From 9168936a0bb9486c5ac2254e2a0c010e40859bac Mon Sep 17 00:00:00 2001 From: John Marino Date: Fri, 17 Apr 2015 09:45:38 +0200 Subject: [PATCH] Update gcc-50 to SVN version 222168 (gcc-5-branch) Last Changed Date: 2015-04-17 09:45:46 +0200 (Fri, 17 Apr 2015) --- contrib/gcc-5.0/LAST_UPDATED | 4 +- contrib/gcc-5.0/gcc/BASE-VER | 2 +- contrib/gcc-5.0/gcc/DATESTAMP | 2 +- contrib/gcc-5.0/gcc/c-family/c-common.c | 4 + contrib/gcc-5.0/gcc/c-family/c-common.h | 4 + contrib/gcc-5.0/gcc/c/c-decl.c | 4 - contrib/gcc-5.0/gcc/c/c-tree.h | 4 - contrib/gcc-5.0/gcc/calls.c | 9 + contrib/gcc-5.0/gcc/cfgrtl.c | 2 +- contrib/gcc-5.0/gcc/cgraphunit.c | 17 + contrib/gcc-5.0/gcc/combine.c | 17 +- contrib/gcc-5.0/gcc/config/i386/i386.c | 41 +- contrib/gcc-5.0/gcc/config/i386/i386.md | 2 +- .../gcc/config/i386/intelmic-mkoffload.c | 15 +- contrib/gcc-5.0/gcc/config/i386/sse.md | 11 +- contrib/gcc-5.0/gcc/cp/constexpr.c | 15 +- contrib/gcc-5.0/gcc/cp/lambda.c | 2 +- contrib/gcc-5.0/gcc/cp/tree.c | 13 +- contrib/gcc-5.0/gcc/doc/avr-mmcu.texi | 79 - contrib/gcc-5.0/gcc/doc/bugreport.texi | 88 - contrib/gcc-5.0/gcc/doc/cfg.texi | 685 - contrib/gcc-5.0/gcc/doc/collect2.texi | 89 - contrib/gcc-5.0/gcc/doc/compat.texi | 156 - contrib/gcc-5.0/gcc/doc/configfiles.texi | 71 - contrib/gcc-5.0/gcc/doc/configterms.texi | 61 - contrib/gcc-5.0/gcc/doc/contrib.texi | 1676 -- contrib/gcc-5.0/gcc/doc/contribute.texi | 24 - contrib/gcc-5.0/gcc/doc/cpp.texi | 4525 --- contrib/gcc-5.0/gcc/doc/cppenv.texi | 82 - contrib/gcc-5.0/gcc/doc/cppinternals.texi | 1066 - contrib/gcc-5.0/gcc/doc/cppopts.texi | 835 - contrib/gcc-5.0/gcc/doc/extend.texi | 19307 ------------ contrib/gcc-5.0/gcc/doc/fragments.texi | 270 - contrib/gcc-5.0/gcc/doc/frontends.texi | 62 - contrib/gcc-5.0/gcc/doc/gcc.texi | 211 - contrib/gcc-5.0/gcc/doc/gccint.texi | 200 - contrib/gcc-5.0/gcc/doc/gcov-tool.texi | 231 - contrib/gcc-5.0/gcc/doc/gcov.texi | 657 - contrib/gcc-5.0/gcc/doc/generic.texi | 3440 --- contrib/gcc-5.0/gcc/doc/gimple.texi | 2739 -- contrib/gcc-5.0/gcc/doc/gnu.texi | 20 - contrib/gcc-5.0/gcc/doc/gty.texi | 705 - contrib/gcc-5.0/gcc/doc/headerdirs.texi | 32 - contrib/gcc-5.0/gcc/doc/hostconfig.texi | 229 - contrib/gcc-5.0/gcc/doc/implement-c.texi | 738 - contrib/gcc-5.0/gcc/doc/implement-cxx.texi | 62 - contrib/gcc-5.0/gcc/doc/include/fdl.texi | 540 - contrib/gcc-5.0/gcc/doc/include/funding.texi | 60 - .../gcc-5.0/gcc/doc/include/gcc-common.texi | 73 - contrib/gcc-5.0/gcc/doc/include/gpl_v3.texi | 733 - contrib/gcc-5.0/gcc/doc/interface.texi | 70 - contrib/gcc-5.0/gcc/doc/invoke.texi | 24252 ---------------- contrib/gcc-5.0/gcc/doc/languages.texi | 36 - contrib/gcc-5.0/gcc/doc/libgcc.texi | 2304 -- contrib/gcc-5.0/gcc/doc/loop.texi | 634 - contrib/gcc-5.0/gcc/doc/lto.texi | 595 - contrib/gcc-5.0/gcc/doc/makefile.texi | 192 - .../gcc-5.0/gcc/doc/match-and-simplify.texi | 354 - contrib/gcc-5.0/gcc/doc/md.texi | 10035 ------- contrib/gcc-5.0/gcc/doc/objc.texi | 1210 - contrib/gcc-5.0/gcc/doc/optinfo.texi | 228 - contrib/gcc-5.0/gcc/doc/options.texi | 499 - contrib/gcc-5.0/gcc/doc/passes.texi | 988 - contrib/gcc-5.0/gcc/doc/plugins.texi | 511 - contrib/gcc-5.0/gcc/doc/portability.texi | 39 - contrib/gcc-5.0/gcc/doc/rtl.texi | 4238 --- contrib/gcc-5.0/gcc/doc/service.texi | 27 - contrib/gcc-5.0/gcc/doc/sourcebuild.texi | 2740 -- contrib/gcc-5.0/gcc/doc/standards.texi | 293 - contrib/gcc-5.0/gcc/doc/tm.texi | 11582 -------- contrib/gcc-5.0/gcc/doc/tree-ssa.texi | 872 - contrib/gcc-5.0/gcc/doc/trouble.texi | 1196 - contrib/gcc-5.0/gcc/dwarf2out.c | 1 + contrib/gcc-5.0/gcc/expr.c | 2 +- contrib/gcc-5.0/gcc/gcov.c | 2 +- contrib/gcc-5.0/gcc/gimple-fold.c | 4 +- contrib/gcc-5.0/gcc/ipa-chkp.c | 6 + contrib/gcc-5.0/gcc/ipa-comdats.c | 12 +- contrib/gcc-5.0/gcc/ipa-cp.c | 1 - contrib/gcc-5.0/gcc/ipa-icf-gimple.c | 10 +- contrib/gcc-5.0/gcc/ipa-icf.c | 41 +- contrib/gcc-5.0/gcc/ipa-inline-analysis.c | 6 +- contrib/gcc-5.0/gcc/ipa-inline-transform.c | 28 +- contrib/gcc-5.0/gcc/ipa-inline.c | 5 +- contrib/gcc-5.0/gcc/ipa-prop.c | 26 +- contrib/gcc-5.0/gcc/ipa-split.c | 18 +- contrib/gcc-5.0/gcc/lra-assigns.c | 15 +- contrib/gcc-5.0/gcc/lra-constraints.c | 3 +- contrib/gcc-5.0/gcc/lra-int.h | 10 + contrib/gcc-5.0/gcc/lra-remat.c | 31 +- contrib/gcc-5.0/gcc/lra.c | 13 + contrib/gcc-5.0/gcc/lto-cgraph.c | 5 +- contrib/gcc-5.0/gcc/omp-low.c | 4 + contrib/gcc-5.0/gcc/params.def | 2 +- contrib/gcc-5.0/gcc/tree-chkp.c | 114 +- contrib/gcc-5.0/gcc/tree-chkp.h | 2 + contrib/gcc-5.0/gcc/tree-ssa-threadedge.c | 12 +- contrib/gcc-5.0/gcc/tree-vect-data-refs.c | 10 +- contrib/gcc-5.0/gcc/tree-vect-loop.c | 83 +- contrib/gcc-5.0/gcc/tree-vectorizer.h | 6 +- contrib/gcc-5.0/gcc/tree.h | 2 +- contrib/gcc-5.0/gcc/ubsan.c | 4 +- contrib/gcc-5.0/gcc/valtrack.c | 31 +- contrib/gcc-5.0/gcc/varasm.c | 5 +- contrib/gcc-5.0/libcpp/files.c | 12 +- contrib/gcc-5.0/libcpp/lex.c | 7 +- contrib/gcc-5.0/libgomp/libgomp-plugin.h | 12 +- contrib/gcc-5.0/libgomp/libgomp.h | 48 +- contrib/gcc-5.0/libgomp/libgomp.map | 1 + contrib/gcc-5.0/libgomp/oacc-async.c | 44 +- contrib/gcc-5.0/libgomp/oacc-cuda.c | 40 +- contrib/gcc-5.0/libgomp/oacc-host.c | 14 +- contrib/gcc-5.0/libgomp/oacc-init.c | 431 +- contrib/gcc-5.0/libgomp/oacc-int.h | 8 +- contrib/gcc-5.0/libgomp/oacc-mem.c | 61 +- contrib/gcc-5.0/libgomp/oacc-parallel.c | 42 +- contrib/gcc-5.0/libgomp/plugin/plugin-host.c | 36 +- contrib/gcc-5.0/libgomp/plugin/plugin-nvptx.c | 318 +- contrib/gcc-5.0/libgomp/target.c | 458 +- contrib/gcc-5.0/libiberty/at-file.texi | 15 - contrib/gcc-5.0/libitm/libitm.texi | 774 - .../libstdc++-v3/config/abi/pre/gnu.ver | 4 +- .../libstdc++-v3/include/bits/atomic_base.h | 5 +- .../gcc-5.0/libstdc++-v3/include/std/atomic | 14 +- .../libstdc++-v3/include/std/shared_mutex | 190 +- 125 files changed, 1396 insertions(+), 104461 deletions(-) delete mode 100644 contrib/gcc-5.0/gcc/doc/avr-mmcu.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/bugreport.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/cfg.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/collect2.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/compat.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/configfiles.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/configterms.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/contrib.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/contribute.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/cpp.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/cppenv.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/cppinternals.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/cppopts.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/extend.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/fragments.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/frontends.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gcc.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gccint.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gcov-tool.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gcov.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/generic.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gimple.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gnu.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/gty.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/headerdirs.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/hostconfig.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/implement-c.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/implement-cxx.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/include/fdl.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/include/funding.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/include/gcc-common.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/include/gpl_v3.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/interface.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/invoke.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/languages.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/libgcc.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/loop.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/lto.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/makefile.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/match-and-simplify.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/md.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/objc.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/optinfo.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/options.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/passes.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/plugins.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/portability.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/rtl.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/service.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/sourcebuild.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/standards.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/tm.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/tree-ssa.texi delete mode 100644 contrib/gcc-5.0/gcc/doc/trouble.texi delete mode 100644 contrib/gcc-5.0/libiberty/at-file.texi delete mode 100644 contrib/gcc-5.0/libitm/libitm.texi diff --git a/contrib/gcc-5.0/LAST_UPDATED b/contrib/gcc-5.0/LAST_UPDATED index 04f3be42b2..7fc42a2cd2 100644 --- a/contrib/gcc-5.0/LAST_UPDATED +++ b/contrib/gcc-5.0/LAST_UPDATED @@ -1,2 +1,2 @@ -221845 -Last Changed Date: 2015-04-02 19:33:22 +0200 (Thu, 02 Apr 2015) +222168 +Last Changed Date: 2015-04-17 09:45:46 +0200 (Fri, 17 Apr 2015) diff --git a/contrib/gcc-5.0/gcc/BASE-VER b/contrib/gcc-5.0/gcc/BASE-VER index 0062ac9718..6b244dcd69 100644 --- a/contrib/gcc-5.0/gcc/BASE-VER +++ b/contrib/gcc-5.0/gcc/BASE-VER @@ -1 +1 @@ -5.0.0 +5.0.1 diff --git a/contrib/gcc-5.0/gcc/DATESTAMP b/contrib/gcc-5.0/gcc/DATESTAMP index 2d34c62fb3..4f5d8b3d3e 100644 --- a/contrib/gcc-5.0/gcc/DATESTAMP +++ b/contrib/gcc-5.0/gcc/DATESTAMP @@ -1 +1 @@ -20150402 +20150417 diff --git a/contrib/gcc-5.0/gcc/c-family/c-common.c b/contrib/gcc-5.0/gcc/c-family/c-common.c index 456c61955c..7fe7fa6007 100644 --- a/contrib/gcc-5.0/gcc/c-family/c-common.c +++ b/contrib/gcc-5.0/gcc/c-family/c-common.c @@ -67,6 +67,10 @@ along with GCC; see the file COPYING3. If not see cpp_reader *parse_in; /* Declared in c-pragma.h. */ +/* Mode used to build pointers (VOIDmode means ptr_mode). */ + +machine_mode c_default_pointer_mode = VOIDmode; + /* The following symbols are subsumed in the c_global_trees array, and listed here individually for documentation purposes. diff --git a/contrib/gcc-5.0/gcc/c-family/c-common.h b/contrib/gcc-5.0/gcc/c-family/c-common.h index 5b2c5ab9c7..cabf452ca1 100644 --- a/contrib/gcc-5.0/gcc/c-family/c-common.h +++ b/contrib/gcc-5.0/gcc/c-family/c-common.h @@ -358,6 +358,10 @@ struct c_common_resword const unsigned int disable : 16; }; +/* Mode used to build pointers (VOIDmode means ptr_mode). */ + +extern machine_mode c_default_pointer_mode; + /* Extra cpp_ttype values for C++. */ /* A token type for template-ids. If a template-id is processed while diff --git a/contrib/gcc-5.0/gcc/c/c-decl.c b/contrib/gcc-5.0/gcc/c/c-decl.c index e1741f1301..e28a294dcc 100644 --- a/contrib/gcc-5.0/gcc/c/c-decl.c +++ b/contrib/gcc-5.0/gcc/c/c-decl.c @@ -168,10 +168,6 @@ static int warn_about_return_type; static bool undef_nested_function; -/* Mode used to build pointers (VOIDmode means ptr_mode). */ - -machine_mode c_default_pointer_mode = VOIDmode; - /* If non-zero, implicit "omp declare target" attribute is added into the attribute lists. */ int current_omp_declare_target_attribute; diff --git a/contrib/gcc-5.0/gcc/c/c-tree.h b/contrib/gcc-5.0/gcc/c/c-tree.h index c879bc77a2..7a7266500b 100644 --- a/contrib/gcc-5.0/gcc/c/c-tree.h +++ b/contrib/gcc-5.0/gcc/c/c-tree.h @@ -671,10 +671,6 @@ extern int current_function_returns_null; extern int current_function_returns_abnormally; -/* Mode used to build pointers (VOIDmode means ptr_mode). */ - -extern machine_mode c_default_pointer_mode; - /* In c-decl.c */ /* Tell the binding oracle what kind of binding we are looking for. */ diff --git a/contrib/gcc-5.0/gcc/calls.c b/contrib/gcc-5.0/gcc/calls.c index ec44624d7c..970415d659 100644 --- a/contrib/gcc-5.0/gcc/calls.c +++ b/contrib/gcc-5.0/gcc/calls.c @@ -1321,6 +1321,15 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, && TREE_CODE (base) != SSA_NAME && (!DECL_P (base) || MEM_P (DECL_RTL (base))))) { + /* We may have turned the parameter value into an SSA name. + Go back to the original parameter so we can take the + address. */ + if (TREE_CODE (args[i].tree_value) == SSA_NAME) + { + gcc_assert (SSA_NAME_IS_DEFAULT_DEF (args[i].tree_value)); + args[i].tree_value = SSA_NAME_VAR (args[i].tree_value); + gcc_assert (TREE_CODE (args[i].tree_value) == PARM_DECL); + } /* Argument setup code may have copied the value to register. We revert that optimization now because the tail call code must use the original location. */ diff --git a/contrib/gcc-5.0/gcc/cfgrtl.c b/contrib/gcc-5.0/gcc/cfgrtl.c index 0e27eddd5a..46fd9588da 100644 --- a/contrib/gcc-5.0/gcc/cfgrtl.c +++ b/contrib/gcc-5.0/gcc/cfgrtl.c @@ -1928,7 +1928,7 @@ rtl_split_edge (edge edge_in) && (edge_in->flags & EDGE_CROSSING)) { after = last_bb_in_partition (edge_in->src); - before = NEXT_INSN (BB_END (after)); + before = get_last_bb_insn (after); /* The instruction following the last bb in partition should be a barrier, since it cannot end in a fall-through. */ gcc_checking_assert (BARRIER_P (before)); diff --git a/contrib/gcc-5.0/gcc/cgraphunit.c b/contrib/gcc-5.0/gcc/cgraphunit.c index 8ac92e1c0c..2315ba84bb 100644 --- a/contrib/gcc-5.0/gcc/cgraphunit.c +++ b/contrib/gcc-5.0/gcc/cgraphunit.c @@ -1508,6 +1508,10 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) tree thunk_fndecl = decl; tree a; + /* Instrumentation thunk is the same function with + a different signature. Never need to expand it. */ + if (thunk.add_pointer_bounds_args) + return false; if (!force_gimple_thunk && this_adjusting && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset, @@ -1581,6 +1585,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) int i; tree resdecl; tree restmp = NULL; + tree resbnd = NULL; gcall *call; greturn *ret; @@ -1697,6 +1702,17 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) gsi_insert_after (&bsi, call, GSI_NEW_STMT); if (!alias_is_noreturn) { + if (instrumentation_clone + && !DECL_BY_REFERENCE (resdecl) + && restmp + && BOUNDED_P (restmp)) + { + resbnd = chkp_insert_retbnd_call (NULL, restmp, &bsi); + create_edge (get_create (gimple_call_fndecl (gsi_stmt (bsi))), + as_a (gsi_stmt (bsi)), + callees->count, callees->frequency); + } + if (restmp && !this_adjusting && (fixed_offset || virtual_offset)) { @@ -1766,6 +1782,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) ret = gimple_build_return (restmp); else ret = gimple_build_return (resdecl); + gimple_return_set_retbnd (ret, resbnd); gsi_insert_after (&bsi, ret, GSI_NEW_STMT); } diff --git a/contrib/gcc-5.0/gcc/combine.c b/contrib/gcc-5.0/gcc/combine.c index 71e5690459..46cd6db62a 100644 --- a/contrib/gcc-5.0/gcc/combine.c +++ b/contrib/gcc-5.0/gcc/combine.c @@ -2492,14 +2492,11 @@ update_cfg_for_uncondjump (rtx_insn *insn) } } -#ifndef HAVE_cc0 -/* Return whether INSN is a PARALLEL of exactly N register SETs followed +/* Return whether PAT is a PARALLEL of exactly N register SETs followed by an arbitrary number of CLOBBERs. */ static bool -is_parallel_of_n_reg_sets (rtx_insn *insn, int n) +is_parallel_of_n_reg_sets (rtx pat, int n) { - rtx pat = PATTERN (insn); - if (GET_CODE (pat) != PARALLEL) return false; @@ -2519,6 +2516,7 @@ is_parallel_of_n_reg_sets (rtx_insn *insn, int n) return true; } +#ifndef HAVE_cc0 /* Return whether INSN, a PARALLEL of N register SETs (and maybe some CLOBBERs), can be split into individual SETs in that order, without changing semantics. */ @@ -2907,7 +2905,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, decrement insn. */ if (i1 == 0 - && is_parallel_of_n_reg_sets (i2, 2) + && is_parallel_of_n_reg_sets (PATTERN (i2), 2) && (GET_MODE_CLASS (GET_MODE (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)))) == MODE_CC) && GET_CODE (SET_SRC (XVECEXP (PATTERN (i2), 0, 0))) == COMPARE @@ -2939,7 +2937,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, make those two SETs separate I1 and I2 insns, and make an I0 that is the original I1. */ if (i0 == 0 - && is_parallel_of_n_reg_sets (i2, 2) + && is_parallel_of_n_reg_sets (PATTERN (i2), 2) && can_split_parallel_of_n_reg_sets (i2, 2) && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3) && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3)) @@ -3460,10 +3458,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, debug info less accurate. */ if (!(added_sets_2 && i1 == 0) - && GET_CODE (newpat) == PARALLEL - && XVECLEN (newpat, 0) == 2 - && GET_CODE (XVECEXP (newpat, 0, 0)) == SET - && GET_CODE (XVECEXP (newpat, 0, 1)) == SET + && is_parallel_of_n_reg_sets (newpat, 2) && asm_noperands (newpat) < 0) { rtx set0 = XVECEXP (newpat, 0, 0); diff --git a/contrib/gcc-5.0/gcc/config/i386/i386.c b/contrib/gcc-5.0/gcc/config/i386/i386.c index d8d9983009..110ec4adc6 100644 --- a/contrib/gcc-5.0/gcc/config/i386/i386.c +++ b/contrib/gcc-5.0/gcc/config/i386/i386.c @@ -5649,7 +5649,7 @@ ix86_handle_cconv_attribute (tree *node, tree name, else if (is_attribute_p ("thiscall", name)) { if (TREE_CODE (*node) != METHOD_TYPE && pedantic) - warning (OPT_Wattributes, "%qE attribute is used for none class-method", + warning (OPT_Wattributes, "%qE attribute is used for non-class method", name); if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node))) { @@ -25624,8 +25624,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, { rtx b0 = gen_rtx_REG (BND64mode, FIRST_BND_REG); rtx b1 = gen_rtx_REG (BND64mode, FIRST_BND_REG + 1); - retval = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (3, retval, b0, b1)); - chkp_put_regs_to_expr_list (retval); + if (GET_CODE (retval) == PARALLEL) + { + b0 = gen_rtx_EXPR_LIST (VOIDmode, b0, const0_rtx); + b1 = gen_rtx_EXPR_LIST (VOIDmode, b1, const0_rtx); + rtx par = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, b0, b1)); + retval = chkp_join_splitted_slot (retval, par); + } + else + { + retval = gen_rtx_PARALLEL (VOIDmode, + gen_rtvec (3, retval, b0, b1)); + chkp_put_regs_to_expr_list (retval); + } } call = gen_rtx_SET (VOIDmode, retval, call); @@ -35852,6 +35863,15 @@ safe_vector_operand (rtx x, machine_mode mode) return x; } +/* Fixup modeless constants to fit required mode. */ +static rtx +fixup_modeless_constant (rtx x, machine_mode mode) +{ + if (GET_MODE (x) == VOIDmode) + x = convert_to_mode (mode, x, 1); + return x; +} + /* Subroutine of ix86_expand_builtin to take care of binop insns. */ static rtx @@ -37498,6 +37518,8 @@ ix86_expand_args_builtin (const struct builtin_description *d, if (memory_operand (op, mode)) num_memory++; + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) { if (optimize || !match || num_memory > 1) @@ -37650,7 +37672,7 @@ ix86_expand_sse_comi_round (const struct builtin_description *d, } if (INTVAL (op2) < 0 || INTVAL (op2) >= 32) { - error ("incorect comparison mode"); + error ("incorrect comparison mode"); return const0_rtx; } @@ -37871,6 +37893,8 @@ ix86_expand_round_builtin (const struct builtin_description *d, if (VECTOR_MODE_P (mode)) op = safe_vector_operand (op, mode); + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) { if (optimize || !match) @@ -38278,6 +38302,8 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, if (VECTOR_MODE_P (mode)) op = safe_vector_operand (op, mode); + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) op = copy_to_mode_reg (mode, op); else @@ -39841,6 +39867,9 @@ addcarryx: op1 = copy_to_mode_reg (Pmode, op1); if (!insn_data[icode].operand[3].predicate (op2, mode2)) op2 = copy_to_mode_reg (mode2, op2); + + op3 = fixup_modeless_constant (op3, mode3); + if (GET_MODE (op3) == mode3 || GET_MODE (op3) == VOIDmode) { if (!insn_data[icode].operand[4].predicate (op3, mode3)) @@ -39984,6 +40013,8 @@ addcarryx: if (!insn_data[icode].operand[0].predicate (op0, Pmode)) op0 = copy_to_mode_reg (Pmode, op0); + op1 = fixup_modeless_constant (op1, mode1); + if (GET_MODE (op1) == mode1 || GET_MODE (op1) == VOIDmode) { if (!insn_data[icode].operand[1].predicate (op1, mode1)) @@ -40030,6 +40061,8 @@ addcarryx: mode3 = insn_data[icode].operand[3].mode; mode4 = insn_data[icode].operand[4].mode; + op0 = fixup_modeless_constant (op0, mode0); + if (GET_MODE (op0) == mode0 || (GET_MODE (op0) == VOIDmode && op0 != constm1_rtx)) { diff --git a/contrib/gcc-5.0/gcc/config/i386/i386.md b/contrib/gcc-5.0/gcc/config/i386/i386.md index cf63afde16..e1c82fefc0 100644 --- a/contrib/gcc-5.0/gcc/config/i386/i386.md +++ b/contrib/gcc-5.0/gcc/config/i386/i386.md @@ -7340,7 +7340,7 @@ (set (match_operand:SWI48 1 "register_operand" "=r") (umod:SWI48 (match_dup 2) (match_dup 3))) (clobber (reg:CC FLAGS_REG))] - "UINTVAL (operands[3]) - 2 < * BITS_PER_UNIT + "IN_RANGE (INTVAL (operands[3]), 2, HOST_WIDE_INT_UC (0x80000000)) && (UINTVAL (operands[3]) & (UINTVAL (operands[3]) - 1)) == 0" "#" "&& 1" diff --git a/contrib/gcc-5.0/gcc/config/i386/intelmic-mkoffload.c b/contrib/gcc-5.0/gcc/config/i386/intelmic-mkoffload.c index f93007c51f..e5e5c35fc4 100644 --- a/contrib/gcc-5.0/gcc/config/i386/intelmic-mkoffload.c +++ b/contrib/gcc-5.0/gcc/config/i386/intelmic-mkoffload.c @@ -350,14 +350,27 @@ generate_host_descr_file (const char *host_compiler) "#ifdef __cplusplus\n" "extern \"C\"\n" "#endif\n" - "void GOMP_offload_register (void *, int, void *);\n\n" + "void GOMP_offload_register (void *, int, void *);\n" + "#ifdef __cplusplus\n" + "extern \"C\"\n" + "#endif\n" + "void GOMP_offload_unregister (void *, int, void *);\n\n" "__attribute__((constructor))\n" "static void\n" "init (void)\n" "{\n" " GOMP_offload_register (&__OFFLOAD_TABLE__, %d, __offload_target_data);\n" + "}\n\n", GOMP_DEVICE_INTEL_MIC); + + fprintf (src_file, + "__attribute__((destructor))\n" + "static void\n" + "fini (void)\n" + "{\n" + " GOMP_offload_unregister (&__OFFLOAD_TABLE__, %d, __offload_target_data);\n" "}\n", GOMP_DEVICE_INTEL_MIC); + fclose (src_file); unsigned new_argc = 0; diff --git a/contrib/gcc-5.0/gcc/config/i386/sse.md b/contrib/gcc-5.0/gcc/config/i386/sse.md index 490fd6b6c3..6d3b54a28c 100644 --- a/contrib/gcc-5.0/gcc/config/i386/sse.md +++ b/contrib/gcc-5.0/gcc/config/i386/sse.md @@ -7015,10 +7015,15 @@ (vec_select: (match_operand:VI8F_256 1 "register_operand" "v,v") (parallel [(const_int 2) (const_int 3)])))] - "TARGET_AVX" + "TARGET_AVX && && " { - if (TARGET_AVX512DQ && TARGET_AVX512VL) - return "vextract64x2\t{$0x1, %1, %0|%0, %1, 0x1}"; + if (TARGET_AVX512VL) + { + if (TARGET_AVX512DQ) + return "vextract64x2\t{$0x1, %1, %0|%0, %1, 0x1}"; + else + return "vextract32x4\t{$0x1, %1, %0|%0, %1, 0x1}"; + } else return "vextract\t{$0x1, %1, %0|%0, %1, 0x1}"; } diff --git a/contrib/gcc-5.0/gcc/cp/constexpr.c b/contrib/gcc-5.0/gcc/cp/constexpr.c index f5be8dfb46..2952cbe1c5 100644 --- a/contrib/gcc-5.0/gcc/cp/constexpr.c +++ b/contrib/gcc-5.0/gcc/cp/constexpr.c @@ -2929,6 +2929,7 @@ cxx_eval_pointer_plus_expression (const constexpr_ctx *ctx, tree t, bool lval, bool *non_constant_p, bool *overflow_p) { + tree orig_type = TREE_TYPE (t); tree op00 = TREE_OPERAND (t, 0); tree op01 = TREE_OPERAND (t, 1); location_t loc = EXPR_LOCATION (t); @@ -2945,7 +2946,9 @@ cxx_eval_pointer_plus_expression (const constexpr_ctx *ctx, tree t, /* &A[i] p+ j => &A[i + j] */ if (TREE_CODE (op00) == ARRAY_REF && TREE_CODE (TREE_OPERAND (op00, 1)) == INTEGER_CST - && TREE_CODE (op01) == INTEGER_CST) + && TREE_CODE (op01) == INTEGER_CST + && TYPE_SIZE_UNIT (TREE_TYPE (op00)) + && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (op00))) == INTEGER_CST) { tree type = TREE_TYPE (op00); t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (op00, 1)); @@ -2953,15 +2956,21 @@ cxx_eval_pointer_plus_expression (const constexpr_ctx *ctx, tree t, /* Don't fold an out-of-bound access. */ if (!tree_int_cst_le (t, nelts)) return NULL_TREE; + op01 = cp_fold_convert (ssizetype, op01); + /* Don't fold if op01 can't be divided exactly by TYPE_SIZE_UNIT. + constexpr int A[1]; ... (char *)&A[0] + 1 */ + if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype, + op01, TYPE_SIZE_UNIT (type)))) + return NULL_TREE; /* Make sure to treat the second operand of POINTER_PLUS_EXPR as signed. */ - op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, - cp_fold_convert (ssizetype, op01), + op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, op01, TYPE_SIZE_UNIT (type)); t = size_binop_loc (loc, PLUS_EXPR, op01, t); t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (op00, 0), t, NULL_TREE, NULL_TREE); t = cp_build_addr_expr (t, tf_warning_or_error); + t = cp_fold_convert (orig_type, t); return cxx_eval_constant_expression (ctx, t, lval, non_constant_p, overflow_p); } diff --git a/contrib/gcc-5.0/gcc/cp/lambda.c b/contrib/gcc-5.0/gcc/cp/lambda.c index b160c8cb7a..dd1c2d4337 100644 --- a/contrib/gcc-5.0/gcc/cp/lambda.c +++ b/contrib/gcc-5.0/gcc/cp/lambda.c @@ -506,7 +506,7 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, if (by_reference_p) { type = build_reference_type (type); - if (!real_lvalue_p (initializer)) + if (!dependent_type_p (type) && !real_lvalue_p (initializer)) error ("cannot capture %qE by reference", initializer); } else diff --git a/contrib/gcc-5.0/gcc/cp/tree.c b/contrib/gcc-5.0/gcc/cp/tree.c index 97bccc0340..71c84ae38e 100644 --- a/contrib/gcc-5.0/gcc/cp/tree.c +++ b/contrib/gcc-5.0/gcc/cp/tree.c @@ -880,12 +880,19 @@ build_cplus_array_type (tree elt_type, tree index_type) { t = build_min_array_type (elt_type, index_type); set_array_type_canon (t, elt_type, index_type); + if (!dependent) + { + layout_type (t); + /* Make sure sizes are shared with the main variant. + layout_type can't be called after setting TYPE_NEXT_VARIANT, + as it will overwrite alignment etc. of all variants. */ + TYPE_SIZE (t) = TYPE_SIZE (m); + TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (m); + } TYPE_MAIN_VARIANT (t) = m; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (m) = t; - if (!dependent) - layout_type (t); } } @@ -1072,6 +1079,8 @@ cp_build_qualified_type_real (tree type, { t = build_variant_type_copy (t); TYPE_NAME (t) = TYPE_NAME (type); + TYPE_ALIGN (t) = TYPE_ALIGN (type); + TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (type); } } diff --git a/contrib/gcc-5.0/gcc/doc/avr-mmcu.texi b/contrib/gcc-5.0/gcc/doc/avr-mmcu.texi deleted file mode 100644 index 1bda5c787c..0000000000 --- a/contrib/gcc-5.0/gcc/doc/avr-mmcu.texi +++ /dev/null @@ -1,79 +0,0 @@ -@c Copyright (C) 2012-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc/doc/include/fdl.texi. - -@c This file is generated automatically using -@c gcc/config/avr/gen-avr-mmcu-texi.c from: -@c gcc/config/avr/avr-arch.h -@c gcc/config/avr/avr-devices.c -@c gcc/config/avr/avr-mcus.def - -@c Please do not edit manually. - -@table @code - -@item avr2 -``Classic'' devices with up to 8@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{attiny22}, @code{attiny26}, @code{at90c8534}, @code{at90s2313}, @code{at90s2323}, @code{at90s2333}, @code{at90s2343}, @code{at90s4414}, @code{at90s4433}, @code{at90s4434}, @code{at90s8515}, @code{at90s8535}. - -@item avr25 -``Classic'' devices with up to 8@tie{}KiB of program memory and with the @code{MOVW} instruction. -@*@var{mcu}@tie{}= @code{ata5272}, @code{ata6616c}, @code{attiny13}, @code{attiny13a}, @code{attiny2313}, @code{attiny2313a}, @code{attiny24}, @code{attiny24a}, @code{attiny25}, @code{attiny261}, @code{attiny261a}, @code{attiny43u}, @code{attiny4313}, @code{attiny44}, @code{attiny44a}, @code{attiny441}, @code{attiny45}, @code{attiny461}, @code{attiny461a}, @code{attiny48}, @code{attiny828}, @code{attiny84}, @code{attiny84a}, @code{attiny841}, @code{attiny85}, @code{attiny861}, @code{attiny861a}, @code{attiny87}, @code{attiny88}, @code{at86rf401}. - -@item avr3 -``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{at43usb355}, @code{at76c711}. - -@item avr31 -``Classic'' devices with 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atmega103}, @code{at43usb320}. - -@item avr35 -``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory and with the @code{MOVW} instruction. -@*@var{mcu}@tie{}= @code{ata5505}, @code{ata6617c}, @code{ata664251}, @code{atmega16u2}, @code{atmega32u2}, @code{atmega8u2}, @code{attiny1634}, @code{attiny167}, @code{at90usb162}, @code{at90usb82}. - -@item avr4 -``Enhanced'' devices with up to 8@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{ata6285}, @code{ata6286}, @code{ata6289}, @code{ata6612c}, @code{atmega48}, @code{atmega48a}, @code{atmega48p}, @code{atmega48pa}, @code{atmega8}, @code{atmega8a}, @code{atmega8hva}, @code{atmega8515}, @code{atmega8535}, @code{atmega88}, @code{atmega88a}, @code{atmega88p}, @code{atmega88pa}, @code{at90pwm1}, @code{at90pwm2}, @code{at90pwm2b}, @code{at90pwm3}, @code{at90pwm3b}, @code{at90pwm81}. - -@item avr5 -``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{ata5702m322}, @code{ata5782}, @code{ata5790}, @code{ata5790n}, @code{ata5795}, @code{ata5831}, @code{ata6613c}, @code{ata6614q}, @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega32}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega325pa}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega328}, @code{atmega328p}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64hve2}, @code{atmega64m1}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega644rfr2}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{at90can32}, @code{at90can64}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}. - -@item avr51 -``Enhanced'' devices with 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atmega128}, @code{atmega128a}, @code{atmega128rfa1}, @code{atmega128rfr2}, @code{atmega1280}, @code{atmega1281}, @code{atmega1284}, @code{atmega1284p}, @code{atmega1284rfr2}, @code{at90can128}, @code{at90usb1286}, @code{at90usb1287}. - -@item avr6 -``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atmega256rfr2}, @code{atmega2560}, @code{atmega2561}, @code{atmega2564rfr2}. - -@item avrxmega2 -``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atxmega16a4}, @code{atxmega16a4u}, @code{atxmega16c4}, @code{atxmega16d4}, @code{atxmega16e5}, @code{atxmega32a4}, @code{atxmega32a4u}, @code{atxmega32c3}, @code{atxmega32c4}, @code{atxmega32d3}, @code{atxmega32d4}, @code{atxmega32e5}, @code{atxmega8e5}. - -@item avrxmega4 -``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64a3u}, @code{atxmega64a4u}, @code{atxmega64b1}, @code{atxmega64b3}, @code{atxmega64c3}, @code{atxmega64d3}, @code{atxmega64d4}. - -@item avrxmega5 -``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. -@*@var{mcu}@tie{}= @code{atxmega64a1}, @code{atxmega64a1u}. - -@item avrxmega6 -``XMEGA'' devices with more than 128@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atxmega128a3}, @code{atxmega128a3u}, @code{atxmega128b1}, @code{atxmega128b3}, @code{atxmega128c3}, @code{atxmega128d3}, @code{atxmega128d4}, @code{atxmega192a3}, @code{atxmega192a3u}, @code{atxmega192c3}, @code{atxmega192d3}, @code{atxmega256a3}, @code{atxmega256a3b}, @code{atxmega256a3bu}, @code{atxmega256a3u}, @code{atxmega256c3}, @code{atxmega256d3}, @code{atxmega384c3}, @code{atxmega384d3}. - -@item avrxmega7 -``XMEGA'' devices with more than 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM. -@*@var{mcu}@tie{}= @code{atxmega128a1}, @code{atxmega128a1u}, @code{atxmega128a4u}. - -@item avrtiny -``TINY'' Tiny core devices with 512@tie{}B up to 4@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{attiny10}, @code{attiny20}, @code{attiny4}, @code{attiny40}, @code{attiny5}, @code{attiny9}. - -@item avr1 -This ISA is implemented by the minimal AVR core and supported for assembler only. -@*@var{mcu}@tie{}= @code{attiny11}, @code{attiny12}, @code{attiny15}, @code{attiny28}, @code{at90s1200}. - -@end table diff --git a/contrib/gcc-5.0/gcc/doc/bugreport.texi b/contrib/gcc-5.0/gcc/doc/bugreport.texi deleted file mode 100644 index 6e02534efd..0000000000 --- a/contrib/gcc-5.0/gcc/doc/bugreport.texi +++ /dev/null @@ -1,88 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Bugs -@chapter Reporting Bugs -@cindex bugs -@cindex reporting bugs - -Your bug reports play an essential role in making GCC reliable. - -When you encounter a problem, the first thing to do is to see if it is -already known. @xref{Trouble}. If it isn't known, then you should -report the problem. - -@menu -* Criteria: Bug Criteria. Have you really found a bug? -* Reporting: Bug Reporting. How to report a bug effectively. -@end menu - -@node Bug Criteria -@section Have You Found a Bug? -@cindex bug criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@cindex fatal signal -@cindex core dump -@item -If the compiler gets a fatal signal, for any input whatever, that is a -compiler bug. Reliable compilers never crash. - -@cindex invalid assembly code -@cindex assembly code, invalid -@item -If the compiler produces invalid assembly code, for any input whatever -(except an @code{asm} statement), that is a compiler bug, unless the -compiler reports errors (not just warnings) which would ordinarily -prevent the assembler from being run. - -@cindex undefined behavior -@cindex undefined function value -@cindex increment operators -@item -If the compiler produces valid assembly code that does not correctly -execute the input source code, that is a compiler bug. - -However, you must double-check to make sure, because you may have a -program whose behavior is undefined, which happened by chance to give -the desired results with another C or C++ compiler. - -For example, in many nonoptimizing compilers, you can write @samp{x;} -at the end of a function instead of @samp{return x;}, with the same -results. But the value of the function is undefined if @code{return} -is omitted; it is not a bug when GCC produces different results. - -Problems often result from expressions with two increment operators, -as in @code{f (*p++, *p++)}. Your previous compiler might have -interpreted that expression the way you intended; GCC might -interpret it another way. Neither compiler is wrong. The bug is -in your code. - -After you have localized the error to a single source line, it should -be easy to check for these things. If your program is correct and -well defined, you have found a compiler bug. - -@item -If the compiler produces an error message for valid input, that is a -compiler bug. - -@cindex invalid input -@item -If the compiler does not produce an error message for invalid input, -that is a compiler bug. However, you should note that your idea of -``invalid input'' might be someone else's idea of ``an extension'' or -``support for traditional practice''. - -@item -If you are an experienced user of one of the languages GCC supports, your -suggestions for improvement of GCC are welcome in any case. -@end itemize - -@node Bug Reporting -@section How and Where to Report Bugs -@cindex compiler bugs, reporting - -Bugs should be reported to the bug database at @value{BUGURL}. diff --git a/contrib/gcc-5.0/gcc/doc/cfg.texi b/contrib/gcc-5.0/gcc/doc/cfg.texi deleted file mode 100644 index b77d9fa7f4..0000000000 --- a/contrib/gcc-5.0/gcc/doc/cfg.texi +++ /dev/null @@ -1,685 +0,0 @@ -@c -*-texinfo-*- -@c Copyright (C) 2001-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@c --------------------------------------------------------------------- -@c Control Flow Graph -@c --------------------------------------------------------------------- - -@node Control Flow -@chapter Control Flow Graph -@cindex CFG, Control Flow Graph -@findex basic-block.h - -A control flow graph (CFG) is a data structure built on top of the -intermediate code representation (the RTL or @code{GIMPLE} instruction -stream) abstracting the control flow behavior of a function that is -being compiled. The CFG is a directed graph where the vertices -represent basic blocks and edges represent possible transfer of -control flow from one basic block to another. The data structures -used to represent the control flow graph are defined in -@file{basic-block.h}. - -In GCC, the representation of control flow is maintained throughout -the compilation process, from constructing the CFG early in -@code{pass_build_cfg} to @code{pass_free_cfg} (see @file{passes.def}). -The CFG takes various different modes and may undergo extensive -manipulations, but the graph is always valid between its construction -and its release. This way, transfer of information such as data flow, -a measured profile, or the loop tree, can be propagated through the -passes pipeline, and even from @code{GIMPLE} to @code{RTL}. - -Often the CFG may be better viewed as integral part of instruction -chain, than structure built on the top of it. Updating the compiler's -intermediate representation for instructions can not be easily done -without proper maintenance of the CFG simultaneously. - -@menu -* Basic Blocks:: The definition and representation of basic blocks. -* Edges:: Types of edges and their representation. -* Profile information:: Representation of frequencies and probabilities. -* Maintaining the CFG:: Keeping the control flow graph and up to date. -* Liveness information:: Using and maintaining liveness information. -@end menu - - -@node Basic Blocks -@section Basic Blocks - -@cindex basic block -@findex basic_block -A basic block is a straight-line sequence of code with only one entry -point and only one exit. In GCC, basic blocks are represented using -the @code{basic_block} data type. - -@findex ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR -Special basic blocks represent possible entry and exit points of a -function. These blocks are called @code{ENTRY_BLOCK_PTR} and -@code{EXIT_BLOCK_PTR}. These blocks do not contain any code. - -@findex BASIC_BLOCK -The @code{BASIC_BLOCK} array contains all basic blocks in an -unspecified order. Each @code{basic_block} structure has a field -that holds a unique integer identifier @code{index} that is the -index of the block in the @code{BASIC_BLOCK} array. -The total number of basic blocks in the function is -@code{n_basic_blocks}. Both the basic block indices and -the total number of basic blocks may vary during the compilation -process, as passes reorder, create, duplicate, and destroy basic -blocks. The index for any block should never be greater than -@code{last_basic_block}. The indices 0 and 1 are special codes -reserved for @code{ENTRY_BLOCK} and @code{EXIT_BLOCK}, the -indices of @code{ENTRY_BLOCK_PTR} and @code{EXIT_BLOCK_PTR}. - -@findex next_bb, prev_bb, FOR_EACH_BB, FOR_ALL_BB -Two pointer members of the @code{basic_block} structure are the -pointers @code{next_bb} and @code{prev_bb}. These are used to keep -doubly linked chain of basic blocks in the same order as the -underlying instruction stream. The chain of basic blocks is updated -transparently by the provided API for manipulating the CFG@. The macro -@code{FOR_EACH_BB} can be used to visit all the basic blocks in -lexicographical order, except @code{ENTRY_BLOCK} and @code{EXIT_BLOCK}. -The macro @code{FOR_ALL_BB} also visits all basic blocks in -lexicographical order, including @code{ENTRY_BLOCK} and @code{EXIT_BLOCK}. - -@findex post_order_compute, inverted_post_order_compute, walk_dominator_tree -The functions @code{post_order_compute} and @code{inverted_post_order_compute} -can be used to compute topological orders of the CFG. The orders are -stored as vectors of basic block indices. The @code{BASIC_BLOCK} array -can be used to iterate each basic block by index. -Dominator traversals are also possible using -@code{walk_dominator_tree}. Given two basic blocks A and B, block A -dominates block B if A is @emph{always} executed before B@. - -Each @code{basic_block} also contains pointers to the first -instruction (the @dfn{head}) and the last instruction (the @dfn{tail}) -or @dfn{end} of the instruction stream contained in a basic block. In -fact, since the @code{basic_block} data type is used to represent -blocks in both major intermediate representations of GCC (@code{GIMPLE} -and RTL), there are pointers to the head and end of a basic block for -both representations, stored in intermediate representation specific -data in the @code{il} field of @code{struct basic_block_def}. - -@findex CODE_LABEL -@findex NOTE_INSN_BASIC_BLOCK -For RTL, these pointers are @code{BB_HEAD} and @code{BB_END}. - -@cindex insn notes, notes -@findex NOTE_INSN_BASIC_BLOCK -In the RTL representation of a function, the instruction stream -contains not only the ``real'' instructions, but also @dfn{notes} -or @dfn{insn notes} (to distinguish them from @dfn{reg notes}). -Any function that moves or duplicates the basic blocks needs -to take care of updating of these notes. Many of these notes expect -that the instruction stream consists of linear regions, so updating -can sometimes be tedious. All types of insn notes are defined -in @file{insn-notes.def}. - -In the RTL function representation, the instructions contained in a -basic block always follow a @code{NOTE_INSN_BASIC_BLOCK}, but zero -or more @code{CODE_LABEL} nodes can precede the block note. -A basic block ends with a control flow instruction or with the last -instruction before the next @code{CODE_LABEL} or -@code{NOTE_INSN_BASIC_BLOCK}. -By definition, a @code{CODE_LABEL} cannot appear in the middle of -the instruction stream of a basic block. - -@findex can_fallthru -@cindex table jump -In addition to notes, the jump table vectors are also represented as -``pseudo-instructions'' inside the insn stream. These vectors never -appear in the basic block and should always be placed just after the -table jump instructions referencing them. After removing the -table-jump it is often difficult to eliminate the code computing the -address and referencing the vector, so cleaning up these vectors is -postponed until after liveness analysis. Thus the jump table vectors -may appear in the insn stream unreferenced and without any purpose. -Before any edge is made @dfn{fall-thru}, the existence of such -construct in the way needs to be checked by calling -@code{can_fallthru} function. - -@cindex GIMPLE statement iterators -For the @code{GIMPLE} representation, the PHI nodes and statements -contained in a basic block are in a @code{gimple_seq} pointed to by -the basic block intermediate language specific pointers. -Abstract containers and iterators are used to access the PHI nodes -and statements in a basic blocks. These iterators are called -@dfn{GIMPLE statement iterators} (GSIs). Grep for @code{^gsi} -in the various @file{gimple-*} and @file{tree-*} files. -There is a @code{gimple_stmt_iterator} type for iterating over -all kinds of statement, and a @code{gphi_iterator} subclass for -iterating over PHI nodes. -The following snippet will pretty-print all PHI nodes the statements -of the current function in the GIMPLE representation. - -@smallexample -basic_block bb; - -FOR_EACH_BB (bb) - @{ - gphi_iterator pi; - gimple_stmt_iterator si; - - for (pi = gsi_start_phis (bb); !gsi_end_p (pi); gsi_next (&pi)) - @{ - gphi *phi = pi.phi (); - print_gimple_stmt (dump_file, phi, 0, TDF_SLIM); - @} - for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) - @{ - gimple stmt = gsi_stmt (si); - print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); - @} - @} -@end smallexample - - -@node Edges -@section Edges - -@cindex edge in the flow graph -@findex edge -Edges represent possible control flow transfers from the end of some -basic block A to the head of another basic block B@. We say that A is -a predecessor of B, and B is a successor of A@. Edges are represented -in GCC with the @code{edge} data type. Each @code{edge} acts as a -link between two basic blocks: The @code{src} member of an edge -points to the predecessor basic block of the @code{dest} basic block. -The members @code{preds} and @code{succs} of the @code{basic_block} data -type point to type-safe vectors of edges to the predecessors and -successors of the block. - -@cindex edge iterators -When walking the edges in an edge vector, @dfn{edge iterators} should -be used. Edge iterators are constructed using the -@code{edge_iterator} data structure and several methods are available -to operate on them: - -@ftable @code -@item ei_start -This function initializes an @code{edge_iterator} that points to the -first edge in a vector of edges. - -@item ei_last -This function initializes an @code{edge_iterator} that points to the -last edge in a vector of edges. - -@item ei_end_p -This predicate is @code{true} if an @code{edge_iterator} represents -the last edge in an edge vector. - -@item ei_one_before_end_p -This predicate is @code{true} if an @code{edge_iterator} represents -the second last edge in an edge vector. - -@item ei_next -This function takes a pointer to an @code{edge_iterator} and makes it -point to the next edge in the sequence. - -@item ei_prev -This function takes a pointer to an @code{edge_iterator} and makes it -point to the previous edge in the sequence. - -@item ei_edge -This function returns the @code{edge} currently pointed to by an -@code{edge_iterator}. - -@item ei_safe_safe -This function returns the @code{edge} currently pointed to by an -@code{edge_iterator}, but returns @code{NULL} if the iterator is -pointing at the end of the sequence. This function has been provided -for existing code makes the assumption that a @code{NULL} edge -indicates the end of the sequence. - -@end ftable - -The convenience macro @code{FOR_EACH_EDGE} can be used to visit all of -the edges in a sequence of predecessor or successor edges. It must -not be used when an element might be removed during the traversal, -otherwise elements will be missed. Here is an example of how to use -the macro: - -@smallexample -edge e; -edge_iterator ei; - -FOR_EACH_EDGE (e, ei, bb->succs) - @{ - if (e->flags & EDGE_FALLTHRU) - break; - @} -@end smallexample - -@findex fall-thru -There are various reasons why control flow may transfer from one block -to another. One possibility is that some instruction, for example a -@code{CODE_LABEL}, in a linearized instruction stream just always -starts a new basic block. In this case a @dfn{fall-thru} edge links -the basic block to the first following basic block. But there are -several other reasons why edges may be created. The @code{flags} -field of the @code{edge} data type is used to store information -about the type of edge we are dealing with. Each edge is of one of -the following types: - -@table @emph -@item jump -No type flags are set for edges corresponding to jump instructions. -These edges are used for unconditional or conditional jumps and in -RTL also for table jumps. They are the easiest to manipulate as they -may be freely redirected when the flow graph is not in SSA form. - -@item fall-thru -@findex EDGE_FALLTHRU, force_nonfallthru -Fall-thru edges are present in case where the basic block may continue -execution to the following one without branching. These edges have -the @code{EDGE_FALLTHRU} flag set. Unlike other types of edges, these -edges must come into the basic block immediately following in the -instruction stream. The function @code{force_nonfallthru} is -available to insert an unconditional jump in the case that redirection -is needed. Note that this may require creation of a new basic block. - -@item exception handling -@cindex exception handling -@findex EDGE_ABNORMAL, EDGE_EH -Exception handling edges represent possible control transfers from a -trapping instruction to an exception handler. The definition of -``trapping'' varies. In C++, only function calls can throw, but for -Java and Ada, exceptions like division by zero or segmentation fault are -defined and thus each instruction possibly throwing this kind of -exception needs to be handled as control flow instruction. Exception -edges have the @code{EDGE_ABNORMAL} and @code{EDGE_EH} flags set. - -@findex purge_dead_edges -When updating the instruction stream it is easy to change possibly -trapping instruction to non-trapping, by simply removing the exception -edge. The opposite conversion is difficult, but should not happen -anyway. The edges can be eliminated via @code{purge_dead_edges} call. - -@findex REG_EH_REGION, EDGE_ABNORMAL_CALL -In the RTL representation, the destination of an exception edge is -specified by @code{REG_EH_REGION} note attached to the insn. -In case of a trapping call the @code{EDGE_ABNORMAL_CALL} flag is set -too. In the @code{GIMPLE} representation, this extra flag is not set. - -@findex may_trap_p, tree_could_trap_p -In the RTL representation, the predicate @code{may_trap_p} may be used -to check whether instruction still may trap or not. For the tree -representation, the @code{tree_could_trap_p} predicate is available, -but this predicate only checks for possible memory traps, as in -dereferencing an invalid pointer location. - - -@item sibling calls -@cindex sibling call -@findex EDGE_ABNORMAL, EDGE_SIBCALL -Sibling calls or tail calls terminate the function in a non-standard -way and thus an edge to the exit must be present. -@code{EDGE_SIBCALL} and @code{EDGE_ABNORMAL} are set in such case. -These edges only exist in the RTL representation. - -@item computed jumps -@cindex computed jump -@findex EDGE_ABNORMAL -Computed jumps contain edges to all labels in the function referenced -from the code. All those edges have @code{EDGE_ABNORMAL} flag set. -The edges used to represent computed jumps often cause compile time -performance problems, since functions consisting of many taken labels -and many computed jumps may have @emph{very} dense flow graphs, so -these edges need to be handled with special care. During the earlier -stages of the compilation process, GCC tries to avoid such dense flow -graphs by factoring computed jumps. For example, given the following -series of jumps, - -@smallexample - goto *x; - [ @dots{} ] - - goto *x; - [ @dots{} ] - - goto *x; - [ @dots{} ] -@end smallexample - -@noindent -factoring the computed jumps results in the following code sequence -which has a much simpler flow graph: - -@smallexample - goto y; - [ @dots{} ] - - goto y; - [ @dots{} ] - - goto y; - [ @dots{} ] - -y: - goto *x; -@end smallexample - -@findex pass_duplicate_computed_gotos -However, the classic problem with this transformation is that it has a -runtime cost in there resulting code: An extra jump. Therefore, the -computed jumps are un-factored in the later passes of the compiler -(in the pass called @code{pass_duplicate_computed_gotos}). -Be aware of that when you work on passes in that area. There have -been numerous examples already where the compile time for code with -unfactored computed jumps caused some serious headaches. - -@item nonlocal goto handlers -@cindex nonlocal goto handler -@findex EDGE_ABNORMAL, EDGE_ABNORMAL_CALL -GCC allows nested functions to return into caller using a @code{goto} -to a label passed to as an argument to the callee. The labels passed -to nested functions contain special code to cleanup after function -call. Such sections of code are referred to as ``nonlocal goto -receivers''. If a function contains such nonlocal goto receivers, an -edge from the call to the label is created with the -@code{EDGE_ABNORMAL} and @code{EDGE_ABNORMAL_CALL} flags set. - -@item function entry points -@cindex function entry point, alternate function entry point -@findex LABEL_ALTERNATE_NAME -By definition, execution of function starts at basic block 0, so there -is always an edge from the @code{ENTRY_BLOCK_PTR} to basic block 0. -There is no @code{GIMPLE} representation for alternate entry points at -this moment. In RTL, alternate entry points are specified by -@code{CODE_LABEL} with @code{LABEL_ALTERNATE_NAME} defined. This -feature is currently used for multiple entry point prologues and is -limited to post-reload passes only. This can be used by back-ends to -emit alternate prologues for functions called from different contexts. -In future full support for multiple entry functions defined by Fortran -90 needs to be implemented. - -@item function exits -In the pre-reload representation a function terminates after the last -instruction in the insn chain and no explicit return instructions are -used. This corresponds to the fall-thru edge into exit block. After -reload, optimal RTL epilogues are used that use explicit (conditional) -return instructions that are represented by edges with no flags set. - -@end table - - -@node Profile information -@section Profile information - -@cindex profile representation -In many cases a compiler must make a choice whether to trade speed in -one part of code for speed in another, or to trade code size for code -speed. In such cases it is useful to know information about how often -some given block will be executed. That is the purpose for -maintaining profile within the flow graph. -GCC can handle profile information obtained through @dfn{profile -feedback}, but it can also estimate branch probabilities based on -statics and heuristics. - -@cindex profile feedback -The feedback based profile is produced by compiling the program with -instrumentation, executing it on a train run and reading the numbers -of executions of basic blocks and edges back to the compiler while -re-compiling the program to produce the final executable. This method -provides very accurate information about where a program spends most -of its time on the train run. Whether it matches the average run of -course depends on the choice of train data set, but several studies -have shown that the behavior of a program usually changes just -marginally over different data sets. - -@cindex Static profile estimation -@cindex branch prediction -@findex predict.def -When profile feedback is not available, the compiler may be asked to -attempt to predict the behavior of each branch in the program using a -set of heuristics (see @file{predict.def} for details) and compute -estimated frequencies of each basic block by propagating the -probabilities over the graph. - -@findex frequency, count, BB_FREQ_BASE -Each @code{basic_block} contains two integer fields to represent -profile information: @code{frequency} and @code{count}. The -@code{frequency} is an estimation how often is basic block executed -within a function. It is represented as an integer scaled in the -range from 0 to @code{BB_FREQ_BASE}. The most frequently executed -basic block in function is initially set to @code{BB_FREQ_BASE} and -the rest of frequencies are scaled accordingly. During optimization, -the frequency of the most frequent basic block can both decrease (for -instance by loop unrolling) or grow (for instance by cross-jumping -optimization), so scaling sometimes has to be performed multiple -times. - -@findex gcov_type -The @code{count} contains hard-counted numbers of execution measured -during training runs and is nonzero only when profile feedback is -available. This value is represented as the host's widest integer -(typically a 64 bit integer) of the special type @code{gcov_type}. - -Most optimization passes can use only the frequency information of a -basic block, but a few passes may want to know hard execution counts. -The frequencies should always match the counts after scaling, however -during updating of the profile information numerical error may -accumulate into quite large errors. - -@findex REG_BR_PROB_BASE, EDGE_FREQUENCY -Each edge also contains a branch probability field: an integer in the -range from 0 to @code{REG_BR_PROB_BASE}. It represents probability of -passing control from the end of the @code{src} basic block to the -@code{dest} basic block, i.e.@: the probability that control will flow -along this edge. The @code{EDGE_FREQUENCY} macro is available to -compute how frequently a given edge is taken. There is a @code{count} -field for each edge as well, representing same information as for a -basic block. - -The basic block frequencies are not represented in the instruction -stream, but in the RTL representation the edge frequencies are -represented for conditional jumps (via the @code{REG_BR_PROB} -macro) since they are used when instructions are output to the -assembly file and the flow graph is no longer maintained. - -@cindex reverse probability -The probability that control flow arrives via a given edge to its -destination basic block is called @dfn{reverse probability} and is not -directly represented, but it may be easily computed from frequencies -of basic blocks. - -@findex redirect_edge_and_branch -Updating profile information is a delicate task that can unfortunately -not be easily integrated with the CFG manipulation API@. Many of the -functions and hooks to modify the CFG, such as -@code{redirect_edge_and_branch}, do not have enough information to -easily update the profile, so updating it is in the majority of cases -left up to the caller. It is difficult to uncover bugs in the profile -updating code, because they manifest themselves only by producing -worse code, and checking profile consistency is not possible because -of numeric error accumulation. Hence special attention needs to be -given to this issue in each pass that modifies the CFG@. - -@findex REG_BR_PROB_BASE, BB_FREQ_BASE, count -It is important to point out that @code{REG_BR_PROB_BASE} and -@code{BB_FREQ_BASE} are both set low enough to be possible to compute -second power of any frequency or probability in the flow graph, it is -not possible to even square the @code{count} field, as modern CPUs are -fast enough to execute $2^32$ operations quickly. - - -@node Maintaining the CFG -@section Maintaining the CFG -@findex cfghooks.h - -An important task of each compiler pass is to keep both the control -flow graph and all profile information up-to-date. Reconstruction of -the control flow graph after each pass is not an option, since it may be -very expensive and lost profile information cannot be reconstructed at -all. - -GCC has two major intermediate representations, and both use the -@code{basic_block} and @code{edge} data types to represent control -flow. Both representations share as much of the CFG maintenance code -as possible. For each representation, a set of @dfn{hooks} is defined -so that each representation can provide its own implementation of CFG -manipulation routines when necessary. These hooks are defined in -@file{cfghooks.h}. There are hooks for almost all common CFG -manipulations, including block splitting and merging, edge redirection -and creating and deleting basic blocks. These hooks should provide -everything you need to maintain and manipulate the CFG in both the RTL -and @code{GIMPLE} representation. - -At the moment, the basic block boundaries are maintained transparently -when modifying instructions, so there rarely is a need to move them -manually (such as in case someone wants to output instruction outside -basic block explicitly). - -@findex BLOCK_FOR_INSN, gimple_bb -In the RTL representation, each instruction has a -@code{BLOCK_FOR_INSN} value that represents pointer to the basic block -that contains the instruction. In the @code{GIMPLE} representation, the -function @code{gimple_bb} returns a pointer to the basic block -containing the queried statement. - -@cindex GIMPLE statement iterators -When changes need to be applied to a function in its @code{GIMPLE} -representation, @dfn{GIMPLE statement iterators} should be used. These -iterators provide an integrated abstraction of the flow graph and the -instruction stream. Block statement iterators are constructed using -the @code{gimple_stmt_iterator} data structure and several modifier are -available, including the following: - -@ftable @code -@item gsi_start -This function initializes a @code{gimple_stmt_iterator} that points to -the first non-empty statement in a basic block. - -@item gsi_last -This function initializes a @code{gimple_stmt_iterator} that points to -the last statement in a basic block. - -@item gsi_end_p -This predicate is @code{true} if a @code{gimple_stmt_iterator} -represents the end of a basic block. - -@item gsi_next -This function takes a @code{gimple_stmt_iterator} and makes it point to -its successor. - -@item gsi_prev -This function takes a @code{gimple_stmt_iterator} and makes it point to -its predecessor. - -@item gsi_insert_after -This function inserts a statement after the @code{gimple_stmt_iterator} -passed in. The final parameter determines whether the statement -iterator is updated to point to the newly inserted statement, or left -pointing to the original statement. - -@item gsi_insert_before -This function inserts a statement before the @code{gimple_stmt_iterator} -passed in. The final parameter determines whether the statement -iterator is updated to point to the newly inserted statement, or left -pointing to the original statement. - -@item gsi_remove -This function removes the @code{gimple_stmt_iterator} passed in and -rechains the remaining statements in a basic block, if any. -@end ftable - -@findex BB_HEAD, BB_END -In the RTL representation, the macros @code{BB_HEAD} and @code{BB_END} -may be used to get the head and end @code{rtx} of a basic block. No -abstract iterators are defined for traversing the insn chain, but you -can just use @code{NEXT_INSN} and @code{PREV_INSN} instead. @xref{Insns}. - -@findex purge_dead_edges -Usually a code manipulating pass simplifies the instruction stream and -the flow of control, possibly eliminating some edges. This may for -example happen when a conditional jump is replaced with an -unconditional jump, but also when simplifying possibly trapping -instruction to non-trapping while compiling Java. Updating of edges -is not transparent and each optimization pass is required to do so -manually. However only few cases occur in practice. The pass may -call @code{purge_dead_edges} on a given basic block to remove -superfluous edges, if any. - -@findex redirect_edge_and_branch, redirect_jump -Another common scenario is redirection of branch instructions, but -this is best modeled as redirection of edges in the control flow graph -and thus use of @code{redirect_edge_and_branch} is preferred over more -low level functions, such as @code{redirect_jump} that operate on RTL -chain only. The CFG hooks defined in @file{cfghooks.h} should provide -the complete API required for manipulating and maintaining the CFG@. - -@findex split_block -It is also possible that a pass has to insert control flow instruction -into the middle of a basic block, thus creating an entry point in the -middle of the basic block, which is impossible by definition: The -block must be split to make sure it only has one entry point, i.e.@: the -head of the basic block. The CFG hook @code{split_block} may be used -when an instruction in the middle of a basic block has to become the -target of a jump or branch instruction. - -@findex insert_insn_on_edge -@findex commit_edge_insertions -@findex gsi_insert_on_edge -@findex gsi_commit_edge_inserts -@cindex edge splitting -For a global optimizer, a common operation is to split edges in the -flow graph and insert instructions on them. In the RTL -representation, this can be easily done using the -@code{insert_insn_on_edge} function that emits an instruction -``on the edge'', caching it for a later @code{commit_edge_insertions} -call that will take care of moving the inserted instructions off the -edge into the instruction stream contained in a basic block. This -includes the creation of new basic blocks where needed. In the -@code{GIMPLE} representation, the equivalent functions are -@code{gsi_insert_on_edge} which inserts a block statement -iterator on an edge, and @code{gsi_commit_edge_inserts} which flushes -the instruction to actual instruction stream. - -@findex verify_flow_info -@cindex CFG verification -While debugging the optimization pass, the @code{verify_flow_info} -function may be useful to find bugs in the control flow graph updating -code. - - -@node Liveness information -@section Liveness information -@cindex Liveness representation -Liveness information is useful to determine whether some register is -``live'' at given point of program, i.e.@: that it contains a value that -may be used at a later point in the program. This information is -used, for instance, during register allocation, as the pseudo -registers only need to be assigned to a unique hard register or to a -stack slot if they are live. The hard registers and stack slots may -be freely reused for other values when a register is dead. - -Liveness information is available in the back end starting with -@code{pass_df_initialize} and ending with @code{pass_df_finish}. Three -flavors of live analysis are available: With @code{LR}, it is possible -to determine at any point @code{P} in the function if the register may be -used on some path from @code{P} to the end of the function. With -@code{UR}, it is possible to determine if there is a path from the -beginning of the function to @code{P} that defines the variable. -@code{LIVE} is the intersection of the @code{LR} and @code{UR} and a -variable is live at @code{P} if there is both an assignment that reaches -it from the beginning of the function and a use that can be reached on -some path from @code{P} to the end of the function. - -In general @code{LIVE} is the most useful of the three. The macros -@code{DF_[LR,UR,LIVE]_[IN,OUT]} can be used to access this information. -The macros take a basic block number and return a bitmap that is indexed -by the register number. This information is only guaranteed to be up to -date after calls are made to @code{df_analyze}. See the file -@code{df-core.c} for details on using the dataflow. - - -@findex REG_DEAD, REG_UNUSED -The liveness information is stored partly in the RTL instruction stream -and partly in the flow graph. Local information is stored in the -instruction stream: Each instruction may contain @code{REG_DEAD} notes -representing that the value of a given register is no longer needed, or -@code{REG_UNUSED} notes representing that the value computed by the -instruction is never used. The second is useful for instructions -computing multiple values at once. - diff --git a/contrib/gcc-5.0/gcc/doc/collect2.texi b/contrib/gcc-5.0/gcc/doc/collect2.texi deleted file mode 100644 index f3ebaceb9a..0000000000 --- a/contrib/gcc-5.0/gcc/doc/collect2.texi +++ /dev/null @@ -1,89 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Collect2 -@chapter @code{collect2} - -GCC uses a utility called @code{collect2} on nearly all systems to arrange -to call various initialization functions at start time. - -The program @code{collect2} works by linking the program once and -looking through the linker output file for symbols with particular names -indicating they are constructor functions. If it finds any, it -creates a new temporary @samp{.c} file containing a table of them, -compiles it, and links the program a second time including that file. - -@findex __main -@cindex constructors, automatic calls -The actual calls to the constructors are carried out by a subroutine -called @code{__main}, which is called (automatically) at the beginning -of the body of @code{main} (provided @code{main} was compiled with GNU -CC)@. Calling @code{__main} is necessary, even when compiling C code, to -allow linking C and C++ object code together. (If you use -@option{-nostdlib}, you get an unresolved reference to @code{__main}, -since it's defined in the standard GCC library. Include @option{-lgcc} at -the end of your compiler command line to resolve this reference.) - -The program @code{collect2} is installed as @code{ld} in the directory -where the passes of the compiler are installed. When @code{collect2} -needs to find the @emph{real} @code{ld}, it tries the following file -names: - -@itemize @bullet -@item -a hard coded linker file name, if GCC was configured with the -@option{--with-ld} option. - -@item -@file{real-ld} in the directories listed in the compiler's search -directories. - -@item -@file{real-ld} in the directories listed in the environment variable -@code{PATH}. - -@item -The file specified in the @code{REAL_LD_FILE_NAME} configuration macro, -if specified. - -@item -@file{ld} in the compiler's search directories, except that -@code{collect2} will not execute itself recursively. - -@item -@file{ld} in @code{PATH}. -@end itemize - -``The compiler's search directories'' means all the directories where -@command{gcc} searches for passes of the compiler. This includes -directories that you specify with @option{-B}. - -Cross-compilers search a little differently: - -@itemize @bullet -@item -@file{real-ld} in the compiler's search directories. - -@item -@file{@var{target}-real-ld} in @code{PATH}. - -@item -The file specified in the @code{REAL_LD_FILE_NAME} configuration macro, -if specified. - -@item -@file{ld} in the compiler's search directories. - -@item -@file{@var{target}-ld} in @code{PATH}. -@end itemize - -@code{collect2} explicitly avoids running @code{ld} using the file name -under which @code{collect2} itself was invoked. In fact, it remembers -up a list of such names---in case one copy of @code{collect2} finds -another copy (or version) of @code{collect2} installed as @code{ld} in a -second place in the search path. - -@code{collect2} searches for the utilities @code{nm} and @code{strip} -using the same algorithm as above for @code{ld}. diff --git a/contrib/gcc-5.0/gcc/doc/compat.texi b/contrib/gcc-5.0/gcc/doc/compat.texi deleted file mode 100644 index c4c899a056..0000000000 --- a/contrib/gcc-5.0/gcc/doc/compat.texi +++ /dev/null @@ -1,156 +0,0 @@ -@c Copyright (C) 2002-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Compatibility -@chapter Binary Compatibility -@cindex binary compatibility -@cindex ABI -@cindex application binary interface - -Binary compatibility encompasses several related concepts: - -@table @dfn -@item application binary interface (ABI) -The set of runtime conventions followed by all of the tools that deal -with binary representations of a program, including compilers, assemblers, -linkers, and language runtime support. -Some ABIs are formal with a written specification, possibly designed -by multiple interested parties. Others are simply the way things are -actually done by a particular set of tools. - -@item ABI conformance -A compiler conforms to an ABI if it generates code that follows all of -the specifications enumerated by that ABI@. -A library conforms to an ABI if it is implemented according to that ABI@. -An application conforms to an ABI if it is built using tools that conform -to that ABI and does not contain source code that specifically changes -behavior specified by the ABI@. - -@item calling conventions -Calling conventions are a subset of an ABI that specify of how arguments -are passed and function results are returned. - -@item interoperability -Different sets of tools are interoperable if they generate files that -can be used in the same program. The set of tools includes compilers, -assemblers, linkers, libraries, header files, startup files, and debuggers. -Binaries produced by different sets of tools are not interoperable unless -they implement the same ABI@. This applies to different versions of the -same tools as well as tools from different vendors. - -@item intercallability -Whether a function in a binary built by one set of tools can call a -function in a binary built by a different set of tools is a subset -of interoperability. - -@item implementation-defined features -Language standards include lists of implementation-defined features whose -behavior can vary from one implementation to another. Some of these -features are normally covered by a platform's ABI and others are not. -The features that are not covered by an ABI generally affect how a -program behaves, but not intercallability. - -@item compatibility -Conformance to the same ABI and the same behavior of implementation-defined -features are both relevant for compatibility. -@end table - -The application binary interface implemented by a C or C++ compiler -affects code generation and runtime support for: - -@itemize @bullet -@item -size and alignment of data types -@item -layout of structured types -@item -calling conventions -@item -register usage conventions -@item -interfaces for runtime arithmetic support -@item -object file formats -@end itemize - -In addition, the application binary interface implemented by a C++ compiler -affects code generation and runtime support for: -@itemize @bullet -@item -name mangling -@item -exception handling -@item -invoking constructors and destructors -@item -layout, alignment, and padding of classes -@item -layout and alignment of virtual tables -@end itemize - -Some GCC compilation options cause the compiler to generate code that -does not conform to the platform's default ABI@. Other options cause -different program behavior for implementation-defined features that are -not covered by an ABI@. These options are provided for consistency with -other compilers that do not follow the platform's default ABI or the -usual behavior of implementation-defined features for the platform. -Be very careful about using such options. - -Most platforms have a well-defined ABI that covers C code, but ABIs -that cover C++ functionality are not yet common. - -Starting with GCC 3.2, GCC binary conventions for C++ are based on a -written, vendor-neutral C++ ABI that was designed to be specific to -64-bit Itanium but also includes generic specifications that apply to -any platform. -This C++ ABI is also implemented by other compiler vendors on some -platforms, notably GNU/Linux and BSD systems. -We have tried hard to provide a stable ABI that will be compatible with -future GCC releases, but it is possible that we will encounter problems -that make this difficult. Such problems could include different -interpretations of the C++ ABI by different vendors, bugs in the ABI, or -bugs in the implementation of the ABI in different compilers. -GCC's @option{-Wabi} switch warns when G++ generates code that is -probably not compatible with the C++ ABI@. - -The C++ library used with a C++ compiler includes the Standard C++ -Library, with functionality defined in the C++ Standard, plus language -runtime support. The runtime support is included in a C++ ABI, but there -is no formal ABI for the Standard C++ Library. Two implementations -of that library are interoperable if one follows the de-facto ABI of the -other and if they are both built with the same compiler, or with compilers -that conform to the same ABI for C++ compiler and runtime support. - -When G++ and another C++ compiler conform to the same C++ ABI, but the -implementations of the Standard C++ Library that they normally use do not -follow the same ABI for the Standard C++ Library, object files built with -those compilers can be used in the same program only if they use the same -C++ library. This requires specifying the location of the C++ library -header files when invoking the compiler whose usual library is not being -used. The location of GCC's C++ header files depends on how the GCC -build was configured, but can be seen by using the G++ @option{-v} option. -With default configuration options for G++ 3.3 the compile line for a -different C++ compiler needs to include - -@smallexample - -I@var{gcc_install_directory}/include/c++/3.3 -@end smallexample - -Similarly, compiling code with G++ that must use a C++ library other -than the GNU C++ library requires specifying the location of the header -files for that other library. - -The most straightforward way to link a program to use a particular -C++ library is to use a C++ driver that specifies that C++ library by -default. The @command{g++} driver, for example, tells the linker where -to find GCC's C++ library (@file{libstdc++}) plus the other libraries -and startup files it needs, in the proper order. - -If a program must use a different C++ library and it's not possible -to do the final link using a C++ driver that uses that library by default, -it is necessary to tell @command{g++} the location and name of that -library. It might also be necessary to specify different startup files -and other runtime support libraries, and to suppress the use of GCC's -support libraries with one or more of the options @option{-nostdlib}, -@option{-nostartfiles}, and @option{-nodefaultlibs}. diff --git a/contrib/gcc-5.0/gcc/doc/configfiles.texi b/contrib/gcc-5.0/gcc/doc/configfiles.texi deleted file mode 100644 index 4bfd5ecb49..0000000000 --- a/contrib/gcc-5.0/gcc/doc/configfiles.texi +++ /dev/null @@ -1,71 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Configuration Files -@subsubsection Files Created by @code{configure} - -Here we spell out what files will be set up by @file{configure} in the -@file{gcc} directory. Some other files are created as temporary files -in the configuration process, and are not used in the subsequent -build; these are not documented. - -@itemize @bullet -@item -@file{Makefile} is constructed from @file{Makefile.in}, together with -the host and target fragments (@pxref{Fragments, , Makefile -Fragments}) @file{t-@var{target}} and @file{x-@var{host}} from -@file{config}, if any, and language Makefile fragments -@file{@var{language}/Make-lang.in}. -@item -@file{auto-host.h} contains information about the host machine -determined by @file{configure}. If the host machine is different from -the build machine, then @file{auto-build.h} is also created, -containing such information about the build machine. -@item -@file{config.status} is a script that may be run to recreate the -current configuration. -@item -@file{configargs.h} is a header containing details of the arguments -passed to @file{configure} to configure GCC, and of the thread model -used. -@item -@file{cstamp-h} is used as a timestamp. -@item -If a language @file{config-lang.in} file (@pxref{Front End Config, , -The Front End @file{config-lang.in} File}) sets @code{outputs}, then -the files listed in @code{outputs} there are also generated. -@end itemize - -The following configuration headers are created from the Makefile, -using @file{mkconfig.sh}, rather than directly by @file{configure}. -@file{config.h}, @file{bconfig.h} and @file{tconfig.h} all contain the -@file{xm-@var{machine}.h} header, if any, appropriate to the host, -build and target machines respectively, the configuration headers for -the target, and some definitions; for the host and build machines, -these include the autoconfigured headers generated by -@file{configure}. The other configuration headers are determined by -@file{config.gcc}. They also contain the typedefs for @code{rtx}, -@code{rtvec} and @code{tree}. - -@itemize @bullet -@item -@file{config.h}, for use in programs that run on the host machine. -@item -@file{bconfig.h}, for use in programs that run on the build machine. -@item -@file{tconfig.h}, for use in programs and libraries for the target -machine. -@item -@file{tm_p.h}, which includes the header @file{@var{machine}-protos.h} -that contains prototypes for functions in the target -@file{@var{machine}.c} file. The header @file{@var{machine}-protos.h} -can include prototypes of functions that use rtl and tree data -structures inside appropriate @code{#ifdef RTX_CODE} and @code{#ifdef -TREE_CODE} conditional code segements. The -@file{@var{machine}-protos.h} is included after the @file{rtl.h} -and/or @file{tree.h} would have been included. The @file{tm_p.h} also -includes the header @file{tm-preds.h} which is generated by -@file{genpreds} program during the build to define the declarations -and inline functions for the predicate functions. -@end itemize diff --git a/contrib/gcc-5.0/gcc/doc/configterms.texi b/contrib/gcc-5.0/gcc/doc/configterms.texi deleted file mode 100644 index 6eb0c95641..0000000000 --- a/contrib/gcc-5.0/gcc/doc/configterms.texi +++ /dev/null @@ -1,61 +0,0 @@ -@c Copyright (C) 2001-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Configure Terms -@section Configure Terms and History -@cindex configure terms -@cindex canadian - -The configure and build process has a long and colorful history, and can -be confusing to anyone who doesn't know why things are the way they are. -While there are other documents which describe the configuration process -in detail, here are a few things that everyone working on GCC should -know. - -There are three system names that the build knows about: the machine you -are building on (@dfn{build}), the machine that you are building for -(@dfn{host}), and the machine that GCC will produce code for -(@dfn{target}). When you configure GCC, you specify these with -@option{--build=}, @option{--host=}, and @option{--target=}. - -Specifying the host without specifying the build should be avoided, as -@command{configure} may (and once did) assume that the host you specify -is also the build, which may not be true. - -If build, host, and target are all the same, this is called a -@dfn{native}. If build and host are the same but target is different, -this is called a @dfn{cross}. If build, host, and target are all -different this is called a @dfn{canadian} (for obscure reasons dealing -with Canada's political party and the background of the person working -on the build at that time). If host and target are the same, but build -is different, you are using a cross-compiler to build a native for a -different system. Some people call this a @dfn{host-x-host}, -@dfn{crossed native}, or @dfn{cross-built native}. If build and target -are the same, but host is different, you are using a cross compiler to -build a cross compiler that produces code for the machine you're -building on. This is rare, so there is no common way of describing it. -There is a proposal to call this a @dfn{crossback}. - -If build and host are the same, the GCC you are building will also be -used to build the target libraries (like @code{libstdc++}). If build and host -are different, you must have already built and installed a cross -compiler that will be used to build the target libraries (if you -configured with @option{--target=foo-bar}, this compiler will be called -@command{foo-bar-gcc}). - -In the case of target libraries, the machine you're building for is the -machine you specified with @option{--target}. So, build is the machine -you're building on (no change there), host is the machine you're -building for (the target libraries are built for the target, so host is -the target you specified), and target doesn't apply (because you're not -building a compiler, you're building libraries). The configure/make -process will adjust these variables as needed. It also sets -@code{$with_cross_host} to the original @option{--host} value in case you -need it. - -The @code{libiberty} support library is built up to three times: once -for the host, once for the target (even if they are the same), and once -for the build if build and host are different. This allows it to be -used by all programs which are generated in the course of the build -process. diff --git a/contrib/gcc-5.0/gcc/doc/contrib.texi b/contrib/gcc-5.0/gcc/doc/contrib.texi deleted file mode 100644 index 9935ac7d6c..0000000000 --- a/contrib/gcc-5.0/gcc/doc/contrib.texi +++ /dev/null @@ -1,1676 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Contributors -@unnumbered Contributors to GCC -@cindex contributors - -The GCC project would like to thank its many contributors. Without them the -project would not have been nearly as successful as it has been. Any omissions -in this list are accidental. Feel free to contact -@email{law@@redhat.com} or @email{gerald@@pfeifer.com} if you have been left -out or some of your contributions are not listed. Please keep this list in -alphabetical order. - -@itemize @bullet - -@item -Analog Devices helped implement the support for complex data types -and iterators. - -@item -John David Anglin for threading-related fixes and improvements to -libstdc++-v3, and the HP-UX port. - -@item -James van Artsdalen wrote the code that makes efficient use of -the Intel 80387 register stack. - -@item -Abramo and Roberto Bagnara for the SysV68 Motorola 3300 Delta Series -port. - -@item -Alasdair Baird for various bug fixes. - -@item -Giovanni Bajo for analyzing lots of complicated C++ problem reports. - -@item -Peter Barada for his work to improve code generation for new -ColdFire cores. - -@item -Gerald Baumgartner added the signature extension to the C++ front end. - -@item -Godmar Back for his Java improvements and encouragement. - -@item -Scott Bambrough for help porting the Java compiler. - -@item -Wolfgang Bangerth for processing tons of bug reports. - -@item -Jon Beniston for his Microsoft Windows port of Java and port to Lattice Mico32. - -@item -Daniel Berlin for better DWARF2 support, faster/better optimizations, -improved alias analysis, plus migrating GCC to Bugzilla. - -@item -Geoff Berry for his Java object serialization work and various patches. - -@item -David Binderman tests weekly snapshots of GCC trunk against Fedora Rawhide -for several architectures. - -@item -Uros Bizjak for the implementation of x87 math built-in functions and -for various middle end and i386 back end improvements and bug fixes. - -@item -Eric Blake for helping to make GCJ and libgcj conform to the -specifications. - -@item -Janne Blomqvist for contributions to GNU Fortran. - -@item -Segher Boessenkool for various fixes. - -@item -Hans-J. Boehm for his @uref{http://www.hpl.hp.com/@/personal/@/Hans_Boehm/@/gc/,, -garbage collector}, IA-64 libffi port, and other Java work. - -@item -Neil Booth for work on cpplib, lang hooks, debug hooks and other -miscellaneous clean-ups. - -@item -Steven Bosscher for integrating the GNU Fortran front end into GCC and for -contributing to the tree-ssa branch. - -@item -Eric Botcazou for fixing middle- and backend bugs left and right. - -@item -Per Bothner for his direction via the steering committee and various -improvements to the infrastructure for supporting new languages. Chill -front end implementation. Initial implementations of -cpplib, fix-header, config.guess, libio, and past C++ library (libg++) -maintainer. Dreaming up, designing and implementing much of GCJ@. - -@item -Devon Bowen helped port GCC to the Tahoe. - -@item -Don Bowman for mips-vxworks contributions. - -@item -Dave Brolley for work on cpplib and Chill. - -@item -Paul Brook for work on the ARM architecture and maintaining GNU Fortran. - -@item -Robert Brown implemented the support for Encore 32000 systems. - -@item -Christian Bruel for improvements to local store elimination. - -@item -Herman A.J. ten Brugge for various fixes. - -@item -Joerg Brunsmann for Java compiler hacking and help with the GCJ FAQ@. - -@item -Joe Buck for his direction via the steering committee. - -@item -Craig Burley for leadership of the G77 Fortran effort. - -@item -Stephan Buys for contributing Doxygen notes for libstdc++. - -@item -Paolo Carlini for libstdc++ work: lots of efficiency improvements to -the C++ strings, streambufs and formatted I/O, hard detective work on -the frustrating localization issues, and keeping up with the problem reports. - -@item -John Carr for his alias work, SPARC hacking, infrastructure improvements, -previous contributions to the steering committee, loop optimizations, etc. - -@item -Stephane Carrez for 68HC11 and 68HC12 ports. - -@item -Steve Chamberlain for support for the Renesas SH and H8 processors -and the PicoJava processor, and for GCJ config fixes. - -@item -Glenn Chambers for help with the GCJ FAQ@. - -@item -John-Marc Chandonia for various libgcj patches. - -@item -Denis Chertykov for contributing and maintaining the AVR port, the first GCC port -for an 8-bit architecture. - -@item -Scott Christley for his Objective-C contributions. - -@item -Eric Christopher for his Java porting help and clean-ups. - -@item -Branko Cibej for more warning contributions. - -@item -The @uref{http://www.gnu.org/software/classpath/,,GNU Classpath project} -for all of their merged runtime code. - -@item -Nick Clifton for arm, mcore, fr30, v850, m32r, msp430 rx work, -@option{--help}, and other random hacking. - -@item -Michael Cook for libstdc++ cleanup patches to reduce warnings. - -@item -R. Kelley Cook for making GCC buildable from a read-only directory as -well as other miscellaneous build process and documentation clean-ups. - -@item -Ralf Corsepius for SH testing and minor bug fixing. - -@item -Stan Cox for care and feeding of the x86 port and lots of behind -the scenes hacking. - -@item -Alex Crain provided changes for the 3b1. - -@item -Ian Dall for major improvements to the NS32k port. - -@item -Paul Dale for his work to add uClinux platform support to the -m68k backend. - -@item -Dario Dariol contributed the four varieties of sample programs -that print a copy of their source. - -@item -Russell Davidson for fstream and stringstream fixes in libstdc++. - -@item -Bud Davis for work on the G77 and GNU Fortran compilers. - -@item -Mo DeJong for GCJ and libgcj bug fixes. - -@item -DJ Delorie for the DJGPP port, build and libiberty maintenance, -various bug fixes, and the M32C, MeP, MSP430, and RL78 ports. - -@item -Arnaud Desitter for helping to debug GNU Fortran. - -@item -Gabriel Dos Reis for contributions to G++, contributions and -maintenance of GCC diagnostics infrastructure, libstdc++-v3, -including @code{valarray<>}, @code{complex<>}, maintaining the numerics library -(including that pesky @code{} :-) and keeping up-to-date anything -to do with numbers. - -@item -Ulrich Drepper for his work on glibc, testing of GCC using glibc, ISO C99 -support, CFG dumping support, etc., plus support of the C++ runtime -libraries including for all kinds of C interface issues, contributing and -maintaining @code{complex<>}, sanity checking and disbursement, configuration -architecture, libio maintenance, and early math work. - -@item -Fran@,{c}ois Dumont for his work on libstdc++-v3, especially maintaining and -improving @code{debug-mode} and associative and unordered containers. - -@item -Zdenek Dvorak for a new loop unroller and various fixes. - -@item -Michael Eager for his work on the Xilinx MicroBlaze port. - -@item -Richard Earnshaw for his ongoing work with the ARM@. - -@item -David Edelsohn for his direction via the steering committee, ongoing work -with the RS6000/PowerPC port, help cleaning up Haifa loop changes, -doing the entire AIX port of libstdc++ with his bare hands, and for -ensuring GCC properly keeps working on AIX@. - -@item -Kevin Ediger for the floating point formatting of num_put::do_put in -libstdc++. - -@item -Phil Edwards for libstdc++ work including configuration hackery, -documentation maintainer, chief breaker of the web pages, the occasional -iostream bug fix, and work on shared library symbol versioning. - -@item -Paul Eggert for random hacking all over GCC@. - -@item -Mark Elbrecht for various DJGPP improvements, and for libstdc++ -configuration support for locales and fstream-related fixes. - -@item -Vadim Egorov for libstdc++ fixes in strings, streambufs, and iostreams. - -@item -Christian Ehrhardt for dealing with bug reports. - -@item -Ben Elliston for his work to move the Objective-C runtime into its -own subdirectory and for his work on autoconf. - -@item -Revital Eres for work on the PowerPC 750CL port. - -@item -Marc Espie for OpenBSD support. - -@item -Doug Evans for much of the global optimization framework, arc, m32r, -and SPARC work. - -@item -Christopher Faylor for his work on the Cygwin port and for caring and -feeding the gcc.gnu.org box and saving its users tons of spam. - -@item -Fred Fish for BeOS support and Ada fixes. - -@item -Ivan Fontes Garcia for the Portuguese translation of the GCJ FAQ@. - -@item -Peter Gerwinski for various bug fixes and the Pascal front end. - -@item -Kaveh R.@: Ghazi for his direction via the steering committee, amazing -work to make @samp{-W -Wall -W* -Werror} useful, and -testing GCC on a plethora of platforms. Kaveh extends his gratitude to -the CAIP Center at Rutgers University for providing him with computing -resources to work on Free Software from the late 1980s to 2010. - -@item -John Gilmore for a donation to the FSF earmarked improving GNU Java. - -@item -Judy Goldberg for c++ contributions. - -@item -Torbjorn Granlund for various fixes and the c-torture testsuite, -multiply- and divide-by-constant optimization, improved long long -support, improved leaf function register allocation, and his direction -via the steering committee. - -@item -Jonny Grant for improvements to @code{collect2's} @option{--help} documentation. - -@item -Anthony Green for his @option{-Os} contributions, the moxie port, and -Java front end work. - -@item -Stu Grossman for gdb hacking, allowing GCJ developers to debug Java code. - -@item -Michael K. Gschwind contributed the port to the PDP-11. - -@item -Richard Biener for his ongoing middle-end contributions and bug fixes -and for release management. - -@item -Ron Guilmette implemented the @command{protoize} and @command{unprotoize} -tools, the support for Dwarf symbolic debugging information, and much of -the support for System V Release 4. He has also worked heavily on the -Intel 386 and 860 support. - -@item -Sumanth Gundapaneni for contributing the CR16 port. - -@item -Mostafa Hagog for Swing Modulo Scheduling (SMS) and post reload GCSE@. - -@item -Bruno Haible for improvements in the runtime overhead for EH, new -warnings and assorted bug fixes. - -@item -Andrew Haley for his amazing Java compiler and library efforts. - -@item -Chris Hanson assisted in making GCC work on HP-UX for the 9000 series 300. - -@item -Michael Hayes for various thankless work he's done trying to get -the c30/c40 ports functional. Lots of loop and unroll improvements and -fixes. - -@item -Dara Hazeghi for wading through myriads of target-specific bug reports. - -@item -Kate Hedstrom for staking the G77 folks with an initial testsuite. - -@item -Richard Henderson for his ongoing SPARC, alpha, ia32, and ia64 work, loop -opts, and generally fixing lots of old problems we've ignored for -years, flow rewrite and lots of further stuff, including reviewing -tons of patches. - -@item -Aldy Hernandez for working on the PowerPC port, SIMD support, and -various fixes. - -@item -Nobuyuki Hikichi of Software Research Associates, Tokyo, contributed -the support for the Sony NEWS machine. - -@item -Kazu Hirata for caring and feeding the Renesas H8/300 port and various fixes. - -@item -Katherine Holcomb for work on GNU Fortran. - -@item -Manfred Hollstein for his ongoing work to keep the m88k alive, lots -of testing and bug fixing, particularly of GCC configury code. - -@item -Steve Holmgren for MachTen patches. - -@item -Mat Hostetter for work on the TILE-Gx and TILEPro ports. - -@item -Jan Hubicka for his x86 port improvements. - -@item -Falk Hueffner for working on C and optimization bug reports. - -@item -Bernardo Innocenti for his m68k work, including merging of -ColdFire improvements and uClinux support. - -@item -Christian Iseli for various bug fixes. - -@item -Kamil Iskra for general m68k hacking. - -@item -Lee Iverson for random fixes and MIPS testing. - -@item -Balaji V. Iyer for Cilk+ development and merging. - -@item -Andreas Jaeger for testing and benchmarking of GCC and various bug fixes. - -@item -Jakub Jelinek for his SPARC work and sibling call optimizations as well -as lots of bug fixes and test cases, and for improving the Java build -system. - -@item -Janis Johnson for ia64 testing and fixes, her quality improvement -sidetracks, and web page maintenance. - -@item -Kean Johnston for SCO OpenServer support and various fixes. - -@item -Tim Josling for the sample language treelang based originally on Richard -Kenner's ``toy'' language. - -@item -Nicolai Josuttis for additional libstdc++ documentation. - -@item -Klaus Kaempf for his ongoing work to make alpha-vms a viable target. - -@item -Steven G. Kargl for work on GNU Fortran. - -@item -David Kashtan of SRI adapted GCC to VMS@. - -@item -Ryszard Kabatek for many, many libstdc++ bug fixes and optimizations of -strings, especially member functions, and for auto_ptr fixes. - -@item -Geoffrey Keating for his ongoing work to make the PPC work for GNU/Linux -and his automatic regression tester. - -@item -Brendan Kehoe for his ongoing work with G++ and for a lot of early work -in just about every part of libstdc++. - -@item -Oliver M. Kellogg of Deutsche Aerospace contributed the port to the -MIL-STD-1750A@. - -@item -Richard Kenner of the New York University Ultracomputer Research -Laboratory wrote the machine descriptions for the AMD 29000, the DEC -Alpha, the IBM RT PC, and the IBM RS/6000 as well as the support for -instruction attributes. He also made changes to better support RISC -processors including changes to common subexpression elimination, -strength reduction, function calling sequence handling, and condition -code support, in addition to generalizing the code for frame pointer -elimination and delay slot scheduling. Richard Kenner was also the -head maintainer of GCC for several years. - -@item -Mumit Khan for various contributions to the Cygwin and Mingw32 ports and -maintaining binary releases for Microsoft Windows hosts, and for massive libstdc++ -porting work to Cygwin/Mingw32. - -@item -Robin Kirkham for cpu32 support. - -@item -Mark Klein for PA improvements. - -@item -Thomas Koenig for various bug fixes. - -@item -Bruce Korb for the new and improved fixincludes code. - -@item -Benjamin Kosnik for his G++ work and for leading the libstdc++-v3 effort. - -@item -Charles LaBrec contributed the support for the Integrated Solutions -68020 system. - -@item -Asher Langton and Mike Kumbera for contributing Cray pointer support -to GNU Fortran, and for other GNU Fortran improvements. - -@item -Jeff Law for his direction via the steering committee, coordinating the -entire egcs project and GCC 2.95, rolling out snapshots and releases, -handling merges from GCC2, reviewing tons of patches that might have -fallen through the cracks else, and random but extensive hacking. - -@item -Walter Lee for work on the TILE-Gx and TILEPro ports. - -@item -Marc Lehmann for his direction via the steering committee and helping -with analysis and improvements of x86 performance. - -@item -Victor Leikehman for work on GNU Fortran. - -@item -Ted Lemon wrote parts of the RTL reader and printer. - -@item -Kriang Lerdsuwanakij for C++ improvements including template as template -parameter support, and many C++ fixes. - -@item -Warren Levy for tremendous work on libgcj (Java Runtime Library) and -random work on the Java front end. - -@item -Alain Lichnewsky ported GCC to the MIPS CPU@. - -@item -Oskar Liljeblad for hacking on AWT and his many Java bug reports and -patches. - -@item -Robert Lipe for OpenServer support, new testsuites, testing, etc. - -@item -Chen Liqin for various S+core related fixes/improvement, and for -maintaining the S+core port. - -@item -Weiwen Liu for testing and various bug fixes. - -@item -Manuel L@'opez-Ib@'a@~nez for improving @option{-Wconversion} and -many other diagnostics fixes and improvements. - -@item -Dave Love for his ongoing work with the Fortran front end and -runtime libraries. - -@item -Martin von L@"owis for internal consistency checking infrastructure, -various C++ improvements including namespace support, and tons of -assistance with libstdc++/compiler merges. - -@item -H.J. Lu for his previous contributions to the steering committee, many x86 -bug reports, prototype patches, and keeping the GNU/Linux ports working. - -@item -Greg McGary for random fixes and (someday) bounded pointers. - -@item -Andrew MacLeod for his ongoing work in building a real EH system, -various code generation improvements, work on the global optimizer, etc. - -@item -Vladimir Makarov for hacking some ugly i960 problems, PowerPC hacking -improvements to compile-time performance, overall knowledge and -direction in the area of instruction scheduling, and design and -implementation of the automaton based instruction scheduler. - -@item -Bob Manson for his behind the scenes work on dejagnu. - -@item -Philip Martin for lots of libstdc++ string and vector iterator fixes and -improvements, and string clean up and testsuites. - -@item -All of the Mauve project -@uref{http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/mauve/THANKS?rev=1.2&cvsroot=mauve&only_with_tag=HEAD,,contributors}, -for Java test code. - -@item -Bryce McKinlay for numerous GCJ and libgcj fixes and improvements. - -@item -Adam Megacz for his work on the Microsoft Windows port of GCJ@. - -@item -Michael Meissner for LRS framework, ia32, m32r, v850, m88k, MIPS, -powerpc, haifa, ECOFF debug support, and other assorted hacking. - -@item -Jason Merrill for his direction via the steering committee and leading -the G++ effort. - -@item -Martin Michlmayr for testing GCC on several architectures using the -entire Debian archive. - -@item -David Miller for his direction via the steering committee, lots of -SPARC work, improvements in jump.c and interfacing with the Linux kernel -developers. - -@item -Gary Miller ported GCC to Charles River Data Systems machines. - -@item -Alfred Minarik for libstdc++ string and ios bug fixes, and turning the -entire libstdc++ testsuite namespace-compatible. - -@item -Mark Mitchell for his direction via the steering committee, mountains of -C++ work, load/store hoisting out of loops, alias analysis improvements, -ISO C @code{restrict} support, and serving as release manager from 2000 -to 2011. - -@item -Alan Modra for various GNU/Linux bits and testing. - -@item -Toon Moene for his direction via the steering committee, Fortran -maintenance, and his ongoing work to make us make Fortran run fast. - -@item -Jason Molenda for major help in the care and feeding of all the services -on the gcc.gnu.org (formerly egcs.cygnus.com) machine---mail, web -services, ftp services, etc etc. Doing all this work on scrap paper and -the backs of envelopes would have been@dots{} difficult. - -@item -Catherine Moore for fixing various ugly problems we have sent her -way, including the haifa bug which was killing the Alpha & PowerPC -Linux kernels. - -@item -Mike Moreton for his various Java patches. - -@item -David Mosberger-Tang for various Alpha improvements, and for the initial -IA-64 port. - -@item -Stephen Moshier contributed the floating point emulator that assists in -cross-compilation and permits support for floating point numbers wider -than 64 bits and for ISO C99 support. - -@item -Bill Moyer for his behind the scenes work on various issues. - -@item -Philippe De Muyter for his work on the m68k port. - -@item -Joseph S. Myers for his work on the PDP-11 port, format checking and ISO -C99 support, and continuous emphasis on (and contributions to) documentation. - -@item -Nathan Myers for his work on libstdc++-v3: architecture and authorship -through the first three snapshots, including implementation of locale -infrastructure, string, shadow C headers, and the initial project -documentation (DESIGN, CHECKLIST, and so forth). Later, more work on -MT-safe string and shadow headers. - -@item -Felix Natter for documentation on porting libstdc++. - -@item -Nathanael Nerode for cleaning up the configuration/build process. - -@item -NeXT, Inc.@: donated the front end that supports the Objective-C -language. - -@item -Hans-Peter Nilsson for the CRIS and MMIX ports, improvements to the search -engine setup, various documentation fixes and other small fixes. - -@item -Geoff Noer for his work on getting cygwin native builds working. - -@item -Diego Novillo for his work on Tree SSA, OpenMP, SPEC performance -tracking web pages, GIMPLE tuples, and assorted fixes. - -@item -David O'Brien for the FreeBSD/alpha, FreeBSD/AMD x86-64, FreeBSD/ARM, -FreeBSD/PowerPC, and FreeBSD/SPARC64 ports and related infrastructure -improvements. - -@item -Alexandre Oliva for various build infrastructure improvements, scripts and -amazing testing work, including keeping libtool issues sane and happy. - -@item -Stefan Olsson for work on mt_alloc. - -@item -Melissa O'Neill for various NeXT fixes. - -@item -Rainer Orth for random MIPS work, including improvements to GCC's o32 -ABI support, improvements to dejagnu's MIPS support, Java configuration -clean-ups and porting work, and maintaining the IRIX, Solaris 2, and -Tru64 UNIX ports. - -@item -Hartmut Penner for work on the s390 port. - -@item -Paul Petersen wrote the machine description for the Alliant FX/8. - -@item -Alexandre Petit-Bianco for implementing much of the Java compiler and -continued Java maintainership. - -@item -Matthias Pfaller for major improvements to the NS32k port. - -@item -Gerald Pfeifer for his direction via the steering committee, pointing -out lots of problems we need to solve, maintenance of the web pages, and -taking care of documentation maintenance in general. - -@item -Andrew Pinski for processing bug reports by the dozen. - -@item -Ovidiu Predescu for his work on the Objective-C front end and runtime -libraries. - -@item -Jerry Quinn for major performance improvements in C++ formatted I/O@. - -@item -Ken Raeburn for various improvements to checker, MIPS ports and various -cleanups in the compiler. - -@item -Rolf W. Rasmussen for hacking on AWT@. - -@item -David Reese of Sun Microsystems contributed to the Solaris on PowerPC -port. - -@item -Volker Reichelt for keeping up with the problem reports. - -@item -Joern Rennecke for maintaining the sh port, loop, regmove & reload -hacking and developing and maintaining the Epiphany port. - -@item -Loren J. Rittle for improvements to libstdc++-v3 including the FreeBSD -port, threading fixes, thread-related configury changes, critical -threading documentation, and solutions to really tricky I/O problems, -as well as keeping GCC properly working on FreeBSD and continuous testing. - -@item -Craig Rodrigues for processing tons of bug reports. - -@item -Ola R@"onnerup for work on mt_alloc. - -@item -Gavin Romig-Koch for lots of behind the scenes MIPS work. - -@item -David Ronis inspired and encouraged Craig to rewrite the G77 -documentation in texinfo format by contributing a first pass at a -translation of the old @file{g77-0.5.16/f/DOC} file. - -@item -Ken Rose for fixes to GCC's delay slot filling code. - -@item -Paul Rubin wrote most of the preprocessor. - -@item -P@'etur Run@'olfsson for major performance improvements in C++ formatted I/O and -large file support in C++ filebuf. - -@item -Chip Salzenberg for libstdc++ patches and improvements to locales, traits, -Makefiles, libio, libtool hackery, and ``long long'' support. - -@item -Juha Sarlin for improvements to the H8 code generator. - -@item -Greg Satz assisted in making GCC work on HP-UX for the 9000 series 300. - -@item -Roger Sayle for improvements to constant folding and GCC's RTL optimizers -as well as for fixing numerous bugs. - -@item -Bradley Schatz for his work on the GCJ FAQ@. - -@item -Peter Schauer wrote the code to allow debugging to work on the Alpha. - -@item -William Schelter did most of the work on the Intel 80386 support. - -@item -Tobias Schl@"uter for work on GNU Fortran. - -@item -Bernd Schmidt for various code generation improvements and major -work in the reload pass, serving as release manager for -GCC 2.95.3, and work on the Blackfin and C6X ports. - -@item -Peter Schmid for constant testing of libstdc++---especially application -testing, going above and beyond what was requested for the release -criteria---and libstdc++ header file tweaks. - -@item -Jason Schroeder for jcf-dump patches. - -@item -Andreas Schwab for his work on the m68k port. - -@item -Lars Segerlund for work on GNU Fortran. - -@item -Dodji Seketeli for numerous C++ bug fixes and debug info improvements. - -@item -Tim Shen for major work on @code{}. - -@item -Joel Sherrill for his direction via the steering committee, RTEMS -contributions and RTEMS testing. - -@item -Nathan Sidwell for many C++ fixes/improvements. - -@item -Jeffrey Siegal for helping RMS with the original design of GCC, some -code which handles the parse tree and RTL data structures, constant -folding and help with the original VAX & m68k ports. - -@item -Kenny Simpson for prompting libstdc++ fixes due to defect reports from -the LWG (thereby keeping GCC in line with updates from the ISO)@. - -@item -Franz Sirl for his ongoing work with making the PPC port stable -for GNU/Linux. - -@item -Andrey Slepuhin for assorted AIX hacking. - -@item -Trevor Smigiel for contributing the SPU port. - -@item -Christopher Smith did the port for Convex machines. - -@item -Danny Smith for his major efforts on the Mingw (and Cygwin) ports. -Retired from GCC maintainership August 2010, having mentored two -new maintainers into the role. - -@item -Randy Smith finished the Sun FPA support. - -@item -Ed Smith-Rowland for his continuous work on libstdc++-v3, special functions, -@code{}, and various improvements to C++11 features. - -@item -Scott Snyder for queue, iterator, istream, and string fixes and libstdc++ -testsuite entries. Also for providing the patch to G77 to add -rudimentary support for @code{INTEGER*1}, @code{INTEGER*2}, and -@code{LOGICAL*1}. - -@item -Zdenek Sojka for running automated regression testing of GCC and reporting -numerous bugs. - -@item -Jayant Sonar for contributing the CR16 port. - -@item -Brad Spencer for contributions to the GLIBCPP_FORCE_NEW technique. - -@item -Richard Stallman, for writing the original GCC and launching the GNU project. - -@item -Jan Stein of the Chalmers Computer Society provided support for -Genix, as well as part of the 32000 machine description. - -@item -Nigel Stephens for various mips16 related fixes/improvements. - -@item -Jonathan Stone wrote the machine description for the Pyramid computer. - -@item -Graham Stott for various infrastructure improvements. - -@item -John Stracke for his Java HTTP protocol fixes. - -@item -Mike Stump for his Elxsi port, G++ contributions over the years and more -recently his vxworks contributions - -@item -Jeff Sturm for Java porting help, bug fixes, and encouragement. - -@item -Shigeya Suzuki for this fixes for the bsdi platforms. - -@item -Ian Lance Taylor for the Go frontend, the initial mips16 and mips64 -support, general configury hacking, fixincludes, etc. - -@item -Holger Teutsch provided the support for the Clipper CPU@. - -@item -Gary Thomas for his ongoing work to make the PPC work for GNU/Linux. - -@item -Philipp Thomas for random bug fixes throughout the compiler - -@item -Jason Thorpe for thread support in libstdc++ on NetBSD@. - -@item -Kresten Krab Thorup wrote the run time support for the Objective-C -language and the fantastic Java bytecode interpreter. - -@item -Michael Tiemann for random bug fixes, the first instruction scheduler, -initial C++ support, function integration, NS32k, SPARC and M88k -machine description work, delay slot scheduling. - -@item -Andreas Tobler for his work porting libgcj to Darwin. - -@item -Teemu Torma for thread safe exception handling support. - -@item -Leonard Tower wrote parts of the parser, RTL generator, and RTL -definitions, and of the VAX machine description. - -@item -Daniel Towner and Hariharan Sandanagobalane contributed and -maintain the picoChip port. - -@item -Tom Tromey for internationalization support and for his many Java -contributions and libgcj maintainership. - -@item -Lassi Tuura for improvements to config.guess to determine HP processor -types. - -@item -Petter Urkedal for libstdc++ CXXFLAGS, math, and algorithms fixes. - -@item -Andy Vaught for the design and initial implementation of the GNU Fortran -front end. - -@item -Brent Verner for work with the libstdc++ cshadow files and their -associated configure steps. - -@item -Todd Vierling for contributions for NetBSD ports. - -@item -Jonathan Wakely for contributing libstdc++ Doxygen notes and XHTML -guidance. - -@item -Dean Wakerley for converting the install documentation from HTML to texinfo -in time for GCC 3.0. - -@item -Krister Walfridsson for random bug fixes. - -@item -Feng Wang for contributions to GNU Fortran. - -@item -Stephen M. Webb for time and effort on making libstdc++ shadow files -work with the tricky Solaris 8+ headers, and for pushing the build-time -header tree. Also, for starting and driving the @code{} effort. - -@item -John Wehle for various improvements for the x86 code generator, -related infrastructure improvements to help x86 code generation, -value range propagation and other work, WE32k port. - -@item -Ulrich Weigand for work on the s390 port. - -@item -Zack Weinberg for major work on cpplib and various other bug fixes. - -@item -Matt Welsh for help with Linux Threads support in GCJ@. - -@item -Urban Widmark for help fixing java.io. - -@item -Mark Wielaard for new Java library code and his work integrating with -Classpath. - -@item -Dale Wiles helped port GCC to the Tahoe. - -@item -Bob Wilson from Tensilica, Inc.@: for the Xtensa port. - -@item -Jim Wilson for his direction via the steering committee, tackling hard -problems in various places that nobody else wanted to work on, strength -reduction and other loop optimizations. - -@item -Paul Woegerer and Tal Agmon for the CRX port. - -@item -Carlo Wood for various fixes. - -@item -Tom Wood for work on the m88k port. - -@item -Chung-Ju Wu for his work on the Andes NDS32 port. - -@item -Canqun Yang for work on GNU Fortran. - -@item -Masanobu Yuhara of Fujitsu Laboratories implemented the machine -description for the Tron architecture (specifically, the Gmicro). - -@item -Kevin Zachmann helped port GCC to the Tahoe. - -@item -Ayal Zaks for Swing Modulo Scheduling (SMS). - -@item -Xiaoqiang Zhang for work on GNU Fortran. - -@item -Gilles Zunino for help porting Java to Irix. - -@end itemize - -The following people are recognized for their contributions to GNAT, -the Ada front end of GCC: -@itemize @bullet -@item -Bernard Banner - -@item -Romain Berrendonner - -@item -Geert Bosch - -@item -Emmanuel Briot - -@item -Joel Brobecker - -@item -Ben Brosgol - -@item -Vincent Celier - -@item -Arnaud Charlet - -@item -Chien Chieng - -@item -Cyrille Comar - -@item -Cyrille Crozes - -@item -Robert Dewar - -@item -Gary Dismukes - -@item -Robert Duff - -@item -Ed Falis - -@item -Ramon Fernandez - -@item -Sam Figueroa - -@item -Vasiliy Fofanov - -@item -Michael Friess - -@item -Franco Gasperoni - -@item -Ted Giering - -@item -Matthew Gingell - -@item -Laurent Guerby - -@item -Jerome Guitton - -@item -Olivier Hainque - -@item -Jerome Hugues - -@item -Hristian Kirtchev - -@item -Jerome Lambourg - -@item -Bruno Leclerc - -@item -Albert Lee - -@item -Sean McNeil - -@item -Javier Miranda - -@item -Laurent Nana - -@item -Pascal Obry - -@item -Dong-Ik Oh - -@item -Laurent Pautet - -@item -Brett Porter - -@item -Thomas Quinot - -@item -Nicolas Roche - -@item -Pat Rogers - -@item -Jose Ruiz - -@item -Douglas Rupp - -@item -Sergey Rybin - -@item -Gail Schenker - -@item -Ed Schonberg - -@item -Nicolas Setton - -@item -Samuel Tardieu - -@end itemize - - -The following people are recognized for their contributions of new -features, bug reports, testing and integration of classpath/libgcj for -GCC version 4.1: -@itemize @bullet -@item -Lillian Angel for @code{JTree} implementation and lots Free Swing -additions and bug fixes. - -@item -Wolfgang Baer for @code{GapContent} bug fixes. - -@item -Anthony Balkissoon for @code{JList}, Free Swing 1.5 updates and mouse event -fixes, lots of Free Swing work including @code{JTable} editing. - -@item -Stuart Ballard for RMI constant fixes. - -@item -Goffredo Baroncelli for @code{HTTPURLConnection} fixes. - -@item -Gary Benson for @code{MessageFormat} fixes. - -@item -Daniel Bonniot for @code{Serialization} fixes. - -@item -Chris Burdess for lots of gnu.xml and http protocol fixes, @code{StAX} -and @code{DOM xml:id} support. - -@item -Ka-Hing Cheung for @code{TreePath} and @code{TreeSelection} fixes. - -@item -Archie Cobbs for build fixes, VM interface updates, -@code{URLClassLoader} updates. - -@item -Kelley Cook for build fixes. - -@item -Martin Cordova for Suggestions for better @code{SocketTimeoutException}. - -@item -David Daney for @code{BitSet} bug fixes, @code{HttpURLConnection} -rewrite and improvements. - -@item -Thomas Fitzsimmons for lots of upgrades to the gtk+ AWT and Cairo 2D -support. Lots of imageio framework additions, lots of AWT and Free -Swing bug fixes. - -@item -Jeroen Frijters for @code{ClassLoader} and nio cleanups, serialization fixes, -better @code{Proxy} support, bug fixes and IKVM integration. - -@item -Santiago Gala for @code{AccessControlContext} fixes. - -@item -Nicolas Geoffray for @code{VMClassLoader} and @code{AccessController} -improvements. - -@item -David Gilbert for @code{basic} and @code{metal} icon and plaf support -and lots of documenting, Lots of Free Swing and metal theme -additions. @code{MetalIconFactory} implementation. - -@item -Anthony Green for @code{MIDI} framework, @code{ALSA} and @code{DSSI} -providers. - -@item -Andrew Haley for @code{Serialization} and @code{URLClassLoader} fixes, -gcj build speedups. - -@item -Kim Ho for @code{JFileChooser} implementation. - -@item -Andrew John Hughes for @code{Locale} and net fixes, URI RFC2986 -updates, @code{Serialization} fixes, @code{Properties} XML support and -generic branch work, VMIntegration guide update. - -@item -Bastiaan Huisman for @code{TimeZone} bug fixing. - -@item -Andreas Jaeger for mprec updates. - -@item -Paul Jenner for better @option{-Werror} support. - -@item -Ito Kazumitsu for @code{NetworkInterface} implementation and updates. - -@item -Roman Kennke for @code{BoxLayout}, @code{GrayFilter} and -@code{SplitPane}, plus bug fixes all over. Lots of Free Swing work -including styled text. - -@item -Simon Kitching for @code{String} cleanups and optimization suggestions. - -@item -Michael Koch for configuration fixes, @code{Locale} updates, bug and -build fixes. - -@item -Guilhem Lavaux for configuration, thread and channel fixes and Kaffe -integration. JCL native @code{Pointer} updates. Logger bug fixes. - -@item -David Lichteblau for JCL support library global/local reference -cleanups. - -@item -Aaron Luchko for JDWP updates and documentation fixes. - -@item -Ziga Mahkovec for @code{Graphics2D} upgraded to Cairo 0.5 and new regex -features. - -@item -Sven de Marothy for BMP imageio support, CSS and @code{TextLayout} -fixes. @code{GtkImage} rewrite, 2D, awt, free swing and date/time fixes and -implementing the Qt4 peers. - -@item -Casey Marshall for crypto algorithm fixes, @code{FileChannel} lock, -@code{SystemLogger} and @code{FileHandler} rotate implementations, NIO -@code{FileChannel.map} support, security and policy updates. - -@item -Bryce McKinlay for RMI work. - -@item -Audrius Meskauskas for lots of Free Corba, RMI and HTML work plus -testing and documenting. - -@item -Kalle Olavi Niemitalo for build fixes. - -@item -Rainer Orth for build fixes. - -@item -Andrew Overholt for @code{File} locking fixes. - -@item -Ingo Proetel for @code{Image}, @code{Logger} and @code{URLClassLoader} -updates. - -@item -Olga Rodimina for @code{MenuSelectionManager} implementation. - -@item -Jan Roehrich for @code{BasicTreeUI} and @code{JTree} fixes. - -@item -Julian Scheid for documentation updates and gjdoc support. - -@item -Christian Schlichtherle for zip fixes and cleanups. - -@item -Robert Schuster for documentation updates and beans fixes, -@code{TreeNode} enumerations and @code{ActionCommand} and various -fixes, XML and URL, AWT and Free Swing bug fixes. - -@item -Keith Seitz for lots of JDWP work. - -@item -Christian Thalinger for 64-bit cleanups, Configuration and VM -interface fixes and @code{CACAO} integration, @code{fdlibm} updates. - -@item -Gael Thomas for @code{VMClassLoader} boot packages support suggestions. - -@item -Andreas Tobler for Darwin and Solaris testing and fixing, @code{Qt4} -support for Darwin/OS X, @code{Graphics2D} support, @code{gtk+} -updates. - -@item -Dalibor Topic for better @code{DEBUG} support, build cleanups and -Kaffe integration. @code{Qt4} build infrastructure, @code{SHA1PRNG} -and @code{GdkPixbugDecoder} updates. - -@item -Tom Tromey for Eclipse integration, generics work, lots of bug fixes -and gcj integration including coordinating The Big Merge. - -@item -Mark Wielaard for bug fixes, packaging and release management, -@code{Clipboard} implementation, system call interrupts and network -timeouts and @code{GdkPixpufDecoder} fixes. - -@end itemize - - -In addition to the above, all of which also contributed time and energy in -testing GCC, we would like to thank the following for their contributions -to testing: - -@itemize @bullet -@item -Michael Abd-El-Malek - -@item -Thomas Arend - -@item -Bonzo Armstrong - -@item -Steven Ashe - -@item -Chris Baldwin - -@item -David Billinghurst - -@item -Jim Blandy - -@item -Stephane Bortzmeyer - -@item -Horst von Brand - -@item -Frank Braun - -@item -Rodney Brown - -@item -Sidney Cadot - -@item -Bradford Castalia - -@item -Robert Clark - -@item -Jonathan Corbet - -@item -Ralph Doncaster - -@item -Richard Emberson - -@item -Levente Farkas - -@item -Graham Fawcett - -@item -Mark Fernyhough - -@item -Robert A. French - -@item -J@"orgen Freyh - -@item -Mark K. Gardner - -@item -Charles-Antoine Gauthier - -@item -Yung Shing Gene - -@item -David Gilbert - -@item -Simon Gornall - -@item -Fred Gray - -@item -John Griffin - -@item -Patrik Hagglund - -@item -Phil Hargett - -@item -Amancio Hasty - -@item -Takafumi Hayashi - -@item -Bryan W. Headley - -@item -Kevin B. Hendricks - -@item -Joep Jansen - -@item -Christian Joensson - -@item -Michel Kern - -@item -David Kidd - -@item -Tobias Kuipers - -@item -Anand Krishnaswamy - -@item -A. O. V. Le Blanc - -@item -llewelly - -@item -Damon Love - -@item -Brad Lucier - -@item -Matthias Klose - -@item -Martin Knoblauch - -@item -Rick Lutowski - -@item -Jesse Macnish - -@item -Stefan Morrell - -@item -Anon A. Mous - -@item -Matthias Mueller - -@item -Pekka Nikander - -@item -Rick Niles - -@item -Jon Olson - -@item -Magnus Persson - -@item -Chris Pollard - -@item -Richard Polton - -@item -Derk Reefman - -@item -David Rees - -@item -Paul Reilly - -@item -Tom Reilly - -@item -Torsten Rueger - -@item -Danny Sadinoff - -@item -Marc Schifer - -@item -Erik Schnetter - -@item -Wayne K. Schroll - -@item -David Schuler - -@item -Vin Shelton - -@item -Tim Souder - -@item -Adam Sulmicki - -@item -Bill Thorson - -@item -George Talbot - -@item -Pedro A. M. Vazquez - -@item -Gregory Warnes - -@item -Ian Watson - -@item -David E. Young - -@item -And many others -@end itemize - -And finally we'd like to thank everyone who uses the compiler, provides -feedback and generally reminds us why we're doing this work in the first -place. diff --git a/contrib/gcc-5.0/gcc/doc/contribute.texi b/contrib/gcc-5.0/gcc/doc/contribute.texi deleted file mode 100644 index 2f983d26ca..0000000000 --- a/contrib/gcc-5.0/gcc/doc/contribute.texi +++ /dev/null @@ -1,24 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Contributing -@chapter Contributing to GCC Development - -If you would like to help pretest GCC releases to assure they work well, -current development sources are available by SVN (see -@uref{http://gcc.gnu.org/svn.html}). Source and binary snapshots are -also available for FTP; see @uref{http://gcc.gnu.org/snapshots.html}. - -If you would like to work on improvements to GCC, please read the -advice at these URLs: - -@smallexample -@uref{http://gcc.gnu.org/contribute.html} -@uref{http://gcc.gnu.org/contributewhy.html} -@end smallexample - -@noindent -for information on how to make useful contributions and avoid -duplication of effort. Suggested projects are listed at -@uref{http://gcc.gnu.org/projects/}. diff --git a/contrib/gcc-5.0/gcc/doc/cpp.texi b/contrib/gcc-5.0/gcc/doc/cpp.texi deleted file mode 100644 index 118ba7c213..0000000000 --- a/contrib/gcc-5.0/gcc/doc/cpp.texi +++ /dev/null @@ -1,4525 +0,0 @@ -\input texinfo -@setfilename cpp.info -@settitle The C Preprocessor -@setchapternewpage off -@c @smallbook -@c @cropmarks -@c @finalout - -@include gcc-common.texi - -@copying -@c man begin COPYRIGHT -Copyright @copyright{} 1987-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation. A copy of -the license is included in the -@c man end -section entitled ``GNU Free Documentation License''. -@ignore -@c man begin COPYRIGHT -man page gfdl(7). -@c man end -@end ignore - -@c man begin COPYRIGHT -This manual contains no Invariant Sections. The Front-Cover Texts are -(a) (see below), and the Back-Cover Texts are (b) (see below). - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@c man end -@end copying - -@c Create a separate index for command line options. -@defcodeindex op -@syncodeindex vr op - -@c Used in cppopts.texi and cppenv.texi. -@set cppmanual - -@ifinfo -@dircategory Software development -@direntry -* Cpp: (cpp). The GNU C preprocessor. -@end direntry -@end ifinfo - -@titlepage -@title The C Preprocessor -@versionsubtitle -@author Richard M. Stallman, Zachary Weinberg -@page -@c There is a fill at the bottom of the page, so we need a filll to -@c override it. -@vskip 0pt plus 1filll -@insertcopying -@end titlepage -@contents -@page - -@ifnottex -@node Top -@top -The C preprocessor implements the macro language used to transform C, -C++, and Objective-C programs before they are compiled. It can also be -useful on its own. - -@menu -* Overview:: -* Header Files:: -* Macros:: -* Conditionals:: -* Diagnostics:: -* Line Control:: -* Pragmas:: -* Other Directives:: -* Preprocessor Output:: -* Traditional Mode:: -* Implementation Details:: -* Invocation:: -* Environment Variables:: -* GNU Free Documentation License:: -* Index of Directives:: -* Option Index:: -* Concept Index:: - -@detailmenu - --- The Detailed Node Listing --- - -Overview - -* Character sets:: -* Initial processing:: -* Tokenization:: -* The preprocessing language:: - -Header Files - -* Include Syntax:: -* Include Operation:: -* Search Path:: -* Once-Only Headers:: -* Alternatives to Wrapper #ifndef:: -* Computed Includes:: -* Wrapper Headers:: -* System Headers:: - -Macros - -* Object-like Macros:: -* Function-like Macros:: -* Macro Arguments:: -* Stringification:: -* Concatenation:: -* Variadic Macros:: -* Predefined Macros:: -* Undefining and Redefining Macros:: -* Directives Within Macro Arguments:: -* Macro Pitfalls:: - -Predefined Macros - -* Standard Predefined Macros:: -* Common Predefined Macros:: -* System-specific Predefined Macros:: -* C++ Named Operators:: - -Macro Pitfalls - -* Misnesting:: -* Operator Precedence Problems:: -* Swallowing the Semicolon:: -* Duplication of Side Effects:: -* Self-Referential Macros:: -* Argument Prescan:: -* Newlines in Arguments:: - -Conditionals - -* Conditional Uses:: -* Conditional Syntax:: -* Deleted Code:: - -Conditional Syntax - -* Ifdef:: -* If:: -* Defined:: -* Else:: -* Elif:: - -Implementation Details - -* Implementation-defined behavior:: -* Implementation limits:: -* Obsolete Features:: -* Differences from previous versions:: - -Obsolete Features - -* Obsolete Features:: - -@end detailmenu -@end menu - -@insertcopying -@end ifnottex - -@node Overview -@chapter Overview -@c man begin DESCRIPTION -The C preprocessor, often known as @dfn{cpp}, is a @dfn{macro processor} -that is used automatically by the C compiler to transform your program -before compilation. It is called a macro processor because it allows -you to define @dfn{macros}, which are brief abbreviations for longer -constructs. - -The C preprocessor is intended to be used only with C, C++, and -Objective-C source code. In the past, it has been abused as a general -text processor. It will choke on input which does not obey C's lexical -rules. For example, apostrophes will be interpreted as the beginning of -character constants, and cause errors. Also, you cannot rely on it -preserving characteristics of the input which are not significant to -C-family languages. If a Makefile is preprocessed, all the hard tabs -will be removed, and the Makefile will not work. - -Having said that, you can often get away with using cpp on things which -are not C@. Other Algol-ish programming languages are often safe -(Pascal, Ada, etc.) So is assembly, with caution. @option{-traditional-cpp} -mode preserves more white space, and is otherwise more permissive. Many -of the problems can be avoided by writing C or C++ style comments -instead of native language comments, and keeping macros simple. - -Wherever possible, you should use a preprocessor geared to the language -you are writing in. Modern versions of the GNU assembler have macro -facilities. Most high level programming languages have their own -conditional compilation and inclusion mechanism. If all else fails, -try a true general text processor, such as GNU M4. - -C preprocessors vary in some details. This manual discusses the GNU C -preprocessor, which provides a small superset of the features of ISO -Standard C@. In its default mode, the GNU C preprocessor does not do a -few things required by the standard. These are features which are -rarely, if ever, used, and may cause surprising changes to the meaning -of a program which does not expect them. To get strict ISO Standard C, -you should use the @option{-std=c90}, @option{-std=c99} or -@option{-std=c11} options, depending -on which version of the standard you want. To get all the mandatory -diagnostics, you must also use @option{-pedantic}. @xref{Invocation}. - -This manual describes the behavior of the ISO preprocessor. To -minimize gratuitous differences, where the ISO preprocessor's -behavior does not conflict with traditional semantics, the -traditional preprocessor should behave the same way. The various -differences that do exist are detailed in the section @ref{Traditional -Mode}. - -For clarity, unless noted otherwise, references to @samp{CPP} in this -manual refer to GNU CPP@. -@c man end - -@menu -* Character sets:: -* Initial processing:: -* Tokenization:: -* The preprocessing language:: -@end menu - -@node Character sets -@section Character sets - -Source code character set processing in C and related languages is -rather complicated. The C standard discusses two character sets, but -there are really at least four. - -The files input to CPP might be in any character set at all. CPP's -very first action, before it even looks for line boundaries, is to -convert the file into the character set it uses for internal -processing. That set is what the C standard calls the @dfn{source} -character set. It must be isomorphic with ISO 10646, also known as -Unicode. CPP uses the UTF-8 encoding of Unicode. - -The character sets of the input files are specified using the -@option{-finput-charset=} option. - -All preprocessing work (the subject of the rest of this manual) is -carried out in the source character set. If you request textual -output from the preprocessor with the @option{-E} option, it will be -in UTF-8. - -After preprocessing is complete, string and character constants are -converted again, into the @dfn{execution} character set. This -character set is under control of the user; the default is UTF-8, -matching the source character set. Wide string and character -constants have their own character set, which is not called out -specifically in the standard. Again, it is under control of the user. -The default is UTF-16 or UTF-32, whichever fits in the target's -@code{wchar_t} type, in the target machine's byte -order.@footnote{UTF-16 does not meet the requirements of the C -standard for a wide character set, but the choice of 16-bit -@code{wchar_t} is enshrined in some system ABIs so we cannot fix -this.} Octal and hexadecimal escape sequences do not undergo -conversion; @t{'\x12'} has the value 0x12 regardless of the currently -selected execution character set. All other escapes are replaced by -the character in the source character set that they represent, then -converted to the execution character set, just like unescaped -characters. - -In identifiers, characters outside the ASCII range can only be -specified with the @samp{\u} and @samp{\U} escapes, not used -directly. If strict ISO C90 conformance is specified with an option -such as @option{-std=c90}, or @option{-fno-extended-identifiers} is -used, then those escapes are not permitted in identifiers. - -@node Initial processing -@section Initial processing - -The preprocessor performs a series of textual transformations on its -input. These happen before all other processing. Conceptually, they -happen in a rigid order, and the entire file is run through each -transformation before the next one begins. CPP actually does them -all at once, for performance reasons. These transformations correspond -roughly to the first three ``phases of translation'' described in the C -standard. - -@enumerate -@item -@cindex line endings -The input file is read into memory and broken into lines. - -Different systems use different conventions to indicate the end of a -line. GCC accepts the ASCII control sequences @kbd{LF}, @kbd{@w{CR -LF}} and @kbd{CR} as end-of-line markers. These are the canonical -sequences used by Unix, DOS and VMS, and the classic Mac OS (before -OSX) respectively. You may therefore safely copy source code written -on any of those systems to a different one and use it without -conversion. (GCC may lose track of the current line number if a file -doesn't consistently use one convention, as sometimes happens when it -is edited on computers with different conventions that share a network -file system.) - -If the last line of any input file lacks an end-of-line marker, the end -of the file is considered to implicitly supply one. The C standard says -that this condition provokes undefined behavior, so GCC will emit a -warning message. - -@item -@cindex trigraphs -@anchor{trigraphs}If trigraphs are enabled, they are replaced by their -corresponding single characters. By default GCC ignores trigraphs, -but if you request a strictly conforming mode with the @option{-std} -option, or you specify the @option{-trigraphs} option, then it -converts them. - -These are nine three-character sequences, all starting with @samp{??}, -that are defined by ISO C to stand for single characters. They permit -obsolete systems that lack some of C's punctuation to use C@. For -example, @samp{??/} stands for @samp{\}, so @t{'??/n'} is a character -constant for a newline. - -Trigraphs are not popular and many compilers implement them -incorrectly. Portable code should not rely on trigraphs being either -converted or ignored. With @option{-Wtrigraphs} GCC will warn you -when a trigraph may change the meaning of your program if it were -converted. @xref{Wtrigraphs}. - -In a string constant, you can prevent a sequence of question marks -from being confused with a trigraph by inserting a backslash between -the question marks, or by separating the string literal at the -trigraph and making use of string literal concatenation. @t{"(??\?)"} -is the string @samp{(???)}, not @samp{(?]}. Traditional C compilers -do not recognize these idioms. - -The nine trigraphs and their replacements are - -@smallexample -Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- -Replacement: [ ] @{ @} # \ ^ | ~ -@end smallexample - -@item -@cindex continued lines -@cindex backslash-newline -Continued lines are merged into one long line. - -A continued line is a line which ends with a backslash, @samp{\}. The -backslash is removed and the following line is joined with the current -one. No space is inserted, so you may split a line anywhere, even in -the middle of a word. (It is generally more readable to split lines -only at white space.) - -The trailing backslash on a continued line is commonly referred to as a -@dfn{backslash-newline}. - -If there is white space between a backslash and the end of a line, that -is still a continued line. However, as this is usually the result of an -editing mistake, and many compilers will not accept it as a continued -line, GCC will warn you about it. - -@item -@cindex comments -@cindex line comments -@cindex block comments -All comments are replaced with single spaces. - -There are two kinds of comments. @dfn{Block comments} begin with -@samp{/*} and continue until the next @samp{*/}. Block comments do not -nest: - -@smallexample -/* @r{this is} /* @r{one comment} */ @r{text outside comment} -@end smallexample - -@dfn{Line comments} begin with @samp{//} and continue to the end of the -current line. Line comments do not nest either, but it does not matter, -because they would end in the same place anyway. - -@smallexample -// @r{this is} // @r{one comment} -@r{text outside comment} -@end smallexample -@end enumerate - -It is safe to put line comments inside block comments, or vice versa. - -@smallexample -@group -/* @r{block comment} - // @r{contains line comment} - @r{yet more comment} - */ @r{outside comment} - -// @r{line comment} /* @r{contains block comment} */ -@end group -@end smallexample - -But beware of commenting out one end of a block comment with a line -comment. - -@smallexample -@group - // @r{l.c.} /* @r{block comment begins} - @r{oops! this isn't a comment anymore} */ -@end group -@end smallexample - -Comments are not recognized within string literals. -@t{@w{"/* blah */"}} is the string constant @samp{@w{/* blah */}}, not -an empty string. - -Line comments are not in the 1989 edition of the C standard, but they -are recognized by GCC as an extension. In C++ and in the 1999 edition -of the C standard, they are an official part of the language. - -Since these transformations happen before all other processing, you can -split a line mechanically with backslash-newline anywhere. You can -comment out the end of a line. You can continue a line comment onto the -next line with backslash-newline. You can even split @samp{/*}, -@samp{*/}, and @samp{//} onto multiple lines with backslash-newline. -For example: - -@smallexample -@group -/\ -* -*/ # /* -*/ defi\ -ne FO\ -O 10\ -20 -@end group -@end smallexample - -@noindent -is equivalent to @code{@w{#define FOO 1020}}. All these tricks are -extremely confusing and should not be used in code intended to be -readable. - -There is no way to prevent a backslash at the end of a line from being -interpreted as a backslash-newline. This cannot affect any correct -program, however. - -@node Tokenization -@section Tokenization - -@cindex tokens -@cindex preprocessing tokens -After the textual transformations are finished, the input file is -converted into a sequence of @dfn{preprocessing tokens}. These mostly -correspond to the syntactic tokens used by the C compiler, but there are -a few differences. White space separates tokens; it is not itself a -token of any kind. Tokens do not have to be separated by white space, -but it is often necessary to avoid ambiguities. - -When faced with a sequence of characters that has more than one possible -tokenization, the preprocessor is greedy. It always makes each token, -starting from the left, as big as possible before moving on to the next -token. For instance, @code{a+++++b} is interpreted as -@code{@w{a ++ ++ + b}}, not as @code{@w{a ++ + ++ b}}, even though the -latter tokenization could be part of a valid C program and the former -could not. - -Once the input file is broken into tokens, the token boundaries never -change, except when the @samp{##} preprocessing operator is used to paste -tokens together. @xref{Concatenation}. For example, - -@smallexample -@group -#define foo() bar -foo()baz - @expansion{} bar baz -@emph{not} - @expansion{} barbaz -@end group -@end smallexample - -The compiler does not re-tokenize the preprocessor's output. Each -preprocessing token becomes one compiler token. - -@cindex identifiers -Preprocessing tokens fall into five broad classes: identifiers, -preprocessing numbers, string literals, punctuators, and other. An -@dfn{identifier} is the same as an identifier in C: any sequence of -letters, digits, or underscores, which begins with a letter or -underscore. Keywords of C have no significance to the preprocessor; -they are ordinary identifiers. You can define a macro whose name is a -keyword, for instance. The only identifier which can be considered a -preprocessing keyword is @code{defined}. @xref{Defined}. - -This is mostly true of other languages which use the C preprocessor. -However, a few of the keywords of C++ are significant even in the -preprocessor. @xref{C++ Named Operators}. - -In the 1999 C standard, identifiers may contain letters which are not -part of the ``basic source character set'', at the implementation's -discretion (such as accented Latin letters, Greek letters, or Chinese -ideograms). This may be done with an extended character set, or the -@samp{\u} and @samp{\U} escape sequences. GCC only accepts such -characters in the @samp{\u} and @samp{\U} forms. - -As an extension, GCC treats @samp{$} as a letter. This is for -compatibility with some systems, such as VMS, where @samp{$} is commonly -used in system-defined function and object names. @samp{$} is not a -letter in strictly conforming mode, or if you specify the @option{-$} -option. @xref{Invocation}. - -@cindex numbers -@cindex preprocessing numbers -A @dfn{preprocessing number} has a rather bizarre definition. The -category includes all the normal integer and floating point constants -one expects of C, but also a number of other things one might not -initially recognize as a number. Formally, preprocessing numbers begin -with an optional period, a required decimal digit, and then continue -with any sequence of letters, digits, underscores, periods, and -exponents. Exponents are the two-character sequences @samp{e+}, -@samp{e-}, @samp{E+}, @samp{E-}, @samp{p+}, @samp{p-}, @samp{P+}, and -@samp{P-}. (The exponents that begin with @samp{p} or @samp{P} are new -to C99. They are used for hexadecimal floating-point constants.) - -The purpose of this unusual definition is to isolate the preprocessor -from the full complexity of numeric constants. It does not have to -distinguish between lexically valid and invalid floating-point numbers, -which is complicated. The definition also permits you to split an -identifier at any position and get exactly two tokens, which can then be -pasted back together with the @samp{##} operator. - -It's possible for preprocessing numbers to cause programs to be -misinterpreted. For example, @code{0xE+12} is a preprocessing number -which does not translate to any valid numeric constant, therefore a -syntax error. It does not mean @code{@w{0xE + 12}}, which is what you -might have intended. - -@cindex string literals -@cindex string constants -@cindex character constants -@cindex header file names -@c the @: prevents makeinfo from turning '' into ". -@dfn{String literals} are string constants, character constants, and -header file names (the argument of @samp{#include}).@footnote{The C -standard uses the term @dfn{string literal} to refer only to what we are -calling @dfn{string constants}.} String constants and character -constants are straightforward: @t{"@dots{}"} or @t{'@dots{}'}. In -either case embedded quotes should be escaped with a backslash: -@t{'\'@:'} is the character constant for @samp{'}. There is no limit on -the length of a character constant, but the value of a character -constant that contains more than one character is -implementation-defined. @xref{Implementation Details}. - -Header file names either look like string constants, @t{"@dots{}"}, or are -written with angle brackets instead, @t{<@dots{}>}. In either case, -backslash is an ordinary character. There is no way to escape the -closing quote or angle bracket. The preprocessor looks for the header -file in different places depending on which form you use. @xref{Include -Operation}. - -No string literal may extend past the end of a line. Older versions -of GCC accepted multi-line string constants. You may use continued -lines instead, or string constant concatenation. @xref{Differences -from previous versions}. - -@cindex punctuators -@cindex digraphs -@cindex alternative tokens -@dfn{Punctuators} are all the usual bits of punctuation which are -meaningful to C and C++. All but three of the punctuation characters in -ASCII are C punctuators. The exceptions are @samp{@@}, @samp{$}, and -@samp{`}. In addition, all the two- and three-character operators are -punctuators. There are also six @dfn{digraphs}, which the C++ standard -calls @dfn{alternative tokens}, which are merely alternate ways to spell -other punctuators. This is a second attempt to work around missing -punctuation in obsolete systems. It has no negative side effects, -unlike trigraphs, but does not cover as much ground. The digraphs and -their corresponding normal punctuators are: - -@smallexample -Digraph: <% %> <: :> %: %:%: -Punctuator: @{ @} [ ] # ## -@end smallexample - -@cindex other tokens -Any other single character is considered ``other''. It is passed on to -the preprocessor's output unmolested. The C compiler will almost -certainly reject source code containing ``other'' tokens. In ASCII, the -only other characters are @samp{@@}, @samp{$}, @samp{`}, and control -characters other than NUL (all bits zero). (Note that @samp{$} is -normally considered a letter.) All characters with the high bit set -(numeric range 0x7F--0xFF) are also ``other'' in the present -implementation. This will change when proper support for international -character sets is added to GCC@. - -NUL is a special case because of the high probability that its -appearance is accidental, and because it may be invisible to the user -(many terminals do not display NUL at all). Within comments, NULs are -silently ignored, just as any other character would be. In running -text, NUL is considered white space. For example, these two directives -have the same meaning. - -@smallexample -#define X^@@1 -#define X 1 -@end smallexample - -@noindent -(where @samp{^@@} is ASCII NUL)@. Within string or character constants, -NULs are preserved. In the latter two cases the preprocessor emits a -warning message. - -@node The preprocessing language -@section The preprocessing language -@cindex directives -@cindex preprocessing directives -@cindex directive line -@cindex directive name - -After tokenization, the stream of tokens may simply be passed straight -to the compiler's parser. However, if it contains any operations in the -@dfn{preprocessing language}, it will be transformed first. This stage -corresponds roughly to the standard's ``translation phase 4'' and is -what most people think of as the preprocessor's job. - -The preprocessing language consists of @dfn{directives} to be executed -and @dfn{macros} to be expanded. Its primary capabilities are: - -@itemize @bullet -@item -Inclusion of header files. These are files of declarations that can be -substituted into your program. - -@item -Macro expansion. You can define @dfn{macros}, which are abbreviations -for arbitrary fragments of C code. The preprocessor will replace the -macros with their definitions throughout the program. Some macros are -automatically defined for you. - -@item -Conditional compilation. You can include or exclude parts of the -program according to various conditions. - -@item -Line control. If you use a program to combine or rearrange source files -into an intermediate file which is then compiled, you can use line -control to inform the compiler where each source line originally came -from. - -@item -Diagnostics. You can detect problems at compile time and issue errors -or warnings. -@end itemize - -There are a few more, less useful, features. - -Except for expansion of predefined macros, all these operations are -triggered with @dfn{preprocessing directives}. Preprocessing directives -are lines in your program that start with @samp{#}. Whitespace is -allowed before and after the @samp{#}. The @samp{#} is followed by an -identifier, the @dfn{directive name}. It specifies the operation to -perform. Directives are commonly referred to as @samp{#@var{name}} -where @var{name} is the directive name. For example, @samp{#define} is -the directive that defines a macro. - -The @samp{#} which begins a directive cannot come from a macro -expansion. Also, the directive name is not macro expanded. Thus, if -@code{foo} is defined as a macro expanding to @code{define}, that does -not make @samp{#foo} a valid preprocessing directive. - -The set of valid directive names is fixed. Programs cannot define new -preprocessing directives. - -Some directives require arguments; these make up the rest of the -directive line and must be separated from the directive name by -whitespace. For example, @samp{#define} must be followed by a macro -name and the intended expansion of the macro. - -A preprocessing directive cannot cover more than one line. The line -may, however, be continued with backslash-newline, or by a block comment -which extends past the end of the line. In either case, when the -directive is processed, the continuations have already been merged with -the first line to make one long line. - -@node Header Files -@chapter Header Files - -@cindex header file -A header file is a file containing C declarations and macro definitions -(@pxref{Macros}) to be shared between several source files. You request -the use of a header file in your program by @dfn{including} it, with the -C preprocessing directive @samp{#include}. - -Header files serve two purposes. - -@itemize @bullet -@item -@cindex system header files -System header files declare the interfaces to parts of the operating -system. You include them in your program to supply the definitions and -declarations you need to invoke system calls and libraries. - -@item -Your own header files contain declarations for interfaces between the -source files of your program. Each time you have a group of related -declarations and macro definitions all or most of which are needed in -several different source files, it is a good idea to create a header -file for them. -@end itemize - -Including a header file produces the same results as copying the header -file into each source file that needs it. Such copying would be -time-consuming and error-prone. With a header file, the related -declarations appear in only one place. If they need to be changed, they -can be changed in one place, and programs that include the header file -will automatically use the new version when next recompiled. The header -file eliminates the labor of finding and changing all the copies as well -as the risk that a failure to find one copy will result in -inconsistencies within a program. - -In C, the usual convention is to give header files names that end with -@file{.h}. It is most portable to use only letters, digits, dashes, and -underscores in header file names, and at most one dot. - -@menu -* Include Syntax:: -* Include Operation:: -* Search Path:: -* Once-Only Headers:: -* Alternatives to Wrapper #ifndef:: -* Computed Includes:: -* Wrapper Headers:: -* System Headers:: -@end menu - -@node Include Syntax -@section Include Syntax - -@findex #include -Both user and system header files are included using the preprocessing -directive @samp{#include}. It has two variants: - -@table @code -@item #include <@var{file}> -This variant is used for system header files. It searches for a file -named @var{file} in a standard list of system directories. You can prepend -directories to this list with the @option{-I} option (@pxref{Invocation}). - -@item #include "@var{file}" -This variant is used for header files of your own program. It -searches for a file named @var{file} first in the directory containing -the current file, then in the quote directories and then the same -directories used for @code{<@var{file}>}. You can prepend directories -to the list of quote directories with the @option{-iquote} option. -@end table - -The argument of @samp{#include}, whether delimited with quote marks or -angle brackets, behaves like a string constant in that comments are not -recognized, and macro names are not expanded. Thus, @code{@w{#include -}} specifies inclusion of a system header file named @file{x/*y}. - -However, if backslashes occur within @var{file}, they are considered -ordinary text characters, not escape characters. None of the character -escape sequences appropriate to string constants in C are processed. -Thus, @code{@w{#include "x\n\\y"}} specifies a filename containing three -backslashes. (Some systems interpret @samp{\} as a pathname separator. -All of these also interpret @samp{/} the same way. It is most portable -to use only @samp{/}.) - -It is an error if there is anything (other than comments) on the line -after the file name. - -@node Include Operation -@section Include Operation - -The @samp{#include} directive works by directing the C preprocessor to -scan the specified file as input before continuing with the rest of the -current file. The output from the preprocessor contains the output -already generated, followed by the output resulting from the included -file, followed by the output that comes from the text after the -@samp{#include} directive. For example, if you have a header file -@file{header.h} as follows, - -@smallexample -char *test (void); -@end smallexample - -@noindent -and a main program called @file{program.c} that uses the header file, -like this, - -@smallexample -int x; -#include "header.h" - -int -main (void) -@{ - puts (test ()); -@} -@end smallexample - -@noindent -the compiler will see the same token stream as it would if -@file{program.c} read - -@smallexample -int x; -char *test (void); - -int -main (void) -@{ - puts (test ()); -@} -@end smallexample - -Included files are not limited to declarations and macro definitions; -those are merely the typical uses. Any fragment of a C program can be -included from another file. The include file could even contain the -beginning of a statement that is concluded in the containing file, or -the end of a statement that was started in the including file. However, -an included file must consist of complete tokens. Comments and string -literals which have not been closed by the end of an included file are -invalid. For error recovery, they are considered to end at the end of -the file. - -To avoid confusion, it is best if header files contain only complete -syntactic units---function declarations or definitions, type -declarations, etc. - -The line following the @samp{#include} directive is always treated as a -separate line by the C preprocessor, even if the included file lacks a -final newline. - -@node Search Path -@section Search Path - -GCC looks in several different places for headers. On a normal Unix -system, if you do not instruct it otherwise, it will look for headers -requested with @code{@w{#include <@var{file}>}} in: - -@smallexample -/usr/local/include -@var{libdir}/gcc/@var{target}/@var{version}/include -/usr/@var{target}/include -/usr/include -@end smallexample - -For C++ programs, it will also look in -@file{@var{libdir}/../include/c++/@var{version}}, -first. In the above, @var{target} is the canonical name of the system -GCC was configured to compile code for; often but not always the same as -the canonical name of the system it runs on. @var{version} is the -version of GCC in use. - -You can add to this list with the @option{-I@var{dir}} command-line -option. All the directories named by @option{-I} are searched, in -left-to-right order, @emph{before} the default directories. The only -exception is when @file{dir} is already searched by default. In -this case, the option is ignored and the search order for system -directories remains unchanged. - -Duplicate directories are removed from the quote and bracket search -chains before the two chains are merged to make the final search chain. -Thus, it is possible for a directory to occur twice in the final search -chain if it was specified in both the quote and bracket chains. - -You can prevent GCC from searching any of the default directories with -the @option{-nostdinc} option. This is useful when you are compiling an -operating system kernel or some other program that does not use the -standard C library facilities, or the standard C library itself. -@option{-I} options are not ignored as described above when -@option{-nostdinc} is in effect. - -GCC looks for headers requested with @code{@w{#include "@var{file}"}} -first in the directory containing the current file, then in the -directories as specified by @option{-iquote} options, then in the same -places it would have looked for a header requested with angle -brackets. For example, if @file{/usr/include/sys/stat.h} contains -@code{@w{#include "types.h"}}, GCC looks for @file{types.h} first in -@file{/usr/include/sys}, then in its usual search path. - -@samp{#line} (@pxref{Line Control}) does not change GCC's idea of the -directory containing the current file. - -You may put @option{-I-} at any point in your list of @option{-I} options. -This has two effects. First, directories appearing before the -@option{-I-} in the list are searched only for headers requested with -quote marks. Directories after @option{-I-} are searched for all -headers. Second, the directory containing the current file is not -searched for anything, unless it happens to be one of the directories -named by an @option{-I} switch. @option{-I-} is deprecated, @option{-iquote} -should be used instead. - -@option{-I. -I-} is not the same as no @option{-I} options at all, and does -not cause the same behavior for @samp{<>} includes that @samp{""} -includes get with no special options. @option{-I.} searches the -compiler's current working directory for header files. That may or may -not be the same as the directory containing the current file. - -If you need to look for headers in a directory named @file{-}, write -@option{-I./-}. - -There are several more ways to adjust the header search path. They are -generally less useful. @xref{Invocation}. - -@node Once-Only Headers -@section Once-Only Headers -@cindex repeated inclusion -@cindex including just once -@cindex wrapper @code{#ifndef} - -If a header file happens to be included twice, the compiler will process -its contents twice. This is very likely to cause an error, e.g.@: when the -compiler sees the same structure definition twice. Even if it does not, -it will certainly waste time. - -The standard way to prevent this is to enclose the entire real contents -of the file in a conditional, like this: - -@smallexample -@group -/* File foo. */ -#ifndef FILE_FOO_SEEN -#define FILE_FOO_SEEN - -@var{the entire file} - -#endif /* !FILE_FOO_SEEN */ -@end group -@end smallexample - -This construct is commonly known as a @dfn{wrapper #ifndef}. -When the header is included again, the conditional will be false, -because @code{FILE_FOO_SEEN} is defined. The preprocessor will skip -over the entire contents of the file, and the compiler will not see it -twice. - -CPP optimizes even further. It remembers when a header file has a -wrapper @samp{#ifndef}. If a subsequent @samp{#include} specifies that -header, and the macro in the @samp{#ifndef} is still defined, it does -not bother to rescan the file at all. - -You can put comments outside the wrapper. They will not interfere with -this optimization. - -@cindex controlling macro -@cindex guard macro -The macro @code{FILE_FOO_SEEN} is called the @dfn{controlling macro} or -@dfn{guard macro}. In a user header file, the macro name should not -begin with @samp{_}. In a system header file, it should begin with -@samp{__} to avoid conflicts with user programs. In any kind of header -file, the macro name should contain the name of the file and some -additional text, to avoid conflicts with other header files. - -@node Alternatives to Wrapper #ifndef -@section Alternatives to Wrapper #ifndef - -CPP supports two more ways of indicating that a header file should be -read only once. Neither one is as portable as a wrapper @samp{#ifndef} -and we recommend you do not use them in new programs, with the caveat -that @samp{#import} is standard practice in Objective-C. - -@findex #import -CPP supports a variant of @samp{#include} called @samp{#import} which -includes a file, but does so at most once. If you use @samp{#import} -instead of @samp{#include}, then you don't need the conditionals -inside the header file to prevent multiple inclusion of the contents. -@samp{#import} is standard in Objective-C, but is considered a -deprecated extension in C and C++. - -@samp{#import} is not a well designed feature. It requires the users of -a header file to know that it should only be included once. It is much -better for the header file's implementor to write the file so that users -don't need to know this. Using a wrapper @samp{#ifndef} accomplishes -this goal. - -In the present implementation, a single use of @samp{#import} will -prevent the file from ever being read again, by either @samp{#import} or -@samp{#include}. You should not rely on this; do not use both -@samp{#import} and @samp{#include} to refer to the same header file. - -Another way to prevent a header file from being included more than once -is with the @samp{#pragma once} directive. If @samp{#pragma once} is -seen when scanning a header file, that file will never be read again, no -matter what. - -@samp{#pragma once} does not have the problems that @samp{#import} does, -but it is not recognized by all preprocessors, so you cannot rely on it -in a portable program. - -@node Computed Includes -@section Computed Includes -@cindex computed includes -@cindex macros in include - -Sometimes it is necessary to select one of several different header -files to be included into your program. They might specify -configuration parameters to be used on different sorts of operating -systems, for instance. You could do this with a series of conditionals, - -@smallexample -#if SYSTEM_1 -# include "system_1.h" -#elif SYSTEM_2 -# include "system_2.h" -#elif SYSTEM_3 -@dots{} -#endif -@end smallexample - -That rapidly becomes tedious. Instead, the preprocessor offers the -ability to use a macro for the header name. This is called a -@dfn{computed include}. Instead of writing a header name as the direct -argument of @samp{#include}, you simply put a macro name there instead: - -@smallexample -#define SYSTEM_H "system_1.h" -@dots{} -#include SYSTEM_H -@end smallexample - -@noindent -@code{SYSTEM_H} will be expanded, and the preprocessor will look for -@file{system_1.h} as if the @samp{#include} had been written that way -originally. @code{SYSTEM_H} could be defined by your Makefile with a -@option{-D} option. - -You must be careful when you define the macro. @samp{#define} saves -tokens, not text. The preprocessor has no way of knowing that the macro -will be used as the argument of @samp{#include}, so it generates -ordinary tokens, not a header name. This is unlikely to cause problems -if you use double-quote includes, which are close enough to string -constants. If you use angle brackets, however, you may have trouble. - -The syntax of a computed include is actually a bit more general than the -above. If the first non-whitespace character after @samp{#include} is -not @samp{"} or @samp{<}, then the entire line is macro-expanded -like running text would be. - -If the line expands to a single string constant, the contents of that -string constant are the file to be included. CPP does not re-examine the -string for embedded quotes, but neither does it process backslash -escapes in the string. Therefore - -@smallexample -#define HEADER "a\"b" -#include HEADER -@end smallexample - -@noindent -looks for a file named @file{a\"b}. CPP searches for the file according -to the rules for double-quoted includes. - -If the line expands to a token stream beginning with a @samp{<} token -and including a @samp{>} token, then the tokens between the @samp{<} and -the first @samp{>} are combined to form the filename to be included. -Any whitespace between tokens is reduced to a single space; then any -space after the initial @samp{<} is retained, but a trailing space -before the closing @samp{>} is ignored. CPP searches for the file -according to the rules for angle-bracket includes. - -In either case, if there are any tokens on the line after the file name, -an error occurs and the directive is not processed. It is also an error -if the result of expansion does not match either of the two expected -forms. - -These rules are implementation-defined behavior according to the C -standard. To minimize the risk of different compilers interpreting your -computed includes differently, we recommend you use only a single -object-like macro which expands to a string constant. This will also -minimize confusion for people reading your program. - -@node Wrapper Headers -@section Wrapper Headers -@cindex wrapper headers -@cindex overriding a header file -@findex #include_next - -Sometimes it is necessary to adjust the contents of a system-provided -header file without editing it directly. GCC's @command{fixincludes} -operation does this, for example. One way to do that would be to create -a new header file with the same name and insert it in the search path -before the original header. That works fine as long as you're willing -to replace the old header entirely. But what if you want to refer to -the old header from the new one? - -You cannot simply include the old header with @samp{#include}. That -will start from the beginning, and find your new header again. If your -header is not protected from multiple inclusion (@pxref{Once-Only -Headers}), it will recurse infinitely and cause a fatal error. - -You could include the old header with an absolute pathname: -@smallexample -#include "/usr/include/old-header.h" -@end smallexample -@noindent -This works, but is not clean; should the system headers ever move, you -would have to edit the new headers to match. - -There is no way to solve this problem within the C standard, but you can -use the GNU extension @samp{#include_next}. It means, ``Include the -@emph{next} file with this name''. This directive works like -@samp{#include} except in searching for the specified file: it starts -searching the list of header file directories @emph{after} the directory -in which the current file was found. - -Suppose you specify @option{-I /usr/local/include}, and the list of -directories to search also includes @file{/usr/include}; and suppose -both directories contain @file{signal.h}. Ordinary @code{@w{#include -}} finds the file under @file{/usr/local/include}. If that -file contains @code{@w{#include_next }}, it starts searching -after that directory, and finds the file in @file{/usr/include}. - -@samp{#include_next} does not distinguish between @code{<@var{file}>} -and @code{"@var{file}"} inclusion, nor does it check that the file you -specify has the same name as the current file. It simply looks for the -file named, starting with the directory in the search path after the one -where the current file was found. - -The use of @samp{#include_next} can lead to great confusion. We -recommend it be used only when there is no other alternative. In -particular, it should not be used in the headers belonging to a specific -program; it should be used only to make global corrections along the -lines of @command{fixincludes}. - -@node System Headers -@section System Headers -@cindex system header files - -The header files declaring interfaces to the operating system and -runtime libraries often cannot be written in strictly conforming C@. -Therefore, GCC gives code found in @dfn{system headers} special -treatment. All warnings, other than those generated by @samp{#warning} -(@pxref{Diagnostics}), are suppressed while GCC is processing a system -header. Macros defined in a system header are immune to a few warnings -wherever they are expanded. This immunity is granted on an ad-hoc -basis, when we find that a warning generates lots of false positives -because of code in macros defined in system headers. - -Normally, only the headers found in specific directories are considered -system headers. These directories are determined when GCC is compiled. -There are, however, two ways to make normal headers into system headers. - -The @option{-isystem} command-line option adds its argument to the list of -directories to search for headers, just like @option{-I}. Any headers -found in that directory will be considered system headers. - -All directories named by @option{-isystem} are searched @emph{after} all -directories named by @option{-I}, no matter what their order was on the -command line. If the same directory is named by both @option{-I} and -@option{-isystem}, the @option{-I} option is ignored. GCC provides an -informative message when this occurs if @option{-v} is used. - -@findex #pragma GCC system_header -There is also a directive, @code{@w{#pragma GCC system_header}}, which -tells GCC to consider the rest of the current include file a system -header, no matter where it was found. Code that comes before the -@samp{#pragma} in the file will not be affected. @code{@w{#pragma GCC -system_header}} has no effect in the primary source file. - -On very old systems, some of the pre-defined system header directories -get even more special treatment. GNU C++ considers code in headers -found in those directories to be surrounded by an @code{@w{extern "C"}} -block. There is no way to request this behavior with a @samp{#pragma}, -or from the command line. - -@node Macros -@chapter Macros - -A @dfn{macro} is a fragment of code which has been given a name. -Whenever the name is used, it is replaced by the contents of the macro. -There are two kinds of macros. They differ mostly in what they look -like when they are used. @dfn{Object-like} macros resemble data objects -when used, @dfn{function-like} macros resemble function calls. - -You may define any valid identifier as a macro, even if it is a C -keyword. The preprocessor does not know anything about keywords. This -can be useful if you wish to hide a keyword such as @code{const} from an -older compiler that does not understand it. However, the preprocessor -operator @code{defined} (@pxref{Defined}) can never be defined as a -macro, and C++'s named operators (@pxref{C++ Named Operators}) cannot be -macros when you are compiling C++. - -@menu -* Object-like Macros:: -* Function-like Macros:: -* Macro Arguments:: -* Stringification:: -* Concatenation:: -* Variadic Macros:: -* Predefined Macros:: -* Undefining and Redefining Macros:: -* Directives Within Macro Arguments:: -* Macro Pitfalls:: -@end menu - -@node Object-like Macros -@section Object-like Macros -@cindex object-like macro -@cindex symbolic constants -@cindex manifest constants - -An @dfn{object-like macro} is a simple identifier which will be replaced -by a code fragment. It is called object-like because it looks like a -data object in code that uses it. They are most commonly used to give -symbolic names to numeric constants. - -@findex #define -You create macros with the @samp{#define} directive. @samp{#define} is -followed by the name of the macro and then the token sequence it should -be an abbreviation for, which is variously referred to as the macro's -@dfn{body}, @dfn{expansion} or @dfn{replacement list}. For example, - -@smallexample -#define BUFFER_SIZE 1024 -@end smallexample - -@noindent -defines a macro named @code{BUFFER_SIZE} as an abbreviation for the -token @code{1024}. If somewhere after this @samp{#define} directive -there comes a C statement of the form - -@smallexample -foo = (char *) malloc (BUFFER_SIZE); -@end smallexample - -@noindent -then the C preprocessor will recognize and @dfn{expand} the macro -@code{BUFFER_SIZE}. The C compiler will see the same tokens as it would -if you had written - -@smallexample -foo = (char *) malloc (1024); -@end smallexample - -By convention, macro names are written in uppercase. Programs are -easier to read when it is possible to tell at a glance which names are -macros. - -The macro's body ends at the end of the @samp{#define} line. You may -continue the definition onto multiple lines, if necessary, using -backslash-newline. When the macro is expanded, however, it will all -come out on one line. For example, - -@smallexample -#define NUMBERS 1, \ - 2, \ - 3 -int x[] = @{ NUMBERS @}; - @expansion{} int x[] = @{ 1, 2, 3 @}; -@end smallexample - -@noindent -The most common visible consequence of this is surprising line numbers -in error messages. - -There is no restriction on what can go in a macro body provided it -decomposes into valid preprocessing tokens. Parentheses need not -balance, and the body need not resemble valid C code. (If it does not, -you may get error messages from the C compiler when you use the macro.) - -The C preprocessor scans your program sequentially. Macro definitions -take effect at the place you write them. Therefore, the following input -to the C preprocessor - -@smallexample -foo = X; -#define X 4 -bar = X; -@end smallexample - -@noindent -produces - -@smallexample -foo = X; -bar = 4; -@end smallexample - -When the preprocessor expands a macro name, the macro's expansion -replaces the macro invocation, then the expansion is examined for more -macros to expand. For example, - -@smallexample -@group -#define TABLESIZE BUFSIZE -#define BUFSIZE 1024 -TABLESIZE - @expansion{} BUFSIZE - @expansion{} 1024 -@end group -@end smallexample - -@noindent -@code{TABLESIZE} is expanded first to produce @code{BUFSIZE}, then that -macro is expanded to produce the final result, @code{1024}. - -Notice that @code{BUFSIZE} was not defined when @code{TABLESIZE} was -defined. The @samp{#define} for @code{TABLESIZE} uses exactly the -expansion you specify---in this case, @code{BUFSIZE}---and does not -check to see whether it too contains macro names. Only when you -@emph{use} @code{TABLESIZE} is the result of its expansion scanned for -more macro names. - -This makes a difference if you change the definition of @code{BUFSIZE} -at some point in the source file. @code{TABLESIZE}, defined as shown, -will always expand using the definition of @code{BUFSIZE} that is -currently in effect: - -@smallexample -#define BUFSIZE 1020 -#define TABLESIZE BUFSIZE -#undef BUFSIZE -#define BUFSIZE 37 -@end smallexample - -@noindent -Now @code{TABLESIZE} expands (in two stages) to @code{37}. - -If the expansion of a macro contains its own name, either directly or -via intermediate macros, it is not expanded again when the expansion is -examined for more macros. This prevents infinite recursion. -@xref{Self-Referential Macros}, for the precise details. - -@node Function-like Macros -@section Function-like Macros -@cindex function-like macros - -You can also define macros whose use looks like a function call. These -are called @dfn{function-like macros}. To define a function-like macro, -you use the same @samp{#define} directive, but you put a pair of -parentheses immediately after the macro name. For example, - -@smallexample -#define lang_init() c_init() -lang_init() - @expansion{} c_init() -@end smallexample - -A function-like macro is only expanded if its name appears with a pair -of parentheses after it. If you write just the name, it is left alone. -This can be useful when you have a function and a macro of the same -name, and you wish to use the function sometimes. - -@smallexample -extern void foo(void); -#define foo() /* @r{optimized inline version} */ -@dots{} - foo(); - funcptr = foo; -@end smallexample - -Here the call to @code{foo()} will use the macro, but the function -pointer will get the address of the real function. If the macro were to -be expanded, it would cause a syntax error. - -If you put spaces between the macro name and the parentheses in the -macro definition, that does not define a function-like macro, it defines -an object-like macro whose expansion happens to begin with a pair of -parentheses. - -@smallexample -#define lang_init () c_init() -lang_init() - @expansion{} () c_init()() -@end smallexample - -The first two pairs of parentheses in this expansion come from the -macro. The third is the pair that was originally after the macro -invocation. Since @code{lang_init} is an object-like macro, it does not -consume those parentheses. - -@node Macro Arguments -@section Macro Arguments -@cindex arguments -@cindex macros with arguments -@cindex arguments in macro definitions - -Function-like macros can take @dfn{arguments}, just like true functions. -To define a macro that uses arguments, you insert @dfn{parameters} -between the pair of parentheses in the macro definition that make the -macro function-like. The parameters must be valid C identifiers, -separated by commas and optionally whitespace. - -To invoke a macro that takes arguments, you write the name of the macro -followed by a list of @dfn{actual arguments} in parentheses, separated -by commas. The invocation of the macro need not be restricted to a -single logical line---it can cross as many lines in the source file as -you wish. The number of arguments you give must match the number of -parameters in the macro definition. When the macro is expanded, each -use of a parameter in its body is replaced by the tokens of the -corresponding argument. (You need not use all of the parameters in the -macro body.) - -As an example, here is a macro that computes the minimum of two numeric -values, as it is defined in many C programs, and some uses. - -@smallexample -#define min(X, Y) ((X) < (Y) ? (X) : (Y)) - x = min(a, b); @expansion{} x = ((a) < (b) ? (a) : (b)); - y = min(1, 2); @expansion{} y = ((1) < (2) ? (1) : (2)); - z = min(a + 28, *p); @expansion{} z = ((a + 28) < (*p) ? (a + 28) : (*p)); -@end smallexample - -@noindent -(In this small example you can already see several of the dangers of -macro arguments. @xref{Macro Pitfalls}, for detailed explanations.) - -Leading and trailing whitespace in each argument is dropped, and all -whitespace between the tokens of an argument is reduced to a single -space. Parentheses within each argument must balance; a comma within -such parentheses does not end the argument. However, there is no -requirement for square brackets or braces to balance, and they do not -prevent a comma from separating arguments. Thus, - -@smallexample -macro (array[x = y, x + 1]) -@end smallexample - -@noindent -passes two arguments to @code{macro}: @code{array[x = y} and @code{x + -1]}. If you want to supply @code{array[x = y, x + 1]} as an argument, -you can write it as @code{array[(x = y, x + 1)]}, which is equivalent C -code. - -All arguments to a macro are completely macro-expanded before they are -substituted into the macro body. After substitution, the complete text -is scanned again for macros to expand, including the arguments. This rule -may seem strange, but it is carefully designed so you need not worry -about whether any function call is actually a macro invocation. You can -run into trouble if you try to be too clever, though. @xref{Argument -Prescan}, for detailed discussion. - -For example, @code{min (min (a, b), c)} is first expanded to - -@smallexample - min (((a) < (b) ? (a) : (b)), (c)) -@end smallexample - -@noindent -and then to - -@smallexample -@group -((((a) < (b) ? (a) : (b))) < (c) - ? (((a) < (b) ? (a) : (b))) - : (c)) -@end group -@end smallexample - -@noindent -(Line breaks shown here for clarity would not actually be generated.) - -@cindex empty macro arguments -You can leave macro arguments empty; this is not an error to the -preprocessor (but many macros will then expand to invalid code). -You cannot leave out arguments entirely; if a macro takes two arguments, -there must be exactly one comma at the top level of its argument list. -Here are some silly examples using @code{min}: - -@smallexample -min(, b) @expansion{} (( ) < (b) ? ( ) : (b)) -min(a, ) @expansion{} ((a ) < ( ) ? (a ) : ( )) -min(,) @expansion{} (( ) < ( ) ? ( ) : ( )) -min((,),) @expansion{} (((,)) < ( ) ? ((,)) : ( )) - -min() @error{} macro "min" requires 2 arguments, but only 1 given -min(,,) @error{} macro "min" passed 3 arguments, but takes just 2 -@end smallexample - -Whitespace is not a preprocessing token, so if a macro @code{foo} takes -one argument, @code{@w{foo ()}} and @code{@w{foo ( )}} both supply it an -empty argument. Previous GNU preprocessor implementations and -documentation were incorrect on this point, insisting that a -function-like macro that takes a single argument be passed a space if an -empty argument was required. - -Macro parameters appearing inside string literals are not replaced by -their corresponding actual arguments. - -@smallexample -#define foo(x) x, "x" -foo(bar) @expansion{} bar, "x" -@end smallexample - -@node Stringification -@section Stringification -@cindex stringification -@cindex @samp{#} operator - -Sometimes you may want to convert a macro argument into a string -constant. Parameters are not replaced inside string constants, but you -can use the @samp{#} preprocessing operator instead. When a macro -parameter is used with a leading @samp{#}, the preprocessor replaces it -with the literal text of the actual argument, converted to a string -constant. Unlike normal parameter replacement, the argument is not -macro-expanded first. This is called @dfn{stringification}. - -There is no way to combine an argument with surrounding text and -stringify it all together. Instead, you can write a series of adjacent -string constants and stringified arguments. The preprocessor will -replace the stringified arguments with string constants. The C -compiler will then combine all the adjacent string constants into one -long string. - -Here is an example of a macro definition that uses stringification: - -@smallexample -@group -#define WARN_IF(EXP) \ -do @{ if (EXP) \ - fprintf (stderr, "Warning: " #EXP "\n"); @} \ -while (0) -WARN_IF (x == 0); - @expansion{} do @{ if (x == 0) - fprintf (stderr, "Warning: " "x == 0" "\n"); @} while (0); -@end group -@end smallexample - -@noindent -The argument for @code{EXP} is substituted once, as-is, into the -@code{if} statement, and once, stringified, into the argument to -@code{fprintf}. If @code{x} were a macro, it would be expanded in the -@code{if} statement, but not in the string. - -The @code{do} and @code{while (0)} are a kludge to make it possible to -write @code{WARN_IF (@var{arg});}, which the resemblance of -@code{WARN_IF} to a function would make C programmers want to do; see -@ref{Swallowing the Semicolon}. - -Stringification in C involves more than putting double-quote characters -around the fragment. The preprocessor backslash-escapes the quotes -surrounding embedded string constants, and all backslashes within string and -character constants, in order to get a valid C string constant with the -proper contents. Thus, stringifying @code{@w{p = "foo\n";}} results in -@t{@w{"p = \"foo\\n\";"}}. However, backslashes that are not inside string -or character constants are not duplicated: @samp{\n} by itself -stringifies to @t{"\n"}. - -All leading and trailing whitespace in text being stringified is -ignored. Any sequence of whitespace in the middle of the text is -converted to a single space in the stringified result. Comments are -replaced by whitespace long before stringification happens, so they -never appear in stringified text. - -There is no way to convert a macro argument into a character constant. - -If you want to stringify the result of expansion of a macro argument, -you have to use two levels of macros. - -@smallexample -#define xstr(s) str(s) -#define str(s) #s -#define foo 4 -str (foo) - @expansion{} "foo" -xstr (foo) - @expansion{} xstr (4) - @expansion{} str (4) - @expansion{} "4" -@end smallexample - -@code{s} is stringified when it is used in @code{str}, so it is not -macro-expanded first. But @code{s} is an ordinary argument to -@code{xstr}, so it is completely macro-expanded before @code{xstr} -itself is expanded (@pxref{Argument Prescan}). Therefore, by the time -@code{str} gets to its argument, it has already been macro-expanded. - -@node Concatenation -@section Concatenation -@cindex concatenation -@cindex token pasting -@cindex token concatenation -@cindex @samp{##} operator - -It is often useful to merge two tokens into one while expanding macros. -This is called @dfn{token pasting} or @dfn{token concatenation}. The -@samp{##} preprocessing operator performs token pasting. When a macro -is expanded, the two tokens on either side of each @samp{##} operator -are combined into a single token, which then replaces the @samp{##} and -the two original tokens in the macro expansion. Usually both will be -identifiers, or one will be an identifier and the other a preprocessing -number. When pasted, they make a longer identifier. This isn't the -only valid case. It is also possible to concatenate two numbers (or a -number and a name, such as @code{1.5} and @code{e3}) into a number. -Also, multi-character operators such as @code{+=} can be formed by -token pasting. - -However, two tokens that don't together form a valid token cannot be -pasted together. For example, you cannot concatenate @code{x} with -@code{+} in either order. If you try, the preprocessor issues a warning -and emits the two tokens. Whether it puts white space between the -tokens is undefined. It is common to find unnecessary uses of @samp{##} -in complex macros. If you get this warning, it is likely that you can -simply remove the @samp{##}. - -Both the tokens combined by @samp{##} could come from the macro body, -but you could just as well write them as one token in the first place. -Token pasting is most useful when one or both of the tokens comes from a -macro argument. If either of the tokens next to an @samp{##} is a -parameter name, it is replaced by its actual argument before @samp{##} -executes. As with stringification, the actual argument is not -macro-expanded first. If the argument is empty, that @samp{##} has no -effect. - -Keep in mind that the C preprocessor converts comments to whitespace -before macros are even considered. Therefore, you cannot create a -comment by concatenating @samp{/} and @samp{*}. You can put as much -whitespace between @samp{##} and its operands as you like, including -comments, and you can put comments in arguments that will be -concatenated. However, it is an error if @samp{##} appears at either -end of a macro body. - -Consider a C program that interprets named commands. There probably -needs to be a table of commands, perhaps an array of structures declared -as follows: - -@smallexample -@group -struct command -@{ - char *name; - void (*function) (void); -@}; -@end group - -@group -struct command commands[] = -@{ - @{ "quit", quit_command @}, - @{ "help", help_command @}, - @dots{} -@}; -@end group -@end smallexample - -It would be cleaner not to have to give each command name twice, once in -the string constant and once in the function name. A macro which takes the -name of a command as an argument can make this unnecessary. The string -constant can be created with stringification, and the function name by -concatenating the argument with @samp{_command}. Here is how it is done: - -@smallexample -#define COMMAND(NAME) @{ #NAME, NAME ## _command @} - -struct command commands[] = -@{ - COMMAND (quit), - COMMAND (help), - @dots{} -@}; -@end smallexample - -@node Variadic Macros -@section Variadic Macros -@cindex variable number of arguments -@cindex macros with variable arguments -@cindex variadic macros - -A macro can be declared to accept a variable number of arguments much as -a function can. The syntax for defining the macro is similar to that of -a function. Here is an example: - -@smallexample -#define eprintf(@dots{}) fprintf (stderr, __VA_ARGS__) -@end smallexample - -This kind of macro is called @dfn{variadic}. When the macro is invoked, -all the tokens in its argument list after the last named argument (this -macro has none), including any commas, become the @dfn{variable -argument}. This sequence of tokens replaces the identifier -@code{@w{__VA_ARGS__}} in the macro body wherever it appears. Thus, we -have this expansion: - -@smallexample -eprintf ("%s:%d: ", input_file, lineno) - @expansion{} fprintf (stderr, "%s:%d: ", input_file, lineno) -@end smallexample - -The variable argument is completely macro-expanded before it is inserted -into the macro expansion, just like an ordinary argument. You may use -the @samp{#} and @samp{##} operators to stringify the variable argument -or to paste its leading or trailing token with another token. (But see -below for an important special case for @samp{##}.) - -If your macro is complicated, you may want a more descriptive name for -the variable argument than @code{@w{__VA_ARGS__}}. CPP permits -this, as an extension. You may write an argument name immediately -before the @samp{@dots{}}; that name is used for the variable argument. -The @code{eprintf} macro above could be written - -@smallexample -#define eprintf(args@dots{}) fprintf (stderr, args) -@end smallexample - -@noindent -using this extension. You cannot use @code{@w{__VA_ARGS__}} and this -extension in the same macro. - -You can have named arguments as well as variable arguments in a variadic -macro. We could define @code{eprintf} like this, instead: - -@smallexample -#define eprintf(format, @dots{}) fprintf (stderr, format, __VA_ARGS__) -@end smallexample - -@noindent -This formulation looks more descriptive, but unfortunately it is less -flexible: you must now supply at least one argument after the format -string. In standard C, you cannot omit the comma separating the named -argument from the variable arguments. Furthermore, if you leave the -variable argument empty, you will get a syntax error, because -there will be an extra comma after the format string. - -@smallexample -eprintf("success!\n", ); - @expansion{} fprintf(stderr, "success!\n", ); -@end smallexample - -GNU CPP has a pair of extensions which deal with this problem. First, -you are allowed to leave the variable argument out entirely: - -@smallexample -eprintf ("success!\n") - @expansion{} fprintf(stderr, "success!\n", ); -@end smallexample - -@noindent -Second, the @samp{##} token paste operator has a special meaning when -placed between a comma and a variable argument. If you write - -@smallexample -#define eprintf(format, @dots{}) fprintf (stderr, format, ##__VA_ARGS__) -@end smallexample - -@noindent -and the variable argument is left out when the @code{eprintf} macro is -used, then the comma before the @samp{##} will be deleted. This does -@emph{not} happen if you pass an empty argument, nor does it happen if -the token preceding @samp{##} is anything other than a comma. - -@smallexample -eprintf ("success!\n") - @expansion{} fprintf(stderr, "success!\n"); -@end smallexample - -@noindent -The above explanation is ambiguous about the case where the only macro -parameter is a variable arguments parameter, as it is meaningless to -try to distinguish whether no argument at all is an empty argument or -a missing argument. In this case the C99 standard is clear that the -comma must remain, however the existing GCC extension used to swallow -the comma. So CPP retains the comma when conforming to a specific C -standard, and drops it otherwise. - -C99 mandates that the only place the identifier @code{@w{__VA_ARGS__}} -can appear is in the replacement list of a variadic macro. It may not -be used as a macro name, macro argument name, or within a different type -of macro. It may also be forbidden in open text; the standard is -ambiguous. We recommend you avoid using it except for its defined -purpose. - -Variadic macros are a new feature in C99. GNU CPP has supported them -for a long time, but only with a named variable argument -(@samp{args@dots{}}, not @samp{@dots{}} and @code{@w{__VA_ARGS__}}). If you are -concerned with portability to previous versions of GCC, you should use -only named variable arguments. On the other hand, if you are concerned -with portability to other conforming implementations of C99, you should -use only @code{@w{__VA_ARGS__}}. - -Previous versions of CPP implemented the comma-deletion extension -much more generally. We have restricted it in this release to minimize -the differences from C99. To get the same effect with both this and -previous versions of GCC, the token preceding the special @samp{##} must -be a comma, and there must be white space between that comma and -whatever comes immediately before it: - -@smallexample -#define eprintf(format, args@dots{}) fprintf (stderr, format , ##args) -@end smallexample - -@noindent -@xref{Differences from previous versions}, for the gory details. - -@node Predefined Macros -@section Predefined Macros - -@cindex predefined macros -Several object-like macros are predefined; you use them without -supplying their definitions. They fall into three classes: standard, -common, and system-specific. - -In C++, there is a fourth category, the named operators. They act like -predefined macros, but you cannot undefine them. - -@menu -* Standard Predefined Macros:: -* Common Predefined Macros:: -* System-specific Predefined Macros:: -* C++ Named Operators:: -@end menu - -@node Standard Predefined Macros -@subsection Standard Predefined Macros -@cindex standard predefined macros. - -The standard predefined macros are specified by the relevant -language standards, so they are available with all compilers that -implement those standards. Older compilers may not provide all of -them. Their names all start with double underscores. - -@table @code -@item __FILE__ -This macro expands to the name of the current input file, in the form of -a C string constant. This is the path by which the preprocessor opened -the file, not the short name specified in @samp{#include} or as the -input file name argument. For example, -@code{"/usr/local/include/myheader.h"} is a possible expansion of this -macro. - -@item __LINE__ -This macro expands to the current input line number, in the form of a -decimal integer constant. While we call it a predefined macro, it's -a pretty strange macro, since its ``definition'' changes with each -new line of source code. -@end table - -@code{__FILE__} and @code{__LINE__} are useful in generating an error -message to report an inconsistency detected by the program; the message -can state the source line at which the inconsistency was detected. For -example, - -@smallexample -fprintf (stderr, "Internal error: " - "negative string length " - "%d at %s, line %d.", - length, __FILE__, __LINE__); -@end smallexample - -An @samp{#include} directive changes the expansions of @code{__FILE__} -and @code{__LINE__} to correspond to the included file. At the end of -that file, when processing resumes on the input file that contained -the @samp{#include} directive, the expansions of @code{__FILE__} and -@code{__LINE__} revert to the values they had before the -@samp{#include} (but @code{__LINE__} is then incremented by one as -processing moves to the line after the @samp{#include}). - -A @samp{#line} directive changes @code{__LINE__}, and may change -@code{__FILE__} as well. @xref{Line Control}. - -C99 introduces @code{__func__}, and GCC has provided @code{__FUNCTION__} -for a long time. Both of these are strings containing the name of the -current function (there are slight semantic differences; see the GCC -manual). Neither of them is a macro; the preprocessor does not know the -name of the current function. They tend to be useful in conjunction -with @code{__FILE__} and @code{__LINE__}, though. - -@table @code - -@item __DATE__ -This macro expands to a string constant that describes the date on which -the preprocessor is being run. The string constant contains eleven -characters and looks like @code{@w{"Feb 12 1996"}}. If the day of the -month is less than 10, it is padded with a space on the left. - -If GCC cannot determine the current date, it will emit a warning message -(once per compilation) and @code{__DATE__} will expand to -@code{@w{"??? ?? ????"}}. - -@item __TIME__ -This macro expands to a string constant that describes the time at -which the preprocessor is being run. The string constant contains -eight characters and looks like @code{"23:59:01"}. - -If GCC cannot determine the current time, it will emit a warning message -(once per compilation) and @code{__TIME__} will expand to -@code{"??:??:??"}. - -@item __STDC__ -In normal operation, this macro expands to the constant 1, to signify -that this compiler conforms to ISO Standard C@. If GNU CPP is used with -a compiler other than GCC, this is not necessarily true; however, the -preprocessor always conforms to the standard unless the -@option{-traditional-cpp} option is used. - -This macro is not defined if the @option{-traditional-cpp} option is used. - -On some hosts, the system compiler uses a different convention, where -@code{__STDC__} is normally 0, but is 1 if the user specifies strict -conformance to the C Standard. CPP follows the host convention when -processing system header files, but when processing user files -@code{__STDC__} is always 1. This has been reported to cause problems; -for instance, some versions of Solaris provide X Windows headers that -expect @code{__STDC__} to be either undefined or 1. @xref{Invocation}. - -@item __STDC_VERSION__ -This macro expands to the C Standard's version number, a long integer -constant of the form @code{@var{yyyy}@var{mm}L} where @var{yyyy} and -@var{mm} are the year and month of the Standard version. This signifies -which version of the C Standard the compiler conforms to. Like -@code{__STDC__}, this is not necessarily accurate for the entire -implementation, unless GNU CPP is being used with GCC@. - -The value @code{199409L} signifies the 1989 C standard as amended in -1994, which is the current default; the value @code{199901L} signifies -the 1999 revision of the C standard. Support for the 1999 revision is -not yet complete. - -This macro is not defined if the @option{-traditional-cpp} option is -used, nor when compiling C++ or Objective-C@. - -@item __STDC_HOSTED__ -This macro is defined, with value 1, if the compiler's target is a -@dfn{hosted environment}. A hosted environment has the complete -facilities of the standard C library available. - -@item __cplusplus -This macro is defined when the C++ compiler is in use. You can use -@code{__cplusplus} to test whether a header is compiled by a C compiler -or a C++ compiler. This macro is similar to @code{__STDC_VERSION__}, in -that it expands to a version number. Depending on the language standard -selected, the value of the macro is @code{199711L}, as mandated by the -1998 C++ standard; @code{201103L}, per the 2011 C++ standard; an -unspecified value strictly larger than @code{201103L} for the experimental -languages enabled by @option{-std=c++1y} and @option{-std=gnu++1y}. - -@item __OBJC__ -This macro is defined, with value 1, when the Objective-C compiler is in -use. You can use @code{__OBJC__} to test whether a header is compiled -by a C compiler or an Objective-C compiler. - -@item __ASSEMBLER__ -This macro is defined with value 1 when preprocessing assembly -language. - -@end table - -@node Common Predefined Macros -@subsection Common Predefined Macros -@cindex common predefined macros - -The common predefined macros are GNU C extensions. They are available -with the same meanings regardless of the machine or operating system on -which you are using GNU C or GNU Fortran. Their names all start with -double underscores. - -@table @code - -@item __COUNTER__ -This macro expands to sequential integral values starting from 0. In -conjunction with the @code{##} operator, this provides a convenient means to -generate unique identifiers. Care must be taken to ensure that -@code{__COUNTER__} is not expanded prior to inclusion of precompiled headers -which use it. Otherwise, the precompiled headers will not be used. - -@item __GFORTRAN__ -The GNU Fortran compiler defines this. - -@item __GNUC__ -@itemx __GNUC_MINOR__ -@itemx __GNUC_PATCHLEVEL__ -These macros are defined by all GNU compilers that use the C -preprocessor: C, C++, Objective-C and Fortran. Their values are the major -version, minor version, and patch level of the compiler, as integer -constants. For example, GCC 3.2.1 will define @code{__GNUC__} to 3, -@code{__GNUC_MINOR__} to 2, and @code{__GNUC_PATCHLEVEL__} to 1. These -macros are also defined if you invoke the preprocessor directly. - -@code{__GNUC_PATCHLEVEL__} is new to GCC 3.0; it is also present in the -widely-used development snapshots leading up to 3.0 (which identify -themselves as GCC 2.96 or 2.97, depending on which snapshot you have). - -If all you need to know is whether or not your program is being compiled -by GCC, or a non-GCC compiler that claims to accept the GNU C dialects, -you can simply test @code{__GNUC__}. If you need to write code -which depends on a specific version, you must be more careful. Each -time the minor version is increased, the patch level is reset to zero; -each time the major version is increased (which happens rarely), the -minor version and patch level are reset. If you wish to use the -predefined macros directly in the conditional, you will need to write it -like this: - -@smallexample -/* @r{Test for GCC > 3.2.0} */ -#if __GNUC__ > 3 || \ - (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \ - (__GNUC_MINOR__ == 2 && \ - __GNUC_PATCHLEVEL__ > 0)) -@end smallexample - -@noindent -Another approach is to use the predefined macros to -calculate a single number, then compare that against a threshold: - -@smallexample -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -@dots{} -/* @r{Test for GCC > 3.2.0} */ -#if GCC_VERSION > 30200 -@end smallexample - -@noindent -Many people find this form easier to understand. - -@item __GNUG__ -The GNU C++ compiler defines this. Testing it is equivalent to -testing @code{@w{(__GNUC__ && __cplusplus)}}. - -@item __STRICT_ANSI__ -GCC defines this macro if and only if the @option{-ansi} switch, or a -@option{-std} switch specifying strict conformance to some version of ISO C -or ISO C++, was specified when GCC was invoked. It is defined to @samp{1}. -This macro exists primarily to direct GNU libc's header files to -restrict their definitions to the minimal set found in the 1989 C -standard. - -@item __BASE_FILE__ -This macro expands to the name of the main input file, in the form -of a C string constant. This is the source file that was specified -on the command line of the preprocessor or C compiler. - -@item __INCLUDE_LEVEL__ -This macro expands to a decimal integer constant that represents the -depth of nesting in include files. The value of this macro is -incremented on every @samp{#include} directive and decremented at the -end of every included file. It starts out at 0, its value within the -base file specified on the command line. - -@item __ELF__ -This macro is defined if the target uses the ELF object format. - -@item __VERSION__ -This macro expands to a string constant which describes the version of -the compiler in use. You should not rely on its contents having any -particular form, but it can be counted on to contain at least the -release number. - -@item __OPTIMIZE__ -@itemx __OPTIMIZE_SIZE__ -@itemx __NO_INLINE__ -These macros describe the compilation mode. @code{__OPTIMIZE__} is -defined in all optimizing compilations. @code{__OPTIMIZE_SIZE__} is -defined if the compiler is optimizing for size, not speed. -@code{__NO_INLINE__} is defined if no functions will be inlined into -their callers (when not optimizing, or when inlining has been -specifically disabled by @option{-fno-inline}). - -These macros cause certain GNU header files to provide optimized -definitions, using macros or inline functions, of system library -functions. You should not use these macros in any way unless you make -sure that programs will execute with the same effect whether or not they -are defined. If they are defined, their value is 1. - -@item __GNUC_GNU_INLINE__ -GCC defines this macro if functions declared @code{inline} will be -handled in GCC's traditional gnu90 mode. Object files will contain -externally visible definitions of all functions declared @code{inline} -without @code{extern} or @code{static}. They will not contain any -definitions of any functions declared @code{extern inline}. - -@item __GNUC_STDC_INLINE__ -GCC defines this macro if functions declared @code{inline} will be -handled according to the ISO C99 standard. Object files will contain -externally visible definitions of all functions declared @code{extern -inline}. They will not contain definitions of any functions declared -@code{inline} without @code{extern}. - -If this macro is defined, GCC supports the @code{gnu_inline} function -attribute as a way to always get the gnu90 behavior. Support for -this and @code{__GNUC_GNU_INLINE__} was added in GCC 4.1.3. If -neither macro is defined, an older version of GCC is being used: -@code{inline} functions will be compiled in gnu90 mode, and the -@code{gnu_inline} function attribute will not be recognized. - -@item __CHAR_UNSIGNED__ -GCC defines this macro if and only if the data type @code{char} is -unsigned on the target machine. It exists to cause the standard header -file @file{limits.h} to work correctly. You should not use this macro -yourself; instead, refer to the standard macros defined in @file{limits.h}. - -@item __WCHAR_UNSIGNED__ -Like @code{__CHAR_UNSIGNED__}, this macro is defined if and only if the -data type @code{wchar_t} is unsigned and the front-end is in C++ mode. - -@item __REGISTER_PREFIX__ -This macro expands to a single token (not a string constant) which is -the prefix applied to CPU register names in assembly language for this -target. You can use it to write assembly that is usable in multiple -environments. For example, in the @code{m68k-aout} environment it -expands to nothing, but in the @code{m68k-coff} environment it expands -to a single @samp{%}. - -@item __USER_LABEL_PREFIX__ -This macro expands to a single token which is the prefix applied to -user labels (symbols visible to C code) in assembly. For example, in -the @code{m68k-aout} environment it expands to an @samp{_}, but in the -@code{m68k-coff} environment it expands to nothing. - -This macro will have the correct definition even if -@option{-f(no-)underscores} is in use, but it will not be correct if -target-specific options that adjust this prefix are used (e.g.@: the -OSF/rose @option{-mno-underscores} option). - -@item __SIZE_TYPE__ -@itemx __PTRDIFF_TYPE__ -@itemx __WCHAR_TYPE__ -@itemx __WINT_TYPE__ -@itemx __INTMAX_TYPE__ -@itemx __UINTMAX_TYPE__ -@itemx __SIG_ATOMIC_TYPE__ -@itemx __INT8_TYPE__ -@itemx __INT16_TYPE__ -@itemx __INT32_TYPE__ -@itemx __INT64_TYPE__ -@itemx __UINT8_TYPE__ -@itemx __UINT16_TYPE__ -@itemx __UINT32_TYPE__ -@itemx __UINT64_TYPE__ -@itemx __INT_LEAST8_TYPE__ -@itemx __INT_LEAST16_TYPE__ -@itemx __INT_LEAST32_TYPE__ -@itemx __INT_LEAST64_TYPE__ -@itemx __UINT_LEAST8_TYPE__ -@itemx __UINT_LEAST16_TYPE__ -@itemx __UINT_LEAST32_TYPE__ -@itemx __UINT_LEAST64_TYPE__ -@itemx __INT_FAST8_TYPE__ -@itemx __INT_FAST16_TYPE__ -@itemx __INT_FAST32_TYPE__ -@itemx __INT_FAST64_TYPE__ -@itemx __UINT_FAST8_TYPE__ -@itemx __UINT_FAST16_TYPE__ -@itemx __UINT_FAST32_TYPE__ -@itemx __UINT_FAST64_TYPE__ -@itemx __INTPTR_TYPE__ -@itemx __UINTPTR_TYPE__ -These macros are defined to the correct underlying types for the -@code{size_t}, @code{ptrdiff_t}, @code{wchar_t}, @code{wint_t}, -@code{intmax_t}, @code{uintmax_t}, @code{sig_atomic_t}, @code{int8_t}, -@code{int16_t}, @code{int32_t}, @code{int64_t}, @code{uint8_t}, -@code{uint16_t}, @code{uint32_t}, @code{uint64_t}, -@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, -@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, -@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, -@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, -@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, -@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t} typedefs, -respectively. They exist to make the standard header files -@file{stddef.h}, @file{stdint.h}, and @file{wchar.h} work correctly. -You should not use these macros directly; instead, include the -appropriate headers and use the typedefs. Some of these macros may -not be defined on particular systems if GCC does not provide a -@file{stdint.h} header on those systems. - -@item __CHAR_BIT__ -Defined to the number of bits used in the representation of the -@code{char} data type. It exists to make the standard header given -numerical limits work correctly. You should not use -this macro directly; instead, include the appropriate headers. - -@item __SCHAR_MAX__ -@itemx __WCHAR_MAX__ -@itemx __SHRT_MAX__ -@itemx __INT_MAX__ -@itemx __LONG_MAX__ -@itemx __LONG_LONG_MAX__ -@itemx __WINT_MAX__ -@itemx __SIZE_MAX__ -@itemx __PTRDIFF_MAX__ -@itemx __INTMAX_MAX__ -@itemx __UINTMAX_MAX__ -@itemx __SIG_ATOMIC_MAX__ -@itemx __INT8_MAX__ -@itemx __INT16_MAX__ -@itemx __INT32_MAX__ -@itemx __INT64_MAX__ -@itemx __UINT8_MAX__ -@itemx __UINT16_MAX__ -@itemx __UINT32_MAX__ -@itemx __UINT64_MAX__ -@itemx __INT_LEAST8_MAX__ -@itemx __INT_LEAST16_MAX__ -@itemx __INT_LEAST32_MAX__ -@itemx __INT_LEAST64_MAX__ -@itemx __UINT_LEAST8_MAX__ -@itemx __UINT_LEAST16_MAX__ -@itemx __UINT_LEAST32_MAX__ -@itemx __UINT_LEAST64_MAX__ -@itemx __INT_FAST8_MAX__ -@itemx __INT_FAST16_MAX__ -@itemx __INT_FAST32_MAX__ -@itemx __INT_FAST64_MAX__ -@itemx __UINT_FAST8_MAX__ -@itemx __UINT_FAST16_MAX__ -@itemx __UINT_FAST32_MAX__ -@itemx __UINT_FAST64_MAX__ -@itemx __INTPTR_MAX__ -@itemx __UINTPTR_MAX__ -@itemx __WCHAR_MIN__ -@itemx __WINT_MIN__ -@itemx __SIG_ATOMIC_MIN__ -Defined to the maximum value of the @code{signed char}, @code{wchar_t}, -@code{signed short}, -@code{signed int}, @code{signed long}, @code{signed long long}, -@code{wint_t}, @code{size_t}, @code{ptrdiff_t}, -@code{intmax_t}, @code{uintmax_t}, @code{sig_atomic_t}, @code{int8_t}, -@code{int16_t}, @code{int32_t}, @code{int64_t}, @code{uint8_t}, -@code{uint16_t}, @code{uint32_t}, @code{uint64_t}, -@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, -@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, -@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, -@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, -@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, -@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t} types and -to the minimum value of the @code{wchar_t}, @code{wint_t}, and -@code{sig_atomic_t} types respectively. They exist to make the -standard header given numerical limits work correctly. You should not -use these macros directly; instead, include the appropriate headers. -Some of these macros may not be defined on particular systems if GCC -does not provide a @file{stdint.h} header on those systems. - -@item __INT8_C -@itemx __INT16_C -@itemx __INT32_C -@itemx __INT64_C -@itemx __UINT8_C -@itemx __UINT16_C -@itemx __UINT32_C -@itemx __UINT64_C -@itemx __INTMAX_C -@itemx __UINTMAX_C -Defined to implementations of the standard @file{stdint.h} macros with -the same names without the leading @code{__}. They exist the make the -implementation of that header work correctly. You should not use -these macros directly; instead, include the appropriate headers. Some -of these macros may not be defined on particular systems if GCC does -not provide a @file{stdint.h} header on those systems. - -@item __SIZEOF_INT__ -@itemx __SIZEOF_LONG__ -@itemx __SIZEOF_LONG_LONG__ -@itemx __SIZEOF_SHORT__ -@itemx __SIZEOF_POINTER__ -@itemx __SIZEOF_FLOAT__ -@itemx __SIZEOF_DOUBLE__ -@itemx __SIZEOF_LONG_DOUBLE__ -@itemx __SIZEOF_SIZE_T__ -@itemx __SIZEOF_WCHAR_T__ -@itemx __SIZEOF_WINT_T__ -@itemx __SIZEOF_PTRDIFF_T__ -Defined to the number of bytes of the C standard data types: @code{int}, -@code{long}, @code{long long}, @code{short}, @code{void *}, @code{float}, -@code{double}, @code{long double}, @code{size_t}, @code{wchar_t}, @code{wint_t} -and @code{ptrdiff_t}. - -@item __BYTE_ORDER__ -@itemx __ORDER_LITTLE_ENDIAN__ -@itemx __ORDER_BIG_ENDIAN__ -@itemx __ORDER_PDP_ENDIAN__ -@code{__BYTE_ORDER__} is defined to one of the values -@code{__ORDER_LITTLE_ENDIAN__}, @code{__ORDER_BIG_ENDIAN__}, or -@code{__ORDER_PDP_ENDIAN__} to reflect the layout of multi-byte and -multi-word quantities in memory. If @code{__BYTE_ORDER__} is equal to -@code{__ORDER_LITTLE_ENDIAN__} or @code{__ORDER_BIG_ENDIAN__}, then -multi-byte and multi-word quantities are laid out identically: the -byte (word) at the lowest address is the least significant or most -significant byte (word) of the quantity, respectively. If -@code{__BYTE_ORDER__} is equal to @code{__ORDER_PDP_ENDIAN__}, then -bytes in 16-bit words are laid out in a little-endian fashion, whereas -the 16-bit subwords of a 32-bit quantity are laid out in big-endian -fashion. - -You should use these macros for testing like this: - -@smallexample -/* @r{Test for a little-endian machine} */ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -@end smallexample - -@item __FLOAT_WORD_ORDER__ -@code{__FLOAT_WORD_ORDER__} is defined to one of the values -@code{__ORDER_LITTLE_ENDIAN__} or @code{__ORDER_BIG_ENDIAN__} to reflect -the layout of the words of multi-word floating-point quantities. - -@item __DEPRECATED -This macro is defined, with value 1, when compiling a C++ source file -with warnings about deprecated constructs enabled. These warnings are -enabled by default, but can be disabled with @option{-Wno-deprecated}. - -@item __EXCEPTIONS -This macro is defined, with value 1, when compiling a C++ source file -with exceptions enabled. If @option{-fno-exceptions} is used when -compiling the file, then this macro is not defined. - -@item __GXX_RTTI -This macro is defined, with value 1, when compiling a C++ source file -with runtime type identification enabled. If @option{-fno-rtti} is -used when compiling the file, then this macro is not defined. - -@item __USING_SJLJ_EXCEPTIONS__ -This macro is defined, with value 1, if the compiler uses the old -mechanism based on @code{setjmp} and @code{longjmp} for exception -handling. - -@item __GXX_EXPERIMENTAL_CXX0X__ -This macro is defined when compiling a C++ source file with the option -@option{-std=c++0x} or @option{-std=gnu++0x}. It indicates that some -features likely to be included in C++0x are available. Note that these -features are experimental, and may change or be removed in future -versions of GCC. - -@item __GXX_WEAK__ -This macro is defined when compiling a C++ source file. It has the -value 1 if the compiler will use weak symbols, COMDAT sections, or -other similar techniques to collapse symbols with ``vague linkage'' -that are defined in multiple translation units. If the compiler will -not collapse such symbols, this macro is defined with value 0. In -general, user code should not need to make use of this macro; the -purpose of this macro is to ease implementation of the C++ runtime -library provided with G++. - -@item __NEXT_RUNTIME__ -This macro is defined, with value 1, if (and only if) the NeXT runtime -(as in @option{-fnext-runtime}) is in use for Objective-C@. If the GNU -runtime is used, this macro is not defined, so that you can use this -macro to determine which runtime (NeXT or GNU) is being used. - -@item __LP64__ -@itemx _LP64 -These macros are defined, with value 1, if (and only if) the compilation -is for a target where @code{long int} and pointer both use 64-bits and -@code{int} uses 32-bit. - -@item __SSP__ -This macro is defined, with value 1, when @option{-fstack-protector} is in -use. - -@item __SSP_ALL__ -This macro is defined, with value 2, when @option{-fstack-protector-all} is -in use. - -@item __SSP_STRONG__ -This macro is defined, with value 3, when @option{-fstack-protector-strong} is -in use. - -@item __SSP_EXPLICIT__ -This macro is defined, with value 4, when @option{-fstack-protector-explicit} is -in use. - -@item __SANITIZE_ADDRESS__ -This macro is defined, with value 1, when @option{-fsanitize=address} -or @option{-fsanitize=kernel-address} are in use. - -@item __TIMESTAMP__ -This macro expands to a string constant that describes the date and time -of the last modification of the current source file. The string constant -contains abbreviated day of the week, month, day of the month, time in -hh:mm:ss form, year and looks like @code{@w{"Sun Sep 16 01:03:52 1973"}}. -If the day of the month is less than 10, it is padded with a space on the left. - -If GCC cannot determine the current date, it will emit a warning message -(once per compilation) and @code{__TIMESTAMP__} will expand to -@code{@w{"??? ??? ?? ??:??:?? ????"}}. - -@item __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 -@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 -@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 -@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 -@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 -These macros are defined when the target processor supports atomic compare -and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively. - -@item __GCC_HAVE_DWARF2_CFI_ASM -This macro is defined when the compiler is emitting Dwarf2 CFI directives -to the assembler. When this is defined, it is possible to emit those same -directives in inline assembly. - -@item __FP_FAST_FMA -@itemx __FP_FAST_FMAF -@itemx __FP_FAST_FMAL -These macros are defined with value 1 if the backend supports the -@code{fma}, @code{fmaf}, and @code{fmal} builtin functions, so that -the include file @file{math.h} can define the macros -@code{FP_FAST_FMA}, @code{FP_FAST_FMAF}, and @code{FP_FAST_FMAL} -for compatibility with the 1999 C standard. - -@item __GCC_IEC_559 -This macro is defined to indicate the intended level of support for -IEEE 754 (IEC 60559) floating-point arithmetic. It expands to a -nonnegative integer value. If 0, it indicates that the combination of -the compiler configuration and the command-line options is not -intended to support IEEE 754 arithmetic for @code{float} and -@code{double} as defined in C99 and C11 Annex F (for example, that the -standard rounding modes and exceptions are not supported, or that -optimizations are enabled that conflict with IEEE 754 semantics). If -1, it indicates that IEEE 754 arithmetic is intended to be supported; -this does not mean that all relevant language features are supported -by GCC. If 2 or more, it additionally indicates support for IEEE -754-2008 (in particular, that the binary encodings for quiet and -signaling NaNs are as specified in IEEE 754-2008). - -This macro does not indicate the default state of command-line options -that control optimizations that C99 and C11 permit to be controlled by -standard pragmas, where those standards do not require a particular -default state. It does not indicate whether optimizations respect -signaling NaN semantics (the macro for that is -@code{__SUPPORT_SNAN__}). It does not indicate support for decimal -floating point or the IEEE 754 binary16 and binary128 types. - -@item __GCC_IEC_559_COMPLEX -This macro is defined to indicate the intended level of support for -IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers, as -defined in C99 and C11 Annex G. It expands to a nonnegative integer -value. If 0, it indicates that the combination of the compiler -configuration and the command-line options is not intended to support -Annex G requirements (for example, because @option{-fcx-limited-range} -was used). If 1 or more, it indicates that it is intended to support -those requirements; this does not mean that all relevant language -features are supported by GCC. - -@item __NO_MATH_ERRNO__ -This macro is defined if @option{-fno-math-errno} is used, or enabled -by another option such as @option{-ffast-math} or by default. -@end table - -@node System-specific Predefined Macros -@subsection System-specific Predefined Macros - -@cindex system-specific predefined macros -@cindex predefined macros, system-specific -@cindex reserved namespace - -The C preprocessor normally predefines several macros that indicate what -type of system and machine is in use. They are obviously different on -each target supported by GCC@. This manual, being for all systems and -machines, cannot tell you what their names are, but you can use -@command{cpp -dM} to see them all. @xref{Invocation}. All system-specific -predefined macros expand to a constant value, so you can test them with -either @samp{#ifdef} or @samp{#if}. - -The C standard requires that all system-specific macros be part of the -@dfn{reserved namespace}. All names which begin with two underscores, -or an underscore and a capital letter, are reserved for the compiler and -library to use as they wish. However, historically system-specific -macros have had names with no special prefix; for instance, it is common -to find @code{unix} defined on Unix systems. For all such macros, GCC -provides a parallel macro with two underscores added at the beginning -and the end. If @code{unix} is defined, @code{__unix__} will be defined -too. There will never be more than two underscores; the parallel of -@code{_mips} is @code{__mips__}. - -When the @option{-ansi} option, or any @option{-std} option that -requests strict conformance, is given to the compiler, all the -system-specific predefined macros outside the reserved namespace are -suppressed. The parallel macros, inside the reserved namespace, remain -defined. - -We are slowly phasing out all predefined macros which are outside the -reserved namespace. You should never use them in new programs, and we -encourage you to correct older code to use the parallel macros whenever -you find it. We don't recommend you use the system-specific macros that -are in the reserved namespace, either. It is better in the long run to -check specifically for features you need, using a tool such as -@command{autoconf}. - -@node C++ Named Operators -@subsection C++ Named Operators -@cindex named operators -@cindex C++ named operators -@cindex @file{iso646.h} - -In C++, there are eleven keywords which are simply alternate spellings -of operators normally written with punctuation. These keywords are -treated as such even in the preprocessor. They function as operators in -@samp{#if}, and they cannot be defined as macros or poisoned. In C, you -can request that those keywords take their C++ meaning by including -@file{iso646.h}. That header defines each one as a normal object-like -macro expanding to the appropriate punctuator. - -These are the named operators and their corresponding punctuators: - -@multitable {Named Operator} {Punctuator} -@item Named Operator @tab Punctuator -@item @code{and} @tab @code{&&} -@item @code{and_eq} @tab @code{&=} -@item @code{bitand} @tab @code{&} -@item @code{bitor} @tab @code{|} -@item @code{compl} @tab @code{~} -@item @code{not} @tab @code{!} -@item @code{not_eq} @tab @code{!=} -@item @code{or} @tab @code{||} -@item @code{or_eq} @tab @code{|=} -@item @code{xor} @tab @code{^} -@item @code{xor_eq} @tab @code{^=} -@end multitable - -@node Undefining and Redefining Macros -@section Undefining and Redefining Macros -@cindex undefining macros -@cindex redefining macros -@findex #undef - -If a macro ceases to be useful, it may be @dfn{undefined} with the -@samp{#undef} directive. @samp{#undef} takes a single argument, the -name of the macro to undefine. You use the bare macro name, even if the -macro is function-like. It is an error if anything appears on the line -after the macro name. @samp{#undef} has no effect if the name is not a -macro. - -@smallexample -#define FOO 4 -x = FOO; @expansion{} x = 4; -#undef FOO -x = FOO; @expansion{} x = FOO; -@end smallexample - -Once a macro has been undefined, that identifier may be @dfn{redefined} -as a macro by a subsequent @samp{#define} directive. The new definition -need not have any resemblance to the old definition. - -However, if an identifier which is currently a macro is redefined, then -the new definition must be @dfn{effectively the same} as the old one. -Two macro definitions are effectively the same if: -@itemize @bullet -@item Both are the same type of macro (object- or function-like). -@item All the tokens of the replacement list are the same. -@item If there are any parameters, they are the same. -@item Whitespace appears in the same places in both. It need not be -exactly the same amount of whitespace, though. Remember that comments -count as whitespace. -@end itemize - -@noindent -These definitions are effectively the same: -@smallexample -#define FOUR (2 + 2) -#define FOUR (2 + 2) -#define FOUR (2 /* @r{two} */ + 2) -@end smallexample -@noindent -but these are not: -@smallexample -#define FOUR (2 + 2) -#define FOUR ( 2+2 ) -#define FOUR (2 * 2) -#define FOUR(score,and,seven,years,ago) (2 + 2) -@end smallexample - -If a macro is redefined with a definition that is not effectively the -same as the old one, the preprocessor issues a warning and changes the -macro to use the new definition. If the new definition is effectively -the same, the redefinition is silently ignored. This allows, for -instance, two different headers to define a common macro. The -preprocessor will only complain if the definitions do not match. - -@node Directives Within Macro Arguments -@section Directives Within Macro Arguments -@cindex macro arguments and directives - -Occasionally it is convenient to use preprocessor directives within -the arguments of a macro. The C and C++ standards declare that -behavior in these cases is undefined. - -Versions of CPP prior to 3.2 would reject such constructs with an -error message. This was the only syntactic difference between normal -functions and function-like macros, so it seemed attractive to remove -this limitation, and people would often be surprised that they could -not use macros in this way. Moreover, sometimes people would use -conditional compilation in the argument list to a normal library -function like @samp{printf}, only to find that after a library upgrade -@samp{printf} had changed to be a function-like macro, and their code -would no longer compile. So from version 3.2 we changed CPP to -successfully process arbitrary directives within macro arguments in -exactly the same way as it would have processed the directive were the -function-like macro invocation not present. - -If, within a macro invocation, that macro is redefined, then the new -definition takes effect in time for argument pre-expansion, but the -original definition is still used for argument replacement. Here is a -pathological example: - -@smallexample -#define f(x) x x -f (1 -#undef f -#define f 2 -f) -@end smallexample - -@noindent -which expands to - -@smallexample -1 2 1 2 -@end smallexample - -@noindent -with the semantics described above. - -@node Macro Pitfalls -@section Macro Pitfalls -@cindex problems with macros -@cindex pitfalls of macros - -In this section we describe some special rules that apply to macros and -macro expansion, and point out certain cases in which the rules have -counter-intuitive consequences that you must watch out for. - -@menu -* Misnesting:: -* Operator Precedence Problems:: -* Swallowing the Semicolon:: -* Duplication of Side Effects:: -* Self-Referential Macros:: -* Argument Prescan:: -* Newlines in Arguments:: -@end menu - -@node Misnesting -@subsection Misnesting - -When a macro is called with arguments, the arguments are substituted -into the macro body and the result is checked, together with the rest of -the input file, for more macro calls. It is possible to piece together -a macro call coming partially from the macro body and partially from the -arguments. For example, - -@smallexample -#define twice(x) (2*(x)) -#define call_with_1(x) x(1) -call_with_1 (twice) - @expansion{} twice(1) - @expansion{} (2*(1)) -@end smallexample - -Macro definitions do not have to have balanced parentheses. By writing -an unbalanced open parenthesis in a macro body, it is possible to create -a macro call that begins inside the macro body but ends outside of it. -For example, - -@smallexample -#define strange(file) fprintf (file, "%s %d", -@dots{} -strange(stderr) p, 35) - @expansion{} fprintf (stderr, "%s %d", p, 35) -@end smallexample - -The ability to piece together a macro call can be useful, but the use of -unbalanced open parentheses in a macro body is just confusing, and -should be avoided. - -@node Operator Precedence Problems -@subsection Operator Precedence Problems -@cindex parentheses in macro bodies - -You may have noticed that in most of the macro definition examples shown -above, each occurrence of a macro argument name had parentheses around -it. In addition, another pair of parentheses usually surround the -entire macro definition. Here is why it is best to write macros that -way. - -Suppose you define a macro as follows, - -@smallexample -#define ceil_div(x, y) (x + y - 1) / y -@end smallexample - -@noindent -whose purpose is to divide, rounding up. (One use for this operation is -to compute how many @code{int} objects are needed to hold a certain -number of @code{char} objects.) Then suppose it is used as follows: - -@smallexample -a = ceil_div (b & c, sizeof (int)); - @expansion{} a = (b & c + sizeof (int) - 1) / sizeof (int); -@end smallexample - -@noindent -This does not do what is intended. The operator-precedence rules of -C make it equivalent to this: - -@smallexample -a = (b & (c + sizeof (int) - 1)) / sizeof (int); -@end smallexample - -@noindent -What we want is this: - -@smallexample -a = ((b & c) + sizeof (int) - 1)) / sizeof (int); -@end smallexample - -@noindent -Defining the macro as - -@smallexample -#define ceil_div(x, y) ((x) + (y) - 1) / (y) -@end smallexample - -@noindent -provides the desired result. - -Unintended grouping can result in another way. Consider @code{sizeof -ceil_div(1, 2)}. That has the appearance of a C expression that would -compute the size of the type of @code{ceil_div (1, 2)}, but in fact it -means something very different. Here is what it expands to: - -@smallexample -sizeof ((1) + (2) - 1) / (2) -@end smallexample - -@noindent -This would take the size of an integer and divide it by two. The -precedence rules have put the division outside the @code{sizeof} when it -was intended to be inside. - -Parentheses around the entire macro definition prevent such problems. -Here, then, is the recommended way to define @code{ceil_div}: - -@smallexample -#define ceil_div(x, y) (((x) + (y) - 1) / (y)) -@end smallexample - -@node Swallowing the Semicolon -@subsection Swallowing the Semicolon -@cindex semicolons (after macro calls) - -Often it is desirable to define a macro that expands into a compound -statement. Consider, for example, the following macro, that advances a -pointer (the argument @code{p} says where to find it) across whitespace -characters: - -@smallexample -#define SKIP_SPACES(p, limit) \ -@{ char *lim = (limit); \ - while (p < lim) @{ \ - if (*p++ != ' ') @{ \ - p--; break; @}@}@} -@end smallexample - -@noindent -Here backslash-newline is used to split the macro definition, which must -be a single logical line, so that it resembles the way such code would -be laid out if not part of a macro definition. - -A call to this macro might be @code{SKIP_SPACES (p, lim)}. Strictly -speaking, the call expands to a compound statement, which is a complete -statement with no need for a semicolon to end it. However, since it -looks like a function call, it minimizes confusion if you can use it -like a function call, writing a semicolon afterward, as in -@code{SKIP_SPACES (p, lim);} - -This can cause trouble before @code{else} statements, because the -semicolon is actually a null statement. Suppose you write - -@smallexample -if (*p != 0) - SKIP_SPACES (p, lim); -else @dots{} -@end smallexample - -@noindent -The presence of two statements---the compound statement and a null -statement---in between the @code{if} condition and the @code{else} -makes invalid C code. - -The definition of the macro @code{SKIP_SPACES} can be altered to solve -this problem, using a @code{do @dots{} while} statement. Here is how: - -@smallexample -#define SKIP_SPACES(p, limit) \ -do @{ char *lim = (limit); \ - while (p < lim) @{ \ - if (*p++ != ' ') @{ \ - p--; break; @}@}@} \ -while (0) -@end smallexample - -Now @code{SKIP_SPACES (p, lim);} expands into - -@smallexample -do @{@dots{}@} while (0); -@end smallexample - -@noindent -which is one statement. The loop executes exactly once; most compilers -generate no extra code for it. - -@node Duplication of Side Effects -@subsection Duplication of Side Effects - -@cindex side effects (in macro arguments) -@cindex unsafe macros -Many C programs define a macro @code{min}, for ``minimum'', like this: - -@smallexample -#define min(X, Y) ((X) < (Y) ? (X) : (Y)) -@end smallexample - -When you use this macro with an argument containing a side effect, -as shown here, - -@smallexample -next = min (x + y, foo (z)); -@end smallexample - -@noindent -it expands as follows: - -@smallexample -next = ((x + y) < (foo (z)) ? (x + y) : (foo (z))); -@end smallexample - -@noindent -where @code{x + y} has been substituted for @code{X} and @code{foo (z)} -for @code{Y}. - -The function @code{foo} is used only once in the statement as it appears -in the program, but the expression @code{foo (z)} has been substituted -twice into the macro expansion. As a result, @code{foo} might be called -two times when the statement is executed. If it has side effects or if -it takes a long time to compute, the results might not be what you -intended. We say that @code{min} is an @dfn{unsafe} macro. - -The best solution to this problem is to define @code{min} in a way that -computes the value of @code{foo (z)} only once. The C language offers -no standard way to do this, but it can be done with GNU extensions as -follows: - -@smallexample -#define min(X, Y) \ -(@{ typeof (X) x_ = (X); \ - typeof (Y) y_ = (Y); \ - (x_ < y_) ? x_ : y_; @}) -@end smallexample - -The @samp{(@{ @dots{} @})} notation produces a compound statement that -acts as an expression. Its value is the value of its last statement. -This permits us to define local variables and assign each argument to -one. The local variables have underscores after their names to reduce -the risk of conflict with an identifier of wider scope (it is impossible -to avoid this entirely). Now each argument is evaluated exactly once. - -If you do not wish to use GNU C extensions, the only solution is to be -careful when @emph{using} the macro @code{min}. For example, you can -calculate the value of @code{foo (z)}, save it in a variable, and use -that variable in @code{min}: - -@smallexample -@group -#define min(X, Y) ((X) < (Y) ? (X) : (Y)) -@dots{} -@{ - int tem = foo (z); - next = min (x + y, tem); -@} -@end group -@end smallexample - -@noindent -(where we assume that @code{foo} returns type @code{int}). - -@node Self-Referential Macros -@subsection Self-Referential Macros -@cindex self-reference - -A @dfn{self-referential} macro is one whose name appears in its -definition. Recall that all macro definitions are rescanned for more -macros to replace. If the self-reference were considered a use of the -macro, it would produce an infinitely large expansion. To prevent this, -the self-reference is not considered a macro call. It is passed into -the preprocessor output unchanged. Consider an example: - -@smallexample -#define foo (4 + foo) -@end smallexample - -@noindent -where @code{foo} is also a variable in your program. - -Following the ordinary rules, each reference to @code{foo} will expand -into @code{(4 + foo)}; then this will be rescanned and will expand into -@code{(4 + (4 + foo))}; and so on until the computer runs out of memory. - -The self-reference rule cuts this process short after one step, at -@code{(4 + foo)}. Therefore, this macro definition has the possibly -useful effect of causing the program to add 4 to the value of @code{foo} -wherever @code{foo} is referred to. - -In most cases, it is a bad idea to take advantage of this feature. A -person reading the program who sees that @code{foo} is a variable will -not expect that it is a macro as well. The reader will come across the -identifier @code{foo} in the program and think its value should be that -of the variable @code{foo}, whereas in fact the value is four greater. - -One common, useful use of self-reference is to create a macro which -expands to itself. If you write - -@smallexample -#define EPERM EPERM -@end smallexample - -@noindent -then the macro @code{EPERM} expands to @code{EPERM}. Effectively, it is -left alone by the preprocessor whenever it's used in running text. You -can tell that it's a macro with @samp{#ifdef}. You might do this if you -want to define numeric constants with an @code{enum}, but have -@samp{#ifdef} be true for each constant. - -If a macro @code{x} expands to use a macro @code{y}, and the expansion of -@code{y} refers to the macro @code{x}, that is an @dfn{indirect -self-reference} of @code{x}. @code{x} is not expanded in this case -either. Thus, if we have - -@smallexample -#define x (4 + y) -#define y (2 * x) -@end smallexample - -@noindent -then @code{x} and @code{y} expand as follows: - -@smallexample -@group -x @expansion{} (4 + y) - @expansion{} (4 + (2 * x)) - -y @expansion{} (2 * x) - @expansion{} (2 * (4 + y)) -@end group -@end smallexample - -@noindent -Each macro is expanded when it appears in the definition of the other -macro, but not when it indirectly appears in its own definition. - -@node Argument Prescan -@subsection Argument Prescan -@cindex expansion of arguments -@cindex macro argument expansion -@cindex prescan of macro arguments - -Macro arguments are completely macro-expanded before they are -substituted into a macro body, unless they are stringified or pasted -with other tokens. After substitution, the entire macro body, including -the substituted arguments, is scanned again for macros to be expanded. -The result is that the arguments are scanned @emph{twice} to expand -macro calls in them. - -Most of the time, this has no effect. If the argument contained any -macro calls, they are expanded during the first scan. The result -therefore contains no macro calls, so the second scan does not change -it. If the argument were substituted as given, with no prescan, the -single remaining scan would find the same macro calls and produce the -same results. - -You might expect the double scan to change the results when a -self-referential macro is used in an argument of another macro -(@pxref{Self-Referential Macros}): the self-referential macro would be -expanded once in the first scan, and a second time in the second scan. -However, this is not what happens. The self-references that do not -expand in the first scan are marked so that they will not expand in the -second scan either. - -You might wonder, ``Why mention the prescan, if it makes no difference? -And why not skip it and make the preprocessor faster?'' The answer is -that the prescan does make a difference in three special cases: - -@itemize @bullet -@item -Nested calls to a macro. - -We say that @dfn{nested} calls to a macro occur when a macro's argument -contains a call to that very macro. For example, if @code{f} is a macro -that expects one argument, @code{f (f (1))} is a nested pair of calls to -@code{f}. The desired expansion is made by expanding @code{f (1)} and -substituting that into the definition of @code{f}. The prescan causes -the expected result to happen. Without the prescan, @code{f (1)} itself -would be substituted as an argument, and the inner use of @code{f} would -appear during the main scan as an indirect self-reference and would not -be expanded. - -@item -Macros that call other macros that stringify or concatenate. - -If an argument is stringified or concatenated, the prescan does not -occur. If you @emph{want} to expand a macro, then stringify or -concatenate its expansion, you can do that by causing one macro to call -another macro that does the stringification or concatenation. For -instance, if you have - -@smallexample -#define AFTERX(x) X_ ## x -#define XAFTERX(x) AFTERX(x) -#define TABLESIZE 1024 -#define BUFSIZE TABLESIZE -@end smallexample - -then @code{AFTERX(BUFSIZE)} expands to @code{X_BUFSIZE}, and -@code{XAFTERX(BUFSIZE)} expands to @code{X_1024}. (Not to -@code{X_TABLESIZE}. Prescan always does a complete expansion.) - -@item -Macros used in arguments, whose expansions contain unshielded commas. - -This can cause a macro expanded on the second scan to be called with the -wrong number of arguments. Here is an example: - -@smallexample -#define foo a,b -#define bar(x) lose(x) -#define lose(x) (1 + (x)) -@end smallexample - -We would like @code{bar(foo)} to turn into @code{(1 + (foo))}, which -would then turn into @code{(1 + (a,b))}. Instead, @code{bar(foo)} -expands into @code{lose(a,b)}, and you get an error because @code{lose} -requires a single argument. In this case, the problem is easily solved -by the same parentheses that ought to be used to prevent misnesting of -arithmetic operations: - -@smallexample -#define foo (a,b) -@exdent or -#define bar(x) lose((x)) -@end smallexample - -The extra pair of parentheses prevents the comma in @code{foo}'s -definition from being interpreted as an argument separator. - -@end itemize - -@node Newlines in Arguments -@subsection Newlines in Arguments -@cindex newlines in macro arguments - -The invocation of a function-like macro can extend over many logical -lines. However, in the present implementation, the entire expansion -comes out on one line. Thus line numbers emitted by the compiler or -debugger refer to the line the invocation started on, which might be -different to the line containing the argument causing the problem. - -Here is an example illustrating this: - -@smallexample -#define ignore_second_arg(a,b,c) a; c - -ignore_second_arg (foo (), - ignored (), - syntax error); -@end smallexample - -@noindent -The syntax error triggered by the tokens @code{syntax error} results in -an error message citing line three---the line of ignore_second_arg--- -even though the problematic code comes from line five. - -We consider this a bug, and intend to fix it in the near future. - -@node Conditionals -@chapter Conditionals -@cindex conditionals - -A @dfn{conditional} is a directive that instructs the preprocessor to -select whether or not to include a chunk of code in the final token -stream passed to the compiler. Preprocessor conditionals can test -arithmetic expressions, or whether a name is defined as a macro, or both -simultaneously using the special @code{defined} operator. - -A conditional in the C preprocessor resembles in some ways an @code{if} -statement in C, but it is important to understand the difference between -them. The condition in an @code{if} statement is tested during the -execution of your program. Its purpose is to allow your program to -behave differently from run to run, depending on the data it is -operating on. The condition in a preprocessing conditional directive is -tested when your program is compiled. Its purpose is to allow different -code to be included in the program depending on the situation at the -time of compilation. - -However, the distinction is becoming less clear. Modern compilers often -do test @code{if} statements when a program is compiled, if their -conditions are known not to vary at run time, and eliminate code which -can never be executed. If you can count on your compiler to do this, -you may find that your program is more readable if you use @code{if} -statements with constant conditions (perhaps determined by macros). Of -course, you can only use this to exclude code, not type definitions or -other preprocessing directives, and you can only do it if the code -remains syntactically valid when it is not to be used. - -GCC version 3 eliminates this kind of never-executed code even when -not optimizing. Older versions did it only when optimizing. - -@menu -* Conditional Uses:: -* Conditional Syntax:: -* Deleted Code:: -@end menu - -@node Conditional Uses -@section Conditional Uses - -There are three general reasons to use a conditional. - -@itemize @bullet -@item -A program may need to use different code depending on the machine or -operating system it is to run on. In some cases the code for one -operating system may be erroneous on another operating system; for -example, it might refer to data types or constants that do not exist on -the other system. When this happens, it is not enough to avoid -executing the invalid code. Its mere presence will cause the compiler -to reject the program. With a preprocessing conditional, the offending -code can be effectively excised from the program when it is not valid. - -@item -You may want to be able to compile the same source file into two -different programs. One version might make frequent time-consuming -consistency checks on its intermediate data, or print the values of -those data for debugging, and the other not. - -@item -A conditional whose condition is always false is one way to exclude code -from the program but keep it as a sort of comment for future reference. -@end itemize - -Simple programs that do not need system-specific logic or complex -debugging hooks generally will not need to use preprocessing -conditionals. - -@node Conditional Syntax -@section Conditional Syntax - -@findex #if -A conditional in the C preprocessor begins with a @dfn{conditional -directive}: @samp{#if}, @samp{#ifdef} or @samp{#ifndef}. - -@menu -* Ifdef:: -* If:: -* Defined:: -* Else:: -* Elif:: -@end menu - -@node Ifdef -@subsection Ifdef -@findex #ifdef -@findex #endif - -The simplest sort of conditional is - -@smallexample -@group -#ifdef @var{MACRO} - -@var{controlled text} - -#endif /* @var{MACRO} */ -@end group -@end smallexample - -@cindex conditional group -This block is called a @dfn{conditional group}. @var{controlled text} -will be included in the output of the preprocessor if and only if -@var{MACRO} is defined. We say that the conditional @dfn{succeeds} if -@var{MACRO} is defined, @dfn{fails} if it is not. - -The @var{controlled text} inside of a conditional can include -preprocessing directives. They are executed only if the conditional -succeeds. You can nest conditional groups inside other conditional -groups, but they must be completely nested. In other words, -@samp{#endif} always matches the nearest @samp{#ifdef} (or -@samp{#ifndef}, or @samp{#if}). Also, you cannot start a conditional -group in one file and end it in another. - -Even if a conditional fails, the @var{controlled text} inside it is -still run through initial transformations and tokenization. Therefore, -it must all be lexically valid C@. Normally the only way this matters is -that all comments and string literals inside a failing conditional group -must still be properly ended. - -The comment following the @samp{#endif} is not required, but it is a -good practice if there is a lot of @var{controlled text}, because it -helps people match the @samp{#endif} to the corresponding @samp{#ifdef}. -Older programs sometimes put @var{MACRO} directly after the -@samp{#endif} without enclosing it in a comment. This is invalid code -according to the C standard. CPP accepts it with a warning. It -never affects which @samp{#ifndef} the @samp{#endif} matches. - -@findex #ifndef -Sometimes you wish to use some code if a macro is @emph{not} defined. -You can do this by writing @samp{#ifndef} instead of @samp{#ifdef}. -One common use of @samp{#ifndef} is to include code only the first -time a header file is included. @xref{Once-Only Headers}. - -Macro definitions can vary between compilations for several reasons. -Here are some samples. - -@itemize @bullet -@item -Some macros are predefined on each kind of machine -(@pxref{System-specific Predefined Macros}). This allows you to provide -code specially tuned for a particular machine. - -@item -System header files define more macros, associated with the features -they implement. You can test these macros with conditionals to avoid -using a system feature on a machine where it is not implemented. - -@item -Macros can be defined or undefined with the @option{-D} and @option{-U} -command-line options when you compile the program. You can arrange to -compile the same source file into two different programs by choosing a -macro name to specify which program you want, writing conditionals to -test whether or how this macro is defined, and then controlling the -state of the macro with command-line options, perhaps set in the -Makefile. @xref{Invocation}. - -@item -Your program might have a special header file (often called -@file{config.h}) that is adjusted when the program is compiled. It can -define or not define macros depending on the features of the system and -the desired capabilities of the program. The adjustment can be -automated by a tool such as @command{autoconf}, or done by hand. -@end itemize - -@node If -@subsection If - -The @samp{#if} directive allows you to test the value of an arithmetic -expression, rather than the mere existence of one macro. Its syntax is - -@smallexample -@group -#if @var{expression} - -@var{controlled text} - -#endif /* @var{expression} */ -@end group -@end smallexample - -@var{expression} is a C expression of integer type, subject to stringent -restrictions. It may contain - -@itemize @bullet -@item -Integer constants. - -@item -Character constants, which are interpreted as they would be in normal -code. - -@item -Arithmetic operators for addition, subtraction, multiplication, -division, bitwise operations, shifts, comparisons, and logical -operations (@code{&&} and @code{||}). The latter two obey the usual -short-circuiting rules of standard C@. - -@item -Macros. All macros in the expression are expanded before actual -computation of the expression's value begins. - -@item -Uses of the @code{defined} operator, which lets you check whether macros -are defined in the middle of an @samp{#if}. - -@item -Identifiers that are not macros, which are all considered to be the -number zero. This allows you to write @code{@w{#if MACRO}} instead of -@code{@w{#ifdef MACRO}}, if you know that MACRO, when defined, will -always have a nonzero value. Function-like macros used without their -function call parentheses are also treated as zero. - -In some contexts this shortcut is undesirable. The @option{-Wundef} -option causes GCC to warn whenever it encounters an identifier which is -not a macro in an @samp{#if}. -@end itemize - -The preprocessor does not know anything about types in the language. -Therefore, @code{sizeof} operators are not recognized in @samp{#if}, and -neither are @code{enum} constants. They will be taken as identifiers -which are not macros, and replaced by zero. In the case of -@code{sizeof}, this is likely to cause the expression to be invalid. - -The preprocessor calculates the value of @var{expression}. It carries -out all calculations in the widest integer type known to the compiler; -on most machines supported by GCC this is 64 bits. This is not the same -rule as the compiler uses to calculate the value of a constant -expression, and may give different results in some cases. If the value -comes out to be nonzero, the @samp{#if} succeeds and the @var{controlled -text} is included; otherwise it is skipped. - -@node Defined -@subsection Defined - -@cindex @code{defined} -The special operator @code{defined} is used in @samp{#if} and -@samp{#elif} expressions to test whether a certain name is defined as a -macro. @code{defined @var{name}} and @code{defined (@var{name})} are -both expressions whose value is 1 if @var{name} is defined as a macro at -the current point in the program, and 0 otherwise. Thus, @code{@w{#if -defined MACRO}} is precisely equivalent to @code{@w{#ifdef MACRO}}. - -@code{defined} is useful when you wish to test more than one macro for -existence at once. For example, - -@smallexample -#if defined (__vax__) || defined (__ns16000__) -@end smallexample - -@noindent -would succeed if either of the names @code{__vax__} or -@code{__ns16000__} is defined as a macro. - -Conditionals written like this: - -@smallexample -#if defined BUFSIZE && BUFSIZE >= 1024 -@end smallexample - -@noindent -can generally be simplified to just @code{@w{#if BUFSIZE >= 1024}}, -since if @code{BUFSIZE} is not defined, it will be interpreted as having -the value zero. - -If the @code{defined} operator appears as a result of a macro expansion, -the C standard says the behavior is undefined. GNU cpp treats it as a -genuine @code{defined} operator and evaluates it normally. It will warn -wherever your code uses this feature if you use the command-line option -@option{-pedantic}, since other compilers may handle it differently. - -@node Else -@subsection Else - -@findex #else -The @samp{#else} directive can be added to a conditional to provide -alternative text to be used if the condition fails. This is what it -looks like: - -@smallexample -@group -#if @var{expression} -@var{text-if-true} -#else /* Not @var{expression} */ -@var{text-if-false} -#endif /* Not @var{expression} */ -@end group -@end smallexample - -@noindent -If @var{expression} is nonzero, the @var{text-if-true} is included and -the @var{text-if-false} is skipped. If @var{expression} is zero, the -opposite happens. - -You can use @samp{#else} with @samp{#ifdef} and @samp{#ifndef}, too. - -@node Elif -@subsection Elif - -@findex #elif -One common case of nested conditionals is used to check for more than two -possible alternatives. For example, you might have - -@smallexample -#if X == 1 -@dots{} -#else /* X != 1 */ -#if X == 2 -@dots{} -#else /* X != 2 */ -@dots{} -#endif /* X != 2 */ -#endif /* X != 1 */ -@end smallexample - -Another conditional directive, @samp{#elif}, allows this to be -abbreviated as follows: - -@smallexample -#if X == 1 -@dots{} -#elif X == 2 -@dots{} -#else /* X != 2 and X != 1*/ -@dots{} -#endif /* X != 2 and X != 1*/ -@end smallexample - -@samp{#elif} stands for ``else if''. Like @samp{#else}, it goes in the -middle of a conditional group and subdivides it; it does not require a -matching @samp{#endif} of its own. Like @samp{#if}, the @samp{#elif} -directive includes an expression to be tested. The text following the -@samp{#elif} is processed only if the original @samp{#if}-condition -failed and the @samp{#elif} condition succeeds. - -More than one @samp{#elif} can go in the same conditional group. Then -the text after each @samp{#elif} is processed only if the @samp{#elif} -condition succeeds after the original @samp{#if} and all previous -@samp{#elif} directives within it have failed. - -@samp{#else} is allowed after any number of @samp{#elif} directives, but -@samp{#elif} may not follow @samp{#else}. - -@node Deleted Code -@section Deleted Code -@cindex commenting out code - -If you replace or delete a part of the program but want to keep the old -code around for future reference, you often cannot simply comment it -out. Block comments do not nest, so the first comment inside the old -code will end the commenting-out. The probable result is a flood of -syntax errors. - -One way to avoid this problem is to use an always-false conditional -instead. For instance, put @code{#if 0} before the deleted code and -@code{#endif} after it. This works even if the code being turned -off contains conditionals, but they must be entire conditionals -(balanced @samp{#if} and @samp{#endif}). - -Some people use @code{#ifdef notdef} instead. This is risky, because -@code{notdef} might be accidentally defined as a macro, and then the -conditional would succeed. @code{#if 0} can be counted on to fail. - -Do not use @code{#if 0} for comments which are not C code. Use a real -comment, instead. The interior of @code{#if 0} must consist of complete -tokens; in particular, single-quote characters must balance. Comments -often contain unbalanced single-quote characters (known in English as -apostrophes). These confuse @code{#if 0}. They don't confuse -@samp{/*}. - -@node Diagnostics -@chapter Diagnostics -@cindex diagnostic -@cindex reporting errors -@cindex reporting warnings - -@findex #error -The directive @samp{#error} causes the preprocessor to report a fatal -error. The tokens forming the rest of the line following @samp{#error} -are used as the error message. - -You would use @samp{#error} inside of a conditional that detects a -combination of parameters which you know the program does not properly -support. For example, if you know that the program will not run -properly on a VAX, you might write - -@smallexample -@group -#ifdef __vax__ -#error "Won't work on VAXen. See comments at get_last_object." -#endif -@end group -@end smallexample - -If you have several configuration parameters that must be set up by -the installation in a consistent way, you can use conditionals to detect -an inconsistency and report it with @samp{#error}. For example, - -@smallexample -#if !defined(FOO) && defined(BAR) -#error "BAR requires FOO." -#endif -@end smallexample - -@findex #warning -The directive @samp{#warning} is like @samp{#error}, but causes the -preprocessor to issue a warning and continue preprocessing. The tokens -following @samp{#warning} are used as the warning message. - -You might use @samp{#warning} in obsolete header files, with a message -directing the user to the header file which should be used instead. - -Neither @samp{#error} nor @samp{#warning} macro-expands its argument. -Internal whitespace sequences are each replaced with a single space. -The line must consist of complete tokens. It is wisest to make the -argument of these directives be a single string constant; this avoids -problems with apostrophes and the like. - -@node Line Control -@chapter Line Control -@cindex line control - -The C preprocessor informs the C compiler of the location in your source -code where each token came from. Presently, this is just the file name -and line number. All the tokens resulting from macro expansion are -reported as having appeared on the line of the source file where the -outermost macro was used. We intend to be more accurate in the future. - -If you write a program which generates source code, such as the -@command{bison} parser generator, you may want to adjust the preprocessor's -notion of the current file name and line number by hand. Parts of the -output from @command{bison} are generated from scratch, other parts come -from a standard parser file. The rest are copied verbatim from -@command{bison}'s input. You would like compiler error messages and -symbolic debuggers to be able to refer to @code{bison}'s input file. - -@findex #line -@command{bison} or any such program can arrange this by writing -@samp{#line} directives into the output file. @samp{#line} is a -directive that specifies the original line number and source file name -for subsequent input in the current preprocessor input file. -@samp{#line} has three variants: - -@table @code -@item #line @var{linenum} -@var{linenum} is a non-negative decimal integer constant. It specifies -the line number which should be reported for the following line of -input. Subsequent lines are counted from @var{linenum}. - -@item #line @var{linenum} @var{filename} -@var{linenum} is the same as for the first form, and has the same -effect. In addition, @var{filename} is a string constant. The -following line and all subsequent lines are reported to come from the -file it specifies, until something else happens to change that. -@var{filename} is interpreted according to the normal rules for a string -constant: backslash escapes are interpreted. This is different from -@samp{#include}. - -Previous versions of CPP did not interpret escapes in @samp{#line}; -we have changed it because the standard requires they be interpreted, -and most other compilers do. - -@item #line @var{anything else} -@var{anything else} is checked for macro calls, which are expanded. -The result should match one of the above two forms. -@end table - -@samp{#line} directives alter the results of the @code{__FILE__} and -@code{__LINE__} predefined macros from that point on. @xref{Standard -Predefined Macros}. They do not have any effect on @samp{#include}'s -idea of the directory containing the current file. This is a change -from GCC 2.95. Previously, a file reading - -@smallexample -#line 1 "../src/gram.y" -#include "gram.h" -@end smallexample - -would search for @file{gram.h} in @file{../src}, then the @option{-I} -chain; the directory containing the physical source file would not be -searched. In GCC 3.0 and later, the @samp{#include} is not affected by -the presence of a @samp{#line} referring to a different directory. - -We made this change because the old behavior caused problems when -generated source files were transported between machines. For instance, -it is common practice to ship generated parsers with a source release, -so that people building the distribution do not need to have yacc or -Bison installed. These files frequently have @samp{#line} directives -referring to the directory tree of the system where the distribution was -created. If GCC tries to search for headers in those directories, the -build is likely to fail. - -The new behavior can cause failures too, if the generated file is not -in the same directory as its source and it attempts to include a header -which would be visible searching from the directory containing the -source file. However, this problem is easily solved with an additional -@option{-I} switch on the command line. The failures caused by the old -semantics could sometimes be corrected only by editing the generated -files, which is difficult and error-prone. - -@node Pragmas -@chapter Pragmas - -The @samp{#pragma} directive is the method specified by the C standard -for providing additional information to the compiler, beyond what is -conveyed in the language itself. Three forms of this directive -(commonly known as @dfn{pragmas}) are specified by the 1999 C standard. -A C compiler is free to attach any meaning it likes to other pragmas. - -GCC has historically preferred to use extensions to the syntax of the -language, such as @code{__attribute__}, for this purpose. However, GCC -does define a few pragmas of its own. These mostly have effects on the -entire translation unit or source file. - -In GCC version 3, all GNU-defined, supported pragmas have been given a -@code{GCC} prefix. This is in line with the @code{STDC} prefix on all -pragmas defined by C99. For backward compatibility, pragmas which were -recognized by previous versions are still recognized without the -@code{GCC} prefix, but that usage is deprecated. Some older pragmas are -deprecated in their entirety. They are not recognized with the -@code{GCC} prefix. @xref{Obsolete Features}. - -@cindex @code{_Pragma} -C99 introduces the @code{@w{_Pragma}} operator. This feature addresses a -major problem with @samp{#pragma}: being a directive, it cannot be -produced as the result of macro expansion. @code{@w{_Pragma}} is an -operator, much like @code{sizeof} or @code{defined}, and can be embedded -in a macro. - -Its syntax is @code{@w{_Pragma (@var{string-literal})}}, where -@var{string-literal} can be either a normal or wide-character string -literal. It is destringized, by replacing all @samp{\\} with a single -@samp{\} and all @samp{\"} with a @samp{"}. The result is then -processed as if it had appeared as the right hand side of a -@samp{#pragma} directive. For example, - -@smallexample -_Pragma ("GCC dependency \"parse.y\"") -@end smallexample - -@noindent -has the same effect as @code{#pragma GCC dependency "parse.y"}. The -same effect could be achieved using macros, for example - -@smallexample -#define DO_PRAGMA(x) _Pragma (#x) -DO_PRAGMA (GCC dependency "parse.y") -@end smallexample - -The standard is unclear on where a @code{_Pragma} operator can appear. -The preprocessor does not accept it within a preprocessing conditional -directive like @samp{#if}. To be safe, you are probably best keeping it -out of directives other than @samp{#define}, and putting it on a line of -its own. - -This manual documents the pragmas which are meaningful to the -preprocessor itself. Other pragmas are meaningful to the C or C++ -compilers. They are documented in the GCC manual. - -GCC plugins may provide their own pragmas. - -@ftable @code -@item #pragma GCC dependency -@code{#pragma GCC dependency} allows you to check the relative dates of -the current file and another file. If the other file is more recent than -the current file, a warning is issued. This is useful if the current -file is derived from the other file, and should be regenerated. The -other file is searched for using the normal include search path. -Optional trailing text can be used to give more information in the -warning message. - -@smallexample -#pragma GCC dependency "parse.y" -#pragma GCC dependency "/usr/include/time.h" rerun fixincludes -@end smallexample - -@item #pragma GCC poison -Sometimes, there is an identifier that you want to remove completely -from your program, and make sure that it never creeps back in. To -enforce this, you can @dfn{poison} the identifier with this pragma. -@code{#pragma GCC poison} is followed by a list of identifiers to -poison. If any of those identifiers appears anywhere in the source -after the directive, it is a hard error. For example, - -@smallexample -#pragma GCC poison printf sprintf fprintf -sprintf(some_string, "hello"); -@end smallexample - -@noindent -will produce an error. - -If a poisoned identifier appears as part of the expansion of a macro -which was defined before the identifier was poisoned, it will @emph{not} -cause an error. This lets you poison an identifier without worrying -about system headers defining macros that use it. - -For example, - -@smallexample -#define strrchr rindex -#pragma GCC poison rindex -strrchr(some_string, 'h'); -@end smallexample - -@noindent -will not produce an error. - -@item #pragma GCC system_header -This pragma takes no arguments. It causes the rest of the code in the -current file to be treated as if it came from a system header. -@xref{System Headers}. - -@item #pragma GCC warning -@itemx #pragma GCC error -@code{#pragma GCC warning "message"} causes the preprocessor to issue -a warning diagnostic with the text @samp{message}. The message -contained in the pragma must be a single string literal. Similarly, -@code{#pragma GCC error "message"} issues an error message. Unlike -the @samp{#warning} and @samp{#error} directives, these pragmas can be -embedded in preprocessor macros using @samp{_Pragma}. - -@end ftable - -@node Other Directives -@chapter Other Directives - -@findex #ident -@findex #sccs -The @samp{#ident} directive takes one argument, a string constant. On -some systems, that string constant is copied into a special segment of -the object file. On other systems, the directive is ignored. The -@samp{#sccs} directive is a synonym for @samp{#ident}. - -These directives are not part of the C standard, but they are not -official GNU extensions either. What historical information we have -been able to find, suggests they originated with System V@. - -@cindex null directive -The @dfn{null directive} consists of a @samp{#} followed by a newline, -with only whitespace (including comments) in between. A null directive -is understood as a preprocessing directive but has no effect on the -preprocessor output. The primary significance of the existence of the -null directive is that an input line consisting of just a @samp{#} will -produce no output, rather than a line of output containing just a -@samp{#}. Supposedly some old C programs contain such lines. - -@node Preprocessor Output -@chapter Preprocessor Output - -When the C preprocessor is used with the C, C++, or Objective-C -compilers, it is integrated into the compiler and communicates a stream -of binary tokens directly to the compiler's parser. However, it can -also be used in the more conventional standalone mode, where it produces -textual output. -@c FIXME: Document the library interface. - -@cindex output format -The output from the C preprocessor looks much like the input, except -that all preprocessing directive lines have been replaced with blank -lines and all comments with spaces. Long runs of blank lines are -discarded. - -The ISO standard specifies that it is implementation defined whether a -preprocessor preserves whitespace between tokens, or replaces it with -e.g.@: a single space. In GNU CPP, whitespace between tokens is collapsed -to become a single space, with the exception that the first token on a -non-directive line is preceded with sufficient spaces that it appears in -the same column in the preprocessed output that it appeared in the -original source file. This is so the output is easy to read. -@xref{Differences from previous versions}. CPP does not insert any -whitespace where there was none in the original source, except where -necessary to prevent an accidental token paste. - -@cindex linemarkers -Source file name and line number information is conveyed by lines -of the form - -@smallexample -# @var{linenum} @var{filename} @var{flags} -@end smallexample - -@noindent -These are called @dfn{linemarkers}. They are inserted as needed into -the output (but never within a string or character constant). They mean -that the following line originated in file @var{filename} at line -@var{linenum}. @var{filename} will never contain any non-printing -characters; they are replaced with octal escape sequences. - -After the file name comes zero or more flags, which are @samp{1}, -@samp{2}, @samp{3}, or @samp{4}. If there are multiple flags, spaces -separate them. Here is what the flags mean: - -@table @samp -@item 1 -This indicates the start of a new file. -@item 2 -This indicates returning to a file (after having included another file). -@item 3 -This indicates that the following text comes from a system header file, -so certain warnings should be suppressed. -@item 4 -This indicates that the following text should be treated as being -wrapped in an implicit @code{extern "C"} block. -@c maybe cross reference NO_IMPLICIT_EXTERN_C -@end table - -As an extension, the preprocessor accepts linemarkers in non-assembler -input files. They are treated like the corresponding @samp{#line} -directive, (@pxref{Line Control}), except that trailing flags are -permitted, and are interpreted with the meanings described above. If -multiple flags are given, they must be in ascending order. - -Some directives may be duplicated in the output of the preprocessor. -These are @samp{#ident} (always), @samp{#pragma} (only if the -preprocessor does not handle the pragma itself), and @samp{#define} and -@samp{#undef} (with certain debugging options). If this happens, the -@samp{#} of the directive will always be in the first column, and there -will be no space between the @samp{#} and the directive name. If macro -expansion happens to generate tokens which might be mistaken for a -duplicated directive, a space will be inserted between the @samp{#} and -the directive name. - -@node Traditional Mode -@chapter Traditional Mode - -Traditional (pre-standard) C preprocessing is rather different from -the preprocessing specified by the standard. When GCC is given the -@option{-traditional-cpp} option, it attempts to emulate a traditional -preprocessor. - -GCC versions 3.2 and later only support traditional mode semantics in -the preprocessor, and not in the compiler front ends. This chapter -outlines the traditional preprocessor semantics we implemented. - -The implementation does not correspond precisely to the behavior of -earlier versions of GCC, nor to any true traditional preprocessor. -After all, inconsistencies among traditional implementations were a -major motivation for C standardization. However, we intend that it -should be compatible with true traditional preprocessors in all ways -that actually matter. - -@menu -* Traditional lexical analysis:: -* Traditional macros:: -* Traditional miscellany:: -* Traditional warnings:: -@end menu - -@node Traditional lexical analysis -@section Traditional lexical analysis - -The traditional preprocessor does not decompose its input into tokens -the same way a standards-conforming preprocessor does. The input is -simply treated as a stream of text with minimal internal form. - -This implementation does not treat trigraphs (@pxref{trigraphs}) -specially since they were an invention of the standards committee. It -handles arbitrarily-positioned escaped newlines properly and splices -the lines as you would expect; many traditional preprocessors did not -do this. - -The form of horizontal whitespace in the input file is preserved in -the output. In particular, hard tabs remain hard tabs. This can be -useful if, for example, you are preprocessing a Makefile. - -Traditional CPP only recognizes C-style block comments, and treats the -@samp{/*} sequence as introducing a comment only if it lies outside -quoted text. Quoted text is introduced by the usual single and double -quotes, and also by an initial @samp{<} in a @code{#include} -directive. - -Traditionally, comments are completely removed and are not replaced -with a space. Since a traditional compiler does its own tokenization -of the output of the preprocessor, this means that comments can -effectively be used as token paste operators. However, comments -behave like separators for text handled by the preprocessor itself, -since it doesn't re-lex its input. For example, in - -@smallexample -#if foo/**/bar -@end smallexample - -@noindent -@samp{foo} and @samp{bar} are distinct identifiers and expanded -separately if they happen to be macros. In other words, this -directive is equivalent to - -@smallexample -#if foo bar -@end smallexample - -@noindent -rather than - -@smallexample -#if foobar -@end smallexample - -Generally speaking, in traditional mode an opening quote need not have -a matching closing quote. In particular, a macro may be defined with -replacement text that contains an unmatched quote. Of course, if you -attempt to compile preprocessed output containing an unmatched quote -you will get a syntax error. - -However, all preprocessing directives other than @code{#define} -require matching quotes. For example: - -@smallexample -#define m This macro's fine and has an unmatched quote -"/* This is not a comment. */ -/* @r{This is a comment. The following #include directive - is ill-formed.} */ -#include } character. Note that we -don't allow the terminators of header names to be escaped; the first -@samp{"} or @samp{>} terminates the header name. - -Interpretation of some character sequences depends upon whether we are -lexing C, C++ or Objective-C, and on the revision of the standard in -force. For example, @samp{::} is a single token in C++, but in C it is -two separate @samp{:} tokens and almost certainly a syntax error. Such -cases are handled by @code{_cpp_lex_direct} based upon command-line -flags stored in the @code{cpp_options} structure. - -Once a token has been lexed, it leads an independent existence. The -spelling of numbers, identifiers and strings is copied to permanent -storage from the original input buffer, so a token remains valid and -correct even if its source buffer is freed with @code{_cpp_pop_buffer}. -The storage holding the spellings of such tokens remains until the -client program calls cpp_destroy, probably at the end of the translation -unit. - -@anchor{Lexing a line} -@section Lexing a line -@cindex token run - -When the preprocessor was changed to return pointers to tokens, one -feature I wanted was some sort of guarantee regarding how long a -returned pointer remains valid. This is important to the stand-alone -preprocessor, the future direction of the C family front ends, and even -to cpplib itself internally. - -Occasionally the preprocessor wants to be able to peek ahead in the -token stream. For example, after the name of a function-like macro, it -wants to check the next token to see if it is an opening parenthesis. -Another example is that, after reading the first few tokens of a -@code{#pragma} directive and not recognizing it as a registered pragma, -it wants to backtrack and allow the user-defined handler for unknown -pragmas to access the full @code{#pragma} token stream. The stand-alone -preprocessor wants to be able to test the current token with the -previous one to see if a space needs to be inserted to preserve their -separate tokenization upon re-lexing (paste avoidance), so it needs to -be sure the pointer to the previous token is still valid. The -recursive-descent C++ parser wants to be able to perform tentative -parsing arbitrarily far ahead in the token stream, and then to be able -to jump back to a prior position in that stream if necessary. - -The rule I chose, which is fairly natural, is to arrange that the -preprocessor lex all tokens on a line consecutively into a token buffer, -which I call a @dfn{token run}, and when meeting an unescaped new line -(newlines within comments do not count either), to start lexing back at -the beginning of the run. Note that we do @emph{not} lex a line of -tokens at once; if we did that @code{parse_identifier} would not have -state flags available to warn about invalid identifiers (@pxref{Invalid -identifiers}). - -In other words, accessing tokens that appeared earlier in the current -line is valid, but since each logical line overwrites the tokens of the -previous line, tokens from prior lines are unavailable. In particular, -since a directive only occupies a single logical line, this means that -the directive handlers like the @code{#pragma} handler can jump around -in the directive's tokens if necessary. - -Two issues remain: what about tokens that arise from macro expansions, -and what happens when we have a long line that overflows the token run? - -Since we promise clients that we preserve the validity of pointers that -we have already returned for tokens that appeared earlier in the line, -we cannot reallocate the run. Instead, on overflow it is expanded by -chaining a new token run on to the end of the existing one. - -The tokens forming a macro's replacement list are collected by the -@code{#define} handler, and placed in storage that is only freed by -@code{cpp_destroy}. So if a macro is expanded in the line of tokens, -the pointers to the tokens of its expansion that are returned will always -remain valid. However, macros are a little trickier than that, since -they give rise to three sources of fresh tokens. They are the built-in -macros like @code{__LINE__}, and the @samp{#} and @samp{##} operators -for stringification and token pasting. I handled this by allocating -space for these tokens from the lexer's token run chain. This means -they automatically receive the same lifetime guarantees as lexed tokens, -and we don't need to concern ourselves with freeing them. - -Lexing into a line of tokens solves some of the token memory management -issues, but not all. The opening parenthesis after a function-like -macro name might lie on a different line, and the front ends definitely -want the ability to look ahead past the end of the current line. So -cpplib only moves back to the start of the token run at the end of a -line if the variable @code{keep_tokens} is zero. Line-buffering is -quite natural for the preprocessor, and as a result the only time cpplib -needs to increment this variable is whilst looking for the opening -parenthesis to, and reading the arguments of, a function-like macro. In -the near future cpplib will export an interface to increment and -decrement this variable, so that clients can share full control over the -lifetime of token pointers too. - -The routine @code{_cpp_lex_token} handles moving to new token runs, -calling @code{_cpp_lex_direct} to lex new tokens, or returning -previously-lexed tokens if we stepped back in the token stream. It also -checks each token for the @code{BOL} flag, which might indicate a -directive that needs to be handled, or require a start-of-line call-back -to be made. @code{_cpp_lex_token} also handles skipping over tokens in -failed conditional blocks, and invalidates the control macro of the -multiple-include optimization if a token was successfully lexed outside -a directive. In other words, its callers do not need to concern -themselves with such issues. - -@node Hash Nodes -@unnumbered Hash Nodes -@cindex hash table -@cindex identifiers -@cindex macros -@cindex assertions -@cindex named operators - -When cpplib encounters an ``identifier'', it generates a hash code for -it and stores it in the hash table. By ``identifier'' we mean tokens -with type @code{CPP_NAME}; this includes identifiers in the usual C -sense, as well as keywords, directive names, macro names and so on. For -example, all of @code{pragma}, @code{int}, @code{foo} and -@code{__GNUC__} are identifiers and hashed when lexed. - -Each node in the hash table contain various information about the -identifier it represents. For example, its length and type. At any one -time, each identifier falls into exactly one of three categories: - -@itemize @bullet -@item Macros - -These have been declared to be macros, either on the command line or -with @code{#define}. A few, such as @code{__TIME__} are built-ins -entered in the hash table during initialization. The hash node for a -normal macro points to a structure with more information about the -macro, such as whether it is function-like, how many arguments it takes, -and its expansion. Built-in macros are flagged as special, and instead -contain an enum indicating which of the various built-in macros it is. - -@item Assertions - -Assertions are in a separate namespace to macros. To enforce this, cpp -actually prepends a @code{#} character before hashing and entering it in -the hash table. An assertion's node points to a chain of answers to -that assertion. - -@item Void - -Everything else falls into this category---an identifier that is not -currently a macro, or a macro that has since been undefined with -@code{#undef}. - -When preprocessing C++, this category also includes the named operators, -such as @code{xor}. In expressions these behave like the operators they -represent, but in contexts where the spelling of a token matters they -are spelt differently. This spelling distinction is relevant when they -are operands of the stringizing and pasting macro operators @code{#} and -@code{##}. Named operator hash nodes are flagged, both to catch the -spelling distinction and to prevent them from being defined as macros. -@end itemize - -The same identifiers share the same hash node. Since each identifier -token, after lexing, contains a pointer to its hash node, this is used -to provide rapid lookup of various information. For example, when -parsing a @code{#define} statement, CPP flags each argument's identifier -hash node with the index of that argument. This makes duplicated -argument checking an O(1) operation for each argument. Similarly, for -each identifier in the macro's expansion, lookup to see if it is an -argument, and which argument it is, is also an O(1) operation. Further, -each directive name, such as @code{endif}, has an associated directive -enum stored in its hash node, so that directive lookup is also O(1). - -@node Macro Expansion -@unnumbered Macro Expansion Algorithm -@cindex macro expansion - -Macro expansion is a tricky operation, fraught with nasty corner cases -and situations that render what you thought was a nifty way to -optimize the preprocessor's expansion algorithm wrong in quite subtle -ways. - -I strongly recommend you have a good grasp of how the C and C++ -standards require macros to be expanded before diving into this -section, let alone the code!. If you don't have a clear mental -picture of how things like nested macro expansion, stringification and -token pasting are supposed to work, damage to your sanity can quickly -result. - -@section Internal representation of macros -@cindex macro representation (internal) - -The preprocessor stores macro expansions in tokenized form. This -saves repeated lexing passes during expansion, at the cost of a small -increase in memory consumption on average. The tokens are stored -contiguously in memory, so a pointer to the first one and a token -count is all you need to get the replacement list of a macro. - -If the macro is a function-like macro the preprocessor also stores its -parameters, in the form of an ordered list of pointers to the hash -table entry of each parameter's identifier. Further, in the macro's -stored expansion each occurrence of a parameter is replaced with a -special token of type @code{CPP_MACRO_ARG}. Each such token holds the -index of the parameter it represents in the parameter list, which -allows rapid replacement of parameters with their arguments during -expansion. Despite this optimization it is still necessary to store -the original parameters to the macro, both for dumping with e.g., -@option{-dD}, and to warn about non-trivial macro redefinitions when -the parameter names have changed. - -@section Macro expansion overview -The preprocessor maintains a @dfn{context stack}, implemented as a -linked list of @code{cpp_context} structures, which together represent -the macro expansion state at any one time. The @code{struct -cpp_reader} member variable @code{context} points to the current top -of this stack. The top normally holds the unexpanded replacement list -of the innermost macro under expansion, except when cpplib is about to -pre-expand an argument, in which case it holds that argument's -unexpanded tokens. - -When there are no macros under expansion, cpplib is in @dfn{base -context}. All contexts other than the base context contain a -contiguous list of tokens delimited by a starting and ending token. -When not in base context, cpplib obtains the next token from the list -of the top context. If there are no tokens left in the list, it pops -that context off the stack, and subsequent ones if necessary, until an -unexhausted context is found or it returns to base context. In base -context, cpplib reads tokens directly from the lexer. - -If it encounters an identifier that is both a macro and enabled for -expansion, cpplib prepares to push a new context for that macro on the -stack by calling the routine @code{enter_macro_context}. When this -routine returns, the new context will contain the unexpanded tokens of -the replacement list of that macro. In the case of function-like -macros, @code{enter_macro_context} also replaces any parameters in the -replacement list, stored as @code{CPP_MACRO_ARG} tokens, with the -appropriate macro argument. If the standard requires that the -parameter be replaced with its expanded argument, the argument will -have been fully macro expanded first. - -@code{enter_macro_context} also handles special macros like -@code{__LINE__}. Although these macros expand to a single token which -cannot contain any further macros, for reasons of token spacing -(@pxref{Token Spacing}) and simplicity of implementation, cpplib -handles these special macros by pushing a context containing just that -one token. - -The final thing that @code{enter_macro_context} does before returning -is to mark the macro disabled for expansion (except for special macros -like @code{__TIME__}). The macro is re-enabled when its context is -later popped from the context stack, as described above. This strict -ordering ensures that a macro is disabled whilst its expansion is -being scanned, but that it is @emph{not} disabled whilst any arguments -to it are being expanded. - -@section Scanning the replacement list for macros to expand -The C standard states that, after any parameters have been replaced -with their possibly-expanded arguments, the replacement list is -scanned for nested macros. Further, any identifiers in the -replacement list that are not expanded during this scan are never -again eligible for expansion in the future, if the reason they were -not expanded is that the macro in question was disabled. - -Clearly this latter condition can only apply to tokens resulting from -argument pre-expansion. Other tokens never have an opportunity to be -re-tested for expansion. It is possible for identifiers that are -function-like macros to not expand initially but to expand during a -later scan. This occurs when the identifier is the last token of an -argument (and therefore originally followed by a comma or a closing -parenthesis in its macro's argument list), and when it replaces its -parameter in the macro's replacement list, the subsequent token -happens to be an opening parenthesis (itself possibly the first token -of an argument). - -It is important to note that when cpplib reads the last token of a -given context, that context still remains on the stack. Only when -looking for the @emph{next} token do we pop it off the stack and drop -to a lower context. This makes backing up by one token easy, but more -importantly ensures that the macro corresponding to the current -context is still disabled when we are considering the last token of -its replacement list for expansion (or indeed expanding it). As an -example, which illustrates many of the points above, consider - -@smallexample -#define foo(x) bar x -foo(foo) (2) -@end smallexample - -@noindent which fully expands to @samp{bar foo (2)}. During pre-expansion -of the argument, @samp{foo} does not expand even though the macro is -enabled, since it has no following parenthesis [pre-expansion of an -argument only uses tokens from that argument; it cannot take tokens -from whatever follows the macro invocation]. This still leaves the -argument token @samp{foo} eligible for future expansion. Then, when -re-scanning after argument replacement, the token @samp{foo} is -rejected for expansion, and marked ineligible for future expansion, -since the macro is now disabled. It is disabled because the -replacement list @samp{bar foo} of the macro is still on the context -stack. - -If instead the algorithm looked for an opening parenthesis first and -then tested whether the macro were disabled it would be subtly wrong. -In the example above, the replacement list of @samp{foo} would be -popped in the process of finding the parenthesis, re-enabling -@samp{foo} and expanding it a second time. - -@section Looking for a function-like macro's opening parenthesis -Function-like macros only expand when immediately followed by a -parenthesis. To do this cpplib needs to temporarily disable macros -and read the next token. Unfortunately, because of spacing issues -(@pxref{Token Spacing}), there can be fake padding tokens in-between, -and if the next real token is not a parenthesis cpplib needs to be -able to back up that one token as well as retain the information in -any intervening padding tokens. - -Backing up more than one token when macros are involved is not -permitted by cpplib, because in general it might involve issues like -restoring popped contexts onto the context stack, which are too hard. -Instead, searching for the parenthesis is handled by a special -function, @code{funlike_invocation_p}, which remembers padding -information as it reads tokens. If the next real token is not an -opening parenthesis, it backs up that one token, and then pushes an -extra context just containing the padding information if necessary. - -@section Marking tokens ineligible for future expansion -As discussed above, cpplib needs a way of marking tokens as -unexpandable. Since the tokens cpplib handles are read-only once they -have been lexed, it instead makes a copy of the token and adds the -flag @code{NO_EXPAND} to the copy. - -For efficiency and to simplify memory management by avoiding having to -remember to free these tokens, they are allocated as temporary tokens -from the lexer's current token run (@pxref{Lexing a line}) using the -function @code{_cpp_temp_token}. The tokens are then re-used once the -current line of tokens has been read in. - -This might sound unsafe. However, tokens runs are not re-used at the -end of a line if it happens to be in the middle of a macro argument -list, and cpplib only wants to back-up more than one lexer token in -situations where no macro expansion is involved, so the optimization -is safe. - -@node Token Spacing -@unnumbered Token Spacing -@cindex paste avoidance -@cindex spacing -@cindex token spacing - -First, consider an issue that only concerns the stand-alone -preprocessor: there needs to be a guarantee that re-reading its preprocessed -output results in an identical token stream. Without taking special -measures, this might not be the case because of macro substitution. -For example: - -@smallexample -#define PLUS + -#define EMPTY -#define f(x) =x= -+PLUS -EMPTY- PLUS+ f(=) - @expansion{} + + - - + + = = = -@emph{not} - @expansion{} ++ -- ++ === -@end smallexample - -One solution would be to simply insert a space between all adjacent -tokens. However, we would like to keep space insertion to a minimum, -both for aesthetic reasons and because it causes problems for people who -still try to abuse the preprocessor for things like Fortran source and -Makefiles. - -For now, just notice that when tokens are added (or removed, as shown by -the @code{EMPTY} example) from the original lexed token stream, we need -to check for accidental token pasting. We call this @dfn{paste -avoidance}. Token addition and removal can only occur because of macro -expansion, but accidental pasting can occur in many places: both before -and after each macro replacement, each argument replacement, and -additionally each token created by the @samp{#} and @samp{##} operators. - -Look at how the preprocessor gets whitespace output correct -normally. The @code{cpp_token} structure contains a flags byte, and one -of those flags is @code{PREV_WHITE}. This is flagged by the lexer, and -indicates that the token was preceded by whitespace of some form other -than a new line. The stand-alone preprocessor can use this flag to -decide whether to insert a space between tokens in the output. - -Now consider the result of the following macro expansion: - -@smallexample -#define add(x, y, z) x + y +z; -sum = add (1,2, 3); - @expansion{} sum = 1 + 2 +3; -@end smallexample - -The interesting thing here is that the tokens @samp{1} and @samp{2} are -output with a preceding space, and @samp{3} is output without a -preceding space, but when lexed none of these tokens had that property. -Careful consideration reveals that @samp{1} gets its preceding -whitespace from the space preceding @samp{add} in the macro invocation, -@emph{not} replacement list. @samp{2} gets its whitespace from the -space preceding the parameter @samp{y} in the macro replacement list, -and @samp{3} has no preceding space because parameter @samp{z} has none -in the replacement list. - -Once lexed, tokens are effectively fixed and cannot be altered, since -pointers to them might be held in many places, in particular by -in-progress macro expansions. So instead of modifying the two tokens -above, the preprocessor inserts a special token, which I call a -@dfn{padding token}, into the token stream to indicate that spacing of -the subsequent token is special. The preprocessor inserts padding -tokens in front of every macro expansion and expanded macro argument. -These point to a @dfn{source token} from which the subsequent real token -should inherit its spacing. In the above example, the source tokens are -@samp{add} in the macro invocation, and @samp{y} and @samp{z} in the -macro replacement list, respectively. - -It is quite easy to get multiple padding tokens in a row, for example if -a macro's first replacement token expands straight into another macro. - -@smallexample -#define foo bar -#define bar baz -[foo] - @expansion{} [baz] -@end smallexample - -Here, two padding tokens are generated with sources the @samp{foo} token -between the brackets, and the @samp{bar} token from foo's replacement -list, respectively. Clearly the first padding token is the one to -use, so the output code should contain a rule that the first -padding token in a sequence is the one that matters. - -But what if a macro expansion is left? Adjusting the above -example slightly: - -@smallexample -#define foo bar -#define bar EMPTY baz -#define EMPTY -[foo] EMPTY; - @expansion{} [ baz] ; -@end smallexample - -As shown, now there should be a space before @samp{baz} and the -semicolon in the output. - -The rules we decided above fail for @samp{baz}: we generate three -padding tokens, one per macro invocation, before the token @samp{baz}. -We would then have it take its spacing from the first of these, which -carries source token @samp{foo} with no leading space. - -It is vital that cpplib get spacing correct in these examples since any -of these macro expansions could be stringified, where spacing matters. - -So, this demonstrates that not just entering macro and argument -expansions, but leaving them requires special handling too. I made -cpplib insert a padding token with a @code{NULL} source token when -leaving macro expansions, as well as after each replaced argument in a -macro's replacement list. It also inserts appropriate padding tokens on -either side of tokens created by the @samp{#} and @samp{##} operators. -I expanded the rule so that, if we see a padding token with a -@code{NULL} source token, @emph{and} that source token has no leading -space, then we behave as if we have seen no padding tokens at all. A -quick check shows this rule will then get the above example correct as -well. - -Now a relationship with paste avoidance is apparent: we have to be -careful about paste avoidance in exactly the same locations we have -padding tokens in order to get white space correct. This makes -implementation of paste avoidance easy: wherever the stand-alone -preprocessor is fixing up spacing because of padding tokens, and it -turns out that no space is needed, it has to take the extra step to -check that a space is not needed after all to avoid an accidental paste. -The function @code{cpp_avoid_paste} advises whether a space is required -between two consecutive tokens. To avoid excessive spacing, it tries -hard to only require a space if one is likely to be necessary, but for -reasons of efficiency it is slightly conservative and might recommend a -space where one is not strictly needed. - -@node Line Numbering -@unnumbered Line numbering -@cindex line numbers - -@section Just which line number anyway? - -There are three reasonable requirements a cpplib client might have for -the line number of a token passed to it: - -@itemize @bullet -@item -The source line it was lexed on. -@item -The line it is output on. This can be different to the line it was -lexed on if, for example, there are intervening escaped newlines or -C-style comments. For example: - -@smallexample -foo /* @r{A long -comment} */ bar \ -baz -@result{} -foo bar baz -@end smallexample - -@item -If the token results from a macro expansion, the line of the macro name, -or possibly the line of the closing parenthesis in the case of -function-like macro expansion. -@end itemize - -The @code{cpp_token} structure contains @code{line} and @code{col} -members. The lexer fills these in with the line and column of the first -character of the token. Consequently, but maybe unexpectedly, a token -from the replacement list of a macro expansion carries the location of -the token within the @code{#define} directive, because cpplib expands a -macro by returning pointers to the tokens in its replacement list. The -current implementation of cpplib assigns tokens created from built-in -macros and the @samp{#} and @samp{##} operators the location of the most -recently lexed token. This is a because they are allocated from the -lexer's token runs, and because of the way the diagnostic routines infer -the appropriate location to report. - -The diagnostic routines in cpplib display the location of the most -recently @emph{lexed} token, unless they are passed a specific line and -column to report. For diagnostics regarding tokens that arise from -macro expansions, it might also be helpful for the user to see the -original location in the macro definition that the token came from. -Since that is exactly the information each token carries, such an -enhancement could be made relatively easily in future. - -The stand-alone preprocessor faces a similar problem when determining -the correct line to output the token on: the position attached to a -token is fairly useless if the token came from a macro expansion. All -tokens on a logical line should be output on its first physical line, so -the token's reported location is also wrong if it is part of a physical -line other than the first. - -To solve these issues, cpplib provides a callback that is generated -whenever it lexes a preprocessing token that starts a new logical line -other than a directive. It passes this token (which may be a -@code{CPP_EOF} token indicating the end of the translation unit) to the -callback routine, which can then use the line and column of this token -to produce correct output. - -@section Representation of line numbers - -As mentioned above, cpplib stores with each token the line number that -it was lexed on. In fact, this number is not the number of the line in -the source file, but instead bears more resemblance to the number of the -line in the translation unit. - -The preprocessor maintains a monotonic increasing line count, which is -incremented at every new line character (and also at the end of any -buffer that does not end in a new line). Since a line number of zero is -useful to indicate certain special states and conditions, this variable -starts counting from one. - -This variable therefore uniquely enumerates each line in the translation -unit. With some simple infrastructure, it is straight forward to map -from this to the original source file and line number pair, saving space -whenever line number information needs to be saved. The code the -implements this mapping lies in the files @file{line-map.c} and -@file{line-map.h}. - -Command-line macros and assertions are implemented by pushing a buffer -containing the right hand side of an equivalent @code{#define} or -@code{#assert} directive. Some built-in macros are handled similarly. -Since these are all processed before the first line of the main input -file, it will typically have an assigned line closer to twenty than to -one. - -@node Guard Macros -@unnumbered The Multiple-Include Optimization -@cindex guard macros -@cindex controlling macros -@cindex multiple-include optimization - -Header files are often of the form - -@smallexample -#ifndef FOO -#define FOO -@dots{} -#endif -@end smallexample - -@noindent -to prevent the compiler from processing them more than once. The -preprocessor notices such header files, so that if the header file -appears in a subsequent @code{#include} directive and @code{FOO} is -defined, then it is ignored and it doesn't preprocess or even re-open -the file a second time. This is referred to as the @dfn{multiple -include optimization}. - -Under what circumstances is such an optimization valid? If the file -were included a second time, it can only be optimized away if that -inclusion would result in no tokens to return, and no relevant -directives to process. Therefore the current implementation imposes -requirements and makes some allowances as follows: - -@enumerate -@item -There must be no tokens outside the controlling @code{#if}-@code{#endif} -pair, but whitespace and comments are permitted. - -@item -There must be no directives outside the controlling directive pair, but -the @dfn{null directive} (a line containing nothing other than a single -@samp{#} and possibly whitespace) is permitted. - -@item -The opening directive must be of the form - -@smallexample -#ifndef FOO -@end smallexample - -or - -@smallexample -#if !defined FOO [equivalently, #if !defined(FOO)] -@end smallexample - -@item -In the second form above, the tokens forming the @code{#if} expression -must have come directly from the source file---no macro expansion must -have been involved. This is because macro definitions can change, and -tracking whether or not a relevant change has been made is not worth the -implementation cost. - -@item -There can be no @code{#else} or @code{#elif} directives at the outer -conditional block level, because they would probably contain something -of interest to a subsequent pass. -@end enumerate - -First, when pushing a new file on the buffer stack, -@code{_stack_include_file} sets the controlling macro @code{mi_cmacro} to -@code{NULL}, and sets @code{mi_valid} to @code{true}. This indicates -that the preprocessor has not yet encountered anything that would -invalidate the multiple-include optimization. As described in the next -few paragraphs, these two variables having these values effectively -indicates top-of-file. - -When about to return a token that is not part of a directive, -@code{_cpp_lex_token} sets @code{mi_valid} to @code{false}. This -enforces the constraint that tokens outside the controlling conditional -block invalidate the optimization. - -The @code{do_if}, when appropriate, and @code{do_ifndef} directive -handlers pass the controlling macro to the function -@code{push_conditional}. cpplib maintains a stack of nested conditional -blocks, and after processing every opening conditional this function -pushes an @code{if_stack} structure onto the stack. In this structure -it records the controlling macro for the block, provided there is one -and we're at top-of-file (as described above). If an @code{#elif} or -@code{#else} directive is encountered, the controlling macro for that -block is cleared to @code{NULL}. Otherwise, it survives until the -@code{#endif} closing the block, upon which @code{do_endif} sets -@code{mi_valid} to true and stores the controlling macro in -@code{mi_cmacro}. - -@code{_cpp_handle_directive} clears @code{mi_valid} when processing any -directive other than an opening conditional and the null directive. -With this, and requiring top-of-file to record a controlling macro, and -no @code{#else} or @code{#elif} for it to survive and be copied to -@code{mi_cmacro} by @code{do_endif}, we have enforced the absence of -directives outside the main conditional block for the optimization to be -on. - -Note that whilst we are inside the conditional block, @code{mi_valid} is -likely to be reset to @code{false}, but this does not matter since -the closing @code{#endif} restores it to @code{true} if appropriate. - -Finally, since @code{_cpp_lex_direct} pops the file off the buffer stack -at @code{EOF} without returning a token, if the @code{#endif} directive -was not followed by any tokens, @code{mi_valid} is @code{true} and -@code{_cpp_pop_file_buffer} remembers the controlling macro associated -with the file. Subsequent calls to @code{stack_include_file} result in -no buffer being pushed if the controlling macro is defined, effecting -the optimization. - -A quick word on how we handle the - -@smallexample -#if !defined FOO -@end smallexample - -@noindent -case. @code{_cpp_parse_expr} and @code{parse_defined} take steps to see -whether the three stages @samp{!}, @samp{defined-expression} and -@samp{end-of-directive} occur in order in a @code{#if} expression. If -so, they return the guard macro to @code{do_if} in the variable -@code{mi_ind_cmacro}, and otherwise set it to @code{NULL}. -@code{enter_macro_context} sets @code{mi_valid} to false, so if a macro -was expanded whilst parsing any part of the expression, then the -top-of-file test in @code{push_conditional} fails and the optimization -is turned off. - -@node Files -@unnumbered File Handling -@cindex files - -Fairly obviously, the file handling code of cpplib resides in the file -@file{files.c}. It takes care of the details of file searching, -opening, reading and caching, for both the main source file and all the -headers it recursively includes. - -The basic strategy is to minimize the number of system calls. On many -systems, the basic @code{open ()} and @code{fstat ()} system calls can -be quite expensive. For every @code{#include}-d file, we need to try -all the directories in the search path until we find a match. Some -projects, such as glibc, pass twenty or thirty include paths on the -command line, so this can rapidly become time consuming. - -For a header file we have not encountered before we have little choice -but to do this. However, it is often the case that the same headers are -repeatedly included, and in these cases we try to avoid repeating the -filesystem queries whilst searching for the correct file. - -For each file we try to open, we store the constructed path in a splay -tree. This path first undergoes simplification by the function -@code{_cpp_simplify_pathname}. For example, -@file{/usr/include/bits/../foo.h} is simplified to -@file{/usr/include/foo.h} before we enter it in the splay tree and try -to @code{open ()} the file. CPP will then find subsequent uses of -@file{foo.h}, even as @file{/usr/include/foo.h}, in the splay tree and -save system calls. - -Further, it is likely the file contents have also been cached, saving a -@code{read ()} system call. We don't bother caching the contents of -header files that are re-inclusion protected, and whose re-inclusion -macro is defined when we leave the header file for the first time. If -the host supports it, we try to map suitably large files into memory, -rather than reading them in directly. - -The include paths are internally stored on a null-terminated -singly-linked list, starting with the @code{"header.h"} directory search -chain, which then links into the @code{} directory chain. - -Files included with the @code{} syntax start the lookup directly -in the second half of this chain. However, files included with the -@code{"foo.h"} syntax start at the beginning of the chain, but with one -extra directory prepended. This is the directory of the current file; -the one containing the @code{#include} directive. Prepending this -directory on a per-file basis is handled by the function -@code{search_from}. - -Note that a header included with a directory component, such as -@code{#include "mydir/foo.h"} and opened as -@file{/usr/local/include/mydir/foo.h}, will have the complete path minus -the basename @samp{foo.h} as the current directory. - -Enough information is stored in the splay tree that CPP can immediately -tell whether it can skip the header file because of the multiple include -optimization, whether the file didn't exist or couldn't be opened for -some reason, or whether the header was flagged not to be re-used, as it -is with the obsolete @code{#import} directive. - -For the benefit of MS-DOS filesystems with an 8.3 filename limitation, -CPP offers the ability to treat various include file names as aliases -for the real header files with shorter names. The map from one to the -other is found in a special file called @samp{header.gcc}, stored in the -command line (or system) include directories to which the mapping -applies. This may be higher up the directory tree than the full path to -the file minus the base name. - -@node Concept Index -@unnumbered Concept Index -@printindex cp - -@bye diff --git a/contrib/gcc-5.0/gcc/doc/cppopts.texi b/contrib/gcc-5.0/gcc/doc/cppopts.texi deleted file mode 100644 index 40e6443cbb..0000000000 --- a/contrib/gcc-5.0/gcc/doc/cppopts.texi +++ /dev/null @@ -1,835 +0,0 @@ -@c Copyright (C) 1999-2015 Free Software Foundation, Inc. -@c This is part of the CPP and GCC manuals. -@c For copying conditions, see the file gcc.texi. - -@c --------------------------------------------------------------------- -@c Options affecting the preprocessor -@c --------------------------------------------------------------------- - -@c If this file is included with the flag ``cppmanual'' set, it is -@c formatted for inclusion in the CPP manual; otherwise the main GCC manual. - -@table @gcctabopt -@item -D @var{name} -@opindex D -Predefine @var{name} as a macro, with definition @code{1}. - -@item -D @var{name}=@var{definition} -The contents of @var{definition} are tokenized and processed as if -they appeared during translation phase three in a @samp{#define} -directive. In particular, the definition will be truncated by -embedded newline characters. - -If you are invoking the preprocessor from a shell or shell-like -program you may need to use the shell's quoting syntax to protect -characters such as spaces that have a meaning in the shell syntax. - -If you wish to define a function-like macro on the command line, write -its argument list with surrounding parentheses before the equals sign -(if any). Parentheses are meaningful to most shells, so you will need -to quote the option. With @command{sh} and @command{csh}, -@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works. - -@option{-D} and @option{-U} options are processed in the order they -are given on the command line. All @option{-imacros @var{file}} and -@option{-include @var{file}} options are processed after all -@option{-D} and @option{-U} options. - -@item -U @var{name} -@opindex U -Cancel any previous definition of @var{name}, either built in or -provided with a @option{-D} option. - -@item -undef -@opindex undef -Do not predefine any system-specific or GCC-specific macros. The -standard predefined macros remain defined. -@ifset cppmanual -@xref{Standard Predefined Macros}. -@end ifset - -@item -I @var{dir} -@opindex I -Add the directory @var{dir} to the list of directories to be searched -for header files. -@ifset cppmanual -@xref{Search Path}. -@end ifset -Directories named by @option{-I} are searched before the standard -system include directories. If the directory @var{dir} is a standard -system include directory, the option is ignored to ensure that the -default search order for system directories and the special treatment -of system headers are not defeated -@ifset cppmanual -(@pxref{System Headers}) -@end ifset -. -If @var{dir} begins with @code{=}, then the @code{=} will be replaced -by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. - -@item -o @var{file} -@opindex o -Write output to @var{file}. This is the same as specifying @var{file} -as the second non-option argument to @command{cpp}. @command{gcc} has a -different interpretation of a second non-option argument, so you must -use @option{-o} to specify the output file. - -@item -Wall -@opindex Wall -Turns on all optional warnings which are desirable for normal code. -At present this is @option{-Wcomment}, @option{-Wtrigraphs}, -@option{-Wmultichar} and a warning about integer promotion causing a -change of sign in @code{#if} expressions. Note that many of the -preprocessor's warnings are on by default and have no options to -control them. - -@item -Wcomment -@itemx -Wcomments -@opindex Wcomment -@opindex Wcomments -Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} -comment, or whenever a backslash-newline appears in a @samp{//} comment. -(Both forms have the same effect.) - -@item -Wtrigraphs -@opindex Wtrigraphs -@anchor{Wtrigraphs} -Most trigraphs in comments cannot affect the meaning of the program. -However, a trigraph that would form an escaped newline (@samp{??/} at -the end of a line) can, by changing where the comment begins or ends. -Therefore, only trigraphs that would form escaped newlines produce -warnings inside a comment. - -This option is implied by @option{-Wall}. If @option{-Wall} is not -given, this option is still enabled unless trigraphs are enabled. To -get trigraph conversion without warnings, but get the other -@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}. - -@item -Wtraditional -@opindex Wtraditional -Warn about certain constructs that behave differently in traditional and -ISO C@. Also warn about ISO C constructs that have no traditional C -equivalent, and problematic constructs which should be avoided. -@ifset cppmanual -@xref{Traditional Mode}. -@end ifset - -@item -Wundef -@opindex Wundef -Warn whenever an identifier which is not a macro is encountered in an -@samp{#if} directive, outside of @samp{defined}. Such identifiers are -replaced with zero. - -@item -Wunused-macros -@opindex Wunused-macros -Warn about macros defined in the main file that are unused. A macro -is @dfn{used} if it is expanded or tested for existence at least once. -The preprocessor will also warn if the macro has not been used at the -time it is redefined or undefined. - -Built-in macros, macros defined on the command line, and macros -defined in include files are not warned about. - -@emph{Note:} If a macro is actually used, but only used in skipped -conditional blocks, then CPP will report it as unused. To avoid the -warning in such a case, you might improve the scope of the macro's -definition by, for example, moving it into the first skipped block. -Alternatively, you could provide a dummy use with something like: - -@smallexample -#if defined the_macro_causing_the_warning -#endif -@end smallexample - -@item -Wendif-labels -@opindex Wendif-labels -Warn whenever an @samp{#else} or an @samp{#endif} are followed by text. -This usually happens in code of the form - -@smallexample -#if FOO -@dots{} -#else FOO -@dots{} -#endif FOO -@end smallexample - -@noindent -The second and third @code{FOO} should be in comments, but often are not -in older programs. This warning is on by default. - -@item -Werror -@opindex Werror -Make all warnings into hard errors. Source code which triggers warnings -will be rejected. - -@item -Wsystem-headers -@opindex Wsystem-headers -Issue warnings for code in system headers. These are normally unhelpful -in finding bugs in your own code, therefore suppressed. If you are -responsible for the system library, you may want to see them. - -@item -w -@opindex w -Suppress all warnings, including those which GNU CPP issues by default. - -@item -pedantic -@opindex pedantic -Issue all the mandatory diagnostics listed in the C standard. Some of -them are left out by default, since they trigger frequently on harmless -code. - -@item -pedantic-errors -@opindex pedantic-errors -Issue all the mandatory diagnostics, and make all mandatory diagnostics -into errors. This includes mandatory diagnostics that GCC issues -without @samp{-pedantic} but treats as warnings. - -@item -M -@opindex M -@cindex @command{make} -@cindex dependencies, @command{make} -Instead of outputting the result of preprocessing, output a rule -suitable for @command{make} describing the dependencies of the main -source file. The preprocessor outputs one @command{make} rule containing -the object file name for that source file, a colon, and the names of all -the included files, including those coming from @option{-include} or -@option{-imacros} command-line options. - -Unless specified explicitly (with @option{-MT} or @option{-MQ}), the -object file name consists of the name of the source file with any -suffix replaced with object file suffix and with any leading directory -parts removed. If there are many included files then the rule is -split into several lines using @samp{\}-newline. The rule has no -commands. - -This option does not suppress the preprocessor's debug output, such as -@option{-dM}. To avoid mixing such debug output with the dependency -rules you should explicitly specify the dependency output file with -@option{-MF}, or use an environment variable like -@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output -will still be sent to the regular output stream as normal. - -Passing @option{-M} to the driver implies @option{-E}, and suppresses -warnings with an implicit @option{-w}. - -@item -MM -@opindex MM -Like @option{-M} but do not mention header files that are found in -system header directories, nor header files that are included, -directly or indirectly, from such a header. - -This implies that the choice of angle brackets or double quotes in an -@samp{#include} directive does not in itself determine whether that -header will appear in @option{-MM} dependency output. This is a -slight change in semantics from GCC versions 3.0 and earlier. - -@anchor{dashMF} -@item -MF @var{file} -@opindex MF -When used with @option{-M} or @option{-MM}, specifies a -file to write the dependencies to. If no @option{-MF} switch is given -the preprocessor sends the rules to the same place it would have sent -preprocessed output. - -When used with the driver options @option{-MD} or @option{-MMD}, -@option{-MF} overrides the default dependency output file. - -@item -MG -@opindex MG -In conjunction with an option such as @option{-M} requesting -dependency generation, @option{-MG} assumes missing header files are -generated files and adds them to the dependency list without raising -an error. The dependency filename is taken directly from the -@code{#include} directive without prepending any path. @option{-MG} -also suppresses preprocessed output, as a missing header file renders -this useless. - -This feature is used in automatic updating of makefiles. - -@item -MP -@opindex MP -This option instructs CPP to add a phony target for each dependency -other than the main file, causing each to depend on nothing. These -dummy rules work around errors @command{make} gives if you remove header -files without updating the @file{Makefile} to match. - -This is typical output: - -@smallexample -test.o: test.c test.h - -test.h: -@end smallexample - -@item -MT @var{target} -@opindex MT - -Change the target of the rule emitted by dependency generation. By -default CPP takes the name of the main input file, deletes any -directory components and any file suffix such as @samp{.c}, and -appends the platform's usual object suffix. The result is the target. - -An @option{-MT} option will set the target to be exactly the string you -specify. If you want multiple targets, you can specify them as a single -argument to @option{-MT}, or use multiple @option{-MT} options. - -For example, @option{@w{-MT '$(objpfx)foo.o'}} might give - -@smallexample -$(objpfx)foo.o: foo.c -@end smallexample - -@item -MQ @var{target} -@opindex MQ - -Same as @option{-MT}, but it quotes any characters which are special to -Make. @option{@w{-MQ '$(objpfx)foo.o'}} gives - -@smallexample -$$(objpfx)foo.o: foo.c -@end smallexample - -The default target is automatically quoted, as if it were given with -@option{-MQ}. - -@item -MD -@opindex MD -@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that -@option{-E} is not implied. The driver determines @var{file} based on -whether an @option{-o} option is given. If it is, the driver uses its -argument but with a suffix of @file{.d}, otherwise it takes the name -of the input file, removes any directory components and suffix, and -applies a @file{.d} suffix. - -If @option{-MD} is used in conjunction with @option{-E}, any -@option{-o} switch is understood to specify the dependency output file -(@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o} -is understood to specify a target object file. - -Since @option{-E} is not implied, @option{-MD} can be used to generate -a dependency output file as a side-effect of the compilation process. - -@item -MMD -@opindex MMD -Like @option{-MD} except mention only user header files, not system -header files. - -@ifclear cppmanual -@item -fpch-deps -@opindex fpch-deps -When using precompiled headers (@pxref{Precompiled Headers}), this flag -will cause the dependency-output flags to also list the files from the -precompiled header's dependencies. If not specified only the -precompiled header would be listed and not the files that were used to -create it because those files are not consulted when a precompiled -header is used. - -@item -fpch-preprocess -@opindex fpch-preprocess -This option allows use of a precompiled header (@pxref{Precompiled -Headers}) together with @option{-E}. It inserts a special @code{#pragma}, -@code{#pragma GCC pch_preprocess "@var{filename}"} in the output to mark -the place where the precompiled header was found, and its @var{filename}. -When @option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma} -and loads the PCH@. - -This option is off by default, because the resulting preprocessed output -is only really suitable as input to GCC@. It is switched on by -@option{-save-temps}. - -You should not write this @code{#pragma} in your own code, but it is -safe to edit the filename if the PCH file is available in a different -location. The filename may be absolute or it may be relative to GCC's -current directory. - -@end ifclear -@item -x c -@itemx -x c++ -@itemx -x objective-c -@itemx -x assembler-with-cpp -@opindex x -Specify the source language: C, C++, Objective-C, or assembly. This has -nothing to do with standards conformance or extensions; it merely -selects which base syntax to expect. If you give none of these options, -cpp will deduce the language from the extension of the source file: -@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common -extensions for C++ and assembly are also recognized. If cpp does not -recognize the extension, it will treat the file as C; this is the most -generic mode. - -@emph{Note:} Previous versions of cpp accepted a @option{-lang} option -which selected both the language and the standards conformance level. -This option has been removed, because it conflicts with the @option{-l} -option. - -@item -std=@var{standard} -@itemx -ansi -@opindex ansi -@opindex std= -Specify the standard to which the code should conform. Currently CPP -knows about C and C++ standards; others may be added in the future. - -@var{standard} -may be one of: -@table @code -@item c90 -@itemx c89 -@itemx iso9899:1990 -The ISO C standard from 1990. @samp{c90} is the customary shorthand for -this version of the standard. - -The @option{-ansi} option is equivalent to @option{-std=c90}. - -@item iso9899:199409 -The 1990 C standard, as amended in 1994. - -@item iso9899:1999 -@itemx c99 -@itemx iso9899:199x -@itemx c9x -The revised ISO C standard, published in December 1999. Before -publication, this was known as C9X@. - -@item iso9899:2011 -@itemx c11 -@itemx c1x -The revised ISO C standard, published in December 2011. Before -publication, this was known as C1X@. - -@item gnu90 -@itemx gnu89 -The 1990 C standard plus GNU extensions. This is the default. - -@item gnu99 -@itemx gnu9x -The 1999 C standard plus GNU extensions. - -@item gnu11 -@itemx gnu1x -The 2011 C standard plus GNU extensions. - -@item c++98 -The 1998 ISO C++ standard plus amendments. - -@item gnu++98 -The same as @option{-std=c++98} plus GNU extensions. This is the -default for C++ code. -@end table - -@item -I- -@opindex I- -Split the include path. Any directories specified with @option{-I} -options before @option{-I-} are searched only for headers requested with -@code{@w{#include "@var{file}"}}; they are not searched for -@code{@w{#include <@var{file}>}}. If additional directories are -specified with @option{-I} options after the @option{-I-}, those -directories are searched for all @samp{#include} directives. - -In addition, @option{-I-} inhibits the use of the directory of the current -file directory as the first search directory for @code{@w{#include -"@var{file}"}}. -@ifset cppmanual -@xref{Search Path}. -@end ifset -This option has been deprecated. - -@item -nostdinc -@opindex nostdinc -Do not search the standard system directories for header files. -Only the directories you have specified with @option{-I} options -(and the directory of the current file, if appropriate) are searched. - -@item -nostdinc++ -@opindex nostdinc++ -Do not search for header files in the C++-specific standard directories, -but do still search the other standard directories. (This option is -used when building the C++ library.) - -@item -include @var{file} -@opindex include -Process @var{file} as if @code{#include "file"} appeared as the first -line of the primary source file. However, the first directory searched -for @var{file} is the preprocessor's working directory @emph{instead of} -the directory containing the main source file. If not found there, it -is searched for in the remainder of the @code{#include "@dots{}"} search -chain as normal. - -If multiple @option{-include} options are given, the files are included -in the order they appear on the command line. - -@item -imacros @var{file} -@opindex imacros -Exactly like @option{-include}, except that any output produced by -scanning @var{file} is thrown away. Macros it defines remain defined. -This allows you to acquire all the macros from a header without also -processing its declarations. - -All files specified by @option{-imacros} are processed before all files -specified by @option{-include}. - -@item -idirafter @var{dir} -@opindex idirafter -Search @var{dir} for header files, but do it @emph{after} all -directories specified with @option{-I} and the standard system directories -have been exhausted. @var{dir} is treated as a system include directory. -If @var{dir} begins with @code{=}, then the @code{=} will be replaced -by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. - -@item -iprefix @var{prefix} -@opindex iprefix -Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix} -options. If the prefix represents a directory, you should include the -final @samp{/}. - -@item -iwithprefix @var{dir} -@itemx -iwithprefixbefore @var{dir} -@opindex iwithprefix -@opindex iwithprefixbefore -Append @var{dir} to the prefix specified previously with -@option{-iprefix}, and add the resulting directory to the include search -path. @option{-iwithprefixbefore} puts it in the same place @option{-I} -would; @option{-iwithprefix} puts it where @option{-idirafter} would. - -@item -isysroot @var{dir} -@opindex isysroot -This option is like the @option{--sysroot} option, but applies only to -header files (except for Darwin targets, where it applies to both header -files and libraries). See the @option{--sysroot} option for more -information. - -@item -imultilib @var{dir} -@opindex imultilib -Use @var{dir} as a subdirectory of the directory containing -target-specific C++ headers. - -@item -isystem @var{dir} -@opindex isystem -Search @var{dir} for header files, after all directories specified by -@option{-I} but before the standard system directories. Mark it -as a system directory, so that it gets the same special treatment as -is applied to the standard system directories. -@ifset cppmanual -@xref{System Headers}. -@end ifset -If @var{dir} begins with @code{=}, then the @code{=} will be replaced -by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. - -@item -iquote @var{dir} -@opindex iquote -Search @var{dir} only for header files requested with -@code{@w{#include "@var{file}"}}; they are not searched for -@code{@w{#include <@var{file}>}}, before all directories specified by -@option{-I} and before the standard system directories. -@ifset cppmanual -@xref{Search Path}. -@end ifset -If @var{dir} begins with @code{=}, then the @code{=} will be replaced -by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. - -@item -fdirectives-only -@opindex fdirectives-only -When preprocessing, handle directives, but do not expand macros. - -The option's behavior depends on the @option{-E} and @option{-fpreprocessed} -options. - -With @option{-E}, preprocessing is limited to the handling of directives -such as @code{#define}, @code{#ifdef}, and @code{#error}. Other -preprocessor operations, such as macro expansion and trigraph -conversion are not performed. In addition, the @option{-dD} option is -implicitly enabled. - -With @option{-fpreprocessed}, predefinition of command line and most -builtin macros is disabled. Macros such as @code{__LINE__}, which are -contextually dependent, are handled normally. This enables compilation of -files previously preprocessed with @code{-E -fdirectives-only}. - -With both @option{-E} and @option{-fpreprocessed}, the rules for -@option{-fpreprocessed} take precedence. This enables full preprocessing of -files previously preprocessed with @code{-E -fdirectives-only}. - -@item -fdollars-in-identifiers -@opindex fdollars-in-identifiers -@anchor{fdollars-in-identifiers} -Accept @samp{$} in identifiers. -@ifset cppmanual -@xref{Identifier characters}. -@end ifset - -@item -fextended-identifiers -@opindex fextended-identifiers -Accept universal character names in identifiers. This option is -enabled by default for C99 (and later C standard versions) and C++. - -@item -fno-canonical-system-headers -@opindex fno-canonical-system-headers -When preprocessing, do not shorten system header paths with canonicalization. - -@item -fpreprocessed -@opindex fpreprocessed -Indicate to the preprocessor that the input file has already been -preprocessed. This suppresses things like macro expansion, trigraph -conversion, escaped newline splicing, and processing of most directives. -The preprocessor still recognizes and removes comments, so that you can -pass a file preprocessed with @option{-C} to the compiler without -problems. In this mode the integrated preprocessor is little more than -a tokenizer for the front ends. - -@option{-fpreprocessed} is implicit if the input file has one of the -extensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are the -extensions that GCC uses for preprocessed files created by -@option{-save-temps}. - -@item -ftabstop=@var{width} -@opindex ftabstop -Set the distance between tab stops. This helps the preprocessor report -correct column numbers in warnings or errors, even if tabs appear on the -line. If the value is less than 1 or greater than 100, the option is -ignored. The default is 8. - -@item -fdebug-cpp -@opindex fdebug-cpp -This option is only useful for debugging GCC. When used with -@option{-E}, dumps debugging information about location maps. Every -token in the output is preceded by the dump of the map its location -belongs to. The dump of the map holding the location of a token would -be: -@smallexample -@{@samp{P}:@file{/file/path};@samp{F}:@file{/includer/path};@samp{L}:@var{line_num};@samp{C}:@var{col_num};@samp{S}:@var{system_header_p};@samp{M}:@var{map_address};@samp{E}:@var{macro_expansion_p},@samp{loc}:@var{location}@} -@end smallexample - -When used without @option{-E}, this option has no effect. - -@item -ftrack-macro-expansion@r{[}=@var{level}@r{]} -@opindex ftrack-macro-expansion -Track locations of tokens across macro expansions. This allows the -compiler to emit diagnostic about the current macro expansion stack -when a compilation error occurs in a macro expansion. Using this -option makes the preprocessor and the compiler consume more -memory. The @var{level} parameter can be used to choose the level of -precision of token location tracking thus decreasing the memory -consumption if necessary. Value @samp{0} of @var{level} de-activates -this option just as if no @option{-ftrack-macro-expansion} was present -on the command line. Value @samp{1} tracks tokens locations in a -degraded mode for the sake of minimal memory overhead. In this mode -all tokens resulting from the expansion of an argument of a -function-like macro have the same location. Value @samp{2} tracks -tokens locations completely. This value is the most memory hungry. -When this option is given no argument, the default parameter value is -@samp{2}. - -Note that @code{-ftrack-macro-expansion=2} is activated by default. - -@item -fexec-charset=@var{charset} -@opindex fexec-charset -@cindex character set, execution -Set the execution character set, used for string and character -constants. The default is UTF-8. @var{charset} can be any encoding -supported by the system's @code{iconv} library routine. - -@item -fwide-exec-charset=@var{charset} -@opindex fwide-exec-charset -@cindex character set, wide execution -Set the wide execution character set, used for wide string and -character constants. The default is UTF-32 or UTF-16, whichever -corresponds to the width of @code{wchar_t}. As with -@option{-fexec-charset}, @var{charset} can be any encoding supported -by the system's @code{iconv} library routine; however, you will have -problems with encodings that do not fit exactly in @code{wchar_t}. - -@item -finput-charset=@var{charset} -@opindex finput-charset -@cindex character set, input -Set the input character set, used for translation from the character -set of the input file to the source character set used by GCC@. If the -locale does not specify, or GCC cannot get this information from the -locale, the default is UTF-8. This can be overridden by either the locale -or this command-line option. Currently the command-line option takes -precedence if there's a conflict. @var{charset} can be any encoding -supported by the system's @code{iconv} library routine. - -@item -fworking-directory -@opindex fworking-directory -@opindex fno-working-directory -Enable generation of linemarkers in the preprocessor output that will -let the compiler know the current working directory at the time of -preprocessing. When this option is enabled, the preprocessor will -emit, after the initial linemarker, a second linemarker with the -current working directory followed by two slashes. GCC will use this -directory, when it's present in the preprocessed input, as the -directory emitted as the current working directory in some debugging -information formats. This option is implicitly enabled if debugging -information is enabled, but this can be inhibited with the negated -form @option{-fno-working-directory}. If the @option{-P} flag is -present in the command line, this option has no effect, since no -@code{#line} directives are emitted whatsoever. - -@item -fno-show-column -@opindex fno-show-column -Do not print column numbers in diagnostics. This may be necessary if -diagnostics are being scanned by a program that does not understand the -column numbers, such as @command{dejagnu}. - -@item -A @var{predicate}=@var{answer} -@opindex A -Make an assertion with the predicate @var{predicate} and answer -@var{answer}. This form is preferred to the older form @option{-A -@var{predicate}(@var{answer})}, which is still supported, because -it does not use shell special characters. -@ifset cppmanual -@xref{Obsolete Features}. -@end ifset - -@item -A -@var{predicate}=@var{answer} -Cancel an assertion with the predicate @var{predicate} and answer -@var{answer}. - -@item -dCHARS -@var{CHARS} is a sequence of one or more of the following characters, -and must not be preceded by a space. Other characters are interpreted -by the compiler proper, or reserved for future versions of GCC, and so -are silently ignored. If you specify characters whose behavior -conflicts, the result is undefined. - -@table @samp -@item M -@opindex dM -Instead of the normal output, generate a list of @samp{#define} -directives for all the macros defined during the execution of the -preprocessor, including predefined macros. This gives you a way of -finding out what is predefined in your version of the preprocessor. -Assuming you have no file @file{foo.h}, the command - -@smallexample -touch foo.h; cpp -dM foo.h -@end smallexample - -@noindent -will show all the predefined macros. - -If you use @option{-dM} without the @option{-E} option, @option{-dM} is -interpreted as a synonym for @option{-fdump-rtl-mach}. -@xref{Debugging Options, , ,gcc}. - -@item D -@opindex dD -Like @samp{M} except in two respects: it does @emph{not} include the -predefined macros, and it outputs @emph{both} the @samp{#define} -directives and the result of preprocessing. Both kinds of output go to -the standard output file. - -@item N -@opindex dN -Like @samp{D}, but emit only the macro names, not their expansions. - -@item I -@opindex dI -Output @samp{#include} directives in addition to the result of -preprocessing. - -@item U -@opindex dU -Like @samp{D} except that only macros that are expanded, or whose -definedness is tested in preprocessor directives, are output; the -output is delayed until the use or test of the macro; and -@samp{#undef} directives are also output for macros tested but -undefined at the time. -@end table - -@item -P -@opindex P -Inhibit generation of linemarkers in the output from the preprocessor. -This might be useful when running the preprocessor on something that is -not C code, and will be sent to a program which might be confused by the -linemarkers. -@ifset cppmanual -@xref{Preprocessor Output}. -@end ifset - -@item -C -@opindex C -Do not discard comments. All comments are passed through to the output -file, except for comments in processed directives, which are deleted -along with the directive. - -You should be prepared for side effects when using @option{-C}; it -causes the preprocessor to treat comments as tokens in their own right. -For example, comments appearing at the start of what would be a -directive line have the effect of turning that line into an ordinary -source line, since the first token on the line is no longer a @samp{#}. - -@item -CC -Do not discard comments, including during macro expansion. This is -like @option{-C}, except that comments contained within macros are -also passed through to the output file where the macro is expanded. - -In addition to the side-effects of the @option{-C} option, the -@option{-CC} option causes all C++-style comments inside a macro -to be converted to C-style comments. This is to prevent later use -of that macro from inadvertently commenting out the remainder of -the source line. - -The @option{-CC} option is generally used to support lint comments. - -@item -traditional-cpp -@opindex traditional-cpp -Try to imitate the behavior of old-fashioned C preprocessors, as -opposed to ISO C preprocessors. -@ifset cppmanual -@xref{Traditional Mode}. -@end ifset - -@item -trigraphs -@opindex trigraphs -Process trigraph sequences. -@ifset cppmanual -@xref{Initial processing}. -@end ifset -@ifclear cppmanual -These are three-character sequences, all starting with @samp{??}, that -are defined by ISO C to stand for single characters. For example, -@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character -constant for a newline. By default, GCC ignores trigraphs, but in -standard-conforming modes it converts them. See the @option{-std} and -@option{-ansi} options. - -The nine trigraphs and their replacements are - -@smallexample -Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- -Replacement: [ ] @{ @} # \ ^ | ~ -@end smallexample -@end ifclear - -@item -remap -@opindex remap -Enable special code to work around file systems which only permit very -short file names, such as MS-DOS@. - -@item --help -@itemx --target-help -@opindex help -@opindex target-help -Print text describing all the command-line options instead of -preprocessing anything. - -@item -v -@opindex v -Verbose mode. Print out GNU CPP's version number at the beginning of -execution, and report the final form of the include path. - -@item -H -@opindex H -Print the name of each header file used, in addition to other normal -activities. Each name is indented to show how deep in the -@samp{#include} stack it is. Precompiled header files are also -printed, even if they are found to be invalid; an invalid precompiled -header file is printed with @samp{...x} and a valid one with @samp{...!} . - -@item -version -@itemx --version -@opindex version -Print out GNU CPP's version number. With one dash, proceed to -preprocess as normal. With two dashes, exit immediately. -@end table diff --git a/contrib/gcc-5.0/gcc/doc/extend.texi b/contrib/gcc-5.0/gcc/doc/extend.texi deleted file mode 100644 index 50815d1bf4..0000000000 --- a/contrib/gcc-5.0/gcc/doc/extend.texi +++ /dev/null @@ -1,19307 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. - -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node C Extensions -@chapter Extensions to the C Language Family -@cindex extensions, C language -@cindex C language extensions - -@opindex pedantic -GNU C provides several language features not found in ISO standard C@. -(The @option{-pedantic} option directs GCC to print a warning message if -any of these features is used.) To test for the availability of these -features in conditional compilation, check for a predefined macro -@code{__GNUC__}, which is always defined under GCC@. - -These extensions are available in C and Objective-C@. Most of them are -also available in C++. @xref{C++ Extensions,,Extensions to the -C++ Language}, for extensions that apply @emph{only} to C++. - -Some features that are in ISO C99 but not C90 or C++ are also, as -extensions, accepted by GCC in C90 mode and in C++. - -@menu -* Statement Exprs:: Putting statements and declarations inside expressions. -* Local Labels:: Labels local to a block. -* Labels as Values:: Getting pointers to labels, and computed gotos. -* Nested Functions:: As in Algol and Pascal, lexical scoping of functions. -* Constructing Calls:: Dispatching a call to another function. -* Typeof:: @code{typeof}: referring to the type of an expression. -* Conditionals:: Omitting the middle operand of a @samp{?:} expression. -* __int128:: 128-bit integers---@code{__int128}. -* Long Long:: Double-word integers---@code{long long int}. -* Complex:: Data types for complex numbers. -* Floating Types:: Additional Floating Types. -* Half-Precision:: Half-Precision Floating Point. -* Decimal Float:: Decimal Floating Types. -* Hex Floats:: Hexadecimal floating-point constants. -* Fixed-Point:: Fixed-Point Types. -* Named Address Spaces::Named address spaces. -* Zero Length:: Zero-length arrays. -* Empty Structures:: Structures with no members. -* Variable Length:: Arrays whose length is computed at run time. -* Variadic Macros:: Macros with a variable number of arguments. -* Escaped Newlines:: Slightly looser rules for escaped newlines. -* Subscripting:: Any array can be subscripted, even if not an lvalue. -* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers. -* Pointers to Arrays:: Pointers to arrays with qualifiers work as expected. -* Initializers:: Non-constant initializers. -* Compound Literals:: Compound literals give structures, unions - or arrays as values. -* Designated Inits:: Labeling elements of initializers. -* Case Ranges:: `case 1 ... 9' and such. -* Cast to Union:: Casting to union type from any member of the union. -* Mixed Declarations:: Mixing declarations and code. -* Function Attributes:: Declaring that functions have no side effects, - or that they can never return. -* Label Attributes:: Specifying attributes on labels. -* Attribute Syntax:: Formal syntax for attributes. -* Function Prototypes:: Prototype declarations and old-style definitions. -* C++ Comments:: C++ comments are recognized. -* Dollar Signs:: Dollar sign is allowed in identifiers. -* Character Escapes:: @samp{\e} stands for the character @key{ESC}. -* Variable Attributes:: Specifying attributes of variables. -* Type Attributes:: Specifying attributes of types. -* Alignment:: Inquiring about the alignment of a type or variable. -* Inline:: Defining inline functions (as fast as macros). -* Volatiles:: What constitutes an access to a volatile object. -* Using Assembly Language with C:: Instructions and extensions for interfacing C with assembler. -* Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files. -* Incomplete Enums:: @code{enum foo;}, with details to follow. -* Function Names:: Printable strings which are the name of the current - function. -* Return Address:: Getting the return or frame address of a function. -* Vector Extensions:: Using vector instructions through built-in functions. -* Offsetof:: Special syntax for implementing @code{offsetof}. -* __sync Builtins:: Legacy built-in functions for atomic memory access. -* __atomic Builtins:: Atomic built-in functions with memory model. -* Integer Overflow Builtins:: Built-in functions to perform arithmetics and - arithmetic overflow checking. -* x86 specific memory model extensions for transactional memory:: x86 memory models. -* Object Size Checking:: Built-in functions for limited buffer overflow - checking. -* Pointer Bounds Checker builtins:: Built-in functions for Pointer Bounds Checker. -* Cilk Plus Builtins:: Built-in functions for the Cilk Plus language extension. -* Other Builtins:: Other built-in functions. -* Target Builtins:: Built-in functions specific to particular targets. -* Target Format Checks:: Format checks specific to particular targets. -* Pragmas:: Pragmas accepted by GCC. -* Unnamed Fields:: Unnamed struct/union fields within structs/unions. -* Thread-Local:: Per-thread variables. -* Binary constants:: Binary constants using the @samp{0b} prefix. -@end menu - -@node Statement Exprs -@section Statements and Declarations in Expressions -@cindex statements inside expressions -@cindex declarations inside expressions -@cindex expressions containing statements -@cindex macros, statements in expressions - -@c the above section title wrapped and causes an underfull hbox.. i -@c changed it from "within" to "in". --mew 4feb93 -A compound statement enclosed in parentheses may appear as an expression -in GNU C@. This allows you to use loops, switches, and local variables -within an expression. - -Recall that a compound statement is a sequence of statements surrounded -by braces; in this construct, parentheses go around the braces. For -example: - -@smallexample -(@{ int y = foo (); int z; - if (y > 0) z = y; - else z = - y; - z; @}) -@end smallexample - -@noindent -is a valid (though slightly more complex than necessary) expression -for the absolute value of @code{foo ()}. - -The last thing in the compound statement should be an expression -followed by a semicolon; the value of this subexpression serves as the -value of the entire construct. (If you use some other kind of statement -last within the braces, the construct has type @code{void}, and thus -effectively no value.) - -This feature is especially useful in making macro definitions ``safe'' (so -that they evaluate each operand exactly once). For example, the -``maximum'' function is commonly defined as a macro in standard C as -follows: - -@smallexample -#define max(a,b) ((a) > (b) ? (a) : (b)) -@end smallexample - -@noindent -@cindex side effects, macro argument -But this definition computes either @var{a} or @var{b} twice, with bad -results if the operand has side effects. In GNU C, if you know the -type of the operands (here taken as @code{int}), you can define -the macro safely as follows: - -@smallexample -#define maxint(a,b) \ - (@{int _a = (a), _b = (b); _a > _b ? _a : _b; @}) -@end smallexample - -Embedded statements are not allowed in constant expressions, such as -the value of an enumeration constant, the width of a bit-field, or -the initial value of a static variable. - -If you don't know the type of the operand, you can still do this, but you -must use @code{typeof} or @code{__auto_type} (@pxref{Typeof}). - -In G++, the result value of a statement expression undergoes array and -function pointer decay, and is returned by value to the enclosing -expression. For instance, if @code{A} is a class, then - -@smallexample - A a; - - (@{a;@}).Foo () -@end smallexample - -@noindent -constructs a temporary @code{A} object to hold the result of the -statement expression, and that is used to invoke @code{Foo}. -Therefore the @code{this} pointer observed by @code{Foo} is not the -address of @code{a}. - -In a statement expression, any temporaries created within a statement -are destroyed at that statement's end. This makes statement -expressions inside macros slightly different from function calls. In -the latter case temporaries introduced during argument evaluation are -destroyed at the end of the statement that includes the function -call. In the statement expression case they are destroyed during -the statement expression. For instance, - -@smallexample -#define macro(a) (@{__typeof__(a) b = (a); b + 3; @}) -template T function(T a) @{ T b = a; return b + 3; @} - -void foo () -@{ - macro (X ()); - function (X ()); -@} -@end smallexample - -@noindent -has different places where temporaries are destroyed. For the -@code{macro} case, the temporary @code{X} is destroyed just after -the initialization of @code{b}. In the @code{function} case that -temporary is destroyed when the function returns. - -These considerations mean that it is probably a bad idea to use -statement expressions of this form in header files that are designed to -work with C++. (Note that some versions of the GNU C Library contained -header files using statement expressions that lead to precisely this -bug.) - -Jumping into a statement expression with @code{goto} or using a -@code{switch} statement outside the statement expression with a -@code{case} or @code{default} label inside the statement expression is -not permitted. Jumping into a statement expression with a computed -@code{goto} (@pxref{Labels as Values}) has undefined behavior. -Jumping out of a statement expression is permitted, but if the -statement expression is part of a larger expression then it is -unspecified which other subexpressions of that expression have been -evaluated except where the language definition requires certain -subexpressions to be evaluated before or after the statement -expression. In any case, as with a function call, the evaluation of a -statement expression is not interleaved with the evaluation of other -parts of the containing expression. For example, - -@smallexample - foo (), ((@{ bar1 (); goto a; 0; @}) + bar2 ()), baz(); -@end smallexample - -@noindent -calls @code{foo} and @code{bar1} and does not call @code{baz} but -may or may not call @code{bar2}. If @code{bar2} is called, it is -called after @code{foo} and before @code{bar1}. - -@node Local Labels -@section Locally Declared Labels -@cindex local labels -@cindex macros, local labels - -GCC allows you to declare @dfn{local labels} in any nested block -scope. A local label is just like an ordinary label, but you can -only reference it (with a @code{goto} statement, or by taking its -address) within the block in which it is declared. - -A local label declaration looks like this: - -@smallexample -__label__ @var{label}; -@end smallexample - -@noindent -or - -@smallexample -__label__ @var{label1}, @var{label2}, /* @r{@dots{}} */; -@end smallexample - -Local label declarations must come at the beginning of the block, -before any ordinary declarations or statements. - -The label declaration defines the label @emph{name}, but does not define -the label itself. You must do this in the usual way, with -@code{@var{label}:}, within the statements of the statement expression. - -The local label feature is useful for complex macros. If a macro -contains nested loops, a @code{goto} can be useful for breaking out of -them. However, an ordinary label whose scope is the whole function -cannot be used: if the macro can be expanded several times in one -function, the label is multiply defined in that function. A -local label avoids this problem. For example: - -@smallexample -#define SEARCH(value, array, target) \ -do @{ \ - __label__ found; \ - typeof (target) _SEARCH_target = (target); \ - typeof (*(array)) *_SEARCH_array = (array); \ - int i, j; \ - int value; \ - for (i = 0; i < max; i++) \ - for (j = 0; j < max; j++) \ - if (_SEARCH_array[i][j] == _SEARCH_target) \ - @{ (value) = i; goto found; @} \ - (value) = -1; \ - found:; \ -@} while (0) -@end smallexample - -This could also be written using a statement expression: - -@smallexample -#define SEARCH(array, target) \ -(@{ \ - __label__ found; \ - typeof (target) _SEARCH_target = (target); \ - typeof (*(array)) *_SEARCH_array = (array); \ - int i, j; \ - int value; \ - for (i = 0; i < max; i++) \ - for (j = 0; j < max; j++) \ - if (_SEARCH_array[i][j] == _SEARCH_target) \ - @{ value = i; goto found; @} \ - value = -1; \ - found: \ - value; \ -@}) -@end smallexample - -Local label declarations also make the labels they declare visible to -nested functions, if there are any. @xref{Nested Functions}, for details. - -@node Labels as Values -@section Labels as Values -@cindex labels as values -@cindex computed gotos -@cindex goto with computed label -@cindex address of a label - -You can get the address of a label defined in the current function -(or a containing function) with the unary operator @samp{&&}. The -value has type @code{void *}. This value is a constant and can be used -wherever a constant of that type is valid. For example: - -@smallexample -void *ptr; -/* @r{@dots{}} */ -ptr = &&foo; -@end smallexample - -To use these values, you need to be able to jump to one. This is done -with the computed goto statement@footnote{The analogous feature in -Fortran is called an assigned goto, but that name seems inappropriate in -C, where one can do more than simply store label addresses in label -variables.}, @code{goto *@var{exp};}. For example, - -@smallexample -goto *ptr; -@end smallexample - -@noindent -Any expression of type @code{void *} is allowed. - -One way of using these constants is in initializing a static array that -serves as a jump table: - -@smallexample -static void *array[] = @{ &&foo, &&bar, &&hack @}; -@end smallexample - -@noindent -Then you can select a label with indexing, like this: - -@smallexample -goto *array[i]; -@end smallexample - -@noindent -Note that this does not check whether the subscript is in bounds---array -indexing in C never does that. - -Such an array of label values serves a purpose much like that of the -@code{switch} statement. The @code{switch} statement is cleaner, so -use that rather than an array unless the problem does not fit a -@code{switch} statement very well. - -Another use of label values is in an interpreter for threaded code. -The labels within the interpreter function can be stored in the -threaded code for super-fast dispatching. - -You may not use this mechanism to jump to code in a different function. -If you do that, totally unpredictable things happen. The best way to -avoid this is to store the label address only in automatic variables and -never pass it as an argument. - -An alternate way to write the above example is - -@smallexample -static const int array[] = @{ &&foo - &&foo, &&bar - &&foo, - &&hack - &&foo @}; -goto *(&&foo + array[i]); -@end smallexample - -@noindent -This is more friendly to code living in shared libraries, as it reduces -the number of dynamic relocations that are needed, and by consequence, -allows the data to be read-only. -This alternative with label differences is not supported for the AVR target, -please use the first approach for AVR programs. - -The @code{&&foo} expressions for the same label might have different -values if the containing function is inlined or cloned. If a program -relies on them being always the same, -@code{__attribute__((__noinline__,__noclone__))} should be used to -prevent inlining and cloning. If @code{&&foo} is used in a static -variable initializer, inlining and cloning is forbidden. - -@node Nested Functions -@section Nested Functions -@cindex nested functions -@cindex downward funargs -@cindex thunks - -A @dfn{nested function} is a function defined inside another function. -Nested functions are supported as an extension in GNU C, but are not -supported by GNU C++. - -The nested function's name is local to the block where it is defined. -For example, here we define a nested function named @code{square}, and -call it twice: - -@smallexample -@group -foo (double a, double b) -@{ - double square (double z) @{ return z * z; @} - - return square (a) + square (b); -@} -@end group -@end smallexample - -The nested function can access all the variables of the containing -function that are visible at the point of its definition. This is -called @dfn{lexical scoping}. For example, here we show a nested -function which uses an inherited variable named @code{offset}: - -@smallexample -@group -bar (int *array, int offset, int size) -@{ - int access (int *array, int index) - @{ return array[index + offset]; @} - int i; - /* @r{@dots{}} */ - for (i = 0; i < size; i++) - /* @r{@dots{}} */ access (array, i) /* @r{@dots{}} */ -@} -@end group -@end smallexample - -Nested function definitions are permitted within functions in the places -where variable definitions are allowed; that is, in any block, mixed -with the other declarations and statements in the block. - -It is possible to call the nested function from outside the scope of its -name by storing its address or passing the address to another function: - -@smallexample -hack (int *array, int size) -@{ - void store (int index, int value) - @{ array[index] = value; @} - - intermediate (store, size); -@} -@end smallexample - -Here, the function @code{intermediate} receives the address of -@code{store} as an argument. If @code{intermediate} calls @code{store}, -the arguments given to @code{store} are used to store into @code{array}. -But this technique works only so long as the containing function -(@code{hack}, in this example) does not exit. - -If you try to call the nested function through its address after the -containing function exits, all hell breaks loose. If you try -to call it after a containing scope level exits, and if it refers -to some of the variables that are no longer in scope, you may be lucky, -but it's not wise to take the risk. If, however, the nested function -does not refer to anything that has gone out of scope, you should be -safe. - -GCC implements taking the address of a nested function using a technique -called @dfn{trampolines}. This technique was described in -@cite{Lexical Closures for C++} (Thomas M. Breuel, USENIX -C++ Conference Proceedings, October 17-21, 1988). - -A nested function can jump to a label inherited from a containing -function, provided the label is explicitly declared in the containing -function (@pxref{Local Labels}). Such a jump returns instantly to the -containing function, exiting the nested function that did the -@code{goto} and any intermediate functions as well. Here is an example: - -@smallexample -@group -bar (int *array, int offset, int size) -@{ - __label__ failure; - int access (int *array, int index) - @{ - if (index > size) - goto failure; - return array[index + offset]; - @} - int i; - /* @r{@dots{}} */ - for (i = 0; i < size; i++) - /* @r{@dots{}} */ access (array, i) /* @r{@dots{}} */ - /* @r{@dots{}} */ - return 0; - - /* @r{Control comes here from @code{access} - if it detects an error.} */ - failure: - return -1; -@} -@end group -@end smallexample - -A nested function always has no linkage. Declaring one with -@code{extern} or @code{static} is erroneous. If you need to declare the nested function -before its definition, use @code{auto} (which is otherwise meaningless -for function declarations). - -@smallexample -bar (int *array, int offset, int size) -@{ - __label__ failure; - auto int access (int *, int); - /* @r{@dots{}} */ - int access (int *array, int index) - @{ - if (index > size) - goto failure; - return array[index + offset]; - @} - /* @r{@dots{}} */ -@} -@end smallexample - -@node Constructing Calls -@section Constructing Function Calls -@cindex constructing calls -@cindex forwarding calls - -Using the built-in functions described below, you can record -the arguments a function received, and call another function -with the same arguments, without knowing the number or types -of the arguments. - -You can also record the return value of that function call, -and later return that value, without knowing what data type -the function tried to return (as long as your caller expects -that data type). - -However, these built-in functions may interact badly with some -sophisticated features or other extensions of the language. It -is, therefore, not recommended to use them outside very simple -functions acting as mere forwarders for their arguments. - -@deftypefn {Built-in Function} {void *} __builtin_apply_args () -This built-in function returns a pointer to data -describing how to perform a call with the same arguments as are passed -to the current function. - -The function saves the arg pointer register, structure value address, -and all registers that might be used to pass arguments to a function -into a block of memory allocated on the stack. Then it returns the -address of that block. -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin_apply (void (*@var{function})(), void *@var{arguments}, size_t @var{size}) -This built-in function invokes @var{function} -with a copy of the parameters described by @var{arguments} -and @var{size}. - -The value of @var{arguments} should be the value returned by -@code{__builtin_apply_args}. The argument @var{size} specifies the size -of the stack argument data, in bytes. - -This function returns a pointer to data describing -how to return whatever value is returned by @var{function}. The data -is saved in a block of memory allocated on the stack. - -It is not always simple to compute the proper value for @var{size}. The -value is used by @code{__builtin_apply} to compute the amount of data -that should be pushed on the stack and copied from the incoming argument -area. -@end deftypefn - -@deftypefn {Built-in Function} {void} __builtin_return (void *@var{result}) -This built-in function returns the value described by @var{result} from -the containing function. You should specify, for @var{result}, a value -returned by @code{__builtin_apply}. -@end deftypefn - -@deftypefn {Built-in Function} {} __builtin_va_arg_pack () -This built-in function represents all anonymous arguments of an inline -function. It can be used only in inline functions that are always -inlined, never compiled as a separate function, such as those using -@code{__attribute__ ((__always_inline__))} or -@code{__attribute__ ((__gnu_inline__))} extern inline functions. -It must be only passed as last argument to some other function -with variable arguments. This is useful for writing small wrapper -inlines for variable argument functions, when using preprocessor -macros is undesirable. For example: -@smallexample -extern int myprintf (FILE *f, const char *format, ...); -extern inline __attribute__ ((__gnu_inline__)) int -myprintf (FILE *f, const char *format, ...) -@{ - int r = fprintf (f, "myprintf: "); - if (r < 0) - return r; - int s = fprintf (f, format, __builtin_va_arg_pack ()); - if (s < 0) - return s; - return r + s; -@} -@end smallexample -@end deftypefn - -@deftypefn {Built-in Function} {size_t} __builtin_va_arg_pack_len () -This built-in function returns the number of anonymous arguments of -an inline function. It can be used only in inline functions that -are always inlined, never compiled as a separate function, such -as those using @code{__attribute__ ((__always_inline__))} or -@code{__attribute__ ((__gnu_inline__))} extern inline functions. -For example following does link- or run-time checking of open -arguments for optimized code: -@smallexample -#ifdef __OPTIMIZE__ -extern inline __attribute__((__gnu_inline__)) int -myopen (const char *path, int oflag, ...) -@{ - if (__builtin_va_arg_pack_len () > 1) - warn_open_too_many_arguments (); - - if (__builtin_constant_p (oflag)) - @{ - if ((oflag & O_CREAT) != 0 && __builtin_va_arg_pack_len () < 1) - @{ - warn_open_missing_mode (); - return __open_2 (path, oflag); - @} - return open (path, oflag, __builtin_va_arg_pack ()); - @} - - if (__builtin_va_arg_pack_len () < 1) - return __open_2 (path, oflag); - - return open (path, oflag, __builtin_va_arg_pack ()); -@} -#endif -@end smallexample -@end deftypefn - -@node Typeof -@section Referring to a Type with @code{typeof} -@findex typeof -@findex sizeof -@cindex macros, types of arguments - -Another way to refer to the type of an expression is with @code{typeof}. -The syntax of using of this keyword looks like @code{sizeof}, but the -construct acts semantically like a type name defined with @code{typedef}. - -There are two ways of writing the argument to @code{typeof}: with an -expression or with a type. Here is an example with an expression: - -@smallexample -typeof (x[0](1)) -@end smallexample - -@noindent -This assumes that @code{x} is an array of pointers to functions; -the type described is that of the values of the functions. - -Here is an example with a typename as the argument: - -@smallexample -typeof (int *) -@end smallexample - -@noindent -Here the type described is that of pointers to @code{int}. - -If you are writing a header file that must work when included in ISO C -programs, write @code{__typeof__} instead of @code{typeof}. -@xref{Alternate Keywords}. - -A @code{typeof} construct can be used anywhere a typedef name can be -used. For example, you can use it in a declaration, in a cast, or inside -of @code{sizeof} or @code{typeof}. - -The operand of @code{typeof} is evaluated for its side effects if and -only if it is an expression of variably modified type or the name of -such a type. - -@code{typeof} is often useful in conjunction with -statement expressions (@pxref{Statement Exprs}). -Here is how the two together can -be used to define a safe ``maximum'' macro which operates on any -arithmetic type and evaluates each of its arguments exactly once: - -@smallexample -#define max(a,b) \ - (@{ typeof (a) _a = (a); \ - typeof (b) _b = (b); \ - _a > _b ? _a : _b; @}) -@end smallexample - -@cindex underscores in variables in macros -@cindex @samp{_} in variables in macros -@cindex local variables in macros -@cindex variables, local, in macros -@cindex macros, local variables in - -The reason for using names that start with underscores for the local -variables is to avoid conflicts with variable names that occur within the -expressions that are substituted for @code{a} and @code{b}. Eventually we -hope to design a new form of declaration syntax that allows you to declare -variables whose scopes start only after their initializers; this will be a -more reliable way to prevent such conflicts. - -@noindent -Some more examples of the use of @code{typeof}: - -@itemize @bullet -@item -This declares @code{y} with the type of what @code{x} points to. - -@smallexample -typeof (*x) y; -@end smallexample - -@item -This declares @code{y} as an array of such values. - -@smallexample -typeof (*x) y[4]; -@end smallexample - -@item -This declares @code{y} as an array of pointers to characters: - -@smallexample -typeof (typeof (char *)[4]) y; -@end smallexample - -@noindent -It is equivalent to the following traditional C declaration: - -@smallexample -char *y[4]; -@end smallexample - -To see the meaning of the declaration using @code{typeof}, and why it -might be a useful way to write, rewrite it with these macros: - -@smallexample -#define pointer(T) typeof(T *) -#define array(T, N) typeof(T [N]) -@end smallexample - -@noindent -Now the declaration can be rewritten this way: - -@smallexample -array (pointer (char), 4) y; -@end smallexample - -@noindent -Thus, @code{array (pointer (char), 4)} is the type of arrays of 4 -pointers to @code{char}. -@end itemize - -In GNU C, but not GNU C++, you may also declare the type of a variable -as @code{__auto_type}. In that case, the declaration must declare -only one variable, whose declarator must just be an identifier, the -declaration must be initialized, and the type of the variable is -determined by the initializer; the name of the variable is not in -scope until after the initializer. (In C++, you should use C++11 -@code{auto} for this purpose.) Using @code{__auto_type}, the -``maximum'' macro above could be written as: - -@smallexample -#define max(a,b) \ - (@{ __auto_type _a = (a); \ - __auto_type _b = (b); \ - _a > _b ? _a : _b; @}) -@end smallexample - -Using @code{__auto_type} instead of @code{typeof} has two advantages: - -@itemize @bullet -@item Each argument to the macro appears only once in the expansion of -the macro. This prevents the size of the macro expansion growing -exponentially when calls to such macros are nested inside arguments of -such macros. - -@item If the argument to the macro has variably modified type, it is -evaluated only once when using @code{__auto_type}, but twice if -@code{typeof} is used. -@end itemize - -@node Conditionals -@section Conditionals with Omitted Operands -@cindex conditional expressions, extensions -@cindex omitted middle-operands -@cindex middle-operands, omitted -@cindex extensions, @code{?:} -@cindex @code{?:} extensions - -The middle operand in a conditional expression may be omitted. Then -if the first operand is nonzero, its value is the value of the conditional -expression. - -Therefore, the expression - -@smallexample -x ? : y -@end smallexample - -@noindent -has the value of @code{x} if that is nonzero; otherwise, the value of -@code{y}. - -This example is perfectly equivalent to - -@smallexample -x ? x : y -@end smallexample - -@cindex side effect in @code{?:} -@cindex @code{?:} side effect -@noindent -In this simple case, the ability to omit the middle operand is not -especially useful. When it becomes useful is when the first operand does, -or may (if it is a macro argument), contain a side effect. Then repeating -the operand in the middle would perform the side effect twice. Omitting -the middle operand uses the value already computed without the undesirable -effects of recomputing it. - -@node __int128 -@section 128-bit Integers -@cindex @code{__int128} data types - -As an extension the integer scalar type @code{__int128} is supported for -targets which have an integer mode wide enough to hold 128 bits. -Simply write @code{__int128} for a signed 128-bit integer, or -@code{unsigned __int128} for an unsigned 128-bit integer. There is no -support in GCC for expressing an integer constant of type @code{__int128} -for targets with @code{long long} integer less than 128 bits wide. - -@node Long Long -@section Double-Word Integers -@cindex @code{long long} data types -@cindex double-word arithmetic -@cindex multiprecision arithmetic -@cindex @code{LL} integer suffix -@cindex @code{ULL} integer suffix - -ISO C99 supports data types for integers that are at least 64 bits wide, -and as an extension GCC supports them in C90 mode and in C++. -Simply write @code{long long int} for a signed integer, or -@code{unsigned long long int} for an unsigned integer. To make an -integer constant of type @code{long long int}, add the suffix @samp{LL} -to the integer. To make an integer constant of type @code{unsigned long -long int}, add the suffix @samp{ULL} to the integer. - -You can use these types in arithmetic like any other integer types. -Addition, subtraction, and bitwise boolean operations on these types -are open-coded on all types of machines. Multiplication is open-coded -if the machine supports a fullword-to-doubleword widening multiply -instruction. Division and shifts are open-coded only on machines that -provide special support. The operations that are not open-coded use -special library routines that come with GCC@. - -There may be pitfalls when you use @code{long long} types for function -arguments without function prototypes. If a function -expects type @code{int} for its argument, and you pass a value of type -@code{long long int}, confusion results because the caller and the -subroutine disagree about the number of bytes for the argument. -Likewise, if the function expects @code{long long int} and you pass -@code{int}. The best way to avoid such problems is to use prototypes. - -@node Complex -@section Complex Numbers -@cindex complex numbers -@cindex @code{_Complex} keyword -@cindex @code{__complex__} keyword - -ISO C99 supports complex floating data types, and as an extension GCC -supports them in C90 mode and in C++. GCC also supports complex integer data -types which are not part of ISO C99. You can declare complex types -using the keyword @code{_Complex}. As an extension, the older GNU -keyword @code{__complex__} is also supported. - -For example, @samp{_Complex double x;} declares @code{x} as a -variable whose real part and imaginary part are both of type -@code{double}. @samp{_Complex short int y;} declares @code{y} to -have real and imaginary parts of type @code{short int}; this is not -likely to be useful, but it shows that the set of complex types is -complete. - -To write a constant with a complex data type, use the suffix @samp{i} or -@samp{j} (either one; they are equivalent). For example, @code{2.5fi} -has type @code{_Complex float} and @code{3i} has type -@code{_Complex int}. Such a constant always has a pure imaginary -value, but you can form any complex value you like by adding one to a -real constant. This is a GNU extension; if you have an ISO C99 -conforming C library (such as the GNU C Library), and want to construct complex -constants of floating type, you should include @code{} and -use the macros @code{I} or @code{_Complex_I} instead. - -@cindex @code{__real__} keyword -@cindex @code{__imag__} keyword -To extract the real part of a complex-valued expression @var{exp}, write -@code{__real__ @var{exp}}. Likewise, use @code{__imag__} to -extract the imaginary part. This is a GNU extension; for values of -floating type, you should use the ISO C99 functions @code{crealf}, -@code{creal}, @code{creall}, @code{cimagf}, @code{cimag} and -@code{cimagl}, declared in @code{} and also provided as -built-in functions by GCC@. - -@cindex complex conjugation -The operator @samp{~} performs complex conjugation when used on a value -with a complex type. This is a GNU extension; for values of -floating type, you should use the ISO C99 functions @code{conjf}, -@code{conj} and @code{conjl}, declared in @code{} and also -provided as built-in functions by GCC@. - -GCC can allocate complex automatic variables in a noncontiguous -fashion; it's even possible for the real part to be in a register while -the imaginary part is on the stack (or vice versa). Only the DWARF 2 -debug info format can represent this, so use of DWARF 2 is recommended. -If you are using the stabs debug info format, GCC describes a noncontiguous -complex variable as if it were two separate variables of noncomplex type. -If the variable's actual name is @code{foo}, the two fictitious -variables are named @code{foo$real} and @code{foo$imag}. You can -examine and set these two fictitious variables with your debugger. - -@node Floating Types -@section Additional Floating Types -@cindex additional floating types -@cindex @code{__float80} data type -@cindex @code{__float128} data type -@cindex @code{w} floating point suffix -@cindex @code{q} floating point suffix -@cindex @code{W} floating point suffix -@cindex @code{Q} floating point suffix - -As an extension, GNU C supports additional floating -types, @code{__float80} and @code{__float128} to support 80-bit -(@code{XFmode}) and 128-bit (@code{TFmode}) floating types. -Support for additional types includes the arithmetic operators: -add, subtract, multiply, divide; unary arithmetic operators; -relational operators; equality operators; and conversions to and from -integer and other floating types. Use a suffix @samp{w} or @samp{W} -in a literal constant of type @code{__float80} and @samp{q} or @samp{Q} -for @code{_float128}. You can declare complex types using the -corresponding internal complex type, @code{XCmode} for @code{__float80} -type and @code{TCmode} for @code{__float128} type: - -@smallexample -typedef _Complex float __attribute__((mode(TC))) _Complex128; -typedef _Complex float __attribute__((mode(XC))) _Complex80; -@end smallexample - -Not all targets support additional floating-point types. @code{__float80} -and @code{__float128} types are supported on x86 and IA-64 targets. -The @code{__float128} type is supported on hppa HP-UX targets. - -@node Half-Precision -@section Half-Precision Floating Point -@cindex half-precision floating point -@cindex @code{__fp16} data type - -On ARM targets, GCC supports half-precision (16-bit) floating point via -the @code{__fp16} type. You must enable this type explicitly -with the @option{-mfp16-format} command-line option in order to use it. - -ARM supports two incompatible representations for half-precision -floating-point values. You must choose one of the representations and -use it consistently in your program. - -Specifying @option{-mfp16-format=ieee} selects the IEEE 754-2008 format. -This format can represent normalized values in the range of @math{2^{-14}} to 65504. -There are 11 bits of significand precision, approximately 3 -decimal digits. - -Specifying @option{-mfp16-format=alternative} selects the ARM -alternative format. This representation is similar to the IEEE -format, but does not support infinities or NaNs. Instead, the range -of exponents is extended, so that this format can represent normalized -values in the range of @math{2^{-14}} to 131008. - -The @code{__fp16} type is a storage format only. For purposes -of arithmetic and other operations, @code{__fp16} values in C or C++ -expressions are automatically promoted to @code{float}. In addition, -you cannot declare a function with a return value or parameters -of type @code{__fp16}. - -Note that conversions from @code{double} to @code{__fp16} -involve an intermediate conversion to @code{float}. Because -of rounding, this can sometimes produce a different result than a -direct conversion. - -ARM provides hardware support for conversions between -@code{__fp16} and @code{float} values -as an extension to VFP and NEON (Advanced SIMD). GCC generates -code using these hardware instructions if you compile with -options to select an FPU that provides them; -for example, @option{-mfpu=neon-fp16 -mfloat-abi=softfp}, -in addition to the @option{-mfp16-format} option to select -a half-precision format. - -Language-level support for the @code{__fp16} data type is -independent of whether GCC generates code using hardware floating-point -instructions. In cases where hardware support is not specified, GCC -implements conversions between @code{__fp16} and @code{float} values -as library calls. - -@node Decimal Float -@section Decimal Floating Types -@cindex decimal floating types -@cindex @code{_Decimal32} data type -@cindex @code{_Decimal64} data type -@cindex @code{_Decimal128} data type -@cindex @code{df} integer suffix -@cindex @code{dd} integer suffix -@cindex @code{dl} integer suffix -@cindex @code{DF} integer suffix -@cindex @code{DD} integer suffix -@cindex @code{DL} integer suffix - -As an extension, GNU C supports decimal floating types as -defined in the N1312 draft of ISO/IEC WDTR24732. Support for decimal -floating types in GCC will evolve as the draft technical report changes. -Calling conventions for any target might also change. Not all targets -support decimal floating types. - -The decimal floating types are @code{_Decimal32}, @code{_Decimal64}, and -@code{_Decimal128}. They use a radix of ten, unlike the floating types -@code{float}, @code{double}, and @code{long double} whose radix is not -specified by the C standard but is usually two. - -Support for decimal floating types includes the arithmetic operators -add, subtract, multiply, divide; unary arithmetic operators; -relational operators; equality operators; and conversions to and from -integer and other floating types. Use a suffix @samp{df} or -@samp{DF} in a literal constant of type @code{_Decimal32}, @samp{dd} -or @samp{DD} for @code{_Decimal64}, and @samp{dl} or @samp{DL} for -@code{_Decimal128}. - -GCC support of decimal float as specified by the draft technical report -is incomplete: - -@itemize @bullet -@item -When the value of a decimal floating type cannot be represented in the -integer type to which it is being converted, the result is undefined -rather than the result value specified by the draft technical report. - -@item -GCC does not provide the C library functionality associated with -@file{math.h}, @file{fenv.h}, @file{stdio.h}, @file{stdlib.h}, and -@file{wchar.h}, which must come from a separate C library implementation. -Because of this the GNU C compiler does not define macro -@code{__STDC_DEC_FP__} to indicate that the implementation conforms to -the technical report. -@end itemize - -Types @code{_Decimal32}, @code{_Decimal64}, and @code{_Decimal128} -are supported by the DWARF 2 debug information format. - -@node Hex Floats -@section Hex Floats -@cindex hex floats - -ISO C99 supports floating-point numbers written not only in the usual -decimal notation, such as @code{1.55e1}, but also numbers such as -@code{0x1.fp3} written in hexadecimal format. As a GNU extension, GCC -supports this in C90 mode (except in some cases when strictly -conforming) and in C++. In that format the -@samp{0x} hex introducer and the @samp{p} or @samp{P} exponent field are -mandatory. The exponent is a decimal number that indicates the power of -2 by which the significant part is multiplied. Thus @samp{0x1.f} is -@tex -$1 {15\over16}$, -@end tex -@ifnottex -1 15/16, -@end ifnottex -@samp{p3} multiplies it by 8, and the value of @code{0x1.fp3} -is the same as @code{1.55e1}. - -Unlike for floating-point numbers in the decimal notation the exponent -is always required in the hexadecimal notation. Otherwise the compiler -would not be able to resolve the ambiguity of, e.g., @code{0x1.f}. This -could mean @code{1.0f} or @code{1.9375} since @samp{f} is also the -extension for floating-point constants of type @code{float}. - -@node Fixed-Point -@section Fixed-Point Types -@cindex fixed-point types -@cindex @code{_Fract} data type -@cindex @code{_Accum} data type -@cindex @code{_Sat} data type -@cindex @code{hr} fixed-suffix -@cindex @code{r} fixed-suffix -@cindex @code{lr} fixed-suffix -@cindex @code{llr} fixed-suffix -@cindex @code{uhr} fixed-suffix -@cindex @code{ur} fixed-suffix -@cindex @code{ulr} fixed-suffix -@cindex @code{ullr} fixed-suffix -@cindex @code{hk} fixed-suffix -@cindex @code{k} fixed-suffix -@cindex @code{lk} fixed-suffix -@cindex @code{llk} fixed-suffix -@cindex @code{uhk} fixed-suffix -@cindex @code{uk} fixed-suffix -@cindex @code{ulk} fixed-suffix -@cindex @code{ullk} fixed-suffix -@cindex @code{HR} fixed-suffix -@cindex @code{R} fixed-suffix -@cindex @code{LR} fixed-suffix -@cindex @code{LLR} fixed-suffix -@cindex @code{UHR} fixed-suffix -@cindex @code{UR} fixed-suffix -@cindex @code{ULR} fixed-suffix -@cindex @code{ULLR} fixed-suffix -@cindex @code{HK} fixed-suffix -@cindex @code{K} fixed-suffix -@cindex @code{LK} fixed-suffix -@cindex @code{LLK} fixed-suffix -@cindex @code{UHK} fixed-suffix -@cindex @code{UK} fixed-suffix -@cindex @code{ULK} fixed-suffix -@cindex @code{ULLK} fixed-suffix - -As an extension, GNU C supports fixed-point types as -defined in the N1169 draft of ISO/IEC DTR 18037. Support for fixed-point -types in GCC will evolve as the draft technical report changes. -Calling conventions for any target might also change. Not all targets -support fixed-point types. - -The fixed-point types are -@code{short _Fract}, -@code{_Fract}, -@code{long _Fract}, -@code{long long _Fract}, -@code{unsigned short _Fract}, -@code{unsigned _Fract}, -@code{unsigned long _Fract}, -@code{unsigned long long _Fract}, -@code{_Sat short _Fract}, -@code{_Sat _Fract}, -@code{_Sat long _Fract}, -@code{_Sat long long _Fract}, -@code{_Sat unsigned short _Fract}, -@code{_Sat unsigned _Fract}, -@code{_Sat unsigned long _Fract}, -@code{_Sat unsigned long long _Fract}, -@code{short _Accum}, -@code{_Accum}, -@code{long _Accum}, -@code{long long _Accum}, -@code{unsigned short _Accum}, -@code{unsigned _Accum}, -@code{unsigned long _Accum}, -@code{unsigned long long _Accum}, -@code{_Sat short _Accum}, -@code{_Sat _Accum}, -@code{_Sat long _Accum}, -@code{_Sat long long _Accum}, -@code{_Sat unsigned short _Accum}, -@code{_Sat unsigned _Accum}, -@code{_Sat unsigned long _Accum}, -@code{_Sat unsigned long long _Accum}. - -Fixed-point data values contain fractional and optional integral parts. -The format of fixed-point data varies and depends on the target machine. - -Support for fixed-point types includes: -@itemize @bullet -@item -prefix and postfix increment and decrement operators (@code{++}, @code{--}) -@item -unary arithmetic operators (@code{+}, @code{-}, @code{!}) -@item -binary arithmetic operators (@code{+}, @code{-}, @code{*}, @code{/}) -@item -binary shift operators (@code{<<}, @code{>>}) -@item -relational operators (@code{<}, @code{<=}, @code{>=}, @code{>}) -@item -equality operators (@code{==}, @code{!=}) -@item -assignment operators (@code{+=}, @code{-=}, @code{*=}, @code{/=}, -@code{<<=}, @code{>>=}) -@item -conversions to and from integer, floating-point, or fixed-point types -@end itemize - -Use a suffix in a fixed-point literal constant: -@itemize -@item @samp{hr} or @samp{HR} for @code{short _Fract} and -@code{_Sat short _Fract} -@item @samp{r} or @samp{R} for @code{_Fract} and @code{_Sat _Fract} -@item @samp{lr} or @samp{LR} for @code{long _Fract} and -@code{_Sat long _Fract} -@item @samp{llr} or @samp{LLR} for @code{long long _Fract} and -@code{_Sat long long _Fract} -@item @samp{uhr} or @samp{UHR} for @code{unsigned short _Fract} and -@code{_Sat unsigned short _Fract} -@item @samp{ur} or @samp{UR} for @code{unsigned _Fract} and -@code{_Sat unsigned _Fract} -@item @samp{ulr} or @samp{ULR} for @code{unsigned long _Fract} and -@code{_Sat unsigned long _Fract} -@item @samp{ullr} or @samp{ULLR} for @code{unsigned long long _Fract} -and @code{_Sat unsigned long long _Fract} -@item @samp{hk} or @samp{HK} for @code{short _Accum} and -@code{_Sat short _Accum} -@item @samp{k} or @samp{K} for @code{_Accum} and @code{_Sat _Accum} -@item @samp{lk} or @samp{LK} for @code{long _Accum} and -@code{_Sat long _Accum} -@item @samp{llk} or @samp{LLK} for @code{long long _Accum} and -@code{_Sat long long _Accum} -@item @samp{uhk} or @samp{UHK} for @code{unsigned short _Accum} and -@code{_Sat unsigned short _Accum} -@item @samp{uk} or @samp{UK} for @code{unsigned _Accum} and -@code{_Sat unsigned _Accum} -@item @samp{ulk} or @samp{ULK} for @code{unsigned long _Accum} and -@code{_Sat unsigned long _Accum} -@item @samp{ullk} or @samp{ULLK} for @code{unsigned long long _Accum} -and @code{_Sat unsigned long long _Accum} -@end itemize - -GCC support of fixed-point types as specified by the draft technical report -is incomplete: - -@itemize @bullet -@item -Pragmas to control overflow and rounding behaviors are not implemented. -@end itemize - -Fixed-point types are supported by the DWARF 2 debug information format. - -@node Named Address Spaces -@section Named Address Spaces -@cindex Named Address Spaces - -As an extension, GNU C supports named address spaces as -defined in the N1275 draft of ISO/IEC DTR 18037. Support for named -address spaces in GCC will evolve as the draft technical report -changes. Calling conventions for any target might also change. At -present, only the AVR, SPU, M32C, and RL78 targets support address -spaces other than the generic address space. - -Address space identifiers may be used exactly like any other C type -qualifier (e.g., @code{const} or @code{volatile}). See the N1275 -document for more details. - -@anchor{AVR Named Address Spaces} -@subsection AVR Named Address Spaces - -On the AVR target, there are several address spaces that can be used -in order to put read-only data into the flash memory and access that -data by means of the special instructions @code{LPM} or @code{ELPM} -needed to read from flash. - -Per default, any data including read-only data is located in RAM -(the generic address space) so that non-generic address spaces are -needed to locate read-only data in flash memory -@emph{and} to generate the right instructions to access this data -without using (inline) assembler code. - -@table @code -@item __flash -@cindex @code{__flash} AVR Named Address Spaces -The @code{__flash} qualifier locates data in the -@code{.progmem.data} section. Data is read using the @code{LPM} -instruction. Pointers to this address space are 16 bits wide. - -@item __flash1 -@itemx __flash2 -@itemx __flash3 -@itemx __flash4 -@itemx __flash5 -@cindex @code{__flash1} AVR Named Address Spaces -@cindex @code{__flash2} AVR Named Address Spaces -@cindex @code{__flash3} AVR Named Address Spaces -@cindex @code{__flash4} AVR Named Address Spaces -@cindex @code{__flash5} AVR Named Address Spaces -These are 16-bit address spaces locating data in section -@code{.progmem@var{N}.data} where @var{N} refers to -address space @code{__flash@var{N}}. -The compiler sets the @code{RAMPZ} segment register appropriately -before reading data by means of the @code{ELPM} instruction. - -@item __memx -@cindex @code{__memx} AVR Named Address Spaces -This is a 24-bit address space that linearizes flash and RAM: -If the high bit of the address is set, data is read from -RAM using the lower two bytes as RAM address. -If the high bit of the address is clear, data is read from flash -with @code{RAMPZ} set according to the high byte of the address. -@xref{AVR Built-in Functions,,@code{__builtin_avr_flash_segment}}. - -Objects in this address space are located in @code{.progmemx.data}. -@end table - -@b{Example} - -@smallexample -char my_read (const __flash char ** p) -@{ - /* p is a pointer to RAM that points to a pointer to flash. - The first indirection of p reads that flash pointer - from RAM and the second indirection reads a char from this - flash address. */ - - return **p; -@} - -/* Locate array[] in flash memory */ -const __flash int array[] = @{ 3, 5, 7, 11, 13, 17, 19 @}; - -int i = 1; - -int main (void) -@{ - /* Return 17 by reading from flash memory */ - return array[array[i]]; -@} -@end smallexample - -@noindent -For each named address space supported by avr-gcc there is an equally -named but uppercase built-in macro defined. -The purpose is to facilitate testing if respective address space -support is available or not: - -@smallexample -#ifdef __FLASH -const __flash int var = 1; - -int read_var (void) -@{ - return var; -@} -#else -#include /* From AVR-LibC */ - -const int var PROGMEM = 1; - -int read_var (void) -@{ - return (int) pgm_read_word (&var); -@} -#endif /* __FLASH */ -@end smallexample - -@noindent -Notice that attribute @ref{AVR Variable Attributes,,@code{progmem}} -locates data in flash but -accesses to these data read from generic address space, i.e.@: -from RAM, -so that you need special accessors like @code{pgm_read_byte} -from @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC}} -together with attribute @code{progmem}. - -@noindent -@b{Limitations and caveats} - -@itemize -@item -Reading across the 64@tie{}KiB section boundary of -the @code{__flash} or @code{__flash@var{N}} address spaces -shows undefined behavior. The only address space that -supports reading across the 64@tie{}KiB flash segment boundaries is -@code{__memx}. - -@item -If you use one of the @code{__flash@var{N}} address spaces -you must arrange your linker script to locate the -@code{.progmem@var{N}.data} sections according to your needs. - -@item -Any data or pointers to the non-generic address spaces must -be qualified as @code{const}, i.e.@: as read-only data. -This still applies if the data in one of these address -spaces like software version number or calibration lookup table are intended to -be changed after load time by, say, a boot loader. In this case -the right qualification is @code{const} @code{volatile} so that the compiler -must not optimize away known values or insert them -as immediates into operands of instructions. - -@item -The following code initializes a variable @code{pfoo} -located in static storage with a 24-bit address: -@smallexample -extern const __memx char foo; -const __memx void *pfoo = &foo; -@end smallexample - -@noindent -Such code requires at least binutils 2.23, see -@w{@uref{http://sourceware.org/PR13503,PR13503}}. - -@end itemize - -@subsection M32C Named Address Spaces -@cindex @code{__far} M32C Named Address Spaces - -On the M32C target, with the R8C and M16C CPU variants, variables -qualified with @code{__far} are accessed using 32-bit addresses in -order to access memory beyond the first 64@tie{}Ki bytes. If -@code{__far} is used with the M32CM or M32C CPU variants, it has no -effect. - -@subsection RL78 Named Address Spaces -@cindex @code{__far} RL78 Named Address Spaces - -On the RL78 target, variables qualified with @code{__far} are accessed -with 32-bit pointers (20-bit addresses) rather than the default 16-bit -addresses. Non-far variables are assumed to appear in the topmost -64@tie{}KiB of the address space. - -@subsection SPU Named Address Spaces -@cindex @code{__ea} SPU Named Address Spaces - -On the SPU target variables may be declared as -belonging to another address space by qualifying the type with the -@code{__ea} address space identifier: - -@smallexample -extern int __ea i; -@end smallexample - -@noindent -The compiler generates special code to access the variable @code{i}. -It may use runtime library -support, or generate special machine instructions to access that address -space. - -@node Zero Length -@section Arrays of Length Zero -@cindex arrays of length zero -@cindex zero-length arrays -@cindex length-zero arrays -@cindex flexible array members - -Zero-length arrays are allowed in GNU C@. They are very useful as the -last element of a structure that is really a header for a variable-length -object: - -@smallexample -struct line @{ - int length; - char contents[0]; -@}; - -struct line *thisline = (struct line *) - malloc (sizeof (struct line) + this_length); -thisline->length = this_length; -@end smallexample - -In ISO C90, you would have to give @code{contents} a length of 1, which -means either you waste space or complicate the argument to @code{malloc}. - -In ISO C99, you would use a @dfn{flexible array member}, which is -slightly different in syntax and semantics: - -@itemize @bullet -@item -Flexible array members are written as @code{contents[]} without -the @code{0}. - -@item -Flexible array members have incomplete type, and so the @code{sizeof} -operator may not be applied. As a quirk of the original implementation -of zero-length arrays, @code{sizeof} evaluates to zero. - -@item -Flexible array members may only appear as the last member of a -@code{struct} that is otherwise non-empty. - -@item -A structure containing a flexible array member, or a union containing -such a structure (possibly recursively), may not be a member of a -structure or an element of an array. (However, these uses are -permitted by GCC as extensions.) -@end itemize - -Non-empty initialization of zero-length -arrays is treated like any case where there are more initializer -elements than the array holds, in that a suitable warning about ``excess -elements in array'' is given, and the excess elements (all of them, in -this case) are ignored. - -GCC allows static initialization of flexible array members. -This is equivalent to defining a new structure containing the original -structure followed by an array of sufficient size to contain the data. -E.g.@: in the following, @code{f1} is constructed as if it were declared -like @code{f2}. - -@smallexample -struct f1 @{ - int x; int y[]; -@} f1 = @{ 1, @{ 2, 3, 4 @} @}; - -struct f2 @{ - struct f1 f1; int data[3]; -@} f2 = @{ @{ 1 @}, @{ 2, 3, 4 @} @}; -@end smallexample - -@noindent -The convenience of this extension is that @code{f1} has the desired -type, eliminating the need to consistently refer to @code{f2.f1}. - -This has symmetry with normal static arrays, in that an array of -unknown size is also written with @code{[]}. - -Of course, this extension only makes sense if the extra data comes at -the end of a top-level object, as otherwise we would be overwriting -data at subsequent offsets. To avoid undue complication and confusion -with initialization of deeply nested arrays, we simply disallow any -non-empty initialization except when the structure is the top-level -object. For example: - -@smallexample -struct foo @{ int x; int y[]; @}; -struct bar @{ struct foo z; @}; - -struct foo a = @{ 1, @{ 2, 3, 4 @} @}; // @r{Valid.} -struct bar b = @{ @{ 1, @{ 2, 3, 4 @} @} @}; // @r{Invalid.} -struct bar c = @{ @{ 1, @{ @} @} @}; // @r{Valid.} -struct foo d[1] = @{ @{ 1, @{ 2, 3, 4 @} @} @}; // @r{Invalid.} -@end smallexample - -@node Empty Structures -@section Structures with No Members -@cindex empty structures -@cindex zero-size structures - -GCC permits a C structure to have no members: - -@smallexample -struct empty @{ -@}; -@end smallexample - -The structure has size zero. In C++, empty structures are part -of the language. G++ treats empty structures as if they had a single -member of type @code{char}. - -@node Variable Length -@section Arrays of Variable Length -@cindex variable-length arrays -@cindex arrays of variable length -@cindex VLAs - -Variable-length automatic arrays are allowed in ISO C99, and as an -extension GCC accepts them in C90 mode and in C++. These arrays are -declared like any other automatic arrays, but with a length that is not -a constant expression. The storage is allocated at the point of -declaration and deallocated when the block scope containing the declaration -exits. For -example: - -@smallexample -FILE * -concat_fopen (char *s1, char *s2, char *mode) -@{ - char str[strlen (s1) + strlen (s2) + 1]; - strcpy (str, s1); - strcat (str, s2); - return fopen (str, mode); -@} -@end smallexample - -@cindex scope of a variable length array -@cindex variable-length array scope -@cindex deallocating variable length arrays -Jumping or breaking out of the scope of the array name deallocates the -storage. Jumping into the scope is not allowed; you get an error -message for it. - -@cindex variable-length array in a structure -As an extension, GCC accepts variable-length arrays as a member of -a structure or a union. For example: - -@smallexample -void -foo (int n) -@{ - struct S @{ int x[n]; @}; -@} -@end smallexample - -@cindex @code{alloca} vs variable-length arrays -You can use the function @code{alloca} to get an effect much like -variable-length arrays. The function @code{alloca} is available in -many other C implementations (but not in all). On the other hand, -variable-length arrays are more elegant. - -There are other differences between these two methods. Space allocated -with @code{alloca} exists until the containing @emph{function} returns. -The space for a variable-length array is deallocated as soon as the array -name's scope ends. (If you use both variable-length arrays and -@code{alloca} in the same function, deallocation of a variable-length array -also deallocates anything more recently allocated with @code{alloca}.) - -You can also use variable-length arrays as arguments to functions: - -@smallexample -struct entry -tester (int len, char data[len][len]) -@{ - /* @r{@dots{}} */ -@} -@end smallexample - -The length of an array is computed once when the storage is allocated -and is remembered for the scope of the array in case you access it with -@code{sizeof}. - -If you want to pass the array first and the length afterward, you can -use a forward declaration in the parameter list---another GNU extension. - -@smallexample -struct entry -tester (int len; char data[len][len], int len) -@{ - /* @r{@dots{}} */ -@} -@end smallexample - -@cindex parameter forward declaration -The @samp{int len} before the semicolon is a @dfn{parameter forward -declaration}, and it serves the purpose of making the name @code{len} -known when the declaration of @code{data} is parsed. - -You can write any number of such parameter forward declarations in the -parameter list. They can be separated by commas or semicolons, but the -last one must end with a semicolon, which is followed by the ``real'' -parameter declarations. Each forward declaration must match a ``real'' -declaration in parameter name and data type. ISO C99 does not support -parameter forward declarations. - -@node Variadic Macros -@section Macros with a Variable Number of Arguments. -@cindex variable number of arguments -@cindex macro with variable arguments -@cindex rest argument (in macro) -@cindex variadic macros - -In the ISO C standard of 1999, a macro can be declared to accept a -variable number of arguments much as a function can. The syntax for -defining the macro is similar to that of a function. Here is an -example: - -@smallexample -#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__) -@end smallexample - -@noindent -Here @samp{@dots{}} is a @dfn{variable argument}. In the invocation of -such a macro, it represents the zero or more tokens until the closing -parenthesis that ends the invocation, including any commas. This set of -tokens replaces the identifier @code{__VA_ARGS__} in the macro body -wherever it appears. See the CPP manual for more information. - -GCC has long supported variadic macros, and used a different syntax that -allowed you to give a name to the variable arguments just like any other -argument. Here is an example: - -@smallexample -#define debug(format, args...) fprintf (stderr, format, args) -@end smallexample - -@noindent -This is in all ways equivalent to the ISO C example above, but arguably -more readable and descriptive. - -GNU CPP has two further variadic macro extensions, and permits them to -be used with either of the above forms of macro definition. - -In standard C, you are not allowed to leave the variable argument out -entirely; but you are allowed to pass an empty argument. For example, -this invocation is invalid in ISO C, because there is no comma after -the string: - -@smallexample -debug ("A message") -@end smallexample - -GNU CPP permits you to completely omit the variable arguments in this -way. In the above examples, the compiler would complain, though since -the expansion of the macro still has the extra comma after the format -string. - -To help solve this problem, CPP behaves specially for variable arguments -used with the token paste operator, @samp{##}. If instead you write - -@smallexample -#define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__) -@end smallexample - -@noindent -and if the variable arguments are omitted or empty, the @samp{##} -operator causes the preprocessor to remove the comma before it. If you -do provide some variable arguments in your macro invocation, GNU CPP -does not complain about the paste operation and instead places the -variable arguments after the comma. Just like any other pasted macro -argument, these arguments are not macro expanded. - -@node Escaped Newlines -@section Slightly Looser Rules for Escaped Newlines -@cindex escaped newlines -@cindex newlines (escaped) - -The preprocessor treatment of escaped newlines is more relaxed -than that specified by the C90 standard, which requires the newline -to immediately follow a backslash. -GCC's implementation allows whitespace in the form -of spaces, horizontal and vertical tabs, and form feeds between the -backslash and the subsequent newline. The preprocessor issues a -warning, but treats it as a valid escaped newline and combines the two -lines to form a single logical line. This works within comments and -tokens, as well as between tokens. Comments are @emph{not} treated as -whitespace for the purposes of this relaxation, since they have not -yet been replaced with spaces. - -@node Subscripting -@section Non-Lvalue Arrays May Have Subscripts -@cindex subscripting -@cindex arrays, non-lvalue - -@cindex subscripting and function values -In ISO C99, arrays that are not lvalues still decay to pointers, and -may be subscripted, although they may not be modified or used after -the next sequence point and the unary @samp{&} operator may not be -applied to them. As an extension, GNU C allows such arrays to be -subscripted in C90 mode, though otherwise they do not decay to -pointers outside C99 mode. For example, -this is valid in GNU C though not valid in C90: - -@smallexample -@group -struct foo @{int a[4];@}; - -struct foo f(); - -bar (int index) -@{ - return f().a[index]; -@} -@end group -@end smallexample - -@node Pointer Arith -@section Arithmetic on @code{void}- and Function-Pointers -@cindex void pointers, arithmetic -@cindex void, size of pointer to -@cindex function pointers, arithmetic -@cindex function, size of pointer to - -In GNU C, addition and subtraction operations are supported on pointers to -@code{void} and on pointers to functions. This is done by treating the -size of a @code{void} or of a function as 1. - -A consequence of this is that @code{sizeof} is also allowed on @code{void} -and on function types, and returns 1. - -@opindex Wpointer-arith -The option @option{-Wpointer-arith} requests a warning if these extensions -are used. - -@node Pointers to Arrays -@section Pointers to Arrays with Qualifiers Work as Expected -@cindex pointers to arrays -@cindex const qualifier - -In GNU C, pointers to arrays with qualifiers work similar to pointers -to other qualified types. For example, a value of type @code{int (*)[5]} -can be used to initialize a variable of type @code{const int (*)[5]}. -These types are incompatible in ISO C because the @code{const} qualifier -is formally attached to the element type of the array and not the -array itself. - -@smallexample -extern void -transpose (int N, int M, double out[M][N], const double in[N][M]); -double x[3][2]; -double y[2][3]; -@r{@dots{}} -transpose(3, 2, y, x); -@end smallexample - -@node Initializers -@section Non-Constant Initializers -@cindex initializers, non-constant -@cindex non-constant initializers - -As in standard C++ and ISO C99, the elements of an aggregate initializer for an -automatic variable are not required to be constant expressions in GNU C@. -Here is an example of an initializer with run-time varying elements: - -@smallexample -foo (float f, float g) -@{ - float beat_freqs[2] = @{ f-g, f+g @}; - /* @r{@dots{}} */ -@} -@end smallexample - -@node Compound Literals -@section Compound Literals -@cindex constructor expressions -@cindex initializations in expressions -@cindex structures, constructor expression -@cindex expressions, constructor -@cindex compound literals -@c The GNU C name for what C99 calls compound literals was "constructor expressions". - -ISO C99 supports compound literals. A compound literal looks like -a cast containing an initializer. Its value is an object of the -type specified in the cast, containing the elements specified in -the initializer; it is an lvalue. As an extension, GCC supports -compound literals in C90 mode and in C++, though the semantics are -somewhat different in C++. - -Usually, the specified type is a structure. Assume that -@code{struct foo} and @code{structure} are declared as shown: - -@smallexample -struct foo @{int a; char b[2];@} structure; -@end smallexample - -@noindent -Here is an example of constructing a @code{struct foo} with a compound literal: - -@smallexample -structure = ((struct foo) @{x + y, 'a', 0@}); -@end smallexample - -@noindent -This is equivalent to writing the following: - -@smallexample -@{ - struct foo temp = @{x + y, 'a', 0@}; - structure = temp; -@} -@end smallexample - -You can also construct an array, though this is dangerous in C++, as -explained below. If all the elements of the compound literal are -(made up of) simple constant expressions, suitable for use in -initializers of objects of static storage duration, then the compound -literal can be coerced to a pointer to its first element and used in -such an initializer, as shown here: - -@smallexample -char **foo = (char *[]) @{ "x", "y", "z" @}; -@end smallexample - -Compound literals for scalar types and union types are -also allowed, but then the compound literal is equivalent -to a cast. - -As a GNU extension, GCC allows initialization of objects with static storage -duration by compound literals (which is not possible in ISO C99, because -the initializer is not a constant). -It is handled as if the object is initialized only with the bracket -enclosed list if the types of the compound literal and the object match. -The initializer list of the compound literal must be constant. -If the object being initialized has array type of unknown size, the size is -determined by compound literal size. - -@smallexample -static struct foo x = (struct foo) @{1, 'a', 'b'@}; -static int y[] = (int []) @{1, 2, 3@}; -static int z[] = (int [3]) @{1@}; -@end smallexample - -@noindent -The above lines are equivalent to the following: -@smallexample -static struct foo x = @{1, 'a', 'b'@}; -static int y[] = @{1, 2, 3@}; -static int z[] = @{1, 0, 0@}; -@end smallexample - -In C, a compound literal designates an unnamed object with static or -automatic storage duration. In C++, a compound literal designates a -temporary object, which only lives until the end of its -full-expression. As a result, well-defined C code that takes the -address of a subobject of a compound literal can be undefined in C++, -so the C++ compiler rejects the conversion of a temporary array to a pointer. -For instance, if the array compound literal example above appeared -inside a function, any subsequent use of @samp{foo} in C++ has -undefined behavior because the lifetime of the array ends after the -declaration of @samp{foo}. - -As an optimization, the C++ compiler sometimes gives array compound -literals longer lifetimes: when the array either appears outside a -function or has const-qualified type. If @samp{foo} and its -initializer had elements of @samp{char *const} type rather than -@samp{char *}, or if @samp{foo} were a global variable, the array -would have static storage duration. But it is probably safest just to -avoid the use of array compound literals in code compiled as C++. - -@node Designated Inits -@section Designated Initializers -@cindex initializers with labeled elements -@cindex labeled elements in initializers -@cindex case labels in initializers -@cindex designated initializers - -Standard C90 requires the elements of an initializer to appear in a fixed -order, the same as the order of the elements in the array or structure -being initialized. - -In ISO C99 you can give the elements in any order, specifying the array -indices or structure field names they apply to, and GNU C allows this as -an extension in C90 mode as well. This extension is not -implemented in GNU C++. - -To specify an array index, write -@samp{[@var{index}] =} before the element value. For example, - -@smallexample -int a[6] = @{ [4] = 29, [2] = 15 @}; -@end smallexample - -@noindent -is equivalent to - -@smallexample -int a[6] = @{ 0, 0, 15, 0, 29, 0 @}; -@end smallexample - -@noindent -The index values must be constant expressions, even if the array being -initialized is automatic. - -An alternative syntax for this that has been obsolete since GCC 2.5 but -GCC still accepts is to write @samp{[@var{index}]} before the element -value, with no @samp{=}. - -To initialize a range of elements to the same value, write -@samp{[@var{first} ... @var{last}] = @var{value}}. This is a GNU -extension. For example, - -@smallexample -int widths[] = @{ [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 @}; -@end smallexample - -@noindent -If the value in it has side-effects, the side-effects happen only once, -not for each initialized field by the range initializer. - -@noindent -Note that the length of the array is the highest value specified -plus one. - -In a structure initializer, specify the name of a field to initialize -with @samp{.@var{fieldname} =} before the element value. For example, -given the following structure, - -@smallexample -struct point @{ int x, y; @}; -@end smallexample - -@noindent -the following initialization - -@smallexample -struct point p = @{ .y = yvalue, .x = xvalue @}; -@end smallexample - -@noindent -is equivalent to - -@smallexample -struct point p = @{ xvalue, yvalue @}; -@end smallexample - -Another syntax that has the same meaning, obsolete since GCC 2.5, is -@samp{@var{fieldname}:}, as shown here: - -@smallexample -struct point p = @{ y: yvalue, x: xvalue @}; -@end smallexample - -Omitted field members are implicitly initialized the same as objects -that have static storage duration. - -@cindex designators -The @samp{[@var{index}]} or @samp{.@var{fieldname}} is known as a -@dfn{designator}. You can also use a designator (or the obsolete colon -syntax) when initializing a union, to specify which element of the union -should be used. For example, - -@smallexample -union foo @{ int i; double d; @}; - -union foo f = @{ .d = 4 @}; -@end smallexample - -@noindent -converts 4 to a @code{double} to store it in the union using -the second element. By contrast, casting 4 to type @code{union foo} -stores it into the union as the integer @code{i}, since it is -an integer. (@xref{Cast to Union}.) - -You can combine this technique of naming elements with ordinary C -initialization of successive elements. Each initializer element that -does not have a designator applies to the next consecutive element of the -array or structure. For example, - -@smallexample -int a[6] = @{ [1] = v1, v2, [4] = v4 @}; -@end smallexample - -@noindent -is equivalent to - -@smallexample -int a[6] = @{ 0, v1, v2, 0, v4, 0 @}; -@end smallexample - -Labeling the elements of an array initializer is especially useful -when the indices are characters or belong to an @code{enum} type. -For example: - -@smallexample -int whitespace[256] - = @{ [' '] = 1, ['\t'] = 1, ['\h'] = 1, - ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 @}; -@end smallexample - -@cindex designator lists -You can also write a series of @samp{.@var{fieldname}} and -@samp{[@var{index}]} designators before an @samp{=} to specify a -nested subobject to initialize; the list is taken relative to the -subobject corresponding to the closest surrounding brace pair. For -example, with the @samp{struct point} declaration above: - -@smallexample -struct point ptarray[10] = @{ [2].y = yv2, [2].x = xv2, [0].x = xv0 @}; -@end smallexample - -@noindent -If the same field is initialized multiple times, it has the value from -the last initialization. If any such overridden initialization has -side-effect, it is unspecified whether the side-effect happens or not. -Currently, GCC discards them and issues a warning. - -@node Case Ranges -@section Case Ranges -@cindex case ranges -@cindex ranges in case statements - -You can specify a range of consecutive values in a single @code{case} label, -like this: - -@smallexample -case @var{low} ... @var{high}: -@end smallexample - -@noindent -This has the same effect as the proper number of individual @code{case} -labels, one for each integer value from @var{low} to @var{high}, inclusive. - -This feature is especially useful for ranges of ASCII character codes: - -@smallexample -case 'A' ... 'Z': -@end smallexample - -@strong{Be careful:} Write spaces around the @code{...}, for otherwise -it may be parsed wrong when you use it with integer values. For example, -write this: - -@smallexample -case 1 ... 5: -@end smallexample - -@noindent -rather than this: - -@smallexample -case 1...5: -@end smallexample - -@node Cast to Union -@section Cast to a Union Type -@cindex cast to a union -@cindex union, casting to a - -A cast to union type is similar to other casts, except that the type -specified is a union type. You can specify the type either with -@code{union @var{tag}} or with a typedef name. A cast to union is actually -a constructor, not a cast, and hence does not yield an lvalue like -normal casts. (@xref{Compound Literals}.) - -The types that may be cast to the union type are those of the members -of the union. Thus, given the following union and variables: - -@smallexample -union foo @{ int i; double d; @}; -int x; -double y; -@end smallexample - -@noindent -both @code{x} and @code{y} can be cast to type @code{union foo}. - -Using the cast as the right-hand side of an assignment to a variable of -union type is equivalent to storing in a member of the union: - -@smallexample -union foo u; -/* @r{@dots{}} */ -u = (union foo) x @equiv{} u.i = x -u = (union foo) y @equiv{} u.d = y -@end smallexample - -You can also use the union cast as a function argument: - -@smallexample -void hack (union foo); -/* @r{@dots{}} */ -hack ((union foo) x); -@end smallexample - -@node Mixed Declarations -@section Mixed Declarations and Code -@cindex mixed declarations and code -@cindex declarations, mixed with code -@cindex code, mixed with declarations - -ISO C99 and ISO C++ allow declarations and code to be freely mixed -within compound statements. As an extension, GNU C also allows this in -C90 mode. For example, you could do: - -@smallexample -int i; -/* @r{@dots{}} */ -i++; -int j = i + 2; -@end smallexample - -Each identifier is visible from where it is declared until the end of -the enclosing block. - -@node Function Attributes -@section Declaring Attributes of Functions -@cindex function attributes -@cindex declaring attributes of functions -@cindex functions that never return -@cindex functions that return more than once -@cindex functions that have no side effects -@cindex functions in arbitrary sections -@cindex functions that behave like malloc -@cindex @code{volatile} applied to function -@cindex @code{const} applied to function -@cindex functions with @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style arguments -@cindex functions with non-null pointer arguments -@cindex functions that are passed arguments in registers on x86-32 -@cindex functions that pop the argument stack on x86-32 -@cindex functions that do not pop the argument stack on x86-32 -@cindex functions that have different compilation options on x86-32 -@cindex functions that have different optimization options -@cindex functions that are dynamically resolved - -In GNU C, you declare certain things about functions called in your program -which help the compiler optimize function calls and check your code more -carefully. - -The keyword @code{__attribute__} allows you to specify special -attributes when making a declaration. This keyword is followed by an -attribute specification inside double parentheses. The following -attributes are currently defined for functions on all targets: -@code{aligned}, @code{alloc_size}, @code{alloc_align}, @code{assume_aligned}, -@code{noreturn}, @code{returns_twice}, @code{noinline}, @code{noclone}, -@code{no_icf}, -@code{always_inline}, @code{flatten}, @code{pure}, @code{const}, -@code{nothrow}, @code{sentinel}, @code{format}, @code{format_arg}, -@code{no_instrument_function}, @code{no_split_stack}, -@code{section}, @code{constructor}, -@code{destructor}, @code{used}, @code{unused}, @code{deprecated}, -@code{weak}, @code{malloc}, @code{alias}, @code{ifunc}, -@code{warn_unused_result}, @code{nonnull}, -@code{returns_nonnull}, @code{gnu_inline}, -@code{externally_visible}, @code{hot}, @code{cold}, @code{artificial}, -@code{no_sanitize_address}, @code{no_address_safety_analysis}, -@code{no_sanitize_thread}, -@code{no_sanitize_undefined}, @code{no_reorder}, @code{bnd_legacy}, -@code{bnd_instrument}, @code{stack_protect}, -@code{error} and @code{warning}. -Several other attributes are defined for functions on particular -target systems. Other attributes, including @code{section} are -supported for variables declarations (@pxref{Variable Attributes}), -labels (@pxref{Label Attributes}) -and for types (@pxref{Type Attributes}). - -GCC plugins may provide their own attributes. - -You may also specify attributes with @samp{__} preceding and following -each keyword. This allows you to use them in header files without -being concerned about a possible macro of the same name. For example, -you may use @code{__noreturn__} instead of @code{noreturn}. - -@xref{Attribute Syntax}, for details of the exact syntax for using -attributes. - -@table @code -@c Keep this table alphabetized by attribute name. Treat _ as space. - -@item alias ("@var{target}") -@cindex @code{alias} function attribute -The @code{alias} attribute causes the declaration to be emitted as an -alias for another symbol, which must be specified. For instance, - -@smallexample -void __f () @{ /* @r{Do something.} */; @} -void f () __attribute__ ((weak, alias ("__f"))); -@end smallexample - -@noindent -defines @samp{f} to be a weak alias for @samp{__f}. In C++, the -mangled name for the target must be used. It is an error if @samp{__f} -is not defined in the same translation unit. - -Not all target machines support this attribute. - -@item aligned (@var{alignment}) -@cindex @code{aligned} function attribute -This attribute specifies a minimum alignment for the function, -measured in bytes. - -You cannot use this attribute to decrease the alignment of a function, -only to increase it. However, when you explicitly specify a function -alignment this overrides the effect of the -@option{-falign-functions} (@pxref{Optimize Options}) option for this -function. - -Note that the effectiveness of @code{aligned} attributes may be -limited by inherent limitations in your linker. On many systems, the -linker is only able to arrange for functions to be aligned up to a -certain maximum alignment. (For some linkers, the maximum supported -alignment may be very very small.) See your linker documentation for -further information. - -The @code{aligned} attribute can also be used for variables and fields -(@pxref{Variable Attributes}.) - -@item alloc_size -@cindex @code{alloc_size} function attribute -The @code{alloc_size} attribute is used to tell the compiler that the -function return value points to memory, where the size is given by -one or two of the functions parameters. GCC uses this -information to improve the correctness of @code{__builtin_object_size}. - -The function parameter(s) denoting the allocated size are specified by -one or two integer arguments supplied to the attribute. The allocated size -is either the value of the single function argument specified or the product -of the two function arguments specified. Argument numbering starts at -one. - -For instance, - -@smallexample -void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2))) -void* my_realloc(void*, size_t) __attribute__((alloc_size(2))) -@end smallexample - -@noindent -declares that @code{my_calloc} returns memory of the size given by -the product of parameter 1 and 2 and that @code{my_realloc} returns memory -of the size given by parameter 2. - -@item alloc_align -@cindex @code{alloc_align} function attribute -The @code{alloc_align} attribute is used to tell the compiler that the -function return value points to memory, where the returned pointer minimum -alignment is given by one of the functions parameters. GCC uses this -information to improve pointer alignment analysis. - -The function parameter denoting the allocated alignment is specified by -one integer argument, whose number is the argument of the attribute. -Argument numbering starts at one. - -For instance, - -@smallexample -void* my_memalign(size_t, size_t) __attribute__((alloc_align(1))) -@end smallexample - -@noindent -declares that @code{my_memalign} returns memory with minimum alignment -given by parameter 1. - -@item assume_aligned -@cindex @code{assume_aligned} function attribute -The @code{assume_aligned} attribute is used to tell the compiler that the -function return value points to memory, where the returned pointer minimum -alignment is given by the first argument. -If the attribute has two arguments, the second argument is misalignment offset. - -For instance - -@smallexample -void* my_alloc1(size_t) __attribute__((assume_aligned(16))) -void* my_alloc2(size_t) __attribute__((assume_aligned(32, 8))) -@end smallexample - -@noindent -declares that @code{my_alloc1} returns 16-byte aligned pointer and -that @code{my_alloc2} returns a pointer whose value modulo 32 is equal -to 8. - -@item always_inline -@cindex @code{always_inline} function attribute -Generally, functions are not inlined unless optimization is specified. -For functions declared inline, this attribute inlines the function -independent of any restrictions that otherwise apply to inlining. -Failure to inline such a function is diagnosed as an error. -Note that if such a function is called indirectly the compiler may -or may not inline it depending on optimization level and a failure -to inline an indirect call may or may not be diagnosed. - -@item gnu_inline -@cindex @code{gnu_inline} function attribute -This attribute should be used with a function that is also declared -with the @code{inline} keyword. It directs GCC to treat the function -as if it were defined in gnu90 mode even when compiling in C99 or -gnu99 mode. - -If the function is declared @code{extern}, then this definition of the -function is used only for inlining. In no case is the function -compiled as a standalone function, not even if you take its address -explicitly. Such an address becomes an external reference, as if you -had only declared the function, and had not defined it. This has -almost the effect of a macro. The way to use this is to put a -function definition in a header file with this attribute, and put -another copy of the function, without @code{extern}, in a library -file. The definition in the header file causes most calls to the -function to be inlined. If any uses of the function remain, they -refer to the single copy in the library. Note that the two -definitions of the functions need not be precisely the same, although -if they do not have the same effect your program may behave oddly. - -In C, if the function is neither @code{extern} nor @code{static}, then -the function is compiled as a standalone function, as well as being -inlined where possible. - -This is how GCC traditionally handled functions declared -@code{inline}. Since ISO C99 specifies a different semantics for -@code{inline}, this function attribute is provided as a transition -measure and as a useful feature in its own right. This attribute is -available in GCC 4.1.3 and later. It is available if either of the -preprocessor macros @code{__GNUC_GNU_INLINE__} or -@code{__GNUC_STDC_INLINE__} are defined. @xref{Inline,,An Inline -Function is As Fast As a Macro}. - -In C++, this attribute does not depend on @code{extern} in any way, -but it still requires the @code{inline} keyword to enable its special -behavior. - -@item artificial -@cindex @code{artificial} function attribute -This attribute is useful for small inline wrappers that if possible -should appear during debugging as a unit. Depending on the debug -info format it either means marking the function as artificial -or using the caller location for all instructions within the inlined -body. - -@item bank_switch -@cindex @code{bank_switch} function attribute, M32C -When added to an interrupt handler with the M32C port, causes the -prologue and epilogue to use bank switching to preserve the registers -rather than saving them on the stack. - -@item flatten -@cindex @code{flatten} function attribute -Generally, inlining into a function is limited. For a function marked with -this attribute, every call inside this function is inlined, if possible. -Whether the function itself is considered for inlining depends on its size and -the current inlining parameters. - -@item error ("@var{message}") -@cindex @code{error} function attribute -If this attribute is used on a function declaration and a call to such a function -is not eliminated through dead code elimination or other optimizations, an error -that includes @var{message} is diagnosed. This is useful -for compile-time checking, especially together with @code{__builtin_constant_p} -and inline functions where checking the inline function arguments is not -possible through @code{extern char [(condition) ? 1 : -1];} tricks. -While it is possible to leave the function undefined and thus invoke -a link failure, when using this attribute the problem is diagnosed -earlier and with exact location of the call even in presence of inline -functions or when not emitting debugging information. - -@item warning ("@var{message}") -@cindex @code{warning} function attribute -If this attribute is used on a function declaration and a call to such a function -is not eliminated through dead code elimination or other optimizations, a warning -that includes @var{message} is diagnosed. This is useful -for compile-time checking, especially together with @code{__builtin_constant_p} -and inline functions. While it is possible to define the function with -a message in @code{.gnu.warning*} section, when using this attribute the problem -is diagnosed earlier and with exact location of the call even in presence -of inline functions or when not emitting debugging information. - -@item cdecl -@cindex @code{cdecl} function attribute, x86-32 -@cindex functions that do pop the argument stack on x86-32 -@opindex mrtd -On the x86-32 targets, the @code{cdecl} attribute causes the compiler to -assume that the calling function pops off the stack space used to -pass arguments. This is -useful to override the effects of the @option{-mrtd} switch. - -@item const -@cindex @code{const} function attribute -Many functions do not examine any values except their arguments, and -have no effects except the return value. Basically this is just slightly -more strict class than the @code{pure} attribute below, since function is not -allowed to read global memory. - -@cindex pointer arguments -Note that a function that has pointer arguments and examines the data -pointed to must @emph{not} be declared @code{const}. Likewise, a -function that calls a non-@code{const} function usually must not be -@code{const}. It does not make sense for a @code{const} function to -return @code{void}. - -@item constructor -@itemx destructor -@itemx constructor (@var{priority}) -@itemx destructor (@var{priority}) -@cindex @code{constructor} function attribute -@cindex @code{destructor} function attribute -The @code{constructor} attribute causes the function to be called -automatically before execution enters @code{main ()}. Similarly, the -@code{destructor} attribute causes the function to be called -automatically after @code{main ()} completes or @code{exit ()} is -called. Functions with these attributes are useful for -initializing data that is used implicitly during the execution of -the program. - -You may provide an optional integer priority to control the order in -which constructor and destructor functions are run. A constructor -with a smaller priority number runs before a constructor with a larger -priority number; the opposite relationship holds for destructors. So, -if you have a constructor that allocates a resource and a destructor -that deallocates the same resource, both functions typically have the -same priority. The priorities for constructor and destructor -functions are the same as those specified for namespace-scope C++ -objects (@pxref{C++ Attributes}). - -These attributes are not currently implemented for Objective-C@. - -@item deprecated -@itemx deprecated (@var{msg}) -@cindex @code{deprecated} function attribute -The @code{deprecated} attribute results in a warning if the function -is used anywhere in the source file. This is useful when identifying -functions that are expected to be removed in a future version of a -program. The warning also includes the location of the declaration -of the deprecated function, to enable users to easily find further -information about why the function is deprecated, or what they should -do instead. Note that the warnings only occurs for uses: - -@smallexample -int old_fn () __attribute__ ((deprecated)); -int old_fn (); -int (*fn_ptr)() = old_fn; -@end smallexample - -@noindent -results in a warning on line 3 but not line 2. The optional @var{msg} -argument, which must be a string, is printed in the warning if -present. - -The @code{deprecated} attribute can also be used for variables and -types (@pxref{Variable Attributes}, @pxref{Type Attributes}.) - -@item disinterrupt -@cindex @code{disinterrupt} function attribute, Epiphany -@cindex @code{disinterrupt} function attribute, MeP -On Epiphany and MeP targets, this attribute causes the compiler to emit -instructions to disable interrupts for the duration of the given -function. - -@item dllexport -@cindex @code{dllexport} function attribute -@cindex @code{__declspec(dllexport)} -On Microsoft Windows targets and Symbian OS targets the -@code{dllexport} attribute causes the compiler to provide a global -pointer to a pointer in a DLL, so that it can be referenced with the -@code{dllimport} attribute. On Microsoft Windows targets, the pointer -name is formed by combining @code{_imp__} and the function or variable -name. - -You can use @code{__declspec(dllexport)} as a synonym for -@code{__attribute__ ((dllexport))} for compatibility with other -compilers. - -On systems that support the @code{visibility} attribute, this -attribute also implies ``default'' visibility. It is an error to -explicitly specify any other visibility. - -GCC's default behavior is to emit all inline functions with the -@code{dllexport} attribute. Since this can cause object file-size bloat, -you can use @option{-fno-keep-inline-dllexport}, which tells GCC to -ignore the attribute for inlined functions unless the -@option{-fkeep-inline-functions} flag is used instead. - -The attribute is ignored for undefined symbols. - -When applied to C++ classes, the attribute marks defined non-inlined -member functions and static data members as exports. Static consts -initialized in-class are not marked unless they are also defined -out-of-class. - -For Microsoft Windows targets there are alternative methods for -including the symbol in the DLL's export table such as using a -@file{.def} file with an @code{EXPORTS} section or, with GNU ld, using -the @option{--export-all} linker flag. - -@item dllimport -@cindex @code{dllimport} function attribute -@cindex @code{__declspec(dllimport)} -On Microsoft Windows and Symbian OS targets, the @code{dllimport} -attribute causes the compiler to reference a function or variable via -a global pointer to a pointer that is set up by the DLL exporting the -symbol. The attribute implies @code{extern}. On Microsoft Windows -targets, the pointer name is formed by combining @code{_imp__} and the -function or variable name. - -You can use @code{__declspec(dllimport)} as a synonym for -@code{__attribute__ ((dllimport))} for compatibility with other -compilers. - -On systems that support the @code{visibility} attribute, this -attribute also implies ``default'' visibility. It is an error to -explicitly specify any other visibility. - -Currently, the attribute is ignored for inlined functions. If the -attribute is applied to a symbol @emph{definition}, an error is reported. -If a symbol previously declared @code{dllimport} is later defined, the -attribute is ignored in subsequent references, and a warning is emitted. -The attribute is also overridden by a subsequent declaration as -@code{dllexport}. - -When applied to C++ classes, the attribute marks non-inlined -member functions and static data members as imports. However, the -attribute is ignored for virtual methods to allow creation of vtables -using thunks. - -On the SH Symbian OS target the @code{dllimport} attribute also has -another affect---it can cause the vtable and run-time type information -for a class to be exported. This happens when the class has a -dllimported constructor or a non-inline, non-pure virtual function -and, for either of those two conditions, the class also has an inline -constructor or destructor and has a key function that is defined in -the current translation unit. - -For Microsoft Windows targets the use of the @code{dllimport} -attribute on functions is not necessary, but provides a small -performance benefit by eliminating a thunk in the DLL@. The use of the -@code{dllimport} attribute on imported variables can be avoided by passing the -@option{--enable-auto-import} switch to the GNU linker. As with -functions, using the attribute for a variable eliminates a thunk in -the DLL@. - -One drawback to using this attribute is that a pointer to a -@emph{variable} marked as @code{dllimport} cannot be used as a constant -address. However, a pointer to a @emph{function} with the -@code{dllimport} attribute can be used as a constant initializer; in -this case, the address of a stub function in the import lib is -referenced. On Microsoft Windows targets, the attribute can be disabled -for functions by setting the @option{-mnop-fun-dllimport} flag. - -@item exception -@cindex @code{exception} function attribute -@cindex exception handler functions, NDS32 -Use this attribute on the NDS32 target to indicate that the specified function -is an exception handler. The compiler will generate corresponding sections -for use in an exception handler. - -@item exception_handler -@cindex @code{exception_handler} function attribute -@cindex exception handler functions, Blackfin -Use this attribute on the Blackfin to indicate that the specified function -is an exception handler. The compiler generates function entry and -exit sequences suitable for use in an exception handler when this -attribute is present. - -@item externally_visible -@cindex @code{externally_visible} function attribute -This attribute, attached to a global variable or function, nullifies -the effect of the @option{-fwhole-program} command-line option, so the -object remains visible outside the current compilation unit. - -If @option{-fwhole-program} is used together with @option{-flto} and -@command{gold} is used as the linker plugin, -@code{externally_visible} attributes are automatically added to functions -(not variable yet due to a current @command{gold} issue) -that are accessed outside of LTO objects according to resolution file -produced by @command{gold}. -For other linkers that cannot generate resolution file, -explicit @code{externally_visible} attributes are still necessary. - -@item far -@cindex @code{far} function attribute - -On MeP targets this causes the compiler to use a calling convention -that assumes the called function is too far away for the built-in -addressing modes. - -@item fast_interrupt -@cindex @code{fast_interrupt} function attribute, M32C -@cindex @code{fast_interrupt} function attribute, RX -Use this attribute on the M32C and RX ports to indicate that the specified -function is a fast interrupt handler. This is just like the -@code{interrupt} attribute, except that @code{freit} is used to return -instead of @code{reit}. - -@item fastcall -@cindex @code{fastcall} function attribute, x86-32 -@cindex functions that pop the argument stack on x86-32 -On x86-32 targets, the @code{fastcall} attribute causes the compiler to -pass the first argument (if of integral type) in the register ECX and -the second argument (if of integral type) in the register EDX@. Subsequent -and other typed arguments are passed on the stack. The called function -pops the arguments off the stack. If the number of arguments is variable all -arguments are pushed on the stack. - -@item thiscall -@cindex @code{thiscall} function attribute, x86-32 -@cindex functions that pop the argument stack on x86-32 -On x86-32 targets, the @code{thiscall} attribute causes the compiler to -pass the first argument (if of integral type) in the register ECX. -Subsequent and other typed arguments are passed on the stack. The called -function pops the arguments off the stack. -If the number of arguments is variable all arguments are pushed on the -stack. -The @code{thiscall} attribute is intended for C++ non-static member functions. -As a GCC extension, this calling convention can be used for C functions -and for static member methods. - -@item format (@var{archetype}, @var{string-index}, @var{first-to-check}) -@cindex @code{format} function attribute -@opindex Wformat -The @code{format} attribute specifies that a function takes @code{printf}, -@code{scanf}, @code{strftime} or @code{strfmon} style arguments that -should be type-checked against a format string. For example, the -declaration: - -@smallexample -extern int -my_printf (void *my_object, const char *my_format, ...) - __attribute__ ((format (printf, 2, 3))); -@end smallexample - -@noindent -causes the compiler to check the arguments in calls to @code{my_printf} -for consistency with the @code{printf} style format string argument -@code{my_format}. - -The parameter @var{archetype} determines how the format string is -interpreted, and should be @code{printf}, @code{scanf}, @code{strftime}, -@code{gnu_printf}, @code{gnu_scanf}, @code{gnu_strftime} or -@code{strfmon}. (You can also use @code{__printf__}, -@code{__scanf__}, @code{__strftime__} or @code{__strfmon__}.) On -MinGW targets, @code{ms_printf}, @code{ms_scanf}, and -@code{ms_strftime} are also present. -@var{archetype} values such as @code{printf} refer to the formats accepted -by the system's C runtime library, -while values prefixed with @samp{gnu_} always refer -to the formats accepted by the GNU C Library. On Microsoft Windows -targets, values prefixed with @samp{ms_} refer to the formats accepted by the -@file{msvcrt.dll} library. -The parameter @var{string-index} -specifies which argument is the format string argument (starting -from 1), while @var{first-to-check} is the number of the first -argument to check against the format string. For functions -where the arguments are not available to be checked (such as -@code{vprintf}), specify the third parameter as zero. In this case the -compiler only checks the format string for consistency. For -@code{strftime} formats, the third parameter is required to be zero. -Since non-static C++ methods have an implicit @code{this} argument, the -arguments of such methods should be counted from two, not one, when -giving values for @var{string-index} and @var{first-to-check}. - -In the example above, the format string (@code{my_format}) is the second -argument of the function @code{my_print}, and the arguments to check -start with the third argument, so the correct parameters for the format -attribute are 2 and 3. - -@opindex ffreestanding -@opindex fno-builtin -The @code{format} attribute allows you to identify your own functions -that take format strings as arguments, so that GCC can check the -calls to these functions for errors. The compiler always (unless -@option{-ffreestanding} or @option{-fno-builtin} is used) checks formats -for the standard library functions @code{printf}, @code{fprintf}, -@code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf}, @code{strftime}, -@code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such -warnings are requested (using @option{-Wformat}), so there is no need to -modify the header file @file{stdio.h}. In C99 mode, the functions -@code{snprintf}, @code{vsnprintf}, @code{vscanf}, @code{vfscanf} and -@code{vsscanf} are also checked. Except in strictly conforming C -standard modes, the X/Open function @code{strfmon} is also checked as -are @code{printf_unlocked} and @code{fprintf_unlocked}. -@xref{C Dialect Options,,Options Controlling C Dialect}. - -For Objective-C dialects, @code{NSString} (or @code{__NSString__}) is -recognized in the same context. Declarations including these format attributes -are parsed for correct syntax, however the result of checking of such format -strings is not yet defined, and is not carried out by this version of the -compiler. - -The target may also provide additional types of format checks. -@xref{Target Format Checks,,Format Checks Specific to Particular -Target Machines}. - -@item format_arg (@var{string-index}) -@cindex @code{format_arg} function attribute -@opindex Wformat-nonliteral -The @code{format_arg} attribute specifies that a function takes a format -string for a @code{printf}, @code{scanf}, @code{strftime} or -@code{strfmon} style function and modifies it (for example, to translate -it into another language), so the result can be passed to a -@code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style -function (with the remaining arguments to the format function the same -as they would have been for the unmodified string). For example, the -declaration: - -@smallexample -extern char * -my_dgettext (char *my_domain, const char *my_format) - __attribute__ ((format_arg (2))); -@end smallexample - -@noindent -causes the compiler to check the arguments in calls to a @code{printf}, -@code{scanf}, @code{strftime} or @code{strfmon} type function, whose -format string argument is a call to the @code{my_dgettext} function, for -consistency with the format string argument @code{my_format}. If the -@code{format_arg} attribute had not been specified, all the compiler -could tell in such calls to format functions would be that the format -string argument is not constant; this would generate a warning when -@option{-Wformat-nonliteral} is used, but the calls could not be checked -without the attribute. - -The parameter @var{string-index} specifies which argument is the format -string argument (starting from one). Since non-static C++ methods have -an implicit @code{this} argument, the arguments of such methods should -be counted from two. - -The @code{format_arg} attribute allows you to identify your own -functions that modify format strings, so that GCC can check the -calls to @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} -type function whose operands are a call to one of your own function. -The compiler always treats @code{gettext}, @code{dgettext}, and -@code{dcgettext} in this manner except when strict ISO C support is -requested by @option{-ansi} or an appropriate @option{-std} option, or -@option{-ffreestanding} or @option{-fno-builtin} -is used. @xref{C Dialect Options,,Options -Controlling C Dialect}. - -For Objective-C dialects, the @code{format-arg} attribute may refer to an -@code{NSString} reference for compatibility with the @code{format} attribute -above. - -The target may also allow additional types in @code{format-arg} attributes. -@xref{Target Format Checks,,Format Checks Specific to Particular -Target Machines}. - -@item function_vector -@cindex @code{function_vector} function attribute, H8/300 -@cindex @code{function_vector} function attribute, M16C/M32C -@cindex @code{function_vector} function attribute, SH -@cindex calling functions through the function vector on H8/300, M16C, M32C and SH2A processors -Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified -function should be called through the function vector. Calling a -function through the function vector reduces code size, however; -the function vector has a limited size (maximum 128 entries on the H8/300 -and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector. - -On SH2A targets, this attribute declares a function to be called using the -TBR relative addressing mode. The argument to this attribute is the entry -number of the same function in a vector table containing all the TBR -relative addressable functions. For correct operation the TBR must be setup -accordingly to point to the start of the vector table before any functions with -this attribute are invoked. Usually a good place to do the initialization is -the startup routine. The TBR relative vector table can have at max 256 function -entries. The jumps to these functions are generated using a SH2A specific, -non delayed branch instruction JSR/N @@(disp8,TBR). You must use GAS and GLD -from GNU binutils version 2.7 or later for this attribute to work correctly. - -Please refer the example of M16C target, to see the use of this -attribute while declaring a function, - -In an application, for a function being called once, this attribute -saves at least 8 bytes of code; and if other successive calls are being -made to the same function, it saves 2 bytes of code per each of these -calls. - -On M16C/M32C targets, the @code{function_vector} attribute declares a -special page subroutine call function. Use of this attribute reduces -the code size by 2 bytes for each call generated to the -subroutine. The argument to the attribute is the vector number entry -from the special page vector table which contains the 16 low-order -bits of the subroutine's entry address. Each vector table has special -page number (18 to 255) that is used in @code{jsrs} instructions. -Jump addresses of the routines are generated by adding 0x0F0000 (in -case of M16C targets) or 0xFF0000 (in case of M32C targets), to the -2-byte addresses set in the vector table. Therefore you need to ensure -that all the special page vector routines should get mapped within the -address range 0x0F0000 to 0x0FFFFF (for M16C) and 0xFF0000 to 0xFFFFFF -(for M32C). - -In the following example 2 bytes are saved for each call to -function @code{foo}. - -@smallexample -void foo (void) __attribute__((function_vector(0x18))); -void foo (void) -@{ -@} - -void bar (void) -@{ - foo(); -@} -@end smallexample - -If functions are defined in one file and are called in another file, -then be sure to write this declaration in both files. - -This attribute is ignored for R8C target. - -@item ifunc ("@var{resolver}") -@cindex @code{ifunc} function attribute -The @code{ifunc} attribute is used to mark a function as an indirect -function using the STT_GNU_IFUNC symbol type extension to the ELF -standard. This allows the resolution of the symbol value to be -determined dynamically at load time, and an optimized version of the -routine can be selected for the particular processor or other system -characteristics determined then. To use this attribute, first define -the implementation functions available, and a resolver function that -returns a pointer to the selected implementation function. The -implementation functions' declarations must match the API of the -function being implemented, the resolver's declaration is be a -function returning pointer to void function returning void: - -@smallexample -void *my_memcpy (void *dst, const void *src, size_t len) -@{ - @dots{} -@} - -static void (*resolve_memcpy (void)) (void) -@{ - return my_memcpy; // we'll just always select this routine -@} -@end smallexample - -@noindent -The exported header file declaring the function the user calls would -contain: - -@smallexample -extern void *memcpy (void *, const void *, size_t); -@end smallexample - -@noindent -allowing the user to call this as a regular function, unaware of the -implementation. Finally, the indirect function needs to be defined in -the same translation unit as the resolver function: - -@smallexample -void *memcpy (void *, const void *, size_t) - __attribute__ ((ifunc ("resolve_memcpy"))); -@end smallexample - -Indirect functions cannot be weak. Binutils version 2.20.1 or higher -and GNU C Library version 2.11.1 are required to use this feature. - -@item interrupt -@cindex @code{interrupt} function attribute, ARC -@cindex @code{interrupt} function attribute, ARM -@cindex @code{interrupt} function attribute, AVR -@cindex @code{interrupt} function attribute, CR16 -@cindex @code{interrupt} function attribute, Epiphany -@cindex @code{interrupt} function attribute, M32C -@cindex @code{interrupt} function attribute, M32R/D -@cindex @code{interrupt} function attribute, m68k -@cindex @code{interrupt} function attribute, MeP -@cindex @code{interrupt} function attribute, MIPS -@cindex @code{interrupt} function attribute, MSP430 -@cindex @code{interrupt} function attribute, NDS32 -@cindex @code{interrupt} function attribute, RL78 -@cindex @code{interrupt} function attribute, RX -@cindex @code{interrupt} function attribute, Visium -@cindex @code{interrupt} function attribute, Xstormy16 -Use this attribute on the ARC, ARM, AVR, CR16, Epiphany, M32C, M32R/D, -m68k, MeP, MIPS, MSP430, NDS32, RL78, RX, Visium and Xstormy16 ports to indicate -that the specified function is an interrupt handler. The compiler generates -function entry and exit sequences suitable for use in an interrupt handler -when this attribute is present. With Epiphany targets it may also generate -a special section with code to initialize the interrupt vector table. - -Note, interrupt handlers for the Blackfin, H8/300, H8/300H, H8S, MicroBlaze, -and SH processors can be specified via the @code{interrupt_handler} attribute. - -Note, on the ARC, you must specify the kind of interrupt to be handled -in a parameter to the interrupt attribute like this: - -@smallexample -void f () __attribute__ ((interrupt ("ilink1"))); -@end smallexample - -Permissible values for this parameter are: @w{@code{ilink1}} and -@w{@code{ilink2}}. - -Note, on the AVR, the hardware globally disables interrupts when an -interrupt is executed. The first instruction of an interrupt handler -declared with this attribute is a @code{SEI} instruction to -re-enable interrupts. See also the @code{signal} function attribute -that does not insert a @code{SEI} instruction. If both @code{signal} and -@code{interrupt} are specified for the same function, @code{signal} -is silently ignored. - -Note, for the ARM, you can specify the kind of interrupt to be handled by -adding an optional parameter to the interrupt attribute like this: - -@smallexample -void f () __attribute__ ((interrupt ("IRQ"))); -@end smallexample - -@noindent -Permissible values for this parameter are: @code{IRQ}, @code{FIQ}, -@code{SWI}, @code{ABORT} and @code{UNDEF}. - -On ARMv7-M the interrupt type is ignored, and the attribute means the function -may be called with a word-aligned stack pointer. - -Note, for the MSP430 you can provide an argument to the interrupt -attribute which specifies a name or number. If the argument is a -number it indicates the slot in the interrupt vector table (0 - 31) to -which this handler should be assigned. If the argument is a name it -is treated as a symbolic name for the vector slot. These names should -match up with appropriate entries in the linker script. By default -the names @code{watchdog} for vector 26, @code{nmi} for vector 30 and -@code{reset} for vector 31 are recognized. - -You can also use the following function attributes to modify how -normal functions interact with interrupt functions: - -@table @code -@item critical -@cindex @code{critical} function attribute, MSP430 -Critical functions disable interrupts upon entry and restore the -previous interrupt state upon exit. Critical functions cannot also -have the @code{naked} or @code{reentrant} attributes. They can have -the @code{interrupt} attribute. - -@item reentrant -@cindex @code{reentrant} function attribute, MSP430 -Reentrant functions disable interrupts upon entry and enable them -upon exit. Reentrant functions cannot also have the @code{naked} -or @code{critical} attributes. They can have the @code{interrupt} -attribute. - -@item wakeup -@cindex @code{wakeup} function attribute, MSP430 -This attribute only applies to interrupt functions. It is silently -ignored if applied to a non-interrupt function. A wakeup interrupt -function will rouse the processor from any low-power state that it -might be in when the function exits. - -@end table - -On Epiphany targets one or more optional parameters can be added like this: - -@smallexample -void __attribute__ ((interrupt ("dma0, dma1"))) universal_dma_handler (); -@end smallexample - -Permissible values for these parameters are: @w{@code{reset}}, -@w{@code{software_exception}}, @w{@code{page_miss}}, -@w{@code{timer0}}, @w{@code{timer1}}, @w{@code{message}}, -@w{@code{dma0}}, @w{@code{dma1}}, @w{@code{wand}} and @w{@code{swi}}. -Multiple parameters indicate that multiple entries in the interrupt -vector table should be initialized for this function, i.e.@: for each -parameter @w{@var{name}}, a jump to the function is emitted in -the section @w{ivt_entry_@var{name}}. The parameter(s) may be omitted -entirely, in which case no interrupt vector table entry is provided. - -Note, on Epiphany targets, interrupts are enabled inside the function -unless the @code{disinterrupt} attribute is also specified. - -On Epiphany targets, you can also use the following attribute to -modify the behavior of an interrupt handler: -@table @code -@item forwarder_section -@cindex @code{forwarder_section} function attribute, Epiphany -The interrupt handler may be in external memory which cannot be -reached by a branch instruction, so generate a local memory trampoline -to transfer control. The single parameter identifies the section where -the trampoline is placed. -@end table - -The following examples are all valid uses of these attributes on -Epiphany targets: -@smallexample -void __attribute__ ((interrupt)) universal_handler (); -void __attribute__ ((interrupt ("dma1"))) dma1_handler (); -void __attribute__ ((interrupt ("dma0, dma1"))) universal_dma_handler (); -void __attribute__ ((interrupt ("timer0"), disinterrupt)) - fast_timer_handler (); -void __attribute__ ((interrupt ("dma0, dma1"), forwarder_section ("tramp"))) - external_dma_handler (); -@end smallexample - -On MIPS targets, you can use the following attributes to modify the behavior -of an interrupt handler: -@table @code -@item use_shadow_register_set -@cindex @code{use_shadow_register_set} function attribute, MIPS -Assume that the handler uses a shadow register set, instead of -the main general-purpose registers. - -@item keep_interrupts_masked -@cindex @code{keep_interrupts_masked} function attribute, MIPS -Keep interrupts masked for the whole function. Without this attribute, -GCC tries to reenable interrupts for as much of the function as it can. - -@item use_debug_exception_return -@cindex @code{use_debug_exception_return} function attribute, MIPS -Return using the @code{deret} instruction. Interrupt handlers that don't -have this attribute return using @code{eret} instead. -@end table - -You can use any combination of these attributes, as shown below: -@smallexample -void __attribute__ ((interrupt)) v0 (); -void __attribute__ ((interrupt, use_shadow_register_set)) v1 (); -void __attribute__ ((interrupt, keep_interrupts_masked)) v2 (); -void __attribute__ ((interrupt, use_debug_exception_return)) v3 (); -void __attribute__ ((interrupt, use_shadow_register_set, - keep_interrupts_masked)) v4 (); -void __attribute__ ((interrupt, use_shadow_register_set, - use_debug_exception_return)) v5 (); -void __attribute__ ((interrupt, keep_interrupts_masked, - use_debug_exception_return)) v6 (); -void __attribute__ ((interrupt, use_shadow_register_set, - keep_interrupts_masked, - use_debug_exception_return)) v7 (); -@end smallexample - -On NDS32 target, this attribute indicates that the specified function -is an interrupt handler. The compiler generates corresponding sections -for use in an interrupt handler. You can use the following attributes -to modify the behavior: -@table @code -@item nested -@cindex @code{nested} function attribute, NDS32 -This interrupt service routine is interruptible. -@item not_nested -@cindex @code{not_nested} function attribute, NDS32 -This interrupt service routine is not interruptible. -@item nested_ready -@cindex @code{nested_ready} function attribute, NDS32 -This interrupt service routine is interruptible after @code{PSW.GIE} -(global interrupt enable) is set. This allows interrupt service routine to -finish some short critical code before enabling interrupts. -@item save_all -@cindex @code{save_all} function attribute, NDS32 -The system will help save all registers into stack before entering -interrupt handler. -@item partial_save -@cindex @code{partial_save} function attribute, NDS32 -The system will help save caller registers into stack before entering -interrupt handler. -@end table - -@cindex @code{brk_interrupt} function attribute, RL78 -On RL78, use @code{brk_interrupt} instead of @code{interrupt} for -handlers intended to be used with the @code{BRK} opcode (i.e.@: those -that must end with @code{RETB} instead of @code{RETI}). - -On RX targets, you may specify one or more vector numbers as arguments -to the attribute, as well as naming an alternate table name. -Parameters are handled sequentially, so one handler can be assigned to -multiple entries in multiple tables. One may also pass the magic -string @code{"$default"} which causes the function to be used for any -unfilled slots in the current table. - -This example shows a simple assignment of a function to one vector in -the default table (note that preprocessor macros may be used for -chip-specific symbolic vector names): -@smallexample -void __attribute__ ((interrupt (5))) txd1_handler (); -@end smallexample - -This example assigns a function to two slots in the default table -(using preprocessor macros defined elsewhere) and makes it the default -for the @code{dct} table: -@smallexample -void __attribute__ ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default"))) - txd1_handler (); -@end smallexample - -@item interrupt_handler -@cindex @code{interrupt_handler} function attribute, Blackfin -@cindex @code{interrupt_handler} function attribute, m68k -@cindex @code{interrupt_handler} function attribute, H8/300 -@cindex @code{interrupt_handler} function attribute, SH -Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to -indicate that the specified function is an interrupt handler. The compiler -generates function entry and exit sequences suitable for use in an -interrupt handler when this attribute is present. - -@item interrupt_thread -@cindex @code{interrupt_thread} function attribute, fido -Use this attribute on fido, a subarchitecture of the m68k, to indicate -that the specified function is an interrupt handler that is designed -to run as a thread. The compiler omits generate prologue/epilogue -sequences and replaces the return instruction with a @code{sleep} -instruction. This attribute is available only on fido. - -@item isr -@cindex @code{isr} function attribute, ARM -Use this attribute on ARM to write Interrupt Service Routines. This is an -alias to the @code{interrupt} attribute above. - -@item kspisusp -@cindex @code{kspisusp} function attribute, Blackfin -@cindex User stack pointer in interrupts on the Blackfin -When used together with @code{interrupt_handler}, @code{exception_handler} -or @code{nmi_handler}, code is generated to load the stack pointer -from the USP register in the function prologue. - -@item l1_text -@cindex @code{l1_text} function attribute, Blackfin -This attribute specifies a function to be placed into L1 Instruction -SRAM@. The function is put into a specific section named @code{.l1.text}. -With @option{-mfdpic}, function calls with a such function as the callee -or caller uses inlined PLT. - -@item l2 -@cindex @code{l2} function attribute, Blackfin -On the Blackfin, this attribute specifies a function to be placed into L2 -SRAM. The function is put into a specific section named -@code{.l1.text}. With @option{-mfdpic}, callers of such functions use -an inlined PLT. - -@item leaf -@cindex @code{leaf} function attribute -Calls to external functions with this attribute must return to the current -compilation unit only by return or by exception handling. In particular, leaf -functions are not allowed to call callback function passed to it from the current -compilation unit or directly call functions exported by the unit or longjmp -into the unit. Leaf function might still call functions from other compilation -units and thus they are not necessarily leaf in the sense that they contain no -function calls at all. - -The attribute is intended for library functions to improve dataflow analysis. -The compiler takes the hint that any data not escaping the current compilation unit can -not be used or modified by the leaf function. For example, the @code{sin} function -is a leaf function, but @code{qsort} is not. - -Note that leaf functions might invoke signals and signal handlers might be -defined in the current compilation unit and use static variables. The only -compliant way to write such a signal handler is to declare such variables -@code{volatile}. - -The attribute has no effect on functions defined within the current compilation -unit. This is to allow easy merging of multiple compilation units into one, -for example, by using the link-time optimization. For this reason the -attribute is not allowed on types to annotate indirect calls. - -@item long_call -@itemx medium_call -@itemx short_call -@cindex @code{long_call} function attribute, ARC -@cindex @code{long_call} function attribute, ARM -@cindex @code{long_call} function attribute, Epiphany -@cindex @code{medium_call} function attribute, ARC -@cindex @code{short_call} function attribute, ARC -@cindex @code{short_call} function attribute, ARM -@cindex @code{short_call} function attribute, Epiphany -@cindex indirect calls, ARC -@cindex indirect calls, ARM -@cindex indirect calls, Epiphany -These attributes specify how a particular function is called on -ARC, ARM and Epiphany - with @code{medium_call} being specific to ARC. -These attributes override the -@option{-mlong-calls} (@pxref{ARM Options} and @ref{ARC Options}) -and @option{-mmedium-calls} (@pxref{ARC Options}) -command-line switches and @code{#pragma long_calls} settings. For ARM, the -@code{long_call} attribute indicates that the function might be far -away from the call site and require a different (more expensive) -calling sequence. The @code{short_call} attribute always places -the offset to the function from the call site into the @samp{BL} -instruction directly. - -For ARC, a function marked with the @code{long_call} attribute is -always called using register-indirect jump-and-link instructions, -thereby enabling the called function to be placed anywhere within the -32-bit address space. A function marked with the @code{medium_call} -attribute will always be close enough to be called with an unconditional -branch-and-link instruction, which has a 25-bit offset from -the call site. A function marked with the @code{short_call} -attribute will always be close enough to be called with a conditional -branch-and-link instruction, which has a 21-bit offset from -the call site. - -@item longcall -@itemx shortcall -@cindex indirect calls, Blackfin -@cindex indirect calls, PowerPC -@cindex @code{longcall} function attribute, Blackfin -@cindex @code{longcall} function attribute, PowerPC -@cindex @code{shortcall} function attribute, Blackfin -@cindex @code{shortcall} function attribute, PowerPC -On Blackfin and PowerPC, the @code{longcall} attribute -indicates that the function might be far away from the call site and -require a different (more expensive) calling sequence. The -@code{shortcall} attribute indicates that the function is always close -enough for the shorter calling sequence to be used. These attributes -override both the @option{-mlongcall} switch and, on the RS/6000 and -PowerPC, the @code{#pragma longcall} setting. - -@xref{RS/6000 and PowerPC Options}, for more information on whether long -calls are necessary. - -@item long_call -@itemx near -@itemx far -@cindex indirect calls, MIPS -@cindex @code{long_call} function attribute, MIPS -@cindex @code{near} function attribute, MIPS -@cindex @code{far} function attribute, MIPS -These attributes specify how a particular function is called on MIPS@. -The attributes override the @option{-mlong-calls} (@pxref{MIPS Options}) -command-line switch. The @code{long_call} and @code{far} attributes are -synonyms, and cause the compiler to always call -the function by first loading its address into a register, and then using -the contents of that register. The @code{near} attribute has the opposite -effect; it specifies that non-PIC calls should be made using the more -efficient @code{jal} instruction. - -@item malloc -@cindex @code{malloc} function attribute -This tells the compiler that a function is @code{malloc}-like, i.e., -that the pointer @var{P} returned by the function cannot alias any -other pointer valid when the function returns, and moreover no -pointers to valid objects occur in any storage addressed by @var{P}. - -Using this attribute can improve optimization. Functions like -@code{malloc} and @code{calloc} have this property because they return -a pointer to uninitialized or zeroed-out storage. However, functions -like @code{realloc} do not have this property, as they can return a -pointer to storage containing pointers. - -@item mips16 -@itemx nomips16 -@cindex @code{mips16} function attribute, MIPS -@cindex @code{nomips16} function attribute, MIPS - -On MIPS targets, you can use the @code{mips16} and @code{nomips16} -function attributes to locally select or turn off MIPS16 code generation. -A function with the @code{mips16} attribute is emitted as MIPS16 code, -while MIPS16 code generation is disabled for functions with the -@code{nomips16} attribute. These attributes override the -@option{-mips16} and @option{-mno-mips16} options on the command line -(@pxref{MIPS Options}). - -When compiling files containing mixed MIPS16 and non-MIPS16 code, the -preprocessor symbol @code{__mips16} reflects the setting on the command line, -not that within individual functions. Mixed MIPS16 and non-MIPS16 code -may interact badly with some GCC extensions such as @code{__builtin_apply} -(@pxref{Constructing Calls}). - -@item micromips, MIPS -@itemx nomicromips, MIPS -@cindex @code{micromips} function attribute -@cindex @code{nomicromips} function attribute - -On MIPS targets, you can use the @code{micromips} and @code{nomicromips} -function attributes to locally select or turn off microMIPS code generation. -A function with the @code{micromips} attribute is emitted as microMIPS code, -while microMIPS code generation is disabled for functions with the -@code{nomicromips} attribute. These attributes override the -@option{-mmicromips} and @option{-mno-micromips} options on the command line -(@pxref{MIPS Options}). - -When compiling files containing mixed microMIPS and non-microMIPS code, the -preprocessor symbol @code{__mips_micromips} reflects the setting on the -command line, -not that within individual functions. Mixed microMIPS and non-microMIPS code -may interact badly with some GCC extensions such as @code{__builtin_apply} -(@pxref{Constructing Calls}). - -@item model (@var{model-name}) -@cindex @code{model} function attribute, M32R/D -@cindex function addressability on the M32R/D - -On the M32R/D, use this attribute to set the addressability of an -object, and of the code generated for a function. The identifier -@var{model-name} is one of @code{small}, @code{medium}, or -@code{large}, representing each of the code models. - -Small model objects live in the lower 16MB of memory (so that their -addresses can be loaded with the @code{ld24} instruction), and are -callable with the @code{bl} instruction. - -Medium model objects may live anywhere in the 32-bit address space (the -compiler generates @code{seth/add3} instructions to load their addresses), -and are callable with the @code{bl} instruction. - -Large model objects may live anywhere in the 32-bit address space (the -compiler generates @code{seth/add3} instructions to load their addresses), -and may not be reachable with the @code{bl} instruction (the compiler -generates the much slower @code{seth/add3/jl} instruction sequence). - -@item ms_abi -@itemx sysv_abi -@cindex @code{ms_abi} function attribute, x86 -@cindex @code{sysv_abi} function attribute, x86 - -On 32-bit and 64-bit x86 targets, you can use an ABI attribute -to indicate which calling convention should be used for a function. The -@code{ms_abi} attribute tells the compiler to use the Microsoft ABI, -while the @code{sysv_abi} attribute tells the compiler to use the ABI -used on GNU/Linux and other systems. The default is to use the Microsoft ABI -when targeting Windows. On all other systems, the default is the x86/AMD ABI. - -Note, the @code{ms_abi} attribute for Microsoft Windows 64-bit targets currently -requires the @option{-maccumulate-outgoing-args} option. - -@item callee_pop_aggregate_return (@var{number}) -@cindex @code{callee_pop_aggregate_return} function attribute, x86 - -On x86-32 targets, you can use this attribute to control how -aggregates are returned in memory. If the caller is responsible for -popping the hidden pointer together with the rest of the arguments, specify -@var{number} equal to zero. If callee is responsible for popping the -hidden pointer, specify @var{number} equal to one. - -The default x86-32 ABI assumes that the callee pops the -stack for hidden pointer. However, on x86-32 Microsoft Windows targets, -the compiler assumes that the -caller pops the stack for hidden pointer. - -@item ms_hook_prologue -@cindex @code{ms_hook_prologue} function attribute, x86 - -On 32-bit and 64-bit x86 targets, you can use -this function attribute to make GCC generate the ``hot-patching'' function -prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2 -and newer. - -@item hotpatch (@var{halfwords-before-function-label},@var{halfwords-after-function-label}) -@cindex @code{hotpatch} function attribute, S/390 - -On S/390 System z targets, you can use this function attribute to -make GCC generate a ``hot-patching'' function prologue. If the -@option{-mhotpatch=} command-line option is used at the same time, -the @code{hotpatch} attribute takes precedence. The first of the -two arguments specifies the number of halfwords to be added before -the function label. A second argument can be used to specify the -number of halfwords to be added after the function label. For -both arguments the maximum allowed value is 1000000. - -If both arguments are zero, hotpatching is disabled. - -@item naked -@cindex @code{naked} function attribute, ARM -@cindex @code{naked} function attribute, AVR -@cindex @code{naked} function attribute, MCORE -@cindex @code{naked} function attribute, MSP430 -@cindex @code{naked} function attribute, NDS32 -@cindex @code{naked} function attribute, RL78 -@cindex @code{naked} function attribute, RX -@cindex @code{naked} function attribute, SPU -@cindex function without prologue/epilogue code -This attribute is available on the ARM, AVR, MCORE, MSP430, NDS32, -RL78, RX and SPU ports. It allows the compiler to construct the -requisite function declaration, while allowing the body of the -function to be assembly code. The specified function will not have -prologue/epilogue sequences generated by the compiler. Only basic -@code{asm} statements can safely be included in naked functions -(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of -basic @code{asm} and C code may appear to work, they cannot be -depended upon to work reliably and are not supported. - -@item near -@cindex @code{near} function attribute, MeP -@cindex functions that do not handle memory bank switching on 68HC11/68HC12 -On MeP targets this attribute causes the compiler to assume the called -function is close enough to use the normal calling convention, -overriding the @option{-mtf} command-line option. - -@item nesting -@cindex @code{nesting} function attribute, Blackfin -@cindex Allow nesting in an interrupt handler on the Blackfin processor -Use this attribute together with @code{interrupt_handler}, -@code{exception_handler} or @code{nmi_handler} to indicate that the function -entry code should enable nested interrupts or exceptions. - -@item nmi_handler -@cindex @code{nmi_handler} function attribute, Blackfin -@cindex NMI handler functions on the Blackfin processor -Use this attribute on the Blackfin to indicate that the specified function -is an NMI handler. The compiler generates function entry and -exit sequences suitable for use in an NMI handler when this -attribute is present. - -@item nocompression -@cindex @code{nocompression} function attribute, MIPS -On MIPS targets, you can use the @code{nocompression} function attribute -to locally turn off MIPS16 and microMIPS code generation. This attribute -overrides the @option{-mips16} and @option{-mmicromips} options on the -command line (@pxref{MIPS Options}). - -@item no_instrument_function -@cindex @code{no_instrument_function} function attribute -@opindex finstrument-functions -If @option{-finstrument-functions} is given, profiling function calls are -generated at entry and exit of most user-compiled functions. -Functions with this attribute are not so instrumented. - -@item no_split_stack -@cindex @code{no_split_stack} function attribute -@opindex fsplit-stack -If @option{-fsplit-stack} is given, functions have a small -prologue which decides whether to split the stack. Functions with the -@code{no_split_stack} attribute do not have that prologue, and thus -may run with only a small amount of stack space available. - -@item stack_protect -@cindex @code{stack_protect} function attribute -This function attribute make a stack protection of the function if -flags @option{fstack-protector} or @option{fstack-protector-strong} -or @option{fstack-protector-explicit} are set. - -@item noinline -@cindex @code{noinline} function attribute -This function attribute prevents a function from being considered for -inlining. -@c Don't enumerate the optimizations by name here; we try to be -@c future-compatible with this mechanism. -If the function does not have side-effects, there are optimizations -other than inlining that cause function calls to be optimized away, -although the function call is live. To keep such calls from being -optimized away, put -@smallexample -asm (""); -@end smallexample - -@noindent -(@pxref{Extended Asm}) in the called function, to serve as a special -side-effect. - -@item noclone -@cindex @code{noclone} function attribute -This function attribute prevents a function from being considered for -cloning---a mechanism that produces specialized copies of functions -and which is (currently) performed by interprocedural constant -propagation. - -@item no_icf -@cindex @code{no_icf} function attribute -This function attribute prevents a functions from being merged with another -semantically equivalent function. - -@item nonnull (@var{arg-index}, @dots{}) -@cindex @code{nonnull} function attribute -The @code{nonnull} attribute specifies that some function parameters should -be non-null pointers. For instance, the declaration: - -@smallexample -extern void * -my_memcpy (void *dest, const void *src, size_t len) - __attribute__((nonnull (1, 2))); -@end smallexample - -@noindent -causes the compiler to check that, in calls to @code{my_memcpy}, -arguments @var{dest} and @var{src} are non-null. If the compiler -determines that a null pointer is passed in an argument slot marked -as non-null, and the @option{-Wnonnull} option is enabled, a warning -is issued. The compiler may also choose to make optimizations based -on the knowledge that certain function arguments will never be null. - -If no argument index list is given to the @code{nonnull} attribute, -all pointer arguments are marked as non-null. To illustrate, the -following declaration is equivalent to the previous example: - -@smallexample -extern void * -my_memcpy (void *dest, const void *src, size_t len) - __attribute__((nonnull)); -@end smallexample - -@item no_reorder -@cindex @code{no_reorder} function attribute -Do not reorder functions or variables marked @code{no_reorder} -against each other or top level assembler statements the executable. -The actual order in the program will depend on the linker command -line. Static variables marked like this are also not removed. -This has a similar effect -as the @option{-fno-toplevel-reorder} option, but only applies to the -marked symbols. - -@item returns_nonnull -@cindex @code{returns_nonnull} function attribute -The @code{returns_nonnull} attribute specifies that the function -return value should be a non-null pointer. For instance, the declaration: - -@smallexample -extern void * -mymalloc (size_t len) __attribute__((returns_nonnull)); -@end smallexample - -@noindent -lets the compiler optimize callers based on the knowledge -that the return value will never be null. - -@item noreturn -@cindex @code{noreturn} function attribute -A few standard library functions, such as @code{abort} and @code{exit}, -cannot return. GCC knows this automatically. Some programs define -their own functions that never return. You can declare them -@code{noreturn} to tell the compiler this fact. For example, - -@smallexample -@group -void fatal () __attribute__ ((noreturn)); - -void -fatal (/* @r{@dots{}} */) -@{ - /* @r{@dots{}} */ /* @r{Print error message.} */ /* @r{@dots{}} */ - exit (1); -@} -@end group -@end smallexample - -The @code{noreturn} keyword tells the compiler to assume that -@code{fatal} cannot return. It can then optimize without regard to what -would happen if @code{fatal} ever did return. This makes slightly -better code. More importantly, it helps avoid spurious warnings of -uninitialized variables. - -The @code{noreturn} keyword does not affect the exceptional path when that -applies: a @code{noreturn}-marked function may still return to the caller -by throwing an exception or calling @code{longjmp}. - -Do not assume that registers saved by the calling function are -restored before calling the @code{noreturn} function. - -It does not make sense for a @code{noreturn} function to have a return -type other than @code{void}. - -@item nothrow -@cindex @code{nothrow} function attribute -The @code{nothrow} attribute is used to inform the compiler that a -function cannot throw an exception. For example, most functions in -the standard C library can be guaranteed not to throw an exception -with the notable exceptions of @code{qsort} and @code{bsearch} that -take function pointer arguments. - -@item nosave_low_regs -@cindex @code{nosave_low_regs} function attribute, SH -Use this attribute on SH targets to indicate that an @code{interrupt_handler} -function should not save and restore registers R0..R7. This can be used on SH3* -and SH4* targets that have a second R0..R7 register bank for non-reentrant -interrupt handlers. - -@item optimize -@cindex @code{optimize} function attribute -The @code{optimize} attribute is used to specify that a function is to -be compiled with different optimization options than specified on the -command line. Arguments can either be numbers or strings. Numbers -are assumed to be an optimization level. Strings that begin with -@code{O} are assumed to be an optimization option, while other options -are assumed to be used with a @code{-f} prefix. You can also use the -@samp{#pragma GCC optimize} pragma to set the optimization options -that affect more than one function. -@xref{Function Specific Option Pragmas}, for details about the -@samp{#pragma GCC optimize} pragma. - -This can be used for instance to have frequently-executed functions -compiled with more aggressive optimization options that produce faster -and larger code, while other functions can be compiled with less -aggressive options. - -@item OS_main -@itemx OS_task -@cindex @code{OS_main} function attribute, AVR -@cindex @code{OS_task} function attribute, AVR -On AVR, functions with the @code{OS_main} or @code{OS_task} attribute -do not save/restore any call-saved register in their prologue/epilogue. - -The @code{OS_main} attribute can be used when there @emph{is -guarantee} that interrupts are disabled at the time when the function -is entered. This saves resources when the stack pointer has to be -changed to set up a frame for local variables. - -The @code{OS_task} attribute can be used when there is @emph{no -guarantee} that interrupts are disabled at that time when the function -is entered like for, e@.g@. task functions in a multi-threading operating -system. In that case, changing the stack pointer register is -guarded by save/clear/restore of the global interrupt enable flag. - -The differences to the @code{naked} function attribute are: -@itemize @bullet -@item @code{naked} functions do not have a return instruction whereas -@code{OS_main} and @code{OS_task} functions have a @code{RET} or -@code{RETI} return instruction. -@item @code{naked} functions do not set up a frame for local variables -or a frame pointer whereas @code{OS_main} and @code{OS_task} do this -as needed. -@end itemize - -@item pcs -@cindex @code{pcs} function attribute, ARM - -The @code{pcs} attribute can be used to control the calling convention -used for a function on ARM. The attribute takes an argument that specifies -the calling convention to use. - -When compiling using the AAPCS ABI (or a variant of it) then valid -values for the argument are @code{"aapcs"} and @code{"aapcs-vfp"}. In -order to use a variant other than @code{"aapcs"} then the compiler must -be permitted to use the appropriate co-processor registers (i.e., the -VFP registers must be available in order to use @code{"aapcs-vfp"}). -For example, - -@smallexample -/* Argument passed in r0, and result returned in r0+r1. */ -double f2d (float) __attribute__((pcs("aapcs"))); -@end smallexample - -Variadic functions always use the @code{"aapcs"} calling convention and -the compiler rejects attempts to specify an alternative. - -@item pure -@cindex @code{pure} function attribute -Many functions have no effects except the return value and their -return value depends only on the parameters and/or global variables. -Such a function can be subject -to common subexpression elimination and loop optimization just as an -arithmetic operator would be. These functions should be declared -with the attribute @code{pure}. For example, - -@smallexample -int square (int) __attribute__ ((pure)); -@end smallexample - -@noindent -says that the hypothetical function @code{square} is safe to call -fewer times than the program says. - -Some of common examples of pure functions are @code{strlen} or @code{memcmp}. -Interesting non-pure functions are functions with infinite loops or those -depending on volatile memory or other system resource, that may change between -two consecutive calls (such as @code{feof} in a multithreading environment). - -@item hot -@cindex @code{hot} function attribute -The @code{hot} attribute on a function is used to inform the compiler that -the function is a hot spot of the compiled program. The function is -optimized more aggressively and on many targets it is placed into a special -subsection of the text section so all hot functions appear close together, -improving locality. - -When profile feedback is available, via @option{-fprofile-use}, hot functions -are automatically detected and this attribute is ignored. - -@item cold -@cindex @code{cold} function attribute -The @code{cold} attribute on functions is used to inform the compiler that -the function is unlikely to be executed. The function is optimized for -size rather than speed and on many targets it is placed into a special -subsection of the text section so all cold functions appear close together, -improving code locality of non-cold parts of program. The paths leading -to calls of cold functions within code are marked as unlikely by the branch -prediction mechanism. It is thus useful to mark functions used to handle -unlikely conditions, such as @code{perror}, as cold to improve optimization -of hot functions that do call marked functions in rare occasions. - -When profile feedback is available, via @option{-fprofile-use}, cold functions -are automatically detected and this attribute is ignored. - -@item no_sanitize_address -@itemx no_address_safety_analysis -@cindex @code{no_sanitize_address} function attribute -The @code{no_sanitize_address} attribute on functions is used -to inform the compiler that it should not instrument memory accesses -in the function when compiling with the @option{-fsanitize=address} option. -The @code{no_address_safety_analysis} is a deprecated alias of the -@code{no_sanitize_address} attribute, new code should use -@code{no_sanitize_address}. - -@item no_sanitize_thread -@cindex @code{no_sanitize_thread} function attribute -The @code{no_sanitize_thread} attribute on functions is used -to inform the compiler that it should not instrument memory accesses -in the function when compiling with the @option{-fsanitize=thread} option. - -@item no_sanitize_undefined -@cindex @code{no_sanitize_undefined} function attribute -The @code{no_sanitize_undefined} attribute on functions is used -to inform the compiler that it should not check for undefined behavior -in the function when compiling with the @option{-fsanitize=undefined} option. - -@item bnd_legacy -@cindex @code{bnd_legacy} function attribute -@cindex Pointer Bounds Checker attributes -The @code{bnd_legacy} attribute on functions is used to inform the -compiler that the function should not be instrumented when compiled -with the @option{-fcheck-pointer-bounds} option. - -@item bnd_instrument -@cindex @code{bnd_instrument} function attribute -The @code{bnd_instrument} attribute on functions is used to inform the -compiler that the function should be instrumented when compiled -with the @option{-fchkp-instrument-marked-only} option. - -@item regparm (@var{number}) -@cindex @code{regparm} function attribute, x86 -@cindex functions that are passed arguments in registers on x86-32 -On x86-32 targets, the @code{regparm} attribute causes the compiler to -pass arguments number one to @var{number} if they are of integral type -in registers EAX, EDX, and ECX instead of on the stack. Functions that -take a variable number of arguments continue to be passed all of their -arguments on the stack. - -Beware that on some ELF systems this attribute is unsuitable for -global functions in shared libraries with lazy binding (which is the -default). Lazy binding sends the first call via resolving code in -the loader, which might assume EAX, EDX and ECX can be clobbered, as -per the standard calling conventions. Solaris 8 is affected by this. -Systems with the GNU C Library version 2.1 or higher -and FreeBSD are believed to be -safe since the loaders there save EAX, EDX and ECX. (Lazy binding can be -disabled with the linker or the loader if desired, to avoid the -problem.) - -@item reset -@cindex @code{reset} function attribute, NDS32 -@cindex reset handler functions -Use this attribute on the NDS32 target to indicate that the specified function -is a reset handler. The compiler will generate corresponding sections -for use in a reset handler. You can use the following attributes -to provide extra exception handling: -@table @code -@item nmi -@cindex @code{nmi} function attribute, NDS32 -Provide a user-defined function to handle NMI exception. -@item warm -@cindex @code{warm} function attribute, NDS32 -Provide a user-defined function to handle warm reset exception. -@end table - -@item sseregparm -@cindex @code{sseregparm} function attribute, x86 -On x86-32 targets with SSE support, the @code{sseregparm} attribute -causes the compiler to pass up to 3 floating-point arguments in -SSE registers instead of on the stack. Functions that take a -variable number of arguments continue to pass all of their -floating-point arguments on the stack. - -@item force_align_arg_pointer -@cindex @code{force_align_arg_pointer} function attribute, x86 -On x86 targets, the @code{force_align_arg_pointer} attribute may be -applied to individual function definitions, generating an alternate -prologue and epilogue that realigns the run-time stack if necessary. -This supports mixing legacy codes that run with a 4-byte aligned stack -with modern codes that keep a 16-byte stack for SSE compatibility. - -@item renesas -@cindex @code{renesas} function attribute, SH -On SH targets this attribute specifies that the function or struct follows the -Renesas ABI. - -@item resbank -@cindex @code{resbank} function attribute, SH -On the SH2A target, this attribute enables the high-speed register -saving and restoration using a register bank for @code{interrupt_handler} -routines. Saving to the bank is performed automatically after the CPU -accepts an interrupt that uses a register bank. - -The nineteen 32-bit registers comprising general register R0 to R14, -control register GBR, and system registers MACH, MACL, and PR and the -vector table address offset are saved into a register bank. Register -banks are stacked in first-in last-out (FILO) sequence. Restoration -from the bank is executed by issuing a RESBANK instruction. - -@item returns_twice -@cindex @code{returns_twice} function attribute -The @code{returns_twice} attribute tells the compiler that a function may -return more than one time. The compiler ensures that all registers -are dead before calling such a function and emits a warning about -the variables that may be clobbered after the second return from the -function. Examples of such functions are @code{setjmp} and @code{vfork}. -The @code{longjmp}-like counterpart of such function, if any, might need -to be marked with the @code{noreturn} attribute. - -@item saveall -@cindex @code{saveall} function attribute, Blackfin -@cindex @code{saveall} function attribute, H8/300 -@cindex save all registers on the Blackfin, H8/300, H8/300H, and H8S -Use this attribute on the Blackfin, H8/300, H8/300H, and H8S to indicate that -all registers except the stack pointer should be saved in the prologue -regardless of whether they are used or not. - -@item save_volatiles -@cindex @code{save_volatiles} function attribute, MicroBlaze -Use this attribute on the MicroBlaze to indicate that the function is -an interrupt handler. All volatile registers (in addition to non-volatile -registers) are saved in the function prologue. If the function is a leaf -function, only volatiles used by the function are saved. A normal function -return is generated instead of a return from interrupt. - -@item break_handler -@cindex @code{break_handler} function attribute, MicroBlaze -@cindex break handler functions -Use this attribute on the MicroBlaze ports to indicate that -the specified function is a break handler. The compiler generates function -entry and exit sequences suitable for use in an break handler when this -attribute is present. The return from @code{break_handler} is done through -the @code{rtbd} instead of @code{rtsd}. - -@smallexample -void f () __attribute__ ((break_handler)); -@end smallexample - -@item section ("@var{section-name}") -@cindex @code{section} function attribute -Normally, the compiler places the code it generates in the @code{text} section. -Sometimes, however, you need additional sections, or you need certain -particular functions to appear in special sections. The @code{section} -attribute specifies that a function lives in a particular section. -For example, the declaration: - -@smallexample -extern void foobar (void) __attribute__ ((section ("bar"))); -@end smallexample - -@noindent -puts the function @code{foobar} in the @code{bar} section. - -Some file formats do not support arbitrary sections so the @code{section} -attribute is not available on all platforms. -If you need to map the entire contents of a module to a particular -section, consider using the facilities of the linker instead. - -@item sentinel -@cindex @code{sentinel} function attribute -This function attribute ensures that a parameter in a function call is -an explicit @code{NULL}. The attribute is only valid on variadic -functions. By default, the sentinel is located at position zero, the -last parameter of the function call. If an optional integer position -argument P is supplied to the attribute, the sentinel must be located at -position P counting backwards from the end of the argument list. - -@smallexample -__attribute__ ((sentinel)) -is equivalent to -__attribute__ ((sentinel(0))) -@end smallexample - -The attribute is automatically set with a position of 0 for the built-in -functions @code{execl} and @code{execlp}. The built-in function -@code{execle} has the attribute set with a position of 1. - -A valid @code{NULL} in this context is defined as zero with any pointer -type. If your system defines the @code{NULL} macro with an integer type -then you need to add an explicit cast. GCC replaces @code{stddef.h} -with a copy that redefines NULL appropriately. - -The warnings for missing or incorrect sentinels are enabled with -@option{-Wformat}. - -@item short_call -See @code{long_call}. - -@item shortcall -See @code{longcall}. - -@item signal -@cindex @code{signal} function attribute, AVR -Use this attribute on the AVR to indicate that the specified -function is an interrupt handler. The compiler generates function -entry and exit sequences suitable for use in an interrupt handler when this -attribute is present. - -See also the @code{interrupt} function attribute. - -The AVR hardware globally disables interrupts when an interrupt is executed. -Interrupt handler functions defined with the @code{signal} attribute -do not re-enable interrupts. It is save to enable interrupts in a -@code{signal} handler. This ``save'' only applies to the code -generated by the compiler and not to the IRQ layout of the -application which is responsibility of the application. - -If both @code{signal} and @code{interrupt} are specified for the same -function, @code{signal} is silently ignored. - -@item sp_switch -@cindex @code{sp_switch} function attribute, SH -Use this attribute on the SH to indicate an @code{interrupt_handler} -function should switch to an alternate stack. It expects a string -argument that names a global variable holding the address of the -alternate stack. - -@smallexample -void *alt_stack; -void f () __attribute__ ((interrupt_handler, - sp_switch ("alt_stack"))); -@end smallexample - -@item stdcall -@cindex @code{stdcall} function attribute, x86-32 -@cindex functions that pop the argument stack on x86-32 -On x86-32 targets, the @code{stdcall} attribute causes the compiler to -assume that the called function pops off the stack space used to -pass arguments, unless it takes a variable number of arguments. - -@item syscall_linkage -@cindex @code{syscall_linkage} function attribute, IA-64 -This attribute is used to modify the IA-64 calling convention by marking -all input registers as live at all function exits. This makes it possible -to restart a system call after an interrupt without having to save/restore -the input registers. This also prevents kernel data from leaking into -application code. - -@item target -@cindex @code{target} function attribute -The @code{target} attribute is used to specify that a function is to -be compiled with different target options than specified on the -command line. This can be used for instance to have functions -compiled with a different ISA (instruction set architecture) than the -default. You can also use the @samp{#pragma GCC target} pragma to set -more than one function to be compiled with specific target options. -@xref{Function Specific Option Pragmas}, for details about the -@samp{#pragma GCC target} pragma. - -For instance on an x86, you could compile one function with -@code{target("sse4.1,arch=core2")} and another with -@code{target("sse4a,arch=amdfam10")}. This is equivalent to -compiling the first function with @option{-msse4.1} and -@option{-march=core2} options, and the second function with -@option{-msse4a} and @option{-march=amdfam10} options. It is up to the -user to make sure that a function is only invoked on a machine that -supports the particular ISA it is compiled for (for example by using -@code{cpuid} on x86 to determine what feature bits and architecture -family are used). - -@smallexample -int core2_func (void) __attribute__ ((__target__ ("arch=core2"))); -int sse3_func (void) __attribute__ ((__target__ ("sse3"))); -@end smallexample - -You can either use multiple -strings to specify multiple options, or separate the options -with a comma (@samp{,}). - -The @code{target} attribute is presently implemented for -x86, PowerPC, and Nios II targets only. -The options supported are specific to each target. - -On the x86, the following options are allowed: - -@table @samp -@item abm -@itemx no-abm -@cindex @code{target("abm")} function attribute, x86 -Enable/disable the generation of the advanced bit instructions. - -@item aes -@itemx no-aes -@cindex @code{target("aes")} function attribute, x86 -Enable/disable the generation of the AES instructions. - -@item default -@cindex @code{target("default")} function attribute, x86 -@xref{Function Multiversioning}, where it is used to specify the -default function version. - -@item mmx -@itemx no-mmx -@cindex @code{target("mmx")} function attribute, x86 -Enable/disable the generation of the MMX instructions. - -@item pclmul -@itemx no-pclmul -@cindex @code{target("pclmul")} function attribute, x86 -Enable/disable the generation of the PCLMUL instructions. - -@item popcnt -@itemx no-popcnt -@cindex @code{target("popcnt")} function attribute, x86 -Enable/disable the generation of the POPCNT instruction. - -@item sse -@itemx no-sse -@cindex @code{target("sse")} function attribute, x86 -Enable/disable the generation of the SSE instructions. - -@item sse2 -@itemx no-sse2 -@cindex @code{target("sse2")} function attribute, x86 -Enable/disable the generation of the SSE2 instructions. - -@item sse3 -@itemx no-sse3 -@cindex @code{target("sse3")} function attribute, x86 -Enable/disable the generation of the SSE3 instructions. - -@item sse4 -@itemx no-sse4 -@cindex @code{target("sse4")} function attribute, x86 -Enable/disable the generation of the SSE4 instructions (both SSE4.1 -and SSE4.2). - -@item sse4.1 -@itemx no-sse4.1 -@cindex @code{target("sse4.1")} function attribute, x86 -Enable/disable the generation of the sse4.1 instructions. - -@item sse4.2 -@itemx no-sse4.2 -@cindex @code{target("sse4.2")} function attribute, x86 -Enable/disable the generation of the sse4.2 instructions. - -@item sse4a -@itemx no-sse4a -@cindex @code{target("sse4a")} function attribute, x86 -Enable/disable the generation of the SSE4A instructions. - -@item fma4 -@itemx no-fma4 -@cindex @code{target("fma4")} function attribute, x86 -Enable/disable the generation of the FMA4 instructions. - -@item xop -@itemx no-xop -@cindex @code{target("xop")} function attribute, x86 -Enable/disable the generation of the XOP instructions. - -@item lwp -@itemx no-lwp -@cindex @code{target("lwp")} function attribute, x86 -Enable/disable the generation of the LWP instructions. - -@item ssse3 -@itemx no-ssse3 -@cindex @code{target("ssse3")} function attribute, x86 -Enable/disable the generation of the SSSE3 instructions. - -@item cld -@itemx no-cld -@cindex @code{target("cld")} function attribute, x86 -Enable/disable the generation of the CLD before string moves. - -@item fancy-math-387 -@itemx no-fancy-math-387 -@cindex @code{target("fancy-math-387")} function attribute, x86 -Enable/disable the generation of the @code{sin}, @code{cos}, and -@code{sqrt} instructions on the 387 floating-point unit. - -@item fused-madd -@itemx no-fused-madd -@cindex @code{target("fused-madd")} function attribute, x86 -Enable/disable the generation of the fused multiply/add instructions. - -@item ieee-fp -@itemx no-ieee-fp -@cindex @code{target("ieee-fp")} function attribute, x86 -Enable/disable the generation of floating point that depends on IEEE arithmetic. - -@item inline-all-stringops -@itemx no-inline-all-stringops -@cindex @code{target("inline-all-stringops")} function attribute, x86 -Enable/disable inlining of string operations. - -@item inline-stringops-dynamically -@itemx no-inline-stringops-dynamically -@cindex @code{target("inline-stringops-dynamically")} function attribute, x86 -Enable/disable the generation of the inline code to do small string -operations and calling the library routines for large operations. - -@item align-stringops -@itemx no-align-stringops -@cindex @code{target("align-stringops")} function attribute, x86 -Do/do not align destination of inlined string operations. - -@item recip -@itemx no-recip -@cindex @code{target("recip")} function attribute, x86 -Enable/disable the generation of RCPSS, RCPPS, RSQRTSS and RSQRTPS -instructions followed an additional Newton-Raphson step instead of -doing a floating-point division. - -@item arch=@var{ARCH} -@cindex @code{target("arch=@var{ARCH}")} function attribute, x86 -Specify the architecture to generate code for in compiling the function. - -@item tune=@var{TUNE} -@cindex @code{target("tune=@var{TUNE}")} function attribute, x86 -Specify the architecture to tune for in compiling the function. - -@item fpmath=@var{FPMATH} -@cindex @code{target("fpmath=@var{FPMATH}")} function attribute, x86 -Specify which floating-point unit to use. The -@code{target("fpmath=sse,387")} option must be specified as -@code{target("fpmath=sse+387")} because the comma would separate -different options. -@end table - -On the PowerPC, the following options are allowed: - -@table @samp -@item altivec -@itemx no-altivec -@cindex @code{target("altivec")} function attribute, PowerPC -Generate code that uses (does not use) AltiVec instructions. In -32-bit code, you cannot enable AltiVec instructions unless -@option{-mabi=altivec} is used on the command line. - -@item cmpb -@itemx no-cmpb -@cindex @code{target("cmpb")} function attribute, PowerPC -Generate code that uses (does not use) the compare bytes instruction -implemented on the POWER6 processor and other processors that support -the PowerPC V2.05 architecture. - -@item dlmzb -@itemx no-dlmzb -@cindex @code{target("dlmzb")} function attribute, PowerPC -Generate code that uses (does not use) the string-search @samp{dlmzb} -instruction on the IBM 405, 440, 464 and 476 processors. This instruction is -generated by default when targeting those processors. - -@item fprnd -@itemx no-fprnd -@cindex @code{target("fprnd")} function attribute, PowerPC -Generate code that uses (does not use) the FP round to integer -instructions implemented on the POWER5+ processor and other processors -that support the PowerPC V2.03 architecture. - -@item hard-dfp -@itemx no-hard-dfp -@cindex @code{target("hard-dfp")} function attribute, PowerPC -Generate code that uses (does not use) the decimal floating-point -instructions implemented on some POWER processors. - -@item isel -@itemx no-isel -@cindex @code{target("isel")} function attribute, PowerPC -Generate code that uses (does not use) ISEL instruction. - -@item mfcrf -@itemx no-mfcrf -@cindex @code{target("mfcrf")} function attribute, PowerPC -Generate code that uses (does not use) the move from condition -register field instruction implemented on the POWER4 processor and -other processors that support the PowerPC V2.01 architecture. - -@item mfpgpr -@itemx no-mfpgpr -@cindex @code{target("mfpgpr")} function attribute, PowerPC -Generate code that uses (does not use) the FP move to/from general -purpose register instructions implemented on the POWER6X processor and -other processors that support the extended PowerPC V2.05 architecture. - -@item mulhw -@itemx no-mulhw -@cindex @code{target("mulhw")} function attribute, PowerPC -Generate code that uses (does not use) the half-word multiply and -multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. -These instructions are generated by default when targeting those -processors. - -@item multiple -@itemx no-multiple -@cindex @code{target("multiple")} function attribute, PowerPC -Generate code that uses (does not use) the load multiple word -instructions and the store multiple word instructions. - -@item update -@itemx no-update -@cindex @code{target("update")} function attribute, PowerPC -Generate code that uses (does not use) the load or store instructions -that update the base register to the address of the calculated memory -location. - -@item popcntb -@itemx no-popcntb -@cindex @code{target("popcntb")} function attribute, PowerPC -Generate code that uses (does not use) the popcount and double-precision -FP reciprocal estimate instruction implemented on the POWER5 -processor and other processors that support the PowerPC V2.02 -architecture. - -@item popcntd -@itemx no-popcntd -@cindex @code{target("popcntd")} function attribute, PowerPC -Generate code that uses (does not use) the popcount instruction -implemented on the POWER7 processor and other processors that support -the PowerPC V2.06 architecture. - -@item powerpc-gfxopt -@itemx no-powerpc-gfxopt -@cindex @code{target("powerpc-gfxopt")} function attribute, PowerPC -Generate code that uses (does not use) the optional PowerPC -architecture instructions in the Graphics group, including -floating-point select. - -@item powerpc-gpopt -@itemx no-powerpc-gpopt -@cindex @code{target("powerpc-gpopt")} function attribute, PowerPC -Generate code that uses (does not use) the optional PowerPC -architecture instructions in the General Purpose group, including -floating-point square root. - -@item recip-precision -@itemx no-recip-precision -@cindex @code{target("recip-precision")} function attribute, PowerPC -Assume (do not assume) that the reciprocal estimate instructions -provide higher-precision estimates than is mandated by the PowerPC -ABI. - -@item string -@itemx no-string -@cindex @code{target("string")} function attribute, PowerPC -Generate code that uses (does not use) the load string instructions -and the store string word instructions to save multiple registers and -do small block moves. - -@item vsx -@itemx no-vsx -@cindex @code{target("vsx")} function attribute, PowerPC -Generate code that uses (does not use) vector/scalar (VSX) -instructions, and also enable the use of built-in functions that allow -more direct access to the VSX instruction set. In 32-bit code, you -cannot enable VSX or AltiVec instructions unless -@option{-mabi=altivec} is used on the command line. - -@item friz -@itemx no-friz -@cindex @code{target("friz")} function attribute, PowerPC -Generate (do not generate) the @code{friz} instruction when the -@option{-funsafe-math-optimizations} option is used to optimize -rounding a floating-point value to 64-bit integer and back to floating -point. The @code{friz} instruction does not return the same value if -the floating-point number is too large to fit in an integer. - -@item avoid-indexed-addresses -@itemx no-avoid-indexed-addresses -@cindex @code{target("avoid-indexed-addresses")} function attribute, PowerPC -Generate code that tries to avoid (not avoid) the use of indexed load -or store instructions. - -@item paired -@itemx no-paired -@cindex @code{target("paired")} function attribute, PowerPC -Generate code that uses (does not use) the generation of PAIRED simd -instructions. - -@item longcall -@itemx no-longcall -@cindex @code{target("longcall")} function attribute, PowerPC -Generate code that assumes (does not assume) that all calls are far -away so that a longer more expensive calling sequence is required. - -@item cpu=@var{CPU} -@cindex @code{target("cpu=@var{CPU}")} function attribute, PowerPC -Specify the architecture to generate code for when compiling the -function. If you select the @code{target("cpu=power7")} attribute when -generating 32-bit code, VSX and AltiVec instructions are not generated -unless you use the @option{-mabi=altivec} option on the command line. - -@item tune=@var{TUNE} -@cindex @code{target("tune=@var{TUNE}")} function attribute, PowerPC -Specify the architecture to tune for when compiling the function. If -you do not specify the @code{target("tune=@var{TUNE}")} attribute and -you do specify the @code{target("cpu=@var{CPU}")} attribute, -compilation tunes for the @var{CPU} architecture, and not the -default tuning specified on the command line. -@end table - -When compiling for Nios II, the following options are allowed: - -@table @samp -@item custom-@var{insn}=@var{N} -@itemx no-custom-@var{insn} -@cindex @code{target("custom-@var{insn}=@var{N}")} function attribute, Nios II -@cindex @code{target("no-custom-@var{insn}")} function attribute, Nios II -Each @samp{custom-@var{insn}=@var{N}} attribute locally enables use of a -custom instruction with encoding @var{N} when generating code that uses -@var{insn}. Similarly, @samp{no-custom-@var{insn}} locally inhibits use of -the custom instruction @var{insn}. -These target attributes correspond to the -@option{-mcustom-@var{insn}=@var{N}} and @option{-mno-custom-@var{insn}} -command-line options, and support the same set of @var{insn} keywords. -@xref{Nios II Options}, for more information. - -@item custom-fpu-cfg=@var{name} -@cindex @code{target("custom-fpu-cfg=@var{name}")} function attribute, Nios II -This attribute corresponds to the @option{-mcustom-fpu-cfg=@var{name}} -command-line option, to select a predefined set of custom instructions -named @var{name}. -@xref{Nios II Options}, for more information. -@end table - -On the x86 and PowerPC back ends, the inliner does not inline a -function that has different target options than the caller, unless the -callee has a subset of the target options of the caller. For example -a function declared with @code{target("sse3")} can inline a function -with @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}. - -@item trap_exit -@cindex @code{trap_exit} function attribute, SH -Use this attribute on the SH for an @code{interrupt_handler} to return using -@code{trapa} instead of @code{rte}. This attribute expects an integer -argument specifying the trap number to be used. - -@item trapa_handler -@cindex @code{trapa_handler} function attribute, SH -On SH targets this function attribute is similar to @code{interrupt_handler} -but it does not save and restore all registers. - -@item unused -@cindex @code{unused} function attribute -This attribute, attached to a function, means that the function is meant -to be possibly unused. GCC does not produce a warning for this -function. - -@item used -@cindex @code{used} function attribute -This attribute, attached to a function, means that code must be emitted -for the function even if it appears that the function is not referenced. -This is useful, for example, when the function is referenced only in -inline assembly. - -When applied to a member function of a C++ class template, the -attribute also means that the function is instantiated if the -class itself is instantiated. - -@item vector -@cindex @code{vector} function attribute, RX -This RX attribute is similar to the @code{interrupt} attribute, including its -parameters, but does not make the function an interrupt-handler type -function (i.e. it retains the normal C function calling ABI). See the -@code{interrupt} attribute for a description of its arguments. - -@item version_id -@cindex @code{version_id} function attribute, IA-64 -This IA-64 HP-UX attribute, attached to a global variable or function, renames a -symbol to contain a version string, thus allowing for function level -versioning. HP-UX system header files may use function level versioning -for some system calls. - -@smallexample -extern int foo () __attribute__((version_id ("20040821"))); -@end smallexample - -@noindent -Calls to @var{foo} are mapped to calls to @var{foo@{20040821@}}. - -@item visibility ("@var{visibility_type}") -@cindex @code{visibility} function attribute -This attribute affects the linkage of the declaration to which it is attached. -There are four supported @var{visibility_type} values: default, -hidden, protected or internal visibility. - -@smallexample -void __attribute__ ((visibility ("protected"))) -f () @{ /* @r{Do something.} */; @} -int i __attribute__ ((visibility ("hidden"))); -@end smallexample - -The possible values of @var{visibility_type} correspond to the -visibility settings in the ELF gABI. - -@table @dfn -@c keep this list of visibilities in alphabetical order. - -@item default -Default visibility is the normal case for the object file format. -This value is available for the visibility attribute to override other -options that may change the assumed visibility of entities. - -On ELF, default visibility means that the declaration is visible to other -modules and, in shared libraries, means that the declared entity may be -overridden. - -On Darwin, default visibility means that the declaration is visible to -other modules. - -Default visibility corresponds to ``external linkage'' in the language. - -@item hidden -Hidden visibility indicates that the entity declared has a new -form of linkage, which we call ``hidden linkage''. Two -declarations of an object with hidden linkage refer to the same object -if they are in the same shared object. - -@item internal -Internal visibility is like hidden visibility, but with additional -processor specific semantics. Unless otherwise specified by the -psABI, GCC defines internal visibility to mean that a function is -@emph{never} called from another module. Compare this with hidden -functions which, while they cannot be referenced directly by other -modules, can be referenced indirectly via function pointers. By -indicating that a function cannot be called from outside the module, -GCC may for instance omit the load of a PIC register since it is known -that the calling function loaded the correct value. - -@item protected -Protected visibility is like default visibility except that it -indicates that references within the defining module bind to the -definition in that module. That is, the declared entity cannot be -overridden by another module. - -@end table - -All visibilities are supported on many, but not all, ELF targets -(supported when the assembler supports the @samp{.visibility} -pseudo-op). Default visibility is supported everywhere. Hidden -visibility is supported on Darwin targets. - -The visibility attribute should be applied only to declarations that -would otherwise have external linkage. The attribute should be applied -consistently, so that the same entity should not be declared with -different settings of the attribute. - -In C++, the visibility attribute applies to types as well as functions -and objects, because in C++ types have linkage. A class must not have -greater visibility than its non-static data member types and bases, -and class members default to the visibility of their class. Also, a -declaration without explicit visibility is limited to the visibility -of its type. - -In C++, you can mark member functions and static member variables of a -class with the visibility attribute. This is useful if you know a -particular method or static member variable should only be used from -one shared object; then you can mark it hidden while the rest of the -class has default visibility. Care must be taken to avoid breaking -the One Definition Rule; for example, it is usually not useful to mark -an inline method as hidden without marking the whole class as hidden. - -A C++ namespace declaration can also have the visibility attribute. - -@smallexample -namespace nspace1 __attribute__ ((visibility ("protected"))) -@{ /* @r{Do something.} */; @} -@end smallexample - -This attribute applies only to the particular namespace body, not to -other definitions of the same namespace; it is equivalent to using -@samp{#pragma GCC visibility} before and after the namespace -definition (@pxref{Visibility Pragmas}). - -In C++, if a template argument has limited visibility, this -restriction is implicitly propagated to the template instantiation. -Otherwise, template instantiations and specializations default to the -visibility of their template. - -If both the template and enclosing class have explicit visibility, the -visibility from the template is used. - -@item vliw -@cindex @code{vliw} function attribute, MeP -On MeP, the @code{vliw} attribute tells the compiler to emit -instructions in VLIW mode instead of core mode. Note that this -attribute is not allowed unless a VLIW coprocessor has been configured -and enabled through command-line options. - -@item warn_unused_result -@cindex @code{warn_unused_result} function attribute -The @code{warn_unused_result} attribute causes a warning to be emitted -if a caller of the function with this attribute does not use its -return value. This is useful for functions where not checking -the result is either a security problem or always a bug, such as -@code{realloc}. - -@smallexample -int fn () __attribute__ ((warn_unused_result)); -int foo () -@{ - if (fn () < 0) return -1; - fn (); - return 0; -@} -@end smallexample - -@noindent -results in warning on line 5. - -@item weak -@cindex @code{weak} function attribute -The @code{weak} attribute causes the declaration to be emitted as a weak -symbol rather than a global. This is primarily useful in defining -library functions that can be overridden in user code, though it can -also be used with non-function declarations. Weak symbols are supported -for ELF targets, and also for a.out targets when using the GNU assembler -and linker. - -@item weakref -@itemx weakref ("@var{target}") -@cindex @code{weakref} function attribute -The @code{weakref} attribute marks a declaration as a weak reference. -Without arguments, it should be accompanied by an @code{alias} attribute -naming the target symbol. Optionally, the @var{target} may be given as -an argument to @code{weakref} itself. In either case, @code{weakref} -implicitly marks the declaration as @code{weak}. Without a -@var{target}, given as an argument to @code{weakref} or to @code{alias}, -@code{weakref} is equivalent to @code{weak}. - -@smallexample -static int x() __attribute__ ((weakref ("y"))); -/* is equivalent to... */ -static int x() __attribute__ ((weak, weakref, alias ("y"))); -/* and to... */ -static int x() __attribute__ ((weakref)); -static int x() __attribute__ ((alias ("y"))); -@end smallexample - -A weak reference is an alias that does not by itself require a -definition to be given for the target symbol. If the target symbol is -only referenced through weak references, then it becomes a @code{weak} -undefined symbol. If it is directly referenced, however, then such -strong references prevail, and a definition is required for the -symbol, not necessarily in the same translation unit. - -The effect is equivalent to moving all references to the alias to a -separate translation unit, renaming the alias to the aliased symbol, -declaring it as weak, compiling the two separate translation units and -performing a reloadable link on them. - -At present, a declaration to which @code{weakref} is attached can -only be @code{static}. - -@end table - -You can specify multiple attributes in a declaration by separating them -by commas within the double parentheses or by immediately following an -attribute declaration with another attribute declaration. - -@cindex @code{#pragma}, reason for not using -@cindex pragma, reason for not using -Some people object to the @code{__attribute__} feature, suggesting that -ISO C's @code{#pragma} should be used instead. At the time -@code{__attribute__} was designed, there were two reasons for not doing -this. - -@enumerate -@item -It is impossible to generate @code{#pragma} commands from a macro. - -@item -There is no telling what the same @code{#pragma} might mean in another -compiler. -@end enumerate - -These two reasons applied to almost any application that might have been -proposed for @code{#pragma}. It was basically a mistake to use -@code{#pragma} for @emph{anything}. - -The ISO C99 standard includes @code{_Pragma}, which now allows pragmas -to be generated from macros. In addition, a @code{#pragma GCC} -namespace is now in use for GCC-specific pragmas. However, it has been -found convenient to use @code{__attribute__} to achieve a natural -attachment of attributes to their corresponding declarations, whereas -@code{#pragma GCC} is of use for constructs that do not naturally form -part of the grammar. @xref{Pragmas,,Pragmas Accepted by GCC}. - -@node Label Attributes -@section Label Attributes -@cindex Label Attributes - -GCC allows attributes to be set on C labels. @xref{Attribute Syntax}, for -details of the exact syntax for using attributes. Other attributes are -available for functions (@pxref{Function Attributes}), variables -(@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}). - -This example uses the @code{cold} label attribute to indicate the -@code{ErrorHandling} branch is unlikely to be taken and that the -@code{ErrorHandling} label is unused: - -@smallexample - - asm goto ("some asm" : : : : NoError); - -/* This branch (the fall-through from the asm) is less commonly used */ -ErrorHandling: - __attribute__((cold, unused)); /* Semi-colon is required here */ - printf("error\n"); - return 0; - -NoError: - printf("no error\n"); - return 1; -@end smallexample - -@table @code -@item unused -@cindex @code{unused} label attribute -This feature is intended for program-generated code that may contain -unused labels, but which is compiled with @option{-Wall}. It is -not normally appropriate to use in it human-written code, though it -could be useful in cases where the code that jumps to the label is -contained within an @code{#ifdef} conditional. - -@item hot -@cindex @code{hot} label attribute -The @code{hot} attribute on a label is used to inform the compiler that -the path following the label is more likely than paths that are not so -annotated. This attribute is used in cases where @code{__builtin_expect} -cannot be used, for instance with computed goto or @code{asm goto}. - -@item cold -@cindex @code{cold} label attribute -The @code{cold} attribute on labels is used to inform the compiler that -the path following the label is unlikely to be executed. This attribute -is used in cases where @code{__builtin_expect} cannot be used, for instance -with computed goto or @code{asm goto}. - -@end table - -@node Attribute Syntax -@section Attribute Syntax -@cindex attribute syntax - -This section describes the syntax with which @code{__attribute__} may be -used, and the constructs to which attribute specifiers bind, for the C -language. Some details may vary for C++ and Objective-C@. Because of -infelicities in the grammar for attributes, some forms described here -may not be successfully parsed in all cases. - -There are some problems with the semantics of attributes in C++. For -example, there are no manglings for attributes, although they may affect -code generation, so problems may arise when attributed types are used in -conjunction with templates or overloading. Similarly, @code{typeid} -does not distinguish between types with different attributes. Support -for attributes in C++ may be restricted in future to attributes on -declarations only, but not on nested declarators. - -@xref{Function Attributes}, for details of the semantics of attributes -applying to functions. @xref{Variable Attributes}, for details of the -semantics of attributes applying to variables. @xref{Type Attributes}, -for details of the semantics of attributes applying to structure, union -and enumerated types. -@xref{Label Attributes}, for details of the semantics of attributes -applying to labels. - -An @dfn{attribute specifier} is of the form -@code{__attribute__ ((@var{attribute-list}))}. An @dfn{attribute list} -is a possibly empty comma-separated sequence of @dfn{attributes}, where -each attribute is one of the following: - -@itemize @bullet -@item -Empty. Empty attributes are ignored. - -@item -A word (which may be an identifier such as @code{unused}, or a reserved -word such as @code{const}). - -@item -A word, followed by, in parentheses, parameters for the attribute. -These parameters take one of the following forms: - -@itemize @bullet -@item -An identifier. For example, @code{mode} attributes use this form. - -@item -An identifier followed by a comma and a non-empty comma-separated list -of expressions. For example, @code{format} attributes use this form. - -@item -A possibly empty comma-separated list of expressions. For example, -@code{format_arg} attributes use this form with the list being a single -integer constant expression, and @code{alias} attributes use this form -with the list being a single string constant. -@end itemize -@end itemize - -An @dfn{attribute specifier list} is a sequence of one or more attribute -specifiers, not separated by any other tokens. - -@subsubheading Label Attributes - -In GNU C, an attribute specifier list may appear after the colon following a -label, other than a @code{case} or @code{default} label. GNU C++ only permits -attributes on labels if the attribute specifier is immediately -followed by a semicolon (i.e., the label applies to an empty -statement). If the semicolon is missing, C++ label attributes are -ambiguous, as it is permissible for a declaration, which could begin -with an attribute list, to be labelled in C++. Declarations cannot be -labelled in C90 or C99, so the ambiguity does not arise there. - -@subsubheading Type Attributes - -An attribute specifier list may appear as part of a @code{struct}, -@code{union} or @code{enum} specifier. It may go either immediately -after the @code{struct}, @code{union} or @code{enum} keyword, or after -the closing brace. The former syntax is preferred. -Where attribute specifiers follow the closing brace, they are considered -to relate to the structure, union or enumerated type defined, not to any -enclosing declaration the type specifier appears in, and the type -defined is not complete until after the attribute specifiers. -@c Otherwise, there would be the following problems: a shift/reduce -@c conflict between attributes binding the struct/union/enum and -@c binding to the list of specifiers/qualifiers; and "aligned" -@c attributes could use sizeof for the structure, but the size could be -@c changed later by "packed" attributes. - - -@subsubheading All other attributes - -Otherwise, an attribute specifier appears as part of a declaration, -counting declarations of unnamed parameters and type names, and relates -to that declaration (which may be nested in another declaration, for -example in the case of a parameter declaration), or to a particular declarator -within a declaration. Where an -attribute specifier is applied to a parameter declared as a function or -an array, it should apply to the function or array rather than the -pointer to which the parameter is implicitly converted, but this is not -yet correctly implemented. - -Any list of specifiers and qualifiers at the start of a declaration may -contain attribute specifiers, whether or not such a list may in that -context contain storage class specifiers. (Some attributes, however, -are essentially in the nature of storage class specifiers, and only make -sense where storage class specifiers may be used; for example, -@code{section}.) There is one necessary limitation to this syntax: the -first old-style parameter declaration in a function definition cannot -begin with an attribute specifier, because such an attribute applies to -the function instead by syntax described below (which, however, is not -yet implemented in this case). In some other cases, attribute -specifiers are permitted by this grammar but not yet supported by the -compiler. All attribute specifiers in this place relate to the -declaration as a whole. In the obsolescent usage where a type of -@code{int} is implied by the absence of type specifiers, such a list of -specifiers and qualifiers may be an attribute specifier list with no -other specifiers or qualifiers. - -At present, the first parameter in a function prototype must have some -type specifier that is not an attribute specifier; this resolves an -ambiguity in the interpretation of @code{void f(int -(__attribute__((foo)) x))}, but is subject to change. At present, if -the parentheses of a function declarator contain only attributes then -those attributes are ignored, rather than yielding an error or warning -or implying a single parameter of type int, but this is subject to -change. - -An attribute specifier list may appear immediately before a declarator -(other than the first) in a comma-separated list of declarators in a -declaration of more than one identifier using a single list of -specifiers and qualifiers. Such attribute specifiers apply -only to the identifier before whose declarator they appear. For -example, in - -@smallexample -__attribute__((noreturn)) void d0 (void), - __attribute__((format(printf, 1, 2))) d1 (const char *, ...), - d2 (void) -@end smallexample - -@noindent -the @code{noreturn} attribute applies to all the functions -declared; the @code{format} attribute only applies to @code{d1}. - -An attribute specifier list may appear immediately before the comma, -@code{=} or semicolon terminating the declaration of an identifier other -than a function definition. Such attribute specifiers apply -to the declared object or function. Where an -assembler name for an object or function is specified (@pxref{Asm -Labels}), the attribute must follow the @code{asm} -specification. - -An attribute specifier list may, in future, be permitted to appear after -the declarator in a function definition (before any old-style parameter -declarations or the function body). - -Attribute specifiers may be mixed with type qualifiers appearing inside -the @code{[]} of a parameter array declarator, in the C99 construct by -which such qualifiers are applied to the pointer to which the array is -implicitly converted. Such attribute specifiers apply to the pointer, -not to the array, but at present this is not implemented and they are -ignored. - -An attribute specifier list may appear at the start of a nested -declarator. At present, there are some limitations in this usage: the -attributes correctly apply to the declarator, but for most individual -attributes the semantics this implies are not implemented. -When attribute specifiers follow the @code{*} of a pointer -declarator, they may be mixed with any type qualifiers present. -The following describes the formal semantics of this syntax. It makes the -most sense if you are familiar with the formal specification of -declarators in the ISO C standard. - -Consider (as in C99 subclause 6.7.5 paragraph 4) a declaration @code{T -D1}, where @code{T} contains declaration specifiers that specify a type -@var{Type} (such as @code{int}) and @code{D1} is a declarator that -contains an identifier @var{ident}. The type specified for @var{ident} -for derived declarators whose type does not include an attribute -specifier is as in the ISO C standard. - -If @code{D1} has the form @code{( @var{attribute-specifier-list} D )}, -and the declaration @code{T D} specifies the type -``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then -@code{T D1} specifies the type ``@var{derived-declarator-type-list} -@var{attribute-specifier-list} @var{Type}'' for @var{ident}. - -If @code{D1} has the form @code{* -@var{type-qualifier-and-attribute-specifier-list} D}, and the -declaration @code{T D} specifies the type -``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then -@code{T D1} specifies the type ``@var{derived-declarator-type-list} -@var{type-qualifier-and-attribute-specifier-list} pointer to @var{Type}'' for -@var{ident}. - -For example, - -@smallexample -void (__attribute__((noreturn)) ****f) (void); -@end smallexample - -@noindent -specifies the type ``pointer to pointer to pointer to pointer to -non-returning function returning @code{void}''. As another example, - -@smallexample -char *__attribute__((aligned(8))) *f; -@end smallexample - -@noindent -specifies the type ``pointer to 8-byte-aligned pointer to @code{char}''. -Note again that this does not work with most attributes; for example, -the usage of @samp{aligned} and @samp{noreturn} attributes given above -is not yet supported. - -For compatibility with existing code written for compiler versions that -did not implement attributes on nested declarators, some laxity is -allowed in the placing of attributes. If an attribute that only applies -to types is applied to a declaration, it is treated as applying to -the type of that declaration. If an attribute that only applies to -declarations is applied to the type of a declaration, it is treated -as applying to that declaration; and, for compatibility with code -placing the attributes immediately before the identifier declared, such -an attribute applied to a function return type is treated as -applying to the function type, and such an attribute applied to an array -element type is treated as applying to the array type. If an -attribute that only applies to function types is applied to a -pointer-to-function type, it is treated as applying to the pointer -target type; if such an attribute is applied to a function return type -that is not a pointer-to-function type, it is treated as applying -to the function type. - -@node Function Prototypes -@section Prototypes and Old-Style Function Definitions -@cindex function prototype declarations -@cindex old-style function definitions -@cindex promotion of formal parameters - -GNU C extends ISO C to allow a function prototype to override a later -old-style non-prototype definition. Consider the following example: - -@smallexample -/* @r{Use prototypes unless the compiler is old-fashioned.} */ -#ifdef __STDC__ -#define P(x) x -#else -#define P(x) () -#endif - -/* @r{Prototype function declaration.} */ -int isroot P((uid_t)); - -/* @r{Old-style function definition.} */ -int -isroot (x) /* @r{??? lossage here ???} */ - uid_t x; -@{ - return x == 0; -@} -@end smallexample - -Suppose the type @code{uid_t} happens to be @code{short}. ISO C does -not allow this example, because subword arguments in old-style -non-prototype definitions are promoted. Therefore in this example the -function definition's argument is really an @code{int}, which does not -match the prototype argument type of @code{short}. - -This restriction of ISO C makes it hard to write code that is portable -to traditional C compilers, because the programmer does not know -whether the @code{uid_t} type is @code{short}, @code{int}, or -@code{long}. Therefore, in cases like these GNU C allows a prototype -to override a later old-style definition. More precisely, in GNU C, a -function prototype argument type overrides the argument type specified -by a later old-style definition if the former type is the same as the -latter type before promotion. Thus in GNU C the above example is -equivalent to the following: - -@smallexample -int isroot (uid_t); - -int -isroot (uid_t x) -@{ - return x == 0; -@} -@end smallexample - -@noindent -GNU C++ does not support old-style function definitions, so this -extension is irrelevant. - -@node C++ Comments -@section C++ Style Comments -@cindex @code{//} -@cindex C++ comments -@cindex comments, C++ style - -In GNU C, you may use C++ style comments, which start with @samp{//} and -continue until the end of the line. Many other C implementations allow -such comments, and they are included in the 1999 C standard. However, -C++ style comments are not recognized if you specify an @option{-std} -option specifying a version of ISO C before C99, or @option{-ansi} -(equivalent to @option{-std=c90}). - -@node Dollar Signs -@section Dollar Signs in Identifier Names -@cindex $ -@cindex dollar signs in identifier names -@cindex identifier names, dollar signs in - -In GNU C, you may normally use dollar signs in identifier names. -This is because many traditional C implementations allow such identifiers. -However, dollar signs in identifiers are not supported on a few target -machines, typically because the target assembler does not allow them. - -@node Character Escapes -@section The Character @key{ESC} in Constants - -You can use the sequence @samp{\e} in a string or character constant to -stand for the ASCII character @key{ESC}. - -@node Variable Attributes -@section Specifying Attributes of Variables -@cindex attribute of variables -@cindex variable attributes - -The keyword @code{__attribute__} allows you to specify special -attributes of variables or structure fields. This keyword is followed -by an attribute specification inside double parentheses. Some -attributes are currently defined generically for variables. -Other attributes are defined for variables on particular target -systems. Other attributes are available for functions -(@pxref{Function Attributes}), labels (@pxref{Label Attributes}) and for -types (@pxref{Type Attributes}). -Other front ends might define more attributes -(@pxref{C++ Extensions,,Extensions to the C++ Language}). - -You may also specify attributes with @samp{__} preceding and following -each keyword. This allows you to use them in header files without -being concerned about a possible macro of the same name. For example, -you may use @code{__aligned__} instead of @code{aligned}. - -@xref{Attribute Syntax}, for details of the exact syntax for using -attributes. - -@table @code -@cindex @code{aligned} variable attribute -@item aligned (@var{alignment}) -This attribute specifies a minimum alignment for the variable or -structure field, measured in bytes. For example, the declaration: - -@smallexample -int x __attribute__ ((aligned (16))) = 0; -@end smallexample - -@noindent -causes the compiler to allocate the global variable @code{x} on a -16-byte boundary. On a 68040, this could be used in conjunction with -an @code{asm} expression to access the @code{move16} instruction which -requires 16-byte aligned operands. - -You can also specify the alignment of structure fields. For example, to -create a double-word aligned @code{int} pair, you could write: - -@smallexample -struct foo @{ int x[2] __attribute__ ((aligned (8))); @}; -@end smallexample - -@noindent -This is an alternative to creating a union with a @code{double} member, -which forces the union to be double-word aligned. - -As in the preceding examples, you can explicitly specify the alignment -(in bytes) that you wish the compiler to use for a given variable or -structure field. Alternatively, you can leave out the alignment factor -and just ask the compiler to align a variable or field to the -default alignment for the target architecture you are compiling for. -The default alignment is sufficient for all scalar types, but may not be -enough for all vector types on a target that supports vector operations. -The default alignment is fixed for a particular target ABI. - -GCC also provides a target specific macro @code{__BIGGEST_ALIGNMENT__}, -which is the largest alignment ever used for any data type on the -target machine you are compiling for. For example, you could write: - -@smallexample -short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__))); -@end smallexample - -The compiler automatically sets the alignment for the declared -variable or field to @code{__BIGGEST_ALIGNMENT__}. Doing this can -often make copy operations more efficient, because the compiler can -use whatever instructions copy the biggest chunks of memory when -performing copies to or from the variables or fields that you have -aligned this way. Note that the value of @code{__BIGGEST_ALIGNMENT__} -may change depending on command-line options. - -When used on a struct, or struct member, the @code{aligned} attribute can -only increase the alignment; in order to decrease it, the @code{packed} -attribute must be specified as well. When used as part of a typedef, the -@code{aligned} attribute can both increase and decrease alignment, and -specifying the @code{packed} attribute generates a warning. - -Note that the effectiveness of @code{aligned} attributes may be limited -by inherent limitations in your linker. On many systems, the linker is -only able to arrange for variables to be aligned up to a certain maximum -alignment. (For some linkers, the maximum supported alignment may -be very very small.) If your linker is only able to align variables -up to a maximum of 8-byte alignment, then specifying @code{aligned(16)} -in an @code{__attribute__} still only provides you with 8-byte -alignment. See your linker documentation for further information. - -The @code{aligned} attribute can also be used for functions -(@pxref{Function Attributes}.) - -@item cleanup (@var{cleanup_function}) -@cindex @code{cleanup} variable attribute -The @code{cleanup} attribute runs a function when the variable goes -out of scope. This attribute can only be applied to auto function -scope variables; it may not be applied to parameters or variables -with static storage duration. The function must take one parameter, -a pointer to a type compatible with the variable. The return value -of the function (if any) is ignored. - -If @option{-fexceptions} is enabled, then @var{cleanup_function} -is run during the stack unwinding that happens during the -processing of the exception. Note that the @code{cleanup} attribute -does not allow the exception to be caught, only to perform an action. -It is undefined what happens if @var{cleanup_function} does not -return normally. - -@item common -@itemx nocommon -@cindex @code{common} variable attribute -@cindex @code{nocommon} variable attribute -@opindex fcommon -@opindex fno-common -The @code{common} attribute requests GCC to place a variable in -``common'' storage. The @code{nocommon} attribute requests the -opposite---to allocate space for it directly. - -These attributes override the default chosen by the -@option{-fno-common} and @option{-fcommon} flags respectively. - -@item deprecated -@itemx deprecated (@var{msg}) -@cindex @code{deprecated} variable attribute -The @code{deprecated} attribute results in a warning if the variable -is used anywhere in the source file. This is useful when identifying -variables that are expected to be removed in a future version of a -program. The warning also includes the location of the declaration -of the deprecated variable, to enable users to easily find further -information about why the variable is deprecated, or what they should -do instead. Note that the warning only occurs for uses: - -@smallexample -extern int old_var __attribute__ ((deprecated)); -extern int old_var; -int new_fn () @{ return old_var; @} -@end smallexample - -@noindent -results in a warning on line 3 but not line 2. The optional @var{msg} -argument, which must be a string, is printed in the warning if -present. - -The @code{deprecated} attribute can also be used for functions and -types (@pxref{Function Attributes}, @pxref{Type Attributes}.) - -@item mode (@var{mode}) -@cindex @code{mode} variable attribute -This attribute specifies the data type for the declaration---whichever -type corresponds to the mode @var{mode}. This in effect lets you -request an integer or floating-point type according to its width. - -You may also specify a mode of @code{byte} or @code{__byte__} to -indicate the mode corresponding to a one-byte integer, @code{word} or -@code{__word__} for the mode of a one-word integer, and @code{pointer} -or @code{__pointer__} for the mode used to represent pointers. - -@item packed -@cindex @code{packed} variable attribute -The @code{packed} attribute specifies that a variable or structure field -should have the smallest possible alignment---one byte for a variable, -and one bit for a field, unless you specify a larger value with the -@code{aligned} attribute. - -Here is a structure in which the field @code{x} is packed, so that it -immediately follows @code{a}: - -@smallexample -struct foo -@{ - char a; - int x[2] __attribute__ ((packed)); -@}; -@end smallexample - -@emph{Note:} The 4.1, 4.2 and 4.3 series of GCC ignore the -@code{packed} attribute on bit-fields of type @code{char}. This has -been fixed in GCC 4.4 but the change can lead to differences in the -structure layout. See the documentation of -@option{-Wpacked-bitfield-compat} for more information. - -@item section ("@var{section-name}") -@cindex @code{section} variable attribute -Normally, the compiler places the objects it generates in sections like -@code{data} and @code{bss}. Sometimes, however, you need additional sections, -or you need certain particular variables to appear in special sections, -for example to map to special hardware. The @code{section} -attribute specifies that a variable (or function) lives in a particular -section. For example, this small program uses several specific section names: - -@smallexample -struct duart a __attribute__ ((section ("DUART_A"))) = @{ 0 @}; -struct duart b __attribute__ ((section ("DUART_B"))) = @{ 0 @}; -char stack[10000] __attribute__ ((section ("STACK"))) = @{ 0 @}; -int init_data __attribute__ ((section ("INITDATA"))); - -main() -@{ - /* @r{Initialize stack pointer} */ - init_sp (stack + sizeof (stack)); - - /* @r{Initialize initialized data} */ - memcpy (&init_data, &data, &edata - &data); - - /* @r{Turn on the serial ports} */ - init_duart (&a); - init_duart (&b); -@} -@end smallexample - -@noindent -Use the @code{section} attribute with -@emph{global} variables and not @emph{local} variables, -as shown in the example. - -You may use the @code{section} attribute with initialized or -uninitialized global variables but the linker requires -each object be defined once, with the exception that uninitialized -variables tentatively go in the @code{common} (or @code{bss}) section -and can be multiply ``defined''. Using the @code{section} attribute -changes what section the variable goes into and may cause the -linker to issue an error if an uninitialized variable has multiple -definitions. You can force a variable to be initialized with the -@option{-fno-common} flag or the @code{nocommon} attribute. - -Some file formats do not support arbitrary sections so the @code{section} -attribute is not available on all platforms. -If you need to map the entire contents of a module to a particular -section, consider using the facilities of the linker instead. - -@item shared -@cindex @code{shared} variable attribute -On Microsoft Windows, in addition to putting variable definitions in a named -section, the section can also be shared among all running copies of an -executable or DLL@. For example, this small program defines shared data -by putting it in a named section @code{shared} and marking the section -shareable: - -@smallexample -int foo __attribute__((section ("shared"), shared)) = 0; - -int -main() -@{ - /* @r{Read and write foo. All running - copies see the same value.} */ - return 0; -@} -@end smallexample - -@noindent -You may only use the @code{shared} attribute along with @code{section} -attribute with a fully-initialized global definition because of the way -linkers work. See @code{section} attribute for more information. - -The @code{shared} attribute is only available on Microsoft Windows@. - -@item tls_model ("@var{tls_model}") -@cindex @code{tls_model} variable attribute -The @code{tls_model} attribute sets thread-local storage model -(@pxref{Thread-Local}) of a particular @code{__thread} variable, -overriding @option{-ftls-model=} command-line switch on a per-variable -basis. -The @var{tls_model} argument should be one of @code{global-dynamic}, -@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. - -Not all targets support this attribute. - -@item unused -@cindex @code{unused} variable attribute -This attribute, attached to a variable, means that the variable is meant -to be possibly unused. GCC does not produce a warning for this -variable. - -@item used -@cindex @code{used} variable attribute -This attribute, attached to a variable with static storage, means that -the variable must be emitted even if it appears that the variable is not -referenced. - -When applied to a static data member of a C++ class template, the -attribute also means that the member is instantiated if the -class itself is instantiated. - -@item vector_size (@var{bytes}) -@cindex @code{vector_size} variable attribute -This attribute specifies the vector size for the variable, measured in -bytes. For example, the declaration: - -@smallexample -int foo __attribute__ ((vector_size (16))); -@end smallexample - -@noindent -causes the compiler to set the mode for @code{foo}, to be 16 bytes, -divided into @code{int} sized units. Assuming a 32-bit int (a vector of -4 units of 4 bytes), the corresponding mode of @code{foo} is V4SI@. - -This attribute is only applicable to integral and float scalars, -although arrays, pointers, and function return values are allowed in -conjunction with this construct. - -Aggregates with this attribute are invalid, even if they are of the same -size as a corresponding scalar. For example, the declaration: - -@smallexample -struct S @{ int a; @}; -struct S __attribute__ ((vector_size (16))) foo; -@end smallexample - -@noindent -is invalid even if the size of the structure is the same as the size of -the @code{int}. - -@item selectany -@cindex @code{selectany} variable attribute -The @code{selectany} attribute causes an initialized global variable to -have link-once semantics. When multiple definitions of the variable are -encountered by the linker, the first is selected and the remainder are -discarded. Following usage by the Microsoft compiler, the linker is told -@emph{not} to warn about size or content differences of the multiple -definitions. - -Although the primary usage of this attribute is for POD types, the -attribute can also be applied to global C++ objects that are initialized -by a constructor. In this case, the static initialization and destruction -code for the object is emitted in each translation defining the object, -but the calls to the constructor and destructor are protected by a -link-once guard variable. - -The @code{selectany} attribute is only available on Microsoft Windows -targets. You can use @code{__declspec (selectany)} as a synonym for -@code{__attribute__ ((selectany))} for compatibility with other -compilers. - -@item weak -@cindex @code{weak} variable attribute -The @code{weak} attribute is described in @ref{Function Attributes}. - -@item dllimport -@cindex @code{dllimport} variable attribute -The @code{dllimport} attribute is described in @ref{Function Attributes}. - -@item dllexport -@cindex @code{dllexport} variable attribute -The @code{dllexport} attribute is described in @ref{Function Attributes}. - -@end table - -@anchor{AVR Variable Attributes} -@subsection AVR Variable Attributes - -@table @code -@item progmem -@cindex @code{progmem} variable attribute, AVR -The @code{progmem} attribute is used on the AVR to place read-only -data in the non-volatile program memory (flash). The @code{progmem} -attribute accomplishes this by putting respective variables into a -section whose name starts with @code{.progmem}. - -This attribute works similar to the @code{section} attribute -but adds additional checking. Notice that just like the -@code{section} attribute, @code{progmem} affects the location -of the data but not how this data is accessed. - -In order to read data located with the @code{progmem} attribute -(inline) assembler must be used. -@smallexample -/* Use custom macros from @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC}} */ -#include - -/* Locate var in flash memory */ -const int var[2] PROGMEM = @{ 1, 2 @}; - -int read_var (int i) -@{ - /* Access var[] by accessor macro from avr/pgmspace.h */ - return (int) pgm_read_word (& var[i]); -@} -@end smallexample - -AVR is a Harvard architecture processor and data and read-only data -normally resides in the data memory (RAM). - -See also the @ref{AVR Named Address Spaces} section for -an alternate way to locate and access data in flash memory. - -@item io -@itemx io (@var{addr}) -@cindex @code{io} variable attribute, AVR -Variables with the @code{io} attribute are used to address -memory-mapped peripherals in the io address range. -If an address is specified, the variable -is assigned that address, and the value is interpreted as an -address in the data address space. -Example: - -@smallexample -volatile int porta __attribute__((io (0x22))); -@end smallexample - -The address specified in the address in the data address range. - -Otherwise, the variable it is not assigned an address, but the -compiler will still use in/out instructions where applicable, -assuming some other module assigns an address in the io address range. -Example: - -@smallexample -extern volatile int porta __attribute__((io)); -@end smallexample - -@item io_low -@itemx io_low (@var{addr}) -@cindex @code{io_low} variable attribute, AVR -This is like the @code{io} attribute, but additionally it informs the -compiler that the object lies in the lower half of the I/O area, -allowing the use of @code{cbi}, @code{sbi}, @code{sbic} and @code{sbis} -instructions. - -@item address -@itemx address (@var{addr}) -@cindex @code{address} variable attribute, AVR -Variables with the @code{address} attribute are used to address -memory-mapped peripherals that may lie outside the io address range. - -@smallexample -volatile int porta __attribute__((address (0x600))); -@end smallexample - -@end table - -@subsection Blackfin Variable Attributes - -Three attributes are currently defined for the Blackfin. - -@table @code -@item l1_data -@itemx l1_data_A -@itemx l1_data_B -@cindex @code{l1_data} variable attribute, Blackfin -@cindex @code{l1_data_A} variable attribute, Blackfin -@cindex @code{l1_data_B} variable attribute, Blackfin -Use these attributes on the Blackfin to place the variable into L1 Data SRAM. -Variables with @code{l1_data} attribute are put into the specific section -named @code{.l1.data}. Those with @code{l1_data_A} attribute are put into -the specific section named @code{.l1.data.A}. Those with @code{l1_data_B} -attribute are put into the specific section named @code{.l1.data.B}. - -@item l2 -@cindex @code{l2} variable attribute, Blackfin -Use this attribute on the Blackfin to place the variable into L2 SRAM. -Variables with @code{l2} attribute are put into the specific section -named @code{.l2.data}. -@end table - -@subsection H8/300 Variable Attributes - -These variable attributes are available for H8/300 targets: - -@table @code -@item eightbit_data -@cindex @code{eightbit_data} variable attribute, H8/300 -@cindex eight-bit data on the H8/300, H8/300H, and H8S -Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified -variable should be placed into the eight-bit data section. -The compiler generates more efficient code for certain operations -on data in the eight-bit data area. Note the eight-bit data area is limited to -256 bytes of data. - -You must use GAS and GLD from GNU binutils version 2.7 or later for -this attribute to work correctly. - -@item tiny_data -@cindex @code{tiny_data} variable attribute, H8/300 -@cindex tiny data section on the H8/300H and H8S -Use this attribute on the H8/300H and H8S to indicate that the specified -variable should be placed into the tiny data section. -The compiler generates more efficient code for loads and stores -on data in the tiny data section. Note the tiny data area is limited to -slightly under 32KB of data. - -@end table - -@subsection IA-64 Variable Attributes - -The IA-64 back end supports the following variable attribute: - -@table @code -@item model (@var{model-name}) -@cindex @code{model} variable attribute, IA-64 - -On IA-64, use this attribute to set the addressability of an object. -At present, the only supported identifier for @var{model-name} is -@code{small}, indicating addressability via ``small'' (22-bit) -addresses (so that their addresses can be loaded with the @code{addl} -instruction). Caveat: such addressing is by definition not position -independent and hence this attribute must not be used for objects -defined by shared libraries. - -@end table - -@subsection M32R/D Variable Attributes - -One attribute is currently defined for the M32R/D@. - -@table @code -@item model (@var{model-name}) -@cindex @code{model-name} variable attribute, M32R/D -@cindex variable addressability on the M32R/D -Use this attribute on the M32R/D to set the addressability of an object. -The identifier @var{model-name} is one of @code{small}, @code{medium}, -or @code{large}, representing each of the code models. - -Small model objects live in the lower 16MB of memory (so that their -addresses can be loaded with the @code{ld24} instruction). - -Medium and large model objects may live anywhere in the 32-bit address space -(the compiler generates @code{seth/add3} instructions to load their -addresses). -@end table - -@anchor{MeP Variable Attributes} -@subsection MeP Variable Attributes - -The MeP target has a number of addressing modes and busses. The -@code{near} space spans the standard memory space's first 16 megabytes -(24 bits). The @code{far} space spans the entire 32-bit memory space. -The @code{based} space is a 128-byte region in the memory space that -is addressed relative to the @code{$tp} register. The @code{tiny} -space is a 65536-byte region relative to the @code{$gp} register. In -addition to these memory regions, the MeP target has a separate 16-bit -control bus which is specified with @code{cb} attributes. - -@table @code - -@item based -@cindex @code{based} variable attribute, MeP -Any variable with the @code{based} attribute is assigned to the -@code{.based} section, and is accessed with relative to the -@code{$tp} register. - -@item tiny -@cindex @code{tiny} variable attribute, MeP -Likewise, the @code{tiny} attribute assigned variables to the -@code{.tiny} section, relative to the @code{$gp} register. - -@item near -@cindex @code{near} variable attribute, MeP -Variables with the @code{near} attribute are assumed to have addresses -that fit in a 24-bit addressing mode. This is the default for large -variables (@code{-mtiny=4} is the default) but this attribute can -override @code{-mtiny=} for small variables, or override @code{-ml}. - -@item far -@cindex @code{far} variable attribute, MeP -Variables with the @code{far} attribute are addressed using a full -32-bit address. Since this covers the entire memory space, this -allows modules to make no assumptions about where variables might be -stored. - -@item io -@cindex @code{io} variable attribute, MeP -@itemx io (@var{addr}) -Variables with the @code{io} attribute are used to address -memory-mapped peripherals. If an address is specified, the variable -is assigned that address, else it is not assigned an address (it is -assumed some other module assigns an address). Example: - -@smallexample -int timer_count __attribute__((io(0x123))); -@end smallexample - -@item cb -@itemx cb (@var{addr}) -@cindex @code{cb} variable attribute, MeP -Variables with the @code{cb} attribute are used to access the control -bus, using special instructions. @code{addr} indicates the control bus -address. Example: - -@smallexample -int cpu_clock __attribute__((cb(0x123))); -@end smallexample - -@end table - -@subsection PowerPC Variable Attributes - -Three attributes currently are defined for PowerPC configurations: -@code{altivec}, @code{ms_struct} and @code{gcc_struct}. - -@cindex @code{ms_struct} variable attribute, PowerPC -@cindex @code{gcc_struct} variable attribute, PowerPC -For full documentation of the struct attributes please see the -documentation in @ref{x86 Variable Attributes}. - -@cindex @code{altivec} variable attribute, PowerPC -For documentation of @code{altivec} attribute please see the -documentation in @ref{PowerPC Type Attributes}. - -@subsection SPU Variable Attributes - -@cindex @code{spu_vector} variable attribute, SPU -The SPU supports the @code{spu_vector} attribute for variables. For -documentation of this attribute please see the documentation in -@ref{SPU Type Attributes}. - -@anchor{x86 Variable Attributes} -@subsection x86 Variable Attributes - -Two attributes are currently defined for x86 configurations: -@code{ms_struct} and @code{gcc_struct}. - -@table @code -@item ms_struct -@itemx gcc_struct -@cindex @code{ms_struct} variable attribute, x86 -@cindex @code{gcc_struct} variable attribute, x86 - -If @code{packed} is used on a structure, or if bit-fields are used, -it may be that the Microsoft ABI lays out the structure differently -than the way GCC normally does. Particularly when moving packed -data between functions compiled with GCC and the native Microsoft compiler -(either via function call or as data in a file), it may be necessary to access -either format. - -Currently @option{-m[no-]ms-bitfields} is provided for the Microsoft Windows x86 -compilers to match the native Microsoft compiler. - -The Microsoft structure layout algorithm is fairly simple with the exception -of the bit-field packing. -The padding and alignment of members of structures and whether a bit-field -can straddle a storage-unit boundary are determine by these rules: - -@enumerate -@item Structure members are stored sequentially in the order in which they are -declared: the first member has the lowest memory address and the last member -the highest. - -@item Every data object has an alignment requirement. The alignment requirement -for all data except structures, unions, and arrays is either the size of the -object or the current packing size (specified with either the -@code{aligned} attribute or the @code{pack} pragma), -whichever is less. For structures, unions, and arrays, -the alignment requirement is the largest alignment requirement of its members. -Every object is allocated an offset so that: - -@smallexample -offset % alignment_requirement == 0 -@end smallexample - -@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation -unit if the integral types are the same size and if the next bit-field fits -into the current allocation unit without crossing the boundary imposed by the -common alignment requirements of the bit-fields. -@end enumerate - -MSVC interprets zero-length bit-fields in the following ways: - -@enumerate -@item If a zero-length bit-field is inserted between two bit-fields that -are normally coalesced, the bit-fields are not coalesced. - -For example: - -@smallexample -struct - @{ - unsigned long bf_1 : 12; - unsigned long : 0; - unsigned long bf_2 : 12; - @} t1; -@end smallexample - -@noindent -The size of @code{t1} is 8 bytes with the zero-length bit-field. If the -zero-length bit-field were removed, @code{t1}'s size would be 4 bytes. - -@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the -alignment of the zero-length bit-field is greater than the member that follows it, -@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field. - -For example: - -@smallexample -struct - @{ - char foo : 4; - short : 0; - char bar; - @} t2; - -struct - @{ - char foo : 4; - short : 0; - double bar; - @} t3; -@end smallexample - -@noindent -For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1. -Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length -bit-field does not affect the alignment of @code{bar} or, as a result, the size -of the structure. - -Taking this into account, it is important to note the following: - -@enumerate -@item If a zero-length bit-field follows a normal bit-field, the type of the -zero-length bit-field may affect the alignment of the structure as whole. For -example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a -normal bit-field, and is of type short. - -@item Even if a zero-length bit-field is not followed by a normal bit-field, it may -still affect the alignment of the structure: - -@smallexample -struct - @{ - char foo : 6; - long : 0; - @} t4; -@end smallexample - -@noindent -Here, @code{t4} takes up 4 bytes. -@end enumerate - -@item Zero-length bit-fields following non-bit-field members are ignored: - -@smallexample -struct - @{ - char foo; - long : 0; - char bar; - @} t5; -@end smallexample - -@noindent -Here, @code{t5} takes up 2 bytes. -@end enumerate -@end table - -@subsection Xstormy16 Variable Attributes - -One attribute is currently defined for xstormy16 configurations: -@code{below100}. - -@table @code -@item below100 -@cindex @code{below100} variable attribute, Xstormy16 - -If a variable has the @code{below100} attribute (@code{BELOW100} is -allowed also), GCC places the variable in the first 0x100 bytes of -memory and use special opcodes to access it. Such variables are -placed in either the @code{.bss_below100} section or the -@code{.data_below100} section. - -@end table - -@node Type Attributes -@section Specifying Attributes of Types -@cindex attribute of types -@cindex type attributes - -The keyword @code{__attribute__} allows you to specify special -attributes of @code{struct} and @code{union} types when you define -such types. This keyword is followed by an attribute specification -inside double parentheses. Eight attributes are currently defined for -types: @code{aligned}, @code{packed}, @code{transparent_union}, -@code{unused}, @code{deprecated}, @code{visibility}, @code{may_alias} -and @code{bnd_variable_size}. Other attributes are defined for -functions (@pxref{Function Attributes}), labels (@pxref{Label -Attributes}) and for variables (@pxref{Variable Attributes}). - -You may also specify any one of these attributes with @samp{__} -preceding and following its keyword. This allows you to use these -attributes in header files without being concerned about a possible -macro of the same name. For example, you may use @code{__aligned__} -instead of @code{aligned}. - -You may specify type attributes in an enum, struct or union type -declaration or definition, or for other types in a @code{typedef} -declaration. - -For an enum, struct or union type, you may specify attributes either -between the enum, struct or union tag and the name of the type, or -just past the closing curly brace of the @emph{definition}. The -former syntax is preferred. - -@xref{Attribute Syntax}, for details of the exact syntax for using -attributes. - -@table @code -@cindex @code{aligned} type attribute -@item aligned (@var{alignment}) -This attribute specifies a minimum alignment (in bytes) for variables -of the specified type. For example, the declarations: - -@smallexample -struct S @{ short f[3]; @} __attribute__ ((aligned (8))); -typedef int more_aligned_int __attribute__ ((aligned (8))); -@end smallexample - -@noindent -force the compiler to ensure (as far as it can) that each variable whose -type is @code{struct S} or @code{more_aligned_int} is allocated and -aligned @emph{at least} on a 8-byte boundary. On a SPARC, having all -variables of type @code{struct S} aligned to 8-byte boundaries allows -the compiler to use the @code{ldd} and @code{std} (doubleword load and -store) instructions when copying one variable of type @code{struct S} to -another, thus improving run-time efficiency. - -Note that the alignment of any given @code{struct} or @code{union} type -is required by the ISO C standard to be at least a perfect multiple of -the lowest common multiple of the alignments of all of the members of -the @code{struct} or @code{union} in question. This means that you @emph{can} -effectively adjust the alignment of a @code{struct} or @code{union} -type by attaching an @code{aligned} attribute to any one of the members -of such a type, but the notation illustrated in the example above is a -more obvious, intuitive, and readable way to request the compiler to -adjust the alignment of an entire @code{struct} or @code{union} type. - -As in the preceding example, you can explicitly specify the alignment -(in bytes) that you wish the compiler to use for a given @code{struct} -or @code{union} type. Alternatively, you can leave out the alignment factor -and just ask the compiler to align a type to the maximum -useful alignment for the target machine you are compiling for. For -example, you could write: - -@smallexample -struct S @{ short f[3]; @} __attribute__ ((aligned)); -@end smallexample - -Whenever you leave out the alignment factor in an @code{aligned} -attribute specification, the compiler automatically sets the alignment -for the type to the largest alignment that is ever used for any data -type on the target machine you are compiling for. Doing this can often -make copy operations more efficient, because the compiler can use -whatever instructions copy the biggest chunks of memory when performing -copies to or from the variables that have types that you have aligned -this way. - -In the example above, if the size of each @code{short} is 2 bytes, then -the size of the entire @code{struct S} type is 6 bytes. The smallest -power of two that is greater than or equal to that is 8, so the -compiler sets the alignment for the entire @code{struct S} type to 8 -bytes. - -Note that although you can ask the compiler to select a time-efficient -alignment for a given type and then declare only individual stand-alone -objects of that type, the compiler's ability to select a time-efficient -alignment is primarily useful only when you plan to create arrays of -variables having the relevant (efficiently aligned) type. If you -declare or use arrays of variables of an efficiently-aligned type, then -it is likely that your program also does pointer arithmetic (or -subscripting, which amounts to the same thing) on pointers to the -relevant type, and the code that the compiler generates for these -pointer arithmetic operations is often more efficient for -efficiently-aligned types than for other types. - -The @code{aligned} attribute can only increase the alignment; but you -can decrease it by specifying @code{packed} as well. See below. - -Note that the effectiveness of @code{aligned} attributes may be limited -by inherent limitations in your linker. On many systems, the linker is -only able to arrange for variables to be aligned up to a certain maximum -alignment. (For some linkers, the maximum supported alignment may -be very very small.) If your linker is only able to align variables -up to a maximum of 8-byte alignment, then specifying @code{aligned(16)} -in an @code{__attribute__} still only provides you with 8-byte -alignment. See your linker documentation for further information. - -@item packed -@cindex @code{packed} type attribute -This attribute, attached to @code{struct} or @code{union} type -definition, specifies that each member (other than zero-width bit-fields) -of the structure or union is placed to minimize the memory required. When -attached to an @code{enum} definition, it indicates that the smallest -integral type should be used. - -@opindex fshort-enums -Specifying this attribute for @code{struct} and @code{union} types is -equivalent to specifying the @code{packed} attribute on each of the -structure or union members. Specifying the @option{-fshort-enums} -flag on the line is equivalent to specifying the @code{packed} -attribute on all @code{enum} definitions. - -In the following example @code{struct my_packed_struct}'s members are -packed closely together, but the internal layout of its @code{s} member -is not packed---to do that, @code{struct my_unpacked_struct} needs to -be packed too. - -@smallexample -struct my_unpacked_struct - @{ - char c; - int i; - @}; - -struct __attribute__ ((__packed__)) my_packed_struct - @{ - char c; - int i; - struct my_unpacked_struct s; - @}; -@end smallexample - -You may only specify this attribute on the definition of an @code{enum}, -@code{struct} or @code{union}, not on a @code{typedef} that does not -also define the enumerated type, structure or union. - -@item transparent_union -@cindex @code{transparent_union} type attribute - -This attribute, attached to a @code{union} type definition, indicates -that any function parameter having that union type causes calls to that -function to be treated in a special way. - -First, the argument corresponding to a transparent union type can be of -any type in the union; no cast is required. Also, if the union contains -a pointer type, the corresponding argument can be a null pointer -constant or a void pointer expression; and if the union contains a void -pointer type, the corresponding argument can be any pointer expression. -If the union member type is a pointer, qualifiers like @code{const} on -the referenced type must be respected, just as with normal pointer -conversions. - -Second, the argument is passed to the function using the calling -conventions of the first member of the transparent union, not the calling -conventions of the union itself. All members of the union must have the -same machine representation; this is necessary for this argument passing -to work properly. - -Transparent unions are designed for library functions that have multiple -interfaces for compatibility reasons. For example, suppose the -@code{wait} function must accept either a value of type @code{int *} to -comply with POSIX, or a value of type @code{union wait *} to comply with -the 4.1BSD interface. If @code{wait}'s parameter were @code{void *}, -@code{wait} would accept both kinds of arguments, but it would also -accept any other pointer type and this would make argument type checking -less useful. Instead, @code{} might define the interface -as follows: - -@smallexample -typedef union __attribute__ ((__transparent_union__)) - @{ - int *__ip; - union wait *__up; - @} wait_status_ptr_t; - -pid_t wait (wait_status_ptr_t); -@end smallexample - -@noindent -This interface allows either @code{int *} or @code{union wait *} -arguments to be passed, using the @code{int *} calling convention. -The program can call @code{wait} with arguments of either type: - -@smallexample -int w1 () @{ int w; return wait (&w); @} -int w2 () @{ union wait w; return wait (&w); @} -@end smallexample - -@noindent -With this interface, @code{wait}'s implementation might look like this: - -@smallexample -pid_t wait (wait_status_ptr_t p) -@{ - return waitpid (-1, p.__ip, 0); -@} -@end smallexample - -@item unused -@cindex @code{unused} type attribute -When attached to a type (including a @code{union} or a @code{struct}), -this attribute means that variables of that type are meant to appear -possibly unused. GCC does not produce a warning for any variables of -that type, even if the variable appears to do nothing. This is often -the case with lock or thread classes, which are usually defined and then -not referenced, but contain constructors and destructors that have -nontrivial bookkeeping functions. - -@item deprecated -@itemx deprecated (@var{msg}) -@cindex @code{deprecated} type attribute -The @code{deprecated} attribute results in a warning if the type -is used anywhere in the source file. This is useful when identifying -types that are expected to be removed in a future version of a program. -If possible, the warning also includes the location of the declaration -of the deprecated type, to enable users to easily find further -information about why the type is deprecated, or what they should do -instead. Note that the warnings only occur for uses and then only -if the type is being applied to an identifier that itself is not being -declared as deprecated. - -@smallexample -typedef int T1 __attribute__ ((deprecated)); -T1 x; -typedef T1 T2; -T2 y; -typedef T1 T3 __attribute__ ((deprecated)); -T3 z __attribute__ ((deprecated)); -@end smallexample - -@noindent -results in a warning on line 2 and 3 but not lines 4, 5, or 6. No -warning is issued for line 4 because T2 is not explicitly -deprecated. Line 5 has no warning because T3 is explicitly -deprecated. Similarly for line 6. The optional @var{msg} -argument, which must be a string, is printed in the warning if -present. - -The @code{deprecated} attribute can also be used for functions and -variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.) - -@item may_alias -@cindex @code{may_alias} type attribute -Accesses through pointers to types with this attribute are not subject -to type-based alias analysis, but are instead assumed to be able to alias -any other type of objects. -In the context of section 6.5 paragraph 7 of the C99 standard, -an lvalue expression -dereferencing such a pointer is treated like having a character type. -See @option{-fstrict-aliasing} for more information on aliasing issues. -This extension exists to support some vector APIs, in which pointers to -one vector type are permitted to alias pointers to a different vector type. - -Note that an object of a type with this attribute does not have any -special semantics. - -Example of use: - -@smallexample -typedef short __attribute__((__may_alias__)) short_a; - -int -main (void) -@{ - int a = 0x12345678; - short_a *b = (short_a *) &a; - - b[1] = 0; - - if (a == 0x12345678) - abort(); - - exit(0); -@} -@end smallexample - -@noindent -If you replaced @code{short_a} with @code{short} in the variable -declaration, the above program would abort when compiled with -@option{-fstrict-aliasing}, which is on by default at @option{-O2} or -above. - -@item visibility -@cindex @code{visibility} type attribute -In C++, attribute visibility (@pxref{Function Attributes}) can also be -applied to class, struct, union and enum types. Unlike other type -attributes, the attribute must appear between the initial keyword and -the name of the type; it cannot appear after the body of the type. - -Note that the type visibility is applied to vague linkage entities -associated with the class (vtable, typeinfo node, etc.). In -particular, if a class is thrown as an exception in one shared object -and caught in another, the class must have default visibility. -Otherwise the two shared objects are unable to use the same -typeinfo node and exception handling will break. - -@item designated_init -@cindex @code{designated_init} type attribute -This attribute may only be applied to structure types. It indicates -that any initialization of an object of this type must use designated -initializers rather than positional initializers. The intent of this -attribute is to allow the programmer to indicate that a structure's -layout may change, and that therefore relying on positional -initialization will result in future breakage. - -GCC emits warnings based on this attribute by default; use -@option{-Wno-designated-init} to suppress them. - -@item bnd_variable_size -@cindex @code{bnd_variable_size} type attribute -@cindex Pointer Bounds Checker attributes -When applied to a structure field, this attribute tells Pointer -Bounds Checker that the size of this field should not be computed -using static type information. It may be used to mark variably-sized -static array fields placed at the end of a structure. - -@smallexample -struct S -@{ - int size; - char data[1]; -@} -S *p = (S *)malloc (sizeof(S) + 100); -p->data[10] = 0; //Bounds violation -@end smallexample - -@noindent -By using an attribute for the field we may avoid unwanted bound -violation checks: - -@smallexample -struct S -@{ - int size; - char data[1] __attribute__((bnd_variable_size)); -@} -S *p = (S *)malloc (sizeof(S) + 100); -p->data[10] = 0; //OK -@end smallexample - -@end table - -To specify multiple attributes, separate them by commas within the -double parentheses: for example, @samp{__attribute__ ((aligned (16), -packed))}. - -@subsection ARM Type Attributes - -@cindex @code{notshared} type attribute, ARM -On those ARM targets that support @code{dllimport} (such as Symbian -OS), you can use the @code{notshared} attribute to indicate that the -virtual table and other similar data for a class should not be -exported from a DLL@. For example: - -@smallexample -class __declspec(notshared) C @{ -public: - __declspec(dllimport) C(); - virtual void f(); -@} - -__declspec(dllexport) -C::C() @{@} -@end smallexample - -@noindent -In this code, @code{C::C} is exported from the current DLL, but the -virtual table for @code{C} is not exported. (You can use -@code{__attribute__} instead of @code{__declspec} if you prefer, but -most Symbian OS code uses @code{__declspec}.) - -@anchor{MeP Type Attributes} -@subsection MeP Type Attributes - -@cindex @code{based} type attribute, MeP -@cindex @code{tiny} type attribute, MeP -@cindex @code{near} type attribute, MeP -@cindex @code{far} type attribute, MeP -Many of the MeP variable attributes may be applied to types as well. -Specifically, the @code{based}, @code{tiny}, @code{near}, and -@code{far} attributes may be applied to either. The @code{io} and -@code{cb} attributes may not be applied to types. - -@anchor{PowerPC Type Attributes} -@subsection PowerPC Type Attributes - -Three attributes currently are defined for PowerPC configurations: -@code{altivec}, @code{ms_struct} and @code{gcc_struct}. - -@cindex @code{ms_struct} type attribute, PowerPC -@cindex @code{gcc_struct} type attribute, PowerPC -For full documentation of the @code{ms_struct} and @code{gcc_struct} -attributes please see the documentation in @ref{x86 Type Attributes}. - -@cindex @code{altivec} type attribute, PowerPC -The @code{altivec} attribute allows one to declare AltiVec vector data -types supported by the AltiVec Programming Interface Manual. The -attribute requires an argument to specify one of three vector types: -@code{vector__}, @code{pixel__} (always followed by unsigned short), -and @code{bool__} (always followed by unsigned). - -@smallexample -__attribute__((altivec(vector__))) -__attribute__((altivec(pixel__))) unsigned short -__attribute__((altivec(bool__))) unsigned -@end smallexample - -These attributes mainly are intended to support the @code{__vector}, -@code{__pixel}, and @code{__bool} AltiVec keywords. - -@anchor{SPU Type Attributes} -@subsection SPU Type Attributes - -@cindex @code{spu_vector} type attribute, SPU -The SPU supports the @code{spu_vector} attribute for types. This attribute -allows one to declare vector data types supported by the Sony/Toshiba/IBM SPU -Language Extensions Specification. It is intended to support the -@code{__vector} keyword. - -@anchor{x86 Type Attributes} -@subsection x86 Type Attributes - -Two attributes are currently defined for x86 configurations: -@code{ms_struct} and @code{gcc_struct}. - -@table @code - -@item ms_struct -@itemx gcc_struct -@cindex @code{ms_struct} type attribute, x86 -@cindex @code{gcc_struct} type attribute, x86 - -If @code{packed} is used on a structure, or if bit-fields are used -it may be that the Microsoft ABI packs them differently -than GCC normally packs them. Particularly when moving packed -data between functions compiled with GCC and the native Microsoft compiler -(either via function call or as data in a file), it may be necessary to access -either format. - -Currently @option{-m[no-]ms-bitfields} is provided for the Microsoft Windows x86 -compilers to match the native Microsoft compiler. -@end table - -@node Alignment -@section Inquiring on Alignment of Types or Variables -@cindex alignment -@cindex type alignment -@cindex variable alignment - -The keyword @code{__alignof__} allows you to inquire about how an object -is aligned, or the minimum alignment usually required by a type. Its -syntax is just like @code{sizeof}. - -For example, if the target machine requires a @code{double} value to be -aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8. -This is true on many RISC machines. On more traditional machine -designs, @code{__alignof__ (double)} is 4 or even 2. - -Some machines never actually require alignment; they allow reference to any -data type even at an odd address. For these machines, @code{__alignof__} -reports the smallest alignment that GCC gives the data type, usually as -mandated by the target ABI. - -If the operand of @code{__alignof__} is an lvalue rather than a type, -its value is the required alignment for its type, taking into account -any minimum alignment specified with GCC's @code{__attribute__} -extension (@pxref{Variable Attributes}). For example, after this -declaration: - -@smallexample -struct foo @{ int x; char y; @} foo1; -@end smallexample - -@noindent -the value of @code{__alignof__ (foo1.y)} is 1, even though its actual -alignment is probably 2 or 4, the same as @code{__alignof__ (int)}. - -It is an error to ask for the alignment of an incomplete type. - - -@node Inline -@section An Inline Function is As Fast As a Macro -@cindex inline functions -@cindex integrating function code -@cindex open coding -@cindex macros, inline alternative - -By declaring a function inline, you can direct GCC to make -calls to that function faster. One way GCC can achieve this is to -integrate that function's code into the code for its callers. This -makes execution faster by eliminating the function-call overhead; in -addition, if any of the actual argument values are constant, their -known values may permit simplifications at compile time so that not -all of the inline function's code needs to be included. The effect on -code size is less predictable; object code may be larger or smaller -with function inlining, depending on the particular case. You can -also direct GCC to try to integrate all ``simple enough'' functions -into their callers with the option @option{-finline-functions}. - -GCC implements three different semantics of declaring a function -inline. One is available with @option{-std=gnu89} or -@option{-fgnu89-inline} or when @code{gnu_inline} attribute is present -on all inline declarations, another when -@option{-std=c99}, @option{-std=c11}, -@option{-std=gnu99} or @option{-std=gnu11} -(without @option{-fgnu89-inline}), and the third -is used when compiling C++. - -To declare a function inline, use the @code{inline} keyword in its -declaration, like this: - -@smallexample -static inline int -inc (int *a) -@{ - return (*a)++; -@} -@end smallexample - -If you are writing a header file to be included in ISO C90 programs, write -@code{__inline__} instead of @code{inline}. @xref{Alternate Keywords}. - -The three types of inlining behave similarly in two important cases: -when the @code{inline} keyword is used on a @code{static} function, -like the example above, and when a function is first declared without -using the @code{inline} keyword and then is defined with -@code{inline}, like this: - -@smallexample -extern int inc (int *a); -inline int -inc (int *a) -@{ - return (*a)++; -@} -@end smallexample - -In both of these common cases, the program behaves the same as if you -had not used the @code{inline} keyword, except for its speed. - -@cindex inline functions, omission of -@opindex fkeep-inline-functions -When a function is both inline and @code{static}, if all calls to the -function are integrated into the caller, and the function's address is -never used, then the function's own assembler code is never referenced. -In this case, GCC does not actually output assembler code for the -function, unless you specify the option @option{-fkeep-inline-functions}. -Some calls cannot be integrated for various reasons (in particular, -calls that precede the function's definition cannot be integrated, and -neither can recursive calls within the definition). If there is a -nonintegrated call, then the function is compiled to assembler code as -usual. The function must also be compiled as usual if the program -refers to its address, because that can't be inlined. - -@opindex Winline -Note that certain usages in a function definition can make it unsuitable -for inline substitution. Among these usages are: variadic functions, use of -@code{alloca}, use of variable-length data types (@pxref{Variable Length}), -use of computed goto (@pxref{Labels as Values}), use of nonlocal goto, -and nested functions (@pxref{Nested Functions}). Using @option{-Winline} -warns when a function marked @code{inline} could not be substituted, -and gives the reason for the failure. - -@cindex automatic @code{inline} for C++ member fns -@cindex @code{inline} automatic for C++ member fns -@cindex member fns, automatically @code{inline} -@cindex C++ member fns, automatically @code{inline} -@opindex fno-default-inline -As required by ISO C++, GCC considers member functions defined within -the body of a class to be marked inline even if they are -not explicitly declared with the @code{inline} keyword. You can -override this with @option{-fno-default-inline}; @pxref{C++ Dialect -Options,,Options Controlling C++ Dialect}. - -GCC does not inline any functions when not optimizing unless you specify -the @samp{always_inline} attribute for the function, like this: - -@smallexample -/* @r{Prototype.} */ -inline void foo (const char) __attribute__((always_inline)); -@end smallexample - -The remainder of this section is specific to GNU C90 inlining. - -@cindex non-static inline function -When an inline function is not @code{static}, then the compiler must assume -that there may be calls from other source files; since a global symbol can -be defined only once in any program, the function must not be defined in -the other source files, so the calls therein cannot be integrated. -Therefore, a non-@code{static} inline function is always compiled on its -own in the usual fashion. - -If you specify both @code{inline} and @code{extern} in the function -definition, then the definition is used only for inlining. In no case -is the function compiled on its own, not even if you refer to its -address explicitly. Such an address becomes an external reference, as -if you had only declared the function, and had not defined it. - -This combination of @code{inline} and @code{extern} has almost the -effect of a macro. The way to use it is to put a function definition in -a header file with these keywords, and put another copy of the -definition (lacking @code{inline} and @code{extern}) in a library file. -The definition in the header file causes most calls to the function -to be inlined. If any uses of the function remain, they refer to -the single copy in the library. - -@node Volatiles -@section When is a Volatile Object Accessed? -@cindex accessing volatiles -@cindex volatile read -@cindex volatile write -@cindex volatile access - -C has the concept of volatile objects. These are normally accessed by -pointers and used for accessing hardware or inter-thread -communication. The standard encourages compilers to refrain from -optimizations concerning accesses to volatile objects, but leaves it -implementation defined as to what constitutes a volatile access. The -minimum requirement is that at a sequence point all previous accesses -to volatile objects have stabilized and no subsequent accesses have -occurred. Thus an implementation is free to reorder and combine -volatile accesses that occur between sequence points, but cannot do -so for accesses across a sequence point. The use of volatile does -not allow you to violate the restriction on updating objects multiple -times between two sequence points. - -Accesses to non-volatile objects are not ordered with respect to -volatile accesses. You cannot use a volatile object as a memory -barrier to order a sequence of writes to non-volatile memory. For -instance: - -@smallexample -int *ptr = @var{something}; -volatile int vobj; -*ptr = @var{something}; -vobj = 1; -@end smallexample - -@noindent -Unless @var{*ptr} and @var{vobj} can be aliased, it is not guaranteed -that the write to @var{*ptr} occurs by the time the update -of @var{vobj} happens. If you need this guarantee, you must use -a stronger memory barrier such as: - -@smallexample -int *ptr = @var{something}; -volatile int vobj; -*ptr = @var{something}; -asm volatile ("" : : : "memory"); -vobj = 1; -@end smallexample - -A scalar volatile object is read when it is accessed in a void context: - -@smallexample -volatile int *src = @var{somevalue}; -*src; -@end smallexample - -Such expressions are rvalues, and GCC implements this as a -read of the volatile object being pointed to. - -Assignments are also expressions and have an rvalue. However when -assigning to a scalar volatile, the volatile object is not reread, -regardless of whether the assignment expression's rvalue is used or -not. If the assignment's rvalue is used, the value is that assigned -to the volatile object. For instance, there is no read of @var{vobj} -in all the following cases: - -@smallexample -int obj; -volatile int vobj; -vobj = @var{something}; -obj = vobj = @var{something}; -obj ? vobj = @var{onething} : vobj = @var{anotherthing}; -obj = (@var{something}, vobj = @var{anotherthing}); -@end smallexample - -If you need to read the volatile object after an assignment has -occurred, you must use a separate expression with an intervening -sequence point. - -As bit-fields are not individually addressable, volatile bit-fields may -be implicitly read when written to, or when adjacent bit-fields are -accessed. Bit-field operations may be optimized such that adjacent -bit-fields are only partially accessed, if they straddle a storage unit -boundary. For these reasons it is unwise to use volatile bit-fields to -access hardware. - -@node Using Assembly Language with C -@section How to Use Inline Assembly Language in C Code -@cindex @code{asm} keyword -@cindex assembly language in C -@cindex inline assembly language -@cindex mixing assembly language and C - -The @code{asm} keyword allows you to embed assembler instructions -within C code. GCC provides two forms of inline @code{asm} -statements. A @dfn{basic @code{asm}} statement is one with no -operands (@pxref{Basic Asm}), while an @dfn{extended @code{asm}} -statement (@pxref{Extended Asm}) includes one or more operands. -The extended form is preferred for mixing C and assembly language -within a function, but to include assembly language at -top level you must use basic @code{asm}. - -You can also use the @code{asm} keyword to override the assembler name -for a C symbol, or to place a C variable in a specific register. - -@menu -* Basic Asm:: Inline assembler without operands. -* Extended Asm:: Inline assembler with operands. -* Constraints:: Constraints for @code{asm} operands -* Asm Labels:: Specifying the assembler name to use for a C symbol. -* Explicit Reg Vars:: Defining variables residing in specified registers. -* Size of an asm:: How GCC calculates the size of an @code{asm} block. -@end menu - -@node Basic Asm -@subsection Basic Asm --- Assembler Instructions Without Operands -@cindex basic @code{asm} -@cindex assembly language in C, basic - -A basic @code{asm} statement has the following syntax: - -@example -asm @r{[} volatile @r{]} ( @var{AssemblerInstructions} ) -@end example - -The @code{asm} keyword is a GNU extension. -When writing code that can be compiled with @option{-ansi} and the -various @option{-std} options, use @code{__asm__} instead of -@code{asm} (@pxref{Alternate Keywords}). - -@subsubheading Qualifiers -@table @code -@item volatile -The optional @code{volatile} qualifier has no effect. -All basic @code{asm} blocks are implicitly volatile. -@end table - -@subsubheading Parameters -@table @var - -@item AssemblerInstructions -This is a literal string that specifies the assembler code. The string can -contain any instructions recognized by the assembler, including directives. -GCC does not parse the assembler instructions themselves and -does not know what they mean or even whether they are valid assembler input. - -You may place multiple assembler instructions together in a single @code{asm} -string, separated by the characters normally used in assembly code for the -system. A combination that works in most places is a newline to break the -line, plus a tab character (written as @samp{\n\t}). -Some assemblers allow semicolons as a line separator. However, -note that some assembler dialects use semicolons to start a comment. -@end table - -@subsubheading Remarks -Using extended @code{asm} typically produces smaller, safer, and more -efficient code, and in most cases it is a better solution than basic -@code{asm}. However, there are two situations where only basic @code{asm} -can be used: - -@itemize @bullet -@item -Extended @code{asm} statements have to be inside a C -function, so to write inline assembly language at file scope (``top-level''), -outside of C functions, you must use basic @code{asm}. -You can use this technique to emit assembler directives, -define assembly language macros that can be invoked elsewhere in the file, -or write entire functions in assembly language. - -@item -Functions declared -with the @code{naked} attribute also require basic @code{asm} -(@pxref{Function Attributes}). -@end itemize - -Safely accessing C data and calling functions from basic @code{asm} is more -complex than it may appear. To access C data, it is better to use extended -@code{asm}. - -Do not expect a sequence of @code{asm} statements to remain perfectly -consecutive after compilation. If certain instructions need to remain -consecutive in the output, put them in a single multi-instruction @code{asm} -statement. Note that GCC's optimizers can move @code{asm} statements -relative to other code, including across jumps. - -@code{asm} statements may not perform jumps into other @code{asm} statements. -GCC does not know about these jumps, and therefore cannot take -account of them when deciding how to optimize. Jumps from @code{asm} to C -labels are only supported in extended @code{asm}. - -Under certain circumstances, GCC may duplicate (or remove duplicates of) your -assembly code when optimizing. This can lead to unexpected duplicate -symbol errors during compilation if your assembly code defines symbols or -labels. - -Since GCC does not parse the @var{AssemblerInstructions}, it has no -visibility of any symbols it references. This may result in GCC discarding -those symbols as unreferenced. - -The compiler copies the assembler instructions in a basic @code{asm} -verbatim to the assembly language output file, without -processing dialects or any of the @samp{%} operators that are available with -extended @code{asm}. This results in minor differences between basic -@code{asm} strings and extended @code{asm} templates. For example, to refer to -registers you might use @samp{%eax} in basic @code{asm} and -@samp{%%eax} in extended @code{asm}. - -On targets such as x86 that support multiple assembler dialects, -all basic @code{asm} blocks use the assembler dialect specified by the -@option{-masm} command-line option (@pxref{x86 Options}). -Basic @code{asm} provides no -mechanism to provide different assembler strings for different dialects. - -Here is an example of basic @code{asm} for i386: - -@example -/* Note that this code will not compile with -masm=intel */ -#define DebugBreak() asm("int $3") -@end example - -@node Extended Asm -@subsection Extended Asm - Assembler Instructions with C Expression Operands -@cindex extended @code{asm} -@cindex assembly language in C, extended - -With extended @code{asm} you can read and write C variables from -assembler and perform jumps from assembler code to C labels. -Extended @code{asm} syntax uses colons (@samp{:}) to delimit -the operand parameters after the assembler template: - -@example -asm @r{[}volatile@r{]} ( @var{AssemblerTemplate} - : @var{OutputOperands} - @r{[} : @var{InputOperands} - @r{[} : @var{Clobbers} @r{]} @r{]}) - -asm @r{[}volatile@r{]} goto ( @var{AssemblerTemplate} - : - : @var{InputOperands} - : @var{Clobbers} - : @var{GotoLabels}) -@end example - -The @code{asm} keyword is a GNU extension. -When writing code that can be compiled with @option{-ansi} and the -various @option{-std} options, use @code{__asm__} instead of -@code{asm} (@pxref{Alternate Keywords}). - -@subsubheading Qualifiers -@table @code - -@item volatile -The typical use of extended @code{asm} statements is to manipulate input -values to produce output values. However, your @code{asm} statements may -also produce side effects. If so, you may need to use the @code{volatile} -qualifier to disable certain optimizations. @xref{Volatile}. - -@item goto -This qualifier informs the compiler that the @code{asm} statement may -perform a jump to one of the labels listed in the @var{GotoLabels}. -@xref{GotoLabels}. -@end table - -@subsubheading Parameters -@table @var -@item AssemblerTemplate -This is a literal string that is the template for the assembler code. It is a -combination of fixed text and tokens that refer to the input, output, -and goto parameters. @xref{AssemblerTemplate}. - -@item OutputOperands -A comma-separated list of the C variables modified by the instructions in the -@var{AssemblerTemplate}. An empty list is permitted. @xref{OutputOperands}. - -@item InputOperands -A comma-separated list of C expressions read by the instructions in the -@var{AssemblerTemplate}. An empty list is permitted. @xref{InputOperands}. - -@item Clobbers -A comma-separated list of registers or other values changed by the -@var{AssemblerTemplate}, beyond those listed as outputs. -An empty list is permitted. @xref{Clobbers}. - -@item GotoLabels -When you are using the @code{goto} form of @code{asm}, this section contains -the list of all C labels to which the code in the -@var{AssemblerTemplate} may jump. -@xref{GotoLabels}. - -@code{asm} statements may not perform jumps into other @code{asm} statements, -only to the listed @var{GotoLabels}. -GCC's optimizers do not know about other jumps; therefore they cannot take -account of them when deciding how to optimize. -@end table - -The total number of input + output + goto operands is limited to 30. - -@subsubheading Remarks -The @code{asm} statement allows you to include assembly instructions directly -within C code. This may help you to maximize performance in time-sensitive -code or to access assembly instructions that are not readily available to C -programs. - -Note that extended @code{asm} statements must be inside a function. Only -basic @code{asm} may be outside functions (@pxref{Basic Asm}). -Functions declared with the @code{naked} attribute also require basic -@code{asm} (@pxref{Function Attributes}). - -While the uses of @code{asm} are many and varied, it may help to think of an -@code{asm} statement as a series of low-level instructions that convert input -parameters to output parameters. So a simple (if not particularly useful) -example for i386 using @code{asm} might look like this: - -@example -int src = 1; -int dst; - -asm ("mov %1, %0\n\t" - "add $1, %0" - : "=r" (dst) - : "r" (src)); - -printf("%d\n", dst); -@end example - -This code copies @code{src} to @code{dst} and add 1 to @code{dst}. - -@anchor{Volatile} -@subsubsection Volatile -@cindex volatile @code{asm} -@cindex @code{asm} volatile - -GCC's optimizers sometimes discard @code{asm} statements if they determine -there is no need for the output variables. Also, the optimizers may move -code out of loops if they believe that the code will always return the same -result (i.e. none of its input values change between calls). Using the -@code{volatile} qualifier disables these optimizations. @code{asm} statements -that have no output operands, including @code{asm goto} statements, -are implicitly volatile. - -This i386 code demonstrates a case that does not use (or require) the -@code{volatile} qualifier. If it is performing assertion checking, this code -uses @code{asm} to perform the validation. Otherwise, @code{dwRes} is -unreferenced by any code. As a result, the optimizers can discard the -@code{asm} statement, which in turn removes the need for the entire -@code{DoCheck} routine. By omitting the @code{volatile} qualifier when it -isn't needed you allow the optimizers to produce the most efficient code -possible. - -@example -void DoCheck(uint32_t dwSomeValue) -@{ - uint32_t dwRes; - - // Assumes dwSomeValue is not zero. - asm ("bsfl %1,%0" - : "=r" (dwRes) - : "r" (dwSomeValue) - : "cc"); - - assert(dwRes > 3); -@} -@end example - -The next example shows a case where the optimizers can recognize that the input -(@code{dwSomeValue}) never changes during the execution of the function and can -therefore move the @code{asm} outside the loop to produce more efficient code. -Again, using @code{volatile} disables this type of optimization. - -@example -void do_print(uint32_t dwSomeValue) -@{ - uint32_t dwRes; - - for (uint32_t x=0; x < 5; x++) - @{ - // Assumes dwSomeValue is not zero. - asm ("bsfl %1,%0" - : "=r" (dwRes) - : "r" (dwSomeValue) - : "cc"); - - printf("%u: %u %u\n", x, dwSomeValue, dwRes); - @} -@} -@end example - -The following example demonstrates a case where you need to use the -@code{volatile} qualifier. -It uses the x86 @code{rdtsc} instruction, which reads -the computer's time-stamp counter. Without the @code{volatile} qualifier, -the optimizers might assume that the @code{asm} block will always return the -same value and therefore optimize away the second call. - -@example -uint64_t msr; - -asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX. - "shl $32, %%rdx\n\t" // Shift the upper bits left. - "or %%rdx, %0" // 'Or' in the lower bits. - : "=a" (msr) - : - : "rdx"); - -printf("msr: %llx\n", msr); - -// Do other work... - -// Reprint the timestamp -asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX. - "shl $32, %%rdx\n\t" // Shift the upper bits left. - "or %%rdx, %0" // 'Or' in the lower bits. - : "=a" (msr) - : - : "rdx"); - -printf("msr: %llx\n", msr); -@end example - -GCC's optimizers do not treat this code like the non-volatile code in the -earlier examples. They do not move it out of loops or omit it on the -assumption that the result from a previous call is still valid. - -Note that the compiler can move even volatile @code{asm} instructions relative -to other code, including across jump instructions. For example, on many -targets there is a system register that controls the rounding mode of -floating-point operations. Setting it with a volatile @code{asm}, as in the -following PowerPC example, does not work reliably. - -@example -asm volatile("mtfsf 255, %0" : : "f" (fpenv)); -sum = x + y; -@end example - -The compiler may move the addition back before the volatile @code{asm}. To -make it work as expected, add an artificial dependency to the @code{asm} by -referencing a variable in the subsequent code, for example: - -@example -asm volatile ("mtfsf 255,%1" : "=X" (sum) : "f" (fpenv)); -sum = x + y; -@end example - -Under certain circumstances, GCC may duplicate (or remove duplicates of) your -assembly code when optimizing. This can lead to unexpected duplicate symbol -errors during compilation if your asm code defines symbols or labels. -Using @samp{%=} -(@pxref{AssemblerTemplate}) may help resolve this problem. - -@anchor{AssemblerTemplate} -@subsubsection Assembler Template -@cindex @code{asm} assembler template - -An assembler template is a literal string containing assembler instructions. -The compiler replaces tokens in the template that refer -to inputs, outputs, and goto labels, -and then outputs the resulting string to the assembler. The -string can contain any instructions recognized by the assembler, including -directives. GCC does not parse the assembler instructions -themselves and does not know what they mean or even whether they are valid -assembler input. However, it does count the statements -(@pxref{Size of an asm}). - -You may place multiple assembler instructions together in a single @code{asm} -string, separated by the characters normally used in assembly code for the -system. A combination that works in most places is a newline to break the -line, plus a tab character to move to the instruction field (written as -@samp{\n\t}). -Some assemblers allow semicolons as a line separator. However, note -that some assembler dialects use semicolons to start a comment. - -Do not expect a sequence of @code{asm} statements to remain perfectly -consecutive after compilation, even when you are using the @code{volatile} -qualifier. If certain instructions need to remain consecutive in the output, -put them in a single multi-instruction asm statement. - -Accessing data from C programs without using input/output operands (such as -by using global symbols directly from the assembler template) may not work as -expected. Similarly, calling functions directly from an assembler template -requires a detailed understanding of the target assembler and ABI. - -Since GCC does not parse the assembler template, -it has no visibility of any -symbols it references. This may result in GCC discarding those symbols as -unreferenced unless they are also listed as input, output, or goto operands. - -@subsubheading Special format strings - -In addition to the tokens described by the input, output, and goto operands, -these tokens have special meanings in the assembler template: - -@table @samp -@item %% -Outputs a single @samp{%} into the assembler code. - -@item %= -Outputs a number that is unique to each instance of the @code{asm} -statement in the entire compilation. This option is useful when creating local -labels and referring to them multiple times in a single template that -generates multiple assembler instructions. - -@item %@{ -@itemx %| -@itemx %@} -Outputs @samp{@{}, @samp{|}, and @samp{@}} characters (respectively) -into the assembler code. When unescaped, these characters have special -meaning to indicate multiple assembler dialects, as described below. -@end table - -@subsubheading Multiple assembler dialects in @code{asm} templates - -On targets such as x86, GCC supports multiple assembler dialects. -The @option{-masm} option controls which dialect GCC uses as its -default for inline assembler. The target-specific documentation for the -@option{-masm} option contains the list of supported dialects, as well as the -default dialect if the option is not specified. This information may be -important to understand, since assembler code that works correctly when -compiled using one dialect will likely fail if compiled using another. -@xref{x86 Options}. - -If your code needs to support multiple assembler dialects (for example, if -you are writing public headers that need to support a variety of compilation -options), use constructs of this form: - -@example -@{ dialect0 | dialect1 | dialect2... @} -@end example - -This construct outputs @code{dialect0} -when using dialect #0 to compile the code, -@code{dialect1} for dialect #1, etc. If there are fewer alternatives within the -braces than the number of dialects the compiler supports, the construct -outputs nothing. - -For example, if an x86 compiler supports two dialects -(@samp{att}, @samp{intel}), an -assembler template such as this: - -@example -"bt@{l %[Offset],%[Base] | %[Base],%[Offset]@}; jc %l2" -@end example - -@noindent -is equivalent to one of - -@example -"btl %[Offset],%[Base] ; jc %l2" @r{/* att dialect */} -"bt %[Base],%[Offset]; jc %l2" @r{/* intel dialect */} -@end example - -Using that same compiler, this code: - -@example -"xchg@{l@}\t@{%%@}ebx, %1" -@end example - -@noindent -corresponds to either - -@example -"xchgl\t%%ebx, %1" @r{/* att dialect */} -"xchg\tebx, %1" @r{/* intel dialect */} -@end example - -There is no support for nesting dialect alternatives. - -@anchor{OutputOperands} -@subsubsection Output Operands -@cindex @code{asm} output operands - -An @code{asm} statement has zero or more output operands indicating the names -of C variables modified by the assembler code. - -In this i386 example, @code{old} (referred to in the template string as -@code{%0}) and @code{*Base} (as @code{%1}) are outputs and @code{Offset} -(@code{%2}) is an input: - -@example -bool old; - -__asm__ ("btsl %2,%1\n\t" // Turn on zero-based bit #Offset in Base. - "sbb %0,%0" // Use the CF to calculate old. - : "=r" (old), "+rm" (*Base) - : "Ir" (Offset) - : "cc"); - -return old; -@end example - -Operands are separated by commas. Each operand has this format: - -@example -@r{[} [@var{asmSymbolicName}] @r{]} @var{constraint} (@var{cvariablename}) -@end example - -@table @var -@item asmSymbolicName -Specifies a symbolic name for the operand. -Reference the name in the assembler template -by enclosing it in square brackets -(i.e. @samp{%[Value]}). The scope of the name is the @code{asm} statement -that contains the definition. Any valid C variable name is acceptable, -including names already defined in the surrounding code. No two operands -within the same @code{asm} statement can use the same symbolic name. - -When not using an @var{asmSymbolicName}, use the (zero-based) position -of the operand -in the list of operands in the assembler template. For example if there are -three output operands, use @samp{%0} in the template to refer to the first, -@samp{%1} for the second, and @samp{%2} for the third. - -@item constraint -A string constant specifying constraints on the placement of the operand; -@xref{Constraints}, for details. - -Output constraints must begin with either @samp{=} (a variable overwriting an -existing value) or @samp{+} (when reading and writing). When using -@samp{=}, do not assume the location contains the existing value -on entry to the @code{asm}, except -when the operand is tied to an input; @pxref{InputOperands,,Input Operands}. - -After the prefix, there must be one or more additional constraints -(@pxref{Constraints}) that describe where the value resides. Common -constraints include @samp{r} for register and @samp{m} for memory. -When you list more than one possible location (for example, @code{"=rm"}), -the compiler chooses the most efficient one based on the current context. -If you list as many alternates as the @code{asm} statement allows, you permit -the optimizers to produce the best possible code. -If you must use a specific register, but your Machine Constraints do not -provide sufficient control to select the specific register you want, -local register variables may provide a solution (@pxref{Local Reg Vars}). - -@item cvariablename -Specifies a C lvalue expression to hold the output, typically a variable name. -The enclosing parentheses are a required part of the syntax. - -@end table - -When the compiler selects the registers to use to -represent the output operands, it does not use any of the clobbered registers -(@pxref{Clobbers}). - -Output operand expressions must be lvalues. The compiler cannot check whether -the operands have data types that are reasonable for the instruction being -executed. For output expressions that are not directly addressable (for -example a bit-field), the constraint must allow a register. In that case, GCC -uses the register as the output of the @code{asm}, and then stores that -register into the output. - -Operands using the @samp{+} constraint modifier count as two operands -(that is, both as input and output) towards the total maximum of 30 operands -per @code{asm} statement. - -Use the @samp{&} constraint modifier (@pxref{Modifiers}) on all output -operands that must not overlap an input. Otherwise, -GCC may allocate the output operand in the same register as an unrelated -input operand, on the assumption that the assembler code consumes its -inputs before producing outputs. This assumption may be false if the assembler -code actually consists of more than one instruction. - -The same problem can occur if one output parameter (@var{a}) allows a register -constraint and another output parameter (@var{b}) allows a memory constraint. -The code generated by GCC to access the memory address in @var{b} can contain -registers which @emph{might} be shared by @var{a}, and GCC considers those -registers to be inputs to the asm. As above, GCC assumes that such input -registers are consumed before any outputs are written. This assumption may -result in incorrect behavior if the asm writes to @var{a} before using -@var{b}. Combining the @samp{&} modifier with the register constraint on @var{a} -ensures that modifying @var{a} does not affect the address referenced by -@var{b}. Otherwise, the location of @var{b} -is undefined if @var{a} is modified before using @var{b}. - -@code{asm} supports operand modifiers on operands (for example @samp{%k2} -instead of simply @samp{%2}). Typically these qualifiers are hardware -dependent. The list of supported modifiers for x86 is found at -@ref{x86Operandmodifiers,x86 Operand modifiers}. - -If the C code that follows the @code{asm} makes no use of any of the output -operands, use @code{volatile} for the @code{asm} statement to prevent the -optimizers from discarding the @code{asm} statement as unneeded -(see @ref{Volatile}). - -This code makes no use of the optional @var{asmSymbolicName}. Therefore it -references the first output operand as @code{%0} (were there a second, it -would be @code{%1}, etc). The number of the first input operand is one greater -than that of the last output operand. In this i386 example, that makes -@code{Mask} referenced as @code{%1}: - -@example -uint32_t Mask = 1234; -uint32_t Index; - - asm ("bsfl %1, %0" - : "=r" (Index) - : "r" (Mask) - : "cc"); -@end example - -That code overwrites the variable @code{Index} (@samp{=}), -placing the value in a register (@samp{r}). -Using the generic @samp{r} constraint instead of a constraint for a specific -register allows the compiler to pick the register to use, which can result -in more efficient code. This may not be possible if an assembler instruction -requires a specific register. - -The following i386 example uses the @var{asmSymbolicName} syntax. -It produces the -same result as the code above, but some may consider it more readable or more -maintainable since reordering index numbers is not necessary when adding or -removing operands. The names @code{aIndex} and @code{aMask} -are only used in this example to emphasize which -names get used where. -It is acceptable to reuse the names @code{Index} and @code{Mask}. - -@example -uint32_t Mask = 1234; -uint32_t Index; - - asm ("bsfl %[aMask], %[aIndex]" - : [aIndex] "=r" (Index) - : [aMask] "r" (Mask) - : "cc"); -@end example - -Here are some more examples of output operands. - -@example -uint32_t c = 1; -uint32_t d; -uint32_t *e = &c; - -asm ("mov %[e], %[d]" - : [d] "=rm" (d) - : [e] "rm" (*e)); -@end example - -Here, @code{d} may either be in a register or in memory. Since the compiler -might already have the current value of the @code{uint32_t} location -pointed to by @code{e} -in a register, you can enable it to choose the best location -for @code{d} by specifying both constraints. - -@anchor{InputOperands} -@subsubsection Input Operands -@cindex @code{asm} input operands -@cindex @code{asm} expressions - -Input operands make values from C variables and expressions available to the -assembly code. - -Operands are separated by commas. Each operand has this format: - -@example -@r{[} [@var{asmSymbolicName}] @r{]} @var{constraint} (@var{cexpression}) -@end example - -@table @var -@item asmSymbolicName -Specifies a symbolic name for the operand. -Reference the name in the assembler template -by enclosing it in square brackets -(i.e. @samp{%[Value]}). The scope of the name is the @code{asm} statement -that contains the definition. Any valid C variable name is acceptable, -including names already defined in the surrounding code. No two operands -within the same @code{asm} statement can use the same symbolic name. - -When not using an @var{asmSymbolicName}, use the (zero-based) position -of the operand -in the list of operands in the assembler template. For example if there are -two output operands and three inputs, -use @samp{%2} in the template to refer to the first input operand, -@samp{%3} for the second, and @samp{%4} for the third. - -@item constraint -A string constant specifying constraints on the placement of the operand; -@xref{Constraints}, for details. - -Input constraint strings may not begin with either @samp{=} or @samp{+}. -When you list more than one possible location (for example, @samp{"irm"}), -the compiler chooses the most efficient one based on the current context. -If you must use a specific register, but your Machine Constraints do not -provide sufficient control to select the specific register you want, -local register variables may provide a solution (@pxref{Local Reg Vars}). - -Input constraints can also be digits (for example, @code{"0"}). This indicates -that the specified input must be in the same place as the output constraint -at the (zero-based) index in the output constraint list. -When using @var{asmSymbolicName} syntax for the output operands, -you may use these names (enclosed in brackets @samp{[]}) instead of digits. - -@item cexpression -This is the C variable or expression being passed to the @code{asm} statement -as input. The enclosing parentheses are a required part of the syntax. - -@end table - -When the compiler selects the registers to use to represent the input -operands, it does not use any of the clobbered registers (@pxref{Clobbers}). - -If there are no output operands but there are input operands, place two -consecutive colons where the output operands would go: - -@example -__asm__ ("some instructions" - : /* No outputs. */ - : "r" (Offset / 8)); -@end example - -@strong{Warning:} Do @emph{not} modify the contents of input-only operands -(except for inputs tied to outputs). The compiler assumes that on exit from -the @code{asm} statement these operands contain the same values as they -had before executing the statement. -It is @emph{not} possible to use clobbers -to inform the compiler that the values in these inputs are changing. One -common work-around is to tie the changing input variable to an output variable -that never gets used. Note, however, that if the code that follows the -@code{asm} statement makes no use of any of the output operands, the GCC -optimizers may discard the @code{asm} statement as unneeded -(see @ref{Volatile}). - -@code{asm} supports operand modifiers on operands (for example @samp{%k2} -instead of simply @samp{%2}). Typically these qualifiers are hardware -dependent. The list of supported modifiers for x86 is found at -@ref{x86Operandmodifiers,x86 Operand modifiers}. - -In this example using the fictitious @code{combine} instruction, the -constraint @code{"0"} for input operand 1 says that it must occupy the same -location as output operand 0. Only input operands may use numbers in -constraints, and they must each refer to an output operand. Only a number (or -the symbolic assembler name) in the constraint can guarantee that one operand -is in the same place as another. The mere fact that @code{foo} is the value of -both operands is not enough to guarantee that they are in the same place in -the generated assembler code. - -@example -asm ("combine %2, %0" - : "=r" (foo) - : "0" (foo), "g" (bar)); -@end example - -Here is an example using symbolic names. - -@example -asm ("cmoveq %1, %2, %[result]" - : [result] "=r"(result) - : "r" (test), "r" (new), "[result]" (old)); -@end example - -@anchor{Clobbers} -@subsubsection Clobbers -@cindex @code{asm} clobbers - -While the compiler is aware of changes to entries listed in the output -operands, the inline @code{asm} code may modify more than just the outputs. For -example, calculations may require additional registers, or the processor may -overwrite a register as a side effect of a particular assembler instruction. -In order to inform the compiler of these changes, list them in the clobber -list. Clobber list items are either register names or the special clobbers -(listed below). Each clobber list item is a string constant -enclosed in double quotes and separated by commas. - -Clobber descriptions may not in any way overlap with an input or output -operand. For example, you may not have an operand describing a register class -with one member when listing that register in the clobber list. Variables -declared to live in specific registers (@pxref{Explicit Reg Vars}) and used -as @code{asm} input or output operands must have no part mentioned in the -clobber description. In particular, there is no way to specify that input -operands get modified without also specifying them as output operands. - -When the compiler selects which registers to use to represent input and output -operands, it does not use any of the clobbered registers. As a result, -clobbered registers are available for any use in the assembler code. - -Here is a realistic example for the VAX showing the use of clobbered -registers: - -@example -asm volatile ("movc3 %0, %1, %2" - : /* No outputs. */ - : "g" (from), "g" (to), "g" (count) - : "r0", "r1", "r2", "r3", "r4", "r5"); -@end example - -Also, there are two special clobber arguments: - -@table @code -@item "cc" -The @code{"cc"} clobber indicates that the assembler code modifies the flags -register. On some machines, GCC represents the condition codes as a specific -hardware register; @code{"cc"} serves to name this register. -On other machines, condition code handling is different, -and specifying @code{"cc"} has no effect. But -it is valid no matter what the target. - -@item "memory" -The @code{"memory"} clobber tells the compiler that the assembly code -performs memory -reads or writes to items other than those listed in the input and output -operands (for example, accessing the memory pointed to by one of the input -parameters). To ensure memory contains correct values, GCC may need to flush -specific register values to memory before executing the @code{asm}. Further, -the compiler does not assume that any values read from memory before an -@code{asm} remain unchanged after that @code{asm}; it reloads them as -needed. -Using the @code{"memory"} clobber effectively forms a read/write -memory barrier for the compiler. - -Note that this clobber does not prevent the @emph{processor} from doing -speculative reads past the @code{asm} statement. To prevent that, you need -processor-specific fence instructions. - -Flushing registers to memory has performance implications and may be an issue -for time-sensitive code. You can use a trick to avoid this if the size of -the memory being accessed is known at compile time. For example, if accessing -ten bytes of a string, use a memory input like: - -@code{@{"m"( (@{ struct @{ char x[10]; @} *p = (void *)ptr ; *p; @}) )@}}. - -@end table - -@anchor{GotoLabels} -@subsubsection Goto Labels -@cindex @code{asm} goto labels - -@code{asm goto} allows assembly code to jump to one or more C labels. The -@var{GotoLabels} section in an @code{asm goto} statement contains -a comma-separated -list of all C labels to which the assembler code may jump. GCC assumes that -@code{asm} execution falls through to the next statement (if this is not the -case, consider using the @code{__builtin_unreachable} intrinsic after the -@code{asm} statement). Optimization of @code{asm goto} may be improved by -using the @code{hot} and @code{cold} label attributes (@pxref{Label -Attributes}). - -An @code{asm goto} statement cannot have outputs. -This is due to an internal restriction of -the compiler: control transfer instructions cannot have outputs. -If the assembler code does modify anything, use the @code{"memory"} clobber -to force the -optimizers to flush all register values to memory and reload them if -necessary after the @code{asm} statement. - -Also note that an @code{asm goto} statement is always implicitly -considered volatile. - -To reference a label in the assembler template, -prefix it with @samp{%l} (lowercase @samp{L}) followed -by its (zero-based) position in @var{GotoLabels} plus the number of input -operands. For example, if the @code{asm} has three inputs and references two -labels, refer to the first label as @samp{%l3} and the second as @samp{%l4}). - -Alternately, you can reference labels using the actual C label name enclosed -in brackets. For example, to reference a label named @code{carry}, you can -use @samp{%l[carry]}. The label must still be listed in the @var{GotoLabels} -section when using this approach. - -Here is an example of @code{asm goto} for i386: - -@example -asm goto ( - "btl %1, %0\n\t" - "jc %l2" - : /* No outputs. */ - : "r" (p1), "r" (p2) - : "cc" - : carry); - -return 0; - -carry: -return 1; -@end example - -The following example shows an @code{asm goto} that uses a memory clobber. - -@example -int frob(int x) -@{ - int y; - asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5" - : /* No outputs. */ - : "r"(x), "r"(&y) - : "r5", "memory" - : error); - return y; -error: - return -1; -@} -@end example - -@anchor{x86Operandmodifiers} -@subsubsection x86 Operand Modifiers - -References to input, output, and goto operands in the assembler template -of extended @code{asm} statements can use -modifiers to affect the way the operands are formatted in -the code output to the assembler. For example, the -following code uses the @samp{h} and @samp{b} modifiers for x86: - -@example -uint16_t num; -asm volatile ("xchg %h0, %b0" : "+a" (num) ); -@end example - -@noindent -These modifiers generate this assembler code: - -@example -xchg %ah, %al -@end example - -The rest of this discussion uses the following code for illustrative purposes. - -@example -int main() -@{ - int iInt = 1; - -top: - - asm volatile goto ("some assembler instructions here" - : /* No outputs. */ - : "q" (iInt), "X" (sizeof(unsigned char) + 1) - : /* No clobbers. */ - : top); -@} -@end example - -With no modifiers, this is what the output from the operands would be for the -@samp{att} and @samp{intel} dialects of assembler: - -@multitable {Operand} {masm=att} {OFFSET FLAT:.L2} -@headitem Operand @tab masm=att @tab masm=intel -@item @code{%0} -@tab @code{%eax} -@tab @code{eax} -@item @code{%1} -@tab @code{$2} -@tab @code{2} -@item @code{%2} -@tab @code{$.L2} -@tab @code{OFFSET FLAT:.L2} -@end multitable - -The table below shows the list of supported modifiers and their effects. - -@multitable {Modifier} {Print the opcode suffix for the size of th} {Operand} {masm=att} {masm=intel} -@headitem Modifier @tab Description @tab Operand @tab @option{masm=att} @tab @option{masm=intel} -@item @code{z} -@tab Print the opcode suffix for the size of the current integer operand (one of @code{b}/@code{w}/@code{l}/@code{q}). -@tab @code{%z0} -@tab @code{l} -@tab -@item @code{b} -@tab Print the QImode name of the register. -@tab @code{%b0} -@tab @code{%al} -@tab @code{al} -@item @code{h} -@tab Print the QImode name for a ``high'' register. -@tab @code{%h0} -@tab @code{%ah} -@tab @code{ah} -@item @code{w} -@tab Print the HImode name of the register. -@tab @code{%w0} -@tab @code{%ax} -@tab @code{ax} -@item @code{k} -@tab Print the SImode name of the register. -@tab @code{%k0} -@tab @code{%eax} -@tab @code{eax} -@item @code{q} -@tab Print the DImode name of the register. -@tab @code{%q0} -@tab @code{%rax} -@tab @code{rax} -@item @code{l} -@tab Print the label name with no punctuation. -@tab @code{%l2} -@tab @code{.L2} -@tab @code{.L2} -@item @code{c} -@tab Require a constant operand and print the constant expression with no punctuation. -@tab @code{%c1} -@tab @code{2} -@tab @code{2} -@end multitable - -@anchor{x86floatingpointasmoperands} -@subsubsection x86 Floating-Point @code{asm} Operands - -On x86 targets, there are several rules on the usage of stack-like registers -in the operands of an @code{asm}. These rules apply only to the operands -that are stack-like registers: - -@enumerate -@item -Given a set of input registers that die in an @code{asm}, it is -necessary to know which are implicitly popped by the @code{asm}, and -which must be explicitly popped by GCC@. - -An input register that is implicitly popped by the @code{asm} must be -explicitly clobbered, unless it is constrained to match an -output operand. - -@item -For any input register that is implicitly popped by an @code{asm}, it is -necessary to know how to adjust the stack to compensate for the pop. -If any non-popped input is closer to the top of the reg-stack than -the implicitly popped register, it would not be possible to know what the -stack looked like---it's not clear how the rest of the stack ``slides -up''. - -All implicitly popped input registers must be closer to the top of -the reg-stack than any input that is not implicitly popped. - -It is possible that if an input dies in an @code{asm}, the compiler might -use the input register for an output reload. Consider this example: - -@smallexample -asm ("foo" : "=t" (a) : "f" (b)); -@end smallexample - -@noindent -This code says that input @code{b} is not popped by the @code{asm}, and that -the @code{asm} pushes a result onto the reg-stack, i.e., the stack is one -deeper after the @code{asm} than it was before. But, it is possible that -reload may think that it can use the same register for both the input and -the output. - -To prevent this from happening, -if any input operand uses the @samp{f} constraint, all output register -constraints must use the @samp{&} early-clobber modifier. - -The example above is correctly written as: - -@smallexample -asm ("foo" : "=&t" (a) : "f" (b)); -@end smallexample - -@item -Some operands need to be in particular places on the stack. All -output operands fall in this category---GCC has no other way to -know which registers the outputs appear in unless you indicate -this in the constraints. - -Output operands must specifically indicate which register an output -appears in after an @code{asm}. @samp{=f} is not allowed: the operand -constraints must select a class with a single register. - -@item -Output operands may not be ``inserted'' between existing stack registers. -Since no 387 opcode uses a read/write operand, all output operands -are dead before the @code{asm}, and are pushed by the @code{asm}. -It makes no sense to push anywhere but the top of the reg-stack. - -Output operands must start at the top of the reg-stack: output -operands may not ``skip'' a register. - -@item -Some @code{asm} statements may need extra stack space for internal -calculations. This can be guaranteed by clobbering stack registers -unrelated to the inputs and outputs. - -@end enumerate - -This @code{asm} -takes one input, which is internally popped, and produces two outputs. - -@smallexample -asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp)); -@end smallexample - -@noindent -This @code{asm} takes two inputs, which are popped by the @code{fyl2xp1} opcode, -and replaces them with one output. The @code{st(1)} clobber is necessary -for the compiler to know that @code{fyl2xp1} pops both inputs. - -@smallexample -asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)"); -@end smallexample - -@lowersections -@include md.texi -@raisesections - -@node Asm Labels -@subsection Controlling Names Used in Assembler Code -@cindex assembler names for identifiers -@cindex names used in assembler code -@cindex identifiers, names in assembler code - -You can specify the name to be used in the assembler code for a C -function or variable by writing the @code{asm} (or @code{__asm__}) -keyword after the declarator as follows: - -@smallexample -int foo asm ("myfoo") = 2; -@end smallexample - -@noindent -This specifies that the name to be used for the variable @code{foo} in -the assembler code should be @samp{myfoo} rather than the usual -@samp{_foo}. - -On systems where an underscore is normally prepended to the name of a C -function or variable, this feature allows you to define names for the -linker that do not start with an underscore. - -It does not make sense to use this feature with a non-static local -variable since such variables do not have assembler names. If you are -trying to put the variable in a particular register, see @ref{Explicit -Reg Vars}. GCC presently accepts such code with a warning, but will -probably be changed to issue an error, rather than a warning, in the -future. - -You cannot use @code{asm} in this way in a function @emph{definition}; but -you can get the same effect by writing a declaration for the function -before its definition and putting @code{asm} there, like this: - -@smallexample -extern func () asm ("FUNC"); - -func (x, y) - int x, y; -/* @r{@dots{}} */ -@end smallexample - -It is up to you to make sure that the assembler names you choose do not -conflict with any other assembler symbols. Also, you must not use a -register name; that would produce completely invalid assembler code. GCC -does not as yet have the ability to store static variables in registers. -Perhaps that will be added. - -@node Explicit Reg Vars -@subsection Variables in Specified Registers -@cindex explicit register variables -@cindex variables in specified registers -@cindex specified registers -@cindex registers, global allocation - -GNU C allows you to put a few global variables into specified hardware -registers. You can also specify the register in which an ordinary -register variable should be allocated. - -@itemize @bullet -@item -Global register variables reserve registers throughout the program. -This may be useful in programs such as programming language -interpreters that have a couple of global variables that are accessed -very often. - -@item -Local register variables in specific registers do not reserve the -registers, except at the point where they are used as input or output -operands in an @code{asm} statement and the @code{asm} statement itself is -not deleted. The compiler's data flow analysis is capable of determining -where the specified registers contain live values, and where they are -available for other uses. Stores into local register variables may be deleted -when they appear to be dead according to dataflow analysis. References -to local register variables may be deleted or moved or simplified. - -These local variables are sometimes convenient for use with the extended -@code{asm} feature (@pxref{Extended Asm}), if you want to write one -output of the assembler instruction directly into a particular register. -(This works provided the register you specify fits the constraints -specified for that operand in the @code{asm}.) -@end itemize - -@menu -* Global Reg Vars:: -* Local Reg Vars:: -@end menu - -@node Global Reg Vars -@subsubsection Defining Global Register Variables -@cindex global register variables -@cindex registers, global variables in - -You can define a global register variable in GNU C like this: - -@smallexample -register int *foo asm ("a5"); -@end smallexample - -@noindent -Here @code{a5} is the name of the register that should be used. Choose a -register that is normally saved and restored by function calls on your -machine, so that library routines will not clobber it. - -Naturally the register name is CPU-dependent, so you need to -conditionalize your program according to CPU type. The register -@code{a5} is a good choice on a 68000 for a variable of pointer -type. On machines with register windows, be sure to choose a ``global'' -register that is not affected magically by the function call mechanism. - -In addition, different operating systems on the same CPU may differ in how they -name the registers; then you need additional conditionals. For -example, some 68000 operating systems call this register @code{%a5}. - -Eventually there may be a way of asking the compiler to choose a register -automatically, but first we need to figure out how it should choose and -how to enable you to guide the choice. No solution is evident. - -Defining a global register variable in a certain register reserves that -register entirely for this use, at least within the current compilation. -The register is not allocated for any other purpose in the functions -in the current compilation, and is not saved and restored by -these functions. Stores into this register are never deleted even if they -appear to be dead, but references may be deleted or moved or -simplified. - -It is not safe to access the global register variables from signal -handlers, or from more than one thread of control, because the system -library routines may temporarily use the register for other things (unless -you recompile them specially for the task at hand). - -@cindex @code{qsort}, and global register variables -It is not safe for one function that uses a global register variable to -call another such function @code{foo} by way of a third function -@code{lose} that is compiled without knowledge of this variable (i.e.@: in a -different source file in which the variable isn't declared). This is -because @code{lose} might save the register and put some other value there. -For example, you can't expect a global register variable to be available in -the comparison-function that you pass to @code{qsort}, since @code{qsort} -might have put something else in that register. (If you are prepared to -recompile @code{qsort} with the same global register variable, you can -solve this problem.) - -If you want to recompile @code{qsort} or other source files that do not -actually use your global register variable, so that they do not use that -register for any other purpose, then it suffices to specify the compiler -option @option{-ffixed-@var{reg}}. You need not actually add a global -register declaration to their source code. - -A function that can alter the value of a global register variable cannot -safely be called from a function compiled without this variable, because it -could clobber the value the caller expects to find there on return. -Therefore, the function that is the entry point into the part of the -program that uses the global register variable must explicitly save and -restore the value that belongs to its caller. - -@cindex register variable after @code{longjmp} -@cindex global register after @code{longjmp} -@cindex value after @code{longjmp} -@findex longjmp -@findex setjmp -On most machines, @code{longjmp} restores to each global register -variable the value it had at the time of the @code{setjmp}. On some -machines, however, @code{longjmp} does not change the value of global -register variables. To be portable, the function that called @code{setjmp} -should make other arrangements to save the values of the global register -variables, and to restore them in a @code{longjmp}. This way, the same -thing happens regardless of what @code{longjmp} does. - -All global register variable declarations must precede all function -definitions. If such a declaration could appear after function -definitions, the declaration would be too late to prevent the register from -being used for other purposes in the preceding functions. - -Global register variables may not have initial values, because an -executable file has no means to supply initial contents for a register. - -On the SPARC, there are reports that g3 @dots{} g7 are suitable -registers, but certain library functions, such as @code{getwd}, as well -as the subroutines for division and remainder, modify g3 and g4. g1 and -g2 are local temporaries. - -On the 68000, a2 @dots{} a5 should be suitable, as should d2 @dots{} d7. -Of course, it does not do to use more than a few of those. - -@node Local Reg Vars -@subsubsection Specifying Registers for Local Variables -@cindex local variables, specifying registers -@cindex specifying registers for local variables -@cindex registers for local variables - -You can define a local register variable with a specified register -like this: - -@smallexample -register int *foo asm ("a5"); -@end smallexample - -@noindent -Here @code{a5} is the name of the register that should be used. Note -that this is the same syntax used for defining global register -variables, but for a local variable it appears within a function. - -Naturally the register name is CPU-dependent, but this is not a -problem, since specific registers are most often useful with explicit -assembler instructions (@pxref{Extended Asm}). Both of these things -generally require that you conditionalize your program according to -CPU type. - -In addition, operating systems on one type of CPU may differ in how they -name the registers; then you need additional conditionals. For -example, some 68000 operating systems call this register @code{%a5}. - -Defining such a register variable does not reserve the register; it -remains available for other uses in places where flow control determines -the variable's value is not live. - -This option does not guarantee that GCC generates code that has -this variable in the register you specify at all times. You may not -code an explicit reference to this register in the assembler -instruction template part of an @code{asm} statement and assume it -always refers to this variable. -However, using the variable as an input or output operand to the @code{asm} -guarantees that the specified register is used for that operand. -@xref{Extended Asm}, for more information. - -Stores into local register variables may be deleted when they appear to be dead -according to dataflow analysis. References to local register variables may -be deleted or moved or simplified. - -As with global register variables, it is recommended that you choose a -register that is normally saved and restored by function calls on -your machine, so that library routines will not clobber it. - -Sometimes when writing inline @code{asm} code, you need to make an operand be a -specific register, but there's no matching constraint letter for that -register. To force the operand into that register, create a local variable -and specify the register in the variable's declaration. Then use the local -variable for the asm operand and specify any constraint letter that matches -the register: - -@smallexample -register int *p1 asm ("r0") = @dots{}; -register int *p2 asm ("r1") = @dots{}; -register int *result asm ("r0"); -asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); -@end smallexample - -@emph{Warning:} In the above example, be aware that a register (for example r0) can be -call-clobbered by subsequent code, including function calls and library calls -for arithmetic operators on other variables (for example the initialization -of p2). In this case, use temporary variables for expressions between the -register assignments: - -@smallexample -int t1 = @dots{}; -register int *p1 asm ("r0") = @dots{}; -register int *p2 asm ("r1") = t1; -register int *result asm ("r0"); -asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); -@end smallexample - -@node Size of an asm -@subsection Size of an @code{asm} - -Some targets require that GCC track the size of each instruction used -in order to generate correct code. Because the final length of the -code produced by an @code{asm} statement is only known by the -assembler, GCC must make an estimate as to how big it will be. It -does this by counting the number of instructions in the pattern of the -@code{asm} and multiplying that by the length of the longest -instruction supported by that processor. (When working out the number -of instructions, it assumes that any occurrence of a newline or of -whatever statement separator character is supported by the assembler -- -typically @samp{;} --- indicates the end of an instruction.) - -Normally, GCC's estimate is adequate to ensure that correct -code is generated, but it is possible to confuse the compiler if you use -pseudo instructions or assembler macros that expand into multiple real -instructions, or if you use assembler directives that expand to more -space in the object file than is needed for a single instruction. -If this happens then the assembler may produce a diagnostic saying that -a label is unreachable. - -@node Alternate Keywords -@section Alternate Keywords -@cindex alternate keywords -@cindex keywords, alternate - -@option{-ansi} and the various @option{-std} options disable certain -keywords. This causes trouble when you want to use GNU C extensions, or -a general-purpose header file that should be usable by all programs, -including ISO C programs. The keywords @code{asm}, @code{typeof} and -@code{inline} are not available in programs compiled with -@option{-ansi} or @option{-std} (although @code{inline} can be used in a -program compiled with @option{-std=c99} or @option{-std=c11}). The -ISO C99 keyword -@code{restrict} is only available when @option{-std=gnu99} (which will -eventually be the default) or @option{-std=c99} (or the equivalent -@option{-std=iso9899:1999}), or an option for a later standard -version, is used. - -The way to solve these problems is to put @samp{__} at the beginning and -end of each problematical keyword. For example, use @code{__asm__} -instead of @code{asm}, and @code{__inline__} instead of @code{inline}. - -Other C compilers won't accept these alternative keywords; if you want to -compile with another compiler, you can define the alternate keywords as -macros to replace them with the customary keywords. It looks like this: - -@smallexample -#ifndef __GNUC__ -#define __asm__ asm -#endif -@end smallexample - -@findex __extension__ -@opindex pedantic -@option{-pedantic} and other options cause warnings for many GNU C extensions. -You can -prevent such warnings within one expression by writing -@code{__extension__} before the expression. @code{__extension__} has no -effect aside from this. - -@node Incomplete Enums -@section Incomplete @code{enum} Types - -You can define an @code{enum} tag without specifying its possible values. -This results in an incomplete type, much like what you get if you write -@code{struct foo} without describing the elements. A later declaration -that does specify the possible values completes the type. - -You can't allocate variables or storage using the type while it is -incomplete. However, you can work with pointers to that type. - -This extension may not be very useful, but it makes the handling of -@code{enum} more consistent with the way @code{struct} and @code{union} -are handled. - -This extension is not supported by GNU C++. - -@node Function Names -@section Function Names as Strings -@cindex @code{__func__} identifier -@cindex @code{__FUNCTION__} identifier -@cindex @code{__PRETTY_FUNCTION__} identifier - -GCC provides three magic variables that hold the name of the current -function, as a string. The first of these is @code{__func__}, which -is part of the C99 standard: - -The identifier @code{__func__} is implicitly declared by the translator -as if, immediately following the opening brace of each function -definition, the declaration - -@smallexample -static const char __func__[] = "function-name"; -@end smallexample - -@noindent -appeared, where function-name is the name of the lexically-enclosing -function. This name is the unadorned name of the function. - -@code{__FUNCTION__} is another name for @code{__func__}, provided for -backward compatibility with old versions of GCC. - -In C, @code{__PRETTY_FUNCTION__} is yet another name for -@code{__func__}. However, in C++, @code{__PRETTY_FUNCTION__} contains -the type signature of the function as well as its bare name. For -example, this program: - -@smallexample -extern "C" @{ -extern int printf (char *, ...); -@} - -class a @{ - public: - void sub (int i) - @{ - printf ("__FUNCTION__ = %s\n", __FUNCTION__); - printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__); - @} -@}; - -int -main (void) -@{ - a ax; - ax.sub (0); - return 0; -@} -@end smallexample - -@noindent -gives this output: - -@smallexample -__FUNCTION__ = sub -__PRETTY_FUNCTION__ = void a::sub(int) -@end smallexample - -These identifiers are variables, not preprocessor macros, and may not -be used to initialize @code{char} arrays or be concatenated with other string -literals. - -@node Return Address -@section Getting the Return or Frame Address of a Function - -These functions may be used to get information about the callers of a -function. - -@deftypefn {Built-in Function} {void *} __builtin_return_address (unsigned int @var{level}) -This function returns the return address of the current function, or of -one of its callers. The @var{level} argument is number of frames to -scan up the call stack. A value of @code{0} yields the return address -of the current function, a value of @code{1} yields the return address -of the caller of the current function, and so forth. When inlining -the expected behavior is that the function returns the address of -the function that is returned to. To work around this behavior use -the @code{noinline} function attribute. - -The @var{level} argument must be a constant integer. - -On some machines it may be impossible to determine the return address of -any function other than the current one; in such cases, or when the top -of the stack has been reached, this function returns @code{0} or a -random value. In addition, @code{__builtin_frame_address} may be used -to determine if the top of the stack has been reached. - -Additional post-processing of the returned value may be needed, see -@code{__builtin_extract_return_addr}. - -This function should only be used with a nonzero argument for debugging -purposes. -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin_extract_return_addr (void *@var{addr}) -The address as returned by @code{__builtin_return_address} may have to be fed -through this function to get the actual encoded address. For example, on the -31-bit S/390 platform the highest bit has to be masked out, or on SPARC -platforms an offset has to be added for the true next instruction to be -executed. - -If no fixup is needed, this function simply passes through @var{addr}. -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin_frob_return_address (void *@var{addr}) -This function does the reverse of @code{__builtin_extract_return_addr}. -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin_frame_address (unsigned int @var{level}) -This function is similar to @code{__builtin_return_address}, but it -returns the address of the function frame rather than the return address -of the function. Calling @code{__builtin_frame_address} with a value of -@code{0} yields the frame address of the current function, a value of -@code{1} yields the frame address of the caller of the current function, -and so forth. - -The frame is the area on the stack that holds local variables and saved -registers. The frame address is normally the address of the first word -pushed on to the stack by the function. However, the exact definition -depends upon the processor and the calling convention. If the processor -has a dedicated frame pointer register, and the function has a frame, -then @code{__builtin_frame_address} returns the value of the frame -pointer register. - -On some machines it may be impossible to determine the frame address of -any function other than the current one; in such cases, or when the top -of the stack has been reached, this function returns @code{0} if -the first frame pointer is properly initialized by the startup code. - -This function should only be used with a nonzero argument for debugging -purposes. -@end deftypefn - -@node Vector Extensions -@section Using Vector Instructions through Built-in Functions - -On some targets, the instruction set contains SIMD vector instructions which -operate on multiple values contained in one large register at the same time. -For example, on the x86 the MMX, 3DNow!@: and SSE extensions can be used -this way. - -The first step in using these extensions is to provide the necessary data -types. This should be done using an appropriate @code{typedef}: - -@smallexample -typedef int v4si __attribute__ ((vector_size (16))); -@end smallexample - -@noindent -The @code{int} type specifies the base type, while the attribute specifies -the vector size for the variable, measured in bytes. For example, the -declaration above causes the compiler to set the mode for the @code{v4si} -type to be 16 bytes wide and divided into @code{int} sized units. For -a 32-bit @code{int} this means a vector of 4 units of 4 bytes, and the -corresponding mode of @code{foo} is @acronym{V4SI}. - -The @code{vector_size} attribute is only applicable to integral and -float scalars, although arrays, pointers, and function return values -are allowed in conjunction with this construct. Only sizes that are -a power of two are currently allowed. - -All the basic integer types can be used as base types, both as signed -and as unsigned: @code{char}, @code{short}, @code{int}, @code{long}, -@code{long long}. In addition, @code{float} and @code{double} can be -used to build floating-point vector types. - -Specifying a combination that is not valid for the current architecture -causes GCC to synthesize the instructions using a narrower mode. -For example, if you specify a variable of type @code{V4SI} and your -architecture does not allow for this specific SIMD type, GCC -produces code that uses 4 @code{SIs}. - -The types defined in this manner can be used with a subset of normal C -operations. Currently, GCC allows using the following operators -on these types: @code{+, -, *, /, unary minus, ^, |, &, ~, %}@. - -The operations behave like C++ @code{valarrays}. Addition is defined as -the addition of the corresponding elements of the operands. For -example, in the code below, each of the 4 elements in @var{a} is -added to the corresponding 4 elements in @var{b} and the resulting -vector is stored in @var{c}. - -@smallexample -typedef int v4si __attribute__ ((vector_size (16))); - -v4si a, b, c; - -c = a + b; -@end smallexample - -Subtraction, multiplication, division, and the logical operations -operate in a similar manner. Likewise, the result of using the unary -minus or complement operators on a vector type is a vector whose -elements are the negative or complemented values of the corresponding -elements in the operand. - -It is possible to use shifting operators @code{<<}, @code{>>} on -integer-type vectors. The operation is defined as following: @code{@{a0, -a1, @dots{}, an@} >> @{b0, b1, @dots{}, bn@} == @{a0 >> b0, a1 >> b1, -@dots{}, an >> bn@}}@. Vector operands must have the same number of -elements. - -For convenience, it is allowed to use a binary vector operation -where one operand is a scalar. In that case the compiler transforms -the scalar operand into a vector where each element is the scalar from -the operation. The transformation happens only if the scalar could be -safely converted to the vector-element type. -Consider the following code. - -@smallexample -typedef int v4si __attribute__ ((vector_size (16))); - -v4si a, b, c; -long l; - -a = b + 1; /* a = b + @{1,1,1,1@}; */ -a = 2 * b; /* a = @{2,2,2,2@} * b; */ - -a = l + a; /* Error, cannot convert long to int. */ -@end smallexample - -Vectors can be subscripted as if the vector were an array with -the same number of elements and base type. Out of bound accesses -invoke undefined behavior at run time. Warnings for out of bound -accesses for vector subscription can be enabled with -@option{-Warray-bounds}. - -Vector comparison is supported with standard comparison -operators: @code{==, !=, <, <=, >, >=}. Comparison operands can be -vector expressions of integer-type or real-type. Comparison between -integer-type vectors and real-type vectors are not supported. The -result of the comparison is a vector of the same width and number of -elements as the comparison operands with a signed integral element -type. - -Vectors are compared element-wise producing 0 when comparison is false -and -1 (constant of the appropriate type where all bits are set) -otherwise. Consider the following example. - -@smallexample -typedef int v4si __attribute__ ((vector_size (16))); - -v4si a = @{1,2,3,4@}; -v4si b = @{3,2,1,4@}; -v4si c; - -c = a > b; /* The result would be @{0, 0,-1, 0@} */ -c = a == b; /* The result would be @{0,-1, 0,-1@} */ -@end smallexample - -In C++, the ternary operator @code{?:} is available. @code{a?b:c}, where -@code{b} and @code{c} are vectors of the same type and @code{a} is an -integer vector with the same number of elements of the same size as @code{b} -and @code{c}, computes all three arguments and creates a vector -@code{@{a[0]?b[0]:c[0], a[1]?b[1]:c[1], @dots{}@}}. Note that unlike in -OpenCL, @code{a} is thus interpreted as @code{a != 0} and not @code{a < 0}. -As in the case of binary operations, this syntax is also accepted when -one of @code{b} or @code{c} is a scalar that is then transformed into a -vector. If both @code{b} and @code{c} are scalars and the type of -@code{true?b:c} has the same size as the element type of @code{a}, then -@code{b} and @code{c} are converted to a vector type whose elements have -this type and with the same number of elements as @code{a}. - -In C++, the logic operators @code{!, &&, ||} are available for vectors. -@code{!v} is equivalent to @code{v == 0}, @code{a && b} is equivalent to -@code{a!=0 & b!=0} and @code{a || b} is equivalent to @code{a!=0 | b!=0}. -For mixed operations between a scalar @code{s} and a vector @code{v}, -@code{s && v} is equivalent to @code{s?v!=0:0} (the evaluation is -short-circuit) and @code{v && s} is equivalent to @code{v!=0 & (s?-1:0)}. - -Vector shuffling is available using functions -@code{__builtin_shuffle (vec, mask)} and -@code{__builtin_shuffle (vec0, vec1, mask)}. -Both functions construct a permutation of elements from one or two -vectors and return a vector of the same type as the input vector(s). -The @var{mask} is an integral vector with the same width (@var{W}) -and element count (@var{N}) as the output vector. - -The elements of the input vectors are numbered in memory ordering of -@var{vec0} beginning at 0 and @var{vec1} beginning at @var{N}. The -elements of @var{mask} are considered modulo @var{N} in the single-operand -case and modulo @math{2*@var{N}} in the two-operand case. - -Consider the following example, - -@smallexample -typedef int v4si __attribute__ ((vector_size (16))); - -v4si a = @{1,2,3,4@}; -v4si b = @{5,6,7,8@}; -v4si mask1 = @{0,1,1,3@}; -v4si mask2 = @{0,4,2,5@}; -v4si res; - -res = __builtin_shuffle (a, mask1); /* res is @{1,2,2,4@} */ -res = __builtin_shuffle (a, b, mask2); /* res is @{1,5,3,6@} */ -@end smallexample - -Note that @code{__builtin_shuffle} is intentionally semantically -compatible with the OpenCL @code{shuffle} and @code{shuffle2} functions. - -You can declare variables and use them in function calls and returns, as -well as in assignments and some casts. You can specify a vector type as -a return type for a function. Vector types can also be used as function -arguments. It is possible to cast from one vector type to another, -provided they are of the same size (in fact, you can also cast vectors -to and from other datatypes of the same size). - -You cannot operate between vectors of different lengths or different -signedness without a cast. - -@node Offsetof -@section Support for @code{offsetof} -@findex __builtin_offsetof - -GCC implements for both C and C++ a syntactic extension to implement -the @code{offsetof} macro. - -@smallexample -primary: - "__builtin_offsetof" "(" @code{typename} "," offsetof_member_designator ")" - -offsetof_member_designator: - @code{identifier} - | offsetof_member_designator "." @code{identifier} - | offsetof_member_designator "[" @code{expr} "]" -@end smallexample - -This extension is sufficient such that - -@smallexample -#define offsetof(@var{type}, @var{member}) __builtin_offsetof (@var{type}, @var{member}) -@end smallexample - -@noindent -is a suitable definition of the @code{offsetof} macro. In C++, @var{type} -may be dependent. In either case, @var{member} may consist of a single -identifier, or a sequence of member accesses and array references. - -@node __sync Builtins -@section Legacy @code{__sync} Built-in Functions for Atomic Memory Access - -The following built-in functions -are intended to be compatible with those described -in the @cite{Intel Itanium Processor-specific Application Binary Interface}, -section 7.4. As such, they depart from the normal GCC practice of using -the @samp{__builtin_} prefix, and further that they are overloaded such that -they work on multiple types. - -The definition given in the Intel documentation allows only for the use of -the types @code{int}, @code{long}, @code{long long} as well as their unsigned -counterparts. GCC allows any integral scalar or pointer type that is -1, 2, 4 or 8 bytes in length. - -Not all operations are supported by all target processors. If a particular -operation cannot be implemented on the target processor, a warning is -generated and a call an external function is generated. The external -function carries the same name as the built-in version, -with an additional suffix -@samp{_@var{n}} where @var{n} is the size of the data type. - -@c ??? Should we have a mechanism to suppress this warning? This is almost -@c useful for implementing the operation under the control of an external -@c mutex. - -In most cases, these built-in functions are considered a @dfn{full barrier}. -That is, -no memory operand is moved across the operation, either forward or -backward. Further, instructions are issued as necessary to prevent the -processor from speculating loads across the operation and from queuing stores -after the operation. - -All of the routines are described in the Intel documentation to take -``an optional list of variables protected by the memory barrier''. It's -not clear what is meant by that; it could mean that @emph{only} the -following variables are protected, or it could mean that these variables -should in addition be protected. At present GCC ignores this list and -protects all variables that are globally accessible. If in the future -we make some use of this list, an empty list will continue to mean all -globally accessible variables. - -@table @code -@item @var{type} __sync_fetch_and_add (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_fetch_and_sub (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_fetch_and_or (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_fetch_and_and (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_fetch_and_xor (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_fetch_and_nand (@var{type} *ptr, @var{type} value, ...) -@findex __sync_fetch_and_add -@findex __sync_fetch_and_sub -@findex __sync_fetch_and_or -@findex __sync_fetch_and_and -@findex __sync_fetch_and_xor -@findex __sync_fetch_and_nand -These built-in functions perform the operation suggested by the name, and -returns the value that had previously been in memory. That is, - -@smallexample -@{ tmp = *ptr; *ptr @var{op}= value; return tmp; @} -@{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; @} // nand -@end smallexample - -@emph{Note:} GCC 4.4 and later implement @code{__sync_fetch_and_nand} -as @code{*ptr = ~(tmp & value)} instead of @code{*ptr = ~tmp & value}. - -@item @var{type} __sync_add_and_fetch (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_sub_and_fetch (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_or_and_fetch (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_and_and_fetch (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_xor_and_fetch (@var{type} *ptr, @var{type} value, ...) -@itemx @var{type} __sync_nand_and_fetch (@var{type} *ptr, @var{type} value, ...) -@findex __sync_add_and_fetch -@findex __sync_sub_and_fetch -@findex __sync_or_and_fetch -@findex __sync_and_and_fetch -@findex __sync_xor_and_fetch -@findex __sync_nand_and_fetch -These built-in functions perform the operation suggested by the name, and -return the new value. That is, - -@smallexample -@{ *ptr @var{op}= value; return *ptr; @} -@{ *ptr = ~(*ptr & value); return *ptr; @} // nand -@end smallexample - -@emph{Note:} GCC 4.4 and later implement @code{__sync_nand_and_fetch} -as @code{*ptr = ~(*ptr & value)} instead of -@code{*ptr = ~*ptr & value}. - -@item bool __sync_bool_compare_and_swap (@var{type} *ptr, @var{type} oldval, @var{type} newval, ...) -@itemx @var{type} __sync_val_compare_and_swap (@var{type} *ptr, @var{type} oldval, @var{type} newval, ...) -@findex __sync_bool_compare_and_swap -@findex __sync_val_compare_and_swap -These built-in functions perform an atomic compare and swap. -That is, if the current -value of @code{*@var{ptr}} is @var{oldval}, then write @var{newval} into -@code{*@var{ptr}}. - -The ``bool'' version returns true if the comparison is successful and -@var{newval} is written. The ``val'' version returns the contents -of @code{*@var{ptr}} before the operation. - -@item __sync_synchronize (...) -@findex __sync_synchronize -This built-in function issues a full memory barrier. - -@item @var{type} __sync_lock_test_and_set (@var{type} *ptr, @var{type} value, ...) -@findex __sync_lock_test_and_set -This built-in function, as described by Intel, is not a traditional test-and-set -operation, but rather an atomic exchange operation. It writes @var{value} -into @code{*@var{ptr}}, and returns the previous contents of -@code{*@var{ptr}}. - -Many targets have only minimal support for such locks, and do not support -a full exchange operation. In this case, a target may support reduced -functionality here by which the @emph{only} valid value to store is the -immediate constant 1. The exact value actually stored in @code{*@var{ptr}} -is implementation defined. - -This built-in function is not a full barrier, -but rather an @dfn{acquire barrier}. -This means that references after the operation cannot move to (or be -speculated to) before the operation, but previous memory stores may not -be globally visible yet, and previous memory loads may not yet be -satisfied. - -@item void __sync_lock_release (@var{type} *ptr, ...) -@findex __sync_lock_release -This built-in function releases the lock acquired by -@code{__sync_lock_test_and_set}. -Normally this means writing the constant 0 to @code{*@var{ptr}}. - -This built-in function is not a full barrier, -but rather a @dfn{release barrier}. -This means that all previous memory stores are globally visible, and all -previous memory loads have been satisfied, but following memory reads -are not prevented from being speculated to before the barrier. -@end table - -@node __atomic Builtins -@section Built-in Functions for Memory Model Aware Atomic Operations - -The following built-in functions approximately match the requirements for -C++11 memory model. Many are similar to the @samp{__sync} prefixed built-in -functions, but all also have a memory model parameter. These are all -identified by being prefixed with @samp{__atomic}, and most are overloaded -such that they work with multiple types. - -GCC allows any integral scalar or pointer type that is 1, 2, 4, or 8 -bytes in length. 16-byte integral types are also allowed if -@samp{__int128} (@pxref{__int128}) is supported by the architecture. - -Target architectures are encouraged to provide their own patterns for -each of these built-in functions. If no target is provided, the original -non-memory model set of @samp{__sync} atomic built-in functions are -utilized, along with any required synchronization fences surrounding it in -order to achieve the proper behavior. Execution in this case is subject -to the same restrictions as those built-in functions. - -If there is no pattern or mechanism to provide a lock free instruction -sequence, a call is made to an external routine with the same parameters -to be resolved at run time. - -The four non-arithmetic functions (load, store, exchange, and -compare_exchange) all have a generic version as well. This generic -version works on any data type. If the data type size maps to one -of the integral sizes that may have lock free support, the generic -version utilizes the lock free built-in function. Otherwise an -external call is left to be resolved at run time. This external call is -the same format with the addition of a @samp{size_t} parameter inserted -as the first parameter indicating the size of the object being pointed to. -All objects must be the same size. - -There are 6 different memory models that can be specified. These map -to the same names in the C++11 standard. Refer there or to the -@uref{http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync,GCC wiki on -atomic synchronization} for more detailed definitions. These memory -models integrate both barriers to code motion as well as synchronization -requirements with other threads. These are listed in approximately -ascending order of strength. It is also possible to use target specific -flags for memory model flags, like Hardware Lock Elision. - -@table @code -@item __ATOMIC_RELAXED -No barriers or synchronization. -@item __ATOMIC_CONSUME -Data dependency only for both barrier and synchronization with another -thread. -@item __ATOMIC_ACQUIRE -Barrier to hoisting of code and synchronizes with release (or stronger) -semantic stores from another thread. -@item __ATOMIC_RELEASE -Barrier to sinking of code and synchronizes with acquire (or stronger) -semantic loads from another thread. -@item __ATOMIC_ACQ_REL -Full barrier in both directions and synchronizes with acquire loads and -release stores in another thread. -@item __ATOMIC_SEQ_CST -Full barrier in both directions and synchronizes with acquire loads and -release stores in all threads. -@end table - -When implementing patterns for these built-in functions, the memory model -parameter can be ignored as long as the pattern implements the most -restrictive @code{__ATOMIC_SEQ_CST} model. Any of the other memory models -execute correctly with this memory model but they may not execute as -efficiently as they could with a more appropriate implementation of the -relaxed requirements. - -Note that the C++11 standard allows for the memory model parameter to be -determined at run time rather than at compile time. These built-in -functions map any run-time value to @code{__ATOMIC_SEQ_CST} rather -than invoke a runtime library call or inline a switch statement. This is -standard compliant, safe, and the simplest approach for now. - -The memory model parameter is a signed int, but only the lower 8 bits are -reserved for the memory model. The remainder of the signed int is reserved -for future use and should be 0. Use of the predefined atomic values -ensures proper usage. - -@deftypefn {Built-in Function} @var{type} __atomic_load_n (@var{type} *ptr, int memmodel) -This built-in function implements an atomic load operation. It returns the -contents of @code{*@var{ptr}}. - -The valid memory model variants are -@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE}, -and @code{__ATOMIC_CONSUME}. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_load (@var{type} *ptr, @var{type} *ret, int memmodel) -This is the generic version of an atomic load. It returns the -contents of @code{*@var{ptr}} in @code{*@var{ret}}. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_store_n (@var{type} *ptr, @var{type} val, int memmodel) -This built-in function implements an atomic store operation. It writes -@code{@var{val}} into @code{*@var{ptr}}. - -The valid memory model variants are -@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and @code{__ATOMIC_RELEASE}. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_store (@var{type} *ptr, @var{type} *val, int memmodel) -This is the generic version of an atomic store. It stores the value -of @code{*@var{val}} into @code{*@var{ptr}}. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __atomic_exchange_n (@var{type} *ptr, @var{type} val, int memmodel) -This built-in function implements an atomic exchange operation. It writes -@var{val} into @code{*@var{ptr}}, and returns the previous contents of -@code{*@var{ptr}}. - -The valid memory model variants are -@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE}, -@code{__ATOMIC_RELEASE}, and @code{__ATOMIC_ACQ_REL}. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_exchange (@var{type} *ptr, @var{type} *val, @var{type} *ret, int memmodel) -This is the generic version of an atomic exchange. It stores the -contents of @code{*@var{val}} into @code{*@var{ptr}}. The original value -of @code{*@var{ptr}} is copied into @code{*@var{ret}}. - -@end deftypefn - -@deftypefn {Built-in Function} bool __atomic_compare_exchange_n (@var{type} *ptr, @var{type} *expected, @var{type} desired, bool weak, int success_memmodel, int failure_memmodel) -This built-in function implements an atomic compare and exchange operation. -This compares the contents of @code{*@var{ptr}} with the contents of -@code{*@var{expected}} and if equal, writes @var{desired} into -@code{*@var{ptr}}. If they are not equal, the current contents of -@code{*@var{ptr}} is written into @code{*@var{expected}}. @var{weak} is true -for weak compare_exchange, and false for the strong variation. Many targets -only offer the strong variation and ignore the parameter. When in doubt, use -the strong variation. - -True is returned if @var{desired} is written into -@code{*@var{ptr}} and the execution is considered to conform to the -memory model specified by @var{success_memmodel}. There are no -restrictions on what memory model can be used here. - -False is returned otherwise, and the execution is considered to conform -to @var{failure_memmodel}. This memory model cannot be -@code{__ATOMIC_RELEASE} nor @code{__ATOMIC_ACQ_REL}. It also cannot be a -stronger model than that specified by @var{success_memmodel}. - -@end deftypefn - -@deftypefn {Built-in Function} bool __atomic_compare_exchange (@var{type} *ptr, @var{type} *expected, @var{type} *desired, bool weak, int success_memmodel, int failure_memmodel) -This built-in function implements the generic version of -@code{__atomic_compare_exchange}. The function is virtually identical to -@code{__atomic_compare_exchange_n}, except the desired value is also a -pointer. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __atomic_add_fetch (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_sub_fetch (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_and_fetch (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_xor_fetch (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_or_fetch (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_nand_fetch (@var{type} *ptr, @var{type} val, int memmodel) -These built-in functions perform the operation suggested by the name, and -return the result of the operation. That is, - -@smallexample -@{ *ptr @var{op}= val; return *ptr; @} -@end smallexample - -All memory models are valid. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __atomic_fetch_add (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_fetch_sub (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_fetch_and (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_fetch_xor (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_fetch_or (@var{type} *ptr, @var{type} val, int memmodel) -@deftypefnx {Built-in Function} @var{type} __atomic_fetch_nand (@var{type} *ptr, @var{type} val, int memmodel) -These built-in functions perform the operation suggested by the name, and -return the value that had previously been in @code{*@var{ptr}}. That is, - -@smallexample -@{ tmp = *ptr; *ptr @var{op}= val; return tmp; @} -@end smallexample - -All memory models are valid. - -@end deftypefn - -@deftypefn {Built-in Function} bool __atomic_test_and_set (void *ptr, int memmodel) - -This built-in function performs an atomic test-and-set operation on -the byte at @code{*@var{ptr}}. The byte is set to some implementation -defined nonzero ``set'' value and the return value is @code{true} if and only -if the previous contents were ``set''. -It should be only used for operands of type @code{bool} or @code{char}. For -other types only part of the value may be set. - -All memory models are valid. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_clear (bool *ptr, int memmodel) - -This built-in function performs an atomic clear operation on -@code{*@var{ptr}}. After the operation, @code{*@var{ptr}} contains 0. -It should be only used for operands of type @code{bool} or @code{char} and -in conjunction with @code{__atomic_test_and_set}. -For other types it may only clear partially. If the type is not @code{bool} -prefer using @code{__atomic_store}. - -The valid memory model variants are -@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and -@code{__ATOMIC_RELEASE}. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_thread_fence (int memmodel) - -This built-in function acts as a synchronization fence between threads -based on the specified memory model. - -All memory orders are valid. - -@end deftypefn - -@deftypefn {Built-in Function} void __atomic_signal_fence (int memmodel) - -This built-in function acts as a synchronization fence between a thread -and signal handlers based in the same thread. - -All memory orders are valid. - -@end deftypefn - -@deftypefn {Built-in Function} bool __atomic_always_lock_free (size_t size, void *ptr) - -This built-in function returns true if objects of @var{size} bytes always -generate lock free atomic instructions for the target architecture. -@var{size} must resolve to a compile-time constant and the result also -resolves to a compile-time constant. - -@var{ptr} is an optional pointer to the object that may be used to determine -alignment. A value of 0 indicates typical alignment should be used. The -compiler may also ignore this parameter. - -@smallexample -if (_atomic_always_lock_free (sizeof (long long), 0)) -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} bool __atomic_is_lock_free (size_t size, void *ptr) - -This built-in function returns true if objects of @var{size} bytes always -generate lock free atomic instructions for the target architecture. If -it is not known to be lock free a call is made to a runtime routine named -@code{__atomic_is_lock_free}. - -@var{ptr} is an optional pointer to the object that may be used to determine -alignment. A value of 0 indicates typical alignment should be used. The -compiler may also ignore this parameter. -@end deftypefn - -@node Integer Overflow Builtins -@section Built-in Functions to Perform Arithmetic with Overflow Checking - -The following built-in functions allow performing simple arithmetic operations -together with checking whether the operations overflowed. - -@deftypefn {Built-in Function} bool __builtin_add_overflow (@var{type1} a, @var{type2} b, @var{type3} *res) -@deftypefnx {Built-in Function} bool __builtin_sadd_overflow (int a, int b, int *res) -@deftypefnx {Built-in Function} bool __builtin_saddl_overflow (long int a, long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_saddll_overflow (long long int a, long long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_uadd_overflow (unsigned int a, unsigned int b, unsigned int *res) -@deftypefnx {Built-in Function} bool __builtin_uaddl_overflow (unsigned long int a, unsigned long int b, unsigned long int *res) -@deftypefnx {Built-in Function} bool __builtin_uaddll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res) - -These built-in functions promote the first two operands into infinite precision signed -type and perform addition on those promoted operands. The result is then -cast to the type the third pointer argument points to and stored there. -If the stored result is equal to the infinite precision result, the built-in -functions return false, otherwise they return true. As the addition is -performed in infinite signed precision, these built-in functions have fully defined -behavior for all argument values. - -The first built-in function allows arbitrary integral types for operands and -the result type must be pointer to some integer type, the rest of the built-in -functions have explicit integer types. - -The compiler will attempt to use hardware instructions to implement -these built-in functions where possible, like conditional jump on overflow -after addition, conditional jump on carry etc. - -@end deftypefn - -@deftypefn {Built-in Function} bool __builtin_sub_overflow (@var{type1} a, @var{type2} b, @var{type3} *res) -@deftypefnx {Built-in Function} bool __builtin_ssub_overflow (int a, int b, int *res) -@deftypefnx {Built-in Function} bool __builtin_ssubl_overflow (long int a, long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_ssubll_overflow (long long int a, long long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_usub_overflow (unsigned int a, unsigned int b, unsigned int *res) -@deftypefnx {Built-in Function} bool __builtin_usubl_overflow (unsigned long int a, unsigned long int b, unsigned long int *res) -@deftypefnx {Built-in Function} bool __builtin_usubll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res) - -These built-in functions are similar to the add overflow checking built-in -functions above, except they perform subtraction, subtract the second argument -from the first one, instead of addition. - -@end deftypefn - -@deftypefn {Built-in Function} bool __builtin_mul_overflow (@var{type1} a, @var{type2} b, @var{type3} *res) -@deftypefnx {Built-in Function} bool __builtin_smul_overflow (int a, int b, int *res) -@deftypefnx {Built-in Function} bool __builtin_smull_overflow (long int a, long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_smulll_overflow (long long int a, long long int b, long int *res) -@deftypefnx {Built-in Function} bool __builtin_umul_overflow (unsigned int a, unsigned int b, unsigned int *res) -@deftypefnx {Built-in Function} bool __builtin_umull_overflow (unsigned long int a, unsigned long int b, unsigned long int *res) -@deftypefnx {Built-in Function} bool __builtin_umulll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res) - -These built-in functions are similar to the add overflow checking built-in -functions above, except they perform multiplication, instead of addition. - -@end deftypefn - -@node x86 specific memory model extensions for transactional memory -@section x86-Specific Memory Model Extensions for Transactional Memory - -The x86 architecture supports additional memory ordering flags -to mark lock critical sections for hardware lock elision. -These must be specified in addition to an existing memory model to -atomic intrinsics. - -@table @code -@item __ATOMIC_HLE_ACQUIRE -Start lock elision on a lock variable. -Memory model must be @code{__ATOMIC_ACQUIRE} or stronger. -@item __ATOMIC_HLE_RELEASE -End lock elision on a lock variable. -Memory model must be @code{__ATOMIC_RELEASE} or stronger. -@end table - -When a lock acquire fails it is required for good performance to abort -the transaction quickly. This can be done with a @code{_mm_pause} - -@smallexample -#include // For _mm_pause - -int lockvar; - -/* Acquire lock with lock elision */ -while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE)) - _mm_pause(); /* Abort failed transaction */ -... -/* Free lock with lock elision */ -__atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); -@end smallexample - -@node Object Size Checking -@section Object Size Checking Built-in Functions -@findex __builtin_object_size -@findex __builtin___memcpy_chk -@findex __builtin___mempcpy_chk -@findex __builtin___memmove_chk -@findex __builtin___memset_chk -@findex __builtin___strcpy_chk -@findex __builtin___stpcpy_chk -@findex __builtin___strncpy_chk -@findex __builtin___strcat_chk -@findex __builtin___strncat_chk -@findex __builtin___sprintf_chk -@findex __builtin___snprintf_chk -@findex __builtin___vsprintf_chk -@findex __builtin___vsnprintf_chk -@findex __builtin___printf_chk -@findex __builtin___vprintf_chk -@findex __builtin___fprintf_chk -@findex __builtin___vfprintf_chk - -GCC implements a limited buffer overflow protection mechanism -that can prevent some buffer overflow attacks. - -@deftypefn {Built-in Function} {size_t} __builtin_object_size (void * @var{ptr}, int @var{type}) -is a built-in construct that returns a constant number of bytes from -@var{ptr} to the end of the object @var{ptr} pointer points to -(if known at compile time). @code{__builtin_object_size} never evaluates -its arguments for side-effects. If there are any side-effects in them, it -returns @code{(size_t) -1} for @var{type} 0 or 1 and @code{(size_t) 0} -for @var{type} 2 or 3. If there are multiple objects @var{ptr} can -point to and all of them are known at compile time, the returned number -is the maximum of remaining byte counts in those objects if @var{type} & 2 is -0 and minimum if nonzero. If it is not possible to determine which objects -@var{ptr} points to at compile time, @code{__builtin_object_size} should -return @code{(size_t) -1} for @var{type} 0 or 1 and @code{(size_t) 0} -for @var{type} 2 or 3. - -@var{type} is an integer constant from 0 to 3. If the least significant -bit is clear, objects are whole variables, if it is set, a closest -surrounding subobject is considered the object a pointer points to. -The second bit determines if maximum or minimum of remaining bytes -is computed. - -@smallexample -struct V @{ char buf1[10]; int b; char buf2[10]; @} var; -char *p = &var.buf1[1], *q = &var.b; - -/* Here the object p points to is var. */ -assert (__builtin_object_size (p, 0) == sizeof (var) - 1); -/* The subobject p points to is var.buf1. */ -assert (__builtin_object_size (p, 1) == sizeof (var.buf1) - 1); -/* The object q points to is var. */ -assert (__builtin_object_size (q, 0) - == (char *) (&var + 1) - (char *) &var.b); -/* The subobject q points to is var.b. */ -assert (__builtin_object_size (q, 1) == sizeof (var.b)); -@end smallexample -@end deftypefn - -There are built-in functions added for many common string operation -functions, e.g., for @code{memcpy} @code{__builtin___memcpy_chk} -built-in is provided. This built-in has an additional last argument, -which is the number of bytes remaining in object the @var{dest} -argument points to or @code{(size_t) -1} if the size is not known. - -The built-in functions are optimized into the normal string functions -like @code{memcpy} if the last argument is @code{(size_t) -1} or if -it is known at compile time that the destination object will not -be overflown. If the compiler can determine at compile time the -object will be always overflown, it issues a warning. - -The intended use can be e.g.@: - -@smallexample -#undef memcpy -#define bos0(dest) __builtin_object_size (dest, 0) -#define memcpy(dest, src, n) \ - __builtin___memcpy_chk (dest, src, n, bos0 (dest)) - -char *volatile p; -char buf[10]; -/* It is unknown what object p points to, so this is optimized - into plain memcpy - no checking is possible. */ -memcpy (p, "abcde", n); -/* Destination is known and length too. It is known at compile - time there will be no overflow. */ -memcpy (&buf[5], "abcde", 5); -/* Destination is known, but the length is not known at compile time. - This will result in __memcpy_chk call that can check for overflow - at run time. */ -memcpy (&buf[5], "abcde", n); -/* Destination is known and it is known at compile time there will - be overflow. There will be a warning and __memcpy_chk call that - will abort the program at run time. */ -memcpy (&buf[6], "abcde", 5); -@end smallexample - -Such built-in functions are provided for @code{memcpy}, @code{mempcpy}, -@code{memmove}, @code{memset}, @code{strcpy}, @code{stpcpy}, @code{strncpy}, -@code{strcat} and @code{strncat}. - -There are also checking built-in functions for formatted output functions. -@smallexample -int __builtin___sprintf_chk (char *s, int flag, size_t os, const char *fmt, ...); -int __builtin___snprintf_chk (char *s, size_t maxlen, int flag, size_t os, - const char *fmt, ...); -int __builtin___vsprintf_chk (char *s, int flag, size_t os, const char *fmt, - va_list ap); -int __builtin___vsnprintf_chk (char *s, size_t maxlen, int flag, size_t os, - const char *fmt, va_list ap); -@end smallexample - -The added @var{flag} argument is passed unchanged to @code{__sprintf_chk} -etc.@: functions and can contain implementation specific flags on what -additional security measures the checking function might take, such as -handling @code{%n} differently. - -The @var{os} argument is the object size @var{s} points to, like in the -other built-in functions. There is a small difference in the behavior -though, if @var{os} is @code{(size_t) -1}, the built-in functions are -optimized into the non-checking functions only if @var{flag} is 0, otherwise -the checking function is called with @var{os} argument set to -@code{(size_t) -1}. - -In addition to this, there are checking built-in functions -@code{__builtin___printf_chk}, @code{__builtin___vprintf_chk}, -@code{__builtin___fprintf_chk} and @code{__builtin___vfprintf_chk}. -These have just one additional argument, @var{flag}, right before -format string @var{fmt}. If the compiler is able to optimize them to -@code{fputc} etc.@: functions, it does, otherwise the checking function -is called and the @var{flag} argument passed to it. - -@node Pointer Bounds Checker builtins -@section Pointer Bounds Checker Built-in Functions -@cindex Pointer Bounds Checker builtins -@findex __builtin___bnd_set_ptr_bounds -@findex __builtin___bnd_narrow_ptr_bounds -@findex __builtin___bnd_copy_ptr_bounds -@findex __builtin___bnd_init_ptr_bounds -@findex __builtin___bnd_null_ptr_bounds -@findex __builtin___bnd_store_ptr_bounds -@findex __builtin___bnd_chk_ptr_lbounds -@findex __builtin___bnd_chk_ptr_ubounds -@findex __builtin___bnd_chk_ptr_bounds -@findex __builtin___bnd_get_ptr_lbound -@findex __builtin___bnd_get_ptr_ubound - -GCC provides a set of built-in functions to control Pointer Bounds Checker -instrumentation. Note that all Pointer Bounds Checker builtins can be used -even if you compile with Pointer Bounds Checker off -(@option{-fno-check-pointer-bounds}). -The behavior may differ in such case as documented below. - -@deftypefn {Built-in Function} {void *} __builtin___bnd_set_ptr_bounds (const void *@var{q}, size_t @var{size}) - -This built-in function returns a new pointer with the value of @var{q}, and -associate it with the bounds [@var{q}, @var{q}+@var{size}-1]. With Pointer -Bounds Checker off, the built-in function just returns the first argument. - -@smallexample -extern void *__wrap_malloc (size_t n) -@{ - void *p = (void *)__real_malloc (n); - if (!p) return __builtin___bnd_null_ptr_bounds (p); - return __builtin___bnd_set_ptr_bounds (p, n); -@} -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin___bnd_narrow_ptr_bounds (const void *@var{p}, const void *@var{q}, size_t @var{size}) - -This built-in function returns a new pointer with the value of @var{p} -and associates it with the narrowed bounds formed by the intersection -of bounds associated with @var{q} and the bounds -[@var{p}, @var{p} + @var{size} - 1]. -With Pointer Bounds Checker off, the built-in function just returns the first -argument. - -@smallexample -void init_objects (object *objs, size_t size) -@{ - size_t i; - /* Initialize objects one-by-one passing pointers with bounds of - an object, not the full array of objects. */ - for (i = 0; i < size; i++) - init_object (__builtin___bnd_narrow_ptr_bounds (objs + i, objs, - sizeof(object))); -@} -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin___bnd_copy_ptr_bounds (const void *@var{q}, const void *@var{r}) - -This built-in function returns a new pointer with the value of @var{q}, -and associates it with the bounds already associated with pointer @var{r}. -With Pointer Bounds Checker off, the built-in function just returns the first -argument. - -@smallexample -/* Here is a way to get pointer to object's field but - still with the full object's bounds. */ -int *field_ptr = __builtin___bnd_copy_ptr_bounds (&objptr->int_field, - objptr); -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin___bnd_init_ptr_bounds (const void *@var{q}) - -This built-in function returns a new pointer with the value of @var{q}, and -associates it with INIT (allowing full memory access) bounds. With Pointer -Bounds Checker off, the built-in function just returns the first argument. - -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin___bnd_null_ptr_bounds (const void *@var{q}) - -This built-in function returns a new pointer with the value of @var{q}, and -associates it with NULL (allowing no memory access) bounds. With Pointer -Bounds Checker off, the built-in function just returns the first argument. - -@end deftypefn - -@deftypefn {Built-in Function} void __builtin___bnd_store_ptr_bounds (const void **@var{ptr_addr}, const void *@var{ptr_val}) - -This built-in function stores the bounds associated with pointer @var{ptr_val} -and location @var{ptr_addr} into Bounds Table. This can be useful to propagate -bounds from legacy code without touching the associated pointer's memory when -pointers are copied as integers. With Pointer Bounds Checker off, the built-in -function call is ignored. - -@end deftypefn - -@deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_lbounds (const void *@var{q}) - -This built-in function checks if the pointer @var{q} is within the lower -bound of its associated bounds. With Pointer Bounds Checker off, the built-in -function call is ignored. - -@smallexample -extern void *__wrap_memset (void *dst, int c, size_t len) -@{ - if (len > 0) - @{ - __builtin___bnd_chk_ptr_lbounds (dst); - __builtin___bnd_chk_ptr_ubounds ((char *)dst + len - 1); - __real_memset (dst, c, len); - @} - return dst; -@} -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_ubounds (const void *@var{q}) - -This built-in function checks if the pointer @var{q} is within the upper -bound of its associated bounds. With Pointer Bounds Checker off, the built-in -function call is ignored. - -@end deftypefn - -@deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_bounds (const void *@var{q}, size_t @var{size}) - -This built-in function checks if [@var{q}, @var{q} + @var{size} - 1] is within -the lower and upper bounds associated with @var{q}. With Pointer Bounds Checker -off, the built-in function call is ignored. - -@smallexample -extern void *__wrap_memcpy (void *dst, const void *src, size_t n) -@{ - if (n > 0) - @{ - __bnd_chk_ptr_bounds (dst, n); - __bnd_chk_ptr_bounds (src, n); - __real_memcpy (dst, src, n); - @} - return dst; -@} -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} {const void *} __builtin___bnd_get_ptr_lbound (const void *@var{q}) - -This built-in function returns the lower bound associated -with the pointer @var{q}, as a pointer value. -This is useful for debugging using @code{printf}. -With Pointer Bounds Checker off, the built-in function returns 0. - -@smallexample -void *lb = __builtin___bnd_get_ptr_lbound (q); -void *ub = __builtin___bnd_get_ptr_ubound (q); -printf ("q = %p lb(q) = %p ub(q) = %p", q, lb, ub); -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} {const void *} __builtin___bnd_get_ptr_ubound (const void *@var{q}) - -This built-in function returns the upper bound (which is a pointer) associated -with the pointer @var{q}. With Pointer Bounds Checker off, -the built-in function returns -1. - -@end deftypefn - -@node Cilk Plus Builtins -@section Cilk Plus C/C++ Language Extension Built-in Functions - -GCC provides support for the following built-in reduction functions if Cilk Plus -is enabled. Cilk Plus can be enabled using the @option{-fcilkplus} flag. - -@itemize @bullet -@item @code{__sec_implicit_index} -@item @code{__sec_reduce} -@item @code{__sec_reduce_add} -@item @code{__sec_reduce_all_nonzero} -@item @code{__sec_reduce_all_zero} -@item @code{__sec_reduce_any_nonzero} -@item @code{__sec_reduce_any_zero} -@item @code{__sec_reduce_max} -@item @code{__sec_reduce_min} -@item @code{__sec_reduce_max_ind} -@item @code{__sec_reduce_min_ind} -@item @code{__sec_reduce_mul} -@item @code{__sec_reduce_mutating} -@end itemize - -Further details and examples about these built-in functions are described -in the Cilk Plus language manual which can be found at -@uref{http://www.cilkplus.org}. - -@node Other Builtins -@section Other Built-in Functions Provided by GCC -@cindex built-in functions -@findex __builtin_call_with_static_chain -@findex __builtin_fpclassify -@findex __builtin_isfinite -@findex __builtin_isnormal -@findex __builtin_isgreater -@findex __builtin_isgreaterequal -@findex __builtin_isinf_sign -@findex __builtin_isless -@findex __builtin_islessequal -@findex __builtin_islessgreater -@findex __builtin_isunordered -@findex __builtin_powi -@findex __builtin_powif -@findex __builtin_powil -@findex _Exit -@findex _exit -@findex abort -@findex abs -@findex acos -@findex acosf -@findex acosh -@findex acoshf -@findex acoshl -@findex acosl -@findex alloca -@findex asin -@findex asinf -@findex asinh -@findex asinhf -@findex asinhl -@findex asinl -@findex atan -@findex atan2 -@findex atan2f -@findex atan2l -@findex atanf -@findex atanh -@findex atanhf -@findex atanhl -@findex atanl -@findex bcmp -@findex bzero -@findex cabs -@findex cabsf -@findex cabsl -@findex cacos -@findex cacosf -@findex cacosh -@findex cacoshf -@findex cacoshl -@findex cacosl -@findex calloc -@findex carg -@findex cargf -@findex cargl -@findex casin -@findex casinf -@findex casinh -@findex casinhf -@findex casinhl -@findex casinl -@findex catan -@findex catanf -@findex catanh -@findex catanhf -@findex catanhl -@findex catanl -@findex cbrt -@findex cbrtf -@findex cbrtl -@findex ccos -@findex ccosf -@findex ccosh -@findex ccoshf -@findex ccoshl -@findex ccosl -@findex ceil -@findex ceilf -@findex ceill -@findex cexp -@findex cexpf -@findex cexpl -@findex cimag -@findex cimagf -@findex cimagl -@findex clog -@findex clogf -@findex clogl -@findex conj -@findex conjf -@findex conjl -@findex copysign -@findex copysignf -@findex copysignl -@findex cos -@findex cosf -@findex cosh -@findex coshf -@findex coshl -@findex cosl -@findex cpow -@findex cpowf -@findex cpowl -@findex cproj -@findex cprojf -@findex cprojl -@findex creal -@findex crealf -@findex creall -@findex csin -@findex csinf -@findex csinh -@findex csinhf -@findex csinhl -@findex csinl -@findex csqrt -@findex csqrtf -@findex csqrtl -@findex ctan -@findex ctanf -@findex ctanh -@findex ctanhf -@findex ctanhl -@findex ctanl -@findex dcgettext -@findex dgettext -@findex drem -@findex dremf -@findex dreml -@findex erf -@findex erfc -@findex erfcf -@findex erfcl -@findex erff -@findex erfl -@findex exit -@findex exp -@findex exp10 -@findex exp10f -@findex exp10l -@findex exp2 -@findex exp2f -@findex exp2l -@findex expf -@findex expl -@findex expm1 -@findex expm1f -@findex expm1l -@findex fabs -@findex fabsf -@findex fabsl -@findex fdim -@findex fdimf -@findex fdiml -@findex ffs -@findex floor -@findex floorf -@findex floorl -@findex fma -@findex fmaf -@findex fmal -@findex fmax -@findex fmaxf -@findex fmaxl -@findex fmin -@findex fminf -@findex fminl -@findex fmod -@findex fmodf -@findex fmodl -@findex fprintf -@findex fprintf_unlocked -@findex fputs -@findex fputs_unlocked -@findex frexp -@findex frexpf -@findex frexpl -@findex fscanf -@findex gamma -@findex gammaf -@findex gammal -@findex gamma_r -@findex gammaf_r -@findex gammal_r -@findex gettext -@findex hypot -@findex hypotf -@findex hypotl -@findex ilogb -@findex ilogbf -@findex ilogbl -@findex imaxabs -@findex index -@findex isalnum -@findex isalpha -@findex isascii -@findex isblank -@findex iscntrl -@findex isdigit -@findex isgraph -@findex islower -@findex isprint -@findex ispunct -@findex isspace -@findex isupper -@findex iswalnum -@findex iswalpha -@findex iswblank -@findex iswcntrl -@findex iswdigit -@findex iswgraph -@findex iswlower -@findex iswprint -@findex iswpunct -@findex iswspace -@findex iswupper -@findex iswxdigit -@findex isxdigit -@findex j0 -@findex j0f -@findex j0l -@findex j1 -@findex j1f -@findex j1l -@findex jn -@findex jnf -@findex jnl -@findex labs -@findex ldexp -@findex ldexpf -@findex ldexpl -@findex lgamma -@findex lgammaf -@findex lgammal -@findex lgamma_r -@findex lgammaf_r -@findex lgammal_r -@findex llabs -@findex llrint -@findex llrintf -@findex llrintl -@findex llround -@findex llroundf -@findex llroundl -@findex log -@findex log10 -@findex log10f -@findex log10l -@findex log1p -@findex log1pf -@findex log1pl -@findex log2 -@findex log2f -@findex log2l -@findex logb -@findex logbf -@findex logbl -@findex logf -@findex logl -@findex lrint -@findex lrintf -@findex lrintl -@findex lround -@findex lroundf -@findex lroundl -@findex malloc -@findex memchr -@findex memcmp -@findex memcpy -@findex mempcpy -@findex memset -@findex modf -@findex modff -@findex modfl -@findex nearbyint -@findex nearbyintf -@findex nearbyintl -@findex nextafter -@findex nextafterf -@findex nextafterl -@findex nexttoward -@findex nexttowardf -@findex nexttowardl -@findex pow -@findex pow10 -@findex pow10f -@findex pow10l -@findex powf -@findex powl -@findex printf -@findex printf_unlocked -@findex putchar -@findex puts -@findex remainder -@findex remainderf -@findex remainderl -@findex remquo -@findex remquof -@findex remquol -@findex rindex -@findex rint -@findex rintf -@findex rintl -@findex round -@findex roundf -@findex roundl -@findex scalb -@findex scalbf -@findex scalbl -@findex scalbln -@findex scalblnf -@findex scalblnf -@findex scalbn -@findex scalbnf -@findex scanfnl -@findex signbit -@findex signbitf -@findex signbitl -@findex signbitd32 -@findex signbitd64 -@findex signbitd128 -@findex significand -@findex significandf -@findex significandl -@findex sin -@findex sincos -@findex sincosf -@findex sincosl -@findex sinf -@findex sinh -@findex sinhf -@findex sinhl -@findex sinl -@findex snprintf -@findex sprintf -@findex sqrt -@findex sqrtf -@findex sqrtl -@findex sscanf -@findex stpcpy -@findex stpncpy -@findex strcasecmp -@findex strcat -@findex strchr -@findex strcmp -@findex strcpy -@findex strcspn -@findex strdup -@findex strfmon -@findex strftime -@findex strlen -@findex strncasecmp -@findex strncat -@findex strncmp -@findex strncpy -@findex strndup -@findex strpbrk -@findex strrchr -@findex strspn -@findex strstr -@findex tan -@findex tanf -@findex tanh -@findex tanhf -@findex tanhl -@findex tanl -@findex tgamma -@findex tgammaf -@findex tgammal -@findex toascii -@findex tolower -@findex toupper -@findex towlower -@findex towupper -@findex trunc -@findex truncf -@findex truncl -@findex vfprintf -@findex vfscanf -@findex vprintf -@findex vscanf -@findex vsnprintf -@findex vsprintf -@findex vsscanf -@findex y0 -@findex y0f -@findex y0l -@findex y1 -@findex y1f -@findex y1l -@findex yn -@findex ynf -@findex ynl - -GCC provides a large number of built-in functions other than the ones -mentioned above. Some of these are for internal use in the processing -of exceptions or variable-length argument lists and are not -documented here because they may change from time to time; we do not -recommend general use of these functions. - -The remaining functions are provided for optimization purposes. - -@opindex fno-builtin -GCC includes built-in versions of many of the functions in the standard -C library. The versions prefixed with @code{__builtin_} are always -treated as having the same meaning as the C library function even if you -specify the @option{-fno-builtin} option. (@pxref{C Dialect Options}) -Many of these functions are only optimized in certain cases; if they are -not optimized in a particular case, a call to the library function is -emitted. - -@opindex ansi -@opindex std -Outside strict ISO C mode (@option{-ansi}, @option{-std=c90}, -@option{-std=c99} or @option{-std=c11}), the functions -@code{_exit}, @code{alloca}, @code{bcmp}, @code{bzero}, -@code{dcgettext}, @code{dgettext}, @code{dremf}, @code{dreml}, -@code{drem}, @code{exp10f}, @code{exp10l}, @code{exp10}, @code{ffsll}, -@code{ffsl}, @code{ffs}, @code{fprintf_unlocked}, -@code{fputs_unlocked}, @code{gammaf}, @code{gammal}, @code{gamma}, -@code{gammaf_r}, @code{gammal_r}, @code{gamma_r}, @code{gettext}, -@code{index}, @code{isascii}, @code{j0f}, @code{j0l}, @code{j0}, -@code{j1f}, @code{j1l}, @code{j1}, @code{jnf}, @code{jnl}, @code{jn}, -@code{lgammaf_r}, @code{lgammal_r}, @code{lgamma_r}, @code{mempcpy}, -@code{pow10f}, @code{pow10l}, @code{pow10}, @code{printf_unlocked}, -@code{rindex}, @code{scalbf}, @code{scalbl}, @code{scalb}, -@code{signbit}, @code{signbitf}, @code{signbitl}, @code{signbitd32}, -@code{signbitd64}, @code{signbitd128}, @code{significandf}, -@code{significandl}, @code{significand}, @code{sincosf}, -@code{sincosl}, @code{sincos}, @code{stpcpy}, @code{stpncpy}, -@code{strcasecmp}, @code{strdup}, @code{strfmon}, @code{strncasecmp}, -@code{strndup}, @code{toascii}, @code{y0f}, @code{y0l}, @code{y0}, -@code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and -@code{yn} -may be handled as built-in functions. -All these functions have corresponding versions -prefixed with @code{__builtin_}, which may be used even in strict C90 -mode. - -The ISO C99 functions -@code{_Exit}, @code{acoshf}, @code{acoshl}, @code{acosh}, @code{asinhf}, -@code{asinhl}, @code{asinh}, @code{atanhf}, @code{atanhl}, @code{atanh}, -@code{cabsf}, @code{cabsl}, @code{cabs}, @code{cacosf}, @code{cacoshf}, -@code{cacoshl}, @code{cacosh}, @code{cacosl}, @code{cacos}, -@code{cargf}, @code{cargl}, @code{carg}, @code{casinf}, @code{casinhf}, -@code{casinhl}, @code{casinh}, @code{casinl}, @code{casin}, -@code{catanf}, @code{catanhf}, @code{catanhl}, @code{catanh}, -@code{catanl}, @code{catan}, @code{cbrtf}, @code{cbrtl}, @code{cbrt}, -@code{ccosf}, @code{ccoshf}, @code{ccoshl}, @code{ccosh}, @code{ccosl}, -@code{ccos}, @code{cexpf}, @code{cexpl}, @code{cexp}, @code{cimagf}, -@code{cimagl}, @code{cimag}, @code{clogf}, @code{clogl}, @code{clog}, -@code{conjf}, @code{conjl}, @code{conj}, @code{copysignf}, @code{copysignl}, -@code{copysign}, @code{cpowf}, @code{cpowl}, @code{cpow}, @code{cprojf}, -@code{cprojl}, @code{cproj}, @code{crealf}, @code{creall}, @code{creal}, -@code{csinf}, @code{csinhf}, @code{csinhl}, @code{csinh}, @code{csinl}, -@code{csin}, @code{csqrtf}, @code{csqrtl}, @code{csqrt}, @code{ctanf}, -@code{ctanhf}, @code{ctanhl}, @code{ctanh}, @code{ctanl}, @code{ctan}, -@code{erfcf}, @code{erfcl}, @code{erfc}, @code{erff}, @code{erfl}, -@code{erf}, @code{exp2f}, @code{exp2l}, @code{exp2}, @code{expm1f}, -@code{expm1l}, @code{expm1}, @code{fdimf}, @code{fdiml}, @code{fdim}, -@code{fmaf}, @code{fmal}, @code{fmaxf}, @code{fmaxl}, @code{fmax}, -@code{fma}, @code{fminf}, @code{fminl}, @code{fmin}, @code{hypotf}, -@code{hypotl}, @code{hypot}, @code{ilogbf}, @code{ilogbl}, @code{ilogb}, -@code{imaxabs}, @code{isblank}, @code{iswblank}, @code{lgammaf}, -@code{lgammal}, @code{lgamma}, @code{llabs}, @code{llrintf}, @code{llrintl}, -@code{llrint}, @code{llroundf}, @code{llroundl}, @code{llround}, -@code{log1pf}, @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l}, -@code{log2}, @code{logbf}, @code{logbl}, @code{logb}, @code{lrintf}, -@code{lrintl}, @code{lrint}, @code{lroundf}, @code{lroundl}, -@code{lround}, @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint}, -@code{nextafterf}, @code{nextafterl}, @code{nextafter}, -@code{nexttowardf}, @code{nexttowardl}, @code{nexttoward}, -@code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof}, -@code{remquol}, @code{remquo}, @code{rintf}, @code{rintl}, @code{rint}, -@code{roundf}, @code{roundl}, @code{round}, @code{scalblnf}, -@code{scalblnl}, @code{scalbln}, @code{scalbnf}, @code{scalbnl}, -@code{scalbn}, @code{snprintf}, @code{tgammaf}, @code{tgammal}, -@code{tgamma}, @code{truncf}, @code{truncl}, @code{trunc}, -@code{vfscanf}, @code{vscanf}, @code{vsnprintf} and @code{vsscanf} -are handled as built-in functions -except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}). - -There are also built-in versions of the ISO C99 functions -@code{acosf}, @code{acosl}, @code{asinf}, @code{asinl}, @code{atan2f}, -@code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill}, -@code{cosf}, @code{coshf}, @code{coshl}, @code{cosl}, @code{expf}, -@code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{floorl}, -@code{fmodf}, @code{fmodl}, @code{frexpf}, @code{frexpl}, @code{ldexpf}, -@code{ldexpl}, @code{log10f}, @code{log10l}, @code{logf}, @code{logl}, -@code{modfl}, @code{modf}, @code{powf}, @code{powl}, @code{sinf}, -@code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf}, @code{sqrtl}, -@code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl} -that are recognized in any mode since ISO C90 reserves these names for -the purpose to which ISO C99 puts them. All these functions have -corresponding versions prefixed with @code{__builtin_}. - -The ISO C94 functions -@code{iswalnum}, @code{iswalpha}, @code{iswcntrl}, @code{iswdigit}, -@code{iswgraph}, @code{iswlower}, @code{iswprint}, @code{iswpunct}, -@code{iswspace}, @code{iswupper}, @code{iswxdigit}, @code{towlower} and -@code{towupper} -are handled as built-in functions -except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}). - -The ISO C90 functions -@code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2}, -@code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos}, -@code{exit}, @code{exp}, @code{fabs}, @code{floor}, @code{fmod}, -@code{fprintf}, @code{fputs}, @code{frexp}, @code{fscanf}, -@code{isalnum}, @code{isalpha}, @code{iscntrl}, @code{isdigit}, -@code{isgraph}, @code{islower}, @code{isprint}, @code{ispunct}, -@code{isspace}, @code{isupper}, @code{isxdigit}, @code{tolower}, -@code{toupper}, @code{labs}, @code{ldexp}, @code{log10}, @code{log}, -@code{malloc}, @code{memchr}, @code{memcmp}, @code{memcpy}, -@code{memset}, @code{modf}, @code{pow}, @code{printf}, @code{putchar}, -@code{puts}, @code{scanf}, @code{sinh}, @code{sin}, @code{snprintf}, -@code{sprintf}, @code{sqrt}, @code{sscanf}, @code{strcat}, -@code{strchr}, @code{strcmp}, @code{strcpy}, @code{strcspn}, -@code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy}, -@code{strpbrk}, @code{strrchr}, @code{strspn}, @code{strstr}, -@code{tanh}, @code{tan}, @code{vfprintf}, @code{vprintf} and @code{vsprintf} -are all recognized as built-in functions unless -@option{-fno-builtin} is specified (or @option{-fno-builtin-@var{function}} -is specified for an individual function). All of these functions have -corresponding versions prefixed with @code{__builtin_}. - -GCC provides built-in versions of the ISO C99 floating-point comparison -macros that avoid raising exceptions for unordered operands. They have -the same names as the standard macros ( @code{isgreater}, -@code{isgreaterequal}, @code{isless}, @code{islessequal}, -@code{islessgreater}, and @code{isunordered}) , with @code{__builtin_} -prefixed. We intend for a library implementor to be able to simply -@code{#define} each standard macro to its built-in equivalent. -In the same fashion, GCC provides @code{fpclassify}, @code{isfinite}, -@code{isinf_sign} and @code{isnormal} built-ins used with -@code{__builtin_} prefixed. The @code{isinf} and @code{isnan} -built-in functions appear both with and without the @code{__builtin_} prefix. - -@deftypefn {Built-in Function} int __builtin_types_compatible_p (@var{type1}, @var{type2}) - -You can use the built-in function @code{__builtin_types_compatible_p} to -determine whether two types are the same. - -This built-in function returns 1 if the unqualified versions of the -types @var{type1} and @var{type2} (which are types, not expressions) are -compatible, 0 otherwise. The result of this built-in function can be -used in integer constant expressions. - -This built-in function ignores top level qualifiers (e.g., @code{const}, -@code{volatile}). For example, @code{int} is equivalent to @code{const -int}. - -The type @code{int[]} and @code{int[5]} are compatible. On the other -hand, @code{int} and @code{char *} are not compatible, even if the size -of their types, on the particular architecture are the same. Also, the -amount of pointer indirection is taken into account when determining -similarity. Consequently, @code{short *} is not similar to -@code{short **}. Furthermore, two types that are typedefed are -considered compatible if their underlying types are compatible. - -An @code{enum} type is not considered to be compatible with another -@code{enum} type even if both are compatible with the same integer -type; this is what the C standard specifies. -For example, @code{enum @{foo, bar@}} is not similar to -@code{enum @{hot, dog@}}. - -You typically use this function in code whose execution varies -depending on the arguments' types. For example: - -@smallexample -#define foo(x) \ - (@{ \ - typeof (x) tmp = (x); \ - if (__builtin_types_compatible_p (typeof (x), long double)) \ - tmp = foo_long_double (tmp); \ - else if (__builtin_types_compatible_p (typeof (x), double)) \ - tmp = foo_double (tmp); \ - else if (__builtin_types_compatible_p (typeof (x), float)) \ - tmp = foo_float (tmp); \ - else \ - abort (); \ - tmp; \ - @}) -@end smallexample - -@emph{Note:} This construct is only available for C@. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __builtin_call_with_static_chain (@var{call_exp}, @var{pointer_exp}) - -The @var{call_exp} expression must be a function call, and the -@var{pointer_exp} expression must be a pointer. The @var{pointer_exp} -is passed to the function call in the target's static chain location. -The result of builtin is the result of the function call. - -@emph{Note:} This builtin is only available for C@. -This builtin can be used to call Go closures from C. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __builtin_choose_expr (@var{const_exp}, @var{exp1}, @var{exp2}) - -You can use the built-in function @code{__builtin_choose_expr} to -evaluate code depending on the value of a constant expression. This -built-in function returns @var{exp1} if @var{const_exp}, which is an -integer constant expression, is nonzero. Otherwise it returns @var{exp2}. - -This built-in function is analogous to the @samp{? :} operator in C, -except that the expression returned has its type unaltered by promotion -rules. Also, the built-in function does not evaluate the expression -that is not chosen. For example, if @var{const_exp} evaluates to true, -@var{exp2} is not evaluated even if it has side-effects. - -This built-in function can return an lvalue if the chosen argument is an -lvalue. - -If @var{exp1} is returned, the return type is the same as @var{exp1}'s -type. Similarly, if @var{exp2} is returned, its return type is the same -as @var{exp2}. - -Example: - -@smallexample -#define foo(x) \ - __builtin_choose_expr ( \ - __builtin_types_compatible_p (typeof (x), double), \ - foo_double (x), \ - __builtin_choose_expr ( \ - __builtin_types_compatible_p (typeof (x), float), \ - foo_float (x), \ - /* @r{The void expression results in a compile-time error} \ - @r{when assigning the result to something.} */ \ - (void)0)) -@end smallexample - -@emph{Note:} This construct is only available for C@. Furthermore, the -unused expression (@var{exp1} or @var{exp2} depending on the value of -@var{const_exp}) may still generate syntax errors. This may change in -future revisions. - -@end deftypefn - -@deftypefn {Built-in Function} @var{type} __builtin_complex (@var{real}, @var{imag}) - -The built-in function @code{__builtin_complex} is provided for use in -implementing the ISO C11 macros @code{CMPLXF}, @code{CMPLX} and -@code{CMPLXL}. @var{real} and @var{imag} must have the same type, a -real binary floating-point type, and the result has the corresponding -complex type with real and imaginary parts @var{real} and @var{imag}. -Unlike @samp{@var{real} + I * @var{imag}}, this works even when -infinities, NaNs and negative zeros are involved. - -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_constant_p (@var{exp}) -You can use the built-in function @code{__builtin_constant_p} to -determine if a value is known to be constant at compile time and hence -that GCC can perform constant-folding on expressions involving that -value. The argument of the function is the value to test. The function -returns the integer 1 if the argument is known to be a compile-time -constant and 0 if it is not known to be a compile-time constant. A -return of 0 does not indicate that the value is @emph{not} a constant, -but merely that GCC cannot prove it is a constant with the specified -value of the @option{-O} option. - -You typically use this function in an embedded application where -memory is a critical resource. If you have some complex calculation, -you may want it to be folded if it involves constants, but need to call -a function if it does not. For example: - -@smallexample -#define Scale_Value(X) \ - (__builtin_constant_p (X) \ - ? ((X) * SCALE + OFFSET) : Scale (X)) -@end smallexample - -You may use this built-in function in either a macro or an inline -function. However, if you use it in an inlined function and pass an -argument of the function as the argument to the built-in, GCC -never returns 1 when you call the inline function with a string constant -or compound literal (@pxref{Compound Literals}) and does not return 1 -when you pass a constant numeric value to the inline function unless you -specify the @option{-O} option. - -You may also use @code{__builtin_constant_p} in initializers for static -data. For instance, you can write - -@smallexample -static const int table[] = @{ - __builtin_constant_p (EXPRESSION) ? (EXPRESSION) : -1, - /* @r{@dots{}} */ -@}; -@end smallexample - -@noindent -This is an acceptable initializer even if @var{EXPRESSION} is not a -constant expression, including the case where -@code{__builtin_constant_p} returns 1 because @var{EXPRESSION} can be -folded to a constant but @var{EXPRESSION} contains operands that are -not otherwise permitted in a static initializer (for example, -@code{0 && foo ()}). GCC must be more conservative about evaluating the -built-in in this case, because it has no opportunity to perform -optimization. -@end deftypefn - -@deftypefn {Built-in Function} long __builtin_expect (long @var{exp}, long @var{c}) -@opindex fprofile-arcs -You may use @code{__builtin_expect} to provide the compiler with -branch prediction information. In general, you should prefer to -use actual profile feedback for this (@option{-fprofile-arcs}), as -programmers are notoriously bad at predicting how their programs -actually perform. However, there are applications in which this -data is hard to collect. - -The return value is the value of @var{exp}, which should be an integral -expression. The semantics of the built-in are that it is expected that -@var{exp} == @var{c}. For example: - -@smallexample -if (__builtin_expect (x, 0)) - foo (); -@end smallexample - -@noindent -indicates that we do not expect to call @code{foo}, since -we expect @code{x} to be zero. Since you are limited to integral -expressions for @var{exp}, you should use constructions such as - -@smallexample -if (__builtin_expect (ptr != NULL, 1)) - foo (*ptr); -@end smallexample - -@noindent -when testing pointer or floating-point values. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_trap (void) -This function causes the program to exit abnormally. GCC implements -this function by using a target-dependent mechanism (such as -intentionally executing an illegal instruction) or by calling -@code{abort}. The mechanism used may vary from release to release so -you should not rely on any particular implementation. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_unreachable (void) -If control flow reaches the point of the @code{__builtin_unreachable}, -the program is undefined. It is useful in situations where the -compiler cannot deduce the unreachability of the code. - -One such case is immediately following an @code{asm} statement that -either never terminates, or one that transfers control elsewhere -and never returns. In this example, without the -@code{__builtin_unreachable}, GCC issues a warning that control -reaches the end of a non-void function. It also generates code -to return after the @code{asm}. - -@smallexample -int f (int c, int v) -@{ - if (c) - @{ - return v; - @} - else - @{ - asm("jmp error_handler"); - __builtin_unreachable (); - @} -@} -@end smallexample - -@noindent -Because the @code{asm} statement unconditionally transfers control out -of the function, control never reaches the end of the function -body. The @code{__builtin_unreachable} is in fact unreachable and -communicates this fact to the compiler. - -Another use for @code{__builtin_unreachable} is following a call a -function that never returns but that is not declared -@code{__attribute__((noreturn))}, as in this example: - -@smallexample -void function_that_never_returns (void); - -int g (int c) -@{ - if (c) - @{ - return 1; - @} - else - @{ - function_that_never_returns (); - __builtin_unreachable (); - @} -@} -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} void *__builtin_assume_aligned (const void *@var{exp}, size_t @var{align}, ...) -This function returns its first argument, and allows the compiler -to assume that the returned pointer is at least @var{align} bytes -aligned. This built-in can have either two or three arguments, -if it has three, the third argument should have integer type, and -if it is nonzero means misalignment offset. For example: - -@smallexample -void *x = __builtin_assume_aligned (arg, 16); -@end smallexample - -@noindent -means that the compiler can assume @code{x}, set to @code{arg}, is at least -16-byte aligned, while: - -@smallexample -void *x = __builtin_assume_aligned (arg, 32, 8); -@end smallexample - -@noindent -means that the compiler can assume for @code{x}, set to @code{arg}, that -@code{(char *) x - 8} is 32-byte aligned. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_LINE () -This function is the equivalent to the preprocessor @code{__LINE__} -macro and returns the line number of the invocation of the built-in. -In a C++ default argument for a function @var{F}, it gets the line number of -the call to @var{F}. -@end deftypefn - -@deftypefn {Built-in Function} {const char *} __builtin_FUNCTION () -This function is the equivalent to the preprocessor @code{__FUNCTION__} -macro and returns the function name the invocation of the built-in is in. -@end deftypefn - -@deftypefn {Built-in Function} {const char *} __builtin_FILE () -This function is the equivalent to the preprocessor @code{__FILE__} -macro and returns the file name the invocation of the built-in is in. -In a C++ default argument for a function @var{F}, it gets the file name of -the call to @var{F}. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin___clear_cache (char *@var{begin}, char *@var{end}) -This function is used to flush the processor's instruction cache for -the region of memory between @var{begin} inclusive and @var{end} -exclusive. Some targets require that the instruction cache be -flushed, after modifying memory containing code, in order to obtain -deterministic behavior. - -If the target does not require instruction cache flushes, -@code{__builtin___clear_cache} has no effect. Otherwise either -instructions are emitted in-line to clear the instruction cache or a -call to the @code{__clear_cache} function in libgcc is made. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_prefetch (const void *@var{addr}, ...) -This function is used to minimize cache-miss latency by moving data into -a cache before it is accessed. -You can insert calls to @code{__builtin_prefetch} into code for which -you know addresses of data in memory that is likely to be accessed soon. -If the target supports them, data prefetch instructions are generated. -If the prefetch is done early enough before the access then the data will -be in the cache by the time it is accessed. - -The value of @var{addr} is the address of the memory to prefetch. -There are two optional arguments, @var{rw} and @var{locality}. -The value of @var{rw} is a compile-time constant one or zero; one -means that the prefetch is preparing for a write to the memory address -and zero, the default, means that the prefetch is preparing for a read. -The value @var{locality} must be a compile-time constant integer between -zero and three. A value of zero means that the data has no temporal -locality, so it need not be left in the cache after the access. A value -of three means that the data has a high degree of temporal locality and -should be left in all levels of cache possible. Values of one and two -mean, respectively, a low or moderate degree of temporal locality. The -default is three. - -@smallexample -for (i = 0; i < n; i++) - @{ - a[i] = a[i] + b[i]; - __builtin_prefetch (&a[i+j], 1, 1); - __builtin_prefetch (&b[i+j], 0, 1); - /* @r{@dots{}} */ - @} -@end smallexample - -Data prefetch does not generate faults if @var{addr} is invalid, but -the address expression itself must be valid. For example, a prefetch -of @code{p->next} does not fault if @code{p->next} is not a valid -address, but evaluation faults if @code{p} is not a valid address. - -If the target does not support data prefetch, the address expression -is evaluated if it includes side effects but no other code is generated -and GCC does not issue a warning. -@end deftypefn - -@deftypefn {Built-in Function} double __builtin_huge_val (void) -Returns a positive infinity, if supported by the floating-point format, -else @code{DBL_MAX}. This function is suitable for implementing the -ISO C macro @code{HUGE_VAL}. -@end deftypefn - -@deftypefn {Built-in Function} float __builtin_huge_valf (void) -Similar to @code{__builtin_huge_val}, except the return type is @code{float}. -@end deftypefn - -@deftypefn {Built-in Function} {long double} __builtin_huge_vall (void) -Similar to @code{__builtin_huge_val}, except the return -type is @code{long double}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_fpclassify (int, int, int, int, int, ...) -This built-in implements the C99 fpclassify functionality. The first -five int arguments should be the target library's notion of the -possible FP classes and are used for return values. They must be -constant values and they must appear in this order: @code{FP_NAN}, -@code{FP_INFINITE}, @code{FP_NORMAL}, @code{FP_SUBNORMAL} and -@code{FP_ZERO}. The ellipsis is for exactly one floating-point value -to classify. GCC treats the last argument as type-generic, which -means it does not do default promotion from float to double. -@end deftypefn - -@deftypefn {Built-in Function} double __builtin_inf (void) -Similar to @code{__builtin_huge_val}, except a warning is generated -if the target floating-point format does not support infinities. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal32 __builtin_infd32 (void) -Similar to @code{__builtin_inf}, except the return type is @code{_Decimal32}. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal64 __builtin_infd64 (void) -Similar to @code{__builtin_inf}, except the return type is @code{_Decimal64}. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal128 __builtin_infd128 (void) -Similar to @code{__builtin_inf}, except the return type is @code{_Decimal128}. -@end deftypefn - -@deftypefn {Built-in Function} float __builtin_inff (void) -Similar to @code{__builtin_inf}, except the return type is @code{float}. -This function is suitable for implementing the ISO C99 macro @code{INFINITY}. -@end deftypefn - -@deftypefn {Built-in Function} {long double} __builtin_infl (void) -Similar to @code{__builtin_inf}, except the return -type is @code{long double}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_isinf_sign (...) -Similar to @code{isinf}, except the return value is -1 for -an argument of @code{-Inf} and 1 for an argument of @code{+Inf}. -Note while the parameter list is an -ellipsis, this function only accepts exactly one floating-point -argument. GCC treats this parameter as type-generic, which means it -does not do default promotion from float to double. -@end deftypefn - -@deftypefn {Built-in Function} double __builtin_nan (const char *str) -This is an implementation of the ISO C99 function @code{nan}. - -Since ISO C99 defines this function in terms of @code{strtod}, which we -do not implement, a description of the parsing is in order. The string -is parsed as by @code{strtol}; that is, the base is recognized by -leading @samp{0} or @samp{0x} prefixes. The number parsed is placed -in the significand such that the least significant bit of the number -is at the least significant bit of the significand. The number is -truncated to fit the significand field provided. The significand is -forced to be a quiet NaN@. - -This function, if given a string literal all of which would have been -consumed by @code{strtol}, is evaluated early enough that it is considered a -compile-time constant. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal32 __builtin_nand32 (const char *str) -Similar to @code{__builtin_nan}, except the return type is @code{_Decimal32}. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal64 __builtin_nand64 (const char *str) -Similar to @code{__builtin_nan}, except the return type is @code{_Decimal64}. -@end deftypefn - -@deftypefn {Built-in Function} _Decimal128 __builtin_nand128 (const char *str) -Similar to @code{__builtin_nan}, except the return type is @code{_Decimal128}. -@end deftypefn - -@deftypefn {Built-in Function} float __builtin_nanf (const char *str) -Similar to @code{__builtin_nan}, except the return type is @code{float}. -@end deftypefn - -@deftypefn {Built-in Function} {long double} __builtin_nanl (const char *str) -Similar to @code{__builtin_nan}, except the return type is @code{long double}. -@end deftypefn - -@deftypefn {Built-in Function} double __builtin_nans (const char *str) -Similar to @code{__builtin_nan}, except the significand is forced -to be a signaling NaN@. The @code{nans} function is proposed by -@uref{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n965.htm,,WG14 N965}. -@end deftypefn - -@deftypefn {Built-in Function} float __builtin_nansf (const char *str) -Similar to @code{__builtin_nans}, except the return type is @code{float}. -@end deftypefn - -@deftypefn {Built-in Function} {long double} __builtin_nansl (const char *str) -Similar to @code{__builtin_nans}, except the return type is @code{long double}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ffs (int x) -Returns one plus the index of the least significant 1-bit of @var{x}, or -if @var{x} is zero, returns zero. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clz (unsigned int x) -Returns the number of leading 0-bits in @var{x}, starting at the most -significant bit position. If @var{x} is 0, the result is undefined. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ctz (unsigned int x) -Returns the number of trailing 0-bits in @var{x}, starting at the least -significant bit position. If @var{x} is 0, the result is undefined. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clrsb (int x) -Returns the number of leading redundant sign bits in @var{x}, i.e.@: the -number of bits following the most significant bit that are identical -to it. There are no special cases for 0 or other values. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_popcount (unsigned int x) -Returns the number of 1-bits in @var{x}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_parity (unsigned int x) -Returns the parity of @var{x}, i.e.@: the number of 1-bits in @var{x} -modulo 2. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ffsl (long) -Similar to @code{__builtin_ffs}, except the argument type is -@code{long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clzl (unsigned long) -Similar to @code{__builtin_clz}, except the argument type is -@code{unsigned long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ctzl (unsigned long) -Similar to @code{__builtin_ctz}, except the argument type is -@code{unsigned long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clrsbl (long) -Similar to @code{__builtin_clrsb}, except the argument type is -@code{long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_popcountl (unsigned long) -Similar to @code{__builtin_popcount}, except the argument type is -@code{unsigned long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_parityl (unsigned long) -Similar to @code{__builtin_parity}, except the argument type is -@code{unsigned long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ffsll (long long) -Similar to @code{__builtin_ffs}, except the argument type is -@code{long long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clzll (unsigned long long) -Similar to @code{__builtin_clz}, except the argument type is -@code{unsigned long long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_ctzll (unsigned long long) -Similar to @code{__builtin_ctz}, except the argument type is -@code{unsigned long long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_clrsbll (long long) -Similar to @code{__builtin_clrsb}, except the argument type is -@code{long long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_popcountll (unsigned long long) -Similar to @code{__builtin_popcount}, except the argument type is -@code{unsigned long long}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_parityll (unsigned long long) -Similar to @code{__builtin_parity}, except the argument type is -@code{unsigned long long}. -@end deftypefn - -@deftypefn {Built-in Function} double __builtin_powi (double, int) -Returns the first argument raised to the power of the second. Unlike the -@code{pow} function no guarantees about precision and rounding are made. -@end deftypefn - -@deftypefn {Built-in Function} float __builtin_powif (float, int) -Similar to @code{__builtin_powi}, except the argument and return types -are @code{float}. -@end deftypefn - -@deftypefn {Built-in Function} {long double} __builtin_powil (long double, int) -Similar to @code{__builtin_powi}, except the argument and return types -are @code{long double}. -@end deftypefn - -@deftypefn {Built-in Function} uint16_t __builtin_bswap16 (uint16_t x) -Returns @var{x} with the order of the bytes reversed; for example, -@code{0xaabb} becomes @code{0xbbaa}. Byte here always means -exactly 8 bits. -@end deftypefn - -@deftypefn {Built-in Function} uint32_t __builtin_bswap32 (uint32_t x) -Similar to @code{__builtin_bswap16}, except the argument and return types -are 32 bit. -@end deftypefn - -@deftypefn {Built-in Function} uint64_t __builtin_bswap64 (uint64_t x) -Similar to @code{__builtin_bswap32}, except the argument and return types -are 64 bit. -@end deftypefn - -@node Target Builtins -@section Built-in Functions Specific to Particular Target Machines - -On some target machines, GCC supports many built-in functions specific -to those machines. Generally these generate calls to specific machine -instructions, but allow the compiler to schedule those calls. - -@menu -* AArch64 Built-in Functions:: -* Alpha Built-in Functions:: -* Altera Nios II Built-in Functions:: -* ARC Built-in Functions:: -* ARC SIMD Built-in Functions:: -* ARM iWMMXt Built-in Functions:: -* ARM C Language Extensions (ACLE):: -* ARM Floating Point Status and Control Intrinsics:: -* AVR Built-in Functions:: -* Blackfin Built-in Functions:: -* FR-V Built-in Functions:: -* MIPS DSP Built-in Functions:: -* MIPS Paired-Single Support:: -* MIPS Loongson Built-in Functions:: -* Other MIPS Built-in Functions:: -* MSP430 Built-in Functions:: -* NDS32 Built-in Functions:: -* picoChip Built-in Functions:: -* PowerPC Built-in Functions:: -* PowerPC AltiVec/VSX Built-in Functions:: -* PowerPC Hardware Transactional Memory Built-in Functions:: -* RX Built-in Functions:: -* S/390 System z Built-in Functions:: -* SH Built-in Functions:: -* SPARC VIS Built-in Functions:: -* SPU Built-in Functions:: -* TI C6X Built-in Functions:: -* TILE-Gx Built-in Functions:: -* TILEPro Built-in Functions:: -* x86 Built-in Functions:: -* x86 transactional memory intrinsics:: -@end menu - -@node AArch64 Built-in Functions -@subsection AArch64 Built-in Functions - -These built-in functions are available for the AArch64 family of -processors. -@smallexample -unsigned int __builtin_aarch64_get_fpcr () -void __builtin_aarch64_set_fpcr (unsigned int) -unsigned int __builtin_aarch64_get_fpsr () -void __builtin_aarch64_set_fpsr (unsigned int) -@end smallexample - -@node Alpha Built-in Functions -@subsection Alpha Built-in Functions - -These built-in functions are available for the Alpha family of -processors, depending on the command-line switches used. - -The following built-in functions are always available. They -all generate the machine instruction that is part of the name. - -@smallexample -long __builtin_alpha_implver (void) -long __builtin_alpha_rpcc (void) -long __builtin_alpha_amask (long) -long __builtin_alpha_cmpbge (long, long) -long __builtin_alpha_extbl (long, long) -long __builtin_alpha_extwl (long, long) -long __builtin_alpha_extll (long, long) -long __builtin_alpha_extql (long, long) -long __builtin_alpha_extwh (long, long) -long __builtin_alpha_extlh (long, long) -long __builtin_alpha_extqh (long, long) -long __builtin_alpha_insbl (long, long) -long __builtin_alpha_inswl (long, long) -long __builtin_alpha_insll (long, long) -long __builtin_alpha_insql (long, long) -long __builtin_alpha_inswh (long, long) -long __builtin_alpha_inslh (long, long) -long __builtin_alpha_insqh (long, long) -long __builtin_alpha_mskbl (long, long) -long __builtin_alpha_mskwl (long, long) -long __builtin_alpha_mskll (long, long) -long __builtin_alpha_mskql (long, long) -long __builtin_alpha_mskwh (long, long) -long __builtin_alpha_msklh (long, long) -long __builtin_alpha_mskqh (long, long) -long __builtin_alpha_umulh (long, long) -long __builtin_alpha_zap (long, long) -long __builtin_alpha_zapnot (long, long) -@end smallexample - -The following built-in functions are always with @option{-mmax} -or @option{-mcpu=@var{cpu}} where @var{cpu} is @code{pca56} or -later. They all generate the machine instruction that is part -of the name. - -@smallexample -long __builtin_alpha_pklb (long) -long __builtin_alpha_pkwb (long) -long __builtin_alpha_unpkbl (long) -long __builtin_alpha_unpkbw (long) -long __builtin_alpha_minub8 (long, long) -long __builtin_alpha_minsb8 (long, long) -long __builtin_alpha_minuw4 (long, long) -long __builtin_alpha_minsw4 (long, long) -long __builtin_alpha_maxub8 (long, long) -long __builtin_alpha_maxsb8 (long, long) -long __builtin_alpha_maxuw4 (long, long) -long __builtin_alpha_maxsw4 (long, long) -long __builtin_alpha_perr (long, long) -@end smallexample - -The following built-in functions are always with @option{-mcix} -or @option{-mcpu=@var{cpu}} where @var{cpu} is @code{ev67} or -later. They all generate the machine instruction that is part -of the name. - -@smallexample -long __builtin_alpha_cttz (long) -long __builtin_alpha_ctlz (long) -long __builtin_alpha_ctpop (long) -@end smallexample - -The following built-in functions are available on systems that use the OSF/1 -PALcode. Normally they invoke the @code{rduniq} and @code{wruniq} -PAL calls, but when invoked with @option{-mtls-kernel}, they invoke -@code{rdval} and @code{wrval}. - -@smallexample -void *__builtin_thread_pointer (void) -void __builtin_set_thread_pointer (void *) -@end smallexample - -@node Altera Nios II Built-in Functions -@subsection Altera Nios II Built-in Functions - -These built-in functions are available for the Altera Nios II -family of processors. - -The following built-in functions are always available. They -all generate the machine instruction that is part of the name. - -@example -int __builtin_ldbio (volatile const void *) -int __builtin_ldbuio (volatile const void *) -int __builtin_ldhio (volatile const void *) -int __builtin_ldhuio (volatile const void *) -int __builtin_ldwio (volatile const void *) -void __builtin_stbio (volatile void *, int) -void __builtin_sthio (volatile void *, int) -void __builtin_stwio (volatile void *, int) -void __builtin_sync (void) -int __builtin_rdctl (int) -void __builtin_wrctl (int, int) -@end example - -The following built-in functions are always available. They -all generate a Nios II Custom Instruction. The name of the -function represents the types that the function takes and -returns. The letter before the @code{n} is the return type -or void if absent. The @code{n} represents the first parameter -to all the custom instructions, the custom instruction number. -The two letters after the @code{n} represent the up to two -parameters to the function. - -The letters represent the following data types: -@table @code -@item -@code{void} for return type and no parameter for parameter types. - -@item i -@code{int} for return type and parameter type - -@item f -@code{float} for return type and parameter type - -@item p -@code{void *} for return type and parameter type - -@end table - -And the function names are: -@example -void __builtin_custom_n (void) -void __builtin_custom_ni (int) -void __builtin_custom_nf (float) -void __builtin_custom_np (void *) -void __builtin_custom_nii (int, int) -void __builtin_custom_nif (int, float) -void __builtin_custom_nip (int, void *) -void __builtin_custom_nfi (float, int) -void __builtin_custom_nff (float, float) -void __builtin_custom_nfp (float, void *) -void __builtin_custom_npi (void *, int) -void __builtin_custom_npf (void *, float) -void __builtin_custom_npp (void *, void *) -int __builtin_custom_in (void) -int __builtin_custom_ini (int) -int __builtin_custom_inf (float) -int __builtin_custom_inp (void *) -int __builtin_custom_inii (int, int) -int __builtin_custom_inif (int, float) -int __builtin_custom_inip (int, void *) -int __builtin_custom_infi (float, int) -int __builtin_custom_inff (float, float) -int __builtin_custom_infp (float, void *) -int __builtin_custom_inpi (void *, int) -int __builtin_custom_inpf (void *, float) -int __builtin_custom_inpp (void *, void *) -float __builtin_custom_fn (void) -float __builtin_custom_fni (int) -float __builtin_custom_fnf (float) -float __builtin_custom_fnp (void *) -float __builtin_custom_fnii (int, int) -float __builtin_custom_fnif (int, float) -float __builtin_custom_fnip (int, void *) -float __builtin_custom_fnfi (float, int) -float __builtin_custom_fnff (float, float) -float __builtin_custom_fnfp (float, void *) -float __builtin_custom_fnpi (void *, int) -float __builtin_custom_fnpf (void *, float) -float __builtin_custom_fnpp (void *, void *) -void * __builtin_custom_pn (void) -void * __builtin_custom_pni (int) -void * __builtin_custom_pnf (float) -void * __builtin_custom_pnp (void *) -void * __builtin_custom_pnii (int, int) -void * __builtin_custom_pnif (int, float) -void * __builtin_custom_pnip (int, void *) -void * __builtin_custom_pnfi (float, int) -void * __builtin_custom_pnff (float, float) -void * __builtin_custom_pnfp (float, void *) -void * __builtin_custom_pnpi (void *, int) -void * __builtin_custom_pnpf (void *, float) -void * __builtin_custom_pnpp (void *, void *) -@end example - -@node ARC Built-in Functions -@subsection ARC Built-in Functions - -The following built-in functions are provided for ARC targets. The -built-ins generate the corresponding assembly instructions. In the -examples given below, the generated code often requires an operand or -result to be in a register. Where necessary further code will be -generated to ensure this is true, but for brevity this is not -described in each case. - -@emph{Note:} Using a built-in to generate an instruction not supported -by a target may cause problems. At present the compiler is not -guaranteed to detect such misuse, and as a result an internal compiler -error may be generated. - -@deftypefn {Built-in Function} int __builtin_arc_aligned (void *@var{val}, int @var{alignval}) -Return 1 if @var{val} is known to have the byte alignment given -by @var{alignval}, otherwise return 0. -Note that this is different from -@smallexample -__alignof__(*(char *)@var{val}) >= alignval -@end smallexample -because __alignof__ sees only the type of the dereference, whereas -__builtin_arc_align uses alignment information from the pointer -as well as from the pointed-to type. -The information available will depend on optimization level. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_brk (void) -Generates -@example -brk -@end example -@end deftypefn - -@deftypefn {Built-in Function} {unsigned int} __builtin_arc_core_read (unsigned int @var{regno}) -The operand is the number of a register to be read. Generates: -@example -mov @var{dest}, r@var{regno} -@end example -where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_core_write (unsigned int @var{regno}, unsigned int @var{val}) -The first operand is the number of a register to be written, the -second operand is a compile time constant to write into that -register. Generates: -@example -mov r@var{regno}, @var{val} -@end example -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_arc_divaw (int @var{a}, int @var{b}) -Only available if either @option{-mcpu=ARC700} or @option{-meA} is set. -Generates: -@example -divaw @var{dest}, @var{a}, @var{b} -@end example -where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_flag (unsigned int @var{a}) -Generates -@example -flag @var{a} -@end example -@end deftypefn - -@deftypefn {Built-in Function} {unsigned int} __builtin_arc_lr (unsigned int @var{auxr}) -The operand, @var{auxv}, is the address of an auxiliary register and -must be a compile time constant. Generates: -@example -lr @var{dest}, [@var{auxr}] -@end example -Where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_mul64 (int @var{a}, int @var{b}) -Only available with @option{-mmul64}. Generates: -@example -mul64 @var{a}, @var{b} -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_mulu64 (unsigned int @var{a}, unsigned int @var{b}) -Only available with @option{-mmul64}. Generates: -@example -mulu64 @var{a}, @var{b} -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_nop (void) -Generates: -@example -nop -@end example -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_arc_norm (int @var{src}) -Only valid if the @samp{norm} instruction is available through the -@option{-mnorm} option or by default with @option{-mcpu=ARC700}. -Generates: -@example -norm @var{dest}, @var{src} -@end example -Where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} {short int} __builtin_arc_normw (short int @var{src}) -Only valid if the @samp{normw} instruction is available through the -@option{-mnorm} option or by default with @option{-mcpu=ARC700}. -Generates: -@example -normw @var{dest}, @var{src} -@end example -Where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_rtie (void) -Generates: -@example -rtie -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_sleep (int @var{a} -Generates: -@example -sleep @var{a} -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_sr (unsigned int @var{auxr}, unsigned int @var{val}) -The first argument, @var{auxv}, is the address of an auxiliary -register, the second argument, @var{val}, is a compile time constant -to be written to the register. Generates: -@example -sr @var{auxr}, [@var{val}] -@end example -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_arc_swap (int @var{src}) -Only valid with @option{-mswap}. Generates: -@example -swap @var{dest}, @var{src} -@end example -Where the value in @var{dest} will be the result returned from the -built-in. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_swi (void) -Generates: -@example -swi -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_sync (void) -Only available with @option{-mcpu=ARC700}. Generates: -@example -sync -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_trap_s (unsigned int @var{c}) -Only available with @option{-mcpu=ARC700}. Generates: -@example -trap_s @var{c} -@end example -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_arc_unimp_s (void) -Only available with @option{-mcpu=ARC700}. Generates: -@example -unimp_s -@end example -@end deftypefn - -The instructions generated by the following builtins are not -considered as candidates for scheduling. They are not moved around by -the compiler during scheduling, and thus can be expected to appear -where they are put in the C code: -@example -__builtin_arc_brk() -__builtin_arc_core_read() -__builtin_arc_core_write() -__builtin_arc_flag() -__builtin_arc_lr() -__builtin_arc_sleep() -__builtin_arc_sr() -__builtin_arc_swi() -@end example - -@node ARC SIMD Built-in Functions -@subsection ARC SIMD Built-in Functions - -SIMD builtins provided by the compiler can be used to generate the -vector instructions. This section describes the available builtins -and their usage in programs. With the @option{-msimd} option, the -compiler provides 128-bit vector types, which can be specified using -the @code{vector_size} attribute. The header file @file{arc-simd.h} -can be included to use the following predefined types: -@example -typedef int __v4si __attribute__((vector_size(16))); -typedef short __v8hi __attribute__((vector_size(16))); -@end example - -These types can be used to define 128-bit variables. The built-in -functions listed in the following section can be used on these -variables to generate the vector operations. - -For all builtins, @code{__builtin_arc_@var{someinsn}}, the header file -@file{arc-simd.h} also provides equivalent macros called -@code{_@var{someinsn}} that can be used for programming ease and -improved readability. The following macros for DMA control are also -provided: -@example -#define _setup_dma_in_channel_reg _vdiwr -#define _setup_dma_out_channel_reg _vdowr -@end example - -The following is a complete list of all the SIMD built-ins provided -for ARC, grouped by calling signature. - -The following take two @code{__v8hi} arguments and return a -@code{__v8hi} result: -@example -__v8hi __builtin_arc_vaddaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vaddw (__v8hi, __v8hi) -__v8hi __builtin_arc_vand (__v8hi, __v8hi) -__v8hi __builtin_arc_vandaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vavb (__v8hi, __v8hi) -__v8hi __builtin_arc_vavrb (__v8hi, __v8hi) -__v8hi __builtin_arc_vbic (__v8hi, __v8hi) -__v8hi __builtin_arc_vbicaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vdifaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vdifw (__v8hi, __v8hi) -__v8hi __builtin_arc_veqw (__v8hi, __v8hi) -__v8hi __builtin_arc_vh264f (__v8hi, __v8hi) -__v8hi __builtin_arc_vh264ft (__v8hi, __v8hi) -__v8hi __builtin_arc_vh264fw (__v8hi, __v8hi) -__v8hi __builtin_arc_vlew (__v8hi, __v8hi) -__v8hi __builtin_arc_vltw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmaxaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmaxw (__v8hi, __v8hi) -__v8hi __builtin_arc_vminaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vminw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr1aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr1w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr2aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr2w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr3aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr3w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr4aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr4w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr5aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr5w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr6aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr6w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr7aw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmr7w (__v8hi, __v8hi) -__v8hi __builtin_arc_vmrb (__v8hi, __v8hi) -__v8hi __builtin_arc_vmulaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmulfaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmulfw (__v8hi, __v8hi) -__v8hi __builtin_arc_vmulw (__v8hi, __v8hi) -__v8hi __builtin_arc_vnew (__v8hi, __v8hi) -__v8hi __builtin_arc_vor (__v8hi, __v8hi) -__v8hi __builtin_arc_vsubaw (__v8hi, __v8hi) -__v8hi __builtin_arc_vsubw (__v8hi, __v8hi) -__v8hi __builtin_arc_vsummw (__v8hi, __v8hi) -__v8hi __builtin_arc_vvc1f (__v8hi, __v8hi) -__v8hi __builtin_arc_vvc1ft (__v8hi, __v8hi) -__v8hi __builtin_arc_vxor (__v8hi, __v8hi) -__v8hi __builtin_arc_vxoraw (__v8hi, __v8hi) -@end example - -The following take one @code{__v8hi} and one @code{int} argument and return a -@code{__v8hi} result: - -@example -__v8hi __builtin_arc_vbaddw (__v8hi, int) -__v8hi __builtin_arc_vbmaxw (__v8hi, int) -__v8hi __builtin_arc_vbminw (__v8hi, int) -__v8hi __builtin_arc_vbmulaw (__v8hi, int) -__v8hi __builtin_arc_vbmulfw (__v8hi, int) -__v8hi __builtin_arc_vbmulw (__v8hi, int) -__v8hi __builtin_arc_vbrsubw (__v8hi, int) -__v8hi __builtin_arc_vbsubw (__v8hi, int) -@end example - -The following take one @code{__v8hi} argument and one @code{int} argument which -must be a 3-bit compile time constant indicating a register number -I0-I7. They return a @code{__v8hi} result. -@example -__v8hi __builtin_arc_vasrw (__v8hi, const int) -__v8hi __builtin_arc_vsr8 (__v8hi, const int) -__v8hi __builtin_arc_vsr8aw (__v8hi, const int) -@end example - -The following take one @code{__v8hi} argument and one @code{int} -argument which must be a 6-bit compile time constant. They return a -@code{__v8hi} result. -@example -__v8hi __builtin_arc_vasrpwbi (__v8hi, const int) -__v8hi __builtin_arc_vasrrpwbi (__v8hi, const int) -__v8hi __builtin_arc_vasrrwi (__v8hi, const int) -__v8hi __builtin_arc_vasrsrwi (__v8hi, const int) -__v8hi __builtin_arc_vasrwi (__v8hi, const int) -__v8hi __builtin_arc_vsr8awi (__v8hi, const int) -__v8hi __builtin_arc_vsr8i (__v8hi, const int) -@end example - -The following take one @code{__v8hi} argument and one @code{int} argument which -must be a 8-bit compile time constant. They return a @code{__v8hi} -result. -@example -__v8hi __builtin_arc_vd6tapf (__v8hi, const int) -__v8hi __builtin_arc_vmvaw (__v8hi, const int) -__v8hi __builtin_arc_vmvw (__v8hi, const int) -__v8hi __builtin_arc_vmvzw (__v8hi, const int) -@end example - -The following take two @code{int} arguments, the second of which which -must be a 8-bit compile time constant. They return a @code{__v8hi} -result: -@example -__v8hi __builtin_arc_vmovaw (int, const int) -__v8hi __builtin_arc_vmovw (int, const int) -__v8hi __builtin_arc_vmovzw (int, const int) -@end example - -The following take a single @code{__v8hi} argument and return a -@code{__v8hi} result: -@example -__v8hi __builtin_arc_vabsaw (__v8hi) -__v8hi __builtin_arc_vabsw (__v8hi) -__v8hi __builtin_arc_vaddsuw (__v8hi) -__v8hi __builtin_arc_vexch1 (__v8hi) -__v8hi __builtin_arc_vexch2 (__v8hi) -__v8hi __builtin_arc_vexch4 (__v8hi) -__v8hi __builtin_arc_vsignw (__v8hi) -__v8hi __builtin_arc_vupbaw (__v8hi) -__v8hi __builtin_arc_vupbw (__v8hi) -__v8hi __builtin_arc_vupsbaw (__v8hi) -__v8hi __builtin_arc_vupsbw (__v8hi) -@end example - -The following take two @code{int} arguments and return no result: -@example -void __builtin_arc_vdirun (int, int) -void __builtin_arc_vdorun (int, int) -@end example - -The following take two @code{int} arguments and return no result. The -first argument must a 3-bit compile time constant indicating one of -the DR0-DR7 DMA setup channels: -@example -void __builtin_arc_vdiwr (const int, int) -void __builtin_arc_vdowr (const int, int) -@end example - -The following take an @code{int} argument and return no result: -@example -void __builtin_arc_vendrec (int) -void __builtin_arc_vrec (int) -void __builtin_arc_vrecrun (int) -void __builtin_arc_vrun (int) -@end example - -The following take a @code{__v8hi} argument and two @code{int} -arguments and return a @code{__v8hi} result. The second argument must -be a 3-bit compile time constants, indicating one the registers I0-I7, -and the third argument must be an 8-bit compile time constant. - -@emph{Note:} Although the equivalent hardware instructions do not take -an SIMD register as an operand, these builtins overwrite the relevant -bits of the @code{__v8hi} register provided as the first argument with -the value loaded from the @code{[Ib, u8]} location in the SDM. - -@example -__v8hi __builtin_arc_vld32 (__v8hi, const int, const int) -__v8hi __builtin_arc_vld32wh (__v8hi, const int, const int) -__v8hi __builtin_arc_vld32wl (__v8hi, const int, const int) -__v8hi __builtin_arc_vld64 (__v8hi, const int, const int) -@end example - -The following take two @code{int} arguments and return a @code{__v8hi} -result. The first argument must be a 3-bit compile time constants, -indicating one the registers I0-I7, and the second argument must be an -8-bit compile time constant. - -@example -__v8hi __builtin_arc_vld128 (const int, const int) -__v8hi __builtin_arc_vld64w (const int, const int) -@end example - -The following take a @code{__v8hi} argument and two @code{int} -arguments and return no result. The second argument must be a 3-bit -compile time constants, indicating one the registers I0-I7, and the -third argument must be an 8-bit compile time constant. - -@example -void __builtin_arc_vst128 (__v8hi, const int, const int) -void __builtin_arc_vst64 (__v8hi, const int, const int) -@end example - -The following take a @code{__v8hi} argument and three @code{int} -arguments and return no result. The second argument must be a 3-bit -compile-time constant, identifying the 16-bit sub-register to be -stored, the third argument must be a 3-bit compile time constants, -indicating one the registers I0-I7, and the fourth argument must be an -8-bit compile time constant. - -@example -void __builtin_arc_vst16_n (__v8hi, const int, const int, const int) -void __builtin_arc_vst32_n (__v8hi, const int, const int, const int) -@end example - -@node ARM iWMMXt Built-in Functions -@subsection ARM iWMMXt Built-in Functions - -These built-in functions are available for the ARM family of -processors when the @option{-mcpu=iwmmxt} switch is used: - -@smallexample -typedef int v2si __attribute__ ((vector_size (8))); -typedef short v4hi __attribute__ ((vector_size (8))); -typedef char v8qi __attribute__ ((vector_size (8))); - -int __builtin_arm_getwcgr0 (void) -void __builtin_arm_setwcgr0 (int) -int __builtin_arm_getwcgr1 (void) -void __builtin_arm_setwcgr1 (int) -int __builtin_arm_getwcgr2 (void) -void __builtin_arm_setwcgr2 (int) -int __builtin_arm_getwcgr3 (void) -void __builtin_arm_setwcgr3 (int) -int __builtin_arm_textrmsb (v8qi, int) -int __builtin_arm_textrmsh (v4hi, int) -int __builtin_arm_textrmsw (v2si, int) -int __builtin_arm_textrmub (v8qi, int) -int __builtin_arm_textrmuh (v4hi, int) -int __builtin_arm_textrmuw (v2si, int) -v8qi __builtin_arm_tinsrb (v8qi, int, int) -v4hi __builtin_arm_tinsrh (v4hi, int, int) -v2si __builtin_arm_tinsrw (v2si, int, int) -long long __builtin_arm_tmia (long long, int, int) -long long __builtin_arm_tmiabb (long long, int, int) -long long __builtin_arm_tmiabt (long long, int, int) -long long __builtin_arm_tmiaph (long long, int, int) -long long __builtin_arm_tmiatb (long long, int, int) -long long __builtin_arm_tmiatt (long long, int, int) -int __builtin_arm_tmovmskb (v8qi) -int __builtin_arm_tmovmskh (v4hi) -int __builtin_arm_tmovmskw (v2si) -long long __builtin_arm_waccb (v8qi) -long long __builtin_arm_wacch (v4hi) -long long __builtin_arm_waccw (v2si) -v8qi __builtin_arm_waddb (v8qi, v8qi) -v8qi __builtin_arm_waddbss (v8qi, v8qi) -v8qi __builtin_arm_waddbus (v8qi, v8qi) -v4hi __builtin_arm_waddh (v4hi, v4hi) -v4hi __builtin_arm_waddhss (v4hi, v4hi) -v4hi __builtin_arm_waddhus (v4hi, v4hi) -v2si __builtin_arm_waddw (v2si, v2si) -v2si __builtin_arm_waddwss (v2si, v2si) -v2si __builtin_arm_waddwus (v2si, v2si) -v8qi __builtin_arm_walign (v8qi, v8qi, int) -long long __builtin_arm_wand(long long, long long) -long long __builtin_arm_wandn (long long, long long) -v8qi __builtin_arm_wavg2b (v8qi, v8qi) -v8qi __builtin_arm_wavg2br (v8qi, v8qi) -v4hi __builtin_arm_wavg2h (v4hi, v4hi) -v4hi __builtin_arm_wavg2hr (v4hi, v4hi) -v8qi __builtin_arm_wcmpeqb (v8qi, v8qi) -v4hi __builtin_arm_wcmpeqh (v4hi, v4hi) -v2si __builtin_arm_wcmpeqw (v2si, v2si) -v8qi __builtin_arm_wcmpgtsb (v8qi, v8qi) -v4hi __builtin_arm_wcmpgtsh (v4hi, v4hi) -v2si __builtin_arm_wcmpgtsw (v2si, v2si) -v8qi __builtin_arm_wcmpgtub (v8qi, v8qi) -v4hi __builtin_arm_wcmpgtuh (v4hi, v4hi) -v2si __builtin_arm_wcmpgtuw (v2si, v2si) -long long __builtin_arm_wmacs (long long, v4hi, v4hi) -long long __builtin_arm_wmacsz (v4hi, v4hi) -long long __builtin_arm_wmacu (long long, v4hi, v4hi) -long long __builtin_arm_wmacuz (v4hi, v4hi) -v4hi __builtin_arm_wmadds (v4hi, v4hi) -v4hi __builtin_arm_wmaddu (v4hi, v4hi) -v8qi __builtin_arm_wmaxsb (v8qi, v8qi) -v4hi __builtin_arm_wmaxsh (v4hi, v4hi) -v2si __builtin_arm_wmaxsw (v2si, v2si) -v8qi __builtin_arm_wmaxub (v8qi, v8qi) -v4hi __builtin_arm_wmaxuh (v4hi, v4hi) -v2si __builtin_arm_wmaxuw (v2si, v2si) -v8qi __builtin_arm_wminsb (v8qi, v8qi) -v4hi __builtin_arm_wminsh (v4hi, v4hi) -v2si __builtin_arm_wminsw (v2si, v2si) -v8qi __builtin_arm_wminub (v8qi, v8qi) -v4hi __builtin_arm_wminuh (v4hi, v4hi) -v2si __builtin_arm_wminuw (v2si, v2si) -v4hi __builtin_arm_wmulsm (v4hi, v4hi) -v4hi __builtin_arm_wmulul (v4hi, v4hi) -v4hi __builtin_arm_wmulum (v4hi, v4hi) -long long __builtin_arm_wor (long long, long long) -v2si __builtin_arm_wpackdss (long long, long long) -v2si __builtin_arm_wpackdus (long long, long long) -v8qi __builtin_arm_wpackhss (v4hi, v4hi) -v8qi __builtin_arm_wpackhus (v4hi, v4hi) -v4hi __builtin_arm_wpackwss (v2si, v2si) -v4hi __builtin_arm_wpackwus (v2si, v2si) -long long __builtin_arm_wrord (long long, long long) -long long __builtin_arm_wrordi (long long, int) -v4hi __builtin_arm_wrorh (v4hi, long long) -v4hi __builtin_arm_wrorhi (v4hi, int) -v2si __builtin_arm_wrorw (v2si, long long) -v2si __builtin_arm_wrorwi (v2si, int) -v2si __builtin_arm_wsadb (v2si, v8qi, v8qi) -v2si __builtin_arm_wsadbz (v8qi, v8qi) -v2si __builtin_arm_wsadh (v2si, v4hi, v4hi) -v2si __builtin_arm_wsadhz (v4hi, v4hi) -v4hi __builtin_arm_wshufh (v4hi, int) -long long __builtin_arm_wslld (long long, long long) -long long __builtin_arm_wslldi (long long, int) -v4hi __builtin_arm_wsllh (v4hi, long long) -v4hi __builtin_arm_wsllhi (v4hi, int) -v2si __builtin_arm_wsllw (v2si, long long) -v2si __builtin_arm_wsllwi (v2si, int) -long long __builtin_arm_wsrad (long long, long long) -long long __builtin_arm_wsradi (long long, int) -v4hi __builtin_arm_wsrah (v4hi, long long) -v4hi __builtin_arm_wsrahi (v4hi, int) -v2si __builtin_arm_wsraw (v2si, long long) -v2si __builtin_arm_wsrawi (v2si, int) -long long __builtin_arm_wsrld (long long, long long) -long long __builtin_arm_wsrldi (long long, int) -v4hi __builtin_arm_wsrlh (v4hi, long long) -v4hi __builtin_arm_wsrlhi (v4hi, int) -v2si __builtin_arm_wsrlw (v2si, long long) -v2si __builtin_arm_wsrlwi (v2si, int) -v8qi __builtin_arm_wsubb (v8qi, v8qi) -v8qi __builtin_arm_wsubbss (v8qi, v8qi) -v8qi __builtin_arm_wsubbus (v8qi, v8qi) -v4hi __builtin_arm_wsubh (v4hi, v4hi) -v4hi __builtin_arm_wsubhss (v4hi, v4hi) -v4hi __builtin_arm_wsubhus (v4hi, v4hi) -v2si __builtin_arm_wsubw (v2si, v2si) -v2si __builtin_arm_wsubwss (v2si, v2si) -v2si __builtin_arm_wsubwus (v2si, v2si) -v4hi __builtin_arm_wunpckehsb (v8qi) -v2si __builtin_arm_wunpckehsh (v4hi) -long long __builtin_arm_wunpckehsw (v2si) -v4hi __builtin_arm_wunpckehub (v8qi) -v2si __builtin_arm_wunpckehuh (v4hi) -long long __builtin_arm_wunpckehuw (v2si) -v4hi __builtin_arm_wunpckelsb (v8qi) -v2si __builtin_arm_wunpckelsh (v4hi) -long long __builtin_arm_wunpckelsw (v2si) -v4hi __builtin_arm_wunpckelub (v8qi) -v2si __builtin_arm_wunpckeluh (v4hi) -long long __builtin_arm_wunpckeluw (v2si) -v8qi __builtin_arm_wunpckihb (v8qi, v8qi) -v4hi __builtin_arm_wunpckihh (v4hi, v4hi) -v2si __builtin_arm_wunpckihw (v2si, v2si) -v8qi __builtin_arm_wunpckilb (v8qi, v8qi) -v4hi __builtin_arm_wunpckilh (v4hi, v4hi) -v2si __builtin_arm_wunpckilw (v2si, v2si) -long long __builtin_arm_wxor (long long, long long) -long long __builtin_arm_wzero () -@end smallexample - - -@node ARM C Language Extensions (ACLE) -@subsection ARM C Language Extensions (ACLE) - -GCC implements extensions for C as described in the ARM C Language -Extensions (ACLE) specification, which can be found at -@uref{http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf}. - -As a part of ACLE, GCC implements extensions for Advanced SIMD as described in -the ARM C Language Extensions Specification. The complete list of Advanced SIMD -intrinsics can be found at -@uref{http://infocenter.arm.com/help/topic/com.arm.doc.ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf}. -The built-in intrinsics for the Advanced SIMD extension are available when -NEON is enabled. - -Currently, ARM and AArch64 back ends do not support ACLE 2.0 fully. Both -back ends support CRC32 intrinsics from @file{arm_acle.h}. The ARM back end's -16-bit floating-point Advanced SIMD intrinsics currently comply to ACLE v1.1. -AArch64's back end does not have support for 16-bit floating point Advanced SIMD -intrinsics yet. - -See @ref{ARM Options} and @ref{AArch64 Options} for more information on the -availability of extensions. - -@node ARM Floating Point Status and Control Intrinsics -@subsection ARM Floating Point Status and Control Intrinsics - -These built-in functions are available for the ARM family of -processors with floating-point unit. - -@smallexample -unsigned int __builtin_arm_get_fpscr () -void __builtin_arm_set_fpscr (unsigned int) -@end smallexample - -@node AVR Built-in Functions -@subsection AVR Built-in Functions - -For each built-in function for AVR, there is an equally named, -uppercase built-in macro defined. That way users can easily query if -or if not a specific built-in is implemented or not. For example, if -@code{__builtin_avr_nop} is available the macro -@code{__BUILTIN_AVR_NOP} is defined to @code{1} and undefined otherwise. - -The following built-in functions map to the respective machine -instruction, i.e.@: @code{nop}, @code{sei}, @code{cli}, @code{sleep}, -@code{wdr}, @code{swap}, @code{fmul}, @code{fmuls} -resp. @code{fmulsu}. The three @code{fmul*} built-ins are implemented -as library call if no hardware multiplier is available. - -@smallexample -void __builtin_avr_nop (void) -void __builtin_avr_sei (void) -void __builtin_avr_cli (void) -void __builtin_avr_sleep (void) -void __builtin_avr_wdr (void) -unsigned char __builtin_avr_swap (unsigned char) -unsigned int __builtin_avr_fmul (unsigned char, unsigned char) -int __builtin_avr_fmuls (char, char) -int __builtin_avr_fmulsu (char, unsigned char) -@end smallexample - -In order to delay execution for a specific number of cycles, GCC -implements -@smallexample -void __builtin_avr_delay_cycles (unsigned long ticks) -@end smallexample - -@noindent -@code{ticks} is the number of ticks to delay execution. Note that this -built-in does not take into account the effect of interrupts that -might increase delay time. @code{ticks} must be a compile-time -integer constant; delays with a variable number of cycles are not supported. - -@smallexample -char __builtin_avr_flash_segment (const __memx void*) -@end smallexample - -@noindent -This built-in takes a byte address to the 24-bit -@ref{AVR Named Address Spaces,address space} @code{__memx} and returns -the number of the flash segment (the 64 KiB chunk) where the address -points to. Counting starts at @code{0}. -If the address does not point to flash memory, return @code{-1}. - -@smallexample -unsigned char __builtin_avr_insert_bits (unsigned long map, unsigned char bits, unsigned char val) -@end smallexample - -@noindent -Insert bits from @var{bits} into @var{val} and return the resulting -value. The nibbles of @var{map} determine how the insertion is -performed: Let @var{X} be the @var{n}-th nibble of @var{map} -@enumerate -@item If @var{X} is @code{0xf}, -then the @var{n}-th bit of @var{val} is returned unaltered. - -@item If X is in the range 0@dots{}7, -then the @var{n}-th result bit is set to the @var{X}-th bit of @var{bits} - -@item If X is in the range 8@dots{}@code{0xe}, -then the @var{n}-th result bit is undefined. -@end enumerate - -@noindent -One typical use case for this built-in is adjusting input and -output values to non-contiguous port layouts. Some examples: - -@smallexample -// same as val, bits is unused -__builtin_avr_insert_bits (0xffffffff, bits, val) -@end smallexample - -@smallexample -// same as bits, val is unused -__builtin_avr_insert_bits (0x76543210, bits, val) -@end smallexample - -@smallexample -// same as rotating bits by 4 -__builtin_avr_insert_bits (0x32107654, bits, 0) -@end smallexample - -@smallexample -// high nibble of result is the high nibble of val -// low nibble of result is the low nibble of bits -__builtin_avr_insert_bits (0xffff3210, bits, val) -@end smallexample - -@smallexample -// reverse the bit order of bits -__builtin_avr_insert_bits (0x01234567, bits, 0) -@end smallexample - -@node Blackfin Built-in Functions -@subsection Blackfin Built-in Functions - -Currently, there are two Blackfin-specific built-in functions. These are -used for generating @code{CSYNC} and @code{SSYNC} machine insns without -using inline assembly; by using these built-in functions the compiler can -automatically add workarounds for hardware errata involving these -instructions. These functions are named as follows: - -@smallexample -void __builtin_bfin_csync (void) -void __builtin_bfin_ssync (void) -@end smallexample - -@node FR-V Built-in Functions -@subsection FR-V Built-in Functions - -GCC provides many FR-V-specific built-in functions. In general, -these functions are intended to be compatible with those described -by @cite{FR-V Family, Softune C/C++ Compiler Manual (V6), Fujitsu -Semiconductor}. The two exceptions are @code{__MDUNPACKH} and -@code{__MBTOHE}, the GCC forms of which pass 128-bit values by -pointer rather than by value. - -Most of the functions are named after specific FR-V instructions. -Such functions are said to be ``directly mapped'' and are summarized -here in tabular form. - -@menu -* Argument Types:: -* Directly-mapped Integer Functions:: -* Directly-mapped Media Functions:: -* Raw read/write Functions:: -* Other Built-in Functions:: -@end menu - -@node Argument Types -@subsubsection Argument Types - -The arguments to the built-in functions can be divided into three groups: -register numbers, compile-time constants and run-time values. In order -to make this classification clear at a glance, the arguments and return -values are given the following pseudo types: - -@multitable @columnfractions .20 .30 .15 .35 -@item Pseudo type @tab Real C type @tab Constant? @tab Description -@item @code{uh} @tab @code{unsigned short} @tab No @tab an unsigned halfword -@item @code{uw1} @tab @code{unsigned int} @tab No @tab an unsigned word -@item @code{sw1} @tab @code{int} @tab No @tab a signed word -@item @code{uw2} @tab @code{unsigned long long} @tab No -@tab an unsigned doubleword -@item @code{sw2} @tab @code{long long} @tab No @tab a signed doubleword -@item @code{const} @tab @code{int} @tab Yes @tab an integer constant -@item @code{acc} @tab @code{int} @tab Yes @tab an ACC register number -@item @code{iacc} @tab @code{int} @tab Yes @tab an IACC register number -@end multitable - -These pseudo types are not defined by GCC, they are simply a notational -convenience used in this manual. - -Arguments of type @code{uh}, @code{uw1}, @code{sw1}, @code{uw2} -and @code{sw2} are evaluated at run time. They correspond to -register operands in the underlying FR-V instructions. - -@code{const} arguments represent immediate operands in the underlying -FR-V instructions. They must be compile-time constants. - -@code{acc} arguments are evaluated at compile time and specify the number -of an accumulator register. For example, an @code{acc} argument of 2 -selects the ACC2 register. - -@code{iacc} arguments are similar to @code{acc} arguments but specify the -number of an IACC register. See @pxref{Other Built-in Functions} -for more details. - -@node Directly-mapped Integer Functions -@subsubsection Directly-Mapped Integer Functions - -The functions listed below map directly to FR-V I-type instructions. - -@multitable @columnfractions .45 .32 .23 -@item Function prototype @tab Example usage @tab Assembly output -@item @code{sw1 __ADDSS (sw1, sw1)} -@tab @code{@var{c} = __ADDSS (@var{a}, @var{b})} -@tab @code{ADDSS @var{a},@var{b},@var{c}} -@item @code{sw1 __SCAN (sw1, sw1)} -@tab @code{@var{c} = __SCAN (@var{a}, @var{b})} -@tab @code{SCAN @var{a},@var{b},@var{c}} -@item @code{sw1 __SCUTSS (sw1)} -@tab @code{@var{b} = __SCUTSS (@var{a})} -@tab @code{SCUTSS @var{a},@var{b}} -@item @code{sw1 __SLASS (sw1, sw1)} -@tab @code{@var{c} = __SLASS (@var{a}, @var{b})} -@tab @code{SLASS @var{a},@var{b},@var{c}} -@item @code{void __SMASS (sw1, sw1)} -@tab @code{__SMASS (@var{a}, @var{b})} -@tab @code{SMASS @var{a},@var{b}} -@item @code{void __SMSSS (sw1, sw1)} -@tab @code{__SMSSS (@var{a}, @var{b})} -@tab @code{SMSSS @var{a},@var{b}} -@item @code{void __SMU (sw1, sw1)} -@tab @code{__SMU (@var{a}, @var{b})} -@tab @code{SMU @var{a},@var{b}} -@item @code{sw2 __SMUL (sw1, sw1)} -@tab @code{@var{c} = __SMUL (@var{a}, @var{b})} -@tab @code{SMUL @var{a},@var{b},@var{c}} -@item @code{sw1 __SUBSS (sw1, sw1)} -@tab @code{@var{c} = __SUBSS (@var{a}, @var{b})} -@tab @code{SUBSS @var{a},@var{b},@var{c}} -@item @code{uw2 __UMUL (uw1, uw1)} -@tab @code{@var{c} = __UMUL (@var{a}, @var{b})} -@tab @code{UMUL @var{a},@var{b},@var{c}} -@end multitable - -@node Directly-mapped Media Functions -@subsubsection Directly-Mapped Media Functions - -The functions listed below map directly to FR-V M-type instructions. - -@multitable @columnfractions .45 .32 .23 -@item Function prototype @tab Example usage @tab Assembly output -@item @code{uw1 __MABSHS (sw1)} -@tab @code{@var{b} = __MABSHS (@var{a})} -@tab @code{MABSHS @var{a},@var{b}} -@item @code{void __MADDACCS (acc, acc)} -@tab @code{__MADDACCS (@var{b}, @var{a})} -@tab @code{MADDACCS @var{a},@var{b}} -@item @code{sw1 __MADDHSS (sw1, sw1)} -@tab @code{@var{c} = __MADDHSS (@var{a}, @var{b})} -@tab @code{MADDHSS @var{a},@var{b},@var{c}} -@item @code{uw1 __MADDHUS (uw1, uw1)} -@tab @code{@var{c} = __MADDHUS (@var{a}, @var{b})} -@tab @code{MADDHUS @var{a},@var{b},@var{c}} -@item @code{uw1 __MAND (uw1, uw1)} -@tab @code{@var{c} = __MAND (@var{a}, @var{b})} -@tab @code{MAND @var{a},@var{b},@var{c}} -@item @code{void __MASACCS (acc, acc)} -@tab @code{__MASACCS (@var{b}, @var{a})} -@tab @code{MASACCS @var{a},@var{b}} -@item @code{uw1 __MAVEH (uw1, uw1)} -@tab @code{@var{c} = __MAVEH (@var{a}, @var{b})} -@tab @code{MAVEH @var{a},@var{b},@var{c}} -@item @code{uw2 __MBTOH (uw1)} -@tab @code{@var{b} = __MBTOH (@var{a})} -@tab @code{MBTOH @var{a},@var{b}} -@item @code{void __MBTOHE (uw1 *, uw1)} -@tab @code{__MBTOHE (&@var{b}, @var{a})} -@tab @code{MBTOHE @var{a},@var{b}} -@item @code{void __MCLRACC (acc)} -@tab @code{__MCLRACC (@var{a})} -@tab @code{MCLRACC @var{a}} -@item @code{void __MCLRACCA (void)} -@tab @code{__MCLRACCA ()} -@tab @code{MCLRACCA} -@item @code{uw1 __Mcop1 (uw1, uw1)} -@tab @code{@var{c} = __Mcop1 (@var{a}, @var{b})} -@tab @code{Mcop1 @var{a},@var{b},@var{c}} -@item @code{uw1 __Mcop2 (uw1, uw1)} -@tab @code{@var{c} = __Mcop2 (@var{a}, @var{b})} -@tab @code{Mcop2 @var{a},@var{b},@var{c}} -@item @code{uw1 __MCPLHI (uw2, const)} -@tab @code{@var{c} = __MCPLHI (@var{a}, @var{b})} -@tab @code{MCPLHI @var{a},#@var{b},@var{c}} -@item @code{uw1 __MCPLI (uw2, const)} -@tab @code{@var{c} = __MCPLI (@var{a}, @var{b})} -@tab @code{MCPLI @var{a},#@var{b},@var{c}} -@item @code{void __MCPXIS (acc, sw1, sw1)} -@tab @code{__MCPXIS (@var{c}, @var{a}, @var{b})} -@tab @code{MCPXIS @var{a},@var{b},@var{c}} -@item @code{void __MCPXIU (acc, uw1, uw1)} -@tab @code{__MCPXIU (@var{c}, @var{a}, @var{b})} -@tab @code{MCPXIU @var{a},@var{b},@var{c}} -@item @code{void __MCPXRS (acc, sw1, sw1)} -@tab @code{__MCPXRS (@var{c}, @var{a}, @var{b})} -@tab @code{MCPXRS @var{a},@var{b},@var{c}} -@item @code{void __MCPXRU (acc, uw1, uw1)} -@tab @code{__MCPXRU (@var{c}, @var{a}, @var{b})} -@tab @code{MCPXRU @var{a},@var{b},@var{c}} -@item @code{uw1 __MCUT (acc, uw1)} -@tab @code{@var{c} = __MCUT (@var{a}, @var{b})} -@tab @code{MCUT @var{a},@var{b},@var{c}} -@item @code{uw1 __MCUTSS (acc, sw1)} -@tab @code{@var{c} = __MCUTSS (@var{a}, @var{b})} -@tab @code{MCUTSS @var{a},@var{b},@var{c}} -@item @code{void __MDADDACCS (acc, acc)} -@tab @code{__MDADDACCS (@var{b}, @var{a})} -@tab @code{MDADDACCS @var{a},@var{b}} -@item @code{void __MDASACCS (acc, acc)} -@tab @code{__MDASACCS (@var{b}, @var{a})} -@tab @code{MDASACCS @var{a},@var{b}} -@item @code{uw2 __MDCUTSSI (acc, const)} -@tab @code{@var{c} = __MDCUTSSI (@var{a}, @var{b})} -@tab @code{MDCUTSSI @var{a},#@var{b},@var{c}} -@item @code{uw2 __MDPACKH (uw2, uw2)} -@tab @code{@var{c} = __MDPACKH (@var{a}, @var{b})} -@tab @code{MDPACKH @var{a},@var{b},@var{c}} -@item @code{uw2 __MDROTLI (uw2, const)} -@tab @code{@var{c} = __MDROTLI (@var{a}, @var{b})} -@tab @code{MDROTLI @var{a},#@var{b},@var{c}} -@item @code{void __MDSUBACCS (acc, acc)} -@tab @code{__MDSUBACCS (@var{b}, @var{a})} -@tab @code{MDSUBACCS @var{a},@var{b}} -@item @code{void __MDUNPACKH (uw1 *, uw2)} -@tab @code{__MDUNPACKH (&@var{b}, @var{a})} -@tab @code{MDUNPACKH @var{a},@var{b}} -@item @code{uw2 __MEXPDHD (uw1, const)} -@tab @code{@var{c} = __MEXPDHD (@var{a}, @var{b})} -@tab @code{MEXPDHD @var{a},#@var{b},@var{c}} -@item @code{uw1 __MEXPDHW (uw1, const)} -@tab @code{@var{c} = __MEXPDHW (@var{a}, @var{b})} -@tab @code{MEXPDHW @var{a},#@var{b},@var{c}} -@item @code{uw1 __MHDSETH (uw1, const)} -@tab @code{@var{c} = __MHDSETH (@var{a}, @var{b})} -@tab @code{MHDSETH @var{a},#@var{b},@var{c}} -@item @code{sw1 __MHDSETS (const)} -@tab @code{@var{b} = __MHDSETS (@var{a})} -@tab @code{MHDSETS #@var{a},@var{b}} -@item @code{uw1 __MHSETHIH (uw1, const)} -@tab @code{@var{b} = __MHSETHIH (@var{b}, @var{a})} -@tab @code{MHSETHIH #@var{a},@var{b}} -@item @code{sw1 __MHSETHIS (sw1, const)} -@tab @code{@var{b} = __MHSETHIS (@var{b}, @var{a})} -@tab @code{MHSETHIS #@var{a},@var{b}} -@item @code{uw1 __MHSETLOH (uw1, const)} -@tab @code{@var{b} = __MHSETLOH (@var{b}, @var{a})} -@tab @code{MHSETLOH #@var{a},@var{b}} -@item @code{sw1 __MHSETLOS (sw1, const)} -@tab @code{@var{b} = __MHSETLOS (@var{b}, @var{a})} -@tab @code{MHSETLOS #@var{a},@var{b}} -@item @code{uw1 __MHTOB (uw2)} -@tab @code{@var{b} = __MHTOB (@var{a})} -@tab @code{MHTOB @var{a},@var{b}} -@item @code{void __MMACHS (acc, sw1, sw1)} -@tab @code{__MMACHS (@var{c}, @var{a}, @var{b})} -@tab @code{MMACHS @var{a},@var{b},@var{c}} -@item @code{void __MMACHU (acc, uw1, uw1)} -@tab @code{__MMACHU (@var{c}, @var{a}, @var{b})} -@tab @code{MMACHU @var{a},@var{b},@var{c}} -@item @code{void __MMRDHS (acc, sw1, sw1)} -@tab @code{__MMRDHS (@var{c}, @var{a}, @var{b})} -@tab @code{MMRDHS @var{a},@var{b},@var{c}} -@item @code{void __MMRDHU (acc, uw1, uw1)} -@tab @code{__MMRDHU (@var{c}, @var{a}, @var{b})} -@tab @code{MMRDHU @var{a},@var{b},@var{c}} -@item @code{void __MMULHS (acc, sw1, sw1)} -@tab @code{__MMULHS (@var{c}, @var{a}, @var{b})} -@tab @code{MMULHS @var{a},@var{b},@var{c}} -@item @code{void __MMULHU (acc, uw1, uw1)} -@tab @code{__MMULHU (@var{c}, @var{a}, @var{b})} -@tab @code{MMULHU @var{a},@var{b},@var{c}} -@item @code{void __MMULXHS (acc, sw1, sw1)} -@tab @code{__MMULXHS (@var{c}, @var{a}, @var{b})} -@tab @code{MMULXHS @var{a},@var{b},@var{c}} -@item @code{void __MMULXHU (acc, uw1, uw1)} -@tab @code{__MMULXHU (@var{c}, @var{a}, @var{b})} -@tab @code{MMULXHU @var{a},@var{b},@var{c}} -@item @code{uw1 __MNOT (uw1)} -@tab @code{@var{b} = __MNOT (@var{a})} -@tab @code{MNOT @var{a},@var{b}} -@item @code{uw1 __MOR (uw1, uw1)} -@tab @code{@var{c} = __MOR (@var{a}, @var{b})} -@tab @code{MOR @var{a},@var{b},@var{c}} -@item @code{uw1 __MPACKH (uh, uh)} -@tab @code{@var{c} = __MPACKH (@var{a}, @var{b})} -@tab @code{MPACKH @var{a},@var{b},@var{c}} -@item @code{sw2 __MQADDHSS (sw2, sw2)} -@tab @code{@var{c} = __MQADDHSS (@var{a}, @var{b})} -@tab @code{MQADDHSS @var{a},@var{b},@var{c}} -@item @code{uw2 __MQADDHUS (uw2, uw2)} -@tab @code{@var{c} = __MQADDHUS (@var{a}, @var{b})} -@tab @code{MQADDHUS @var{a},@var{b},@var{c}} -@item @code{void __MQCPXIS (acc, sw2, sw2)} -@tab @code{__MQCPXIS (@var{c}, @var{a}, @var{b})} -@tab @code{MQCPXIS @var{a},@var{b},@var{c}} -@item @code{void __MQCPXIU (acc, uw2, uw2)} -@tab @code{__MQCPXIU (@var{c}, @var{a}, @var{b})} -@tab @code{MQCPXIU @var{a},@var{b},@var{c}} -@item @code{void __MQCPXRS (acc, sw2, sw2)} -@tab @code{__MQCPXRS (@var{c}, @var{a}, @var{b})} -@tab @code{MQCPXRS @var{a},@var{b},@var{c}} -@item @code{void __MQCPXRU (acc, uw2, uw2)} -@tab @code{__MQCPXRU (@var{c}, @var{a}, @var{b})} -@tab @code{MQCPXRU @var{a},@var{b},@var{c}} -@item @code{sw2 __MQLCLRHS (sw2, sw2)} -@tab @code{@var{c} = __MQLCLRHS (@var{a}, @var{b})} -@tab @code{MQLCLRHS @var{a},@var{b},@var{c}} -@item @code{sw2 __MQLMTHS (sw2, sw2)} -@tab @code{@var{c} = __MQLMTHS (@var{a}, @var{b})} -@tab @code{MQLMTHS @var{a},@var{b},@var{c}} -@item @code{void __MQMACHS (acc, sw2, sw2)} -@tab @code{__MQMACHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQMACHS @var{a},@var{b},@var{c}} -@item @code{void __MQMACHU (acc, uw2, uw2)} -@tab @code{__MQMACHU (@var{c}, @var{a}, @var{b})} -@tab @code{MQMACHU @var{a},@var{b},@var{c}} -@item @code{void __MQMACXHS (acc, sw2, sw2)} -@tab @code{__MQMACXHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQMACXHS @var{a},@var{b},@var{c}} -@item @code{void __MQMULHS (acc, sw2, sw2)} -@tab @code{__MQMULHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQMULHS @var{a},@var{b},@var{c}} -@item @code{void __MQMULHU (acc, uw2, uw2)} -@tab @code{__MQMULHU (@var{c}, @var{a}, @var{b})} -@tab @code{MQMULHU @var{a},@var{b},@var{c}} -@item @code{void __MQMULXHS (acc, sw2, sw2)} -@tab @code{__MQMULXHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQMULXHS @var{a},@var{b},@var{c}} -@item @code{void __MQMULXHU (acc, uw2, uw2)} -@tab @code{__MQMULXHU (@var{c}, @var{a}, @var{b})} -@tab @code{MQMULXHU @var{a},@var{b},@var{c}} -@item @code{sw2 __MQSATHS (sw2, sw2)} -@tab @code{@var{c} = __MQSATHS (@var{a}, @var{b})} -@tab @code{MQSATHS @var{a},@var{b},@var{c}} -@item @code{uw2 __MQSLLHI (uw2, int)} -@tab @code{@var{c} = __MQSLLHI (@var{a}, @var{b})} -@tab @code{MQSLLHI @var{a},@var{b},@var{c}} -@item @code{sw2 __MQSRAHI (sw2, int)} -@tab @code{@var{c} = __MQSRAHI (@var{a}, @var{b})} -@tab @code{MQSRAHI @var{a},@var{b},@var{c}} -@item @code{sw2 __MQSUBHSS (sw2, sw2)} -@tab @code{@var{c} = __MQSUBHSS (@var{a}, @var{b})} -@tab @code{MQSUBHSS @var{a},@var{b},@var{c}} -@item @code{uw2 __MQSUBHUS (uw2, uw2)} -@tab @code{@var{c} = __MQSUBHUS (@var{a}, @var{b})} -@tab @code{MQSUBHUS @var{a},@var{b},@var{c}} -@item @code{void __MQXMACHS (acc, sw2, sw2)} -@tab @code{__MQXMACHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQXMACHS @var{a},@var{b},@var{c}} -@item @code{void __MQXMACXHS (acc, sw2, sw2)} -@tab @code{__MQXMACXHS (@var{c}, @var{a}, @var{b})} -@tab @code{MQXMACXHS @var{a},@var{b},@var{c}} -@item @code{uw1 __MRDACC (acc)} -@tab @code{@var{b} = __MRDACC (@var{a})} -@tab @code{MRDACC @var{a},@var{b}} -@item @code{uw1 __MRDACCG (acc)} -@tab @code{@var{b} = __MRDACCG (@var{a})} -@tab @code{MRDACCG @var{a},@var{b}} -@item @code{uw1 __MROTLI (uw1, const)} -@tab @code{@var{c} = __MROTLI (@var{a}, @var{b})} -@tab @code{MROTLI @var{a},#@var{b},@var{c}} -@item @code{uw1 __MROTRI (uw1, const)} -@tab @code{@var{c} = __MROTRI (@var{a}, @var{b})} -@tab @code{MROTRI @var{a},#@var{b},@var{c}} -@item @code{sw1 __MSATHS (sw1, sw1)} -@tab @code{@var{c} = __MSATHS (@var{a}, @var{b})} -@tab @code{MSATHS @var{a},@var{b},@var{c}} -@item @code{uw1 __MSATHU (uw1, uw1)} -@tab @code{@var{c} = __MSATHU (@var{a}, @var{b})} -@tab @code{MSATHU @var{a},@var{b},@var{c}} -@item @code{uw1 __MSLLHI (uw1, const)} -@tab @code{@var{c} = __MSLLHI (@var{a}, @var{b})} -@tab @code{MSLLHI @var{a},#@var{b},@var{c}} -@item @code{sw1 __MSRAHI (sw1, const)} -@tab @code{@var{c} = __MSRAHI (@var{a}, @var{b})} -@tab @code{MSRAHI @var{a},#@var{b},@var{c}} -@item @code{uw1 __MSRLHI (uw1, const)} -@tab @code{@var{c} = __MSRLHI (@var{a}, @var{b})} -@tab @code{MSRLHI @var{a},#@var{b},@var{c}} -@item @code{void __MSUBACCS (acc, acc)} -@tab @code{__MSUBACCS (@var{b}, @var{a})} -@tab @code{MSUBACCS @var{a},@var{b}} -@item @code{sw1 __MSUBHSS (sw1, sw1)} -@tab @code{@var{c} = __MSUBHSS (@var{a}, @var{b})} -@tab @code{MSUBHSS @var{a},@var{b},@var{c}} -@item @code{uw1 __MSUBHUS (uw1, uw1)} -@tab @code{@var{c} = __MSUBHUS (@var{a}, @var{b})} -@tab @code{MSUBHUS @var{a},@var{b},@var{c}} -@item @code{void __MTRAP (void)} -@tab @code{__MTRAP ()} -@tab @code{MTRAP} -@item @code{uw2 __MUNPACKH (uw1)} -@tab @code{@var{b} = __MUNPACKH (@var{a})} -@tab @code{MUNPACKH @var{a},@var{b}} -@item @code{uw1 __MWCUT (uw2, uw1)} -@tab @code{@var{c} = __MWCUT (@var{a}, @var{b})} -@tab @code{MWCUT @var{a},@var{b},@var{c}} -@item @code{void __MWTACC (acc, uw1)} -@tab @code{__MWTACC (@var{b}, @var{a})} -@tab @code{MWTACC @var{a},@var{b}} -@item @code{void __MWTACCG (acc, uw1)} -@tab @code{__MWTACCG (@var{b}, @var{a})} -@tab @code{MWTACCG @var{a},@var{b}} -@item @code{uw1 __MXOR (uw1, uw1)} -@tab @code{@var{c} = __MXOR (@var{a}, @var{b})} -@tab @code{MXOR @var{a},@var{b},@var{c}} -@end multitable - -@node Raw read/write Functions -@subsubsection Raw Read/Write Functions - -This sections describes built-in functions related to read and write -instructions to access memory. These functions generate -@code{membar} instructions to flush the I/O load and stores where -appropriate, as described in Fujitsu's manual described above. - -@table @code - -@item unsigned char __builtin_read8 (void *@var{data}) -@item unsigned short __builtin_read16 (void *@var{data}) -@item unsigned long __builtin_read32 (void *@var{data}) -@item unsigned long long __builtin_read64 (void *@var{data}) - -@item void __builtin_write8 (void *@var{data}, unsigned char @var{datum}) -@item void __builtin_write16 (void *@var{data}, unsigned short @var{datum}) -@item void __builtin_write32 (void *@var{data}, unsigned long @var{datum}) -@item void __builtin_write64 (void *@var{data}, unsigned long long @var{datum}) -@end table - -@node Other Built-in Functions -@subsubsection Other Built-in Functions - -This section describes built-in functions that are not named after -a specific FR-V instruction. - -@table @code -@item sw2 __IACCreadll (iacc @var{reg}) -Return the full 64-bit value of IACC0@. The @var{reg} argument is reserved -for future expansion and must be 0. - -@item sw1 __IACCreadl (iacc @var{reg}) -Return the value of IACC0H if @var{reg} is 0 and IACC0L if @var{reg} is 1. -Other values of @var{reg} are rejected as invalid. - -@item void __IACCsetll (iacc @var{reg}, sw2 @var{x}) -Set the full 64-bit value of IACC0 to @var{x}. The @var{reg} argument -is reserved for future expansion and must be 0. - -@item void __IACCsetl (iacc @var{reg}, sw1 @var{x}) -Set IACC0H to @var{x} if @var{reg} is 0 and IACC0L to @var{x} if @var{reg} -is 1. Other values of @var{reg} are rejected as invalid. - -@item void __data_prefetch0 (const void *@var{x}) -Use the @code{dcpl} instruction to load the contents of address @var{x} -into the data cache. - -@item void __data_prefetch (const void *@var{x}) -Use the @code{nldub} instruction to load the contents of address @var{x} -into the data cache. The instruction is issued in slot I1@. -@end table - -@node MIPS DSP Built-in Functions -@subsection MIPS DSP Built-in Functions - -The MIPS DSP Application-Specific Extension (ASE) includes new -instructions that are designed to improve the performance of DSP and -media applications. It provides instructions that operate on packed -8-bit/16-bit integer data, Q7, Q15 and Q31 fractional data. - -GCC supports MIPS DSP operations using both the generic -vector extensions (@pxref{Vector Extensions}) and a collection of -MIPS-specific built-in functions. Both kinds of support are -enabled by the @option{-mdsp} command-line option. - -Revision 2 of the ASE was introduced in the second half of 2006. -This revision adds extra instructions to the original ASE, but is -otherwise backwards-compatible with it. You can select revision 2 -using the command-line option @option{-mdspr2}; this option implies -@option{-mdsp}. - -The SCOUNT and POS bits of the DSP control register are global. The -WRDSP, EXTPDP, EXTPDPV and MTHLIP instructions modify the SCOUNT and -POS bits. During optimization, the compiler does not delete these -instructions and it does not delete calls to functions containing -these instructions. - -At present, GCC only provides support for operations on 32-bit -vectors. The vector type associated with 8-bit integer data is -usually called @code{v4i8}, the vector type associated with Q7 -is usually called @code{v4q7}, the vector type associated with 16-bit -integer data is usually called @code{v2i16}, and the vector type -associated with Q15 is usually called @code{v2q15}. They can be -defined in C as follows: - -@smallexample -typedef signed char v4i8 __attribute__ ((vector_size(4))); -typedef signed char v4q7 __attribute__ ((vector_size(4))); -typedef short v2i16 __attribute__ ((vector_size(4))); -typedef short v2q15 __attribute__ ((vector_size(4))); -@end smallexample - -@code{v4i8}, @code{v4q7}, @code{v2i16} and @code{v2q15} values are -initialized in the same way as aggregates. For example: - -@smallexample -v4i8 a = @{1, 2, 3, 4@}; -v4i8 b; -b = (v4i8) @{5, 6, 7, 8@}; - -v2q15 c = @{0x0fcb, 0x3a75@}; -v2q15 d; -d = (v2q15) @{0.1234 * 0x1.0p15, 0.4567 * 0x1.0p15@}; -@end smallexample - -@emph{Note:} The CPU's endianness determines the order in which values -are packed. On little-endian targets, the first value is the least -significant and the last value is the most significant. The opposite -order applies to big-endian targets. For example, the code above -sets the lowest byte of @code{a} to @code{1} on little-endian targets -and @code{4} on big-endian targets. - -@emph{Note:} Q7, Q15 and Q31 values must be initialized with their integer -representation. As shown in this example, the integer representation -of a Q7 value can be obtained by multiplying the fractional value by -@code{0x1.0p7}. The equivalent for Q15 values is to multiply by -@code{0x1.0p15}. The equivalent for Q31 values is to multiply by -@code{0x1.0p31}. - -The table below lists the @code{v4i8} and @code{v2q15} operations for which -hardware support exists. @code{a} and @code{b} are @code{v4i8} values, -and @code{c} and @code{d} are @code{v2q15} values. - -@multitable @columnfractions .50 .50 -@item C code @tab MIPS instruction -@item @code{a + b} @tab @code{addu.qb} -@item @code{c + d} @tab @code{addq.ph} -@item @code{a - b} @tab @code{subu.qb} -@item @code{c - d} @tab @code{subq.ph} -@end multitable - -The table below lists the @code{v2i16} operation for which -hardware support exists for the DSP ASE REV 2. @code{e} and @code{f} are -@code{v2i16} values. - -@multitable @columnfractions .50 .50 -@item C code @tab MIPS instruction -@item @code{e * f} @tab @code{mul.ph} -@end multitable - -It is easier to describe the DSP built-in functions if we first define -the following types: - -@smallexample -typedef int q31; -typedef int i32; -typedef unsigned int ui32; -typedef long long a64; -@end smallexample - -@code{q31} and @code{i32} are actually the same as @code{int}, but we -use @code{q31} to indicate a Q31 fractional value and @code{i32} to -indicate a 32-bit integer value. Similarly, @code{a64} is the same as -@code{long long}, but we use @code{a64} to indicate values that are -placed in one of the four DSP accumulators (@code{$ac0}, -@code{$ac1}, @code{$ac2} or @code{$ac3}). - -Also, some built-in functions prefer or require immediate numbers as -parameters, because the corresponding DSP instructions accept both immediate -numbers and register operands, or accept immediate numbers only. The -immediate parameters are listed as follows. - -@smallexample -imm0_3: 0 to 3. -imm0_7: 0 to 7. -imm0_15: 0 to 15. -imm0_31: 0 to 31. -imm0_63: 0 to 63. -imm0_255: 0 to 255. -imm_n32_31: -32 to 31. -imm_n512_511: -512 to 511. -@end smallexample - -The following built-in functions map directly to a particular MIPS DSP -instruction. Please refer to the architecture specification -for details on what each instruction does. - -@smallexample -v2q15 __builtin_mips_addq_ph (v2q15, v2q15) -v2q15 __builtin_mips_addq_s_ph (v2q15, v2q15) -q31 __builtin_mips_addq_s_w (q31, q31) -v4i8 __builtin_mips_addu_qb (v4i8, v4i8) -v4i8 __builtin_mips_addu_s_qb (v4i8, v4i8) -v2q15 __builtin_mips_subq_ph (v2q15, v2q15) -v2q15 __builtin_mips_subq_s_ph (v2q15, v2q15) -q31 __builtin_mips_subq_s_w (q31, q31) -v4i8 __builtin_mips_subu_qb (v4i8, v4i8) -v4i8 __builtin_mips_subu_s_qb (v4i8, v4i8) -i32 __builtin_mips_addsc (i32, i32) -i32 __builtin_mips_addwc (i32, i32) -i32 __builtin_mips_modsub (i32, i32) -i32 __builtin_mips_raddu_w_qb (v4i8) -v2q15 __builtin_mips_absq_s_ph (v2q15) -q31 __builtin_mips_absq_s_w (q31) -v4i8 __builtin_mips_precrq_qb_ph (v2q15, v2q15) -v2q15 __builtin_mips_precrq_ph_w (q31, q31) -v2q15 __builtin_mips_precrq_rs_ph_w (q31, q31) -v4i8 __builtin_mips_precrqu_s_qb_ph (v2q15, v2q15) -q31 __builtin_mips_preceq_w_phl (v2q15) -q31 __builtin_mips_preceq_w_phr (v2q15) -v2q15 __builtin_mips_precequ_ph_qbl (v4i8) -v2q15 __builtin_mips_precequ_ph_qbr (v4i8) -v2q15 __builtin_mips_precequ_ph_qbla (v4i8) -v2q15 __builtin_mips_precequ_ph_qbra (v4i8) -v2q15 __builtin_mips_preceu_ph_qbl (v4i8) -v2q15 __builtin_mips_preceu_ph_qbr (v4i8) -v2q15 __builtin_mips_preceu_ph_qbla (v4i8) -v2q15 __builtin_mips_preceu_ph_qbra (v4i8) -v4i8 __builtin_mips_shll_qb (v4i8, imm0_7) -v4i8 __builtin_mips_shll_qb (v4i8, i32) -v2q15 __builtin_mips_shll_ph (v2q15, imm0_15) -v2q15 __builtin_mips_shll_ph (v2q15, i32) -v2q15 __builtin_mips_shll_s_ph (v2q15, imm0_15) -v2q15 __builtin_mips_shll_s_ph (v2q15, i32) -q31 __builtin_mips_shll_s_w (q31, imm0_31) -q31 __builtin_mips_shll_s_w (q31, i32) -v4i8 __builtin_mips_shrl_qb (v4i8, imm0_7) -v4i8 __builtin_mips_shrl_qb (v4i8, i32) -v2q15 __builtin_mips_shra_ph (v2q15, imm0_15) -v2q15 __builtin_mips_shra_ph (v2q15, i32) -v2q15 __builtin_mips_shra_r_ph (v2q15, imm0_15) -v2q15 __builtin_mips_shra_r_ph (v2q15, i32) -q31 __builtin_mips_shra_r_w (q31, imm0_31) -q31 __builtin_mips_shra_r_w (q31, i32) -v2q15 __builtin_mips_muleu_s_ph_qbl (v4i8, v2q15) -v2q15 __builtin_mips_muleu_s_ph_qbr (v4i8, v2q15) -v2q15 __builtin_mips_mulq_rs_ph (v2q15, v2q15) -q31 __builtin_mips_muleq_s_w_phl (v2q15, v2q15) -q31 __builtin_mips_muleq_s_w_phr (v2q15, v2q15) -a64 __builtin_mips_dpau_h_qbl (a64, v4i8, v4i8) -a64 __builtin_mips_dpau_h_qbr (a64, v4i8, v4i8) -a64 __builtin_mips_dpsu_h_qbl (a64, v4i8, v4i8) -a64 __builtin_mips_dpsu_h_qbr (a64, v4i8, v4i8) -a64 __builtin_mips_dpaq_s_w_ph (a64, v2q15, v2q15) -a64 __builtin_mips_dpaq_sa_l_w (a64, q31, q31) -a64 __builtin_mips_dpsq_s_w_ph (a64, v2q15, v2q15) -a64 __builtin_mips_dpsq_sa_l_w (a64, q31, q31) -a64 __builtin_mips_mulsaq_s_w_ph (a64, v2q15, v2q15) -a64 __builtin_mips_maq_s_w_phl (a64, v2q15, v2q15) -a64 __builtin_mips_maq_s_w_phr (a64, v2q15, v2q15) -a64 __builtin_mips_maq_sa_w_phl (a64, v2q15, v2q15) -a64 __builtin_mips_maq_sa_w_phr (a64, v2q15, v2q15) -i32 __builtin_mips_bitrev (i32) -i32 __builtin_mips_insv (i32, i32) -v4i8 __builtin_mips_repl_qb (imm0_255) -v4i8 __builtin_mips_repl_qb (i32) -v2q15 __builtin_mips_repl_ph (imm_n512_511) -v2q15 __builtin_mips_repl_ph (i32) -void __builtin_mips_cmpu_eq_qb (v4i8, v4i8) -void __builtin_mips_cmpu_lt_qb (v4i8, v4i8) -void __builtin_mips_cmpu_le_qb (v4i8, v4i8) -i32 __builtin_mips_cmpgu_eq_qb (v4i8, v4i8) -i32 __builtin_mips_cmpgu_lt_qb (v4i8, v4i8) -i32 __builtin_mips_cmpgu_le_qb (v4i8, v4i8) -void __builtin_mips_cmp_eq_ph (v2q15, v2q15) -void __builtin_mips_cmp_lt_ph (v2q15, v2q15) -void __builtin_mips_cmp_le_ph (v2q15, v2q15) -v4i8 __builtin_mips_pick_qb (v4i8, v4i8) -v2q15 __builtin_mips_pick_ph (v2q15, v2q15) -v2q15 __builtin_mips_packrl_ph (v2q15, v2q15) -i32 __builtin_mips_extr_w (a64, imm0_31) -i32 __builtin_mips_extr_w (a64, i32) -i32 __builtin_mips_extr_r_w (a64, imm0_31) -i32 __builtin_mips_extr_s_h (a64, i32) -i32 __builtin_mips_extr_rs_w (a64, imm0_31) -i32 __builtin_mips_extr_rs_w (a64, i32) -i32 __builtin_mips_extr_s_h (a64, imm0_31) -i32 __builtin_mips_extr_r_w (a64, i32) -i32 __builtin_mips_extp (a64, imm0_31) -i32 __builtin_mips_extp (a64, i32) -i32 __builtin_mips_extpdp (a64, imm0_31) -i32 __builtin_mips_extpdp (a64, i32) -a64 __builtin_mips_shilo (a64, imm_n32_31) -a64 __builtin_mips_shilo (a64, i32) -a64 __builtin_mips_mthlip (a64, i32) -void __builtin_mips_wrdsp (i32, imm0_63) -i32 __builtin_mips_rddsp (imm0_63) -i32 __builtin_mips_lbux (void *, i32) -i32 __builtin_mips_lhx (void *, i32) -i32 __builtin_mips_lwx (void *, i32) -a64 __builtin_mips_ldx (void *, i32) [MIPS64 only] -i32 __builtin_mips_bposge32 (void) -a64 __builtin_mips_madd (a64, i32, i32); -a64 __builtin_mips_maddu (a64, ui32, ui32); -a64 __builtin_mips_msub (a64, i32, i32); -a64 __builtin_mips_msubu (a64, ui32, ui32); -a64 __builtin_mips_mult (i32, i32); -a64 __builtin_mips_multu (ui32, ui32); -@end smallexample - -The following built-in functions map directly to a particular MIPS DSP REV 2 -instruction. Please refer to the architecture specification -for details on what each instruction does. - -@smallexample -v4q7 __builtin_mips_absq_s_qb (v4q7); -v2i16 __builtin_mips_addu_ph (v2i16, v2i16); -v2i16 __builtin_mips_addu_s_ph (v2i16, v2i16); -v4i8 __builtin_mips_adduh_qb (v4i8, v4i8); -v4i8 __builtin_mips_adduh_r_qb (v4i8, v4i8); -i32 __builtin_mips_append (i32, i32, imm0_31); -i32 __builtin_mips_balign (i32, i32, imm0_3); -i32 __builtin_mips_cmpgdu_eq_qb (v4i8, v4i8); -i32 __builtin_mips_cmpgdu_lt_qb (v4i8, v4i8); -i32 __builtin_mips_cmpgdu_le_qb (v4i8, v4i8); -a64 __builtin_mips_dpa_w_ph (a64, v2i16, v2i16); -a64 __builtin_mips_dps_w_ph (a64, v2i16, v2i16); -v2i16 __builtin_mips_mul_ph (v2i16, v2i16); -v2i16 __builtin_mips_mul_s_ph (v2i16, v2i16); -q31 __builtin_mips_mulq_rs_w (q31, q31); -v2q15 __builtin_mips_mulq_s_ph (v2q15, v2q15); -q31 __builtin_mips_mulq_s_w (q31, q31); -a64 __builtin_mips_mulsa_w_ph (a64, v2i16, v2i16); -v4i8 __builtin_mips_precr_qb_ph (v2i16, v2i16); -v2i16 __builtin_mips_precr_sra_ph_w (i32, i32, imm0_31); -v2i16 __builtin_mips_precr_sra_r_ph_w (i32, i32, imm0_31); -i32 __builtin_mips_prepend (i32, i32, imm0_31); -v4i8 __builtin_mips_shra_qb (v4i8, imm0_7); -v4i8 __builtin_mips_shra_r_qb (v4i8, imm0_7); -v4i8 __builtin_mips_shra_qb (v4i8, i32); -v4i8 __builtin_mips_shra_r_qb (v4i8, i32); -v2i16 __builtin_mips_shrl_ph (v2i16, imm0_15); -v2i16 __builtin_mips_shrl_ph (v2i16, i32); -v2i16 __builtin_mips_subu_ph (v2i16, v2i16); -v2i16 __builtin_mips_subu_s_ph (v2i16, v2i16); -v4i8 __builtin_mips_subuh_qb (v4i8, v4i8); -v4i8 __builtin_mips_subuh_r_qb (v4i8, v4i8); -v2q15 __builtin_mips_addqh_ph (v2q15, v2q15); -v2q15 __builtin_mips_addqh_r_ph (v2q15, v2q15); -q31 __builtin_mips_addqh_w (q31, q31); -q31 __builtin_mips_addqh_r_w (q31, q31); -v2q15 __builtin_mips_subqh_ph (v2q15, v2q15); -v2q15 __builtin_mips_subqh_r_ph (v2q15, v2q15); -q31 __builtin_mips_subqh_w (q31, q31); -q31 __builtin_mips_subqh_r_w (q31, q31); -a64 __builtin_mips_dpax_w_ph (a64, v2i16, v2i16); -a64 __builtin_mips_dpsx_w_ph (a64, v2i16, v2i16); -a64 __builtin_mips_dpaqx_s_w_ph (a64, v2q15, v2q15); -a64 __builtin_mips_dpaqx_sa_w_ph (a64, v2q15, v2q15); -a64 __builtin_mips_dpsqx_s_w_ph (a64, v2q15, v2q15); -a64 __builtin_mips_dpsqx_sa_w_ph (a64, v2q15, v2q15); -@end smallexample - - -@node MIPS Paired-Single Support -@subsection MIPS Paired-Single Support - -The MIPS64 architecture includes a number of instructions that -operate on pairs of single-precision floating-point values. -Each pair is packed into a 64-bit floating-point register, -with one element being designated the ``upper half'' and -the other being designated the ``lower half''. - -GCC supports paired-single operations using both the generic -vector extensions (@pxref{Vector Extensions}) and a collection of -MIPS-specific built-in functions. Both kinds of support are -enabled by the @option{-mpaired-single} command-line option. - -The vector type associated with paired-single values is usually -called @code{v2sf}. It can be defined in C as follows: - -@smallexample -typedef float v2sf __attribute__ ((vector_size (8))); -@end smallexample - -@code{v2sf} values are initialized in the same way as aggregates. -For example: - -@smallexample -v2sf a = @{1.5, 9.1@}; -v2sf b; -float e, f; -b = (v2sf) @{e, f@}; -@end smallexample - -@emph{Note:} The CPU's endianness determines which value is stored in -the upper half of a register and which value is stored in the lower half. -On little-endian targets, the first value is the lower one and the second -value is the upper one. The opposite order applies to big-endian targets. -For example, the code above sets the lower half of @code{a} to -@code{1.5} on little-endian targets and @code{9.1} on big-endian targets. - -@node MIPS Loongson Built-in Functions -@subsection MIPS Loongson Built-in Functions - -GCC provides intrinsics to access the SIMD instructions provided by the -ST Microelectronics Loongson-2E and -2F processors. These intrinsics, -available after inclusion of the @code{loongson.h} header file, -operate on the following 64-bit vector types: - -@itemize -@item @code{uint8x8_t}, a vector of eight unsigned 8-bit integers; -@item @code{uint16x4_t}, a vector of four unsigned 16-bit integers; -@item @code{uint32x2_t}, a vector of two unsigned 32-bit integers; -@item @code{int8x8_t}, a vector of eight signed 8-bit integers; -@item @code{int16x4_t}, a vector of four signed 16-bit integers; -@item @code{int32x2_t}, a vector of two signed 32-bit integers. -@end itemize - -The intrinsics provided are listed below; each is named after the -machine instruction to which it corresponds, with suffixes added as -appropriate to distinguish intrinsics that expand to the same machine -instruction yet have different argument types. Refer to the architecture -documentation for a description of the functionality of each -instruction. - -@smallexample -int16x4_t packsswh (int32x2_t s, int32x2_t t); -int8x8_t packsshb (int16x4_t s, int16x4_t t); -uint8x8_t packushb (uint16x4_t s, uint16x4_t t); -uint32x2_t paddw_u (uint32x2_t s, uint32x2_t t); -uint16x4_t paddh_u (uint16x4_t s, uint16x4_t t); -uint8x8_t paddb_u (uint8x8_t s, uint8x8_t t); -int32x2_t paddw_s (int32x2_t s, int32x2_t t); -int16x4_t paddh_s (int16x4_t s, int16x4_t t); -int8x8_t paddb_s (int8x8_t s, int8x8_t t); -uint64_t paddd_u (uint64_t s, uint64_t t); -int64_t paddd_s (int64_t s, int64_t t); -int16x4_t paddsh (int16x4_t s, int16x4_t t); -int8x8_t paddsb (int8x8_t s, int8x8_t t); -uint16x4_t paddush (uint16x4_t s, uint16x4_t t); -uint8x8_t paddusb (uint8x8_t s, uint8x8_t t); -uint64_t pandn_ud (uint64_t s, uint64_t t); -uint32x2_t pandn_uw (uint32x2_t s, uint32x2_t t); -uint16x4_t pandn_uh (uint16x4_t s, uint16x4_t t); -uint8x8_t pandn_ub (uint8x8_t s, uint8x8_t t); -int64_t pandn_sd (int64_t s, int64_t t); -int32x2_t pandn_sw (int32x2_t s, int32x2_t t); -int16x4_t pandn_sh (int16x4_t s, int16x4_t t); -int8x8_t pandn_sb (int8x8_t s, int8x8_t t); -uint16x4_t pavgh (uint16x4_t s, uint16x4_t t); -uint8x8_t pavgb (uint8x8_t s, uint8x8_t t); -uint32x2_t pcmpeqw_u (uint32x2_t s, uint32x2_t t); -uint16x4_t pcmpeqh_u (uint16x4_t s, uint16x4_t t); -uint8x8_t pcmpeqb_u (uint8x8_t s, uint8x8_t t); -int32x2_t pcmpeqw_s (int32x2_t s, int32x2_t t); -int16x4_t pcmpeqh_s (int16x4_t s, int16x4_t t); -int8x8_t pcmpeqb_s (int8x8_t s, int8x8_t t); -uint32x2_t pcmpgtw_u (uint32x2_t s, uint32x2_t t); -uint16x4_t pcmpgth_u (uint16x4_t s, uint16x4_t t); -uint8x8_t pcmpgtb_u (uint8x8_t s, uint8x8_t t); -int32x2_t pcmpgtw_s (int32x2_t s, int32x2_t t); -int16x4_t pcmpgth_s (int16x4_t s, int16x4_t t); -int8x8_t pcmpgtb_s (int8x8_t s, int8x8_t t); -uint16x4_t pextrh_u (uint16x4_t s, int field); -int16x4_t pextrh_s (int16x4_t s, int field); -uint16x4_t pinsrh_0_u (uint16x4_t s, uint16x4_t t); -uint16x4_t pinsrh_1_u (uint16x4_t s, uint16x4_t t); -uint16x4_t pinsrh_2_u (uint16x4_t s, uint16x4_t t); -uint16x4_t pinsrh_3_u (uint16x4_t s, uint16x4_t t); -int16x4_t pinsrh_0_s (int16x4_t s, int16x4_t t); -int16x4_t pinsrh_1_s (int16x4_t s, int16x4_t t); -int16x4_t pinsrh_2_s (int16x4_t s, int16x4_t t); -int16x4_t pinsrh_3_s (int16x4_t s, int16x4_t t); -int32x2_t pmaddhw (int16x4_t s, int16x4_t t); -int16x4_t pmaxsh (int16x4_t s, int16x4_t t); -uint8x8_t pmaxub (uint8x8_t s, uint8x8_t t); -int16x4_t pminsh (int16x4_t s, int16x4_t t); -uint8x8_t pminub (uint8x8_t s, uint8x8_t t); -uint8x8_t pmovmskb_u (uint8x8_t s); -int8x8_t pmovmskb_s (int8x8_t s); -uint16x4_t pmulhuh (uint16x4_t s, uint16x4_t t); -int16x4_t pmulhh (int16x4_t s, int16x4_t t); -int16x4_t pmullh (int16x4_t s, int16x4_t t); -int64_t pmuluw (uint32x2_t s, uint32x2_t t); -uint8x8_t pasubub (uint8x8_t s, uint8x8_t t); -uint16x4_t biadd (uint8x8_t s); -uint16x4_t psadbh (uint8x8_t s, uint8x8_t t); -uint16x4_t pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order); -int16x4_t pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order); -uint16x4_t psllh_u (uint16x4_t s, uint8_t amount); -int16x4_t psllh_s (int16x4_t s, uint8_t amount); -uint32x2_t psllw_u (uint32x2_t s, uint8_t amount); -int32x2_t psllw_s (int32x2_t s, uint8_t amount); -uint16x4_t psrlh_u (uint16x4_t s, uint8_t amount); -int16x4_t psrlh_s (int16x4_t s, uint8_t amount); -uint32x2_t psrlw_u (uint32x2_t s, uint8_t amount); -int32x2_t psrlw_s (int32x2_t s, uint8_t amount); -uint16x4_t psrah_u (uint16x4_t s, uint8_t amount); -int16x4_t psrah_s (int16x4_t s, uint8_t amount); -uint32x2_t psraw_u (uint32x2_t s, uint8_t amount); -int32x2_t psraw_s (int32x2_t s, uint8_t amount); -uint32x2_t psubw_u (uint32x2_t s, uint32x2_t t); -uint16x4_t psubh_u (uint16x4_t s, uint16x4_t t); -uint8x8_t psubb_u (uint8x8_t s, uint8x8_t t); -int32x2_t psubw_s (int32x2_t s, int32x2_t t); -int16x4_t psubh_s (int16x4_t s, int16x4_t t); -int8x8_t psubb_s (int8x8_t s, int8x8_t t); -uint64_t psubd_u (uint64_t s, uint64_t t); -int64_t psubd_s (int64_t s, int64_t t); -int16x4_t psubsh (int16x4_t s, int16x4_t t); -int8x8_t psubsb (int8x8_t s, int8x8_t t); -uint16x4_t psubush (uint16x4_t s, uint16x4_t t); -uint8x8_t psubusb (uint8x8_t s, uint8x8_t t); -uint32x2_t punpckhwd_u (uint32x2_t s, uint32x2_t t); -uint16x4_t punpckhhw_u (uint16x4_t s, uint16x4_t t); -uint8x8_t punpckhbh_u (uint8x8_t s, uint8x8_t t); -int32x2_t punpckhwd_s (int32x2_t s, int32x2_t t); -int16x4_t punpckhhw_s (int16x4_t s, int16x4_t t); -int8x8_t punpckhbh_s (int8x8_t s, int8x8_t t); -uint32x2_t punpcklwd_u (uint32x2_t s, uint32x2_t t); -uint16x4_t punpcklhw_u (uint16x4_t s, uint16x4_t t); -uint8x8_t punpcklbh_u (uint8x8_t s, uint8x8_t t); -int32x2_t punpcklwd_s (int32x2_t s, int32x2_t t); -int16x4_t punpcklhw_s (int16x4_t s, int16x4_t t); -int8x8_t punpcklbh_s (int8x8_t s, int8x8_t t); -@end smallexample - -@menu -* Paired-Single Arithmetic:: -* Paired-Single Built-in Functions:: -* MIPS-3D Built-in Functions:: -@end menu - -@node Paired-Single Arithmetic -@subsubsection Paired-Single Arithmetic - -The table below lists the @code{v2sf} operations for which hardware -support exists. @code{a}, @code{b} and @code{c} are @code{v2sf} -values and @code{x} is an integral value. - -@multitable @columnfractions .50 .50 -@item C code @tab MIPS instruction -@item @code{a + b} @tab @code{add.ps} -@item @code{a - b} @tab @code{sub.ps} -@item @code{-a} @tab @code{neg.ps} -@item @code{a * b} @tab @code{mul.ps} -@item @code{a * b + c} @tab @code{madd.ps} -@item @code{a * b - c} @tab @code{msub.ps} -@item @code{-(a * b + c)} @tab @code{nmadd.ps} -@item @code{-(a * b - c)} @tab @code{nmsub.ps} -@item @code{x ? a : b} @tab @code{movn.ps}/@code{movz.ps} -@end multitable - -Note that the multiply-accumulate instructions can be disabled -using the command-line option @code{-mno-fused-madd}. - -@node Paired-Single Built-in Functions -@subsubsection Paired-Single Built-in Functions - -The following paired-single functions map directly to a particular -MIPS instruction. Please refer to the architecture specification -for details on what each instruction does. - -@table @code -@item v2sf __builtin_mips_pll_ps (v2sf, v2sf) -Pair lower lower (@code{pll.ps}). - -@item v2sf __builtin_mips_pul_ps (v2sf, v2sf) -Pair upper lower (@code{pul.ps}). - -@item v2sf __builtin_mips_plu_ps (v2sf, v2sf) -Pair lower upper (@code{plu.ps}). - -@item v2sf __builtin_mips_puu_ps (v2sf, v2sf) -Pair upper upper (@code{puu.ps}). - -@item v2sf __builtin_mips_cvt_ps_s (float, float) -Convert pair to paired single (@code{cvt.ps.s}). - -@item float __builtin_mips_cvt_s_pl (v2sf) -Convert pair lower to single (@code{cvt.s.pl}). - -@item float __builtin_mips_cvt_s_pu (v2sf) -Convert pair upper to single (@code{cvt.s.pu}). - -@item v2sf __builtin_mips_abs_ps (v2sf) -Absolute value (@code{abs.ps}). - -@item v2sf __builtin_mips_alnv_ps (v2sf, v2sf, int) -Align variable (@code{alnv.ps}). - -@emph{Note:} The value of the third parameter must be 0 or 4 -modulo 8, otherwise the result is unpredictable. Please read the -instruction description for details. -@end table - -The following multi-instruction functions are also available. -In each case, @var{cond} can be any of the 16 floating-point conditions: -@code{f}, @code{un}, @code{eq}, @code{ueq}, @code{olt}, @code{ult}, -@code{ole}, @code{ule}, @code{sf}, @code{ngle}, @code{seq}, @code{ngl}, -@code{lt}, @code{nge}, @code{le} or @code{ngt}. - -@table @code -@item v2sf __builtin_mips_movt_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -@itemx v2sf __builtin_mips_movf_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -Conditional move based on floating-point comparison (@code{c.@var{cond}.ps}, -@code{movt.ps}/@code{movf.ps}). - -The @code{movt} functions return the value @var{x} computed by: - -@smallexample -c.@var{cond}.ps @var{cc},@var{a},@var{b} -mov.ps @var{x},@var{c} -movt.ps @var{x},@var{d},@var{cc} -@end smallexample - -The @code{movf} functions are similar but use @code{movf.ps} instead -of @code{movt.ps}. - -@item int __builtin_mips_upper_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -@itemx int __builtin_mips_lower_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -Comparison of two paired-single values (@code{c.@var{cond}.ps}, -@code{bc1t}/@code{bc1f}). - -These functions compare @var{a} and @var{b} using @code{c.@var{cond}.ps} -and return either the upper or lower half of the result. For example: - -@smallexample -v2sf a, b; -if (__builtin_mips_upper_c_eq_ps (a, b)) - upper_halves_are_equal (); -else - upper_halves_are_unequal (); - -if (__builtin_mips_lower_c_eq_ps (a, b)) - lower_halves_are_equal (); -else - lower_halves_are_unequal (); -@end smallexample -@end table - -@node MIPS-3D Built-in Functions -@subsubsection MIPS-3D Built-in Functions - -The MIPS-3D Application-Specific Extension (ASE) includes additional -paired-single instructions that are designed to improve the performance -of 3D graphics operations. Support for these instructions is controlled -by the @option{-mips3d} command-line option. - -The functions listed below map directly to a particular MIPS-3D -instruction. Please refer to the architecture specification for -more details on what each instruction does. - -@table @code -@item v2sf __builtin_mips_addr_ps (v2sf, v2sf) -Reduction add (@code{addr.ps}). - -@item v2sf __builtin_mips_mulr_ps (v2sf, v2sf) -Reduction multiply (@code{mulr.ps}). - -@item v2sf __builtin_mips_cvt_pw_ps (v2sf) -Convert paired single to paired word (@code{cvt.pw.ps}). - -@item v2sf __builtin_mips_cvt_ps_pw (v2sf) -Convert paired word to paired single (@code{cvt.ps.pw}). - -@item float __builtin_mips_recip1_s (float) -@itemx double __builtin_mips_recip1_d (double) -@itemx v2sf __builtin_mips_recip1_ps (v2sf) -Reduced-precision reciprocal (sequence step 1) (@code{recip1.@var{fmt}}). - -@item float __builtin_mips_recip2_s (float, float) -@itemx double __builtin_mips_recip2_d (double, double) -@itemx v2sf __builtin_mips_recip2_ps (v2sf, v2sf) -Reduced-precision reciprocal (sequence step 2) (@code{recip2.@var{fmt}}). - -@item float __builtin_mips_rsqrt1_s (float) -@itemx double __builtin_mips_rsqrt1_d (double) -@itemx v2sf __builtin_mips_rsqrt1_ps (v2sf) -Reduced-precision reciprocal square root (sequence step 1) -(@code{rsqrt1.@var{fmt}}). - -@item float __builtin_mips_rsqrt2_s (float, float) -@itemx double __builtin_mips_rsqrt2_d (double, double) -@itemx v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf) -Reduced-precision reciprocal square root (sequence step 2) -(@code{rsqrt2.@var{fmt}}). -@end table - -The following multi-instruction functions are also available. -In each case, @var{cond} can be any of the 16 floating-point conditions: -@code{f}, @code{un}, @code{eq}, @code{ueq}, @code{olt}, @code{ult}, -@code{ole}, @code{ule}, @code{sf}, @code{ngle}, @code{seq}, -@code{ngl}, @code{lt}, @code{nge}, @code{le} or @code{ngt}. - -@table @code -@item int __builtin_mips_cabs_@var{cond}_s (float @var{a}, float @var{b}) -@itemx int __builtin_mips_cabs_@var{cond}_d (double @var{a}, double @var{b}) -Absolute comparison of two scalar values (@code{cabs.@var{cond}.@var{fmt}}, -@code{bc1t}/@code{bc1f}). - -These functions compare @var{a} and @var{b} using @code{cabs.@var{cond}.s} -or @code{cabs.@var{cond}.d} and return the result as a boolean value. -For example: - -@smallexample -float a, b; -if (__builtin_mips_cabs_eq_s (a, b)) - true (); -else - false (); -@end smallexample - -@item int __builtin_mips_upper_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -@itemx int __builtin_mips_lower_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -Absolute comparison of two paired-single values (@code{cabs.@var{cond}.ps}, -@code{bc1t}/@code{bc1f}). - -These functions compare @var{a} and @var{b} using @code{cabs.@var{cond}.ps} -and return either the upper or lower half of the result. For example: - -@smallexample -v2sf a, b; -if (__builtin_mips_upper_cabs_eq_ps (a, b)) - upper_halves_are_equal (); -else - upper_halves_are_unequal (); - -if (__builtin_mips_lower_cabs_eq_ps (a, b)) - lower_halves_are_equal (); -else - lower_halves_are_unequal (); -@end smallexample - -@item v2sf __builtin_mips_movt_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -@itemx v2sf __builtin_mips_movf_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -Conditional move based on absolute comparison (@code{cabs.@var{cond}.ps}, -@code{movt.ps}/@code{movf.ps}). - -The @code{movt} functions return the value @var{x} computed by: - -@smallexample -cabs.@var{cond}.ps @var{cc},@var{a},@var{b} -mov.ps @var{x},@var{c} -movt.ps @var{x},@var{d},@var{cc} -@end smallexample - -The @code{movf} functions are similar but use @code{movf.ps} instead -of @code{movt.ps}. - -@item int __builtin_mips_any_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -@itemx int __builtin_mips_all_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -@itemx int __builtin_mips_any_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -@itemx int __builtin_mips_all_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}) -Comparison of two paired-single values -(@code{c.@var{cond}.ps}/@code{cabs.@var{cond}.ps}, -@code{bc1any2t}/@code{bc1any2f}). - -These functions compare @var{a} and @var{b} using @code{c.@var{cond}.ps} -or @code{cabs.@var{cond}.ps}. The @code{any} forms return true if either -result is true and the @code{all} forms return true if both results are true. -For example: - -@smallexample -v2sf a, b; -if (__builtin_mips_any_c_eq_ps (a, b)) - one_is_true (); -else - both_are_false (); - -if (__builtin_mips_all_c_eq_ps (a, b)) - both_are_true (); -else - one_is_false (); -@end smallexample - -@item int __builtin_mips_any_c_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -@itemx int __builtin_mips_all_c_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -@itemx int __builtin_mips_any_cabs_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -@itemx int __builtin_mips_all_cabs_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d}) -Comparison of four paired-single values -(@code{c.@var{cond}.ps}/@code{cabs.@var{cond}.ps}, -@code{bc1any4t}/@code{bc1any4f}). - -These functions use @code{c.@var{cond}.ps} or @code{cabs.@var{cond}.ps} -to compare @var{a} with @var{b} and to compare @var{c} with @var{d}. -The @code{any} forms return true if any of the four results are true -and the @code{all} forms return true if all four results are true. -For example: - -@smallexample -v2sf a, b, c, d; -if (__builtin_mips_any_c_eq_4s (a, b, c, d)) - some_are_true (); -else - all_are_false (); - -if (__builtin_mips_all_c_eq_4s (a, b, c, d)) - all_are_true (); -else - some_are_false (); -@end smallexample -@end table - -@node Other MIPS Built-in Functions -@subsection Other MIPS Built-in Functions - -GCC provides other MIPS-specific built-in functions: - -@table @code -@item void __builtin_mips_cache (int @var{op}, const volatile void *@var{addr}) -Insert a @samp{cache} instruction with operands @var{op} and @var{addr}. -GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE} -when this function is available. - -@item unsigned int __builtin_mips_get_fcsr (void) -@itemx void __builtin_mips_set_fcsr (unsigned int @var{value}) -Get and set the contents of the floating-point control and status register -(FPU control register 31). These functions are only available in hard-float -code but can be called in both MIPS16 and non-MIPS16 contexts. - -@code{__builtin_mips_set_fcsr} can be used to change any bit of the -register except the condition codes, which GCC assumes are preserved. -@end table - -@node MSP430 Built-in Functions -@subsection MSP430 Built-in Functions - -GCC provides a couple of special builtin functions to aid in the -writing of interrupt handlers in C. - -@table @code -@item __bic_SR_register_on_exit (int @var{mask}) -This clears the indicated bits in the saved copy of the status register -currently residing on the stack. This only works inside interrupt -handlers and the changes to the status register will only take affect -once the handler returns. - -@item __bis_SR_register_on_exit (int @var{mask}) -This sets the indicated bits in the saved copy of the status register -currently residing on the stack. This only works inside interrupt -handlers and the changes to the status register will only take affect -once the handler returns. - -@item __delay_cycles (long long @var{cycles}) -This inserts an instruction sequence that takes exactly @var{cycles} -cycles (between 0 and about 17E9) to complete. The inserted sequence -may use jumps, loops, or no-ops, and does not interfere with any other -instructions. Note that @var{cycles} must be a compile-time constant -integer - that is, you must pass a number, not a variable that may be -optimized to a constant later. The number of cycles delayed by this -builtin is exact. -@end table - -@node NDS32 Built-in Functions -@subsection NDS32 Built-in Functions - -These built-in functions are available for the NDS32 target: - -@deftypefn {Built-in Function} void __builtin_nds32_isync (int *@var{addr}) -Insert an ISYNC instruction into the instruction stream where -@var{addr} is an instruction address for serialization. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_nds32_isb (void) -Insert an ISB instruction into the instruction stream. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_nds32_mfsr (int @var{sr}) -Return the content of a system register which is mapped by @var{sr}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_nds32_mfusr (int @var{usr}) -Return the content of a user space register which is mapped by @var{usr}. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_nds32_mtsr (int @var{value}, int @var{sr}) -Move the @var{value} to a system register which is mapped by @var{sr}. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_nds32_mtusr (int @var{value}, int @var{usr}) -Move the @var{value} to a user space register which is mapped by @var{usr}. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_nds32_setgie_en (void) -Enable global interrupt. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_nds32_setgie_dis (void) -Disable global interrupt. -@end deftypefn - -@node picoChip Built-in Functions -@subsection picoChip Built-in Functions - -GCC provides an interface to selected machine instructions from the -picoChip instruction set. - -@table @code -@item int __builtin_sbc (int @var{value}) -Sign bit count. Return the number of consecutive bits in @var{value} -that have the same value as the sign bit. The result is the number of -leading sign bits minus one, giving the number of redundant sign bits in -@var{value}. - -@item int __builtin_byteswap (int @var{value}) -Byte swap. Return the result of swapping the upper and lower bytes of -@var{value}. - -@item int __builtin_brev (int @var{value}) -Bit reversal. Return the result of reversing the bits in -@var{value}. Bit 15 is swapped with bit 0, bit 14 is swapped with bit 1, -and so on. - -@item int __builtin_adds (int @var{x}, int @var{y}) -Saturating addition. Return the result of adding @var{x} and @var{y}, -storing the value 32767 if the result overflows. - -@item int __builtin_subs (int @var{x}, int @var{y}) -Saturating subtraction. Return the result of subtracting @var{y} from -@var{x}, storing the value @minus{}32768 if the result overflows. - -@item void __builtin_halt (void) -Halt. The processor stops execution. This built-in is useful for -implementing assertions. - -@end table - -@node PowerPC Built-in Functions -@subsection PowerPC Built-in Functions - -These built-in functions are available for the PowerPC family of -processors: -@smallexample -float __builtin_recipdivf (float, float); -float __builtin_rsqrtf (float); -double __builtin_recipdiv (double, double); -double __builtin_rsqrt (double); -uint64_t __builtin_ppc_get_timebase (); -unsigned long __builtin_ppc_mftb (); -double __builtin_unpack_longdouble (long double, int); -long double __builtin_pack_longdouble (double, double); -@end smallexample - -The @code{vec_rsqrt}, @code{__builtin_rsqrt}, and -@code{__builtin_rsqrtf} functions generate multiple instructions to -implement the reciprocal sqrt functionality using reciprocal sqrt -estimate instructions. - -The @code{__builtin_recipdiv}, and @code{__builtin_recipdivf} -functions generate multiple instructions to implement division using -the reciprocal estimate instructions. - -The @code{__builtin_ppc_get_timebase} and @code{__builtin_ppc_mftb} -functions generate instructions to read the Time Base Register. The -@code{__builtin_ppc_get_timebase} function may generate multiple -instructions and always returns the 64 bits of the Time Base Register. -The @code{__builtin_ppc_mftb} function always generates one instruction and -returns the Time Base Register value as an unsigned long, throwing away -the most significant word on 32-bit environments. - -The following built-in functions are available for the PowerPC family -of processors, starting with ISA 2.06 or later (@option{-mcpu=power7} -or @option{-mpopcntd}): -@smallexample -long __builtin_bpermd (long, long); -int __builtin_divwe (int, int); -int __builtin_divweo (int, int); -unsigned int __builtin_divweu (unsigned int, unsigned int); -unsigned int __builtin_divweuo (unsigned int, unsigned int); -long __builtin_divde (long, long); -long __builtin_divdeo (long, long); -unsigned long __builtin_divdeu (unsigned long, unsigned long); -unsigned long __builtin_divdeuo (unsigned long, unsigned long); -unsigned int cdtbcd (unsigned int); -unsigned int cbcdtd (unsigned int); -unsigned int addg6s (unsigned int, unsigned int); -@end smallexample - -The @code{__builtin_divde}, @code{__builtin_divdeo}, -@code{__builtin_divdeu}, @code{__builtin_divdeou} functions require a -64-bit environment support ISA 2.06 or later. - -The following built-in functions are available for the PowerPC family -of processors when hardware decimal floating point -(@option{-mhard-dfp}) is available: -@smallexample -_Decimal64 __builtin_dxex (_Decimal64); -_Decimal128 __builtin_dxexq (_Decimal128); -_Decimal64 __builtin_ddedpd (int, _Decimal64); -_Decimal128 __builtin_ddedpdq (int, _Decimal128); -_Decimal64 __builtin_denbcd (int, _Decimal64); -_Decimal128 __builtin_denbcdq (int, _Decimal128); -_Decimal64 __builtin_diex (_Decimal64, _Decimal64); -_Decimal128 _builtin_diexq (_Decimal128, _Decimal128); -_Decimal64 __builtin_dscli (_Decimal64, int); -_Decimal128 __builtin_dscliq (_Decimal128, int); -_Decimal64 __builtin_dscri (_Decimal64, int); -_Decimal128 __builtin_dscriq (_Decimal128, int); -unsigned long long __builtin_unpack_dec128 (_Decimal128, int); -_Decimal128 __builtin_pack_dec128 (unsigned long long, unsigned long long); -@end smallexample - -The following built-in functions are available for the PowerPC family -of processors when the Vector Scalar (vsx) instruction set is -available: -@smallexample -unsigned long long __builtin_unpack_vector_int128 (vector __int128_t, int); -vector __int128_t __builtin_pack_vector_int128 (unsigned long long, - unsigned long long); -@end smallexample - -@node PowerPC AltiVec/VSX Built-in Functions -@subsection PowerPC AltiVec Built-in Functions - -GCC provides an interface for the PowerPC family of processors to access -the AltiVec operations described in Motorola's AltiVec Programming -Interface Manual. The interface is made available by including -@code{} and using @option{-maltivec} and -@option{-mabi=altivec}. The interface supports the following vector -types. - -@smallexample -vector unsigned char -vector signed char -vector bool char - -vector unsigned short -vector signed short -vector bool short -vector pixel - -vector unsigned int -vector signed int -vector bool int -vector float -@end smallexample - -If @option{-mvsx} is used the following additional vector types are -implemented. - -@smallexample -vector unsigned long -vector signed long -vector double -@end smallexample - -The long types are only implemented for 64-bit code generation, and -the long type is only used in the floating point/integer conversion -instructions. - -GCC's implementation of the high-level language interface available from -C and C++ code differs from Motorola's documentation in several ways. - -@itemize @bullet - -@item -A vector constant is a list of constant expressions within curly braces. - -@item -A vector initializer requires no cast if the vector constant is of the -same type as the variable it is initializing. - -@item -If @code{signed} or @code{unsigned} is omitted, the signedness of the -vector type is the default signedness of the base type. The default -varies depending on the operating system, so a portable program should -always specify the signedness. - -@item -Compiling with @option{-maltivec} adds keywords @code{__vector}, -@code{vector}, @code{__pixel}, @code{pixel}, @code{__bool} and -@code{bool}. When compiling ISO C, the context-sensitive substitution -of the keywords @code{vector}, @code{pixel} and @code{bool} is -disabled. To use them, you must include @code{} instead. - -@item -GCC allows using a @code{typedef} name as the type specifier for a -vector type. - -@item -For C, overloaded functions are implemented with macros so the following -does not work: - -@smallexample - vec_add ((vector signed int)@{1, 2, 3, 4@}, foo); -@end smallexample - -@noindent -Since @code{vec_add} is a macro, the vector constant in the example -is treated as four separate arguments. Wrap the entire argument in -parentheses for this to work. -@end itemize - -@emph{Note:} Only the @code{} interface is supported. -Internally, GCC uses built-in functions to achieve the functionality in -the aforementioned header file, but they are not supported and are -subject to change without notice. - -The following interfaces are supported for the generic and specific -AltiVec operations and the AltiVec predicates. In cases where there -is a direct mapping between generic and specific operations, only the -generic names are shown here, although the specific operations can also -be used. - -Arguments that are documented as @code{const int} require literal -integral values within the range required for that operation. - -@smallexample -vector signed char vec_abs (vector signed char); -vector signed short vec_abs (vector signed short); -vector signed int vec_abs (vector signed int); -vector float vec_abs (vector float); - -vector signed char vec_abss (vector signed char); -vector signed short vec_abss (vector signed short); -vector signed int vec_abss (vector signed int); - -vector signed char vec_add (vector bool char, vector signed char); -vector signed char vec_add (vector signed char, vector bool char); -vector signed char vec_add (vector signed char, vector signed char); -vector unsigned char vec_add (vector bool char, vector unsigned char); -vector unsigned char vec_add (vector unsigned char, vector bool char); -vector unsigned char vec_add (vector unsigned char, - vector unsigned char); -vector signed short vec_add (vector bool short, vector signed short); -vector signed short vec_add (vector signed short, vector bool short); -vector signed short vec_add (vector signed short, vector signed short); -vector unsigned short vec_add (vector bool short, - vector unsigned short); -vector unsigned short vec_add (vector unsigned short, - vector bool short); -vector unsigned short vec_add (vector unsigned short, - vector unsigned short); -vector signed int vec_add (vector bool int, vector signed int); -vector signed int vec_add (vector signed int, vector bool int); -vector signed int vec_add (vector signed int, vector signed int); -vector unsigned int vec_add (vector bool int, vector unsigned int); -vector unsigned int vec_add (vector unsigned int, vector bool int); -vector unsigned int vec_add (vector unsigned int, vector unsigned int); -vector float vec_add (vector float, vector float); - -vector float vec_vaddfp (vector float, vector float); - -vector signed int vec_vadduwm (vector bool int, vector signed int); -vector signed int vec_vadduwm (vector signed int, vector bool int); -vector signed int vec_vadduwm (vector signed int, vector signed int); -vector unsigned int vec_vadduwm (vector bool int, vector unsigned int); -vector unsigned int vec_vadduwm (vector unsigned int, vector bool int); -vector unsigned int vec_vadduwm (vector unsigned int, - vector unsigned int); - -vector signed short vec_vadduhm (vector bool short, - vector signed short); -vector signed short vec_vadduhm (vector signed short, - vector bool short); -vector signed short vec_vadduhm (vector signed short, - vector signed short); -vector unsigned short vec_vadduhm (vector bool short, - vector unsigned short); -vector unsigned short vec_vadduhm (vector unsigned short, - vector bool short); -vector unsigned short vec_vadduhm (vector unsigned short, - vector unsigned short); - -vector signed char vec_vaddubm (vector bool char, vector signed char); -vector signed char vec_vaddubm (vector signed char, vector bool char); -vector signed char vec_vaddubm (vector signed char, vector signed char); -vector unsigned char vec_vaddubm (vector bool char, - vector unsigned char); -vector unsigned char vec_vaddubm (vector unsigned char, - vector bool char); -vector unsigned char vec_vaddubm (vector unsigned char, - vector unsigned char); - -vector unsigned int vec_addc (vector unsigned int, vector unsigned int); - -vector unsigned char vec_adds (vector bool char, vector unsigned char); -vector unsigned char vec_adds (vector unsigned char, vector bool char); -vector unsigned char vec_adds (vector unsigned char, - vector unsigned char); -vector signed char vec_adds (vector bool char, vector signed char); -vector signed char vec_adds (vector signed char, vector bool char); -vector signed char vec_adds (vector signed char, vector signed char); -vector unsigned short vec_adds (vector bool short, - vector unsigned short); -vector unsigned short vec_adds (vector unsigned short, - vector bool short); -vector unsigned short vec_adds (vector unsigned short, - vector unsigned short); -vector signed short vec_adds (vector bool short, vector signed short); -vector signed short vec_adds (vector signed short, vector bool short); -vector signed short vec_adds (vector signed short, vector signed short); -vector unsigned int vec_adds (vector bool int, vector unsigned int); -vector unsigned int vec_adds (vector unsigned int, vector bool int); -vector unsigned int vec_adds (vector unsigned int, vector unsigned int); -vector signed int vec_adds (vector bool int, vector signed int); -vector signed int vec_adds (vector signed int, vector bool int); -vector signed int vec_adds (vector signed int, vector signed int); - -vector signed int vec_vaddsws (vector bool int, vector signed int); -vector signed int vec_vaddsws (vector signed int, vector bool int); -vector signed int vec_vaddsws (vector signed int, vector signed int); - -vector unsigned int vec_vadduws (vector bool int, vector unsigned int); -vector unsigned int vec_vadduws (vector unsigned int, vector bool int); -vector unsigned int vec_vadduws (vector unsigned int, - vector unsigned int); - -vector signed short vec_vaddshs (vector bool short, - vector signed short); -vector signed short vec_vaddshs (vector signed short, - vector bool short); -vector signed short vec_vaddshs (vector signed short, - vector signed short); - -vector unsigned short vec_vadduhs (vector bool short, - vector unsigned short); -vector unsigned short vec_vadduhs (vector unsigned short, - vector bool short); -vector unsigned short vec_vadduhs (vector unsigned short, - vector unsigned short); - -vector signed char vec_vaddsbs (vector bool char, vector signed char); -vector signed char vec_vaddsbs (vector signed char, vector bool char); -vector signed char vec_vaddsbs (vector signed char, vector signed char); - -vector unsigned char vec_vaddubs (vector bool char, - vector unsigned char); -vector unsigned char vec_vaddubs (vector unsigned char, - vector bool char); -vector unsigned char vec_vaddubs (vector unsigned char, - vector unsigned char); - -vector float vec_and (vector float, vector float); -vector float vec_and (vector float, vector bool int); -vector float vec_and (vector bool int, vector float); -vector bool int vec_and (vector bool int, vector bool int); -vector signed int vec_and (vector bool int, vector signed int); -vector signed int vec_and (vector signed int, vector bool int); -vector signed int vec_and (vector signed int, vector signed int); -vector unsigned int vec_and (vector bool int, vector unsigned int); -vector unsigned int vec_and (vector unsigned int, vector bool int); -vector unsigned int vec_and (vector unsigned int, vector unsigned int); -vector bool short vec_and (vector bool short, vector bool short); -vector signed short vec_and (vector bool short, vector signed short); -vector signed short vec_and (vector signed short, vector bool short); -vector signed short vec_and (vector signed short, vector signed short); -vector unsigned short vec_and (vector bool short, - vector unsigned short); -vector unsigned short vec_and (vector unsigned short, - vector bool short); -vector unsigned short vec_and (vector unsigned short, - vector unsigned short); -vector signed char vec_and (vector bool char, vector signed char); -vector bool char vec_and (vector bool char, vector bool char); -vector signed char vec_and (vector signed char, vector bool char); -vector signed char vec_and (vector signed char, vector signed char); -vector unsigned char vec_and (vector bool char, vector unsigned char); -vector unsigned char vec_and (vector unsigned char, vector bool char); -vector unsigned char vec_and (vector unsigned char, - vector unsigned char); - -vector float vec_andc (vector float, vector float); -vector float vec_andc (vector float, vector bool int); -vector float vec_andc (vector bool int, vector float); -vector bool int vec_andc (vector bool int, vector bool int); -vector signed int vec_andc (vector bool int, vector signed int); -vector signed int vec_andc (vector signed int, vector bool int); -vector signed int vec_andc (vector signed int, vector signed int); -vector unsigned int vec_andc (vector bool int, vector unsigned int); -vector unsigned int vec_andc (vector unsigned int, vector bool int); -vector unsigned int vec_andc (vector unsigned int, vector unsigned int); -vector bool short vec_andc (vector bool short, vector bool short); -vector signed short vec_andc (vector bool short, vector signed short); -vector signed short vec_andc (vector signed short, vector bool short); -vector signed short vec_andc (vector signed short, vector signed short); -vector unsigned short vec_andc (vector bool short, - vector unsigned short); -vector unsigned short vec_andc (vector unsigned short, - vector bool short); -vector unsigned short vec_andc (vector unsigned short, - vector unsigned short); -vector signed char vec_andc (vector bool char, vector signed char); -vector bool char vec_andc (vector bool char, vector bool char); -vector signed char vec_andc (vector signed char, vector bool char); -vector signed char vec_andc (vector signed char, vector signed char); -vector unsigned char vec_andc (vector bool char, vector unsigned char); -vector unsigned char vec_andc (vector unsigned char, vector bool char); -vector unsigned char vec_andc (vector unsigned char, - vector unsigned char); - -vector unsigned char vec_avg (vector unsigned char, - vector unsigned char); -vector signed char vec_avg (vector signed char, vector signed char); -vector unsigned short vec_avg (vector unsigned short, - vector unsigned short); -vector signed short vec_avg (vector signed short, vector signed short); -vector unsigned int vec_avg (vector unsigned int, vector unsigned int); -vector signed int vec_avg (vector signed int, vector signed int); - -vector signed int vec_vavgsw (vector signed int, vector signed int); - -vector unsigned int vec_vavguw (vector unsigned int, - vector unsigned int); - -vector signed short vec_vavgsh (vector signed short, - vector signed short); - -vector unsigned short vec_vavguh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vavgsb (vector signed char, vector signed char); - -vector unsigned char vec_vavgub (vector unsigned char, - vector unsigned char); - -vector float vec_copysign (vector float); - -vector float vec_ceil (vector float); - -vector signed int vec_cmpb (vector float, vector float); - -vector bool char vec_cmpeq (vector signed char, vector signed char); -vector bool char vec_cmpeq (vector unsigned char, vector unsigned char); -vector bool short vec_cmpeq (vector signed short, vector signed short); -vector bool short vec_cmpeq (vector unsigned short, - vector unsigned short); -vector bool int vec_cmpeq (vector signed int, vector signed int); -vector bool int vec_cmpeq (vector unsigned int, vector unsigned int); -vector bool int vec_cmpeq (vector float, vector float); - -vector bool int vec_vcmpeqfp (vector float, vector float); - -vector bool int vec_vcmpequw (vector signed int, vector signed int); -vector bool int vec_vcmpequw (vector unsigned int, vector unsigned int); - -vector bool short vec_vcmpequh (vector signed short, - vector signed short); -vector bool short vec_vcmpequh (vector unsigned short, - vector unsigned short); - -vector bool char vec_vcmpequb (vector signed char, vector signed char); -vector bool char vec_vcmpequb (vector unsigned char, - vector unsigned char); - -vector bool int vec_cmpge (vector float, vector float); - -vector bool char vec_cmpgt (vector unsigned char, vector unsigned char); -vector bool char vec_cmpgt (vector signed char, vector signed char); -vector bool short vec_cmpgt (vector unsigned short, - vector unsigned short); -vector bool short vec_cmpgt (vector signed short, vector signed short); -vector bool int vec_cmpgt (vector unsigned int, vector unsigned int); -vector bool int vec_cmpgt (vector signed int, vector signed int); -vector bool int vec_cmpgt (vector float, vector float); - -vector bool int vec_vcmpgtfp (vector float, vector float); - -vector bool int vec_vcmpgtsw (vector signed int, vector signed int); - -vector bool int vec_vcmpgtuw (vector unsigned int, vector unsigned int); - -vector bool short vec_vcmpgtsh (vector signed short, - vector signed short); - -vector bool short vec_vcmpgtuh (vector unsigned short, - vector unsigned short); - -vector bool char vec_vcmpgtsb (vector signed char, vector signed char); - -vector bool char vec_vcmpgtub (vector unsigned char, - vector unsigned char); - -vector bool int vec_cmple (vector float, vector float); - -vector bool char vec_cmplt (vector unsigned char, vector unsigned char); -vector bool char vec_cmplt (vector signed char, vector signed char); -vector bool short vec_cmplt (vector unsigned short, - vector unsigned short); -vector bool short vec_cmplt (vector signed short, vector signed short); -vector bool int vec_cmplt (vector unsigned int, vector unsigned int); -vector bool int vec_cmplt (vector signed int, vector signed int); -vector bool int vec_cmplt (vector float, vector float); - -vector float vec_cpsgn (vector float, vector float); - -vector float vec_ctf (vector unsigned int, const int); -vector float vec_ctf (vector signed int, const int); -vector double vec_ctf (vector unsigned long, const int); -vector double vec_ctf (vector signed long, const int); - -vector float vec_vcfsx (vector signed int, const int); - -vector float vec_vcfux (vector unsigned int, const int); - -vector signed int vec_cts (vector float, const int); -vector signed long vec_cts (vector double, const int); - -vector unsigned int vec_ctu (vector float, const int); -vector unsigned long vec_ctu (vector double, const int); - -void vec_dss (const int); - -void vec_dssall (void); - -void vec_dst (const vector unsigned char *, int, const int); -void vec_dst (const vector signed char *, int, const int); -void vec_dst (const vector bool char *, int, const int); -void vec_dst (const vector unsigned short *, int, const int); -void vec_dst (const vector signed short *, int, const int); -void vec_dst (const vector bool short *, int, const int); -void vec_dst (const vector pixel *, int, const int); -void vec_dst (const vector unsigned int *, int, const int); -void vec_dst (const vector signed int *, int, const int); -void vec_dst (const vector bool int *, int, const int); -void vec_dst (const vector float *, int, const int); -void vec_dst (const unsigned char *, int, const int); -void vec_dst (const signed char *, int, const int); -void vec_dst (const unsigned short *, int, const int); -void vec_dst (const short *, int, const int); -void vec_dst (const unsigned int *, int, const int); -void vec_dst (const int *, int, const int); -void vec_dst (const unsigned long *, int, const int); -void vec_dst (const long *, int, const int); -void vec_dst (const float *, int, const int); - -void vec_dstst (const vector unsigned char *, int, const int); -void vec_dstst (const vector signed char *, int, const int); -void vec_dstst (const vector bool char *, int, const int); -void vec_dstst (const vector unsigned short *, int, const int); -void vec_dstst (const vector signed short *, int, const int); -void vec_dstst (const vector bool short *, int, const int); -void vec_dstst (const vector pixel *, int, const int); -void vec_dstst (const vector unsigned int *, int, const int); -void vec_dstst (const vector signed int *, int, const int); -void vec_dstst (const vector bool int *, int, const int); -void vec_dstst (const vector float *, int, const int); -void vec_dstst (const unsigned char *, int, const int); -void vec_dstst (const signed char *, int, const int); -void vec_dstst (const unsigned short *, int, const int); -void vec_dstst (const short *, int, const int); -void vec_dstst (const unsigned int *, int, const int); -void vec_dstst (const int *, int, const int); -void vec_dstst (const unsigned long *, int, const int); -void vec_dstst (const long *, int, const int); -void vec_dstst (const float *, int, const int); - -void vec_dststt (const vector unsigned char *, int, const int); -void vec_dststt (const vector signed char *, int, const int); -void vec_dststt (const vector bool char *, int, const int); -void vec_dststt (const vector unsigned short *, int, const int); -void vec_dststt (const vector signed short *, int, const int); -void vec_dststt (const vector bool short *, int, const int); -void vec_dststt (const vector pixel *, int, const int); -void vec_dststt (const vector unsigned int *, int, const int); -void vec_dststt (const vector signed int *, int, const int); -void vec_dststt (const vector bool int *, int, const int); -void vec_dststt (const vector float *, int, const int); -void vec_dststt (const unsigned char *, int, const int); -void vec_dststt (const signed char *, int, const int); -void vec_dststt (const unsigned short *, int, const int); -void vec_dststt (const short *, int, const int); -void vec_dststt (const unsigned int *, int, const int); -void vec_dststt (const int *, int, const int); -void vec_dststt (const unsigned long *, int, const int); -void vec_dststt (const long *, int, const int); -void vec_dststt (const float *, int, const int); - -void vec_dstt (const vector unsigned char *, int, const int); -void vec_dstt (const vector signed char *, int, const int); -void vec_dstt (const vector bool char *, int, const int); -void vec_dstt (const vector unsigned short *, int, const int); -void vec_dstt (const vector signed short *, int, const int); -void vec_dstt (const vector bool short *, int, const int); -void vec_dstt (const vector pixel *, int, const int); -void vec_dstt (const vector unsigned int *, int, const int); -void vec_dstt (const vector signed int *, int, const int); -void vec_dstt (const vector bool int *, int, const int); -void vec_dstt (const vector float *, int, const int); -void vec_dstt (const unsigned char *, int, const int); -void vec_dstt (const signed char *, int, const int); -void vec_dstt (const unsigned short *, int, const int); -void vec_dstt (const short *, int, const int); -void vec_dstt (const unsigned int *, int, const int); -void vec_dstt (const int *, int, const int); -void vec_dstt (const unsigned long *, int, const int); -void vec_dstt (const long *, int, const int); -void vec_dstt (const float *, int, const int); - -vector float vec_expte (vector float); - -vector float vec_floor (vector float); - -vector float vec_ld (int, const vector float *); -vector float vec_ld (int, const float *); -vector bool int vec_ld (int, const vector bool int *); -vector signed int vec_ld (int, const vector signed int *); -vector signed int vec_ld (int, const int *); -vector signed int vec_ld (int, const long *); -vector unsigned int vec_ld (int, const vector unsigned int *); -vector unsigned int vec_ld (int, const unsigned int *); -vector unsigned int vec_ld (int, const unsigned long *); -vector bool short vec_ld (int, const vector bool short *); -vector pixel vec_ld (int, const vector pixel *); -vector signed short vec_ld (int, const vector signed short *); -vector signed short vec_ld (int, const short *); -vector unsigned short vec_ld (int, const vector unsigned short *); -vector unsigned short vec_ld (int, const unsigned short *); -vector bool char vec_ld (int, const vector bool char *); -vector signed char vec_ld (int, const vector signed char *); -vector signed char vec_ld (int, const signed char *); -vector unsigned char vec_ld (int, const vector unsigned char *); -vector unsigned char vec_ld (int, const unsigned char *); - -vector signed char vec_lde (int, const signed char *); -vector unsigned char vec_lde (int, const unsigned char *); -vector signed short vec_lde (int, const short *); -vector unsigned short vec_lde (int, const unsigned short *); -vector float vec_lde (int, const float *); -vector signed int vec_lde (int, const int *); -vector unsigned int vec_lde (int, const unsigned int *); -vector signed int vec_lde (int, const long *); -vector unsigned int vec_lde (int, const unsigned long *); - -vector float vec_lvewx (int, float *); -vector signed int vec_lvewx (int, int *); -vector unsigned int vec_lvewx (int, unsigned int *); -vector signed int vec_lvewx (int, long *); -vector unsigned int vec_lvewx (int, unsigned long *); - -vector signed short vec_lvehx (int, short *); -vector unsigned short vec_lvehx (int, unsigned short *); - -vector signed char vec_lvebx (int, char *); -vector unsigned char vec_lvebx (int, unsigned char *); - -vector float vec_ldl (int, const vector float *); -vector float vec_ldl (int, const float *); -vector bool int vec_ldl (int, const vector bool int *); -vector signed int vec_ldl (int, const vector signed int *); -vector signed int vec_ldl (int, const int *); -vector signed int vec_ldl (int, const long *); -vector unsigned int vec_ldl (int, const vector unsigned int *); -vector unsigned int vec_ldl (int, const unsigned int *); -vector unsigned int vec_ldl (int, const unsigned long *); -vector bool short vec_ldl (int, const vector bool short *); -vector pixel vec_ldl (int, const vector pixel *); -vector signed short vec_ldl (int, const vector signed short *); -vector signed short vec_ldl (int, const short *); -vector unsigned short vec_ldl (int, const vector unsigned short *); -vector unsigned short vec_ldl (int, const unsigned short *); -vector bool char vec_ldl (int, const vector bool char *); -vector signed char vec_ldl (int, const vector signed char *); -vector signed char vec_ldl (int, const signed char *); -vector unsigned char vec_ldl (int, const vector unsigned char *); -vector unsigned char vec_ldl (int, const unsigned char *); - -vector float vec_loge (vector float); - -vector unsigned char vec_lvsl (int, const volatile unsigned char *); -vector unsigned char vec_lvsl (int, const volatile signed char *); -vector unsigned char vec_lvsl (int, const volatile unsigned short *); -vector unsigned char vec_lvsl (int, const volatile short *); -vector unsigned char vec_lvsl (int, const volatile unsigned int *); -vector unsigned char vec_lvsl (int, const volatile int *); -vector unsigned char vec_lvsl (int, const volatile unsigned long *); -vector unsigned char vec_lvsl (int, const volatile long *); -vector unsigned char vec_lvsl (int, const volatile float *); - -vector unsigned char vec_lvsr (int, const volatile unsigned char *); -vector unsigned char vec_lvsr (int, const volatile signed char *); -vector unsigned char vec_lvsr (int, const volatile unsigned short *); -vector unsigned char vec_lvsr (int, const volatile short *); -vector unsigned char vec_lvsr (int, const volatile unsigned int *); -vector unsigned char vec_lvsr (int, const volatile int *); -vector unsigned char vec_lvsr (int, const volatile unsigned long *); -vector unsigned char vec_lvsr (int, const volatile long *); -vector unsigned char vec_lvsr (int, const volatile float *); - -vector float vec_madd (vector float, vector float, vector float); - -vector signed short vec_madds (vector signed short, - vector signed short, - vector signed short); - -vector unsigned char vec_max (vector bool char, vector unsigned char); -vector unsigned char vec_max (vector unsigned char, vector bool char); -vector unsigned char vec_max (vector unsigned char, - vector unsigned char); -vector signed char vec_max (vector bool char, vector signed char); -vector signed char vec_max (vector signed char, vector bool char); -vector signed char vec_max (vector signed char, vector signed char); -vector unsigned short vec_max (vector bool short, - vector unsigned short); -vector unsigned short vec_max (vector unsigned short, - vector bool short); -vector unsigned short vec_max (vector unsigned short, - vector unsigned short); -vector signed short vec_max (vector bool short, vector signed short); -vector signed short vec_max (vector signed short, vector bool short); -vector signed short vec_max (vector signed short, vector signed short); -vector unsigned int vec_max (vector bool int, vector unsigned int); -vector unsigned int vec_max (vector unsigned int, vector bool int); -vector unsigned int vec_max (vector unsigned int, vector unsigned int); -vector signed int vec_max (vector bool int, vector signed int); -vector signed int vec_max (vector signed int, vector bool int); -vector signed int vec_max (vector signed int, vector signed int); -vector float vec_max (vector float, vector float); - -vector float vec_vmaxfp (vector float, vector float); - -vector signed int vec_vmaxsw (vector bool int, vector signed int); -vector signed int vec_vmaxsw (vector signed int, vector bool int); -vector signed int vec_vmaxsw (vector signed int, vector signed int); - -vector unsigned int vec_vmaxuw (vector bool int, vector unsigned int); -vector unsigned int vec_vmaxuw (vector unsigned int, vector bool int); -vector unsigned int vec_vmaxuw (vector unsigned int, - vector unsigned int); - -vector signed short vec_vmaxsh (vector bool short, vector signed short); -vector signed short vec_vmaxsh (vector signed short, vector bool short); -vector signed short vec_vmaxsh (vector signed short, - vector signed short); - -vector unsigned short vec_vmaxuh (vector bool short, - vector unsigned short); -vector unsigned short vec_vmaxuh (vector unsigned short, - vector bool short); -vector unsigned short vec_vmaxuh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vmaxsb (vector bool char, vector signed char); -vector signed char vec_vmaxsb (vector signed char, vector bool char); -vector signed char vec_vmaxsb (vector signed char, vector signed char); - -vector unsigned char vec_vmaxub (vector bool char, - vector unsigned char); -vector unsigned char vec_vmaxub (vector unsigned char, - vector bool char); -vector unsigned char vec_vmaxub (vector unsigned char, - vector unsigned char); - -vector bool char vec_mergeh (vector bool char, vector bool char); -vector signed char vec_mergeh (vector signed char, vector signed char); -vector unsigned char vec_mergeh (vector unsigned char, - vector unsigned char); -vector bool short vec_mergeh (vector bool short, vector bool short); -vector pixel vec_mergeh (vector pixel, vector pixel); -vector signed short vec_mergeh (vector signed short, - vector signed short); -vector unsigned short vec_mergeh (vector unsigned short, - vector unsigned short); -vector float vec_mergeh (vector float, vector float); -vector bool int vec_mergeh (vector bool int, vector bool int); -vector signed int vec_mergeh (vector signed int, vector signed int); -vector unsigned int vec_mergeh (vector unsigned int, - vector unsigned int); - -vector float vec_vmrghw (vector float, vector float); -vector bool int vec_vmrghw (vector bool int, vector bool int); -vector signed int vec_vmrghw (vector signed int, vector signed int); -vector unsigned int vec_vmrghw (vector unsigned int, - vector unsigned int); - -vector bool short vec_vmrghh (vector bool short, vector bool short); -vector signed short vec_vmrghh (vector signed short, - vector signed short); -vector unsigned short vec_vmrghh (vector unsigned short, - vector unsigned short); -vector pixel vec_vmrghh (vector pixel, vector pixel); - -vector bool char vec_vmrghb (vector bool char, vector bool char); -vector signed char vec_vmrghb (vector signed char, vector signed char); -vector unsigned char vec_vmrghb (vector unsigned char, - vector unsigned char); - -vector bool char vec_mergel (vector bool char, vector bool char); -vector signed char vec_mergel (vector signed char, vector signed char); -vector unsigned char vec_mergel (vector unsigned char, - vector unsigned char); -vector bool short vec_mergel (vector bool short, vector bool short); -vector pixel vec_mergel (vector pixel, vector pixel); -vector signed short vec_mergel (vector signed short, - vector signed short); -vector unsigned short vec_mergel (vector unsigned short, - vector unsigned short); -vector float vec_mergel (vector float, vector float); -vector bool int vec_mergel (vector bool int, vector bool int); -vector signed int vec_mergel (vector signed int, vector signed int); -vector unsigned int vec_mergel (vector unsigned int, - vector unsigned int); - -vector float vec_vmrglw (vector float, vector float); -vector signed int vec_vmrglw (vector signed int, vector signed int); -vector unsigned int vec_vmrglw (vector unsigned int, - vector unsigned int); -vector bool int vec_vmrglw (vector bool int, vector bool int); - -vector bool short vec_vmrglh (vector bool short, vector bool short); -vector signed short vec_vmrglh (vector signed short, - vector signed short); -vector unsigned short vec_vmrglh (vector unsigned short, - vector unsigned short); -vector pixel vec_vmrglh (vector pixel, vector pixel); - -vector bool char vec_vmrglb (vector bool char, vector bool char); -vector signed char vec_vmrglb (vector signed char, vector signed char); -vector unsigned char vec_vmrglb (vector unsigned char, - vector unsigned char); - -vector unsigned short vec_mfvscr (void); - -vector unsigned char vec_min (vector bool char, vector unsigned char); -vector unsigned char vec_min (vector unsigned char, vector bool char); -vector unsigned char vec_min (vector unsigned char, - vector unsigned char); -vector signed char vec_min (vector bool char, vector signed char); -vector signed char vec_min (vector signed char, vector bool char); -vector signed char vec_min (vector signed char, vector signed char); -vector unsigned short vec_min (vector bool short, - vector unsigned short); -vector unsigned short vec_min (vector unsigned short, - vector bool short); -vector unsigned short vec_min (vector unsigned short, - vector unsigned short); -vector signed short vec_min (vector bool short, vector signed short); -vector signed short vec_min (vector signed short, vector bool short); -vector signed short vec_min (vector signed short, vector signed short); -vector unsigned int vec_min (vector bool int, vector unsigned int); -vector unsigned int vec_min (vector unsigned int, vector bool int); -vector unsigned int vec_min (vector unsigned int, vector unsigned int); -vector signed int vec_min (vector bool int, vector signed int); -vector signed int vec_min (vector signed int, vector bool int); -vector signed int vec_min (vector signed int, vector signed int); -vector float vec_min (vector float, vector float); - -vector float vec_vminfp (vector float, vector float); - -vector signed int vec_vminsw (vector bool int, vector signed int); -vector signed int vec_vminsw (vector signed int, vector bool int); -vector signed int vec_vminsw (vector signed int, vector signed int); - -vector unsigned int vec_vminuw (vector bool int, vector unsigned int); -vector unsigned int vec_vminuw (vector unsigned int, vector bool int); -vector unsigned int vec_vminuw (vector unsigned int, - vector unsigned int); - -vector signed short vec_vminsh (vector bool short, vector signed short); -vector signed short vec_vminsh (vector signed short, vector bool short); -vector signed short vec_vminsh (vector signed short, - vector signed short); - -vector unsigned short vec_vminuh (vector bool short, - vector unsigned short); -vector unsigned short vec_vminuh (vector unsigned short, - vector bool short); -vector unsigned short vec_vminuh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vminsb (vector bool char, vector signed char); -vector signed char vec_vminsb (vector signed char, vector bool char); -vector signed char vec_vminsb (vector signed char, vector signed char); - -vector unsigned char vec_vminub (vector bool char, - vector unsigned char); -vector unsigned char vec_vminub (vector unsigned char, - vector bool char); -vector unsigned char vec_vminub (vector unsigned char, - vector unsigned char); - -vector signed short vec_mladd (vector signed short, - vector signed short, - vector signed short); -vector signed short vec_mladd (vector signed short, - vector unsigned short, - vector unsigned short); -vector signed short vec_mladd (vector unsigned short, - vector signed short, - vector signed short); -vector unsigned short vec_mladd (vector unsigned short, - vector unsigned short, - vector unsigned short); - -vector signed short vec_mradds (vector signed short, - vector signed short, - vector signed short); - -vector unsigned int vec_msum (vector unsigned char, - vector unsigned char, - vector unsigned int); -vector signed int vec_msum (vector signed char, - vector unsigned char, - vector signed int); -vector unsigned int vec_msum (vector unsigned short, - vector unsigned short, - vector unsigned int); -vector signed int vec_msum (vector signed short, - vector signed short, - vector signed int); - -vector signed int vec_vmsumshm (vector signed short, - vector signed short, - vector signed int); - -vector unsigned int vec_vmsumuhm (vector unsigned short, - vector unsigned short, - vector unsigned int); - -vector signed int vec_vmsummbm (vector signed char, - vector unsigned char, - vector signed int); - -vector unsigned int vec_vmsumubm (vector unsigned char, - vector unsigned char, - vector unsigned int); - -vector unsigned int vec_msums (vector unsigned short, - vector unsigned short, - vector unsigned int); -vector signed int vec_msums (vector signed short, - vector signed short, - vector signed int); - -vector signed int vec_vmsumshs (vector signed short, - vector signed short, - vector signed int); - -vector unsigned int vec_vmsumuhs (vector unsigned short, - vector unsigned short, - vector unsigned int); - -void vec_mtvscr (vector signed int); -void vec_mtvscr (vector unsigned int); -void vec_mtvscr (vector bool int); -void vec_mtvscr (vector signed short); -void vec_mtvscr (vector unsigned short); -void vec_mtvscr (vector bool short); -void vec_mtvscr (vector pixel); -void vec_mtvscr (vector signed char); -void vec_mtvscr (vector unsigned char); -void vec_mtvscr (vector bool char); - -vector unsigned short vec_mule (vector unsigned char, - vector unsigned char); -vector signed short vec_mule (vector signed char, - vector signed char); -vector unsigned int vec_mule (vector unsigned short, - vector unsigned short); -vector signed int vec_mule (vector signed short, vector signed short); - -vector signed int vec_vmulesh (vector signed short, - vector signed short); - -vector unsigned int vec_vmuleuh (vector unsigned short, - vector unsigned short); - -vector signed short vec_vmulesb (vector signed char, - vector signed char); - -vector unsigned short vec_vmuleub (vector unsigned char, - vector unsigned char); - -vector unsigned short vec_mulo (vector unsigned char, - vector unsigned char); -vector signed short vec_mulo (vector signed char, vector signed char); -vector unsigned int vec_mulo (vector unsigned short, - vector unsigned short); -vector signed int vec_mulo (vector signed short, vector signed short); - -vector signed int vec_vmulosh (vector signed short, - vector signed short); - -vector unsigned int vec_vmulouh (vector unsigned short, - vector unsigned short); - -vector signed short vec_vmulosb (vector signed char, - vector signed char); - -vector unsigned short vec_vmuloub (vector unsigned char, - vector unsigned char); - -vector float vec_nmsub (vector float, vector float, vector float); - -vector float vec_nor (vector float, vector float); -vector signed int vec_nor (vector signed int, vector signed int); -vector unsigned int vec_nor (vector unsigned int, vector unsigned int); -vector bool int vec_nor (vector bool int, vector bool int); -vector signed short vec_nor (vector signed short, vector signed short); -vector unsigned short vec_nor (vector unsigned short, - vector unsigned short); -vector bool short vec_nor (vector bool short, vector bool short); -vector signed char vec_nor (vector signed char, vector signed char); -vector unsigned char vec_nor (vector unsigned char, - vector unsigned char); -vector bool char vec_nor (vector bool char, vector bool char); - -vector float vec_or (vector float, vector float); -vector float vec_or (vector float, vector bool int); -vector float vec_or (vector bool int, vector float); -vector bool int vec_or (vector bool int, vector bool int); -vector signed int vec_or (vector bool int, vector signed int); -vector signed int vec_or (vector signed int, vector bool int); -vector signed int vec_or (vector signed int, vector signed int); -vector unsigned int vec_or (vector bool int, vector unsigned int); -vector unsigned int vec_or (vector unsigned int, vector bool int); -vector unsigned int vec_or (vector unsigned int, vector unsigned int); -vector bool short vec_or (vector bool short, vector bool short); -vector signed short vec_or (vector bool short, vector signed short); -vector signed short vec_or (vector signed short, vector bool short); -vector signed short vec_or (vector signed short, vector signed short); -vector unsigned short vec_or (vector bool short, vector unsigned short); -vector unsigned short vec_or (vector unsigned short, vector bool short); -vector unsigned short vec_or (vector unsigned short, - vector unsigned short); -vector signed char vec_or (vector bool char, vector signed char); -vector bool char vec_or (vector bool char, vector bool char); -vector signed char vec_or (vector signed char, vector bool char); -vector signed char vec_or (vector signed char, vector signed char); -vector unsigned char vec_or (vector bool char, vector unsigned char); -vector unsigned char vec_or (vector unsigned char, vector bool char); -vector unsigned char vec_or (vector unsigned char, - vector unsigned char); - -vector signed char vec_pack (vector signed short, vector signed short); -vector unsigned char vec_pack (vector unsigned short, - vector unsigned short); -vector bool char vec_pack (vector bool short, vector bool short); -vector signed short vec_pack (vector signed int, vector signed int); -vector unsigned short vec_pack (vector unsigned int, - vector unsigned int); -vector bool short vec_pack (vector bool int, vector bool int); - -vector bool short vec_vpkuwum (vector bool int, vector bool int); -vector signed short vec_vpkuwum (vector signed int, vector signed int); -vector unsigned short vec_vpkuwum (vector unsigned int, - vector unsigned int); - -vector bool char vec_vpkuhum (vector bool short, vector bool short); -vector signed char vec_vpkuhum (vector signed short, - vector signed short); -vector unsigned char vec_vpkuhum (vector unsigned short, - vector unsigned short); - -vector pixel vec_packpx (vector unsigned int, vector unsigned int); - -vector unsigned char vec_packs (vector unsigned short, - vector unsigned short); -vector signed char vec_packs (vector signed short, vector signed short); -vector unsigned short vec_packs (vector unsigned int, - vector unsigned int); -vector signed short vec_packs (vector signed int, vector signed int); - -vector signed short vec_vpkswss (vector signed int, vector signed int); - -vector unsigned short vec_vpkuwus (vector unsigned int, - vector unsigned int); - -vector signed char vec_vpkshss (vector signed short, - vector signed short); - -vector unsigned char vec_vpkuhus (vector unsigned short, - vector unsigned short); - -vector unsigned char vec_packsu (vector unsigned short, - vector unsigned short); -vector unsigned char vec_packsu (vector signed short, - vector signed short); -vector unsigned short vec_packsu (vector unsigned int, - vector unsigned int); -vector unsigned short vec_packsu (vector signed int, vector signed int); - -vector unsigned short vec_vpkswus (vector signed int, - vector signed int); - -vector unsigned char vec_vpkshus (vector signed short, - vector signed short); - -vector float vec_perm (vector float, - vector float, - vector unsigned char); -vector signed int vec_perm (vector signed int, - vector signed int, - vector unsigned char); -vector unsigned int vec_perm (vector unsigned int, - vector unsigned int, - vector unsigned char); -vector bool int vec_perm (vector bool int, - vector bool int, - vector unsigned char); -vector signed short vec_perm (vector signed short, - vector signed short, - vector unsigned char); -vector unsigned short vec_perm (vector unsigned short, - vector unsigned short, - vector unsigned char); -vector bool short vec_perm (vector bool short, - vector bool short, - vector unsigned char); -vector pixel vec_perm (vector pixel, - vector pixel, - vector unsigned char); -vector signed char vec_perm (vector signed char, - vector signed char, - vector unsigned char); -vector unsigned char vec_perm (vector unsigned char, - vector unsigned char, - vector unsigned char); -vector bool char vec_perm (vector bool char, - vector bool char, - vector unsigned char); - -vector float vec_re (vector float); - -vector signed char vec_rl (vector signed char, - vector unsigned char); -vector unsigned char vec_rl (vector unsigned char, - vector unsigned char); -vector signed short vec_rl (vector signed short, vector unsigned short); -vector unsigned short vec_rl (vector unsigned short, - vector unsigned short); -vector signed int vec_rl (vector signed int, vector unsigned int); -vector unsigned int vec_rl (vector unsigned int, vector unsigned int); - -vector signed int vec_vrlw (vector signed int, vector unsigned int); -vector unsigned int vec_vrlw (vector unsigned int, vector unsigned int); - -vector signed short vec_vrlh (vector signed short, - vector unsigned short); -vector unsigned short vec_vrlh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vrlb (vector signed char, vector unsigned char); -vector unsigned char vec_vrlb (vector unsigned char, - vector unsigned char); - -vector float vec_round (vector float); - -vector float vec_recip (vector float, vector float); - -vector float vec_rsqrt (vector float); - -vector float vec_rsqrte (vector float); - -vector float vec_sel (vector float, vector float, vector bool int); -vector float vec_sel (vector float, vector float, vector unsigned int); -vector signed int vec_sel (vector signed int, - vector signed int, - vector bool int); -vector signed int vec_sel (vector signed int, - vector signed int, - vector unsigned int); -vector unsigned int vec_sel (vector unsigned int, - vector unsigned int, - vector bool int); -vector unsigned int vec_sel (vector unsigned int, - vector unsigned int, - vector unsigned int); -vector bool int vec_sel (vector bool int, - vector bool int, - vector bool int); -vector bool int vec_sel (vector bool int, - vector bool int, - vector unsigned int); -vector signed short vec_sel (vector signed short, - vector signed short, - vector bool short); -vector signed short vec_sel (vector signed short, - vector signed short, - vector unsigned short); -vector unsigned short vec_sel (vector unsigned short, - vector unsigned short, - vector bool short); -vector unsigned short vec_sel (vector unsigned short, - vector unsigned short, - vector unsigned short); -vector bool short vec_sel (vector bool short, - vector bool short, - vector bool short); -vector bool short vec_sel (vector bool short, - vector bool short, - vector unsigned short); -vector signed char vec_sel (vector signed char, - vector signed char, - vector bool char); -vector signed char vec_sel (vector signed char, - vector signed char, - vector unsigned char); -vector unsigned char vec_sel (vector unsigned char, - vector unsigned char, - vector bool char); -vector unsigned char vec_sel (vector unsigned char, - vector unsigned char, - vector unsigned char); -vector bool char vec_sel (vector bool char, - vector bool char, - vector bool char); -vector bool char vec_sel (vector bool char, - vector bool char, - vector unsigned char); - -vector signed char vec_sl (vector signed char, - vector unsigned char); -vector unsigned char vec_sl (vector unsigned char, - vector unsigned char); -vector signed short vec_sl (vector signed short, vector unsigned short); -vector unsigned short vec_sl (vector unsigned short, - vector unsigned short); -vector signed int vec_sl (vector signed int, vector unsigned int); -vector unsigned int vec_sl (vector unsigned int, vector unsigned int); - -vector signed int vec_vslw (vector signed int, vector unsigned int); -vector unsigned int vec_vslw (vector unsigned int, vector unsigned int); - -vector signed short vec_vslh (vector signed short, - vector unsigned short); -vector unsigned short vec_vslh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vslb (vector signed char, vector unsigned char); -vector unsigned char vec_vslb (vector unsigned char, - vector unsigned char); - -vector float vec_sld (vector float, vector float, const int); -vector signed int vec_sld (vector signed int, - vector signed int, - const int); -vector unsigned int vec_sld (vector unsigned int, - vector unsigned int, - const int); -vector bool int vec_sld (vector bool int, - vector bool int, - const int); -vector signed short vec_sld (vector signed short, - vector signed short, - const int); -vector unsigned short vec_sld (vector unsigned short, - vector unsigned short, - const int); -vector bool short vec_sld (vector bool short, - vector bool short, - const int); -vector pixel vec_sld (vector pixel, - vector pixel, - const int); -vector signed char vec_sld (vector signed char, - vector signed char, - const int); -vector unsigned char vec_sld (vector unsigned char, - vector unsigned char, - const int); -vector bool char vec_sld (vector bool char, - vector bool char, - const int); - -vector signed int vec_sll (vector signed int, - vector unsigned int); -vector signed int vec_sll (vector signed int, - vector unsigned short); -vector signed int vec_sll (vector signed int, - vector unsigned char); -vector unsigned int vec_sll (vector unsigned int, - vector unsigned int); -vector unsigned int vec_sll (vector unsigned int, - vector unsigned short); -vector unsigned int vec_sll (vector unsigned int, - vector unsigned char); -vector bool int vec_sll (vector bool int, - vector unsigned int); -vector bool int vec_sll (vector bool int, - vector unsigned short); -vector bool int vec_sll (vector bool int, - vector unsigned char); -vector signed short vec_sll (vector signed short, - vector unsigned int); -vector signed short vec_sll (vector signed short, - vector unsigned short); -vector signed short vec_sll (vector signed short, - vector unsigned char); -vector unsigned short vec_sll (vector unsigned short, - vector unsigned int); -vector unsigned short vec_sll (vector unsigned short, - vector unsigned short); -vector unsigned short vec_sll (vector unsigned short, - vector unsigned char); -vector bool short vec_sll (vector bool short, vector unsigned int); -vector bool short vec_sll (vector bool short, vector unsigned short); -vector bool short vec_sll (vector bool short, vector unsigned char); -vector pixel vec_sll (vector pixel, vector unsigned int); -vector pixel vec_sll (vector pixel, vector unsigned short); -vector pixel vec_sll (vector pixel, vector unsigned char); -vector signed char vec_sll (vector signed char, vector unsigned int); -vector signed char vec_sll (vector signed char, vector unsigned short); -vector signed char vec_sll (vector signed char, vector unsigned char); -vector unsigned char vec_sll (vector unsigned char, - vector unsigned int); -vector unsigned char vec_sll (vector unsigned char, - vector unsigned short); -vector unsigned char vec_sll (vector unsigned char, - vector unsigned char); -vector bool char vec_sll (vector bool char, vector unsigned int); -vector bool char vec_sll (vector bool char, vector unsigned short); -vector bool char vec_sll (vector bool char, vector unsigned char); - -vector float vec_slo (vector float, vector signed char); -vector float vec_slo (vector float, vector unsigned char); -vector signed int vec_slo (vector signed int, vector signed char); -vector signed int vec_slo (vector signed int, vector unsigned char); -vector unsigned int vec_slo (vector unsigned int, vector signed char); -vector unsigned int vec_slo (vector unsigned int, vector unsigned char); -vector signed short vec_slo (vector signed short, vector signed char); -vector signed short vec_slo (vector signed short, vector unsigned char); -vector unsigned short vec_slo (vector unsigned short, - vector signed char); -vector unsigned short vec_slo (vector unsigned short, - vector unsigned char); -vector pixel vec_slo (vector pixel, vector signed char); -vector pixel vec_slo (vector pixel, vector unsigned char); -vector signed char vec_slo (vector signed char, vector signed char); -vector signed char vec_slo (vector signed char, vector unsigned char); -vector unsigned char vec_slo (vector unsigned char, vector signed char); -vector unsigned char vec_slo (vector unsigned char, - vector unsigned char); - -vector signed char vec_splat (vector signed char, const int); -vector unsigned char vec_splat (vector unsigned char, const int); -vector bool char vec_splat (vector bool char, const int); -vector signed short vec_splat (vector signed short, const int); -vector unsigned short vec_splat (vector unsigned short, const int); -vector bool short vec_splat (vector bool short, const int); -vector pixel vec_splat (vector pixel, const int); -vector float vec_splat (vector float, const int); -vector signed int vec_splat (vector signed int, const int); -vector unsigned int vec_splat (vector unsigned int, const int); -vector bool int vec_splat (vector bool int, const int); -vector signed long vec_splat (vector signed long, const int); -vector unsigned long vec_splat (vector unsigned long, const int); - -vector signed char vec_splats (signed char); -vector unsigned char vec_splats (unsigned char); -vector signed short vec_splats (signed short); -vector unsigned short vec_splats (unsigned short); -vector signed int vec_splats (signed int); -vector unsigned int vec_splats (unsigned int); -vector float vec_splats (float); - -vector float vec_vspltw (vector float, const int); -vector signed int vec_vspltw (vector signed int, const int); -vector unsigned int vec_vspltw (vector unsigned int, const int); -vector bool int vec_vspltw (vector bool int, const int); - -vector bool short vec_vsplth (vector bool short, const int); -vector signed short vec_vsplth (vector signed short, const int); -vector unsigned short vec_vsplth (vector unsigned short, const int); -vector pixel vec_vsplth (vector pixel, const int); - -vector signed char vec_vspltb (vector signed char, const int); -vector unsigned char vec_vspltb (vector unsigned char, const int); -vector bool char vec_vspltb (vector bool char, const int); - -vector signed char vec_splat_s8 (const int); - -vector signed short vec_splat_s16 (const int); - -vector signed int vec_splat_s32 (const int); - -vector unsigned char vec_splat_u8 (const int); - -vector unsigned short vec_splat_u16 (const int); - -vector unsigned int vec_splat_u32 (const int); - -vector signed char vec_sr (vector signed char, vector unsigned char); -vector unsigned char vec_sr (vector unsigned char, - vector unsigned char); -vector signed short vec_sr (vector signed short, - vector unsigned short); -vector unsigned short vec_sr (vector unsigned short, - vector unsigned short); -vector signed int vec_sr (vector signed int, vector unsigned int); -vector unsigned int vec_sr (vector unsigned int, vector unsigned int); - -vector signed int vec_vsrw (vector signed int, vector unsigned int); -vector unsigned int vec_vsrw (vector unsigned int, vector unsigned int); - -vector signed short vec_vsrh (vector signed short, - vector unsigned short); -vector unsigned short vec_vsrh (vector unsigned short, - vector unsigned short); - -vector signed char vec_vsrb (vector signed char, vector unsigned char); -vector unsigned char vec_vsrb (vector unsigned char, - vector unsigned char); - -vector signed char vec_sra (vector signed char, vector unsigned char); -vector unsigned char vec_sra (vector unsigned char, - vector unsigned char); -vector signed short vec_sra (vector signed short, - vector unsigned short); -vector unsigned short vec_sra (vector unsigned short, - vector unsigned short); -vector signed int vec_sra (vector signed int, vector unsigned int); -vector unsigned int vec_sra (vector unsigned int, vector unsigned int); - -vector signed int vec_vsraw (vector signed int, vector unsigned int); -vector unsigned int vec_vsraw (vector unsigned int, - vector unsigned int); - -vector signed short vec_vsrah (vector signed short, - vector unsigned short); -vector unsigned short vec_vsrah (vector unsigned short, - vector unsigned short); - -vector signed char vec_vsrab (vector signed char, vector unsigned char); -vector unsigned char vec_vsrab (vector unsigned char, - vector unsigned char); - -vector signed int vec_srl (vector signed int, vector unsigned int); -vector signed int vec_srl (vector signed int, vector unsigned short); -vector signed int vec_srl (vector signed int, vector unsigned char); -vector unsigned int vec_srl (vector unsigned int, vector unsigned int); -vector unsigned int vec_srl (vector unsigned int, - vector unsigned short); -vector unsigned int vec_srl (vector unsigned int, vector unsigned char); -vector bool int vec_srl (vector bool int, vector unsigned int); -vector bool int vec_srl (vector bool int, vector unsigned short); -vector bool int vec_srl (vector bool int, vector unsigned char); -vector signed short vec_srl (vector signed short, vector unsigned int); -vector signed short vec_srl (vector signed short, - vector unsigned short); -vector signed short vec_srl (vector signed short, vector unsigned char); -vector unsigned short vec_srl (vector unsigned short, - vector unsigned int); -vector unsigned short vec_srl (vector unsigned short, - vector unsigned short); -vector unsigned short vec_srl (vector unsigned short, - vector unsigned char); -vector bool short vec_srl (vector bool short, vector unsigned int); -vector bool short vec_srl (vector bool short, vector unsigned short); -vector bool short vec_srl (vector bool short, vector unsigned char); -vector pixel vec_srl (vector pixel, vector unsigned int); -vector pixel vec_srl (vector pixel, vector unsigned short); -vector pixel vec_srl (vector pixel, vector unsigned char); -vector signed char vec_srl (vector signed char, vector unsigned int); -vector signed char vec_srl (vector signed char, vector unsigned short); -vector signed char vec_srl (vector signed char, vector unsigned char); -vector unsigned char vec_srl (vector unsigned char, - vector unsigned int); -vector unsigned char vec_srl (vector unsigned char, - vector unsigned short); -vector unsigned char vec_srl (vector unsigned char, - vector unsigned char); -vector bool char vec_srl (vector bool char, vector unsigned int); -vector bool char vec_srl (vector bool char, vector unsigned short); -vector bool char vec_srl (vector bool char, vector unsigned char); - -vector float vec_sro (vector float, vector signed char); -vector float vec_sro (vector float, vector unsigned char); -vector signed int vec_sro (vector signed int, vector signed char); -vector signed int vec_sro (vector signed int, vector unsigned char); -vector unsigned int vec_sro (vector unsigned int, vector signed char); -vector unsigned int vec_sro (vector unsigned int, vector unsigned char); -vector signed short vec_sro (vector signed short, vector signed char); -vector signed short vec_sro (vector signed short, vector unsigned char); -vector unsigned short vec_sro (vector unsigned short, - vector signed char); -vector unsigned short vec_sro (vector unsigned short, - vector unsigned char); -vector pixel vec_sro (vector pixel, vector signed char); -vector pixel vec_sro (vector pixel, vector unsigned char); -vector signed char vec_sro (vector signed char, vector signed char); -vector signed char vec_sro (vector signed char, vector unsigned char); -vector unsigned char vec_sro (vector unsigned char, vector signed char); -vector unsigned char vec_sro (vector unsigned char, - vector unsigned char); - -void vec_st (vector float, int, vector float *); -void vec_st (vector float, int, float *); -void vec_st (vector signed int, int, vector signed int *); -void vec_st (vector signed int, int, int *); -void vec_st (vector unsigned int, int, vector unsigned int *); -void vec_st (vector unsigned int, int, unsigned int *); -void vec_st (vector bool int, int, vector bool int *); -void vec_st (vector bool int, int, unsigned int *); -void vec_st (vector bool int, int, int *); -void vec_st (vector signed short, int, vector signed short *); -void vec_st (vector signed short, int, short *); -void vec_st (vector unsigned short, int, vector unsigned short *); -void vec_st (vector unsigned short, int, unsigned short *); -void vec_st (vector bool short, int, vector bool short *); -void vec_st (vector bool short, int, unsigned short *); -void vec_st (vector pixel, int, vector pixel *); -void vec_st (vector pixel, int, unsigned short *); -void vec_st (vector pixel, int, short *); -void vec_st (vector bool short, int, short *); -void vec_st (vector signed char, int, vector signed char *); -void vec_st (vector signed char, int, signed char *); -void vec_st (vector unsigned char, int, vector unsigned char *); -void vec_st (vector unsigned char, int, unsigned char *); -void vec_st (vector bool char, int, vector bool char *); -void vec_st (vector bool char, int, unsigned char *); -void vec_st (vector bool char, int, signed char *); - -void vec_ste (vector signed char, int, signed char *); -void vec_ste (vector unsigned char, int, unsigned char *); -void vec_ste (vector bool char, int, signed char *); -void vec_ste (vector bool char, int, unsigned char *); -void vec_ste (vector signed short, int, short *); -void vec_ste (vector unsigned short, int, unsigned short *); -void vec_ste (vector bool short, int, short *); -void vec_ste (vector bool short, int, unsigned short *); -void vec_ste (vector pixel, int, short *); -void vec_ste (vector pixel, int, unsigned short *); -void vec_ste (vector float, int, float *); -void vec_ste (vector signed int, int, int *); -void vec_ste (vector unsigned int, int, unsigned int *); -void vec_ste (vector bool int, int, int *); -void vec_ste (vector bool int, int, unsigned int *); - -void vec_stvewx (vector float, int, float *); -void vec_stvewx (vector signed int, int, int *); -void vec_stvewx (vector unsigned int, int, unsigned int *); -void vec_stvewx (vector bool int, int, int *); -void vec_stvewx (vector bool int, int, unsigned int *); - -void vec_stvehx (vector signed short, int, short *); -void vec_stvehx (vector unsigned short, int, unsigned short *); -void vec_stvehx (vector bool short, int, short *); -void vec_stvehx (vector bool short, int, unsigned short *); -void vec_stvehx (vector pixel, int, short *); -void vec_stvehx (vector pixel, int, unsigned short *); - -void vec_stvebx (vector signed char, int, signed char *); -void vec_stvebx (vector unsigned char, int, unsigned char *); -void vec_stvebx (vector bool char, int, signed char *); -void vec_stvebx (vector bool char, int, unsigned char *); - -void vec_stl (vector float, int, vector float *); -void vec_stl (vector float, int, float *); -void vec_stl (vector signed int, int, vector signed int *); -void vec_stl (vector signed int, int, int *); -void vec_stl (vector unsigned int, int, vector unsigned int *); -void vec_stl (vector unsigned int, int, unsigned int *); -void vec_stl (vector bool int, int, vector bool int *); -void vec_stl (vector bool int, int, unsigned int *); -void vec_stl (vector bool int, int, int *); -void vec_stl (vector signed short, int, vector signed short *); -void vec_stl (vector signed short, int, short *); -void vec_stl (vector unsigned short, int, vector unsigned short *); -void vec_stl (vector unsigned short, int, unsigned short *); -void vec_stl (vector bool short, int, vector bool short *); -void vec_stl (vector bool short, int, unsigned short *); -void vec_stl (vector bool short, int, short *); -void vec_stl (vector pixel, int, vector pixel *); -void vec_stl (vector pixel, int, unsigned short *); -void vec_stl (vector pixel, int, short *); -void vec_stl (vector signed char, int, vector signed char *); -void vec_stl (vector signed char, int, signed char *); -void vec_stl (vector unsigned char, int, vector unsigned char *); -void vec_stl (vector unsigned char, int, unsigned char *); -void vec_stl (vector bool char, int, vector bool char *); -void vec_stl (vector bool char, int, unsigned char *); -void vec_stl (vector bool char, int, signed char *); - -vector signed char vec_sub (vector bool char, vector signed char); -vector signed char vec_sub (vector signed char, vector bool char); -vector signed char vec_sub (vector signed char, vector signed char); -vector unsigned char vec_sub (vector bool char, vector unsigned char); -vector unsigned char vec_sub (vector unsigned char, vector bool char); -vector unsigned char vec_sub (vector unsigned char, - vector unsigned char); -vector signed short vec_sub (vector bool short, vector signed short); -vector signed short vec_sub (vector signed short, vector bool short); -vector signed short vec_sub (vector signed short, vector signed short); -vector unsigned short vec_sub (vector bool short, - vector unsigned short); -vector unsigned short vec_sub (vector unsigned short, - vector bool short); -vector unsigned short vec_sub (vector unsigned short, - vector unsigned short); -vector signed int vec_sub (vector bool int, vector signed int); -vector signed int vec_sub (vector signed int, vector bool int); -vector signed int vec_sub (vector signed int, vector signed int); -vector unsigned int vec_sub (vector bool int, vector unsigned int); -vector unsigned int vec_sub (vector unsigned int, vector bool int); -vector unsigned int vec_sub (vector unsigned int, vector unsigned int); -vector float vec_sub (vector float, vector float); - -vector float vec_vsubfp (vector float, vector float); - -vector signed int vec_vsubuwm (vector bool int, vector signed int); -vector signed int vec_vsubuwm (vector signed int, vector bool int); -vector signed int vec_vsubuwm (vector signed int, vector signed int); -vector unsigned int vec_vsubuwm (vector bool int, vector unsigned int); -vector unsigned int vec_vsubuwm (vector unsigned int, vector bool int); -vector unsigned int vec_vsubuwm (vector unsigned int, - vector unsigned int); - -vector signed short vec_vsubuhm (vector bool short, - vector signed short); -vector signed short vec_vsubuhm (vector signed short, - vector bool short); -vector signed short vec_vsubuhm (vector signed short, - vector signed short); -vector unsigned short vec_vsubuhm (vector bool short, - vector unsigned short); -vector unsigned short vec_vsubuhm (vector unsigned short, - vector bool short); -vector unsigned short vec_vsubuhm (vector unsigned short, - vector unsigned short); - -vector signed char vec_vsububm (vector bool char, vector signed char); -vector signed char vec_vsububm (vector signed char, vector bool char); -vector signed char vec_vsububm (vector signed char, vector signed char); -vector unsigned char vec_vsububm (vector bool char, - vector unsigned char); -vector unsigned char vec_vsububm (vector unsigned char, - vector bool char); -vector unsigned char vec_vsububm (vector unsigned char, - vector unsigned char); - -vector unsigned int vec_subc (vector unsigned int, vector unsigned int); - -vector unsigned char vec_subs (vector bool char, vector unsigned char); -vector unsigned char vec_subs (vector unsigned char, vector bool char); -vector unsigned char vec_subs (vector unsigned char, - vector unsigned char); -vector signed char vec_subs (vector bool char, vector signed char); -vector signed char vec_subs (vector signed char, vector bool char); -vector signed char vec_subs (vector signed char, vector signed char); -vector unsigned short vec_subs (vector bool short, - vector unsigned short); -vector unsigned short vec_subs (vector unsigned short, - vector bool short); -vector unsigned short vec_subs (vector unsigned short, - vector unsigned short); -vector signed short vec_subs (vector bool short, vector signed short); -vector signed short vec_subs (vector signed short, vector bool short); -vector signed short vec_subs (vector signed short, vector signed short); -vector unsigned int vec_subs (vector bool int, vector unsigned int); -vector unsigned int vec_subs (vector unsigned int, vector bool int); -vector unsigned int vec_subs (vector unsigned int, vector unsigned int); -vector signed int vec_subs (vector bool int, vector signed int); -vector signed int vec_subs (vector signed int, vector bool int); -vector signed int vec_subs (vector signed int, vector signed int); - -vector signed int vec_vsubsws (vector bool int, vector signed int); -vector signed int vec_vsubsws (vector signed int, vector bool int); -vector signed int vec_vsubsws (vector signed int, vector signed int); - -vector unsigned int vec_vsubuws (vector bool int, vector unsigned int); -vector unsigned int vec_vsubuws (vector unsigned int, vector bool int); -vector unsigned int vec_vsubuws (vector unsigned int, - vector unsigned int); - -vector signed short vec_vsubshs (vector bool short, - vector signed short); -vector signed short vec_vsubshs (vector signed short, - vector bool short); -vector signed short vec_vsubshs (vector signed short, - vector signed short); - -vector unsigned short vec_vsubuhs (vector bool short, - vector unsigned short); -vector unsigned short vec_vsubuhs (vector unsigned short, - vector bool short); -vector unsigned short vec_vsubuhs (vector unsigned short, - vector unsigned short); - -vector signed char vec_vsubsbs (vector bool char, vector signed char); -vector signed char vec_vsubsbs (vector signed char, vector bool char); -vector signed char vec_vsubsbs (vector signed char, vector signed char); - -vector unsigned char vec_vsububs (vector bool char, - vector unsigned char); -vector unsigned char vec_vsububs (vector unsigned char, - vector bool char); -vector unsigned char vec_vsububs (vector unsigned char, - vector unsigned char); - -vector unsigned int vec_sum4s (vector unsigned char, - vector unsigned int); -vector signed int vec_sum4s (vector signed char, vector signed int); -vector signed int vec_sum4s (vector signed short, vector signed int); - -vector signed int vec_vsum4shs (vector signed short, vector signed int); - -vector signed int vec_vsum4sbs (vector signed char, vector signed int); - -vector unsigned int vec_vsum4ubs (vector unsigned char, - vector unsigned int); - -vector signed int vec_sum2s (vector signed int, vector signed int); - -vector signed int vec_sums (vector signed int, vector signed int); - -vector float vec_trunc (vector float); - -vector signed short vec_unpackh (vector signed char); -vector bool short vec_unpackh (vector bool char); -vector signed int vec_unpackh (vector signed short); -vector bool int vec_unpackh (vector bool short); -vector unsigned int vec_unpackh (vector pixel); - -vector bool int vec_vupkhsh (vector bool short); -vector signed int vec_vupkhsh (vector signed short); - -vector unsigned int vec_vupkhpx (vector pixel); - -vector bool short vec_vupkhsb (vector bool char); -vector signed short vec_vupkhsb (vector signed char); - -vector signed short vec_unpackl (vector signed char); -vector bool short vec_unpackl (vector bool char); -vector unsigned int vec_unpackl (vector pixel); -vector signed int vec_unpackl (vector signed short); -vector bool int vec_unpackl (vector bool short); - -vector unsigned int vec_vupklpx (vector pixel); - -vector bool int vec_vupklsh (vector bool short); -vector signed int vec_vupklsh (vector signed short); - -vector bool short vec_vupklsb (vector bool char); -vector signed short vec_vupklsb (vector signed char); - -vector float vec_xor (vector float, vector float); -vector float vec_xor (vector float, vector bool int); -vector float vec_xor (vector bool int, vector float); -vector bool int vec_xor (vector bool int, vector bool int); -vector signed int vec_xor (vector bool int, vector signed int); -vector signed int vec_xor (vector signed int, vector bool int); -vector signed int vec_xor (vector signed int, vector signed int); -vector unsigned int vec_xor (vector bool int, vector unsigned int); -vector unsigned int vec_xor (vector unsigned int, vector bool int); -vector unsigned int vec_xor (vector unsigned int, vector unsigned int); -vector bool short vec_xor (vector bool short, vector bool short); -vector signed short vec_xor (vector bool short, vector signed short); -vector signed short vec_xor (vector signed short, vector bool short); -vector signed short vec_xor (vector signed short, vector signed short); -vector unsigned short vec_xor (vector bool short, - vector unsigned short); -vector unsigned short vec_xor (vector unsigned short, - vector bool short); -vector unsigned short vec_xor (vector unsigned short, - vector unsigned short); -vector signed char vec_xor (vector bool char, vector signed char); -vector bool char vec_xor (vector bool char, vector bool char); -vector signed char vec_xor (vector signed char, vector bool char); -vector signed char vec_xor (vector signed char, vector signed char); -vector unsigned char vec_xor (vector bool char, vector unsigned char); -vector unsigned char vec_xor (vector unsigned char, vector bool char); -vector unsigned char vec_xor (vector unsigned char, - vector unsigned char); - -int vec_all_eq (vector signed char, vector bool char); -int vec_all_eq (vector signed char, vector signed char); -int vec_all_eq (vector unsigned char, vector bool char); -int vec_all_eq (vector unsigned char, vector unsigned char); -int vec_all_eq (vector bool char, vector bool char); -int vec_all_eq (vector bool char, vector unsigned char); -int vec_all_eq (vector bool char, vector signed char); -int vec_all_eq (vector signed short, vector bool short); -int vec_all_eq (vector signed short, vector signed short); -int vec_all_eq (vector unsigned short, vector bool short); -int vec_all_eq (vector unsigned short, vector unsigned short); -int vec_all_eq (vector bool short, vector bool short); -int vec_all_eq (vector bool short, vector unsigned short); -int vec_all_eq (vector bool short, vector signed short); -int vec_all_eq (vector pixel, vector pixel); -int vec_all_eq (vector signed int, vector bool int); -int vec_all_eq (vector signed int, vector signed int); -int vec_all_eq (vector unsigned int, vector bool int); -int vec_all_eq (vector unsigned int, vector unsigned int); -int vec_all_eq (vector bool int, vector bool int); -int vec_all_eq (vector bool int, vector unsigned int); -int vec_all_eq (vector bool int, vector signed int); -int vec_all_eq (vector float, vector float); - -int vec_all_ge (vector bool char, vector unsigned char); -int vec_all_ge (vector unsigned char, vector bool char); -int vec_all_ge (vector unsigned char, vector unsigned char); -int vec_all_ge (vector bool char, vector signed char); -int vec_all_ge (vector signed char, vector bool char); -int vec_all_ge (vector signed char, vector signed char); -int vec_all_ge (vector bool short, vector unsigned short); -int vec_all_ge (vector unsigned short, vector bool short); -int vec_all_ge (vector unsigned short, vector unsigned short); -int vec_all_ge (vector signed short, vector signed short); -int vec_all_ge (vector bool short, vector signed short); -int vec_all_ge (vector signed short, vector bool short); -int vec_all_ge (vector bool int, vector unsigned int); -int vec_all_ge (vector unsigned int, vector bool int); -int vec_all_ge (vector unsigned int, vector unsigned int); -int vec_all_ge (vector bool int, vector signed int); -int vec_all_ge (vector signed int, vector bool int); -int vec_all_ge (vector signed int, vector signed int); -int vec_all_ge (vector float, vector float); - -int vec_all_gt (vector bool char, vector unsigned char); -int vec_all_gt (vector unsigned char, vector bool char); -int vec_all_gt (vector unsigned char, vector unsigned char); -int vec_all_gt (vector bool char, vector signed char); -int vec_all_gt (vector signed char, vector bool char); -int vec_all_gt (vector signed char, vector signed char); -int vec_all_gt (vector bool short, vector unsigned short); -int vec_all_gt (vector unsigned short, vector bool short); -int vec_all_gt (vector unsigned short, vector unsigned short); -int vec_all_gt (vector bool short, vector signed short); -int vec_all_gt (vector signed short, vector bool short); -int vec_all_gt (vector signed short, vector signed short); -int vec_all_gt (vector bool int, vector unsigned int); -int vec_all_gt (vector unsigned int, vector bool int); -int vec_all_gt (vector unsigned int, vector unsigned int); -int vec_all_gt (vector bool int, vector signed int); -int vec_all_gt (vector signed int, vector bool int); -int vec_all_gt (vector signed int, vector signed int); -int vec_all_gt (vector float, vector float); - -int vec_all_in (vector float, vector float); - -int vec_all_le (vector bool char, vector unsigned char); -int vec_all_le (vector unsigned char, vector bool char); -int vec_all_le (vector unsigned char, vector unsigned char); -int vec_all_le (vector bool char, vector signed char); -int vec_all_le (vector signed char, vector bool char); -int vec_all_le (vector signed char, vector signed char); -int vec_all_le (vector bool short, vector unsigned short); -int vec_all_le (vector unsigned short, vector bool short); -int vec_all_le (vector unsigned short, vector unsigned short); -int vec_all_le (vector bool short, vector signed short); -int vec_all_le (vector signed short, vector bool short); -int vec_all_le (vector signed short, vector signed short); -int vec_all_le (vector bool int, vector unsigned int); -int vec_all_le (vector unsigned int, vector bool int); -int vec_all_le (vector unsigned int, vector unsigned int); -int vec_all_le (vector bool int, vector signed int); -int vec_all_le (vector signed int, vector bool int); -int vec_all_le (vector signed int, vector signed int); -int vec_all_le (vector float, vector float); - -int vec_all_lt (vector bool char, vector unsigned char); -int vec_all_lt (vector unsigned char, vector bool char); -int vec_all_lt (vector unsigned char, vector unsigned char); -int vec_all_lt (vector bool char, vector signed char); -int vec_all_lt (vector signed char, vector bool char); -int vec_all_lt (vector signed char, vector signed char); -int vec_all_lt (vector bool short, vector unsigned short); -int vec_all_lt (vector unsigned short, vector bool short); -int vec_all_lt (vector unsigned short, vector unsigned short); -int vec_all_lt (vector bool short, vector signed short); -int vec_all_lt (vector signed short, vector bool short); -int vec_all_lt (vector signed short, vector signed short); -int vec_all_lt (vector bool int, vector unsigned int); -int vec_all_lt (vector unsigned int, vector bool int); -int vec_all_lt (vector unsigned int, vector unsigned int); -int vec_all_lt (vector bool int, vector signed int); -int vec_all_lt (vector signed int, vector bool int); -int vec_all_lt (vector signed int, vector signed int); -int vec_all_lt (vector float, vector float); - -int vec_all_nan (vector float); - -int vec_all_ne (vector signed char, vector bool char); -int vec_all_ne (vector signed char, vector signed char); -int vec_all_ne (vector unsigned char, vector bool char); -int vec_all_ne (vector unsigned char, vector unsigned char); -int vec_all_ne (vector bool char, vector bool char); -int vec_all_ne (vector bool char, vector unsigned char); -int vec_all_ne (vector bool char, vector signed char); -int vec_all_ne (vector signed short, vector bool short); -int vec_all_ne (vector signed short, vector signed short); -int vec_all_ne (vector unsigned short, vector bool short); -int vec_all_ne (vector unsigned short, vector unsigned short); -int vec_all_ne (vector bool short, vector bool short); -int vec_all_ne (vector bool short, vector unsigned short); -int vec_all_ne (vector bool short, vector signed short); -int vec_all_ne (vector pixel, vector pixel); -int vec_all_ne (vector signed int, vector bool int); -int vec_all_ne (vector signed int, vector signed int); -int vec_all_ne (vector unsigned int, vector bool int); -int vec_all_ne (vector unsigned int, vector unsigned int); -int vec_all_ne (vector bool int, vector bool int); -int vec_all_ne (vector bool int, vector unsigned int); -int vec_all_ne (vector bool int, vector signed int); -int vec_all_ne (vector float, vector float); - -int vec_all_nge (vector float, vector float); - -int vec_all_ngt (vector float, vector float); - -int vec_all_nle (vector float, vector float); - -int vec_all_nlt (vector float, vector float); - -int vec_all_numeric (vector float); - -int vec_any_eq (vector signed char, vector bool char); -int vec_any_eq (vector signed char, vector signed char); -int vec_any_eq (vector unsigned char, vector bool char); -int vec_any_eq (vector unsigned char, vector unsigned char); -int vec_any_eq (vector bool char, vector bool char); -int vec_any_eq (vector bool char, vector unsigned char); -int vec_any_eq (vector bool char, vector signed char); -int vec_any_eq (vector signed short, vector bool short); -int vec_any_eq (vector signed short, vector signed short); -int vec_any_eq (vector unsigned short, vector bool short); -int vec_any_eq (vector unsigned short, vector unsigned short); -int vec_any_eq (vector bool short, vector bool short); -int vec_any_eq (vector bool short, vector unsigned short); -int vec_any_eq (vector bool short, vector signed short); -int vec_any_eq (vector pixel, vector pixel); -int vec_any_eq (vector signed int, vector bool int); -int vec_any_eq (vector signed int, vector signed int); -int vec_any_eq (vector unsigned int, vector bool int); -int vec_any_eq (vector unsigned int, vector unsigned int); -int vec_any_eq (vector bool int, vector bool int); -int vec_any_eq (vector bool int, vector unsigned int); -int vec_any_eq (vector bool int, vector signed int); -int vec_any_eq (vector float, vector float); - -int vec_any_ge (vector signed char, vector bool char); -int vec_any_ge (vector unsigned char, vector bool char); -int vec_any_ge (vector unsigned char, vector unsigned char); -int vec_any_ge (vector signed char, vector signed char); -int vec_any_ge (vector bool char, vector unsigned char); -int vec_any_ge (vector bool char, vector signed char); -int vec_any_ge (vector unsigned short, vector bool short); -int vec_any_ge (vector unsigned short, vector unsigned short); -int vec_any_ge (vector signed short, vector signed short); -int vec_any_ge (vector signed short, vector bool short); -int vec_any_ge (vector bool short, vector unsigned short); -int vec_any_ge (vector bool short, vector signed short); -int vec_any_ge (vector signed int, vector bool int); -int vec_any_ge (vector unsigned int, vector bool int); -int vec_any_ge (vector unsigned int, vector unsigned int); -int vec_any_ge (vector signed int, vector signed int); -int vec_any_ge (vector bool int, vector unsigned int); -int vec_any_ge (vector bool int, vector signed int); -int vec_any_ge (vector float, vector float); - -int vec_any_gt (vector bool char, vector unsigned char); -int vec_any_gt (vector unsigned char, vector bool char); -int vec_any_gt (vector unsigned char, vector unsigned char); -int vec_any_gt (vector bool char, vector signed char); -int vec_any_gt (vector signed char, vector bool char); -int vec_any_gt (vector signed char, vector signed char); -int vec_any_gt (vector bool short, vector unsigned short); -int vec_any_gt (vector unsigned short, vector bool short); -int vec_any_gt (vector unsigned short, vector unsigned short); -int vec_any_gt (vector bool short, vector signed short); -int vec_any_gt (vector signed short, vector bool short); -int vec_any_gt (vector signed short, vector signed short); -int vec_any_gt (vector bool int, vector unsigned int); -int vec_any_gt (vector unsigned int, vector bool int); -int vec_any_gt (vector unsigned int, vector unsigned int); -int vec_any_gt (vector bool int, vector signed int); -int vec_any_gt (vector signed int, vector bool int); -int vec_any_gt (vector signed int, vector signed int); -int vec_any_gt (vector float, vector float); - -int vec_any_le (vector bool char, vector unsigned char); -int vec_any_le (vector unsigned char, vector bool char); -int vec_any_le (vector unsigned char, vector unsigned char); -int vec_any_le (vector bool char, vector signed char); -int vec_any_le (vector signed char, vector bool char); -int vec_any_le (vector signed char, vector signed char); -int vec_any_le (vector bool short, vector unsigned short); -int vec_any_le (vector unsigned short, vector bool short); -int vec_any_le (vector unsigned short, vector unsigned short); -int vec_any_le (vector bool short, vector signed short); -int vec_any_le (vector signed short, vector bool short); -int vec_any_le (vector signed short, vector signed short); -int vec_any_le (vector bool int, vector unsigned int); -int vec_any_le (vector unsigned int, vector bool int); -int vec_any_le (vector unsigned int, vector unsigned int); -int vec_any_le (vector bool int, vector signed int); -int vec_any_le (vector signed int, vector bool int); -int vec_any_le (vector signed int, vector signed int); -int vec_any_le (vector float, vector float); - -int vec_any_lt (vector bool char, vector unsigned char); -int vec_any_lt (vector unsigned char, vector bool char); -int vec_any_lt (vector unsigned char, vector unsigned char); -int vec_any_lt (vector bool char, vector signed char); -int vec_any_lt (vector signed char, vector bool char); -int vec_any_lt (vector signed char, vector signed char); -int vec_any_lt (vector bool short, vector unsigned short); -int vec_any_lt (vector unsigned short, vector bool short); -int vec_any_lt (vector unsigned short, vector unsigned short); -int vec_any_lt (vector bool short, vector signed short); -int vec_any_lt (vector signed short, vector bool short); -int vec_any_lt (vector signed short, vector signed short); -int vec_any_lt (vector bool int, vector unsigned int); -int vec_any_lt (vector unsigned int, vector bool int); -int vec_any_lt (vector unsigned int, vector unsigned int); -int vec_any_lt (vector bool int, vector signed int); -int vec_any_lt (vector signed int, vector bool int); -int vec_any_lt (vector signed int, vector signed int); -int vec_any_lt (vector float, vector float); - -int vec_any_nan (vector float); - -int vec_any_ne (vector signed char, vector bool char); -int vec_any_ne (vector signed char, vector signed char); -int vec_any_ne (vector unsigned char, vector bool char); -int vec_any_ne (vector unsigned char, vector unsigned char); -int vec_any_ne (vector bool char, vector bool char); -int vec_any_ne (vector bool char, vector unsigned char); -int vec_any_ne (vector bool char, vector signed char); -int vec_any_ne (vector signed short, vector bool short); -int vec_any_ne (vector signed short, vector signed short); -int vec_any_ne (vector unsigned short, vector bool short); -int vec_any_ne (vector unsigned short, vector unsigned short); -int vec_any_ne (vector bool short, vector bool short); -int vec_any_ne (vector bool short, vector unsigned short); -int vec_any_ne (vector bool short, vector signed short); -int vec_any_ne (vector pixel, vector pixel); -int vec_any_ne (vector signed int, vector bool int); -int vec_any_ne (vector signed int, vector signed int); -int vec_any_ne (vector unsigned int, vector bool int); -int vec_any_ne (vector unsigned int, vector unsigned int); -int vec_any_ne (vector bool int, vector bool int); -int vec_any_ne (vector bool int, vector unsigned int); -int vec_any_ne (vector bool int, vector signed int); -int vec_any_ne (vector float, vector float); - -int vec_any_nge (vector float, vector float); - -int vec_any_ngt (vector float, vector float); - -int vec_any_nle (vector float, vector float); - -int vec_any_nlt (vector float, vector float); - -int vec_any_numeric (vector float); - -int vec_any_out (vector float, vector float); -@end smallexample - -If the vector/scalar (VSX) instruction set is available, the following -additional functions are available: - -@smallexample -vector double vec_abs (vector double); -vector double vec_add (vector double, vector double); -vector double vec_and (vector double, vector double); -vector double vec_and (vector double, vector bool long); -vector double vec_and (vector bool long, vector double); -vector long vec_and (vector long, vector long); -vector long vec_and (vector long, vector bool long); -vector long vec_and (vector bool long, vector long); -vector unsigned long vec_and (vector unsigned long, vector unsigned long); -vector unsigned long vec_and (vector unsigned long, vector bool long); -vector unsigned long vec_and (vector bool long, vector unsigned long); -vector double vec_andc (vector double, vector double); -vector double vec_andc (vector double, vector bool long); -vector double vec_andc (vector bool long, vector double); -vector long vec_andc (vector long, vector long); -vector long vec_andc (vector long, vector bool long); -vector long vec_andc (vector bool long, vector long); -vector unsigned long vec_andc (vector unsigned long, vector unsigned long); -vector unsigned long vec_andc (vector unsigned long, vector bool long); -vector unsigned long vec_andc (vector bool long, vector unsigned long); -vector double vec_ceil (vector double); -vector bool long vec_cmpeq (vector double, vector double); -vector bool long vec_cmpge (vector double, vector double); -vector bool long vec_cmpgt (vector double, vector double); -vector bool long vec_cmple (vector double, vector double); -vector bool long vec_cmplt (vector double, vector double); -vector double vec_cpsgn (vector double, vector double); -vector float vec_div (vector float, vector float); -vector double vec_div (vector double, vector double); -vector long vec_div (vector long, vector long); -vector unsigned long vec_div (vector unsigned long, vector unsigned long); -vector double vec_floor (vector double); -vector double vec_ld (int, const vector double *); -vector double vec_ld (int, const double *); -vector double vec_ldl (int, const vector double *); -vector double vec_ldl (int, const double *); -vector unsigned char vec_lvsl (int, const volatile double *); -vector unsigned char vec_lvsr (int, const volatile double *); -vector double vec_madd (vector double, vector double, vector double); -vector double vec_max (vector double, vector double); -vector signed long vec_mergeh (vector signed long, vector signed long); -vector signed long vec_mergeh (vector signed long, vector bool long); -vector signed long vec_mergeh (vector bool long, vector signed long); -vector unsigned long vec_mergeh (vector unsigned long, vector unsigned long); -vector unsigned long vec_mergeh (vector unsigned long, vector bool long); -vector unsigned long vec_mergeh (vector bool long, vector unsigned long); -vector signed long vec_mergel (vector signed long, vector signed long); -vector signed long vec_mergel (vector signed long, vector bool long); -vector signed long vec_mergel (vector bool long, vector signed long); -vector unsigned long vec_mergel (vector unsigned long, vector unsigned long); -vector unsigned long vec_mergel (vector unsigned long, vector bool long); -vector unsigned long vec_mergel (vector bool long, vector unsigned long); -vector double vec_min (vector double, vector double); -vector float vec_msub (vector float, vector float, vector float); -vector double vec_msub (vector double, vector double, vector double); -vector float vec_mul (vector float, vector float); -vector double vec_mul (vector double, vector double); -vector long vec_mul (vector long, vector long); -vector unsigned long vec_mul (vector unsigned long, vector unsigned long); -vector float vec_nearbyint (vector float); -vector double vec_nearbyint (vector double); -vector float vec_nmadd (vector float, vector float, vector float); -vector double vec_nmadd (vector double, vector double, vector double); -vector double vec_nmsub (vector double, vector double, vector double); -vector double vec_nor (vector double, vector double); -vector long vec_nor (vector long, vector long); -vector long vec_nor (vector long, vector bool long); -vector long vec_nor (vector bool long, vector long); -vector unsigned long vec_nor (vector unsigned long, vector unsigned long); -vector unsigned long vec_nor (vector unsigned long, vector bool long); -vector unsigned long vec_nor (vector bool long, vector unsigned long); -vector double vec_or (vector double, vector double); -vector double vec_or (vector double, vector bool long); -vector double vec_or (vector bool long, vector double); -vector long vec_or (vector long, vector long); -vector long vec_or (vector long, vector bool long); -vector long vec_or (vector bool long, vector long); -vector unsigned long vec_or (vector unsigned long, vector unsigned long); -vector unsigned long vec_or (vector unsigned long, vector bool long); -vector unsigned long vec_or (vector bool long, vector unsigned long); -vector double vec_perm (vector double, vector double, vector unsigned char); -vector long vec_perm (vector long, vector long, vector unsigned char); -vector unsigned long vec_perm (vector unsigned long, vector unsigned long, - vector unsigned char); -vector double vec_rint (vector double); -vector double vec_recip (vector double, vector double); -vector double vec_rsqrt (vector double); -vector double vec_rsqrte (vector double); -vector double vec_sel (vector double, vector double, vector bool long); -vector double vec_sel (vector double, vector double, vector unsigned long); -vector long vec_sel (vector long, vector long, vector long); -vector long vec_sel (vector long, vector long, vector unsigned long); -vector long vec_sel (vector long, vector long, vector bool long); -vector unsigned long vec_sel (vector unsigned long, vector unsigned long, - vector long); -vector unsigned long vec_sel (vector unsigned long, vector unsigned long, - vector unsigned long); -vector unsigned long vec_sel (vector unsigned long, vector unsigned long, - vector bool long); -vector double vec_splats (double); -vector signed long vec_splats (signed long); -vector unsigned long vec_splats (unsigned long); -vector float vec_sqrt (vector float); -vector double vec_sqrt (vector double); -void vec_st (vector double, int, vector double *); -void vec_st (vector double, int, double *); -vector double vec_sub (vector double, vector double); -vector double vec_trunc (vector double); -vector double vec_xor (vector double, vector double); -vector double vec_xor (vector double, vector bool long); -vector double vec_xor (vector bool long, vector double); -vector long vec_xor (vector long, vector long); -vector long vec_xor (vector long, vector bool long); -vector long vec_xor (vector bool long, vector long); -vector unsigned long vec_xor (vector unsigned long, vector unsigned long); -vector unsigned long vec_xor (vector unsigned long, vector bool long); -vector unsigned long vec_xor (vector bool long, vector unsigned long); -int vec_all_eq (vector double, vector double); -int vec_all_ge (vector double, vector double); -int vec_all_gt (vector double, vector double); -int vec_all_le (vector double, vector double); -int vec_all_lt (vector double, vector double); -int vec_all_nan (vector double); -int vec_all_ne (vector double, vector double); -int vec_all_nge (vector double, vector double); -int vec_all_ngt (vector double, vector double); -int vec_all_nle (vector double, vector double); -int vec_all_nlt (vector double, vector double); -int vec_all_numeric (vector double); -int vec_any_eq (vector double, vector double); -int vec_any_ge (vector double, vector double); -int vec_any_gt (vector double, vector double); -int vec_any_le (vector double, vector double); -int vec_any_lt (vector double, vector double); -int vec_any_nan (vector double); -int vec_any_ne (vector double, vector double); -int vec_any_nge (vector double, vector double); -int vec_any_ngt (vector double, vector double); -int vec_any_nle (vector double, vector double); -int vec_any_nlt (vector double, vector double); -int vec_any_numeric (vector double); - -vector double vec_vsx_ld (int, const vector double *); -vector double vec_vsx_ld (int, const double *); -vector float vec_vsx_ld (int, const vector float *); -vector float vec_vsx_ld (int, const float *); -vector bool int vec_vsx_ld (int, const vector bool int *); -vector signed int vec_vsx_ld (int, const vector signed int *); -vector signed int vec_vsx_ld (int, const int *); -vector signed int vec_vsx_ld (int, const long *); -vector unsigned int vec_vsx_ld (int, const vector unsigned int *); -vector unsigned int vec_vsx_ld (int, const unsigned int *); -vector unsigned int vec_vsx_ld (int, const unsigned long *); -vector bool short vec_vsx_ld (int, const vector bool short *); -vector pixel vec_vsx_ld (int, const vector pixel *); -vector signed short vec_vsx_ld (int, const vector signed short *); -vector signed short vec_vsx_ld (int, const short *); -vector unsigned short vec_vsx_ld (int, const vector unsigned short *); -vector unsigned short vec_vsx_ld (int, const unsigned short *); -vector bool char vec_vsx_ld (int, const vector bool char *); -vector signed char vec_vsx_ld (int, const vector signed char *); -vector signed char vec_vsx_ld (int, const signed char *); -vector unsigned char vec_vsx_ld (int, const vector unsigned char *); -vector unsigned char vec_vsx_ld (int, const unsigned char *); - -void vec_vsx_st (vector double, int, vector double *); -void vec_vsx_st (vector double, int, double *); -void vec_vsx_st (vector float, int, vector float *); -void vec_vsx_st (vector float, int, float *); -void vec_vsx_st (vector signed int, int, vector signed int *); -void vec_vsx_st (vector signed int, int, int *); -void vec_vsx_st (vector unsigned int, int, vector unsigned int *); -void vec_vsx_st (vector unsigned int, int, unsigned int *); -void vec_vsx_st (vector bool int, int, vector bool int *); -void vec_vsx_st (vector bool int, int, unsigned int *); -void vec_vsx_st (vector bool int, int, int *); -void vec_vsx_st (vector signed short, int, vector signed short *); -void vec_vsx_st (vector signed short, int, short *); -void vec_vsx_st (vector unsigned short, int, vector unsigned short *); -void vec_vsx_st (vector unsigned short, int, unsigned short *); -void vec_vsx_st (vector bool short, int, vector bool short *); -void vec_vsx_st (vector bool short, int, unsigned short *); -void vec_vsx_st (vector pixel, int, vector pixel *); -void vec_vsx_st (vector pixel, int, unsigned short *); -void vec_vsx_st (vector pixel, int, short *); -void vec_vsx_st (vector bool short, int, short *); -void vec_vsx_st (vector signed char, int, vector signed char *); -void vec_vsx_st (vector signed char, int, signed char *); -void vec_vsx_st (vector unsigned char, int, vector unsigned char *); -void vec_vsx_st (vector unsigned char, int, unsigned char *); -void vec_vsx_st (vector bool char, int, vector bool char *); -void vec_vsx_st (vector bool char, int, unsigned char *); -void vec_vsx_st (vector bool char, int, signed char *); - -vector double vec_xxpermdi (vector double, vector double, int); -vector float vec_xxpermdi (vector float, vector float, int); -vector long long vec_xxpermdi (vector long long, vector long long, int); -vector unsigned long long vec_xxpermdi (vector unsigned long long, - vector unsigned long long, int); -vector int vec_xxpermdi (vector int, vector int, int); -vector unsigned int vec_xxpermdi (vector unsigned int, - vector unsigned int, int); -vector short vec_xxpermdi (vector short, vector short, int); -vector unsigned short vec_xxpermdi (vector unsigned short, - vector unsigned short, int); -vector signed char vec_xxpermdi (vector signed char, vector signed char, int); -vector unsigned char vec_xxpermdi (vector unsigned char, - vector unsigned char, int); - -vector double vec_xxsldi (vector double, vector double, int); -vector float vec_xxsldi (vector float, vector float, int); -vector long long vec_xxsldi (vector long long, vector long long, int); -vector unsigned long long vec_xxsldi (vector unsigned long long, - vector unsigned long long, int); -vector int vec_xxsldi (vector int, vector int, int); -vector unsigned int vec_xxsldi (vector unsigned int, vector unsigned int, int); -vector short vec_xxsldi (vector short, vector short, int); -vector unsigned short vec_xxsldi (vector unsigned short, - vector unsigned short, int); -vector signed char vec_xxsldi (vector signed char, vector signed char, int); -vector unsigned char vec_xxsldi (vector unsigned char, - vector unsigned char, int); -@end smallexample - -Note that the @samp{vec_ld} and @samp{vec_st} built-in functions always -generate the AltiVec @samp{LVX} and @samp{STVX} instructions even -if the VSX instruction set is available. The @samp{vec_vsx_ld} and -@samp{vec_vsx_st} built-in functions always generate the VSX @samp{LXVD2X}, -@samp{LXVW4X}, @samp{STXVD2X}, and @samp{STXVW4X} instructions. - -If the ISA 2.07 additions to the vector/scalar (power8-vector) -instruction set is available, the following additional functions are -available for both 32-bit and 64-bit targets. For 64-bit targets, you -can use @var{vector long} instead of @var{vector long long}, -@var{vector bool long} instead of @var{vector bool long long}, and -@var{vector unsigned long} instead of @var{vector unsigned long long}. - -@smallexample -vector long long vec_abs (vector long long); - -vector long long vec_add (vector long long, vector long long); -vector unsigned long long vec_add (vector unsigned long long, - vector unsigned long long); - -int vec_all_eq (vector long long, vector long long); -int vec_all_eq (vector unsigned long long, vector unsigned long long); -int vec_all_ge (vector long long, vector long long); -int vec_all_ge (vector unsigned long long, vector unsigned long long); -int vec_all_gt (vector long long, vector long long); -int vec_all_gt (vector unsigned long long, vector unsigned long long); -int vec_all_le (vector long long, vector long long); -int vec_all_le (vector unsigned long long, vector unsigned long long); -int vec_all_lt (vector long long, vector long long); -int vec_all_lt (vector unsigned long long, vector unsigned long long); -int vec_all_ne (vector long long, vector long long); -int vec_all_ne (vector unsigned long long, vector unsigned long long); - -int vec_any_eq (vector long long, vector long long); -int vec_any_eq (vector unsigned long long, vector unsigned long long); -int vec_any_ge (vector long long, vector long long); -int vec_any_ge (vector unsigned long long, vector unsigned long long); -int vec_any_gt (vector long long, vector long long); -int vec_any_gt (vector unsigned long long, vector unsigned long long); -int vec_any_le (vector long long, vector long long); -int vec_any_le (vector unsigned long long, vector unsigned long long); -int vec_any_lt (vector long long, vector long long); -int vec_any_lt (vector unsigned long long, vector unsigned long long); -int vec_any_ne (vector long long, vector long long); -int vec_any_ne (vector unsigned long long, vector unsigned long long); - -vector long long vec_eqv (vector long long, vector long long); -vector long long vec_eqv (vector bool long long, vector long long); -vector long long vec_eqv (vector long long, vector bool long long); -vector unsigned long long vec_eqv (vector unsigned long long, - vector unsigned long long); -vector unsigned long long vec_eqv (vector bool long long, - vector unsigned long long); -vector unsigned long long vec_eqv (vector unsigned long long, - vector bool long long); -vector int vec_eqv (vector int, vector int); -vector int vec_eqv (vector bool int, vector int); -vector int vec_eqv (vector int, vector bool int); -vector unsigned int vec_eqv (vector unsigned int, vector unsigned int); -vector unsigned int vec_eqv (vector bool unsigned int, - vector unsigned int); -vector unsigned int vec_eqv (vector unsigned int, - vector bool unsigned int); -vector short vec_eqv (vector short, vector short); -vector short vec_eqv (vector bool short, vector short); -vector short vec_eqv (vector short, vector bool short); -vector unsigned short vec_eqv (vector unsigned short, vector unsigned short); -vector unsigned short vec_eqv (vector bool unsigned short, - vector unsigned short); -vector unsigned short vec_eqv (vector unsigned short, - vector bool unsigned short); -vector signed char vec_eqv (vector signed char, vector signed char); -vector signed char vec_eqv (vector bool signed char, vector signed char); -vector signed char vec_eqv (vector signed char, vector bool signed char); -vector unsigned char vec_eqv (vector unsigned char, vector unsigned char); -vector unsigned char vec_eqv (vector bool unsigned char, vector unsigned char); -vector unsigned char vec_eqv (vector unsigned char, vector bool unsigned char); - -vector long long vec_max (vector long long, vector long long); -vector unsigned long long vec_max (vector unsigned long long, - vector unsigned long long); - -vector signed int vec_mergee (vector signed int, vector signed int); -vector unsigned int vec_mergee (vector unsigned int, vector unsigned int); -vector bool int vec_mergee (vector bool int, vector bool int); - -vector signed int vec_mergeo (vector signed int, vector signed int); -vector unsigned int vec_mergeo (vector unsigned int, vector unsigned int); -vector bool int vec_mergeo (vector bool int, vector bool int); - -vector long long vec_min (vector long long, vector long long); -vector unsigned long long vec_min (vector unsigned long long, - vector unsigned long long); - -vector long long vec_nand (vector long long, vector long long); -vector long long vec_nand (vector bool long long, vector long long); -vector long long vec_nand (vector long long, vector bool long long); -vector unsigned long long vec_nand (vector unsigned long long, - vector unsigned long long); -vector unsigned long long vec_nand (vector bool long long, - vector unsigned long long); -vector unsigned long long vec_nand (vector unsigned long long, - vector bool long long); -vector int vec_nand (vector int, vector int); -vector int vec_nand (vector bool int, vector int); -vector int vec_nand (vector int, vector bool int); -vector unsigned int vec_nand (vector unsigned int, vector unsigned int); -vector unsigned int vec_nand (vector bool unsigned int, - vector unsigned int); -vector unsigned int vec_nand (vector unsigned int, - vector bool unsigned int); -vector short vec_nand (vector short, vector short); -vector short vec_nand (vector bool short, vector short); -vector short vec_nand (vector short, vector bool short); -vector unsigned short vec_nand (vector unsigned short, vector unsigned short); -vector unsigned short vec_nand (vector bool unsigned short, - vector unsigned short); -vector unsigned short vec_nand (vector unsigned short, - vector bool unsigned short); -vector signed char vec_nand (vector signed char, vector signed char); -vector signed char vec_nand (vector bool signed char, vector signed char); -vector signed char vec_nand (vector signed char, vector bool signed char); -vector unsigned char vec_nand (vector unsigned char, vector unsigned char); -vector unsigned char vec_nand (vector bool unsigned char, vector unsigned char); -vector unsigned char vec_nand (vector unsigned char, vector bool unsigned char); - -vector long long vec_orc (vector long long, vector long long); -vector long long vec_orc (vector bool long long, vector long long); -vector long long vec_orc (vector long long, vector bool long long); -vector unsigned long long vec_orc (vector unsigned long long, - vector unsigned long long); -vector unsigned long long vec_orc (vector bool long long, - vector unsigned long long); -vector unsigned long long vec_orc (vector unsigned long long, - vector bool long long); -vector int vec_orc (vector int, vector int); -vector int vec_orc (vector bool int, vector int); -vector int vec_orc (vector int, vector bool int); -vector unsigned int vec_orc (vector unsigned int, vector unsigned int); -vector unsigned int vec_orc (vector bool unsigned int, - vector unsigned int); -vector unsigned int vec_orc (vector unsigned int, - vector bool unsigned int); -vector short vec_orc (vector short, vector short); -vector short vec_orc (vector bool short, vector short); -vector short vec_orc (vector short, vector bool short); -vector unsigned short vec_orc (vector unsigned short, vector unsigned short); -vector unsigned short vec_orc (vector bool unsigned short, - vector unsigned short); -vector unsigned short vec_orc (vector unsigned short, - vector bool unsigned short); -vector signed char vec_orc (vector signed char, vector signed char); -vector signed char vec_orc (vector bool signed char, vector signed char); -vector signed char vec_orc (vector signed char, vector bool signed char); -vector unsigned char vec_orc (vector unsigned char, vector unsigned char); -vector unsigned char vec_orc (vector bool unsigned char, vector unsigned char); -vector unsigned char vec_orc (vector unsigned char, vector bool unsigned char); - -vector int vec_pack (vector long long, vector long long); -vector unsigned int vec_pack (vector unsigned long long, - vector unsigned long long); -vector bool int vec_pack (vector bool long long, vector bool long long); - -vector int vec_packs (vector long long, vector long long); -vector unsigned int vec_packs (vector unsigned long long, - vector unsigned long long); - -vector unsigned int vec_packsu (vector long long, vector long long); -vector unsigned int vec_packsu (vector unsigned long long, - vector unsigned long long); - -vector long long vec_rl (vector long long, - vector unsigned long long); -vector long long vec_rl (vector unsigned long long, - vector unsigned long long); - -vector long long vec_sl (vector long long, vector unsigned long long); -vector long long vec_sl (vector unsigned long long, - vector unsigned long long); - -vector long long vec_sr (vector long long, vector unsigned long long); -vector unsigned long long char vec_sr (vector unsigned long long, - vector unsigned long long); - -vector long long vec_sra (vector long long, vector unsigned long long); -vector unsigned long long vec_sra (vector unsigned long long, - vector unsigned long long); - -vector long long vec_sub (vector long long, vector long long); -vector unsigned long long vec_sub (vector unsigned long long, - vector unsigned long long); - -vector long long vec_unpackh (vector int); -vector unsigned long long vec_unpackh (vector unsigned int); - -vector long long vec_unpackl (vector int); -vector unsigned long long vec_unpackl (vector unsigned int); - -vector long long vec_vaddudm (vector long long, vector long long); -vector long long vec_vaddudm (vector bool long long, vector long long); -vector long long vec_vaddudm (vector long long, vector bool long long); -vector unsigned long long vec_vaddudm (vector unsigned long long, - vector unsigned long long); -vector unsigned long long vec_vaddudm (vector bool unsigned long long, - vector unsigned long long); -vector unsigned long long vec_vaddudm (vector unsigned long long, - vector bool unsigned long long); - -vector long long vec_vbpermq (vector signed char, vector signed char); -vector long long vec_vbpermq (vector unsigned char, vector unsigned char); - -vector long long vec_cntlz (vector long long); -vector unsigned long long vec_cntlz (vector unsigned long long); -vector int vec_cntlz (vector int); -vector unsigned int vec_cntlz (vector int); -vector short vec_cntlz (vector short); -vector unsigned short vec_cntlz (vector unsigned short); -vector signed char vec_cntlz (vector signed char); -vector unsigned char vec_cntlz (vector unsigned char); - -vector long long vec_vclz (vector long long); -vector unsigned long long vec_vclz (vector unsigned long long); -vector int vec_vclz (vector int); -vector unsigned int vec_vclz (vector int); -vector short vec_vclz (vector short); -vector unsigned short vec_vclz (vector unsigned short); -vector signed char vec_vclz (vector signed char); -vector unsigned char vec_vclz (vector unsigned char); - -vector signed char vec_vclzb (vector signed char); -vector unsigned char vec_vclzb (vector unsigned char); - -vector long long vec_vclzd (vector long long); -vector unsigned long long vec_vclzd (vector unsigned long long); - -vector short vec_vclzh (vector short); -vector unsigned short vec_vclzh (vector unsigned short); - -vector int vec_vclzw (vector int); -vector unsigned int vec_vclzw (vector int); - -vector signed char vec_vgbbd (vector signed char); -vector unsigned char vec_vgbbd (vector unsigned char); - -vector long long vec_vmaxsd (vector long long, vector long long); - -vector unsigned long long vec_vmaxud (vector unsigned long long, - unsigned vector long long); - -vector long long vec_vminsd (vector long long, vector long long); - -vector unsigned long long vec_vminud (vector long long, - vector long long); - -vector int vec_vpksdss (vector long long, vector long long); -vector unsigned int vec_vpksdss (vector long long, vector long long); - -vector unsigned int vec_vpkudus (vector unsigned long long, - vector unsigned long long); - -vector int vec_vpkudum (vector long long, vector long long); -vector unsigned int vec_vpkudum (vector unsigned long long, - vector unsigned long long); -vector bool int vec_vpkudum (vector bool long long, vector bool long long); - -vector long long vec_vpopcnt (vector long long); -vector unsigned long long vec_vpopcnt (vector unsigned long long); -vector int vec_vpopcnt (vector int); -vector unsigned int vec_vpopcnt (vector int); -vector short vec_vpopcnt (vector short); -vector unsigned short vec_vpopcnt (vector unsigned short); -vector signed char vec_vpopcnt (vector signed char); -vector unsigned char vec_vpopcnt (vector unsigned char); - -vector signed char vec_vpopcntb (vector signed char); -vector unsigned char vec_vpopcntb (vector unsigned char); - -vector long long vec_vpopcntd (vector long long); -vector unsigned long long vec_vpopcntd (vector unsigned long long); - -vector short vec_vpopcnth (vector short); -vector unsigned short vec_vpopcnth (vector unsigned short); - -vector int vec_vpopcntw (vector int); -vector unsigned int vec_vpopcntw (vector int); - -vector long long vec_vrld (vector long long, vector unsigned long long); -vector unsigned long long vec_vrld (vector unsigned long long, - vector unsigned long long); - -vector long long vec_vsld (vector long long, vector unsigned long long); -vector long long vec_vsld (vector unsigned long long, - vector unsigned long long); - -vector long long vec_vsrad (vector long long, vector unsigned long long); -vector unsigned long long vec_vsrad (vector unsigned long long, - vector unsigned long long); - -vector long long vec_vsrd (vector long long, vector unsigned long long); -vector unsigned long long char vec_vsrd (vector unsigned long long, - vector unsigned long long); - -vector long long vec_vsubudm (vector long long, vector long long); -vector long long vec_vsubudm (vector bool long long, vector long long); -vector long long vec_vsubudm (vector long long, vector bool long long); -vector unsigned long long vec_vsubudm (vector unsigned long long, - vector unsigned long long); -vector unsigned long long vec_vsubudm (vector bool long long, - vector unsigned long long); -vector unsigned long long vec_vsubudm (vector unsigned long long, - vector bool long long); - -vector long long vec_vupkhsw (vector int); -vector unsigned long long vec_vupkhsw (vector unsigned int); - -vector long long vec_vupklsw (vector int); -vector unsigned long long vec_vupklsw (vector int); -@end smallexample - -If the ISA 2.07 additions to the vector/scalar (power8-vector) -instruction set is available, the following additional functions are -available for 64-bit targets. New vector types -(@var{vector __int128_t} and @var{vector __uint128_t}) are available -to hold the @var{__int128_t} and @var{__uint128_t} types to use these -builtins. - -The normal vector extract, and set operations work on -@var{vector __int128_t} and @var{vector __uint128_t} types, -but the index value must be 0. - -@smallexample -vector __int128_t vec_vaddcuq (vector __int128_t, vector __int128_t); -vector __uint128_t vec_vaddcuq (vector __uint128_t, vector __uint128_t); - -vector __int128_t vec_vadduqm (vector __int128_t, vector __int128_t); -vector __uint128_t vec_vadduqm (vector __uint128_t, vector __uint128_t); - -vector __int128_t vec_vaddecuq (vector __int128_t, vector __int128_t, - vector __int128_t); -vector __uint128_t vec_vaddecuq (vector __uint128_t, vector __uint128_t, - vector __uint128_t); - -vector __int128_t vec_vaddeuqm (vector __int128_t, vector __int128_t, - vector __int128_t); -vector __uint128_t vec_vaddeuqm (vector __uint128_t, vector __uint128_t, - vector __uint128_t); - -vector __int128_t vec_vsubecuq (vector __int128_t, vector __int128_t, - vector __int128_t); -vector __uint128_t vec_vsubecuq (vector __uint128_t, vector __uint128_t, - vector __uint128_t); - -vector __int128_t vec_vsubeuqm (vector __int128_t, vector __int128_t, - vector __int128_t); -vector __uint128_t vec_vsubeuqm (vector __uint128_t, vector __uint128_t, - vector __uint128_t); - -vector __int128_t vec_vsubcuq (vector __int128_t, vector __int128_t); -vector __uint128_t vec_vsubcuq (vector __uint128_t, vector __uint128_t); - -__int128_t vec_vsubuqm (__int128_t, __int128_t); -__uint128_t vec_vsubuqm (__uint128_t, __uint128_t); - -vector __int128_t __builtin_bcdadd (vector __int128_t, vector__int128_t); -int __builtin_bcdadd_lt (vector __int128_t, vector__int128_t); -int __builtin_bcdadd_eq (vector __int128_t, vector__int128_t); -int __builtin_bcdadd_gt (vector __int128_t, vector__int128_t); -int __builtin_bcdadd_ov (vector __int128_t, vector__int128_t); -vector __int128_t bcdsub (vector __int128_t, vector__int128_t); -int __builtin_bcdsub_lt (vector __int128_t, vector__int128_t); -int __builtin_bcdsub_eq (vector __int128_t, vector__int128_t); -int __builtin_bcdsub_gt (vector __int128_t, vector__int128_t); -int __builtin_bcdsub_ov (vector __int128_t, vector__int128_t); -@end smallexample - -If the cryptographic instructions are enabled (@option{-mcrypto} or -@option{-mcpu=power8}), the following builtins are enabled. - -@smallexample -vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long); - -vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long, - vector unsigned long long); - -vector unsigned long long __builtin_crypto_vcipherlast - (vector unsigned long long, - vector unsigned long long); - -vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long, - vector unsigned long long); - -vector unsigned long long __builtin_crypto_vncipherlast - (vector unsigned long long, - vector unsigned long long); - -vector unsigned char __builtin_crypto_vpermxor (vector unsigned char, - vector unsigned char, - vector unsigned char); - -vector unsigned short __builtin_crypto_vpermxor (vector unsigned short, - vector unsigned short, - vector unsigned short); - -vector unsigned int __builtin_crypto_vpermxor (vector unsigned int, - vector unsigned int, - vector unsigned int); - -vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long, - vector unsigned long long, - vector unsigned long long); - -vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char, - vector unsigned char); - -vector unsigned short __builtin_crypto_vpmsumb (vector unsigned short, - vector unsigned short); - -vector unsigned int __builtin_crypto_vpmsumb (vector unsigned int, - vector unsigned int); - -vector unsigned long long __builtin_crypto_vpmsumb (vector unsigned long long, - vector unsigned long long); - -vector unsigned long long __builtin_crypto_vshasigmad - (vector unsigned long long, int, int); - -vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int, - int, int); -@end smallexample - -The second argument to the @var{__builtin_crypto_vshasigmad} and -@var{__builtin_crypto_vshasigmaw} builtin functions must be a constant -integer that is 0 or 1. The third argument to these builtin functions -must be a constant integer in the range of 0 to 15. - -@node PowerPC Hardware Transactional Memory Built-in Functions -@subsection PowerPC Hardware Transactional Memory Built-in Functions -GCC provides two interfaces for accessing the Hardware Transactional -Memory (HTM) instructions available on some of the PowerPC family -of processors (eg, POWER8). The two interfaces come in a low level -interface, consisting of built-in functions specific to PowerPC and a -higher level interface consisting of inline functions that are common -between PowerPC and S/390. - -@subsubsection PowerPC HTM Low Level Built-in Functions - -The following low level built-in functions are available with -@option{-mhtm} or @option{-mcpu=CPU} where CPU is `power8' or later. -They all generate the machine instruction that is part of the name. - -The HTM built-ins return true or false depending on their success and -their arguments match exactly the type and order of the associated -hardware instruction's operands. Refer to the ISA manual for a -description of each instruction's operands. - -@smallexample -unsigned int __builtin_tbegin (unsigned int) -unsigned int __builtin_tend (unsigned int) - -unsigned int __builtin_tabort (unsigned int) -unsigned int __builtin_tabortdc (unsigned int, unsigned int, unsigned int) -unsigned int __builtin_tabortdci (unsigned int, unsigned int, int) -unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int) -unsigned int __builtin_tabortwci (unsigned int, unsigned int, int) - -unsigned int __builtin_tcheck (unsigned int) -unsigned int __builtin_treclaim (unsigned int) -unsigned int __builtin_trechkpt (void) -unsigned int __builtin_tsr (unsigned int) -@end smallexample - -In addition to the above HTM built-ins, we have added built-ins for -some common extended mnemonics of the HTM instructions: - -@smallexample -unsigned int __builtin_tendall (void) -unsigned int __builtin_tresume (void) -unsigned int __builtin_tsuspend (void) -@end smallexample - -The following set of built-in functions are available to gain access -to the HTM specific special purpose registers. - -@smallexample -unsigned long __builtin_get_texasr (void) -unsigned long __builtin_get_texasru (void) -unsigned long __builtin_get_tfhar (void) -unsigned long __builtin_get_tfiar (void) - -void __builtin_set_texasr (unsigned long); -void __builtin_set_texasru (unsigned long); -void __builtin_set_tfhar (unsigned long); -void __builtin_set_tfiar (unsigned long); -@end smallexample - -Example usage of these low level built-in functions may look like: - -@smallexample -#include - -int num_retries = 10; - -while (1) - @{ - if (__builtin_tbegin (0)) - @{ - /* Transaction State Initiated. */ - if (is_locked (lock)) - __builtin_tabort (0); - ... transaction code... - __builtin_tend (0); - break; - @} - else - @{ - /* Transaction State Failed. Use locks if the transaction - failure is "persistent" or we've tried too many times. */ - if (num_retries-- <= 0 - || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) - @{ - acquire_lock (lock); - ... non transactional fallback path... - release_lock (lock); - break; - @} - @} - @} -@end smallexample - -One final built-in function has been added that returns the value of -the 2-bit Transaction State field of the Machine Status Register (MSR) -as stored in @code{CR0}. - -@smallexample -unsigned long __builtin_ttest (void) -@end smallexample - -This built-in can be used to determine the current transaction state -using the following code example: - -@smallexample -#include - -unsigned char tx_state = _HTM_STATE (__builtin_ttest ()); - -if (tx_state == _HTM_TRANSACTIONAL) - @{ - /* Code to use in transactional state. */ - @} -else if (tx_state == _HTM_NONTRANSACTIONAL) - @{ - /* Code to use in non-transactional state. */ - @} -else if (tx_state == _HTM_SUSPENDED) - @{ - /* Code to use in transaction suspended state. */ - @} -@end smallexample - -@subsubsection PowerPC HTM High Level Inline Functions - -The following high level HTM interface is made available by including -@code{} and using @option{-mhtm} or @option{-mcpu=CPU} -where CPU is `power8' or later. This interface is common between PowerPC -and S/390, allowing users to write one HTM source implementation that -can be compiled and executed on either system. - -@smallexample -long __TM_simple_begin (void) -long __TM_begin (void* const TM_buff) -long __TM_end (void) -void __TM_abort (void) -void __TM_named_abort (unsigned char const code) -void __TM_resume (void) -void __TM_suspend (void) - -long __TM_is_user_abort (void* const TM_buff) -long __TM_is_named_user_abort (void* const TM_buff, unsigned char *code) -long __TM_is_illegal (void* const TM_buff) -long __TM_is_footprint_exceeded (void* const TM_buff) -long __TM_nesting_depth (void* const TM_buff) -long __TM_is_nested_too_deep(void* const TM_buff) -long __TM_is_conflict(void* const TM_buff) -long __TM_is_failure_persistent(void* const TM_buff) -long __TM_failure_address(void* const TM_buff) -long long __TM_failure_code(void* const TM_buff) -@end smallexample - -Using these common set of HTM inline functions, we can create -a more portable version of the HTM example in the previous -section that will work on either PowerPC or S/390: - -@smallexample -#include - -int num_retries = 10; -TM_buff_type TM_buff; - -while (1) - @{ - if (__TM_begin (TM_buff)) - @{ - /* Transaction State Initiated. */ - if (is_locked (lock)) - __TM_abort (); - ... transaction code... - __TM_end (); - break; - @} - else - @{ - /* Transaction State Failed. Use locks if the transaction - failure is "persistent" or we've tried too many times. */ - if (num_retries-- <= 0 - || __TM_is_failure_persistent (TM_buff)) - @{ - acquire_lock (lock); - ... non transactional fallback path... - release_lock (lock); - break; - @} - @} - @} -@end smallexample - -@node RX Built-in Functions -@subsection RX Built-in Functions -GCC supports some of the RX instructions which cannot be expressed in -the C programming language via the use of built-in functions. The -following functions are supported: - -@deftypefn {Built-in Function} void __builtin_rx_brk (void) -Generates the @code{brk} machine instruction. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_clrpsw (int) -Generates the @code{clrpsw} machine instruction to clear the specified -bit in the processor status word. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_int (int) -Generates the @code{int} machine instruction to generate an interrupt -with the specified value. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_machi (int, int) -Generates the @code{machi} machine instruction to add the result of -multiplying the top 16 bits of the two arguments into the -accumulator. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_maclo (int, int) -Generates the @code{maclo} machine instruction to add the result of -multiplying the bottom 16 bits of the two arguments into the -accumulator. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mulhi (int, int) -Generates the @code{mulhi} machine instruction to place the result of -multiplying the top 16 bits of the two arguments into the -accumulator. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mullo (int, int) -Generates the @code{mullo} machine instruction to place the result of -multiplying the bottom 16 bits of the two arguments into the -accumulator. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_rx_mvfachi (void) -Generates the @code{mvfachi} machine instruction to read the top -32 bits of the accumulator. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_rx_mvfacmi (void) -Generates the @code{mvfacmi} machine instruction to read the middle -32 bits of the accumulator. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_rx_mvfc (int) -Generates the @code{mvfc} machine instruction which reads the control -register specified in its argument and returns its value. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mvtachi (int) -Generates the @code{mvtachi} machine instruction to set the top -32 bits of the accumulator. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mvtaclo (int) -Generates the @code{mvtaclo} machine instruction to set the bottom -32 bits of the accumulator. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mvtc (int reg, int val) -Generates the @code{mvtc} machine instruction which sets control -register number @code{reg} to @code{val}. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_mvtipl (int) -Generates the @code{mvtipl} machine instruction set the interrupt -priority level. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_racw (int) -Generates the @code{racw} machine instruction to round the accumulator -according to the specified mode. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_rx_revw (int) -Generates the @code{revw} machine instruction which swaps the bytes in -the argument so that bits 0--7 now occupy bits 8--15 and vice versa, -and also bits 16--23 occupy bits 24--31 and vice versa. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_rmpa (void) -Generates the @code{rmpa} machine instruction which initiates a -repeated multiply and accumulate sequence. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_round (float) -Generates the @code{round} machine instruction which returns the -floating-point argument rounded according to the current rounding mode -set in the floating-point status word register. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_rx_sat (int) -Generates the @code{sat} machine instruction which returns the -saturated value of the argument. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_setpsw (int) -Generates the @code{setpsw} machine instruction to set the specified -bit in the processor status word. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_rx_wait (void) -Generates the @code{wait} machine instruction. -@end deftypefn - -@node S/390 System z Built-in Functions -@subsection S/390 System z Built-in Functions -@deftypefn {Built-in Function} int __builtin_tbegin (void*) -Generates the @code{tbegin} machine instruction starting a -non-constraint hardware transaction. If the parameter is non-NULL the -memory area is used to store the transaction diagnostic buffer and -will be passed as first operand to @code{tbegin}. This buffer can be -defined using the @code{struct __htm_tdb} C struct defined in -@code{htmintrin.h} and must reside on a double-word boundary. The -second tbegin operand is set to @code{0xff0c}. This enables -save/restore of all GPRs and disables aborts for FPR and AR -manipulations inside the transaction body. The condition code set by -the tbegin instruction is returned as integer value. The tbegin -instruction by definition overwrites the content of all FPRs. The -compiler will generate code which saves and restores the FPRs. For -soft-float code it is recommended to used the @code{*_nofloat} -variant. In order to prevent a TDB from being written it is required -to pass an constant zero value as parameter. Passing the zero value -through a variable is not sufficient. Although modifications of -access registers inside the transaction will not trigger an -transaction abort it is not supported to actually modify them. Access -registers do not get saved when entering a transaction. They will have -undefined state when reaching the abort code. -@end deftypefn - -Macros for the possible return codes of tbegin are defined in the -@code{htmintrin.h} header file: - -@table @code -@item _HTM_TBEGIN_STARTED -@code{tbegin} has been executed as part of normal processing. The -transaction body is supposed to be executed. -@item _HTM_TBEGIN_INDETERMINATE -The transaction was aborted due to an indeterminate condition which -might be persistent. -@item _HTM_TBEGIN_TRANSIENT -The transaction aborted due to a transient failure. The transaction -should be re-executed in that case. -@item _HTM_TBEGIN_PERSISTENT -The transaction aborted due to a persistent failure. Re-execution -under same circumstances will not be productive. -@end table - -@defmac _HTM_FIRST_USER_ABORT_CODE -The @code{_HTM_FIRST_USER_ABORT_CODE} defined in @code{htmintrin.h} -specifies the first abort code which can be used for -@code{__builtin_tabort}. Values below this threshold are reserved for -machine use. -@end defmac - -@deftp {Data type} {struct __htm_tdb} -The @code{struct __htm_tdb} defined in @code{htmintrin.h} describes -the structure of the transaction diagnostic block as specified in the -Principles of Operation manual chapter 5-91. -@end deftp - -@deftypefn {Built-in Function} int __builtin_tbegin_nofloat (void*) -Same as @code{__builtin_tbegin} but without FPR saves and restores. -Using this variant in code making use of FPRs will leave the FPRs in -undefined state when entering the transaction abort handler code. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_tbegin_retry (void*, int) -In addition to @code{__builtin_tbegin} a loop for transient failures -is generated. If tbegin returns a condition code of 2 the transaction -will be retried as often as specified in the second argument. The -perform processor assist instruction is used to tell the CPU about the -number of fails so far. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_tbegin_retry_nofloat (void*, int) -Same as @code{__builtin_tbegin_retry} but without FPR saves and -restores. Using this variant in code making use of FPRs will leave -the FPRs in undefined state when entering the transaction abort -handler code. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_tbeginc (void) -Generates the @code{tbeginc} machine instruction starting a constraint -hardware transaction. The second operand is set to @code{0xff08}. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_tend (void) -Generates the @code{tend} machine instruction finishing a transaction -and making the changes visible to other threads. The condition code -generated by tend is returned as integer value. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_tabort (int) -Generates the @code{tabort} machine instruction with the specified -abort code. Abort codes from 0 through 255 are reserved and will -result in an error message. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_tx_assist (int) -Generates the @code{ppa rX,rY,1} machine instruction. Where the -integer parameter is loaded into rX and a value of zero is loaded into -rY. The integer parameter specifies the number of times the -transaction repeatedly aborted. -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_tx_nesting_depth (void) -Generates the @code{etnd} machine instruction. The current nesting -depth is returned as integer value. For a nesting depth of 0 the code -is not executed as part of an transaction. -@end deftypefn - -@deftypefn {Built-in Function} void __builtin_non_tx_store (uint64_t *, uint64_t) - -Generates the @code{ntstg} machine instruction. The second argument -is written to the first arguments location. The store operation will -not be rolled-back in case of an transaction abort. -@end deftypefn - -@node SH Built-in Functions -@subsection SH Built-in Functions -The following built-in functions are supported on the SH1, SH2, SH3 and SH4 -families of processors: - -@deftypefn {Built-in Function} {void} __builtin_set_thread_pointer (void *@var{ptr}) -Sets the @samp{GBR} register to the specified value @var{ptr}. This is usually -used by system code that manages threads and execution contexts. The compiler -normally does not generate code that modifies the contents of @samp{GBR} and -thus the value is preserved across function calls. Changing the @samp{GBR} -value in user code must be done with caution, since the compiler might use -@samp{GBR} in order to access thread local variables. - -@end deftypefn - -@deftypefn {Built-in Function} {void *} __builtin_thread_pointer (void) -Returns the value that is currently set in the @samp{GBR} register. -Memory loads and stores that use the thread pointer as a base address are -turned into @samp{GBR} based displacement loads and stores, if possible. -For example: -@smallexample -struct my_tcb -@{ - int a, b, c, d, e; -@}; - -int get_tcb_value (void) -@{ - // Generate @samp{mov.l @@(8,gbr),r0} instruction - return ((my_tcb*)__builtin_thread_pointer ())->c; -@} - -@end smallexample -@end deftypefn - -@deftypefn {Built-in Function} {unsigned int} __builtin_sh_get_fpscr (void) -Returns the value that is currently set in the @samp{FPSCR} register. -@end deftypefn - -@deftypefn {Built-in Function} {void} __builtin_sh_set_fpscr (unsigned int @var{val}) -Sets the @samp{FPSCR} register to the specified value @var{val}, while -preserving the current values of the FR, SZ and PR bits. -@end deftypefn - -@node SPARC VIS Built-in Functions -@subsection SPARC VIS Built-in Functions - -GCC supports SIMD operations on the SPARC using both the generic vector -extensions (@pxref{Vector Extensions}) as well as built-in functions for -the SPARC Visual Instruction Set (VIS). When you use the @option{-mvis} -switch, the VIS extension is exposed as the following built-in functions: - -@smallexample -typedef int v1si __attribute__ ((vector_size (4))); -typedef int v2si __attribute__ ((vector_size (8))); -typedef short v4hi __attribute__ ((vector_size (8))); -typedef short v2hi __attribute__ ((vector_size (4))); -typedef unsigned char v8qi __attribute__ ((vector_size (8))); -typedef unsigned char v4qi __attribute__ ((vector_size (4))); - -void __builtin_vis_write_gsr (int64_t); -int64_t __builtin_vis_read_gsr (void); - -void * __builtin_vis_alignaddr (void *, long); -void * __builtin_vis_alignaddrl (void *, long); -int64_t __builtin_vis_faligndatadi (int64_t, int64_t); -v2si __builtin_vis_faligndatav2si (v2si, v2si); -v4hi __builtin_vis_faligndatav4hi (v4si, v4si); -v8qi __builtin_vis_faligndatav8qi (v8qi, v8qi); - -v4hi __builtin_vis_fexpand (v4qi); - -v4hi __builtin_vis_fmul8x16 (v4qi, v4hi); -v4hi __builtin_vis_fmul8x16au (v4qi, v2hi); -v4hi __builtin_vis_fmul8x16al (v4qi, v2hi); -v4hi __builtin_vis_fmul8sux16 (v8qi, v4hi); -v4hi __builtin_vis_fmul8ulx16 (v8qi, v4hi); -v2si __builtin_vis_fmuld8sux16 (v4qi, v2hi); -v2si __builtin_vis_fmuld8ulx16 (v4qi, v2hi); - -v4qi __builtin_vis_fpack16 (v4hi); -v8qi __builtin_vis_fpack32 (v2si, v8qi); -v2hi __builtin_vis_fpackfix (v2si); -v8qi __builtin_vis_fpmerge (v4qi, v4qi); - -int64_t __builtin_vis_pdist (v8qi, v8qi, int64_t); - -long __builtin_vis_edge8 (void *, void *); -long __builtin_vis_edge8l (void *, void *); -long __builtin_vis_edge16 (void *, void *); -long __builtin_vis_edge16l (void *, void *); -long __builtin_vis_edge32 (void *, void *); -long __builtin_vis_edge32l (void *, void *); - -long __builtin_vis_fcmple16 (v4hi, v4hi); -long __builtin_vis_fcmple32 (v2si, v2si); -long __builtin_vis_fcmpne16 (v4hi, v4hi); -long __builtin_vis_fcmpne32 (v2si, v2si); -long __builtin_vis_fcmpgt16 (v4hi, v4hi); -long __builtin_vis_fcmpgt32 (v2si, v2si); -long __builtin_vis_fcmpeq16 (v4hi, v4hi); -long __builtin_vis_fcmpeq32 (v2si, v2si); - -v4hi __builtin_vis_fpadd16 (v4hi, v4hi); -v2hi __builtin_vis_fpadd16s (v2hi, v2hi); -v2si __builtin_vis_fpadd32 (v2si, v2si); -v1si __builtin_vis_fpadd32s (v1si, v1si); -v4hi __builtin_vis_fpsub16 (v4hi, v4hi); -v2hi __builtin_vis_fpsub16s (v2hi, v2hi); -v2si __builtin_vis_fpsub32 (v2si, v2si); -v1si __builtin_vis_fpsub32s (v1si, v1si); - -long __builtin_vis_array8 (long, long); -long __builtin_vis_array16 (long, long); -long __builtin_vis_array32 (long, long); -@end smallexample - -When you use the @option{-mvis2} switch, the VIS version 2.0 built-in -functions also become available: - -@smallexample -long __builtin_vis_bmask (long, long); -int64_t __builtin_vis_bshuffledi (int64_t, int64_t); -v2si __builtin_vis_bshufflev2si (v2si, v2si); -v4hi __builtin_vis_bshufflev2si (v4hi, v4hi); -v8qi __builtin_vis_bshufflev2si (v8qi, v8qi); - -long __builtin_vis_edge8n (void *, void *); -long __builtin_vis_edge8ln (void *, void *); -long __builtin_vis_edge16n (void *, void *); -long __builtin_vis_edge16ln (void *, void *); -long __builtin_vis_edge32n (void *, void *); -long __builtin_vis_edge32ln (void *, void *); -@end smallexample - -When you use the @option{-mvis3} switch, the VIS version 3.0 built-in -functions also become available: - -@smallexample -void __builtin_vis_cmask8 (long); -void __builtin_vis_cmask16 (long); -void __builtin_vis_cmask32 (long); - -v4hi __builtin_vis_fchksm16 (v4hi, v4hi); - -v4hi __builtin_vis_fsll16 (v4hi, v4hi); -v4hi __builtin_vis_fslas16 (v4hi, v4hi); -v4hi __builtin_vis_fsrl16 (v4hi, v4hi); -v4hi __builtin_vis_fsra16 (v4hi, v4hi); -v2si __builtin_vis_fsll16 (v2si, v2si); -v2si __builtin_vis_fslas16 (v2si, v2si); -v2si __builtin_vis_fsrl16 (v2si, v2si); -v2si __builtin_vis_fsra16 (v2si, v2si); - -long __builtin_vis_pdistn (v8qi, v8qi); - -v4hi __builtin_vis_fmean16 (v4hi, v4hi); - -int64_t __builtin_vis_fpadd64 (int64_t, int64_t); -int64_t __builtin_vis_fpsub64 (int64_t, int64_t); - -v4hi __builtin_vis_fpadds16 (v4hi, v4hi); -v2hi __builtin_vis_fpadds16s (v2hi, v2hi); -v4hi __builtin_vis_fpsubs16 (v4hi, v4hi); -v2hi __builtin_vis_fpsubs16s (v2hi, v2hi); -v2si __builtin_vis_fpadds32 (v2si, v2si); -v1si __builtin_vis_fpadds32s (v1si, v1si); -v2si __builtin_vis_fpsubs32 (v2si, v2si); -v1si __builtin_vis_fpsubs32s (v1si, v1si); - -long __builtin_vis_fucmple8 (v8qi, v8qi); -long __builtin_vis_fucmpne8 (v8qi, v8qi); -long __builtin_vis_fucmpgt8 (v8qi, v8qi); -long __builtin_vis_fucmpeq8 (v8qi, v8qi); - -float __builtin_vis_fhadds (float, float); -double __builtin_vis_fhaddd (double, double); -float __builtin_vis_fhsubs (float, float); -double __builtin_vis_fhsubd (double, double); -float __builtin_vis_fnhadds (float, float); -double __builtin_vis_fnhaddd (double, double); - -int64_t __builtin_vis_umulxhi (int64_t, int64_t); -int64_t __builtin_vis_xmulx (int64_t, int64_t); -int64_t __builtin_vis_xmulxhi (int64_t, int64_t); -@end smallexample - -@node SPU Built-in Functions -@subsection SPU Built-in Functions - -GCC provides extensions for the SPU processor as described in the -Sony/Toshiba/IBM SPU Language Extensions Specification, which can be -found at @uref{http://cell.scei.co.jp/} or -@uref{http://www.ibm.com/developerworks/power/cell/}. GCC's -implementation differs in several ways. - -@itemize @bullet - -@item -The optional extension of specifying vector constants in parentheses is -not supported. - -@item -A vector initializer requires no cast if the vector constant is of the -same type as the variable it is initializing. - -@item -If @code{signed} or @code{unsigned} is omitted, the signedness of the -vector type is the default signedness of the base type. The default -varies depending on the operating system, so a portable program should -always specify the signedness. - -@item -By default, the keyword @code{__vector} is added. The macro -@code{vector} is defined in @code{} and can be -undefined. - -@item -GCC allows using a @code{typedef} name as the type specifier for a -vector type. - -@item -For C, overloaded functions are implemented with macros so the following -does not work: - -@smallexample - spu_add ((vector signed int)@{1, 2, 3, 4@}, foo); -@end smallexample - -@noindent -Since @code{spu_add} is a macro, the vector constant in the example -is treated as four separate arguments. Wrap the entire argument in -parentheses for this to work. - -@item -The extended version of @code{__builtin_expect} is not supported. - -@end itemize - -@emph{Note:} Only the interface described in the aforementioned -specification is supported. Internally, GCC uses built-in functions to -implement the required functionality, but these are not supported and -are subject to change without notice. - -@node TI C6X Built-in Functions -@subsection TI C6X Built-in Functions - -GCC provides intrinsics to access certain instructions of the TI C6X -processors. These intrinsics, listed below, are available after -inclusion of the @code{c6x_intrinsics.h} header file. They map directly -to C6X instructions. - -@smallexample - -int _sadd (int, int) -int _ssub (int, int) -int _sadd2 (int, int) -int _ssub2 (int, int) -long long _mpy2 (int, int) -long long _smpy2 (int, int) -int _add4 (int, int) -int _sub4 (int, int) -int _saddu4 (int, int) - -int _smpy (int, int) -int _smpyh (int, int) -int _smpyhl (int, int) -int _smpylh (int, int) - -int _sshl (int, int) -int _subc (int, int) - -int _avg2 (int, int) -int _avgu4 (int, int) - -int _clrr (int, int) -int _extr (int, int) -int _extru (int, int) -int _abs (int) -int _abs2 (int) - -@end smallexample - -@node TILE-Gx Built-in Functions -@subsection TILE-Gx Built-in Functions - -GCC provides intrinsics to access every instruction of the TILE-Gx -processor. The intrinsics are of the form: - -@smallexample - -unsigned long long __insn_@var{op} (...) - -@end smallexample - -Where @var{op} is the name of the instruction. Refer to the ISA manual -for the complete list of instructions. - -GCC also provides intrinsics to directly access the network registers. -The intrinsics are: - -@smallexample - -unsigned long long __tile_idn0_receive (void) -unsigned long long __tile_idn1_receive (void) -unsigned long long __tile_udn0_receive (void) -unsigned long long __tile_udn1_receive (void) -unsigned long long __tile_udn2_receive (void) -unsigned long long __tile_udn3_receive (void) -void __tile_idn_send (unsigned long long) -void __tile_udn_send (unsigned long long) - -@end smallexample - -The intrinsic @code{void __tile_network_barrier (void)} is used to -guarantee that no network operations before it are reordered with -those after it. - -@node TILEPro Built-in Functions -@subsection TILEPro Built-in Functions - -GCC provides intrinsics to access every instruction of the TILEPro -processor. The intrinsics are of the form: - -@smallexample - -unsigned __insn_@var{op} (...) - -@end smallexample - -@noindent -where @var{op} is the name of the instruction. Refer to the ISA manual -for the complete list of instructions. - -GCC also provides intrinsics to directly access the network registers. -The intrinsics are: - -@smallexample - -unsigned __tile_idn0_receive (void) -unsigned __tile_idn1_receive (void) -unsigned __tile_sn_receive (void) -unsigned __tile_udn0_receive (void) -unsigned __tile_udn1_receive (void) -unsigned __tile_udn2_receive (void) -unsigned __tile_udn3_receive (void) -void __tile_idn_send (unsigned) -void __tile_sn_send (unsigned) -void __tile_udn_send (unsigned) - -@end smallexample - -The intrinsic @code{void __tile_network_barrier (void)} is used to -guarantee that no network operations before it are reordered with -those after it. - -@node x86 Built-in Functions -@subsection x86 Built-in Functions - -These built-in functions are available for the x86-32 and x86-64 family -of computers, depending on the command-line switches used. - -If you specify command-line switches such as @option{-msse}, -the compiler could use the extended instruction sets even if the built-ins -are not used explicitly in the program. For this reason, applications -that perform run-time CPU detection must compile separate files for each -supported architecture, using the appropriate flags. In particular, -the file containing the CPU detection code should be compiled without -these options. - -The following machine modes are available for use with MMX built-in functions -(@pxref{Vector Extensions}): @code{V2SI} for a vector of two 32-bit integers, -@code{V4HI} for a vector of four 16-bit integers, and @code{V8QI} for a -vector of eight 8-bit integers. Some of the built-in functions operate on -MMX registers as a whole 64-bit entity, these use @code{V1DI} as their mode. - -If 3DNow!@: extensions are enabled, @code{V2SF} is used as a mode for a vector -of two 32-bit floating-point values. - -If SSE extensions are enabled, @code{V4SF} is used for a vector of four 32-bit -floating-point values. Some instructions use a vector of four 32-bit -integers, these use @code{V4SI}. Finally, some instructions operate on an -entire vector register, interpreting it as a 128-bit integer, these use mode -@code{TI}. - -In 64-bit mode, the x86-64 family of processors uses additional built-in -functions for efficient use of @code{TF} (@code{__float128}) 128-bit -floating point and @code{TC} 128-bit complex floating-point values. - -The following floating-point built-in functions are available in 64-bit -mode. All of them implement the function that is part of the name. - -@smallexample -__float128 __builtin_fabsq (__float128) -__float128 __builtin_copysignq (__float128, __float128) -@end smallexample - -The following built-in function is always available. - -@table @code -@item void __builtin_ia32_pause (void) -Generates the @code{pause} machine instruction with a compiler memory -barrier. -@end table - -The following floating-point built-in functions are made available in the -64-bit mode. - -@table @code -@item __float128 __builtin_infq (void) -Similar to @code{__builtin_inf}, except the return type is @code{__float128}. -@findex __builtin_infq - -@item __float128 __builtin_huge_valq (void) -Similar to @code{__builtin_huge_val}, except the return type is @code{__float128}. -@findex __builtin_huge_valq -@end table - -The following built-in functions are always available and can be used to -check the target platform type. - -@deftypefn {Built-in Function} void __builtin_cpu_init (void) -This function runs the CPU detection code to check the type of CPU and the -features supported. This built-in function needs to be invoked along with the built-in functions -to check CPU type and features, @code{__builtin_cpu_is} and -@code{__builtin_cpu_supports}, only when used in a function that is -executed before any constructors are called. The CPU detection code is -automatically executed in a very high priority constructor. - -For example, this function has to be used in @code{ifunc} resolvers that -check for CPU type using the built-in functions @code{__builtin_cpu_is} -and @code{__builtin_cpu_supports}, or in constructors on targets that -don't support constructor priority. -@smallexample - -static void (*resolve_memcpy (void)) (void) -@{ - // ifunc resolvers fire before constructors, explicitly call the init - // function. - __builtin_cpu_init (); - if (__builtin_cpu_supports ("ssse3")) - return ssse3_memcpy; // super fast memcpy with ssse3 instructions. - else - return default_memcpy; -@} - -void *memcpy (void *, const void *, size_t) - __attribute__ ((ifunc ("resolve_memcpy"))); -@end smallexample - -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_cpu_is (const char *@var{cpuname}) -This function returns a positive integer if the run-time CPU -is of type @var{cpuname} -and returns @code{0} otherwise. The following CPU names can be detected: - -@table @samp -@item intel -Intel CPU. - -@item atom -Intel Atom CPU. - -@item core2 -Intel Core 2 CPU. - -@item corei7 -Intel Core i7 CPU. - -@item nehalem -Intel Core i7 Nehalem CPU. - -@item westmere -Intel Core i7 Westmere CPU. - -@item sandybridge -Intel Core i7 Sandy Bridge CPU. - -@item amd -AMD CPU. - -@item amdfam10h -AMD Family 10h CPU. - -@item barcelona -AMD Family 10h Barcelona CPU. - -@item shanghai -AMD Family 10h Shanghai CPU. - -@item istanbul -AMD Family 10h Istanbul CPU. - -@item btver1 -AMD Family 14h CPU. - -@item amdfam15h -AMD Family 15h CPU. - -@item bdver1 -AMD Family 15h Bulldozer version 1. - -@item bdver2 -AMD Family 15h Bulldozer version 2. - -@item bdver3 -AMD Family 15h Bulldozer version 3. - -@item bdver4 -AMD Family 15h Bulldozer version 4. - -@item btver2 -AMD Family 16h CPU. -@end table - -Here is an example: -@smallexample -if (__builtin_cpu_is ("corei7")) - @{ - do_corei7 (); // Core i7 specific implementation. - @} -else - @{ - do_generic (); // Generic implementation. - @} -@end smallexample -@end deftypefn - -@deftypefn {Built-in Function} int __builtin_cpu_supports (const char *@var{feature}) -This function returns a positive integer if the run-time CPU -supports @var{feature} -and returns @code{0} otherwise. The following features can be detected: - -@table @samp -@item cmov -CMOV instruction. -@item mmx -MMX instructions. -@item popcnt -POPCNT instruction. -@item sse -SSE instructions. -@item sse2 -SSE2 instructions. -@item sse3 -SSE3 instructions. -@item ssse3 -SSSE3 instructions. -@item sse4.1 -SSE4.1 instructions. -@item sse4.2 -SSE4.2 instructions. -@item avx -AVX instructions. -@item avx2 -AVX2 instructions. -@item avx512f -AVX512F instructions. -@end table - -Here is an example: -@smallexample -if (__builtin_cpu_supports ("popcnt")) - @{ - asm("popcnt %1,%0" : "=r"(count) : "rm"(n) : "cc"); - @} -else - @{ - count = generic_countbits (n); //generic implementation. - @} -@end smallexample -@end deftypefn - - -The following built-in functions are made available by @option{-mmmx}. -All of them generate the machine instruction that is part of the name. - -@smallexample -v8qi __builtin_ia32_paddb (v8qi, v8qi) -v4hi __builtin_ia32_paddw (v4hi, v4hi) -v2si __builtin_ia32_paddd (v2si, v2si) -v8qi __builtin_ia32_psubb (v8qi, v8qi) -v4hi __builtin_ia32_psubw (v4hi, v4hi) -v2si __builtin_ia32_psubd (v2si, v2si) -v8qi __builtin_ia32_paddsb (v8qi, v8qi) -v4hi __builtin_ia32_paddsw (v4hi, v4hi) -v8qi __builtin_ia32_psubsb (v8qi, v8qi) -v4hi __builtin_ia32_psubsw (v4hi, v4hi) -v8qi __builtin_ia32_paddusb (v8qi, v8qi) -v4hi __builtin_ia32_paddusw (v4hi, v4hi) -v8qi __builtin_ia32_psubusb (v8qi, v8qi) -v4hi __builtin_ia32_psubusw (v4hi, v4hi) -v4hi __builtin_ia32_pmullw (v4hi, v4hi) -v4hi __builtin_ia32_pmulhw (v4hi, v4hi) -di __builtin_ia32_pand (di, di) -di __builtin_ia32_pandn (di,di) -di __builtin_ia32_por (di, di) -di __builtin_ia32_pxor (di, di) -v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi) -v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi) -v2si __builtin_ia32_pcmpeqd (v2si, v2si) -v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi) -v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi) -v2si __builtin_ia32_pcmpgtd (v2si, v2si) -v8qi __builtin_ia32_punpckhbw (v8qi, v8qi) -v4hi __builtin_ia32_punpckhwd (v4hi, v4hi) -v2si __builtin_ia32_punpckhdq (v2si, v2si) -v8qi __builtin_ia32_punpcklbw (v8qi, v8qi) -v4hi __builtin_ia32_punpcklwd (v4hi, v4hi) -v2si __builtin_ia32_punpckldq (v2si, v2si) -v8qi __builtin_ia32_packsswb (v4hi, v4hi) -v4hi __builtin_ia32_packssdw (v2si, v2si) -v8qi __builtin_ia32_packuswb (v4hi, v4hi) - -v4hi __builtin_ia32_psllw (v4hi, v4hi) -v2si __builtin_ia32_pslld (v2si, v2si) -v1di __builtin_ia32_psllq (v1di, v1di) -v4hi __builtin_ia32_psrlw (v4hi, v4hi) -v2si __builtin_ia32_psrld (v2si, v2si) -v1di __builtin_ia32_psrlq (v1di, v1di) -v4hi __builtin_ia32_psraw (v4hi, v4hi) -v2si __builtin_ia32_psrad (v2si, v2si) -v4hi __builtin_ia32_psllwi (v4hi, int) -v2si __builtin_ia32_pslldi (v2si, int) -v1di __builtin_ia32_psllqi (v1di, int) -v4hi __builtin_ia32_psrlwi (v4hi, int) -v2si __builtin_ia32_psrldi (v2si, int) -v1di __builtin_ia32_psrlqi (v1di, int) -v4hi __builtin_ia32_psrawi (v4hi, int) -v2si __builtin_ia32_psradi (v2si, int) - -@end smallexample - -The following built-in functions are made available either with -@option{-msse}, or with a combination of @option{-m3dnow} and -@option{-march=athlon}. All of them generate the machine -instruction that is part of the name. - -@smallexample -v4hi __builtin_ia32_pmulhuw (v4hi, v4hi) -v8qi __builtin_ia32_pavgb (v8qi, v8qi) -v4hi __builtin_ia32_pavgw (v4hi, v4hi) -v1di __builtin_ia32_psadbw (v8qi, v8qi) -v8qi __builtin_ia32_pmaxub (v8qi, v8qi) -v4hi __builtin_ia32_pmaxsw (v4hi, v4hi) -v8qi __builtin_ia32_pminub (v8qi, v8qi) -v4hi __builtin_ia32_pminsw (v4hi, v4hi) -int __builtin_ia32_pmovmskb (v8qi) -void __builtin_ia32_maskmovq (v8qi, v8qi, char *) -void __builtin_ia32_movntq (di *, di) -void __builtin_ia32_sfence (void) -@end smallexample - -The following built-in functions are available when @option{-msse} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -int __builtin_ia32_comieq (v4sf, v4sf) -int __builtin_ia32_comineq (v4sf, v4sf) -int __builtin_ia32_comilt (v4sf, v4sf) -int __builtin_ia32_comile (v4sf, v4sf) -int __builtin_ia32_comigt (v4sf, v4sf) -int __builtin_ia32_comige (v4sf, v4sf) -int __builtin_ia32_ucomieq (v4sf, v4sf) -int __builtin_ia32_ucomineq (v4sf, v4sf) -int __builtin_ia32_ucomilt (v4sf, v4sf) -int __builtin_ia32_ucomile (v4sf, v4sf) -int __builtin_ia32_ucomigt (v4sf, v4sf) -int __builtin_ia32_ucomige (v4sf, v4sf) -v4sf __builtin_ia32_addps (v4sf, v4sf) -v4sf __builtin_ia32_subps (v4sf, v4sf) -v4sf __builtin_ia32_mulps (v4sf, v4sf) -v4sf __builtin_ia32_divps (v4sf, v4sf) -v4sf __builtin_ia32_addss (v4sf, v4sf) -v4sf __builtin_ia32_subss (v4sf, v4sf) -v4sf __builtin_ia32_mulss (v4sf, v4sf) -v4sf __builtin_ia32_divss (v4sf, v4sf) -v4sf __builtin_ia32_cmpeqps (v4sf, v4sf) -v4sf __builtin_ia32_cmpltps (v4sf, v4sf) -v4sf __builtin_ia32_cmpleps (v4sf, v4sf) -v4sf __builtin_ia32_cmpgtps (v4sf, v4sf) -v4sf __builtin_ia32_cmpgeps (v4sf, v4sf) -v4sf __builtin_ia32_cmpunordps (v4sf, v4sf) -v4sf __builtin_ia32_cmpneqps (v4sf, v4sf) -v4sf __builtin_ia32_cmpnltps (v4sf, v4sf) -v4sf __builtin_ia32_cmpnleps (v4sf, v4sf) -v4sf __builtin_ia32_cmpngtps (v4sf, v4sf) -v4sf __builtin_ia32_cmpngeps (v4sf, v4sf) -v4sf __builtin_ia32_cmpordps (v4sf, v4sf) -v4sf __builtin_ia32_cmpeqss (v4sf, v4sf) -v4sf __builtin_ia32_cmpltss (v4sf, v4sf) -v4sf __builtin_ia32_cmpless (v4sf, v4sf) -v4sf __builtin_ia32_cmpunordss (v4sf, v4sf) -v4sf __builtin_ia32_cmpneqss (v4sf, v4sf) -v4sf __builtin_ia32_cmpnltss (v4sf, v4sf) -v4sf __builtin_ia32_cmpnless (v4sf, v4sf) -v4sf __builtin_ia32_cmpordss (v4sf, v4sf) -v4sf __builtin_ia32_maxps (v4sf, v4sf) -v4sf __builtin_ia32_maxss (v4sf, v4sf) -v4sf __builtin_ia32_minps (v4sf, v4sf) -v4sf __builtin_ia32_minss (v4sf, v4sf) -v4sf __builtin_ia32_andps (v4sf, v4sf) -v4sf __builtin_ia32_andnps (v4sf, v4sf) -v4sf __builtin_ia32_orps (v4sf, v4sf) -v4sf __builtin_ia32_xorps (v4sf, v4sf) -v4sf __builtin_ia32_movss (v4sf, v4sf) -v4sf __builtin_ia32_movhlps (v4sf, v4sf) -v4sf __builtin_ia32_movlhps (v4sf, v4sf) -v4sf __builtin_ia32_unpckhps (v4sf, v4sf) -v4sf __builtin_ia32_unpcklps (v4sf, v4sf) -v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si) -v4sf __builtin_ia32_cvtsi2ss (v4sf, int) -v2si __builtin_ia32_cvtps2pi (v4sf) -int __builtin_ia32_cvtss2si (v4sf) -v2si __builtin_ia32_cvttps2pi (v4sf) -int __builtin_ia32_cvttss2si (v4sf) -v4sf __builtin_ia32_rcpps (v4sf) -v4sf __builtin_ia32_rsqrtps (v4sf) -v4sf __builtin_ia32_sqrtps (v4sf) -v4sf __builtin_ia32_rcpss (v4sf) -v4sf __builtin_ia32_rsqrtss (v4sf) -v4sf __builtin_ia32_sqrtss (v4sf) -v4sf __builtin_ia32_shufps (v4sf, v4sf, int) -void __builtin_ia32_movntps (float *, v4sf) -int __builtin_ia32_movmskps (v4sf) -@end smallexample - -The following built-in functions are available when @option{-msse} is used. - -@table @code -@item v4sf __builtin_ia32_loadups (float *) -Generates the @code{movups} machine instruction as a load from memory. -@item void __builtin_ia32_storeups (float *, v4sf) -Generates the @code{movups} machine instruction as a store to memory. -@item v4sf __builtin_ia32_loadss (float *) -Generates the @code{movss} machine instruction as a load from memory. -@item v4sf __builtin_ia32_loadhps (v4sf, const v2sf *) -Generates the @code{movhps} machine instruction as a load from memory. -@item v4sf __builtin_ia32_loadlps (v4sf, const v2sf *) -Generates the @code{movlps} machine instruction as a load from memory -@item void __builtin_ia32_storehps (v2sf *, v4sf) -Generates the @code{movhps} machine instruction as a store to memory. -@item void __builtin_ia32_storelps (v2sf *, v4sf) -Generates the @code{movlps} machine instruction as a store to memory. -@end table - -The following built-in functions are available when @option{-msse2} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -int __builtin_ia32_comisdeq (v2df, v2df) -int __builtin_ia32_comisdlt (v2df, v2df) -int __builtin_ia32_comisdle (v2df, v2df) -int __builtin_ia32_comisdgt (v2df, v2df) -int __builtin_ia32_comisdge (v2df, v2df) -int __builtin_ia32_comisdneq (v2df, v2df) -int __builtin_ia32_ucomisdeq (v2df, v2df) -int __builtin_ia32_ucomisdlt (v2df, v2df) -int __builtin_ia32_ucomisdle (v2df, v2df) -int __builtin_ia32_ucomisdgt (v2df, v2df) -int __builtin_ia32_ucomisdge (v2df, v2df) -int __builtin_ia32_ucomisdneq (v2df, v2df) -v2df __builtin_ia32_cmpeqpd (v2df, v2df) -v2df __builtin_ia32_cmpltpd (v2df, v2df) -v2df __builtin_ia32_cmplepd (v2df, v2df) -v2df __builtin_ia32_cmpgtpd (v2df, v2df) -v2df __builtin_ia32_cmpgepd (v2df, v2df) -v2df __builtin_ia32_cmpunordpd (v2df, v2df) -v2df __builtin_ia32_cmpneqpd (v2df, v2df) -v2df __builtin_ia32_cmpnltpd (v2df, v2df) -v2df __builtin_ia32_cmpnlepd (v2df, v2df) -v2df __builtin_ia32_cmpngtpd (v2df, v2df) -v2df __builtin_ia32_cmpngepd (v2df, v2df) -v2df __builtin_ia32_cmpordpd (v2df, v2df) -v2df __builtin_ia32_cmpeqsd (v2df, v2df) -v2df __builtin_ia32_cmpltsd (v2df, v2df) -v2df __builtin_ia32_cmplesd (v2df, v2df) -v2df __builtin_ia32_cmpunordsd (v2df, v2df) -v2df __builtin_ia32_cmpneqsd (v2df, v2df) -v2df __builtin_ia32_cmpnltsd (v2df, v2df) -v2df __builtin_ia32_cmpnlesd (v2df, v2df) -v2df __builtin_ia32_cmpordsd (v2df, v2df) -v2di __builtin_ia32_paddq (v2di, v2di) -v2di __builtin_ia32_psubq (v2di, v2di) -v2df __builtin_ia32_addpd (v2df, v2df) -v2df __builtin_ia32_subpd (v2df, v2df) -v2df __builtin_ia32_mulpd (v2df, v2df) -v2df __builtin_ia32_divpd (v2df, v2df) -v2df __builtin_ia32_addsd (v2df, v2df) -v2df __builtin_ia32_subsd (v2df, v2df) -v2df __builtin_ia32_mulsd (v2df, v2df) -v2df __builtin_ia32_divsd (v2df, v2df) -v2df __builtin_ia32_minpd (v2df, v2df) -v2df __builtin_ia32_maxpd (v2df, v2df) -v2df __builtin_ia32_minsd (v2df, v2df) -v2df __builtin_ia32_maxsd (v2df, v2df) -v2df __builtin_ia32_andpd (v2df, v2df) -v2df __builtin_ia32_andnpd (v2df, v2df) -v2df __builtin_ia32_orpd (v2df, v2df) -v2df __builtin_ia32_xorpd (v2df, v2df) -v2df __builtin_ia32_movsd (v2df, v2df) -v2df __builtin_ia32_unpckhpd (v2df, v2df) -v2df __builtin_ia32_unpcklpd (v2df, v2df) -v16qi __builtin_ia32_paddb128 (v16qi, v16qi) -v8hi __builtin_ia32_paddw128 (v8hi, v8hi) -v4si __builtin_ia32_paddd128 (v4si, v4si) -v2di __builtin_ia32_paddq128 (v2di, v2di) -v16qi __builtin_ia32_psubb128 (v16qi, v16qi) -v8hi __builtin_ia32_psubw128 (v8hi, v8hi) -v4si __builtin_ia32_psubd128 (v4si, v4si) -v2di __builtin_ia32_psubq128 (v2di, v2di) -v8hi __builtin_ia32_pmullw128 (v8hi, v8hi) -v8hi __builtin_ia32_pmulhw128 (v8hi, v8hi) -v2di __builtin_ia32_pand128 (v2di, v2di) -v2di __builtin_ia32_pandn128 (v2di, v2di) -v2di __builtin_ia32_por128 (v2di, v2di) -v2di __builtin_ia32_pxor128 (v2di, v2di) -v16qi __builtin_ia32_pavgb128 (v16qi, v16qi) -v8hi __builtin_ia32_pavgw128 (v8hi, v8hi) -v16qi __builtin_ia32_pcmpeqb128 (v16qi, v16qi) -v8hi __builtin_ia32_pcmpeqw128 (v8hi, v8hi) -v4si __builtin_ia32_pcmpeqd128 (v4si, v4si) -v16qi __builtin_ia32_pcmpgtb128 (v16qi, v16qi) -v8hi __builtin_ia32_pcmpgtw128 (v8hi, v8hi) -v4si __builtin_ia32_pcmpgtd128 (v4si, v4si) -v16qi __builtin_ia32_pmaxub128 (v16qi, v16qi) -v8hi __builtin_ia32_pmaxsw128 (v8hi, v8hi) -v16qi __builtin_ia32_pminub128 (v16qi, v16qi) -v8hi __builtin_ia32_pminsw128 (v8hi, v8hi) -v16qi __builtin_ia32_punpckhbw128 (v16qi, v16qi) -v8hi __builtin_ia32_punpckhwd128 (v8hi, v8hi) -v4si __builtin_ia32_punpckhdq128 (v4si, v4si) -v2di __builtin_ia32_punpckhqdq128 (v2di, v2di) -v16qi __builtin_ia32_punpcklbw128 (v16qi, v16qi) -v8hi __builtin_ia32_punpcklwd128 (v8hi, v8hi) -v4si __builtin_ia32_punpckldq128 (v4si, v4si) -v2di __builtin_ia32_punpcklqdq128 (v2di, v2di) -v16qi __builtin_ia32_packsswb128 (v8hi, v8hi) -v8hi __builtin_ia32_packssdw128 (v4si, v4si) -v16qi __builtin_ia32_packuswb128 (v8hi, v8hi) -v8hi __builtin_ia32_pmulhuw128 (v8hi, v8hi) -void __builtin_ia32_maskmovdqu (v16qi, v16qi) -v2df __builtin_ia32_loadupd (double *) -void __builtin_ia32_storeupd (double *, v2df) -v2df __builtin_ia32_loadhpd (v2df, double const *) -v2df __builtin_ia32_loadlpd (v2df, double const *) -int __builtin_ia32_movmskpd (v2df) -int __builtin_ia32_pmovmskb128 (v16qi) -void __builtin_ia32_movnti (int *, int) -void __builtin_ia32_movnti64 (long long int *, long long int) -void __builtin_ia32_movntpd (double *, v2df) -void __builtin_ia32_movntdq (v2df *, v2df) -v4si __builtin_ia32_pshufd (v4si, int) -v8hi __builtin_ia32_pshuflw (v8hi, int) -v8hi __builtin_ia32_pshufhw (v8hi, int) -v2di __builtin_ia32_psadbw128 (v16qi, v16qi) -v2df __builtin_ia32_sqrtpd (v2df) -v2df __builtin_ia32_sqrtsd (v2df) -v2df __builtin_ia32_shufpd (v2df, v2df, int) -v2df __builtin_ia32_cvtdq2pd (v4si) -v4sf __builtin_ia32_cvtdq2ps (v4si) -v4si __builtin_ia32_cvtpd2dq (v2df) -v2si __builtin_ia32_cvtpd2pi (v2df) -v4sf __builtin_ia32_cvtpd2ps (v2df) -v4si __builtin_ia32_cvttpd2dq (v2df) -v2si __builtin_ia32_cvttpd2pi (v2df) -v2df __builtin_ia32_cvtpi2pd (v2si) -int __builtin_ia32_cvtsd2si (v2df) -int __builtin_ia32_cvttsd2si (v2df) -long long __builtin_ia32_cvtsd2si64 (v2df) -long long __builtin_ia32_cvttsd2si64 (v2df) -v4si __builtin_ia32_cvtps2dq (v4sf) -v2df __builtin_ia32_cvtps2pd (v4sf) -v4si __builtin_ia32_cvttps2dq (v4sf) -v2df __builtin_ia32_cvtsi2sd (v2df, int) -v2df __builtin_ia32_cvtsi642sd (v2df, long long) -v4sf __builtin_ia32_cvtsd2ss (v4sf, v2df) -v2df __builtin_ia32_cvtss2sd (v2df, v4sf) -void __builtin_ia32_clflush (const void *) -void __builtin_ia32_lfence (void) -void __builtin_ia32_mfence (void) -v16qi __builtin_ia32_loaddqu (const char *) -void __builtin_ia32_storedqu (char *, v16qi) -v1di __builtin_ia32_pmuludq (v2si, v2si) -v2di __builtin_ia32_pmuludq128 (v4si, v4si) -v8hi __builtin_ia32_psllw128 (v8hi, v8hi) -v4si __builtin_ia32_pslld128 (v4si, v4si) -v2di __builtin_ia32_psllq128 (v2di, v2di) -v8hi __builtin_ia32_psrlw128 (v8hi, v8hi) -v4si __builtin_ia32_psrld128 (v4si, v4si) -v2di __builtin_ia32_psrlq128 (v2di, v2di) -v8hi __builtin_ia32_psraw128 (v8hi, v8hi) -v4si __builtin_ia32_psrad128 (v4si, v4si) -v2di __builtin_ia32_pslldqi128 (v2di, int) -v8hi __builtin_ia32_psllwi128 (v8hi, int) -v4si __builtin_ia32_pslldi128 (v4si, int) -v2di __builtin_ia32_psllqi128 (v2di, int) -v2di __builtin_ia32_psrldqi128 (v2di, int) -v8hi __builtin_ia32_psrlwi128 (v8hi, int) -v4si __builtin_ia32_psrldi128 (v4si, int) -v2di __builtin_ia32_psrlqi128 (v2di, int) -v8hi __builtin_ia32_psrawi128 (v8hi, int) -v4si __builtin_ia32_psradi128 (v4si, int) -v4si __builtin_ia32_pmaddwd128 (v8hi, v8hi) -v2di __builtin_ia32_movq128 (v2di) -@end smallexample - -The following built-in functions are available when @option{-msse3} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -v2df __builtin_ia32_addsubpd (v2df, v2df) -v4sf __builtin_ia32_addsubps (v4sf, v4sf) -v2df __builtin_ia32_haddpd (v2df, v2df) -v4sf __builtin_ia32_haddps (v4sf, v4sf) -v2df __builtin_ia32_hsubpd (v2df, v2df) -v4sf __builtin_ia32_hsubps (v4sf, v4sf) -v16qi __builtin_ia32_lddqu (char const *) -void __builtin_ia32_monitor (void *, unsigned int, unsigned int) -v4sf __builtin_ia32_movshdup (v4sf) -v4sf __builtin_ia32_movsldup (v4sf) -void __builtin_ia32_mwait (unsigned int, unsigned int) -@end smallexample - -The following built-in functions are available when @option{-mssse3} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -v2si __builtin_ia32_phaddd (v2si, v2si) -v4hi __builtin_ia32_phaddw (v4hi, v4hi) -v4hi __builtin_ia32_phaddsw (v4hi, v4hi) -v2si __builtin_ia32_phsubd (v2si, v2si) -v4hi __builtin_ia32_phsubw (v4hi, v4hi) -v4hi __builtin_ia32_phsubsw (v4hi, v4hi) -v4hi __builtin_ia32_pmaddubsw (v8qi, v8qi) -v4hi __builtin_ia32_pmulhrsw (v4hi, v4hi) -v8qi __builtin_ia32_pshufb (v8qi, v8qi) -v8qi __builtin_ia32_psignb (v8qi, v8qi) -v2si __builtin_ia32_psignd (v2si, v2si) -v4hi __builtin_ia32_psignw (v4hi, v4hi) -v1di __builtin_ia32_palignr (v1di, v1di, int) -v8qi __builtin_ia32_pabsb (v8qi) -v2si __builtin_ia32_pabsd (v2si) -v4hi __builtin_ia32_pabsw (v4hi) -@end smallexample - -The following built-in functions are available when @option{-mssse3} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -v4si __builtin_ia32_phaddd128 (v4si, v4si) -v8hi __builtin_ia32_phaddw128 (v8hi, v8hi) -v8hi __builtin_ia32_phaddsw128 (v8hi, v8hi) -v4si __builtin_ia32_phsubd128 (v4si, v4si) -v8hi __builtin_ia32_phsubw128 (v8hi, v8hi) -v8hi __builtin_ia32_phsubsw128 (v8hi, v8hi) -v8hi __builtin_ia32_pmaddubsw128 (v16qi, v16qi) -v8hi __builtin_ia32_pmulhrsw128 (v8hi, v8hi) -v16qi __builtin_ia32_pshufb128 (v16qi, v16qi) -v16qi __builtin_ia32_psignb128 (v16qi, v16qi) -v4si __builtin_ia32_psignd128 (v4si, v4si) -v8hi __builtin_ia32_psignw128 (v8hi, v8hi) -v2di __builtin_ia32_palignr128 (v2di, v2di, int) -v16qi __builtin_ia32_pabsb128 (v16qi) -v4si __builtin_ia32_pabsd128 (v4si) -v8hi __builtin_ia32_pabsw128 (v8hi) -@end smallexample - -The following built-in functions are available when @option{-msse4.1} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -v2df __builtin_ia32_blendpd (v2df, v2df, const int) -v4sf __builtin_ia32_blendps (v4sf, v4sf, const int) -v2df __builtin_ia32_blendvpd (v2df, v2df, v2df) -v4sf __builtin_ia32_blendvps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_dppd (v2df, v2df, const int) -v4sf __builtin_ia32_dpps (v4sf, v4sf, const int) -v4sf __builtin_ia32_insertps128 (v4sf, v4sf, const int) -v2di __builtin_ia32_movntdqa (v2di *); -v16qi __builtin_ia32_mpsadbw128 (v16qi, v16qi, const int) -v8hi __builtin_ia32_packusdw128 (v4si, v4si) -v16qi __builtin_ia32_pblendvb128 (v16qi, v16qi, v16qi) -v8hi __builtin_ia32_pblendw128 (v8hi, v8hi, const int) -v2di __builtin_ia32_pcmpeqq (v2di, v2di) -v8hi __builtin_ia32_phminposuw128 (v8hi) -v16qi __builtin_ia32_pmaxsb128 (v16qi, v16qi) -v4si __builtin_ia32_pmaxsd128 (v4si, v4si) -v4si __builtin_ia32_pmaxud128 (v4si, v4si) -v8hi __builtin_ia32_pmaxuw128 (v8hi, v8hi) -v16qi __builtin_ia32_pminsb128 (v16qi, v16qi) -v4si __builtin_ia32_pminsd128 (v4si, v4si) -v4si __builtin_ia32_pminud128 (v4si, v4si) -v8hi __builtin_ia32_pminuw128 (v8hi, v8hi) -v4si __builtin_ia32_pmovsxbd128 (v16qi) -v2di __builtin_ia32_pmovsxbq128 (v16qi) -v8hi __builtin_ia32_pmovsxbw128 (v16qi) -v2di __builtin_ia32_pmovsxdq128 (v4si) -v4si __builtin_ia32_pmovsxwd128 (v8hi) -v2di __builtin_ia32_pmovsxwq128 (v8hi) -v4si __builtin_ia32_pmovzxbd128 (v16qi) -v2di __builtin_ia32_pmovzxbq128 (v16qi) -v8hi __builtin_ia32_pmovzxbw128 (v16qi) -v2di __builtin_ia32_pmovzxdq128 (v4si) -v4si __builtin_ia32_pmovzxwd128 (v8hi) -v2di __builtin_ia32_pmovzxwq128 (v8hi) -v2di __builtin_ia32_pmuldq128 (v4si, v4si) -v4si __builtin_ia32_pmulld128 (v4si, v4si) -int __builtin_ia32_ptestc128 (v2di, v2di) -int __builtin_ia32_ptestnzc128 (v2di, v2di) -int __builtin_ia32_ptestz128 (v2di, v2di) -v2df __builtin_ia32_roundpd (v2df, const int) -v4sf __builtin_ia32_roundps (v4sf, const int) -v2df __builtin_ia32_roundsd (v2df, v2df, const int) -v4sf __builtin_ia32_roundss (v4sf, v4sf, const int) -@end smallexample - -The following built-in functions are available when @option{-msse4.1} is -used. - -@table @code -@item v4sf __builtin_ia32_vec_set_v4sf (v4sf, float, const int) -Generates the @code{insertps} machine instruction. -@item int __builtin_ia32_vec_ext_v16qi (v16qi, const int) -Generates the @code{pextrb} machine instruction. -@item v16qi __builtin_ia32_vec_set_v16qi (v16qi, int, const int) -Generates the @code{pinsrb} machine instruction. -@item v4si __builtin_ia32_vec_set_v4si (v4si, int, const int) -Generates the @code{pinsrd} machine instruction. -@item v2di __builtin_ia32_vec_set_v2di (v2di, long long, const int) -Generates the @code{pinsrq} machine instruction in 64bit mode. -@end table - -The following built-in functions are changed to generate new SSE4.1 -instructions when @option{-msse4.1} is used. - -@table @code -@item float __builtin_ia32_vec_ext_v4sf (v4sf, const int) -Generates the @code{extractps} machine instruction. -@item int __builtin_ia32_vec_ext_v4si (v4si, const int) -Generates the @code{pextrd} machine instruction. -@item long long __builtin_ia32_vec_ext_v2di (v2di, const int) -Generates the @code{pextrq} machine instruction in 64bit mode. -@end table - -The following built-in functions are available when @option{-msse4.2} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -v16qi __builtin_ia32_pcmpestrm128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestri128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestria128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestric128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestrio128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestris128 (v16qi, int, v16qi, int, const int) -int __builtin_ia32_pcmpestriz128 (v16qi, int, v16qi, int, const int) -v16qi __builtin_ia32_pcmpistrm128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistri128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistria128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistric128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistrio128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistris128 (v16qi, v16qi, const int) -int __builtin_ia32_pcmpistriz128 (v16qi, v16qi, const int) -v2di __builtin_ia32_pcmpgtq (v2di, v2di) -@end smallexample - -The following built-in functions are available when @option{-msse4.2} is -used. - -@table @code -@item unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char) -Generates the @code{crc32b} machine instruction. -@item unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short) -Generates the @code{crc32w} machine instruction. -@item unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int) -Generates the @code{crc32l} machine instruction. -@item unsigned long long __builtin_ia32_crc32di (unsigned long long, unsigned long long) -Generates the @code{crc32q} machine instruction. -@end table - -The following built-in functions are changed to generate new SSE4.2 -instructions when @option{-msse4.2} is used. - -@table @code -@item int __builtin_popcount (unsigned int) -Generates the @code{popcntl} machine instruction. -@item int __builtin_popcountl (unsigned long) -Generates the @code{popcntl} or @code{popcntq} machine instruction, -depending on the size of @code{unsigned long}. -@item int __builtin_popcountll (unsigned long long) -Generates the @code{popcntq} machine instruction. -@end table - -The following built-in functions are available when @option{-mavx} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -v4df __builtin_ia32_addpd256 (v4df,v4df) -v8sf __builtin_ia32_addps256 (v8sf,v8sf) -v4df __builtin_ia32_addsubpd256 (v4df,v4df) -v8sf __builtin_ia32_addsubps256 (v8sf,v8sf) -v4df __builtin_ia32_andnpd256 (v4df,v4df) -v8sf __builtin_ia32_andnps256 (v8sf,v8sf) -v4df __builtin_ia32_andpd256 (v4df,v4df) -v8sf __builtin_ia32_andps256 (v8sf,v8sf) -v4df __builtin_ia32_blendpd256 (v4df,v4df,int) -v8sf __builtin_ia32_blendps256 (v8sf,v8sf,int) -v4df __builtin_ia32_blendvpd256 (v4df,v4df,v4df) -v8sf __builtin_ia32_blendvps256 (v8sf,v8sf,v8sf) -v2df __builtin_ia32_cmppd (v2df,v2df,int) -v4df __builtin_ia32_cmppd256 (v4df,v4df,int) -v4sf __builtin_ia32_cmpps (v4sf,v4sf,int) -v8sf __builtin_ia32_cmpps256 (v8sf,v8sf,int) -v2df __builtin_ia32_cmpsd (v2df,v2df,int) -v4sf __builtin_ia32_cmpss (v4sf,v4sf,int) -v4df __builtin_ia32_cvtdq2pd256 (v4si) -v8sf __builtin_ia32_cvtdq2ps256 (v8si) -v4si __builtin_ia32_cvtpd2dq256 (v4df) -v4sf __builtin_ia32_cvtpd2ps256 (v4df) -v8si __builtin_ia32_cvtps2dq256 (v8sf) -v4df __builtin_ia32_cvtps2pd256 (v4sf) -v4si __builtin_ia32_cvttpd2dq256 (v4df) -v8si __builtin_ia32_cvttps2dq256 (v8sf) -v4df __builtin_ia32_divpd256 (v4df,v4df) -v8sf __builtin_ia32_divps256 (v8sf,v8sf) -v8sf __builtin_ia32_dpps256 (v8sf,v8sf,int) -v4df __builtin_ia32_haddpd256 (v4df,v4df) -v8sf __builtin_ia32_haddps256 (v8sf,v8sf) -v4df __builtin_ia32_hsubpd256 (v4df,v4df) -v8sf __builtin_ia32_hsubps256 (v8sf,v8sf) -v32qi __builtin_ia32_lddqu256 (pcchar) -v32qi __builtin_ia32_loaddqu256 (pcchar) -v4df __builtin_ia32_loadupd256 (pcdouble) -v8sf __builtin_ia32_loadups256 (pcfloat) -v2df __builtin_ia32_maskloadpd (pcv2df,v2df) -v4df __builtin_ia32_maskloadpd256 (pcv4df,v4df) -v4sf __builtin_ia32_maskloadps (pcv4sf,v4sf) -v8sf __builtin_ia32_maskloadps256 (pcv8sf,v8sf) -void __builtin_ia32_maskstorepd (pv2df,v2df,v2df) -void __builtin_ia32_maskstorepd256 (pv4df,v4df,v4df) -void __builtin_ia32_maskstoreps (pv4sf,v4sf,v4sf) -void __builtin_ia32_maskstoreps256 (pv8sf,v8sf,v8sf) -v4df __builtin_ia32_maxpd256 (v4df,v4df) -v8sf __builtin_ia32_maxps256 (v8sf,v8sf) -v4df __builtin_ia32_minpd256 (v4df,v4df) -v8sf __builtin_ia32_minps256 (v8sf,v8sf) -v4df __builtin_ia32_movddup256 (v4df) -int __builtin_ia32_movmskpd256 (v4df) -int __builtin_ia32_movmskps256 (v8sf) -v8sf __builtin_ia32_movshdup256 (v8sf) -v8sf __builtin_ia32_movsldup256 (v8sf) -v4df __builtin_ia32_mulpd256 (v4df,v4df) -v8sf __builtin_ia32_mulps256 (v8sf,v8sf) -v4df __builtin_ia32_orpd256 (v4df,v4df) -v8sf __builtin_ia32_orps256 (v8sf,v8sf) -v2df __builtin_ia32_pd_pd256 (v4df) -v4df __builtin_ia32_pd256_pd (v2df) -v4sf __builtin_ia32_ps_ps256 (v8sf) -v8sf __builtin_ia32_ps256_ps (v4sf) -int __builtin_ia32_ptestc256 (v4di,v4di,ptest) -int __builtin_ia32_ptestnzc256 (v4di,v4di,ptest) -int __builtin_ia32_ptestz256 (v4di,v4di,ptest) -v8sf __builtin_ia32_rcpps256 (v8sf) -v4df __builtin_ia32_roundpd256 (v4df,int) -v8sf __builtin_ia32_roundps256 (v8sf,int) -v8sf __builtin_ia32_rsqrtps_nr256 (v8sf) -v8sf __builtin_ia32_rsqrtps256 (v8sf) -v4df __builtin_ia32_shufpd256 (v4df,v4df,int) -v8sf __builtin_ia32_shufps256 (v8sf,v8sf,int) -v4si __builtin_ia32_si_si256 (v8si) -v8si __builtin_ia32_si256_si (v4si) -v4df __builtin_ia32_sqrtpd256 (v4df) -v8sf __builtin_ia32_sqrtps_nr256 (v8sf) -v8sf __builtin_ia32_sqrtps256 (v8sf) -void __builtin_ia32_storedqu256 (pchar,v32qi) -void __builtin_ia32_storeupd256 (pdouble,v4df) -void __builtin_ia32_storeups256 (pfloat,v8sf) -v4df __builtin_ia32_subpd256 (v4df,v4df) -v8sf __builtin_ia32_subps256 (v8sf,v8sf) -v4df __builtin_ia32_unpckhpd256 (v4df,v4df) -v8sf __builtin_ia32_unpckhps256 (v8sf,v8sf) -v4df __builtin_ia32_unpcklpd256 (v4df,v4df) -v8sf __builtin_ia32_unpcklps256 (v8sf,v8sf) -v4df __builtin_ia32_vbroadcastf128_pd256 (pcv2df) -v8sf __builtin_ia32_vbroadcastf128_ps256 (pcv4sf) -v4df __builtin_ia32_vbroadcastsd256 (pcdouble) -v4sf __builtin_ia32_vbroadcastss (pcfloat) -v8sf __builtin_ia32_vbroadcastss256 (pcfloat) -v2df __builtin_ia32_vextractf128_pd256 (v4df,int) -v4sf __builtin_ia32_vextractf128_ps256 (v8sf,int) -v4si __builtin_ia32_vextractf128_si256 (v8si,int) -v4df __builtin_ia32_vinsertf128_pd256 (v4df,v2df,int) -v8sf __builtin_ia32_vinsertf128_ps256 (v8sf,v4sf,int) -v8si __builtin_ia32_vinsertf128_si256 (v8si,v4si,int) -v4df __builtin_ia32_vperm2f128_pd256 (v4df,v4df,int) -v8sf __builtin_ia32_vperm2f128_ps256 (v8sf,v8sf,int) -v8si __builtin_ia32_vperm2f128_si256 (v8si,v8si,int) -v2df __builtin_ia32_vpermil2pd (v2df,v2df,v2di,int) -v4df __builtin_ia32_vpermil2pd256 (v4df,v4df,v4di,int) -v4sf __builtin_ia32_vpermil2ps (v4sf,v4sf,v4si,int) -v8sf __builtin_ia32_vpermil2ps256 (v8sf,v8sf,v8si,int) -v2df __builtin_ia32_vpermilpd (v2df,int) -v4df __builtin_ia32_vpermilpd256 (v4df,int) -v4sf __builtin_ia32_vpermilps (v4sf,int) -v8sf __builtin_ia32_vpermilps256 (v8sf,int) -v2df __builtin_ia32_vpermilvarpd (v2df,v2di) -v4df __builtin_ia32_vpermilvarpd256 (v4df,v4di) -v4sf __builtin_ia32_vpermilvarps (v4sf,v4si) -v8sf __builtin_ia32_vpermilvarps256 (v8sf,v8si) -int __builtin_ia32_vtestcpd (v2df,v2df,ptest) -int __builtin_ia32_vtestcpd256 (v4df,v4df,ptest) -int __builtin_ia32_vtestcps (v4sf,v4sf,ptest) -int __builtin_ia32_vtestcps256 (v8sf,v8sf,ptest) -int __builtin_ia32_vtestnzcpd (v2df,v2df,ptest) -int __builtin_ia32_vtestnzcpd256 (v4df,v4df,ptest) -int __builtin_ia32_vtestnzcps (v4sf,v4sf,ptest) -int __builtin_ia32_vtestnzcps256 (v8sf,v8sf,ptest) -int __builtin_ia32_vtestzpd (v2df,v2df,ptest) -int __builtin_ia32_vtestzpd256 (v4df,v4df,ptest) -int __builtin_ia32_vtestzps (v4sf,v4sf,ptest) -int __builtin_ia32_vtestzps256 (v8sf,v8sf,ptest) -void __builtin_ia32_vzeroall (void) -void __builtin_ia32_vzeroupper (void) -v4df __builtin_ia32_xorpd256 (v4df,v4df) -v8sf __builtin_ia32_xorps256 (v8sf,v8sf) -@end smallexample - -The following built-in functions are available when @option{-mavx2} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,int) -v32qi __builtin_ia32_pabsb256 (v32qi) -v16hi __builtin_ia32_pabsw256 (v16hi) -v8si __builtin_ia32_pabsd256 (v8si) -v16hi __builtin_ia32_packssdw256 (v8si,v8si) -v32qi __builtin_ia32_packsswb256 (v16hi,v16hi) -v16hi __builtin_ia32_packusdw256 (v8si,v8si) -v32qi __builtin_ia32_packuswb256 (v16hi,v16hi) -v32qi __builtin_ia32_paddb256 (v32qi,v32qi) -v16hi __builtin_ia32_paddw256 (v16hi,v16hi) -v8si __builtin_ia32_paddd256 (v8si,v8si) -v4di __builtin_ia32_paddq256 (v4di,v4di) -v32qi __builtin_ia32_paddsb256 (v32qi,v32qi) -v16hi __builtin_ia32_paddsw256 (v16hi,v16hi) -v32qi __builtin_ia32_paddusb256 (v32qi,v32qi) -v16hi __builtin_ia32_paddusw256 (v16hi,v16hi) -v4di __builtin_ia32_palignr256 (v4di,v4di,int) -v4di __builtin_ia32_andsi256 (v4di,v4di) -v4di __builtin_ia32_andnotsi256 (v4di,v4di) -v32qi __builtin_ia32_pavgb256 (v32qi,v32qi) -v16hi __builtin_ia32_pavgw256 (v16hi,v16hi) -v32qi __builtin_ia32_pblendvb256 (v32qi,v32qi,v32qi) -v16hi __builtin_ia32_pblendw256 (v16hi,v16hi,int) -v32qi __builtin_ia32_pcmpeqb256 (v32qi,v32qi) -v16hi __builtin_ia32_pcmpeqw256 (v16hi,v16hi) -v8si __builtin_ia32_pcmpeqd256 (c8si,v8si) -v4di __builtin_ia32_pcmpeqq256 (v4di,v4di) -v32qi __builtin_ia32_pcmpgtb256 (v32qi,v32qi) -v16hi __builtin_ia32_pcmpgtw256 (16hi,v16hi) -v8si __builtin_ia32_pcmpgtd256 (v8si,v8si) -v4di __builtin_ia32_pcmpgtq256 (v4di,v4di) -v16hi __builtin_ia32_phaddw256 (v16hi,v16hi) -v8si __builtin_ia32_phaddd256 (v8si,v8si) -v16hi __builtin_ia32_phaddsw256 (v16hi,v16hi) -v16hi __builtin_ia32_phsubw256 (v16hi,v16hi) -v8si __builtin_ia32_phsubd256 (v8si,v8si) -v16hi __builtin_ia32_phsubsw256 (v16hi,v16hi) -v32qi __builtin_ia32_pmaddubsw256 (v32qi,v32qi) -v16hi __builtin_ia32_pmaddwd256 (v16hi,v16hi) -v32qi __builtin_ia32_pmaxsb256 (v32qi,v32qi) -v16hi __builtin_ia32_pmaxsw256 (v16hi,v16hi) -v8si __builtin_ia32_pmaxsd256 (v8si,v8si) -v32qi __builtin_ia32_pmaxub256 (v32qi,v32qi) -v16hi __builtin_ia32_pmaxuw256 (v16hi,v16hi) -v8si __builtin_ia32_pmaxud256 (v8si,v8si) -v32qi __builtin_ia32_pminsb256 (v32qi,v32qi) -v16hi __builtin_ia32_pminsw256 (v16hi,v16hi) -v8si __builtin_ia32_pminsd256 (v8si,v8si) -v32qi __builtin_ia32_pminub256 (v32qi,v32qi) -v16hi __builtin_ia32_pminuw256 (v16hi,v16hi) -v8si __builtin_ia32_pminud256 (v8si,v8si) -int __builtin_ia32_pmovmskb256 (v32qi) -v16hi __builtin_ia32_pmovsxbw256 (v16qi) -v8si __builtin_ia32_pmovsxbd256 (v16qi) -v4di __builtin_ia32_pmovsxbq256 (v16qi) -v8si __builtin_ia32_pmovsxwd256 (v8hi) -v4di __builtin_ia32_pmovsxwq256 (v8hi) -v4di __builtin_ia32_pmovsxdq256 (v4si) -v16hi __builtin_ia32_pmovzxbw256 (v16qi) -v8si __builtin_ia32_pmovzxbd256 (v16qi) -v4di __builtin_ia32_pmovzxbq256 (v16qi) -v8si __builtin_ia32_pmovzxwd256 (v8hi) -v4di __builtin_ia32_pmovzxwq256 (v8hi) -v4di __builtin_ia32_pmovzxdq256 (v4si) -v4di __builtin_ia32_pmuldq256 (v8si,v8si) -v16hi __builtin_ia32_pmulhrsw256 (v16hi, v16hi) -v16hi __builtin_ia32_pmulhuw256 (v16hi,v16hi) -v16hi __builtin_ia32_pmulhw256 (v16hi,v16hi) -v16hi __builtin_ia32_pmullw256 (v16hi,v16hi) -v8si __builtin_ia32_pmulld256 (v8si,v8si) -v4di __builtin_ia32_pmuludq256 (v8si,v8si) -v4di __builtin_ia32_por256 (v4di,v4di) -v16hi __builtin_ia32_psadbw256 (v32qi,v32qi) -v32qi __builtin_ia32_pshufb256 (v32qi,v32qi) -v8si __builtin_ia32_pshufd256 (v8si,int) -v16hi __builtin_ia32_pshufhw256 (v16hi,int) -v16hi __builtin_ia32_pshuflw256 (v16hi,int) -v32qi __builtin_ia32_psignb256 (v32qi,v32qi) -v16hi __builtin_ia32_psignw256 (v16hi,v16hi) -v8si __builtin_ia32_psignd256 (v8si,v8si) -v4di __builtin_ia32_pslldqi256 (v4di,int) -v16hi __builtin_ia32_psllwi256 (16hi,int) -v16hi __builtin_ia32_psllw256(v16hi,v8hi) -v8si __builtin_ia32_pslldi256 (v8si,int) -v8si __builtin_ia32_pslld256(v8si,v4si) -v4di __builtin_ia32_psllqi256 (v4di,int) -v4di __builtin_ia32_psllq256(v4di,v2di) -v16hi __builtin_ia32_psrawi256 (v16hi,int) -v16hi __builtin_ia32_psraw256 (v16hi,v8hi) -v8si __builtin_ia32_psradi256 (v8si,int) -v8si __builtin_ia32_psrad256 (v8si,v4si) -v4di __builtin_ia32_psrldqi256 (v4di, int) -v16hi __builtin_ia32_psrlwi256 (v16hi,int) -v16hi __builtin_ia32_psrlw256 (v16hi,v8hi) -v8si __builtin_ia32_psrldi256 (v8si,int) -v8si __builtin_ia32_psrld256 (v8si,v4si) -v4di __builtin_ia32_psrlqi256 (v4di,int) -v4di __builtin_ia32_psrlq256(v4di,v2di) -v32qi __builtin_ia32_psubb256 (v32qi,v32qi) -v32hi __builtin_ia32_psubw256 (v16hi,v16hi) -v8si __builtin_ia32_psubd256 (v8si,v8si) -v4di __builtin_ia32_psubq256 (v4di,v4di) -v32qi __builtin_ia32_psubsb256 (v32qi,v32qi) -v16hi __builtin_ia32_psubsw256 (v16hi,v16hi) -v32qi __builtin_ia32_psubusb256 (v32qi,v32qi) -v16hi __builtin_ia32_psubusw256 (v16hi,v16hi) -v32qi __builtin_ia32_punpckhbw256 (v32qi,v32qi) -v16hi __builtin_ia32_punpckhwd256 (v16hi,v16hi) -v8si __builtin_ia32_punpckhdq256 (v8si,v8si) -v4di __builtin_ia32_punpckhqdq256 (v4di,v4di) -v32qi __builtin_ia32_punpcklbw256 (v32qi,v32qi) -v16hi __builtin_ia32_punpcklwd256 (v16hi,v16hi) -v8si __builtin_ia32_punpckldq256 (v8si,v8si) -v4di __builtin_ia32_punpcklqdq256 (v4di,v4di) -v4di __builtin_ia32_pxor256 (v4di,v4di) -v4di __builtin_ia32_movntdqa256 (pv4di) -v4sf __builtin_ia32_vbroadcastss_ps (v4sf) -v8sf __builtin_ia32_vbroadcastss_ps256 (v4sf) -v4df __builtin_ia32_vbroadcastsd_pd256 (v2df) -v4di __builtin_ia32_vbroadcastsi256 (v2di) -v4si __builtin_ia32_pblendd128 (v4si,v4si) -v8si __builtin_ia32_pblendd256 (v8si,v8si) -v32qi __builtin_ia32_pbroadcastb256 (v16qi) -v16hi __builtin_ia32_pbroadcastw256 (v8hi) -v8si __builtin_ia32_pbroadcastd256 (v4si) -v4di __builtin_ia32_pbroadcastq256 (v2di) -v16qi __builtin_ia32_pbroadcastb128 (v16qi) -v8hi __builtin_ia32_pbroadcastw128 (v8hi) -v4si __builtin_ia32_pbroadcastd128 (v4si) -v2di __builtin_ia32_pbroadcastq128 (v2di) -v8si __builtin_ia32_permvarsi256 (v8si,v8si) -v4df __builtin_ia32_permdf256 (v4df,int) -v8sf __builtin_ia32_permvarsf256 (v8sf,v8sf) -v4di __builtin_ia32_permdi256 (v4di,int) -v4di __builtin_ia32_permti256 (v4di,v4di,int) -v4di __builtin_ia32_extract128i256 (v4di,int) -v4di __builtin_ia32_insert128i256 (v4di,v2di,int) -v8si __builtin_ia32_maskloadd256 (pcv8si,v8si) -v4di __builtin_ia32_maskloadq256 (pcv4di,v4di) -v4si __builtin_ia32_maskloadd (pcv4si,v4si) -v2di __builtin_ia32_maskloadq (pcv2di,v2di) -void __builtin_ia32_maskstored256 (pv8si,v8si,v8si) -void __builtin_ia32_maskstoreq256 (pv4di,v4di,v4di) -void __builtin_ia32_maskstored (pv4si,v4si,v4si) -void __builtin_ia32_maskstoreq (pv2di,v2di,v2di) -v8si __builtin_ia32_psllv8si (v8si,v8si) -v4si __builtin_ia32_psllv4si (v4si,v4si) -v4di __builtin_ia32_psllv4di (v4di,v4di) -v2di __builtin_ia32_psllv2di (v2di,v2di) -v8si __builtin_ia32_psrav8si (v8si,v8si) -v4si __builtin_ia32_psrav4si (v4si,v4si) -v8si __builtin_ia32_psrlv8si (v8si,v8si) -v4si __builtin_ia32_psrlv4si (v4si,v4si) -v4di __builtin_ia32_psrlv4di (v4di,v4di) -v2di __builtin_ia32_psrlv2di (v2di,v2di) -v2df __builtin_ia32_gathersiv2df (v2df, pcdouble,v4si,v2df,int) -v4df __builtin_ia32_gathersiv4df (v4df, pcdouble,v4si,v4df,int) -v2df __builtin_ia32_gatherdiv2df (v2df, pcdouble,v2di,v2df,int) -v4df __builtin_ia32_gatherdiv4df (v4df, pcdouble,v4di,v4df,int) -v4sf __builtin_ia32_gathersiv4sf (v4sf, pcfloat,v4si,v4sf,int) -v8sf __builtin_ia32_gathersiv8sf (v8sf, pcfloat,v8si,v8sf,int) -v4sf __builtin_ia32_gatherdiv4sf (v4sf, pcfloat,v2di,v4sf,int) -v4sf __builtin_ia32_gatherdiv4sf256 (v4sf, pcfloat,v4di,v4sf,int) -v2di __builtin_ia32_gathersiv2di (v2di, pcint64,v4si,v2di,int) -v4di __builtin_ia32_gathersiv4di (v4di, pcint64,v4si,v4di,int) -v2di __builtin_ia32_gatherdiv2di (v2di, pcint64,v2di,v2di,int) -v4di __builtin_ia32_gatherdiv4di (v4di, pcint64,v4di,v4di,int) -v4si __builtin_ia32_gathersiv4si (v4si, pcint,v4si,v4si,int) -v8si __builtin_ia32_gathersiv8si (v8si, pcint,v8si,v8si,int) -v4si __builtin_ia32_gatherdiv4si (v4si, pcint,v2di,v4si,int) -v4si __builtin_ia32_gatherdiv4si256 (v4si, pcint,v4di,v4si,int) -@end smallexample - -The following built-in functions are available when @option{-maes} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -v2di __builtin_ia32_aesenc128 (v2di, v2di) -v2di __builtin_ia32_aesenclast128 (v2di, v2di) -v2di __builtin_ia32_aesdec128 (v2di, v2di) -v2di __builtin_ia32_aesdeclast128 (v2di, v2di) -v2di __builtin_ia32_aeskeygenassist128 (v2di, const int) -v2di __builtin_ia32_aesimc128 (v2di) -@end smallexample - -The following built-in function is available when @option{-mpclmul} is -used. - -@table @code -@item v2di __builtin_ia32_pclmulqdq128 (v2di, v2di, const int) -Generates the @code{pclmulqdq} machine instruction. -@end table - -The following built-in function is available when @option{-mfsgsbase} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -unsigned int __builtin_ia32_rdfsbase32 (void) -unsigned long long __builtin_ia32_rdfsbase64 (void) -unsigned int __builtin_ia32_rdgsbase32 (void) -unsigned long long __builtin_ia32_rdgsbase64 (void) -void _writefsbase_u32 (unsigned int) -void _writefsbase_u64 (unsigned long long) -void _writegsbase_u32 (unsigned int) -void _writegsbase_u64 (unsigned long long) -@end smallexample - -The following built-in function is available when @option{-mrdrnd} is -used. All of them generate the machine instruction that is part of the -name. - -@smallexample -unsigned int __builtin_ia32_rdrand16_step (unsigned short *) -unsigned int __builtin_ia32_rdrand32_step (unsigned int *) -unsigned int __builtin_ia32_rdrand64_step (unsigned long long *) -@end smallexample - -The following built-in functions are available when @option{-msse4a} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -void __builtin_ia32_movntsd (double *, v2df) -void __builtin_ia32_movntss (float *, v4sf) -v2di __builtin_ia32_extrq (v2di, v16qi) -v2di __builtin_ia32_extrqi (v2di, const unsigned int, const unsigned int) -v2di __builtin_ia32_insertq (v2di, v2di) -v2di __builtin_ia32_insertqi (v2di, v2di, const unsigned int, const unsigned int) -@end smallexample - -The following built-in functions are available when @option{-mxop} is used. -@smallexample -v2df __builtin_ia32_vfrczpd (v2df) -v4sf __builtin_ia32_vfrczps (v4sf) -v2df __builtin_ia32_vfrczsd (v2df) -v4sf __builtin_ia32_vfrczss (v4sf) -v4df __builtin_ia32_vfrczpd256 (v4df) -v8sf __builtin_ia32_vfrczps256 (v8sf) -v2di __builtin_ia32_vpcmov (v2di, v2di, v2di) -v2di __builtin_ia32_vpcmov_v2di (v2di, v2di, v2di) -v4si __builtin_ia32_vpcmov_v4si (v4si, v4si, v4si) -v8hi __builtin_ia32_vpcmov_v8hi (v8hi, v8hi, v8hi) -v16qi __builtin_ia32_vpcmov_v16qi (v16qi, v16qi, v16qi) -v2df __builtin_ia32_vpcmov_v2df (v2df, v2df, v2df) -v4sf __builtin_ia32_vpcmov_v4sf (v4sf, v4sf, v4sf) -v4di __builtin_ia32_vpcmov_v4di256 (v4di, v4di, v4di) -v8si __builtin_ia32_vpcmov_v8si256 (v8si, v8si, v8si) -v16hi __builtin_ia32_vpcmov_v16hi256 (v16hi, v16hi, v16hi) -v32qi __builtin_ia32_vpcmov_v32qi256 (v32qi, v32qi, v32qi) -v4df __builtin_ia32_vpcmov_v4df256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vpcmov_v8sf256 (v8sf, v8sf, v8sf) -v16qi __builtin_ia32_vpcomeqb (v16qi, v16qi) -v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi) -v4si __builtin_ia32_vpcomeqd (v4si, v4si) -v2di __builtin_ia32_vpcomeqq (v2di, v2di) -v16qi __builtin_ia32_vpcomequb (v16qi, v16qi) -v4si __builtin_ia32_vpcomequd (v4si, v4si) -v2di __builtin_ia32_vpcomequq (v2di, v2di) -v8hi __builtin_ia32_vpcomequw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi) -v16qi __builtin_ia32_vpcomfalseb (v16qi, v16qi) -v4si __builtin_ia32_vpcomfalsed (v4si, v4si) -v2di __builtin_ia32_vpcomfalseq (v2di, v2di) -v16qi __builtin_ia32_vpcomfalseub (v16qi, v16qi) -v4si __builtin_ia32_vpcomfalseud (v4si, v4si) -v2di __builtin_ia32_vpcomfalseuq (v2di, v2di) -v8hi __builtin_ia32_vpcomfalseuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomfalsew (v8hi, v8hi) -v16qi __builtin_ia32_vpcomgeb (v16qi, v16qi) -v4si __builtin_ia32_vpcomged (v4si, v4si) -v2di __builtin_ia32_vpcomgeq (v2di, v2di) -v16qi __builtin_ia32_vpcomgeub (v16qi, v16qi) -v4si __builtin_ia32_vpcomgeud (v4si, v4si) -v2di __builtin_ia32_vpcomgeuq (v2di, v2di) -v8hi __builtin_ia32_vpcomgeuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomgew (v8hi, v8hi) -v16qi __builtin_ia32_vpcomgtb (v16qi, v16qi) -v4si __builtin_ia32_vpcomgtd (v4si, v4si) -v2di __builtin_ia32_vpcomgtq (v2di, v2di) -v16qi __builtin_ia32_vpcomgtub (v16qi, v16qi) -v4si __builtin_ia32_vpcomgtud (v4si, v4si) -v2di __builtin_ia32_vpcomgtuq (v2di, v2di) -v8hi __builtin_ia32_vpcomgtuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomgtw (v8hi, v8hi) -v16qi __builtin_ia32_vpcomleb (v16qi, v16qi) -v4si __builtin_ia32_vpcomled (v4si, v4si) -v2di __builtin_ia32_vpcomleq (v2di, v2di) -v16qi __builtin_ia32_vpcomleub (v16qi, v16qi) -v4si __builtin_ia32_vpcomleud (v4si, v4si) -v2di __builtin_ia32_vpcomleuq (v2di, v2di) -v8hi __builtin_ia32_vpcomleuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomlew (v8hi, v8hi) -v16qi __builtin_ia32_vpcomltb (v16qi, v16qi) -v4si __builtin_ia32_vpcomltd (v4si, v4si) -v2di __builtin_ia32_vpcomltq (v2di, v2di) -v16qi __builtin_ia32_vpcomltub (v16qi, v16qi) -v4si __builtin_ia32_vpcomltud (v4si, v4si) -v2di __builtin_ia32_vpcomltuq (v2di, v2di) -v8hi __builtin_ia32_vpcomltuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomltw (v8hi, v8hi) -v16qi __builtin_ia32_vpcomneb (v16qi, v16qi) -v4si __builtin_ia32_vpcomned (v4si, v4si) -v2di __builtin_ia32_vpcomneq (v2di, v2di) -v16qi __builtin_ia32_vpcomneub (v16qi, v16qi) -v4si __builtin_ia32_vpcomneud (v4si, v4si) -v2di __builtin_ia32_vpcomneuq (v2di, v2di) -v8hi __builtin_ia32_vpcomneuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomnew (v8hi, v8hi) -v16qi __builtin_ia32_vpcomtrueb (v16qi, v16qi) -v4si __builtin_ia32_vpcomtrued (v4si, v4si) -v2di __builtin_ia32_vpcomtrueq (v2di, v2di) -v16qi __builtin_ia32_vpcomtrueub (v16qi, v16qi) -v4si __builtin_ia32_vpcomtrueud (v4si, v4si) -v2di __builtin_ia32_vpcomtrueuq (v2di, v2di) -v8hi __builtin_ia32_vpcomtrueuw (v8hi, v8hi) -v8hi __builtin_ia32_vpcomtruew (v8hi, v8hi) -v4si __builtin_ia32_vphaddbd (v16qi) -v2di __builtin_ia32_vphaddbq (v16qi) -v8hi __builtin_ia32_vphaddbw (v16qi) -v2di __builtin_ia32_vphadddq (v4si) -v4si __builtin_ia32_vphaddubd (v16qi) -v2di __builtin_ia32_vphaddubq (v16qi) -v8hi __builtin_ia32_vphaddubw (v16qi) -v2di __builtin_ia32_vphaddudq (v4si) -v4si __builtin_ia32_vphadduwd (v8hi) -v2di __builtin_ia32_vphadduwq (v8hi) -v4si __builtin_ia32_vphaddwd (v8hi) -v2di __builtin_ia32_vphaddwq (v8hi) -v8hi __builtin_ia32_vphsubbw (v16qi) -v2di __builtin_ia32_vphsubdq (v4si) -v4si __builtin_ia32_vphsubwd (v8hi) -v4si __builtin_ia32_vpmacsdd (v4si, v4si, v4si) -v2di __builtin_ia32_vpmacsdqh (v4si, v4si, v2di) -v2di __builtin_ia32_vpmacsdql (v4si, v4si, v2di) -v4si __builtin_ia32_vpmacssdd (v4si, v4si, v4si) -v2di __builtin_ia32_vpmacssdqh (v4si, v4si, v2di) -v2di __builtin_ia32_vpmacssdql (v4si, v4si, v2di) -v4si __builtin_ia32_vpmacsswd (v8hi, v8hi, v4si) -v8hi __builtin_ia32_vpmacssww (v8hi, v8hi, v8hi) -v4si __builtin_ia32_vpmacswd (v8hi, v8hi, v4si) -v8hi __builtin_ia32_vpmacsww (v8hi, v8hi, v8hi) -v4si __builtin_ia32_vpmadcsswd (v8hi, v8hi, v4si) -v4si __builtin_ia32_vpmadcswd (v8hi, v8hi, v4si) -v16qi __builtin_ia32_vpperm (v16qi, v16qi, v16qi) -v16qi __builtin_ia32_vprotb (v16qi, v16qi) -v4si __builtin_ia32_vprotd (v4si, v4si) -v2di __builtin_ia32_vprotq (v2di, v2di) -v8hi __builtin_ia32_vprotw (v8hi, v8hi) -v16qi __builtin_ia32_vpshab (v16qi, v16qi) -v4si __builtin_ia32_vpshad (v4si, v4si) -v2di __builtin_ia32_vpshaq (v2di, v2di) -v8hi __builtin_ia32_vpshaw (v8hi, v8hi) -v16qi __builtin_ia32_vpshlb (v16qi, v16qi) -v4si __builtin_ia32_vpshld (v4si, v4si) -v2di __builtin_ia32_vpshlq (v2di, v2di) -v8hi __builtin_ia32_vpshlw (v8hi, v8hi) -@end smallexample - -The following built-in functions are available when @option{-mfma4} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -v2df __builtin_ia32_vfmaddpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmaddps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfmaddsd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmaddss (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfmsubpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmsubps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfmsubsd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmsubss (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfnmaddpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfnmaddps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfnmaddsd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfnmaddss (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfnmsubpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfnmsubps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfnmsubsd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfnmsubss (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfmaddsubpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmaddsubps (v4sf, v4sf, v4sf) -v2df __builtin_ia32_vfmsubaddpd (v2df, v2df, v2df) -v4sf __builtin_ia32_vfmsubaddps (v4sf, v4sf, v4sf) -v4df __builtin_ia32_vfmaddpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfmaddps256 (v8sf, v8sf, v8sf) -v4df __builtin_ia32_vfmsubpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfmsubps256 (v8sf, v8sf, v8sf) -v4df __builtin_ia32_vfnmaddpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfnmaddps256 (v8sf, v8sf, v8sf) -v4df __builtin_ia32_vfnmsubpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfnmsubps256 (v8sf, v8sf, v8sf) -v4df __builtin_ia32_vfmaddsubpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfmaddsubps256 (v8sf, v8sf, v8sf) -v4df __builtin_ia32_vfmsubaddpd256 (v4df, v4df, v4df) -v8sf __builtin_ia32_vfmsubaddps256 (v8sf, v8sf, v8sf) - -@end smallexample - -The following built-in functions are available when @option{-mlwp} is used. - -@smallexample -void __builtin_ia32_llwpcb16 (void *); -void __builtin_ia32_llwpcb32 (void *); -void __builtin_ia32_llwpcb64 (void *); -void * __builtin_ia32_llwpcb16 (void); -void * __builtin_ia32_llwpcb32 (void); -void * __builtin_ia32_llwpcb64 (void); -void __builtin_ia32_lwpval16 (unsigned short, unsigned int, unsigned short) -void __builtin_ia32_lwpval32 (unsigned int, unsigned int, unsigned int) -void __builtin_ia32_lwpval64 (unsigned __int64, unsigned int, unsigned int) -unsigned char __builtin_ia32_lwpins16 (unsigned short, unsigned int, unsigned short) -unsigned char __builtin_ia32_lwpins32 (unsigned int, unsigned int, unsigned int) -unsigned char __builtin_ia32_lwpins64 (unsigned __int64, unsigned int, unsigned int) -@end smallexample - -The following built-in functions are available when @option{-mbmi} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -unsigned int __builtin_ia32_bextr_u32(unsigned int, unsigned int); -unsigned long long __builtin_ia32_bextr_u64 (unsigned long long, unsigned long long); -@end smallexample - -The following built-in functions are available when @option{-mbmi2} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -unsigned int _bzhi_u32 (unsigned int, unsigned int) -unsigned int _pdep_u32 (unsigned int, unsigned int) -unsigned int _pext_u32 (unsigned int, unsigned int) -unsigned long long _bzhi_u64 (unsigned long long, unsigned long long) -unsigned long long _pdep_u64 (unsigned long long, unsigned long long) -unsigned long long _pext_u64 (unsigned long long, unsigned long long) -@end smallexample - -The following built-in functions are available when @option{-mlzcnt} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -unsigned short __builtin_ia32_lzcnt_16(unsigned short); -unsigned int __builtin_ia32_lzcnt_u32(unsigned int); -unsigned long long __builtin_ia32_lzcnt_u64 (unsigned long long); -@end smallexample - -The following built-in functions are available when @option{-mfxsr} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -void __builtin_ia32_fxsave (void *) -void __builtin_ia32_fxrstor (void *) -void __builtin_ia32_fxsave64 (void *) -void __builtin_ia32_fxrstor64 (void *) -@end smallexample - -The following built-in functions are available when @option{-mxsave} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -void __builtin_ia32_xsave (void *, long long) -void __builtin_ia32_xrstor (void *, long long) -void __builtin_ia32_xsave64 (void *, long long) -void __builtin_ia32_xrstor64 (void *, long long) -@end smallexample - -The following built-in functions are available when @option{-mxsaveopt} is used. -All of them generate the machine instruction that is part of the name. -@smallexample -void __builtin_ia32_xsaveopt (void *, long long) -void __builtin_ia32_xsaveopt64 (void *, long long) -@end smallexample - -The following built-in functions are available when @option{-mtbm} is used. -Both of them generate the immediate form of the bextr machine instruction. -@smallexample -unsigned int __builtin_ia32_bextri_u32 (unsigned int, const unsigned int); -unsigned long long __builtin_ia32_bextri_u64 (unsigned long long, const unsigned long long); -@end smallexample - - -The following built-in functions are available when @option{-m3dnow} is used. -All of them generate the machine instruction that is part of the name. - -@smallexample -void __builtin_ia32_femms (void) -v8qi __builtin_ia32_pavgusb (v8qi, v8qi) -v2si __builtin_ia32_pf2id (v2sf) -v2sf __builtin_ia32_pfacc (v2sf, v2sf) -v2sf __builtin_ia32_pfadd (v2sf, v2sf) -v2si __builtin_ia32_pfcmpeq (v2sf, v2sf) -v2si __builtin_ia32_pfcmpge (v2sf, v2sf) -v2si __builtin_ia32_pfcmpgt (v2sf, v2sf) -v2sf __builtin_ia32_pfmax (v2sf, v2sf) -v2sf __builtin_ia32_pfmin (v2sf, v2sf) -v2sf __builtin_ia32_pfmul (v2sf, v2sf) -v2sf __builtin_ia32_pfrcp (v2sf) -v2sf __builtin_ia32_pfrcpit1 (v2sf, v2sf) -v2sf __builtin_ia32_pfrcpit2 (v2sf, v2sf) -v2sf __builtin_ia32_pfrsqrt (v2sf) -v2sf __builtin_ia32_pfsub (v2sf, v2sf) -v2sf __builtin_ia32_pfsubr (v2sf, v2sf) -v2sf __builtin_ia32_pi2fd (v2si) -v4hi __builtin_ia32_pmulhrw (v4hi, v4hi) -@end smallexample - -The following built-in functions are available when both @option{-m3dnow} -and @option{-march=athlon} are used. All of them generate the machine -instruction that is part of the name. - -@smallexample -v2si __builtin_ia32_pf2iw (v2sf) -v2sf __builtin_ia32_pfnacc (v2sf, v2sf) -v2sf __builtin_ia32_pfpnacc (v2sf, v2sf) -v2sf __builtin_ia32_pi2fw (v2si) -v2sf __builtin_ia32_pswapdsf (v2sf) -v2si __builtin_ia32_pswapdsi (v2si) -@end smallexample - -The following built-in functions are available when @option{-mrtm} is used -They are used for restricted transactional memory. These are the internal -low level functions. Normally the functions in -@ref{x86 transactional memory intrinsics} should be used instead. - -@smallexample -int __builtin_ia32_xbegin () -void __builtin_ia32_xend () -void __builtin_ia32_xabort (status) -int __builtin_ia32_xtest () -@end smallexample - -@node x86 transactional memory intrinsics -@subsection x86 Transactional Memory Intrinsics - -These hardware transactional memory intrinsics for x86 allow you to use -memory transactions with RTM (Restricted Transactional Memory). -This support is enabled with the @option{-mrtm} option. -For using HLE (Hardware Lock Elision) see -@ref{x86 specific memory model extensions for transactional memory} instead. - -A memory transaction commits all changes to memory in an atomic way, -as visible to other threads. If the transaction fails it is rolled back -and all side effects discarded. - -Generally there is no guarantee that a memory transaction ever succeeds -and suitable fallback code always needs to be supplied. - -@deftypefn {RTM Function} {unsigned} _xbegin () -Start a RTM (Restricted Transactional Memory) transaction. -Returns @code{_XBEGIN_STARTED} when the transaction -started successfully (note this is not 0, so the constant has to be -explicitly tested). - -If the transaction aborts, all side-effects -are undone and an abort code encoded as a bit mask is returned. -The following macros are defined: - -@table @code -@item _XABORT_EXPLICIT -Transaction was explicitly aborted with @code{_xabort}. The parameter passed -to @code{_xabort} is available with @code{_XABORT_CODE(status)}. -@item _XABORT_RETRY -Transaction retry is possible. -@item _XABORT_CONFLICT -Transaction abort due to a memory conflict with another thread. -@item _XABORT_CAPACITY -Transaction abort due to the transaction using too much memory. -@item _XABORT_DEBUG -Transaction abort due to a debug trap. -@item _XABORT_NESTED -Transaction abort in an inner nested transaction. -@end table - -There is no guarantee -any transaction ever succeeds, so there always needs to be a valid -fallback path. -@end deftypefn - -@deftypefn {RTM Function} {void} _xend () -Commit the current transaction. When no transaction is active this faults. -All memory side-effects of the transaction become visible -to other threads in an atomic manner. -@end deftypefn - -@deftypefn {RTM Function} {int} _xtest () -Return a nonzero value if a transaction is currently active, otherwise 0. -@end deftypefn - -@deftypefn {RTM Function} {void} _xabort (status) -Abort the current transaction. When no transaction is active this is a no-op. -The @var{status} is an 8-bit constant; its value is encoded in the return -value from @code{_xbegin}. -@end deftypefn - -Here is an example showing handling for @code{_XABORT_RETRY} -and a fallback path for other failures: - -@smallexample -#include - -int n_tries, max_tries; -unsigned status = _XABORT_EXPLICIT; -... - -for (n_tries = 0; n_tries < max_tries; n_tries++) - @{ - status = _xbegin (); - if (status == _XBEGIN_STARTED || !(status & _XABORT_RETRY)) - break; - @} -if (status == _XBEGIN_STARTED) - @{ - ... transaction code... - _xend (); - @} -else - @{ - ... non-transactional fallback path... - @} -@end smallexample - -@noindent -Note that, in most cases, the transactional and non-transactional code -must synchronize together to ensure consistency. - -@node Target Format Checks -@section Format Checks Specific to Particular Target Machines - -For some target machines, GCC supports additional options to the -format attribute -(@pxref{Function Attributes,,Declaring Attributes of Functions}). - -@menu -* Solaris Format Checks:: -* Darwin Format Checks:: -@end menu - -@node Solaris Format Checks -@subsection Solaris Format Checks - -Solaris targets support the @code{cmn_err} (or @code{__cmn_err__}) format -check. @code{cmn_err} accepts a subset of the standard @code{printf} -conversions, and the two-argument @code{%b} conversion for displaying -bit-fields. See the Solaris man page for @code{cmn_err} for more information. - -@node Darwin Format Checks -@subsection Darwin Format Checks - -Darwin targets support the @code{CFString} (or @code{__CFString__}) in the format -attribute context. Declarations made with such attribution are parsed for correct syntax -and format argument types. However, parsing of the format string itself is currently undefined -and is not carried out by this version of the compiler. - -Additionally, @code{CFStringRefs} (defined by the @code{CoreFoundation} headers) may -also be used as format arguments. Note that the relevant headers are only likely to be -available on Darwin (OSX) installations. On such installations, the XCode and system -documentation provide descriptions of @code{CFString}, @code{CFStringRefs} and -associated functions. - -@node Pragmas -@section Pragmas Accepted by GCC -@cindex pragmas -@cindex @code{#pragma} - -GCC supports several types of pragmas, primarily in order to compile -code originally written for other compilers. Note that in general -we do not recommend the use of pragmas; @xref{Function Attributes}, -for further explanation. - -@menu -* ARM Pragmas:: -* M32C Pragmas:: -* MeP Pragmas:: -* RS/6000 and PowerPC Pragmas:: -* Darwin Pragmas:: -* Solaris Pragmas:: -* Symbol-Renaming Pragmas:: -* Structure-Packing Pragmas:: -* Weak Pragmas:: -* Diagnostic Pragmas:: -* Visibility Pragmas:: -* Push/Pop Macro Pragmas:: -* Function Specific Option Pragmas:: -* Loop-Specific Pragmas:: -@end menu - -@node ARM Pragmas -@subsection ARM Pragmas - -The ARM target defines pragmas for controlling the default addition of -@code{long_call} and @code{short_call} attributes to functions. -@xref{Function Attributes}, for information about the effects of these -attributes. - -@table @code -@item long_calls -@cindex pragma, long_calls -Set all subsequent functions to have the @code{long_call} attribute. - -@item no_long_calls -@cindex pragma, no_long_calls -Set all subsequent functions to have the @code{short_call} attribute. - -@item long_calls_off -@cindex pragma, long_calls_off -Do not affect the @code{long_call} or @code{short_call} attributes of -subsequent functions. -@end table - -@node M32C Pragmas -@subsection M32C Pragmas - -@table @code -@item GCC memregs @var{number} -@cindex pragma, memregs -Overrides the command-line option @code{-memregs=} for the current -file. Use with care! This pragma must be before any function in the -file, and mixing different memregs values in different objects may -make them incompatible. This pragma is useful when a -performance-critical function uses a memreg for temporary values, -as it may allow you to reduce the number of memregs used. - -@item ADDRESS @var{name} @var{address} -@cindex pragma, address -For any declared symbols matching @var{name}, this does three things -to that symbol: it forces the symbol to be located at the given -address (a number), it forces the symbol to be volatile, and it -changes the symbol's scope to be static. This pragma exists for -compatibility with other compilers, but note that the common -@code{1234H} numeric syntax is not supported (use @code{0x1234} -instead). Example: - -@smallexample -#pragma ADDRESS port3 0x103 -char port3; -@end smallexample - -@end table - -@node MeP Pragmas -@subsection MeP Pragmas - -@table @code - -@item custom io_volatile (on|off) -@cindex pragma, custom io_volatile -Overrides the command-line option @code{-mio-volatile} for the current -file. Note that for compatibility with future GCC releases, this -option should only be used once before any @code{io} variables in each -file. - -@item GCC coprocessor available @var{registers} -@cindex pragma, coprocessor available -Specifies which coprocessor registers are available to the register -allocator. @var{registers} may be a single register, register range -separated by ellipses, or comma-separated list of those. Example: - -@smallexample -#pragma GCC coprocessor available $c0...$c10, $c28 -@end smallexample - -@item GCC coprocessor call_saved @var{registers} -@cindex pragma, coprocessor call_saved -Specifies which coprocessor registers are to be saved and restored by -any function using them. @var{registers} may be a single register, -register range separated by ellipses, or comma-separated list of -those. Example: - -@smallexample -#pragma GCC coprocessor call_saved $c4...$c6, $c31 -@end smallexample - -@item GCC coprocessor subclass '(A|B|C|D)' = @var{registers} -@cindex pragma, coprocessor subclass -Creates and defines a register class. These register classes can be -used by inline @code{asm} constructs. @var{registers} may be a single -register, register range separated by ellipses, or comma-separated -list of those. Example: - -@smallexample -#pragma GCC coprocessor subclass 'B' = $c2, $c4, $c6 - -asm ("cpfoo %0" : "=B" (x)); -@end smallexample - -@item GCC disinterrupt @var{name} , @var{name} @dots{} -@cindex pragma, disinterrupt -For the named functions, the compiler adds code to disable interrupts -for the duration of those functions. If any functions so named -are not encountered in the source, a warning is emitted that the pragma is -not used. Examples: - -@smallexample -#pragma disinterrupt foo -#pragma disinterrupt bar, grill -int foo () @{ @dots{} @} -@end smallexample - -@item GCC call @var{name} , @var{name} @dots{} -@cindex pragma, call -For the named functions, the compiler always uses a register-indirect -call model when calling the named functions. Examples: - -@smallexample -extern int foo (); -#pragma call foo -@end smallexample - -@end table - -@node RS/6000 and PowerPC Pragmas -@subsection RS/6000 and PowerPC Pragmas - -The RS/6000 and PowerPC targets define one pragma for controlling -whether or not the @code{longcall} attribute is added to function -declarations by default. This pragma overrides the @option{-mlongcall} -option, but not the @code{longcall} and @code{shortcall} attributes. -@xref{RS/6000 and PowerPC Options}, for more information about when long -calls are and are not necessary. - -@table @code -@item longcall (1) -@cindex pragma, longcall -Apply the @code{longcall} attribute to all subsequent function -declarations. - -@item longcall (0) -Do not apply the @code{longcall} attribute to subsequent function -declarations. -@end table - -@c Describe h8300 pragmas here. -@c Describe sh pragmas here. -@c Describe v850 pragmas here. - -@node Darwin Pragmas -@subsection Darwin Pragmas - -The following pragmas are available for all architectures running the -Darwin operating system. These are useful for compatibility with other -Mac OS compilers. - -@table @code -@item mark @var{tokens}@dots{} -@cindex pragma, mark -This pragma is accepted, but has no effect. - -@item options align=@var{alignment} -@cindex pragma, options align -This pragma sets the alignment of fields in structures. The values of -@var{alignment} may be @code{mac68k}, to emulate m68k alignment, or -@code{power}, to emulate PowerPC alignment. Uses of this pragma nest -properly; to restore the previous setting, use @code{reset} for the -@var{alignment}. - -@item segment @var{tokens}@dots{} -@cindex pragma, segment -This pragma is accepted, but has no effect. - -@item unused (@var{var} [, @var{var}]@dots{}) -@cindex pragma, unused -This pragma declares variables to be possibly unused. GCC does not -produce warnings for the listed variables. The effect is similar to -that of the @code{unused} attribute, except that this pragma may appear -anywhere within the variables' scopes. -@end table - -@node Solaris Pragmas -@subsection Solaris Pragmas - -The Solaris target supports @code{#pragma redefine_extname} -(@pxref{Symbol-Renaming Pragmas}). It also supports additional -@code{#pragma} directives for compatibility with the system compiler. - -@table @code -@item align @var{alignment} (@var{variable} [, @var{variable}]...) -@cindex pragma, align - -Increase the minimum alignment of each @var{variable} to @var{alignment}. -This is the same as GCC's @code{aligned} attribute @pxref{Variable -Attributes}). Macro expansion occurs on the arguments to this pragma -when compiling C and Objective-C@. It does not currently occur when -compiling C++, but this is a bug which may be fixed in a future -release. - -@item fini (@var{function} [, @var{function}]...) -@cindex pragma, fini - -This pragma causes each listed @var{function} to be called after -main, or during shared module unloading, by adding a call to the -@code{.fini} section. - -@item init (@var{function} [, @var{function}]...) -@cindex pragma, init - -This pragma causes each listed @var{function} to be called during -initialization (before @code{main}) or during shared module loading, by -adding a call to the @code{.init} section. - -@end table - -@node Symbol-Renaming Pragmas -@subsection Symbol-Renaming Pragmas - -GCC supports a @code{#pragma} directive that changes the name used in -assembly for a given declaration. While this pragma is supported on all -platforms, it is intended primarily to provide compatibility with the -Solaris system headers. This effect can also be achieved using the asm -labels extension (@pxref{Asm Labels}). - -@table @code -@item redefine_extname @var{oldname} @var{newname} -@cindex pragma, redefine_extname - -This pragma gives the C function @var{oldname} the assembly symbol -@var{newname}. The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME} -is defined if this pragma is available (currently on all platforms). -@end table - -This pragma and the asm labels extension interact in a complicated -manner. Here are some corner cases you may want to be aware of: - -@enumerate -@item This pragma silently applies only to declarations with external -linkage. Asm labels do not have this restriction. - -@item In C++, this pragma silently applies only to declarations with -``C'' linkage. Again, asm labels do not have this restriction. - -@item If either of the ways of changing the assembly name of a -declaration are applied to a declaration whose assembly name has -already been determined (either by a previous use of one of these -features, or because the compiler needed the assembly name in order to -generate code), and the new name is different, a warning issues and -the name does not change. - -@item The @var{oldname} used by @code{#pragma redefine_extname} is -always the C-language name. -@end enumerate - -@node Structure-Packing Pragmas -@subsection Structure-Packing Pragmas - -For compatibility with Microsoft Windows compilers, GCC supports a -set of @code{#pragma} directives that change the maximum alignment of -members of structures (other than zero-width bit-fields), unions, and -classes subsequently defined. The @var{n} value below always is required -to be a small power of two and specifies the new alignment in bytes. - -@enumerate -@item @code{#pragma pack(@var{n})} simply sets the new alignment. -@item @code{#pragma pack()} sets the alignment to the one that was in -effect when compilation started (see also command-line option -@option{-fpack-struct[=@var{n}]} @pxref{Code Gen Options}). -@item @code{#pragma pack(push[,@var{n}])} pushes the current alignment -setting on an internal stack and then optionally sets the new alignment. -@item @code{#pragma pack(pop)} restores the alignment setting to the one -saved at the top of the internal stack (and removes that stack entry). -Note that @code{#pragma pack([@var{n}])} does not influence this internal -stack; thus it is possible to have @code{#pragma pack(push)} followed by -multiple @code{#pragma pack(@var{n})} instances and finalized by a single -@code{#pragma pack(pop)}. -@end enumerate - -Some targets, e.g.@: x86 and PowerPC, support the @code{ms_struct} -@code{#pragma} which lays out a structure as the documented -@code{__attribute__ ((ms_struct))}. -@enumerate -@item @code{#pragma ms_struct on} turns on the layout for structures -declared. -@item @code{#pragma ms_struct off} turns off the layout for structures -declared. -@item @code{#pragma ms_struct reset} goes back to the default layout. -@end enumerate - -@node Weak Pragmas -@subsection Weak Pragmas - -For compatibility with SVR4, GCC supports a set of @code{#pragma} -directives for declaring symbols to be weak, and defining weak -aliases. - -@table @code -@item #pragma weak @var{symbol} -@cindex pragma, weak -This pragma declares @var{symbol} to be weak, as if the declaration -had the attribute of the same name. The pragma may appear before -or after the declaration of @var{symbol}. It is not an error for -@var{symbol} to never be defined at all. - -@item #pragma weak @var{symbol1} = @var{symbol2} -This pragma declares @var{symbol1} to be a weak alias of @var{symbol2}. -It is an error if @var{symbol2} is not defined in the current -translation unit. -@end table - -@node Diagnostic Pragmas -@subsection Diagnostic Pragmas - -GCC allows the user to selectively enable or disable certain types of -diagnostics, and change the kind of the diagnostic. For example, a -project's policy might require that all sources compile with -@option{-Werror} but certain files might have exceptions allowing -specific types of warnings. Or, a project might selectively enable -diagnostics and treat them as errors depending on which preprocessor -macros are defined. - -@table @code -@item #pragma GCC diagnostic @var{kind} @var{option} -@cindex pragma, diagnostic - -Modifies the disposition of a diagnostic. Note that not all -diagnostics are modifiable; at the moment only warnings (normally -controlled by @samp{-W@dots{}}) can be controlled, and not all of them. -Use @option{-fdiagnostics-show-option} to determine which diagnostics -are controllable and which option controls them. - -@var{kind} is @samp{error} to treat this diagnostic as an error, -@samp{warning} to treat it like a warning (even if @option{-Werror} is -in effect), or @samp{ignored} if the diagnostic is to be ignored. -@var{option} is a double quoted string that matches the command-line -option. - -@smallexample -#pragma GCC diagnostic warning "-Wformat" -#pragma GCC diagnostic error "-Wformat" -#pragma GCC diagnostic ignored "-Wformat" -@end smallexample - -Note that these pragmas override any command-line options. GCC keeps -track of the location of each pragma, and issues diagnostics according -to the state as of that point in the source file. Thus, pragmas occurring -after a line do not affect diagnostics caused by that line. - -@item #pragma GCC diagnostic push -@itemx #pragma GCC diagnostic pop - -Causes GCC to remember the state of the diagnostics as of each -@code{push}, and restore to that point at each @code{pop}. If a -@code{pop} has no matching @code{push}, the command-line options are -restored. - -@smallexample -#pragma GCC diagnostic error "-Wuninitialized" - foo(a); /* error is given for this one */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" - foo(b); /* no diagnostic for this one */ -#pragma GCC diagnostic pop - foo(c); /* error is given for this one */ -#pragma GCC diagnostic pop - foo(d); /* depends on command-line options */ -@end smallexample - -@end table - -GCC also offers a simple mechanism for printing messages during -compilation. - -@table @code -@item #pragma message @var{string} -@cindex pragma, diagnostic - -Prints @var{string} as a compiler message on compilation. The message -is informational only, and is neither a compilation warning nor an error. - -@smallexample -#pragma message "Compiling " __FILE__ "..." -@end smallexample - -@var{string} may be parenthesized, and is printed with location -information. For example, - -@smallexample -#define DO_PRAGMA(x) _Pragma (#x) -#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) - -TODO(Remember to fix this) -@end smallexample - -@noindent -prints @samp{/tmp/file.c:4: note: #pragma message: -TODO - Remember to fix this}. - -@end table - -@node Visibility Pragmas -@subsection Visibility Pragmas - -@table @code -@item #pragma GCC visibility push(@var{visibility}) -@itemx #pragma GCC visibility pop -@cindex pragma, visibility - -This pragma allows the user to set the visibility for multiple -declarations without having to give each a visibility attribute -(@pxref{Function Attributes}). - -In C++, @samp{#pragma GCC visibility} affects only namespace-scope -declarations. Class members and template specializations are not -affected; if you want to override the visibility for a particular -member or instantiation, you must use an attribute. - -@end table - - -@node Push/Pop Macro Pragmas -@subsection Push/Pop Macro Pragmas - -For compatibility with Microsoft Windows compilers, GCC supports -@samp{#pragma push_macro(@var{"macro_name"})} -and @samp{#pragma pop_macro(@var{"macro_name"})}. - -@table @code -@item #pragma push_macro(@var{"macro_name"}) -@cindex pragma, push_macro -This pragma saves the value of the macro named as @var{macro_name} to -the top of the stack for this macro. - -@item #pragma pop_macro(@var{"macro_name"}) -@cindex pragma, pop_macro -This pragma sets the value of the macro named as @var{macro_name} to -the value on top of the stack for this macro. If the stack for -@var{macro_name} is empty, the value of the macro remains unchanged. -@end table - -For example: - -@smallexample -#define X 1 -#pragma push_macro("X") -#undef X -#define X -1 -#pragma pop_macro("X") -int x [X]; -@end smallexample - -@noindent -In this example, the definition of X as 1 is saved by @code{#pragma -push_macro} and restored by @code{#pragma pop_macro}. - -@node Function Specific Option Pragmas -@subsection Function Specific Option Pragmas - -@table @code -@item #pragma GCC target (@var{"string"}...) -@cindex pragma GCC target - -This pragma allows you to set target specific options for functions -defined later in the source file. One or more strings can be -specified. Each function that is defined after this point is as -if @code{attribute((target("STRING")))} was specified for that -function. The parenthesis around the options is optional. -@xref{Function Attributes}, for more information about the -@code{target} attribute and the attribute syntax. - -The @code{#pragma GCC target} pragma is presently implemented for -x86, PowerPC, and Nios II targets only. -@end table - -@table @code -@item #pragma GCC optimize (@var{"string"}...) -@cindex pragma GCC optimize - -This pragma allows you to set global optimization options for functions -defined later in the source file. One or more strings can be -specified. Each function that is defined after this point is as -if @code{attribute((optimize("STRING")))} was specified for that -function. The parenthesis around the options is optional. -@xref{Function Attributes}, for more information about the -@code{optimize} attribute and the attribute syntax. -@end table - -@table @code -@item #pragma GCC push_options -@itemx #pragma GCC pop_options -@cindex pragma GCC push_options -@cindex pragma GCC pop_options - -These pragmas maintain a stack of the current target and optimization -options. It is intended for include files where you temporarily want -to switch to using a different @samp{#pragma GCC target} or -@samp{#pragma GCC optimize} and then to pop back to the previous -options. -@end table - -@table @code -@item #pragma GCC reset_options -@cindex pragma GCC reset_options - -This pragma clears the current @code{#pragma GCC target} and -@code{#pragma GCC optimize} to use the default switches as specified -on the command line. -@end table - -@node Loop-Specific Pragmas -@subsection Loop-Specific Pragmas - -@table @code -@item #pragma GCC ivdep -@cindex pragma GCC ivdep -@end table - -With this pragma, the programmer asserts that there are no loop-carried -dependencies which would prevent consecutive iterations of -the following loop from executing concurrently with SIMD -(single instruction multiple data) instructions. - -For example, the compiler can only unconditionally vectorize the following -loop with the pragma: - -@smallexample -void foo (int n, int *a, int *b, int *c) -@{ - int i, j; -#pragma GCC ivdep - for (i = 0; i < n; ++i) - a[i] = b[i] + c[i]; -@} -@end smallexample - -@noindent -In this example, using the @code{restrict} qualifier had the same -effect. In the following example, that would not be possible. Assume -@math{k < -m} or @math{k >= m}. Only with the pragma, the compiler knows -that it can unconditionally vectorize the following loop: - -@smallexample -void ignore_vec_dep (int *a, int k, int c, int m) -@{ -#pragma GCC ivdep - for (int i = 0; i < m; i++) - a[i] = a[i + k] * c; -@} -@end smallexample - - -@node Unnamed Fields -@section Unnamed Structure and Union Fields -@cindex @code{struct} -@cindex @code{union} - -As permitted by ISO C11 and for compatibility with other compilers, -GCC allows you to define -a structure or union that contains, as fields, structures and unions -without names. For example: - -@smallexample -struct @{ - int a; - union @{ - int b; - float c; - @}; - int d; -@} foo; -@end smallexample - -@noindent -In this example, you are able to access members of the unnamed -union with code like @samp{foo.b}. Note that only unnamed structs and -unions are allowed, you may not have, for example, an unnamed -@code{int}. - -You must never create such structures that cause ambiguous field definitions. -For example, in this structure: - -@smallexample -struct @{ - int a; - struct @{ - int a; - @}; -@} foo; -@end smallexample - -@noindent -it is ambiguous which @code{a} is being referred to with @samp{foo.a}. -The compiler gives errors for such constructs. - -@opindex fms-extensions -Unless @option{-fms-extensions} is used, the unnamed field must be a -structure or union definition without a tag (for example, @samp{struct -@{ int a; @};}). If @option{-fms-extensions} is used, the field may -also be a definition with a tag such as @samp{struct foo @{ int a; -@};}, a reference to a previously defined structure or union such as -@samp{struct foo;}, or a reference to a @code{typedef} name for a -previously defined structure or union type. - -@opindex fplan9-extensions -The option @option{-fplan9-extensions} enables -@option{-fms-extensions} as well as two other extensions. First, a -pointer to a structure is automatically converted to a pointer to an -anonymous field for assignments and function calls. For example: - -@smallexample -struct s1 @{ int a; @}; -struct s2 @{ struct s1; @}; -extern void f1 (struct s1 *); -void f2 (struct s2 *p) @{ f1 (p); @} -@end smallexample - -@noindent -In the call to @code{f1} inside @code{f2}, the pointer @code{p} is -converted into a pointer to the anonymous field. - -Second, when the type of an anonymous field is a @code{typedef} for a -@code{struct} or @code{union}, code may refer to the field using the -name of the @code{typedef}. - -@smallexample -typedef struct @{ int a; @} s1; -struct s2 @{ s1; @}; -s1 f1 (struct s2 *p) @{ return p->s1; @} -@end smallexample - -These usages are only permitted when they are not ambiguous. - -@node Thread-Local -@section Thread-Local Storage -@cindex Thread-Local Storage -@cindex @acronym{TLS} -@cindex @code{__thread} - -Thread-local storage (@acronym{TLS}) is a mechanism by which variables -are allocated such that there is one instance of the variable per extant -thread. The runtime model GCC uses to implement this originates -in the IA-64 processor-specific ABI, but has since been migrated -to other processors as well. It requires significant support from -the linker (@command{ld}), dynamic linker (@command{ld.so}), and -system libraries (@file{libc.so} and @file{libpthread.so}), so it -is not available everywhere. - -At the user level, the extension is visible with a new storage -class keyword: @code{__thread}. For example: - -@smallexample -__thread int i; -extern __thread struct state s; -static __thread char *p; -@end smallexample - -The @code{__thread} specifier may be used alone, with the @code{extern} -or @code{static} specifiers, but with no other storage class specifier. -When used with @code{extern} or @code{static}, @code{__thread} must appear -immediately after the other storage class specifier. - -The @code{__thread} specifier may be applied to any global, file-scoped -static, function-scoped static, or static data member of a class. It may -not be applied to block-scoped automatic or non-static data member. - -When the address-of operator is applied to a thread-local variable, it is -evaluated at run time and returns the address of the current thread's -instance of that variable. An address so obtained may be used by any -thread. When a thread terminates, any pointers to thread-local variables -in that thread become invalid. - -No static initialization may refer to the address of a thread-local variable. - -In C++, if an initializer is present for a thread-local variable, it must -be a @var{constant-expression}, as defined in 5.19.2 of the ANSI/ISO C++ -standard. - -See @uref{http://www.akkadia.org/drepper/tls.pdf, -ELF Handling For Thread-Local Storage} for a detailed explanation of -the four thread-local storage addressing models, and how the runtime -is expected to function. - -@menu -* C99 Thread-Local Edits:: -* C++98 Thread-Local Edits:: -@end menu - -@node C99 Thread-Local Edits -@subsection ISO/IEC 9899:1999 Edits for Thread-Local Storage - -The following are a set of changes to ISO/IEC 9899:1999 (aka C99) -that document the exact semantics of the language extension. - -@itemize @bullet -@item -@cite{5.1.2 Execution environments} - -Add new text after paragraph 1 - -@quotation -Within either execution environment, a @dfn{thread} is a flow of -control within a program. It is implementation defined whether -or not there may be more than one thread associated with a program. -It is implementation defined how threads beyond the first are -created, the name and type of the function called at thread -startup, and how threads may be terminated. However, objects -with thread storage duration shall be initialized before thread -startup. -@end quotation - -@item -@cite{6.2.4 Storage durations of objects} - -Add new text before paragraph 3 - -@quotation -An object whose identifier is declared with the storage-class -specifier @w{@code{__thread}} has @dfn{thread storage duration}. -Its lifetime is the entire execution of the thread, and its -stored value is initialized only once, prior to thread startup. -@end quotation - -@item -@cite{6.4.1 Keywords} - -Add @code{__thread}. - -@item -@cite{6.7.1 Storage-class specifiers} - -Add @code{__thread} to the list of storage class specifiers in -paragraph 1. - -Change paragraph 2 to - -@quotation -With the exception of @code{__thread}, at most one storage-class -specifier may be given [@dots{}]. The @code{__thread} specifier may -be used alone, or immediately following @code{extern} or -@code{static}. -@end quotation - -Add new text after paragraph 6 - -@quotation -The declaration of an identifier for a variable that has -block scope that specifies @code{__thread} shall also -specify either @code{extern} or @code{static}. - -The @code{__thread} specifier shall be used only with -variables. -@end quotation -@end itemize - -@node C++98 Thread-Local Edits -@subsection ISO/IEC 14882:1998 Edits for Thread-Local Storage - -The following are a set of changes to ISO/IEC 14882:1998 (aka C++98) -that document the exact semantics of the language extension. - -@itemize @bullet -@item -@b{[intro.execution]} - -New text after paragraph 4 - -@quotation -A @dfn{thread} is a flow of control within the abstract machine. -It is implementation defined whether or not there may be more than -one thread. -@end quotation - -New text after paragraph 7 - -@quotation -It is unspecified whether additional action must be taken to -ensure when and whether side effects are visible to other threads. -@end quotation - -@item -@b{[lex.key]} - -Add @code{__thread}. - -@item -@b{[basic.start.main]} - -Add after paragraph 5 - -@quotation -The thread that begins execution at the @code{main} function is called -the @dfn{main thread}. It is implementation defined how functions -beginning threads other than the main thread are designated or typed. -A function so designated, as well as the @code{main} function, is called -a @dfn{thread startup function}. It is implementation defined what -happens if a thread startup function returns. It is implementation -defined what happens to other threads when any thread calls @code{exit}. -@end quotation - -@item -@b{[basic.start.init]} - -Add after paragraph 4 - -@quotation -The storage for an object of thread storage duration shall be -statically initialized before the first statement of the thread startup -function. An object of thread storage duration shall not require -dynamic initialization. -@end quotation - -@item -@b{[basic.start.term]} - -Add after paragraph 3 - -@quotation -The type of an object with thread storage duration shall not have a -non-trivial destructor, nor shall it be an array type whose elements -(directly or indirectly) have non-trivial destructors. -@end quotation - -@item -@b{[basic.stc]} - -Add ``thread storage duration'' to the list in paragraph 1. - -Change paragraph 2 - -@quotation -Thread, static, and automatic storage durations are associated with -objects introduced by declarations [@dots{}]. -@end quotation - -Add @code{__thread} to the list of specifiers in paragraph 3. - -@item -@b{[basic.stc.thread]} - -New section before @b{[basic.stc.static]} - -@quotation -The keyword @code{__thread} applied to a non-local object gives the -object thread storage duration. - -A local variable or class data member declared both @code{static} -and @code{__thread} gives the variable or member thread storage -duration. -@end quotation - -@item -@b{[basic.stc.static]} - -Change paragraph 1 - -@quotation -All objects that have neither thread storage duration, dynamic -storage duration nor are local [@dots{}]. -@end quotation - -@item -@b{[dcl.stc]} - -Add @code{__thread} to the list in paragraph 1. - -Change paragraph 1 - -@quotation -With the exception of @code{__thread}, at most one -@var{storage-class-specifier} shall appear in a given -@var{decl-specifier-seq}. The @code{__thread} specifier may -be used alone, or immediately following the @code{extern} or -@code{static} specifiers. [@dots{}] -@end quotation - -Add after paragraph 5 - -@quotation -The @code{__thread} specifier can be applied only to the names of objects -and to anonymous unions. -@end quotation - -@item -@b{[class.mem]} - -Add after paragraph 6 - -@quotation -Non-@code{static} members shall not be @code{__thread}. -@end quotation -@end itemize - -@node Binary constants -@section Binary Constants using the @samp{0b} Prefix -@cindex Binary constants using the @samp{0b} prefix - -Integer constants can be written as binary constants, consisting of a -sequence of @samp{0} and @samp{1} digits, prefixed by @samp{0b} or -@samp{0B}. This is particularly useful in environments that operate a -lot on the bit level (like microcontrollers). - -The following statements are identical: - -@smallexample -i = 42; -i = 0x2a; -i = 052; -i = 0b101010; -@end smallexample - -The type of these constants follows the same rules as for octal or -hexadecimal integer constants, so suffixes like @samp{L} or @samp{UL} -can be applied. - -@node C++ Extensions -@chapter Extensions to the C++ Language -@cindex extensions, C++ language -@cindex C++ language extensions - -The GNU compiler provides these extensions to the C++ language (and you -can also use most of the C language extensions in your C++ programs). If you -want to write code that checks whether these features are available, you can -test for the GNU compiler the same way as for C programs: check for a -predefined macro @code{__GNUC__}. You can also use @code{__GNUG__} to -test specifically for GNU C++ (@pxref{Common Predefined Macros,, -Predefined Macros,cpp,The GNU C Preprocessor}). - -@menu -* C++ Volatiles:: What constitutes an access to a volatile object. -* Restricted Pointers:: C99 restricted pointers and references. -* Vague Linkage:: Where G++ puts inlines, vtables and such. -* C++ Interface:: You can use a single C++ header file for both - declarations and definitions. -* Template Instantiation:: Methods for ensuring that exactly one copy of - each needed template instantiation is emitted. -* Bound member functions:: You can extract a function pointer to the - method denoted by a @samp{->*} or @samp{.*} expression. -* C++ Attributes:: Variable, function, and type attributes for C++ only. -* Function Multiversioning:: Declaring multiple function versions. -* Namespace Association:: Strong using-directives for namespace association. -* Type Traits:: Compiler support for type traits -* Java Exceptions:: Tweaking exception handling to work with Java. -* Deprecated Features:: Things will disappear from G++. -* Backwards Compatibility:: Compatibilities with earlier definitions of C++. -@end menu - -@node C++ Volatiles -@section When is a Volatile C++ Object Accessed? -@cindex accessing volatiles -@cindex volatile read -@cindex volatile write -@cindex volatile access - -The C++ standard differs from the C standard in its treatment of -volatile objects. It fails to specify what constitutes a volatile -access, except to say that C++ should behave in a similar manner to C -with respect to volatiles, where possible. However, the different -lvalueness of expressions between C and C++ complicate the behavior. -G++ behaves the same as GCC for volatile access, @xref{C -Extensions,,Volatiles}, for a description of GCC's behavior. - -The C and C++ language specifications differ when an object is -accessed in a void context: - -@smallexample -volatile int *src = @var{somevalue}; -*src; -@end smallexample - -The C++ standard specifies that such expressions do not undergo lvalue -to rvalue conversion, and that the type of the dereferenced object may -be incomplete. The C++ standard does not specify explicitly that it -is lvalue to rvalue conversion that is responsible for causing an -access. There is reason to believe that it is, because otherwise -certain simple expressions become undefined. However, because it -would surprise most programmers, G++ treats dereferencing a pointer to -volatile object of complete type as GCC would do for an equivalent -type in C@. When the object has incomplete type, G++ issues a -warning; if you wish to force an error, you must force a conversion to -rvalue with, for instance, a static cast. - -When using a reference to volatile, G++ does not treat equivalent -expressions as accesses to volatiles, but instead issues a warning that -no volatile is accessed. The rationale for this is that otherwise it -becomes difficult to determine where volatile access occur, and not -possible to ignore the return value from functions returning volatile -references. Again, if you wish to force a read, cast the reference to -an rvalue. - -G++ implements the same behavior as GCC does when assigning to a -volatile object---there is no reread of the assigned-to object, the -assigned rvalue is reused. Note that in C++ assignment expressions -are lvalues, and if used as an lvalue, the volatile object is -referred to. For instance, @var{vref} refers to @var{vobj}, as -expected, in the following example: - -@smallexample -volatile int vobj; -volatile int &vref = vobj = @var{something}; -@end smallexample - -@node Restricted Pointers -@section Restricting Pointer Aliasing -@cindex restricted pointers -@cindex restricted references -@cindex restricted this pointer - -As with the C front end, G++ understands the C99 feature of restricted pointers, -specified with the @code{__restrict__}, or @code{__restrict} type -qualifier. Because you cannot compile C++ by specifying the @option{-std=c99} -language flag, @code{restrict} is not a keyword in C++. - -In addition to allowing restricted pointers, you can specify restricted -references, which indicate that the reference is not aliased in the local -context. - -@smallexample -void fn (int *__restrict__ rptr, int &__restrict__ rref) -@{ - /* @r{@dots{}} */ -@} -@end smallexample - -@noindent -In the body of @code{fn}, @var{rptr} points to an unaliased integer and -@var{rref} refers to a (different) unaliased integer. - -You may also specify whether a member function's @var{this} pointer is -unaliased by using @code{__restrict__} as a member function qualifier. - -@smallexample -void T::fn () __restrict__ -@{ - /* @r{@dots{}} */ -@} -@end smallexample - -@noindent -Within the body of @code{T::fn}, @var{this} has the effective -definition @code{T *__restrict__ const this}. Notice that the -interpretation of a @code{__restrict__} member function qualifier is -different to that of @code{const} or @code{volatile} qualifier, in that it -is applied to the pointer rather than the object. This is consistent with -other compilers that implement restricted pointers. - -As with all outermost parameter qualifiers, @code{__restrict__} is -ignored in function definition matching. This means you only need to -specify @code{__restrict__} in a function definition, rather than -in a function prototype as well. - -@node Vague Linkage -@section Vague Linkage -@cindex vague linkage - -There are several constructs in C++ that require space in the object -file but are not clearly tied to a single translation unit. We say that -these constructs have ``vague linkage''. Typically such constructs are -emitted wherever they are needed, though sometimes we can be more -clever. - -@table @asis -@item Inline Functions -Inline functions are typically defined in a header file which can be -included in many different compilations. Hopefully they can usually be -inlined, but sometimes an out-of-line copy is necessary, if the address -of the function is taken or if inlining fails. In general, we emit an -out-of-line copy in all translation units where one is needed. As an -exception, we only emit inline virtual functions with the vtable, since -it always requires a copy. - -Local static variables and string constants used in an inline function -are also considered to have vague linkage, since they must be shared -between all inlined and out-of-line instances of the function. - -@item VTables -@cindex vtable -C++ virtual functions are implemented in most compilers using a lookup -table, known as a vtable. The vtable contains pointers to the virtual -functions provided by a class, and each object of the class contains a -pointer to its vtable (or vtables, in some multiple-inheritance -situations). If the class declares any non-inline, non-pure virtual -functions, the first one is chosen as the ``key method'' for the class, -and the vtable is only emitted in the translation unit where the key -method is defined. - -@emph{Note:} If the chosen key method is later defined as inline, the -vtable is still emitted in every translation unit that defines it. -Make sure that any inline virtuals are declared inline in the class -body, even if they are not defined there. - -@item @code{type_info} objects -@cindex @code{type_info} -@cindex RTTI -C++ requires information about types to be written out in order to -implement @samp{dynamic_cast}, @samp{typeid} and exception handling. -For polymorphic classes (classes with virtual functions), the @samp{type_info} -object is written out along with the vtable so that @samp{dynamic_cast} -can determine the dynamic type of a class object at run time. For all -other types, we write out the @samp{type_info} object when it is used: when -applying @samp{typeid} to an expression, throwing an object, or -referring to a type in a catch clause or exception specification. - -@item Template Instantiations -Most everything in this section also applies to template instantiations, -but there are other options as well. -@xref{Template Instantiation,,Where's the Template?}. - -@end table - -When used with GNU ld version 2.8 or later on an ELF system such as -GNU/Linux or Solaris 2, or on Microsoft Windows, duplicate copies of -these constructs will be discarded at link time. This is known as -COMDAT support. - -On targets that don't support COMDAT, but do support weak symbols, GCC -uses them. This way one copy overrides all the others, but -the unused copies still take up space in the executable. - -For targets that do not support either COMDAT or weak symbols, -most entities with vague linkage are emitted as local symbols to -avoid duplicate definition errors from the linker. This does not happen -for local statics in inlines, however, as having multiple copies -almost certainly breaks things. - -@xref{C++ Interface,,Declarations and Definitions in One Header}, for -another way to control placement of these constructs. - -@node C++ Interface -@section C++ Interface and Implementation Pragmas - -@cindex interface and implementation headers, C++ -@cindex C++ interface and implementation headers -@cindex pragmas, interface and implementation - -@code{#pragma interface} and @code{#pragma implementation} provide the -user with a way of explicitly directing the compiler to emit entities -with vague linkage (and debugging information) in a particular -translation unit. - -@emph{Note:} These @code{#pragma}s have been superceded as of GCC 2.7.2 -by COMDAT support and the ``key method'' heuristic -mentioned in @ref{Vague Linkage}. Using them can actually cause your -program to grow due to unnecessary out-of-line copies of inline -functions. - -@table @code -@item #pragma interface -@itemx #pragma interface "@var{subdir}/@var{objects}.h" -@kindex #pragma interface -Use this directive in @emph{header files} that define object classes, to save -space in most of the object files that use those classes. Normally, -local copies of certain information (backup copies of inline member -functions, debugging information, and the internal tables that implement -virtual functions) must be kept in each object file that includes class -definitions. You can use this pragma to avoid such duplication. When a -header file containing @samp{#pragma interface} is included in a -compilation, this auxiliary information is not generated (unless -the main input source file itself uses @samp{#pragma implementation}). -Instead, the object files contain references to be resolved at link -time. - -The second form of this directive is useful for the case where you have -multiple headers with the same name in different directories. If you -use this form, you must specify the same string to @samp{#pragma -implementation}. - -@item #pragma implementation -@itemx #pragma implementation "@var{objects}.h" -@kindex #pragma implementation -Use this pragma in a @emph{main input file}, when you want full output from -included header files to be generated (and made globally visible). The -included header file, in turn, should use @samp{#pragma interface}. -Backup copies of inline member functions, debugging information, and the -internal tables used to implement virtual functions are all generated in -implementation files. - -@cindex implied @code{#pragma implementation} -@cindex @code{#pragma implementation}, implied -@cindex naming convention, implementation headers -If you use @samp{#pragma implementation} with no argument, it applies to -an include file with the same basename@footnote{A file's @dfn{basename} -is the name stripped of all leading path information and of trailing -suffixes, such as @samp{.h} or @samp{.C} or @samp{.cc}.} as your source -file. For example, in @file{allclass.cc}, giving just -@samp{#pragma implementation} -by itself is equivalent to @samp{#pragma implementation "allclass.h"}. - -Use the string argument if you want a single implementation file to -include code from multiple header files. (You must also use -@samp{#include} to include the header file; @samp{#pragma -implementation} only specifies how to use the file---it doesn't actually -include it.) - -There is no way to split up the contents of a single header file into -multiple implementation files. -@end table - -@cindex inlining and C++ pragmas -@cindex C++ pragmas, effect on inlining -@cindex pragmas in C++, effect on inlining -@samp{#pragma implementation} and @samp{#pragma interface} also have an -effect on function inlining. - -If you define a class in a header file marked with @samp{#pragma -interface}, the effect on an inline function defined in that class is -similar to an explicit @code{extern} declaration---the compiler emits -no code at all to define an independent version of the function. Its -definition is used only for inlining with its callers. - -@opindex fno-implement-inlines -Conversely, when you include the same header file in a main source file -that declares it as @samp{#pragma implementation}, the compiler emits -code for the function itself; this defines a version of the function -that can be found via pointers (or by callers compiled without -inlining). If all calls to the function can be inlined, you can avoid -emitting the function by compiling with @option{-fno-implement-inlines}. -If any calls are not inlined, you will get linker errors. - -@node Template Instantiation -@section Where's the Template? -@cindex template instantiation - -C++ templates are the first language feature to require more -intelligence from the environment than one usually finds on a UNIX -system. Somehow the compiler and linker have to make sure that each -template instance occurs exactly once in the executable if it is needed, -and not at all otherwise. There are two basic approaches to this -problem, which are referred to as the Borland model and the Cfront model. - -@table @asis -@item Borland model -Borland C++ solved the template instantiation problem by adding the code -equivalent of common blocks to their linker; the compiler emits template -instances in each translation unit that uses them, and the linker -collapses them together. The advantage of this model is that the linker -only has to consider the object files themselves; there is no external -complexity to worry about. This disadvantage is that compilation time -is increased because the template code is being compiled repeatedly. -Code written for this model tends to include definitions of all -templates in the header file, since they must be seen to be -instantiated. - -@item Cfront model -The AT&T C++ translator, Cfront, solved the template instantiation -problem by creating the notion of a template repository, an -automatically maintained place where template instances are stored. A -more modern version of the repository works as follows: As individual -object files are built, the compiler places any template definitions and -instantiations encountered in the repository. At link time, the link -wrapper adds in the objects in the repository and compiles any needed -instances that were not previously emitted. The advantages of this -model are more optimal compilation speed and the ability to use the -system linker; to implement the Borland model a compiler vendor also -needs to replace the linker. The disadvantages are vastly increased -complexity, and thus potential for error; for some code this can be -just as transparent, but in practice it can been very difficult to build -multiple programs in one directory and one program in multiple -directories. Code written for this model tends to separate definitions -of non-inline member templates into a separate file, which should be -compiled separately. -@end table - -When used with GNU ld version 2.8 or later on an ELF system such as -GNU/Linux or Solaris 2, or on Microsoft Windows, G++ supports the -Borland model. On other systems, G++ implements neither automatic -model. - -You have the following options for dealing with template instantiations: - -@enumerate -@item -@opindex frepo -Compile your template-using code with @option{-frepo}. The compiler -generates files with the extension @samp{.rpo} listing all of the -template instantiations used in the corresponding object files that -could be instantiated there; the link wrapper, @samp{collect2}, -then updates the @samp{.rpo} files to tell the compiler where to place -those instantiations and rebuild any affected object files. The -link-time overhead is negligible after the first pass, as the compiler -continues to place the instantiations in the same files. - -This is your best option for application code written for the Borland -model, as it just works. Code written for the Cfront model -needs to be modified so that the template definitions are available at -one or more points of instantiation; usually this is as simple as adding -@code{#include } to the end of each template header. - -For library code, if you want the library to provide all of the template -instantiations it needs, just try to link all of its object files -together; the link will fail, but cause the instantiations to be -generated as a side effect. Be warned, however, that this may cause -conflicts if multiple libraries try to provide the same instantiations. -For greater control, use explicit instantiation as described in the next -option. - -@item -@opindex fno-implicit-templates -Compile your code with @option{-fno-implicit-templates} to disable the -implicit generation of template instances, and explicitly instantiate -all the ones you use. This approach requires more knowledge of exactly -which instances you need than do the others, but it's less -mysterious and allows greater control. You can scatter the explicit -instantiations throughout your program, perhaps putting them in the -translation units where the instances are used or the translation units -that define the templates themselves; you can put all of the explicit -instantiations you need into one big file; or you can create small files -like - -@smallexample -#include "Foo.h" -#include "Foo.cc" - -template class Foo; -template ostream& operator << - (ostream&, const Foo&); -@end smallexample - -@noindent -for each of the instances you need, and create a template instantiation -library from those. - -If you are using Cfront-model code, you can probably get away with not -using @option{-fno-implicit-templates} when compiling files that don't -@samp{#include} the member template definitions. - -If you use one big file to do the instantiations, you may want to -compile it without @option{-fno-implicit-templates} so you get all of the -instances required by your explicit instantiations (but not by any -other files) without having to specify them as well. - -The ISO C++ 2011 standard allows forward declaration of explicit -instantiations (with @code{extern}). G++ supports explicit instantiation -declarations in C++98 mode and has extended the template instantiation -syntax to support instantiation of the compiler support data for a -template class (i.e.@: the vtable) without instantiating any of its -members (with @code{inline}), and instantiation of only the static data -members of a template class, without the support data or member -functions (with @code{static}): - -@smallexample -extern template int max (int, int); -inline template class Foo; -static template class Foo; -@end smallexample - -@item -Do nothing. Pretend G++ does implement automatic instantiation -management. Code written for the Borland model works fine, but -each translation unit contains instances of each of the templates it -uses. In a large program, this can lead to an unacceptable amount of code -duplication. -@end enumerate - -@node Bound member functions -@section Extracting the Function Pointer from a Bound Pointer to Member Function -@cindex pmf -@cindex pointer to member function -@cindex bound pointer to member function - -In C++, pointer to member functions (PMFs) are implemented using a wide -pointer of sorts to handle all the possible call mechanisms; the PMF -needs to store information about how to adjust the @samp{this} pointer, -and if the function pointed to is virtual, where to find the vtable, and -where in the vtable to look for the member function. If you are using -PMFs in an inner loop, you should really reconsider that decision. If -that is not an option, you can extract the pointer to the function that -would be called for a given object/PMF pair and call it directly inside -the inner loop, to save a bit of time. - -Note that you still pay the penalty for the call through a -function pointer; on most modern architectures, such a call defeats the -branch prediction features of the CPU@. This is also true of normal -virtual function calls. - -The syntax for this extension is - -@smallexample -extern A a; -extern int (A::*fp)(); -typedef int (*fptr)(A *); - -fptr p = (fptr)(a.*fp); -@end smallexample - -For PMF constants (i.e.@: expressions of the form @samp{&Klasse::Member}), -no object is needed to obtain the address of the function. They can be -converted to function pointers directly: - -@smallexample -fptr p1 = (fptr)(&A::foo); -@end smallexample - -@opindex Wno-pmf-conversions -You must specify @option{-Wno-pmf-conversions} to use this extension. - -@node C++ Attributes -@section C++-Specific Variable, Function, and Type Attributes - -Some attributes only make sense for C++ programs. - -@table @code -@item abi_tag ("@var{tag}", ...) -@cindex @code{abi_tag} function attribute -@cindex @code{abi_tag} variable attribute -@cindex @code{abi_tag} type attribute -The @code{abi_tag} attribute can be applied to a function, variable, or class -declaration. It modifies the mangled name of the entity to -incorporate the tag name, in order to distinguish the function or -class from an earlier version with a different ABI; perhaps the class -has changed size, or the function has a different return type that is -not encoded in the mangled name. - -The attribute can also be applied to an inline namespace, but does not -affect the mangled name of the namespace; in this case it is only used -for @option{-Wabi-tag} warnings and automatic tagging of functions and -variables. Tagging inline namespaces is generally preferable to -tagging individual declarations, but the latter is sometimes -necessary, such as when only certain members of a class need to be -tagged. - -The argument can be a list of strings of arbitrary length. The -strings are sorted on output, so the order of the list is -unimportant. - -A redeclaration of an entity must not add new ABI tags, -since doing so would change the mangled name. - -The ABI tags apply to a name, so all instantiations and -specializations of a template have the same tags. The attribute will -be ignored if applied to an explicit specialization or instantiation. - -The @option{-Wabi-tag} flag enables a warning about a class which does -not have all the ABI tags used by its subobjects and virtual functions; for users with code -that needs to coexist with an earlier ABI, using this option can help -to find all affected types that need to be tagged. - -When a type involving an ABI tag is used as the type of a variable or -return type of a function where that tag is not already present in the -signature of the function, the tag is automatically applied to the -variable or function. @option{-Wabi-tag} also warns about this -situation; this warning can be avoided by explicitly tagging the -variable or function or moving it into a tagged inline namespace. - -@item init_priority (@var{priority}) -@cindex @code{init_priority} variable attribute - -In Standard C++, objects defined at namespace scope are guaranteed to be -initialized in an order in strict accordance with that of their definitions -@emph{in a given translation unit}. No guarantee is made for initializations -across translation units. However, GNU C++ allows users to control the -order of initialization of objects defined at namespace scope with the -@code{init_priority} attribute by specifying a relative @var{priority}, -a constant integral expression currently bounded between 101 and 65535 -inclusive. Lower numbers indicate a higher priority. - -In the following example, @code{A} would normally be created before -@code{B}, but the @code{init_priority} attribute reverses that order: - -@smallexample -Some_Class A __attribute__ ((init_priority (2000))); -Some_Class B __attribute__ ((init_priority (543))); -@end smallexample - -@noindent -Note that the particular values of @var{priority} do not matter; only their -relative ordering. - -@item java_interface -@cindex @code{java_interface} type attribute - -This type attribute informs C++ that the class is a Java interface. It may -only be applied to classes declared within an @code{extern "Java"} block. -Calls to methods declared in this interface are dispatched using GCJ's -interface table mechanism, instead of regular virtual table dispatch. - -@item warn_unused -@cindex @code{warn_unused} type attribute - -For C++ types with non-trivial constructors and/or destructors it is -impossible for the compiler to determine whether a variable of this -type is truly unused if it is not referenced. This type attribute -informs the compiler that variables of this type should be warned -about if they appear to be unused, just like variables of fundamental -types. - -This attribute is appropriate for types which just represent a value, -such as @code{std::string}; it is not appropriate for types which -control a resource, such as @code{std::mutex}. - -This attribute is also accepted in C, but it is unnecessary because C -does not have constructors or destructors. - -@end table - -See also @ref{Namespace Association}. - -@node Function Multiversioning -@section Function Multiversioning -@cindex function versions - -With the GNU C++ front end, for x86 targets, you may specify multiple -versions of a function, where each function is specialized for a -specific target feature. At runtime, the appropriate version of the -function is automatically executed depending on the characteristics of -the execution platform. Here is an example. - -@smallexample -__attribute__ ((target ("default"))) -int foo () -@{ - // The default version of foo. - return 0; -@} - -__attribute__ ((target ("sse4.2"))) -int foo () -@{ - // foo version for SSE4.2 - return 1; -@} - -__attribute__ ((target ("arch=atom"))) -int foo () -@{ - // foo version for the Intel ATOM processor - return 2; -@} - -__attribute__ ((target ("arch=amdfam10"))) -int foo () -@{ - // foo version for the AMD Family 0x10 processors. - return 3; -@} - -int main () -@{ - int (*p)() = &foo; - assert ((*p) () == foo ()); - return 0; -@} -@end smallexample - -In the above example, four versions of function foo are created. The -first version of foo with the target attribute "default" is the default -version. This version gets executed when no other target specific -version qualifies for execution on a particular platform. A new version -of foo is created by using the same function signature but with a -different target string. Function foo is called or a pointer to it is -taken just like a regular function. GCC takes care of doing the -dispatching to call the right version at runtime. Refer to the -@uref{http://gcc.gnu.org/wiki/FunctionMultiVersioning, GCC wiki on -Function Multiversioning} for more details. - -@node Namespace Association -@section Namespace Association - -@strong{Caution:} The semantics of this extension are equivalent -to C++ 2011 inline namespaces. Users should use inline namespaces -instead as this extension will be removed in future versions of G++. - -A using-directive with @code{__attribute ((strong))} is stronger -than a normal using-directive in two ways: - -@itemize @bullet -@item -Templates from the used namespace can be specialized and explicitly -instantiated as though they were members of the using namespace. - -@item -The using namespace is considered an associated namespace of all -templates in the used namespace for purposes of argument-dependent -name lookup. -@end itemize - -The used namespace must be nested within the using namespace so that -normal unqualified lookup works properly. - -This is useful for composing a namespace transparently from -implementation namespaces. For example: - -@smallexample -namespace std @{ - namespace debug @{ - template struct A @{ @}; - @} - using namespace debug __attribute ((__strong__)); - template <> struct A @{ @}; // @r{OK to specialize} - - template void f (A); -@} - -int main() -@{ - f (std::A()); // @r{lookup finds} std::f - f (std::A()); -@} -@end smallexample - -@node Type Traits -@section Type Traits - -The C++ front end implements syntactic extensions that allow -compile-time determination of -various characteristics of a type (or of a -pair of types). - -@table @code -@item __has_nothrow_assign (type) -If @code{type} is const qualified or is a reference type then the trait is -false. Otherwise if @code{__has_trivial_assign (type)} is true then the trait -is true, else if @code{type} is a cv class or union type with copy assignment -operators that are known not to throw an exception then the trait is true, -else it is false. Requires: @code{type} shall be a complete type, -(possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __has_nothrow_copy (type) -If @code{__has_trivial_copy (type)} is true then the trait is true, else if -@code{type} is a cv class or union type with copy constructors that -are known not to throw an exception then the trait is true, else it is false. -Requires: @code{type} shall be a complete type, (possibly cv-qualified) -@code{void}, or an array of unknown bound. - -@item __has_nothrow_constructor (type) -If @code{__has_trivial_constructor (type)} is true then the trait is -true, else if @code{type} is a cv class or union type (or array -thereof) with a default constructor that is known not to throw an -exception then the trait is true, else it is false. Requires: -@code{type} shall be a complete type, (possibly cv-qualified) -@code{void}, or an array of unknown bound. - -@item __has_trivial_assign (type) -If @code{type} is const qualified or is a reference type then the trait is -false. Otherwise if @code{__is_pod (type)} is true then the trait is -true, else if @code{type} is a cv class or union type with a trivial -copy assignment ([class.copy]) then the trait is true, else it is -false. Requires: @code{type} shall be a complete type, (possibly -cv-qualified) @code{void}, or an array of unknown bound. - -@item __has_trivial_copy (type) -If @code{__is_pod (type)} is true or @code{type} is a reference type -then the trait is true, else if @code{type} is a cv class or union type -with a trivial copy constructor ([class.copy]) then the trait -is true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __has_trivial_constructor (type) -If @code{__is_pod (type)} is true then the trait is true, else if -@code{type} is a cv class or union type (or array thereof) with a -trivial default constructor ([class.ctor]) then the trait is true, -else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __has_trivial_destructor (type) -If @code{__is_pod (type)} is true or @code{type} is a reference type then -the trait is true, else if @code{type} is a cv class or union type (or -array thereof) with a trivial destructor ([class.dtor]) then the trait -is true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __has_virtual_destructor (type) -If @code{type} is a class type with a virtual destructor -([class.dtor]) then the trait is true, else it is false. Requires: -@code{type} shall be a complete type, (possibly cv-qualified) -@code{void}, or an array of unknown bound. - -@item __is_abstract (type) -If @code{type} is an abstract class ([class.abstract]) then the trait -is true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_base_of (base_type, derived_type) -If @code{base_type} is a base class of @code{derived_type} -([class.derived]) then the trait is true, otherwise it is false. -Top-level cv qualifications of @code{base_type} and -@code{derived_type} are ignored. For the purposes of this trait, a -class type is considered is own base. Requires: if @code{__is_class -(base_type)} and @code{__is_class (derived_type)} are true and -@code{base_type} and @code{derived_type} are not the same type -(disregarding cv-qualifiers), @code{derived_type} shall be a complete -type. Diagnostic is produced if this requirement is not met. - -@item __is_class (type) -If @code{type} is a cv class type, and not a union type -([basic.compound]) the trait is true, else it is false. - -@item __is_empty (type) -If @code{__is_class (type)} is false then the trait is false. -Otherwise @code{type} is considered empty if and only if: @code{type} -has no non-static data members, or all non-static data members, if -any, are bit-fields of length 0, and @code{type} has no virtual -members, and @code{type} has no virtual base classes, and @code{type} -has no base classes @code{base_type} for which -@code{__is_empty (base_type)} is false. Requires: @code{type} shall -be a complete type, (possibly cv-qualified) @code{void}, or an array -of unknown bound. - -@item __is_enum (type) -If @code{type} is a cv enumeration type ([basic.compound]) the trait is -true, else it is false. - -@item __is_literal_type (type) -If @code{type} is a literal type ([basic.types]) the trait is -true, else it is false. Requires: @code{type} shall be a complete type, -(possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_pod (type) -If @code{type} is a cv POD type ([basic.types]) then the trait is true, -else it is false. Requires: @code{type} shall be a complete type, -(possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_polymorphic (type) -If @code{type} is a polymorphic class ([class.virtual]) then the trait -is true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_standard_layout (type) -If @code{type} is a standard-layout type ([basic.types]) the trait is -true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_trivial (type) -If @code{type} is a trivial type ([basic.types]) the trait is -true, else it is false. Requires: @code{type} shall be a complete -type, (possibly cv-qualified) @code{void}, or an array of unknown bound. - -@item __is_union (type) -If @code{type} is a cv union type ([basic.compound]) the trait is -true, else it is false. - -@item __underlying_type (type) -The underlying type of @code{type}. Requires: @code{type} shall be -an enumeration type ([dcl.enum]). - -@end table - -@node Java Exceptions -@section Java Exceptions - -The Java language uses a slightly different exception handling model -from C++. Normally, GNU C++ automatically detects when you are -writing C++ code that uses Java exceptions, and handle them -appropriately. However, if C++ code only needs to execute destructors -when Java exceptions are thrown through it, GCC guesses incorrectly. -Sample problematic code is: - -@smallexample - struct S @{ ~S(); @}; - extern void bar(); // @r{is written in Java, and may throw exceptions} - void foo() - @{ - S s; - bar(); - @} -@end smallexample - -@noindent -The usual effect of an incorrect guess is a link failure, complaining of -a missing routine called @samp{__gxx_personality_v0}. - -You can inform the compiler that Java exceptions are to be used in a -translation unit, irrespective of what it might think, by writing -@samp{@w{#pragma GCC java_exceptions}} at the head of the file. This -@samp{#pragma} must appear before any functions that throw or catch -exceptions, or run destructors when exceptions are thrown through them. - -You cannot mix Java and C++ exceptions in the same translation unit. It -is believed to be safe to throw a C++ exception from one file through -another file compiled for the Java exception model, or vice versa, but -there may be bugs in this area. - -@node Deprecated Features -@section Deprecated Features - -In the past, the GNU C++ compiler was extended to experiment with new -features, at a time when the C++ language was still evolving. Now that -the C++ standard is complete, some of those features are superseded by -superior alternatives. Using the old features might cause a warning in -some cases that the feature will be dropped in the future. In other -cases, the feature might be gone already. - -While the list below is not exhaustive, it documents some of the options -that are now deprecated: - -@table @code -@item -fexternal-templates -@itemx -falt-external-templates -These are two of the many ways for G++ to implement template -instantiation. @xref{Template Instantiation}. The C++ standard clearly -defines how template definitions have to be organized across -implementation units. G++ has an implicit instantiation mechanism that -should work just fine for standard-conforming code. - -@item -fstrict-prototype -@itemx -fno-strict-prototype -Previously it was possible to use an empty prototype parameter list to -indicate an unspecified number of parameters (like C), rather than no -parameters, as C++ demands. This feature has been removed, except where -it is required for backwards compatibility. @xref{Backwards Compatibility}. -@end table - -G++ allows a virtual function returning @samp{void *} to be overridden -by one returning a different pointer type. This extension to the -covariant return type rules is now deprecated and will be removed from a -future version. - -The G++ minimum and maximum operators (@samp{?}) and -their compound forms (@samp{?=}) have been deprecated -and are now removed from G++. Code using these operators should be -modified to use @code{std::min} and @code{std::max} instead. - -The named return value extension has been deprecated, and is now -removed from G++. - -The use of initializer lists with new expressions has been deprecated, -and is now removed from G++. - -Floating and complex non-type template parameters have been deprecated, -and are now removed from G++. - -The implicit typename extension has been deprecated and is now -removed from G++. - -The use of default arguments in function pointers, function typedefs -and other places where they are not permitted by the standard is -deprecated and will be removed from a future version of G++. - -G++ allows floating-point literals to appear in integral constant expressions, -e.g.@: @samp{ enum E @{ e = int(2.2 * 3.7) @} } -This extension is deprecated and will be removed from a future version. - -G++ allows static data members of const floating-point type to be declared -with an initializer in a class definition. The standard only allows -initializers for static members of const integral types and const -enumeration types so this extension has been deprecated and will be removed -from a future version. - -@node Backwards Compatibility -@section Backwards Compatibility -@cindex Backwards Compatibility -@cindex ARM [Annotated C++ Reference Manual] - -Now that there is a definitive ISO standard C++, G++ has a specification -to adhere to. The C++ language evolved over time, and features that -used to be acceptable in previous drafts of the standard, such as the ARM -[Annotated C++ Reference Manual], are no longer accepted. In order to allow -compilation of C++ written to such drafts, G++ contains some backwards -compatibilities. @emph{All such backwards compatibility features are -liable to disappear in future versions of G++.} They should be considered -deprecated. @xref{Deprecated Features}. - -@table @code -@item For scope -If a variable is declared at for scope, it used to remain in scope until -the end of the scope that contained the for statement (rather than just -within the for scope). G++ retains this, but issues a warning, if such a -variable is accessed outside the for scope. - -@item Implicit C language -Old C system header files did not contain an @code{extern "C" @{@dots{}@}} -scope to set the language. On such systems, all header files are -implicitly scoped inside a C language scope. Also, an empty prototype -@code{()} is treated as an unspecified number of arguments, rather -than no arguments, as C++ demands. -@end table - -@c LocalWords: emph deftypefn builtin ARCv2EM SIMD builtins msimd -@c LocalWords: typedef v4si v8hi DMA dma vdiwr vdowr diff --git a/contrib/gcc-5.0/gcc/doc/fragments.texi b/contrib/gcc-5.0/gcc/doc/fragments.texi deleted file mode 100644 index 805f1a205d..0000000000 --- a/contrib/gcc-5.0/gcc/doc/fragments.texi +++ /dev/null @@ -1,270 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Fragments -@chapter Makefile Fragments -@cindex makefile fragment - -When you configure GCC using the @file{configure} script, it will -construct the file @file{Makefile} from the template file -@file{Makefile.in}. When it does this, it can incorporate makefile -fragments from the @file{config} directory. These are used to set -Makefile parameters that are not amenable to being calculated by -autoconf. The list of fragments to incorporate is set by -@file{config.gcc} (and occasionally @file{config.build} -and @file{config.host}); @xref{System Config}. - -Fragments are named either @file{t-@var{target}} or @file{x-@var{host}}, -depending on whether they are relevant to configuring GCC to produce -code for a particular target, or to configuring GCC to run on a -particular host. Here @var{target} and @var{host} are mnemonics -which usually have some relationship to the canonical system name, but -no formal connection. - -If these files do not exist, it means nothing needs to be added for a -given target or host. Most targets need a few @file{t-@var{target}} -fragments, but needing @file{x-@var{host}} fragments is rare. - -@menu -* Target Fragment:: Writing @file{t-@var{target}} files. -* Host Fragment:: Writing @file{x-@var{host}} files. -@end menu - -@node Target Fragment -@section Target Makefile Fragments -@cindex target makefile fragment -@cindex @file{t-@var{target}} - -Target makefile fragments can set these Makefile variables. - -@table @code -@findex LIBGCC2_CFLAGS -@item LIBGCC2_CFLAGS -Compiler flags to use when compiling @file{libgcc2.c}. - -@findex LIB2FUNCS_EXTRA -@item LIB2FUNCS_EXTRA -A list of source file names to be compiled or assembled and inserted -into @file{libgcc.a}. - -@findex CRTSTUFF_T_CFLAGS -@item CRTSTUFF_T_CFLAGS -Special flags used when compiling @file{crtstuff.c}. -@xref{Initialization}. - -@findex CRTSTUFF_T_CFLAGS_S -@item CRTSTUFF_T_CFLAGS_S -Special flags used when compiling @file{crtstuff.c} for shared -linking. Used if you use @file{crtbeginS.o} and @file{crtendS.o} -in @code{EXTRA-PARTS}. -@xref{Initialization}. - -@findex MULTILIB_OPTIONS -@item MULTILIB_OPTIONS -For some targets, invoking GCC in different ways produces objects -that can not be linked together. For example, for some targets GCC -produces both big and little endian code. For these targets, you must -arrange for multiple versions of @file{libgcc.a} to be compiled, one for -each set of incompatible options. When GCC invokes the linker, it -arranges to link in the right version of @file{libgcc.a}, based on -the command line options used. - -The @code{MULTILIB_OPTIONS} macro lists the set of options for which -special versions of @file{libgcc.a} must be built. Write options that -are mutually incompatible side by side, separated by a slash. Write -options that may be used together separated by a space. The build -procedure will build all combinations of compatible options. - -For example, if you set @code{MULTILIB_OPTIONS} to @samp{m68000/m68020 -msoft-float}, @file{Makefile} will build special versions of -@file{libgcc.a} using the following sets of options: @option{-m68000}, -@option{-m68020}, @option{-msoft-float}, @samp{-m68000 -msoft-float}, and -@samp{-m68020 -msoft-float}. - -@findex MULTILIB_DIRNAMES -@item MULTILIB_DIRNAMES -If @code{MULTILIB_OPTIONS} is used, this variable specifies the -directory names that should be used to hold the various libraries. -Write one element in @code{MULTILIB_DIRNAMES} for each element in -@code{MULTILIB_OPTIONS}. If @code{MULTILIB_DIRNAMES} is not used, the -default value will be @code{MULTILIB_OPTIONS}, with all slashes treated -as spaces. - -@code{MULTILIB_DIRNAMES} describes the multilib directories using GCC -conventions and is applied to directories that are part of the GCC -installation. When multilib-enabled, the compiler will add a -subdirectory of the form @var{prefix}/@var{multilib} before each -directory in the search path for libraries and crt files. - -For example, if @code{MULTILIB_OPTIONS} is set to @samp{m68000/m68020 -msoft-float}, then the default value of @code{MULTILIB_DIRNAMES} is -@samp{m68000 m68020 msoft-float}. You may specify a different value if -you desire a different set of directory names. - -@findex MULTILIB_MATCHES -@item MULTILIB_MATCHES -Sometimes the same option may be written in two different ways. If an -option is listed in @code{MULTILIB_OPTIONS}, GCC needs to know about -any synonyms. In that case, set @code{MULTILIB_MATCHES} to a list of -items of the form @samp{option=option} to describe all relevant -synonyms. For example, @samp{m68000=mc68000 m68020=mc68020}. - -@findex MULTILIB_EXCEPTIONS -@item MULTILIB_EXCEPTIONS -Sometimes when there are multiple sets of @code{MULTILIB_OPTIONS} being -specified, there are combinations that should not be built. In that -case, set @code{MULTILIB_EXCEPTIONS} to be all of the switch exceptions -in shell case syntax that should not be built. - -For example the ARM processor cannot execute both hardware floating -point instructions and the reduced size THUMB instructions at the same -time, so there is no need to build libraries with both of these -options enabled. Therefore @code{MULTILIB_EXCEPTIONS} is set to: -@smallexample -*mthumb/*mhard-float* -@end smallexample - -@findex MULTILIB_REQUIRED -@item MULTILIB_REQUIRED -Sometimes when there are only a few combinations are required, it would -be a big effort to come up with a @code{MULTILIB_EXCEPTIONS} list to -cover all undesired ones. In such a case, just listing all the required -combinations in @code{MULTILIB_REQUIRED} would be more straightforward. - -The way to specify the entries in @code{MULTILIB_REQUIRED} is same with -the way used for @code{MULTILIB_EXCEPTIONS}, only this time what are -required will be specified. Suppose there are multiple sets of -@code{MULTILIB_OPTIONS} and only two combinations are required, one -for ARMv7-M and one for ARMv7-R with hard floating-point ABI and FPU, the -@code{MULTILIB_REQUIRED} can be set to: -@smallexample -@code{MULTILIB_REQUIRED} = mthumb/march=armv7-m -@code{MULTILIB_REQUIRED} += march=armv7-r/mfloat-abi=hard/mfpu=vfpv3-d16 -@end smallexample - -The @code{MULTILIB_REQUIRED} can be used together with -@code{MULTILIB_EXCEPTIONS}. The option combinations generated from -@code{MULTILIB_OPTIONS} will be filtered by @code{MULTILIB_EXCEPTIONS} -and then by @code{MULTILIB_REQUIRED}. - -@findex MULTILIB_REUSE -@item MULTILIB_REUSE -Sometimes it is desirable to reuse one existing multilib for different -sets of options. Such kind of reuse can minimize the number of multilib -variants. And for some targets it is better to reuse an existing multilib -than to fall back to default multilib when there is no corresponding multilib. -This can be done by adding reuse rules to @code{MULTILIB_REUSE}. - -A reuse rule is comprised of two parts connected by equality sign. The left part -is option set used to build multilib and the right part is option set that will -reuse this multilib. The order of options in the left part matters and should be -same with those specified in @code{MULTILIB_REQUIRED} or aligned with order in -@code{MULTILIB_OPTIONS}. There is no such limitation for options in right part -as we don't build multilib from them. But the equality sign in both parts should -be replaced with period. - -The @code{MULTILIB_REUSE} is different from @code{MULTILIB_MATCHES} in that it -sets up relations between two option sets rather than two options. Here is an -example to demo how we reuse libraries built in Thumb mode for applications built -in ARM mode: -@smallexample -@code{MULTILIB_REUSE} = mthumb/march.armv7-r=marm/march.armv7-r -@end smallexample - -Before the advent of @code{MULTILIB_REUSE}, GCC select multilib by comparing command -line options with options used to build multilib. The @code{MULTILIB_REUSE} is -complementary to that way. Only when the original comparison matches nothing it will -work to see if it is OK to reuse some existing multilib. - -@findex MULTILIB_EXTRA_OPTS -@item MULTILIB_EXTRA_OPTS -Sometimes it is desirable that when building multiple versions of -@file{libgcc.a} certain options should always be passed on to the -compiler. In that case, set @code{MULTILIB_EXTRA_OPTS} to be the list -of options to be used for all builds. If you set this, you should -probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it. - -@findex MULTILIB_OSDIRNAMES -@item MULTILIB_OSDIRNAMES -If @code{MULTILIB_OPTIONS} is used, this variable specifies -a list of subdirectory names, that are used to modify the search -path depending on the chosen multilib. Unlike @code{MULTILIB_DIRNAMES}, -@code{MULTILIB_OSDIRNAMES} describes the multilib directories using -operating systems conventions, and is applied to the directories such as -@code{lib} or those in the @env{LIBRARY_PATH} environment variable. -The format is either the same as of -@code{MULTILIB_DIRNAMES}, or a set of mappings. When it is the same -as @code{MULTILIB_DIRNAMES}, it describes the multilib directories -using operating system conventions, rather than GCC conventions. When it is a set -of mappings of the form @var{gccdir}=@var{osdir}, the left side gives -the GCC convention and the right gives the equivalent OS defined -location. If the @var{osdir} part begins with a @samp{!}, -GCC will not search in the non-multilib directory and use -exclusively the multilib directory. Otherwise, the compiler will -examine the search path for libraries and crt files twice; the first -time it will add @var{multilib} to each directory in the search path, -the second it will not. - -For configurations that support both multilib and multiarch, -@code{MULTILIB_OSDIRNAMES} also encodes the multiarch name, thus -subsuming @code{MULTIARCH_DIRNAME}. The multiarch name is appended to -each directory name, separated by a colon (e.g. -@samp{../lib32:i386-linux-gnu}). - -Each multiarch subdirectory will be searched before the corresponding OS -multilib directory, for example @samp{/lib/i386-linux-gnu} before -@samp{/lib/../lib32}. The multiarch name will also be used to modify the -system header search path, as explained for @code{MULTIARCH_DIRNAME}. - -@findex MULTIARCH_DIRNAME -@item MULTIARCH_DIRNAME -This variable specifies the multiarch name for configurations that are -multiarch-enabled but not multilibbed configurations. - -The multiarch name is used to augment the search path for libraries, crt -files and system header files with additional locations. The compiler -will add a multiarch subdirectory of the form -@var{prefix}/@var{multiarch} before each directory in the library and -crt search path. It will also add two directories -@code{LOCAL_INCLUDE_DIR}/@var{multiarch} and -@code{NATIVE_SYSTEM_HEADER_DIR}/@var{multiarch}) to the system header -search path, respectively before @code{LOCAL_INCLUDE_DIR} and -@code{NATIVE_SYSTEM_HEADER_DIR}. - -@code{MULTIARCH_DIRNAME} is not used for configurations that support -both multilib and multiarch. In that case, multiarch names are encoded -in @code{MULTILIB_OSDIRNAMES} instead. - -More documentation about multiarch can be found at -@uref{http://wiki.debian.org/Multiarch}. - -@findex SPECS -@item SPECS -Unfortunately, setting @code{MULTILIB_EXTRA_OPTS} is not enough, since -it does not affect the build of target libraries, at least not the -build of the default multilib. One possible work-around is to use -@code{DRIVER_SELF_SPECS} to bring options from the @file{specs} file -as if they had been passed in the compiler driver command line. -However, you don't want to be adding these options after the toolchain -is installed, so you can instead tweak the @file{specs} file that will -be used during the toolchain build, while you still install the -original, built-in @file{specs}. The trick is to set @code{SPECS} to -some other filename (say @file{specs.install}), that will then be -created out of the built-in specs, and introduce a @file{Makefile} -rule to generate the @file{specs} file that's going to be used at -build time out of your @file{specs.install}. - -@item T_CFLAGS -These are extra flags to pass to the C compiler. They are used both -when building GCC, and when compiling things with the just-built GCC@. -This variable is deprecated and should not be used. -@end table - -@node Host Fragment -@section Host Makefile Fragments -@cindex host makefile fragment -@cindex @file{x-@var{host}} - -The use of @file{x-@var{host}} fragments is discouraged. You should only -use it for makefile dependencies. diff --git a/contrib/gcc-5.0/gcc/doc/frontends.texi b/contrib/gcc-5.0/gcc/doc/frontends.texi deleted file mode 100644 index 852fd580d7..0000000000 --- a/contrib/gcc-5.0/gcc/doc/frontends.texi +++ /dev/null @@ -1,62 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node G++ and GCC -@chapter Programming Languages Supported by GCC - -@cindex GCC -@cindex GNU Compiler Collection -@cindex GNU C Compiler -@cindex Ada -@cindex Fortran -@cindex Go -@cindex Java -@cindex Objective-C -@cindex Objective-C++ -GCC stands for ``GNU Compiler Collection''. GCC is an integrated -distribution of compilers for several major programming languages. These -languages currently include C, C++, Objective-C, Objective-C++, Java, -Fortran, Ada, and Go. - -The abbreviation @dfn{GCC} has multiple meanings in common use. The -current official meaning is ``GNU Compiler Collection'', which refers -generically to the complete suite of tools. The name historically stood -for ``GNU C Compiler'', and this usage is still common when the emphasis -is on compiling C programs. Finally, the name is also used when speaking -of the @dfn{language-independent} component of GCC: code shared among the -compilers for all supported languages. - -The language-independent component of GCC includes the majority of the -optimizers, as well as the ``back ends'' that generate machine code for -various processors. - -@cindex COBOL -@cindex Mercury -@cindex Pascal -The part of a compiler that is specific to a particular language is -called the ``front end''. In addition to the front ends that are -integrated components of GCC, there are several other front ends that -are maintained separately. These support languages such as Pascal, -Mercury, and COBOL@. To use these, they must be built together with -GCC proper. - -@cindex C++ -@cindex G++ -@cindex Ada -@cindex GNAT -Most of the compilers for languages other than C have their own names. -The C++ compiler is G++, the Ada compiler is GNAT, and so on. When we -talk about compiling one of those languages, we might refer to that -compiler by its own name, or as GCC@. Either is correct. - -@cindex compiler compared to C++ preprocessor -@cindex intermediate C version, nonexistent -@cindex C intermediate output, nonexistent -Historically, compilers for many languages, including C++ and Fortran, -have been implemented as ``preprocessors'' which emit another high -level language such as C@. None of the compilers included in GCC are -implemented this way; they all generate machine code directly. This -sort of preprocessor should not be confused with the @dfn{C -preprocessor}, which is an integral feature of the C, C++, Objective-C -and Objective-C++ languages. diff --git a/contrib/gcc-5.0/gcc/doc/gcc.texi b/contrib/gcc-5.0/gcc/doc/gcc.texi deleted file mode 100644 index ba6b60807d..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gcc.texi +++ /dev/null @@ -1,211 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename gcc.info -@c INTERNALS is used by md.texi to determine whether to include the -@c whole of that file, in the internals manual, or only the part -@c dealing with constraints, in the user manual. -@clear INTERNALS - -@c NOTE: checks/things to do: -@c -@c -have bob do a search in all seven files for "mew" (ideally --mew, -@c but i may have forgotten the occasional "--"..). -@c Just checked... all have `--'! Bob 22Jul96 -@c Use this to search: grep -n '\-\-mew' *.texi -@c -item/itemx, text after all (sub/sub)section titles, etc.. -@c -consider putting the lists of options on pp 17--> etc in columns or -@c some such. -@c -overfulls. do a search for "mew" in the files, and you will see -@c overfulls that i noted but could not deal with. -@c -have to add text: beginning of chapter 8 - -@c -@c anything else? --mew 10feb93 - -@include gcc-common.texi - -@settitle Using the GNU Compiler Collection (GCC) - -@c Create a separate index for command line options. -@defcodeindex op -@c Merge the standard indexes into a single one. -@syncodeindex fn cp -@syncodeindex vr cp -@syncodeindex ky cp -@syncodeindex pg cp -@syncodeindex tp cp - -@paragraphindent 1 - -@c %**end of header - -@copying -Copyright @copyright{} 1988-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``Funding Free Software'', the Front-Cover -Texts being (a) (see below), and with the Back-Cover Texts being (b) -(see below). A copy of the license is included in the section entitled -``GNU Free Documentation License''. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@end copying -@ifnottex -@dircategory Software development -@direntry -* gcc: (gcc). The GNU Compiler Collection. -* g++: (gcc). The GNU C++ compiler. -* gcov: (gcc) Gcov. @command{gcov}---a test coverage program. -* gcov-tool: (gcc) Gcov-tool. @command{gcov-tool}---an offline gcda profile processing program. -@end direntry -This file documents the use of the GNU compilers. -@sp 1 -@insertcopying -@sp 1 -@end ifnottex - -@setchapternewpage odd -@titlepage -@title Using the GNU Compiler Collection -@versionsubtitle -@author Richard M. Stallman and the @sc{GCC} Developer Community -@page -@vskip 0pt plus 1filll -Published by: -@multitable @columnfractions 0.5 0.5 -@item GNU Press -@tab Website: @uref{http://www.gnupress.org} -@item a division of the -@tab General: @email{press@@gnu.org} -@item Free Software Foundation -@tab Orders: @email{sales@@gnu.org} -@item 51 Franklin Street, Fifth Floor -@tab Tel 617-542-5942 -@item Boston, MA 02110-1301 USA -@tab Fax 617-542-2652 -@end multitable -@sp 2 -@ifset FSFPRINT -@c Update this ISBN when printing a new edition. -@acronym{ISBN} 1-882114-39-6 - -Cover art by Gary M. Torrisi. Cover design by Jonathan Richard. -@end ifset -@ifclear FSFPRINT -Last printed October 2003 for GCC 3.3.1.@* -Printed copies are available for $45 each. -@end ifclear -@sp 1 -@insertcopying -@end titlepage -@summarycontents -@contents -@page - -@node Top, G++ and GCC,, (DIR) -@top Introduction -@cindex introduction - -This manual documents how to use the GNU compilers, -as well as their features and incompatibilities, and how to report -bugs. It corresponds to the compilers -@ifset VERSION_PACKAGE -@value{VERSION_PACKAGE} -@end ifset -version @value{version-GCC}. -The internals of the GNU compilers, including how to port them to new -targets and some information about how to write front ends for new -languages, are documented in a separate manual. @xref{Top,, -Introduction, gccint, GNU Compiler Collection (GCC) Internals}. - -@menu -* G++ and GCC:: You can compile C or C++ programs. -* Standards:: Language standards supported by GCC. -* Invoking GCC:: Command options supported by @samp{gcc}. -* C Implementation:: How GCC implements the ISO C specification. -* C++ Implementation:: How GCC implements the ISO C++ specification. -* C Extensions:: GNU extensions to the C language family. -* C++ Extensions:: GNU extensions to the C++ language. -* Objective-C:: GNU Objective-C runtime features. -* Compatibility:: Binary Compatibility -* Gcov:: @command{gcov}---a test coverage program. -* Gcov-tool:: @command{gcov-tool}---an offline gcda profile processing program. -* Trouble:: If you have trouble using GCC. -* Bugs:: How, why and where to report bugs. -* Service:: How To Get Help with GCC -* Contributing:: How to contribute to testing and developing GCC. - -* Funding:: How to help assure funding for free software. -* GNU Project:: The GNU Project and GNU/Linux. - -* Copying:: GNU General Public License says - how you can copy and share GCC. -* GNU Free Documentation License:: How you can copy and share this manual. -* Contributors:: People who have contributed to GCC. - -* Option Index:: Index to command line options. -* Keyword Index:: Index of concepts and symbol names. -@end menu - -@include frontends.texi -@include standards.texi -@include invoke.texi -@include implement-c.texi -@include implement-cxx.texi -@include extend.texi -@include objc.texi -@include compat.texi -@include gcov.texi -@include gcov-tool.texi -@include trouble.texi -@include bugreport.texi -@include service.texi -@include contribute.texi - -@include funding.texi -@include gnu.texi -@include gpl_v3.texi - -@c --------------------------------------------------------------------- -@c GFDL -@c --------------------------------------------------------------------- - -@include fdl.texi - -@include contrib.texi - -@c --------------------------------------------------------------------- -@c Indexes -@c --------------------------------------------------------------------- - -@node Option Index -@unnumbered Option Index - -GCC's command line options are indexed here without any initial @samp{-} -or @samp{--}. Where an option has both positive and negative forms -(such as @option{-f@var{option}} and @option{-fno-@var{option}}), -relevant entries in the manual are indexed under the most appropriate -form; it may sometimes be useful to look up both forms. - -@printindex op - -@node Keyword Index -@unnumbered Keyword Index - -@printindex cp - -@c --------------------------------------------------------------------- -@c Epilogue -@c --------------------------------------------------------------------- - -@bye diff --git a/contrib/gcc-5.0/gcc/doc/gccint.texi b/contrib/gcc-5.0/gcc/doc/gccint.texi deleted file mode 100644 index d6913e694a..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gccint.texi +++ /dev/null @@ -1,200 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename gccint.info -@c INTERNALS is used by md.texi to determine whether to include the -@c whole of that file, in the internals manual, or only the part -@c dealing with constraints, in the user manual. -@set INTERNALS - -@c See miscellaneous notes in gcc.texi on checks/things to do. - -@include gcc-common.texi - -@settitle GNU Compiler Collection (GCC) Internals - -@c Create a separate index for command line options. -@defcodeindex op -@c Merge the standard indexes into a single one. -@syncodeindex fn cp -@syncodeindex vr cp -@syncodeindex ky cp -@syncodeindex pg cp -@syncodeindex tp cp - -@paragraphindent 1 - -@c %**end of header - -@copying -Copyright @copyright{} 1988-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``Funding Free Software'', the Front-Cover -Texts being (a) (see below), and with the Back-Cover Texts being (b) -(see below). A copy of the license is included in the section entitled -``GNU Free Documentation License''. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@end copying -@ifnottex -@dircategory Software development -@direntry -* gccint: (gccint). Internals of the GNU Compiler Collection. -@end direntry -This file documents the internals of the GNU compilers. -@sp 1 -@insertcopying -@sp 1 -@end ifnottex - -@setchapternewpage odd -@titlepage -@title GNU Compiler Collection Internals -@versionsubtitle -@author Richard M. Stallman and the @sc{GCC} Developer Community -@page -@vskip 0pt plus 1filll -@insertcopying -@end titlepage -@summarycontents -@contents -@page - -@node Top, Contributing,, (DIR) -@top Introduction -@cindex introduction - -This manual documents the internals of the GNU compilers, including -how to port them to new targets and some information about how to -write front ends for new languages. It corresponds to the compilers -@ifset VERSION_PACKAGE -@value{VERSION_PACKAGE} -@end ifset -version @value{version-GCC}. The use of the GNU compilers is documented in a -separate manual. @xref{Top,, Introduction, gcc, Using the GNU -Compiler Collection (GCC)}. - -This manual is mainly a reference manual rather than a tutorial. It -discusses how to contribute to GCC (@pxref{Contributing}), the -characteristics of the machines supported by GCC as hosts and targets -(@pxref{Portability}), how GCC relates to the ABIs on such systems -(@pxref{Interface}), and the characteristics of the languages for -which GCC front ends are written (@pxref{Languages}). It then -describes the GCC source tree structure and build system, some of the -interfaces to GCC front ends, and how support for a target system is -implemented in GCC@. - -Additional tutorial information is linked to from -@uref{http://gcc.gnu.org/readings.html}. - -@menu -* Contributing:: How to contribute to testing and developing GCC. -* Portability:: Goals of GCC's portability features. -* Interface:: Function-call interface of GCC output. -* Libgcc:: Low-level runtime library used by GCC. -* Languages:: Languages for which GCC front ends are written. -* Source Tree:: GCC source tree structure and build system. -* Testsuites:: GCC testsuites. -* Options:: Option specification files. -* Passes:: Order of passes, what they do, and what each file is for. -* GENERIC:: Language-independent representation generated by Front Ends -* GIMPLE:: Tuple representation used by Tree SSA optimizers -* Tree SSA:: Analysis and optimization of GIMPLE -* RTL:: Machine-dependent low-level intermediate representation. -* Control Flow:: Maintaining and manipulating the control flow graph. -* Loop Analysis and Representation:: Analysis and representation of loops -* Machine Desc:: How to write machine description instruction patterns. -* Target Macros:: How to write the machine description C macros and functions. -* Host Config:: Writing the @file{xm-@var{machine}.h} file. -* Fragments:: Writing the @file{t-@var{target}} and @file{x-@var{host}} files. -* Collect2:: How @code{collect2} works; how it finds @code{ld}. -* Header Dirs:: Understanding the standard header file directories. -* Type Information:: GCC's memory management; generating type information. -* Plugins:: Extending the compiler with plugins. -* LTO:: Using Link-Time Optimization. - -* Match and Simplify:: How to write expression simplification patterns for GIMPLE and GENERIC -* Funding:: How to help assure funding for free software. -* GNU Project:: The GNU Project and GNU/Linux. - -* Copying:: GNU General Public License says - how you can copy and share GCC. -* GNU Free Documentation License:: How you can copy and share this manual. -* Contributors:: People who have contributed to GCC. - -* Option Index:: Index to command line options. -* Concept Index:: Index of concepts and symbol names. -@end menu - -@include contribute.texi -@include portability.texi -@include interface.texi -@include libgcc.texi -@include languages.texi -@include sourcebuild.texi -@include options.texi -@include passes.texi -@include generic.texi -@include gimple.texi -@include tree-ssa.texi -@include rtl.texi -@include cfg.texi -@include loop.texi -@include md.texi -@include tm.texi -@include hostconfig.texi -@include fragments.texi -@include collect2.texi -@include headerdirs.texi -@include gty.texi -@include plugins.texi -@include lto.texi -@include match-and-simplify.texi - -@include funding.texi -@include gnu.texi -@include gpl_v3.texi - -@c --------------------------------------------------------------------- -@c GFDL -@c --------------------------------------------------------------------- - -@include fdl.texi - -@include contrib.texi - -@c --------------------------------------------------------------------- -@c Indexes -@c --------------------------------------------------------------------- - -@node Option Index -@unnumbered Option Index - -GCC's command line options are indexed here without any initial @samp{-} -or @samp{--}. Where an option has both positive and negative forms -(such as @option{-f@var{option}} and @option{-fno-@var{option}}), -relevant entries in the manual are indexed under the most appropriate -form; it may sometimes be useful to look up both forms. - -@printindex op - -@node Concept Index -@unnumbered Concept Index - -@printindex cp - -@c --------------------------------------------------------------------- -@c Epilogue -@c --------------------------------------------------------------------- - -@bye diff --git a/contrib/gcc-5.0/gcc/doc/gcov-tool.texi b/contrib/gcc-5.0/gcc/doc/gcov-tool.texi deleted file mode 100644 index 6f3f6b4a76..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gcov-tool.texi +++ /dev/null @@ -1,231 +0,0 @@ -@c Copyright (C) 2014-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@ignore -@c man begin COPYRIGHT -Copyright @copyright{} 2014-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``GNU General Public License'' and ``Funding -Free Software'', the Front-Cover texts being (a) (see below), and with -the Back-Cover Texts being (b) (see below). A copy of the license is -included in the gfdl(7) man page. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@c man end -@c Set file name and title for the man page. -@setfilename gcov-tool -@settitle offline gcda profile processing tool -@end ignore - -@node Gcov-tool -@chapter @command{gcov-tool}---an Offline Gcda Profile Processing Tool - -@command{gcov-tool} is a tool you can use in conjunction with GCC to -manipulate or process gcda profile files offline. - -@menu -* Gcov-tool Intro:: Introduction to gcov-tool. -* Invoking Gcov-tool:: How to use gcov-tool. -@end menu - -@node Gcov-tool Intro -@section Introduction to @command{gcov-tool} -@c man begin DESCRIPTION - -@command{gcov-tool} is an offline tool to process gcc's gcda profile files. - -Current gcov-tool supports the following functionalities: - -@itemize @bullet -@item -merge two sets of profiles with weights. - -@item -read one set of profile and rewrite profile contents. One can scale or -normalize the count values. -@end itemize - -Examples of the use cases for this tool are: -@itemize @bullet -@item -Collect the profiles for different set of inputs, and use this tool to merge -them. One can specify the weight to factor in the relative importance of -each input. - -@item -Rewrite the profile after removing a subset of the gcda files, while maintaining -the consistency of the summary and the histogram. - -@item -It can also be used to debug or libgcov code as the tools shares the majority -code as the runtime library. -@end itemize - -Note that for the merging operation, this profile generated offline may -contain slight different values from the online merged profile. Here are -a list of typical differences: - -@itemize @bullet -@item -histogram difference: This offline tool recomputes the histogram after merging -the counters. The resulting histogram, therefore, is precise. The online -merging does not have this capability -- the histogram is merged from two -histograms and the result is an approximation. - -@item -summary checksum difference: Summary checksum uses a CRC32 operation. The value -depends on the link list order of gcov-info objects. This order is different in -gcov-tool from that in the online merge. It's expected to have different -summary checksums. It does not really matter as the compiler does not use this -checksum anywhere. - -@item -value profile counter values difference: Some counter values for value profile -are runtime dependent, like heap addresses. It's normal to see some difference -in these kind of counters. -@end itemize - -@c man end - -@node Invoking Gcov-tool -@section Invoking @command{gcov-tool} - -@smallexample -gcov-tool @r{[}@var{global-options}@r{]} SUB_COMMAND @r{[}@var{sub_command-options}@r{]} @var{profile_dir} -@end smallexample - -@command{gcov-tool} accepts the following options: - -@ignore -@c man begin SYNOPSIS -gcov-tool [@option{-v}|@option{--version}] [@option{-h}|@option{--help}] - -gcov-tool merge [merge-options] @var{directory1} @var{directory2} - [@option{-v}|@option{--verbose}] - [@option{-o}|@option{ --output} @var{directory}] - [@option{-w}|@option{--weight} @var{w1,w2}] - -gcov-tool rewrite [rewrite-options] @var{directory} - [@option{-v}|@option{--verbose}] - [@option{-o}|@option{--output} @var{directory}] - [@option{-s}|@option{--scale} @var{float_or_simple-frac_value}] - [@option{-n}|@option{--normalize} @var{long_long_value}] - -gcov-tool overlap [overlap-options] @var{directory1} @var{directory2} - [@option{-v}|@option{--verbose}] - [@option{-h}|@option{--hotonly}] - [@option{-f}|@option{--function}] - [@option{-F}|@option{--fullname}] - [@option{-o}|@option{--object}] - [@option{-t}|@option{--hot_threshold}] @var{float} - -@c man end -@c man begin SEEALSO -gpl(7), gfdl(7), fsf-funding(7), gcc(1), gcov(1) and the Info entry for -@file{gcc}. -@c man end -@end ignore - -@c man begin OPTIONS -@table @gcctabopt -@item -h -@itemx --help -Display help about using @command{gcov-tool} (on the standard output), and -exit without doing any further processing. - -@item -v -@itemx --version -Display the @command{gcov-tool} version number (on the standard output), -and exit without doing any further processing. - -@item merge -Merge two profile directories. - -@table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. - -@item -o @var{directory} -@itemx --output @var{directory} -Set the output profile directory. Default output directory name is -@var{merged_profile}. - -@item -w @var{w1},@var{w2} -@itemx --weight @var{w1},@var{w2} -Set the merge weights of the @var{directory1} and @var{directory2}, -respectively. The default weights are 1 for both. -@end table - -@item rewrite -Read the specified profile directory and rewrite to a new directory. - -@table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. - -@item -o @var{directory} -@itemx --output @var{directory} -Set the output profile directory. Default output name is @var{rewrite_profile}. - -@item -s @var{float_or_simple-frac_value} -@itemx --scale @var{float_or_simple-frac_value} -Scale the profile counters. The specified value can be in floating point value, -or simple fraction value form, such 1, 2, 2/3, and 5/3. - -@item -n @var{long_long_value} -@itemx --normalize -Normalize the profile. The specified value is the max counter value -in the new profile. -@end table - -@item overlap -Computer the overlap score between the two specified profile directories. -The overlap score is computed based on the arc profiles. It is defined as -the sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all), -for all arc counter i, where p1_counter[i] and p2_counter[i] are two -matched counters and p1_sum_all and p2_sum_all are the sum of counter -values in profile 1 and profile 2, respectively. - -@table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. - -@item -h -@itemx --hotonly -Only print info for hot objects/functions. - -@item -f -@itemx --function -Print function level overlap score. - -@item -F -@itemx --fullname -Print full gcda filename. - -@item -o -@itemx --object -Print object level overlap score. - -@item -t @var{float} -@itemx --hot_threshold -Set the threshold for hot counter value. -@end table - -@end table - -@c man end diff --git a/contrib/gcc-5.0/gcc/doc/gcov.texi b/contrib/gcc-5.0/gcc/doc/gcov.texi deleted file mode 100644 index dba36e0b97..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gcov.texi +++ /dev/null @@ -1,657 +0,0 @@ -@c Copyright (C) 1996-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@ignore -@c man begin COPYRIGHT -Copyright @copyright{} 1996-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``GNU General Public License'' and ``Funding -Free Software'', the Front-Cover texts being (a) (see below), and with -the Back-Cover Texts being (b) (see below). A copy of the license is -included in the gfdl(7) man page. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@c man end -@c Set file name and title for the man page. -@setfilename gcov -@settitle coverage testing tool -@end ignore - -@node Gcov -@chapter @command{gcov}---a Test Coverage Program - -@command{gcov} is a tool you can use in conjunction with GCC to -test code coverage in your programs. - -@menu -* Gcov Intro:: Introduction to gcov. -* Invoking Gcov:: How to use gcov. -* Gcov and Optimization:: Using gcov with GCC optimization. -* Gcov Data Files:: The files used by gcov. -* Cross-profiling:: Data file relocation. -@end menu - -@node Gcov Intro -@section Introduction to @command{gcov} -@c man begin DESCRIPTION - -@command{gcov} is a test coverage program. Use it in concert with GCC -to analyze your programs to help create more efficient, faster running -code and to discover untested parts of your program. You can use -@command{gcov} as a profiling tool to help discover where your -optimization efforts will best affect your code. You can also use -@command{gcov} along with the other profiling tool, @command{gprof}, to -assess which parts of your code use the greatest amount of computing -time. - -Profiling tools help you analyze your code's performance. Using a -profiler such as @command{gcov} or @command{gprof}, you can find out some -basic performance statistics, such as: - -@itemize @bullet -@item -how often each line of code executes - -@item -what lines of code are actually executed - -@item -how much computing time each section of code uses -@end itemize - -Once you know these things about how your code works when compiled, you -can look at each module to see which modules should be optimized. -@command{gcov} helps you determine where to work on optimization. - -Software developers also use coverage testing in concert with -testsuites, to make sure software is actually good enough for a release. -Testsuites can verify that a program works as expected; a coverage -program tests to see how much of the program is exercised by the -testsuite. Developers can then determine what kinds of test cases need -to be added to the testsuites to create both better testing and a better -final product. - -You should compile your code without optimization if you plan to use -@command{gcov} because the optimization, by combining some lines of code -into one function, may not give you as much information as you need to -look for `hot spots' where the code is using a great deal of computer -time. Likewise, because @command{gcov} accumulates statistics by line (at -the lowest resolution), it works best with a programming style that -places only one statement on each line. If you use complicated macros -that expand to loops or to other control structures, the statistics are -less helpful---they only report on the line where the macro call -appears. If your complex macros behave like functions, you can replace -them with inline functions to solve this problem. - -@command{gcov} creates a logfile called @file{@var{sourcefile}.gcov} which -indicates how many times each line of a source file @file{@var{sourcefile}.c} -has executed. You can use these logfiles along with @command{gprof} to aid -in fine-tuning the performance of your programs. @command{gprof} gives -timing information you can use along with the information you get from -@command{gcov}. - -@command{gcov} works only on code compiled with GCC@. It is not -compatible with any other profiling or test coverage mechanism. - -@c man end - -@node Invoking Gcov -@section Invoking @command{gcov} - -@smallexample -gcov @r{[}@var{options}@r{]} @var{files} -@end smallexample - -@command{gcov} accepts the following options: - -@ignore -@c man begin SYNOPSIS -gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}] - [@option{-a}|@option{--all-blocks}] - [@option{-b}|@option{--branch-probabilities}] - [@option{-c}|@option{--branch-counts}] - [@option{-d}|@option{--display-progress}] - [@option{-f}|@option{--function-summaries}] - [@option{-i}|@option{--intermediate-format}] - [@option{-l}|@option{--long-file-names}] - [@option{-m}|@option{--demangled-names}] - [@option{-n}|@option{--no-output}] - [@option{-o}|@option{--object-directory} @var{directory|file}] - [@option{-p}|@option{--preserve-paths}] - [@option{-r}|@option{--relative-only}] - [@option{-s}|@option{--source-prefix} @var{directory}] - [@option{-u}|@option{--unconditional-branches}] - @var{files} -@c man end -@c man begin SEEALSO -gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entry for @file{gcc}. -@c man end -@end ignore - -@c man begin OPTIONS -@table @gcctabopt -@item -h -@itemx --help -Display help about using @command{gcov} (on the standard output), and -exit without doing any further processing. - -@item -v -@itemx --version -Display the @command{gcov} version number (on the standard output), -and exit without doing any further processing. - -@item -a -@itemx --all-blocks -Write individual execution counts for every basic block. Normally gcov -outputs execution counts only for the main blocks of a line. With this -option you can determine if blocks within a single line are not being -executed. - -@item -b -@itemx --branch-probabilities -Write branch frequencies to the output file, and write branch summary -info to the standard output. This option allows you to see how often -each branch in your program was taken. Unconditional branches will not -be shown, unless the @option{-u} option is given. - -@item -c -@itemx --branch-counts -Write branch frequencies as the number of branches taken, rather than -the percentage of branches taken. - -@item -n -@itemx --no-output -Do not create the @command{gcov} output file. - -@item -l -@itemx --long-file-names -Create long file names for included source files. For example, if the -header file @file{x.h} contains code, and was included in the file -@file{a.c}, then running @command{gcov} on the file @file{a.c} will -produce an output file called @file{a.c##x.h.gcov} instead of -@file{x.h.gcov}. This can be useful if @file{x.h} is included in -multiple source files and you want to see the individual -contributions. If you use the @samp{-p} option, both the including -and included file names will be complete path names. - -@item -p -@itemx --preserve-paths -Preserve complete path information in the names of generated -@file{.gcov} files. Without this option, just the filename component is -used. With this option, all directories are used, with @samp{/} characters -translated to @samp{#} characters, @file{.} directory components -removed and unremoveable @file{..} -components renamed to @samp{^}. This is useful if sourcefiles are in several -different directories. - -@item -r -@itemx --relative-only -Only output information about source files with a relative pathname -(after source prefix elision). Absolute paths are usually system -header files and coverage of any inline functions therein is normally -uninteresting. - -@item -f -@itemx --function-summaries -Output summaries for each function in addition to the file level summary. - -@item -o @var{directory|file} -@itemx --object-directory @var{directory} -@itemx --object-file @var{file} -Specify either the directory containing the gcov data files, or the -object path name. The @file{.gcno}, and -@file{.gcda} data files are searched for using this option. If a directory -is specified, the data files are in that directory and named after the -input file name, without its extension. If a file is specified here, -the data files are named after that file, without its extension. - -@item -s @var{directory} -@itemx --source-prefix @var{directory} -A prefix for source file names to remove when generating the output -coverage files. This option is useful when building in a separate -directory, and the pathname to the source directory is not wanted when -determining the output file names. Note that this prefix detection is -applied before determining whether the source file is absolute. - -@item -u -@itemx --unconditional-branches -When branch probabilities are given, include those of unconditional branches. -Unconditional branches are normally not interesting. - -@item -d -@itemx --display-progress -Display the progress on the standard output. - -@item -i -@itemx --intermediate-format -Output gcov file in an easy-to-parse intermediate text format that can -be used by @command{lcov} or other tools. The output is a single -@file{.gcov} file per @file{.gcda} file. No source code is required. - -The format of the intermediate @file{.gcov} file is plain text with -one entry per line - -@smallexample -file:@var{source_file_name} -function:@var{line_number},@var{execution_count},@var{function_name} -lcount:@var{line number},@var{execution_count} -branch:@var{line_number},@var{branch_coverage_type} - -Where the @var{branch_coverage_type} is - notexec (Branch not executed) - taken (Branch executed and taken) - nottaken (Branch executed, but not taken) - -There can be multiple @var{file} entries in an intermediate gcov -file. All entries following a @var{file} pertain to that source file -until the next @var{file} entry. -@end smallexample - -Here is a sample when @option{-i} is used in conjunction with @option{-b} option: - -@smallexample -file:array.cc -function:11,1,_Z3sumRKSt6vectorIPiSaIS0_EE -function:22,1,main -lcount:11,1 -lcount:12,1 -lcount:14,1 -branch:14,taken -lcount:26,1 -branch:28,nottaken -@end smallexample - -@item -m -@itemx --demangled-names -Display demangled function names in output. The default is to show -mangled function names. - -@end table - -@command{gcov} should be run with the current directory the same as that -when you invoked the compiler. Otherwise it will not be able to locate -the source files. @command{gcov} produces files called -@file{@var{mangledname}.gcov} in the current directory. These contain -the coverage information of the source file they correspond to. -One @file{.gcov} file is produced for each source (or header) file -containing code, -which was compiled to produce the data files. The @var{mangledname} part -of the output file name is usually simply the source file name, but can -be something more complicated if the @samp{-l} or @samp{-p} options are -given. Refer to those options for details. - -If you invoke @command{gcov} with multiple input files, the -contributions from each input file are summed. Typically you would -invoke it with the same list of files as the final link of your executable. - -The @file{.gcov} files contain the @samp{:} separated fields along with -program source code. The format is - -@smallexample -@var{execution_count}:@var{line_number}:@var{source line text} -@end smallexample - -Additional block information may succeed each line, when requested by -command line option. The @var{execution_count} is @samp{-} for lines -containing no code. Unexecuted lines are marked @samp{#####} or -@samp{====}, depending on whether they are reachable by -non-exceptional paths or only exceptional paths such as C++ exception -handlers, respectively. - -Some lines of information at the start have @var{line_number} of zero. -These preamble lines are of the form - -@smallexample --:0:@var{tag}:@var{value} -@end smallexample - -The ordering and number of these preamble lines will be augmented as -@command{gcov} development progresses --- do not rely on them remaining -unchanged. Use @var{tag} to locate a particular preamble line. - -The additional block information is of the form - -@smallexample -@var{tag} @var{information} -@end smallexample - -The @var{information} is human readable, but designed to be simple -enough for machine parsing too. - -When printing percentages, 0% and 100% are only printed when the values -are @emph{exactly} 0% and 100% respectively. Other values which would -conventionally be rounded to 0% or 100% are instead printed as the -nearest non-boundary value. - -When using @command{gcov}, you must first compile your program with two -special GCC options: @samp{-fprofile-arcs -ftest-coverage}. -This tells the compiler to generate additional information needed by -gcov (basically a flow graph of the program) and also includes -additional code in the object files for generating the extra profiling -information needed by gcov. These additional files are placed in the -directory where the object file is located. - -Running the program will cause profile output to be generated. For each -source file compiled with @option{-fprofile-arcs}, an accompanying -@file{.gcda} file will be placed in the object file directory. - -Running @command{gcov} with your program's source file names as arguments -will now produce a listing of the code along with frequency of execution -for each line. For example, if your program is called @file{tmp.c}, this -is what you see when you use the basic @command{gcov} facility: - -@smallexample -$ gcc -fprofile-arcs -ftest-coverage tmp.c -$ a.out -$ gcov tmp.c -90.00% of 10 source lines executed in file tmp.c -Creating tmp.c.gcov. -@end smallexample - -The file @file{tmp.c.gcov} contains output from @command{gcov}. -Here is a sample: - -@smallexample - -: 0:Source:tmp.c - -: 0:Graph:tmp.gcno - -: 0:Data:tmp.gcda - -: 0:Runs:1 - -: 0:Programs:1 - -: 1:#include - -: 2: - -: 3:int main (void) - 1: 4:@{ - 1: 5: int i, total; - -: 6: - 1: 7: total = 0; - -: 8: - 11: 9: for (i = 0; i < 10; i++) - 10: 10: total += i; - -: 11: - 1: 12: if (total != 45) - #####: 13: printf ("Failure\n"); - -: 14: else - 1: 15: printf ("Success\n"); - 1: 16: return 0; - -: 17:@} -@end smallexample - -When you use the @option{-a} option, you will get individual block -counts, and the output looks like this: - -@smallexample - -: 0:Source:tmp.c - -: 0:Graph:tmp.gcno - -: 0:Data:tmp.gcda - -: 0:Runs:1 - -: 0:Programs:1 - -: 1:#include - -: 2: - -: 3:int main (void) - 1: 4:@{ - 1: 4-block 0 - 1: 5: int i, total; - -: 6: - 1: 7: total = 0; - -: 8: - 11: 9: for (i = 0; i < 10; i++) - 11: 9-block 0 - 10: 10: total += i; - 10: 10-block 0 - -: 11: - 1: 12: if (total != 45) - 1: 12-block 0 - #####: 13: printf ("Failure\n"); - $$$$$: 13-block 0 - -: 14: else - 1: 15: printf ("Success\n"); - 1: 15-block 0 - 1: 16: return 0; - 1: 16-block 0 - -: 17:@} -@end smallexample - -In this mode, each basic block is only shown on one line -- the last -line of the block. A multi-line block will only contribute to the -execution count of that last line, and other lines will not be shown -to contain code, unless previous blocks end on those lines. -The total execution count of a line is shown and subsequent lines show -the execution counts for individual blocks that end on that line. After each -block, the branch and call counts of the block will be shown, if the -@option{-b} option is given. - -Because of the way GCC instruments calls, a call count can be shown -after a line with no individual blocks. -As you can see, line 13 contains a basic block that was not executed. - -@need 450 -When you use the @option{-b} option, your output looks like this: - -@smallexample -$ gcov -b tmp.c -90.00% of 10 source lines executed in file tmp.c -80.00% of 5 branches executed in file tmp.c -80.00% of 5 branches taken at least once in file tmp.c -50.00% of 2 calls executed in file tmp.c -Creating tmp.c.gcov. -@end smallexample - -Here is a sample of a resulting @file{tmp.c.gcov} file: - -@smallexample - -: 0:Source:tmp.c - -: 0:Graph:tmp.gcno - -: 0:Data:tmp.gcda - -: 0:Runs:1 - -: 0:Programs:1 - -: 1:#include - -: 2: - -: 3:int main (void) -function main called 1 returned 1 blocks executed 75% - 1: 4:@{ - 1: 5: int i, total; - -: 6: - 1: 7: total = 0; - -: 8: - 11: 9: for (i = 0; i < 10; i++) -branch 0 taken 91% (fallthrough) -branch 1 taken 9% - 10: 10: total += i; - -: 11: - 1: 12: if (total != 45) -branch 0 taken 0% (fallthrough) -branch 1 taken 100% - #####: 13: printf ("Failure\n"); -call 0 never executed - -: 14: else - 1: 15: printf ("Success\n"); -call 0 called 1 returned 100% - 1: 16: return 0; - -: 17:@} -@end smallexample - -For each function, a line is printed showing how many times the function -is called, how many times it returns and what percentage of the -function's blocks were executed. - -For each basic block, a line is printed after the last line of the basic -block describing the branch or call that ends the basic block. There can -be multiple branches and calls listed for a single source line if there -are multiple basic blocks that end on that line. In this case, the -branches and calls are each given a number. There is no simple way to map -these branches and calls back to source constructs. In general, though, -the lowest numbered branch or call will correspond to the leftmost construct -on the source line. - -For a branch, if it was executed at least once, then a percentage -indicating the number of times the branch was taken divided by the -number of times the branch was executed will be printed. Otherwise, the -message ``never executed'' is printed. - -For a call, if it was executed at least once, then a percentage -indicating the number of times the call returned divided by the number -of times the call was executed will be printed. This will usually be -100%, but may be less for functions that call @code{exit} or @code{longjmp}, -and thus may not return every time they are called. - -The execution counts are cumulative. If the example program were -executed again without removing the @file{.gcda} file, the count for the -number of times each line in the source was executed would be added to -the results of the previous run(s). This is potentially useful in -several ways. For example, it could be used to accumulate data over a -number of program runs as part of a test verification suite, or to -provide more accurate long-term information over a large number of -program runs. - -The data in the @file{.gcda} files is saved immediately before the program -exits. For each source file compiled with @option{-fprofile-arcs}, the -profiling code first attempts to read in an existing @file{.gcda} file; if -the file doesn't match the executable (differing number of basic block -counts) it will ignore the contents of the file. It then adds in the -new execution counts and finally writes the data to the file. - -@node Gcov and Optimization -@section Using @command{gcov} with GCC Optimization - -If you plan to use @command{gcov} to help optimize your code, you must -first compile your program with two special GCC options: -@samp{-fprofile-arcs -ftest-coverage}. Aside from that, you can use any -other GCC options; but if you want to prove that every single line -in your program was executed, you should not compile with optimization -at the same time. On some machines the optimizer can eliminate some -simple code lines by combining them with other lines. For example, code -like this: - -@smallexample -if (a != b) - c = 1; -else - c = 0; -@end smallexample - -@noindent -can be compiled into one instruction on some machines. In this case, -there is no way for @command{gcov} to calculate separate execution counts -for each line because there isn't separate code for each line. Hence -the @command{gcov} output looks like this if you compiled the program with -optimization: - -@smallexample - 100: 12:if (a != b) - 100: 13: c = 1; - 100: 14:else - 100: 15: c = 0; -@end smallexample - -The output shows that this block of code, combined by optimization, -executed 100 times. In one sense this result is correct, because there -was only one instruction representing all four of these lines. However, -the output does not indicate how many times the result was 0 and how -many times the result was 1. - -Inlineable functions can create unexpected line counts. Line counts are -shown for the source code of the inlineable function, but what is shown -depends on where the function is inlined, or if it is not inlined at all. - -If the function is not inlined, the compiler must emit an out of line -copy of the function, in any object file that needs it. If -@file{fileA.o} and @file{fileB.o} both contain out of line bodies of a -particular inlineable function, they will also both contain coverage -counts for that function. When @file{fileA.o} and @file{fileB.o} are -linked together, the linker will, on many systems, select one of those -out of line bodies for all calls to that function, and remove or ignore -the other. Unfortunately, it will not remove the coverage counters for -the unused function body. Hence when instrumented, all but one use of -that function will show zero counts. - -If the function is inlined in several places, the block structure in -each location might not be the same. For instance, a condition might -now be calculable at compile time in some instances. Because the -coverage of all the uses of the inline function will be shown for the -same source lines, the line counts themselves might seem inconsistent. - -Long-running applications can use the @code{_gcov_reset} and @code{_gcov_dump} -facilities to restrict profile collection to the program region of -interest. Calling @code{_gcov_reset(void)} will clear all profile counters -to zero, and calling @code{_gcov_dump(void)} will cause the profile information -collected at that point to be dumped to @file{.gcda} output files. - -@c man end - -@node Gcov Data Files -@section Brief Description of @command{gcov} Data Files - -@command{gcov} uses two files for profiling. The names of these files -are derived from the original @emph{object} file by substituting the -file suffix with either @file{.gcno}, or @file{.gcda}. The files -contain coverage and profile data stored in a platform-independent format. -The @file{.gcno} files are placed in the same directory as the object -file. By default, the @file{.gcda} files are also stored in the same -directory as the object file, but the GCC @option{-fprofile-dir} option -may be used to store the @file{.gcda} files in a separate directory. - -The @file{.gcno} notes file is generated when the source file is compiled -with the GCC @option{-ftest-coverage} option. It contains information to -reconstruct the basic block graphs and assign source line numbers to -blocks. - -The @file{.gcda} count data file is generated when a program containing -object files built with the GCC @option{-fprofile-arcs} option is executed. -A separate @file{.gcda} file is created for each object file compiled with -this option. It contains arc transition counts, value profile counts, and -some summary information. - -The full details of the file format is specified in @file{gcov-io.h}, -and functions provided in that header file should be used to access the -coverage files. - -@node Cross-profiling -@section Data File Relocation to Support Cross-Profiling - -Running the program will cause profile output to be generated. For each -source file compiled with @option{-fprofile-arcs}, an accompanying @file{.gcda} -file will be placed in the object file directory. That implicitly requires -running the program on the same system as it was built or having the same -absolute directory structure on the target system. The program will try -to create the needed directory structure, if it is not already present. - -To support cross-profiling, a program compiled with @option{-fprofile-arcs} -can relocate the data files based on two environment variables: - -@itemize @bullet -@item -GCOV_PREFIX contains the prefix to add to the absolute paths -in the object file. Prefix can be absolute, or relative. The -default is no prefix. - -@item -GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off -the hardwired absolute paths. Default value is 0. - -@emph{Note:} If GCOV_PREFIX_STRIP is set without GCOV_PREFIX is undefined, - then a relative path is made out of the hardwired absolute paths. -@end itemize - -For example, if the object file @file{/user/build/foo.o} was built with -@option{-fprofile-arcs}, the final executable will try to create the data file -@file{/user/build/foo.gcda} when running on the target system. This will -fail if the corresponding directory does not exist and it is unable to create -it. This can be overcome by, for example, setting the environment as -@samp{GCOV_PREFIX=/target/run} and @samp{GCOV_PREFIX_STRIP=1}. Such a -setting will name the data file @file{/target/run/build/foo.gcda}. - -You must move the data files to the expected directory tree in order to -use them for profile directed optimizations (@option{--use-profile}), or to -use the @command{gcov} tool. diff --git a/contrib/gcc-5.0/gcc/doc/generic.texi b/contrib/gcc-5.0/gcc/doc/generic.texi deleted file mode 100644 index bbafad9f93..0000000000 --- a/contrib/gcc-5.0/gcc/doc/generic.texi +++ /dev/null @@ -1,3440 +0,0 @@ -@c Copyright (C) 2004-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@c --------------------------------------------------------------------- -@c GENERIC -@c --------------------------------------------------------------------- - -@node GENERIC -@chapter GENERIC -@cindex GENERIC - -The purpose of GENERIC is simply to provide a -language-independent way of representing an entire function in -trees. To this end, it was necessary to add a few new tree codes -to the back end, but almost everything was already there. If you -can express it with the codes in @code{gcc/tree.def}, it's -GENERIC@. - -Early on, there was a great deal of debate about how to think -about statements in a tree IL@. In GENERIC, a statement is -defined as any expression whose value, if any, is ignored. A -statement will always have @code{TREE_SIDE_EFFECTS} set (or it -will be discarded), but a non-statement expression may also have -side effects. A @code{CALL_EXPR}, for instance. - -It would be possible for some local optimizations to work on the -GENERIC form of a function; indeed, the adapted tree inliner -works fine on GENERIC, but the current compiler performs inlining -after lowering to GIMPLE (a restricted form described in the next -section). Indeed, currently the frontends perform this lowering -before handing off to @code{tree_rest_of_compilation}, but this -seems inelegant. - -@menu -* Deficiencies:: Topics net yet covered in this document. -* Tree overview:: All about @code{tree}s. -* Types:: Fundamental and aggregate types. -* Declarations:: Type declarations and variables. -* Attributes:: Declaration and type attributes. -* Expressions: Expression trees. Operating on data. -* Statements:: Control flow and related trees. -* Functions:: Function bodies, linkage, and other aspects. -* Language-dependent trees:: Topics and trees specific to language front ends. -* C and C++ Trees:: Trees specific to C and C++. -* Java Trees:: Trees specific to Java. -@end menu - -@c --------------------------------------------------------------------- -@c Deficiencies -@c --------------------------------------------------------------------- - -@node Deficiencies -@section Deficiencies - -@c The spelling of "incomplet" and "incorrekt" below is intentional. -There are many places in which this document is incomplet and incorrekt. -It is, as of yet, only @emph{preliminary} documentation. - -@c --------------------------------------------------------------------- -@c Overview -@c --------------------------------------------------------------------- - -@node Tree overview -@section Overview -@cindex tree -@findex TREE_CODE - -The central data structure used by the internal representation is the -@code{tree}. These nodes, while all of the C type @code{tree}, are of -many varieties. A @code{tree} is a pointer type, but the object to -which it points may be of a variety of types. From this point forward, -we will refer to trees in ordinary type, rather than in @code{this -font}, except when talking about the actual C type @code{tree}. - -You can tell what kind of node a particular tree is by using the -@code{TREE_CODE} macro. Many, many macros take trees as input and -return trees as output. However, most macros require a certain kind of -tree node as input. In other words, there is a type-system for trees, -but it is not reflected in the C type-system. - -For safety, it is useful to configure GCC with @option{--enable-checking}. -Although this results in a significant performance penalty (since all -tree types are checked at run-time), and is therefore inappropriate in a -release version, it is extremely helpful during the development process. - -Many macros behave as predicates. Many, although not all, of these -predicates end in @samp{_P}. Do not rely on the result type of these -macros being of any particular type. You may, however, rely on the fact -that the type can be compared to @code{0}, so that statements like -@smallexample -if (TEST_P (t) && !TEST_P (y)) - x = 1; -@end smallexample -@noindent -and -@smallexample -int i = (TEST_P (t) != 0); -@end smallexample -@noindent -are legal. Macros that return @code{int} values now may be changed to -return @code{tree} values, or other pointers in the future. Even those -that continue to return @code{int} may return multiple nonzero codes -where previously they returned only zero and one. Therefore, you should -not write code like -@smallexample -if (TEST_P (t) == 1) -@end smallexample -@noindent -as this code is not guaranteed to work correctly in the future. - -You should not take the address of values returned by the macros or -functions described here. In particular, no guarantee is given that the -values are lvalues. - -In general, the names of macros are all in uppercase, while the names of -functions are entirely in lowercase. There are rare exceptions to this -rule. You should assume that any macro or function whose name is made -up entirely of uppercase letters may evaluate its arguments more than -once. You may assume that a macro or function whose name is made up -entirely of lowercase letters will evaluate its arguments only once. - -The @code{error_mark_node} is a special tree. Its tree code is -@code{ERROR_MARK}, but since there is only ever one node with that code, -the usual practice is to compare the tree against -@code{error_mark_node}. (This test is just a test for pointer -equality.) If an error has occurred during front-end processing the -flag @code{errorcount} will be set. If the front end has encountered -code it cannot handle, it will issue a message to the user and set -@code{sorrycount}. When these flags are set, any macro or function -which normally returns a tree of a particular kind may instead return -the @code{error_mark_node}. Thus, if you intend to do any processing of -erroneous code, you must be prepared to deal with the -@code{error_mark_node}. - -Occasionally, a particular tree slot (like an operand to an expression, -or a particular field in a declaration) will be referred to as -``reserved for the back end''. These slots are used to store RTL when -the tree is converted to RTL for use by the GCC back end. However, if -that process is not taking place (e.g., if the front end is being hooked -up to an intelligent editor), then those slots may be used by the -back end presently in use. - -If you encounter situations that do not match this documentation, such -as tree nodes of types not mentioned here, or macros documented to -return entities of a particular kind that instead return entities of -some different kind, you have found a bug, either in the front end or in -the documentation. Please report these bugs as you would any other -bug. - -@menu -* Macros and Functions::Macros and functions that can be used with all trees. -* Identifiers:: The names of things. -* Containers:: Lists and vectors. -@end menu - -@c --------------------------------------------------------------------- -@c Trees -@c --------------------------------------------------------------------- - -@node Macros and Functions -@subsection Trees -@cindex tree -@findex TREE_CHAIN -@findex TREE_TYPE - -All GENERIC trees have two fields in common. First, @code{TREE_CHAIN} -is a pointer that can be used as a singly-linked list to other trees. -The other is @code{TREE_TYPE}. Many trees store the type of an -expression or declaration in this field. - -These are some other functions for handling trees: - -@ftable @code - -@item tree_size -Return the number of bytes a tree takes. - -@item build0 -@itemx build1 -@itemx build2 -@itemx build3 -@itemx build4 -@itemx build5 -@itemx build6 - -These functions build a tree and supply values to put in each -parameter. The basic signature is @samp{@w{code, type, [operands]}}. -@code{code} is the @code{TREE_CODE}, and @code{type} is a tree -representing the @code{TREE_TYPE}. These are followed by the -operands, each of which is also a tree. - -@end ftable - - -@c --------------------------------------------------------------------- -@c Identifiers -@c --------------------------------------------------------------------- - -@node Identifiers -@subsection Identifiers -@cindex identifier -@cindex name -@tindex IDENTIFIER_NODE - -An @code{IDENTIFIER_NODE} represents a slightly more general concept -than the standard C or C++ concept of identifier. In particular, an -@code{IDENTIFIER_NODE} may contain a @samp{$}, or other extraordinary -characters. - -There are never two distinct @code{IDENTIFIER_NODE}s representing the -same identifier. Therefore, you may use pointer equality to compare -@code{IDENTIFIER_NODE}s, rather than using a routine like -@code{strcmp}. Use @code{get_identifier} to obtain the unique -@code{IDENTIFIER_NODE} for a supplied string. - -You can use the following macros to access identifiers: -@ftable @code -@item IDENTIFIER_POINTER -The string represented by the identifier, represented as a -@code{char*}. This string is always @code{NUL}-terminated, and contains -no embedded @code{NUL} characters. - -@item IDENTIFIER_LENGTH -The length of the string returned by @code{IDENTIFIER_POINTER}, not -including the trailing @code{NUL}. This value of -@code{IDENTIFIER_LENGTH (x)} is always the same as @code{strlen -(IDENTIFIER_POINTER (x))}. - -@item IDENTIFIER_OPNAME_P -This predicate holds if the identifier represents the name of an -overloaded operator. In this case, you should not depend on the -contents of either the @code{IDENTIFIER_POINTER} or the -@code{IDENTIFIER_LENGTH}. - -@item IDENTIFIER_TYPENAME_P -This predicate holds if the identifier represents the name of a -user-defined conversion operator. In this case, the @code{TREE_TYPE} of -the @code{IDENTIFIER_NODE} holds the type to which the conversion -operator converts. - -@end ftable - -@c --------------------------------------------------------------------- -@c Containers -@c --------------------------------------------------------------------- - -@node Containers -@subsection Containers -@cindex container -@cindex list -@cindex vector -@tindex TREE_LIST -@tindex TREE_VEC -@findex TREE_PURPOSE -@findex TREE_VALUE -@findex TREE_VEC_LENGTH -@findex TREE_VEC_ELT - -Two common container data structures can be represented directly with -tree nodes. A @code{TREE_LIST} is a singly linked list containing two -trees per node. These are the @code{TREE_PURPOSE} and @code{TREE_VALUE} -of each node. (Often, the @code{TREE_PURPOSE} contains some kind of -tag, or additional information, while the @code{TREE_VALUE} contains the -majority of the payload. In other cases, the @code{TREE_PURPOSE} is -simply @code{NULL_TREE}, while in still others both the -@code{TREE_PURPOSE} and @code{TREE_VALUE} are of equal stature.) Given -one @code{TREE_LIST} node, the next node is found by following the -@code{TREE_CHAIN}. If the @code{TREE_CHAIN} is @code{NULL_TREE}, then -you have reached the end of the list. - -A @code{TREE_VEC} is a simple vector. The @code{TREE_VEC_LENGTH} is an -integer (not a tree) giving the number of nodes in the vector. The -nodes themselves are accessed using the @code{TREE_VEC_ELT} macro, which -takes two arguments. The first is the @code{TREE_VEC} in question; the -second is an integer indicating which element in the vector is desired. -The elements are indexed from zero. - -@c --------------------------------------------------------------------- -@c Types -@c --------------------------------------------------------------------- - -@node Types -@section Types -@cindex type -@cindex pointer -@cindex reference -@cindex fundamental type -@cindex array -@tindex VOID_TYPE -@tindex INTEGER_TYPE -@tindex TYPE_MIN_VALUE -@tindex TYPE_MAX_VALUE -@tindex REAL_TYPE -@tindex FIXED_POINT_TYPE -@tindex COMPLEX_TYPE -@tindex ENUMERAL_TYPE -@tindex BOOLEAN_TYPE -@tindex POINTER_TYPE -@tindex REFERENCE_TYPE -@tindex FUNCTION_TYPE -@tindex METHOD_TYPE -@tindex ARRAY_TYPE -@tindex RECORD_TYPE -@tindex UNION_TYPE -@tindex UNKNOWN_TYPE -@tindex OFFSET_TYPE -@findex TYPE_UNQUALIFIED -@findex TYPE_QUAL_CONST -@findex TYPE_QUAL_VOLATILE -@findex TYPE_QUAL_RESTRICT -@findex TYPE_MAIN_VARIANT -@cindex qualified type -@findex TYPE_SIZE -@findex TYPE_ALIGN -@findex TYPE_PRECISION -@findex TYPE_ARG_TYPES -@findex TYPE_METHOD_BASETYPE -@findex TYPE_OFFSET_BASETYPE -@findex TREE_TYPE -@findex TYPE_CONTEXT -@findex TYPE_NAME -@findex TYPENAME_TYPE_FULLNAME -@findex TYPE_FIELDS -@findex TYPE_CANONICAL -@findex TYPE_STRUCTURAL_EQUALITY_P -@findex SET_TYPE_STRUCTURAL_EQUALITY - -All types have corresponding tree nodes. However, you should not assume -that there is exactly one tree node corresponding to each type. There -are often multiple nodes corresponding to the same type. - -For the most part, different kinds of types have different tree codes. -(For example, pointer types use a @code{POINTER_TYPE} code while arrays -use an @code{ARRAY_TYPE} code.) However, pointers to member functions -use the @code{RECORD_TYPE} code. Therefore, when writing a -@code{switch} statement that depends on the code associated with a -particular type, you should take care to handle pointers to member -functions under the @code{RECORD_TYPE} case label. - -The following functions and macros deal with cv-qualification of types: -@ftable @code -@item TYPE_MAIN_VARIANT -This macro returns the unqualified version of a type. It may be applied -to an unqualified type, but it is not always the identity function in -that case. -@end ftable - -A few other macros and functions are usable with all types: -@ftable @code -@item TYPE_SIZE -The number of bits required to represent the type, represented as an -@code{INTEGER_CST}. For an incomplete type, @code{TYPE_SIZE} will be -@code{NULL_TREE}. - -@item TYPE_ALIGN -The alignment of the type, in bits, represented as an @code{int}. - -@item TYPE_NAME -This macro returns a declaration (in the form of a @code{TYPE_DECL}) for -the type. (Note this macro does @emph{not} return an -@code{IDENTIFIER_NODE}, as you might expect, given its name!) You can -look at the @code{DECL_NAME} of the @code{TYPE_DECL} to obtain the -actual name of the type. The @code{TYPE_NAME} will be @code{NULL_TREE} -for a type that is not a built-in type, the result of a typedef, or a -named class type. - -@item TYPE_CANONICAL -This macro returns the ``canonical'' type for the given type -node. Canonical types are used to improve performance in the C++ and -Objective-C++ front ends by allowing efficient comparison between two -type nodes in @code{same_type_p}: if the @code{TYPE_CANONICAL} values -of the types are equal, the types are equivalent; otherwise, the types -are not equivalent. The notion of equivalence for canonical types is -the same as the notion of type equivalence in the language itself. For -instance, - -When @code{TYPE_CANONICAL} is @code{NULL_TREE}, there is no canonical -type for the given type node. In this case, comparison between this -type and any other type requires the compiler to perform a deep, -``structural'' comparison to see if the two type nodes have the same -form and properties. - -The canonical type for a node is always the most fundamental type in -the equivalence class of types. For instance, @code{int} is its own -canonical type. A typedef @code{I} of @code{int} will have @code{int} -as its canonical type. Similarly, @code{I*}@ and a typedef @code{IP}@ -(defined to @code{I*}) will has @code{int*} as their canonical -type. When building a new type node, be sure to set -@code{TYPE_CANONICAL} to the appropriate canonical type. If the new -type is a compound type (built from other types), and any of those -other types require structural equality, use -@code{SET_TYPE_STRUCTURAL_EQUALITY} to ensure that the new type also -requires structural equality. Finally, if for some reason you cannot -guarantee that @code{TYPE_CANONICAL} will point to the canonical type, -use @code{SET_TYPE_STRUCTURAL_EQUALITY} to make sure that the new -type--and any type constructed based on it--requires structural -equality. If you suspect that the canonical type system is -miscomparing types, pass @code{--param verify-canonical-types=1} to -the compiler or configure with @code{--enable-checking} to force the -compiler to verify its canonical-type comparisons against the -structural comparisons; the compiler will then print any warnings if -the canonical types miscompare. - -@item TYPE_STRUCTURAL_EQUALITY_P -This predicate holds when the node requires structural equality -checks, e.g., when @code{TYPE_CANONICAL} is @code{NULL_TREE}. - -@item SET_TYPE_STRUCTURAL_EQUALITY -This macro states that the type node it is given requires structural -equality checks, e.g., it sets @code{TYPE_CANONICAL} to -@code{NULL_TREE}. - -@item same_type_p -This predicate takes two types as input, and holds if they are the same -type. For example, if one type is a @code{typedef} for the other, or -both are @code{typedef}s for the same type. This predicate also holds if -the two trees given as input are simply copies of one another; i.e., -there is no difference between them at the source level, but, for -whatever reason, a duplicate has been made in the representation. You -should never use @code{==} (pointer equality) to compare types; always -use @code{same_type_p} instead. -@end ftable - -Detailed below are the various kinds of types, and the macros that can -be used to access them. Although other kinds of types are used -elsewhere in G++, the types described here are the only ones that you -will encounter while examining the intermediate representation. - -@table @code -@item VOID_TYPE -Used to represent the @code{void} type. - -@item INTEGER_TYPE -Used to represent the various integral types, including @code{char}, -@code{short}, @code{int}, @code{long}, and @code{long long}. This code -is not used for enumeration types, nor for the @code{bool} type. -The @code{TYPE_PRECISION} is the number of bits used in -the representation, represented as an @code{unsigned int}. (Note that -in the general case this is not the same value as @code{TYPE_SIZE}; -suppose that there were a 24-bit integer type, but that alignment -requirements for the ABI required 32-bit alignment. Then, -@code{TYPE_SIZE} would be an @code{INTEGER_CST} for 32, while -@code{TYPE_PRECISION} would be 24.) The integer type is unsigned if -@code{TYPE_UNSIGNED} holds; otherwise, it is signed. - -The @code{TYPE_MIN_VALUE} is an @code{INTEGER_CST} for the smallest -integer that may be represented by this type. Similarly, the -@code{TYPE_MAX_VALUE} is an @code{INTEGER_CST} for the largest integer -that may be represented by this type. - -@item REAL_TYPE -Used to represent the @code{float}, @code{double}, and @code{long -double} types. The number of bits in the floating-point representation -is given by @code{TYPE_PRECISION}, as in the @code{INTEGER_TYPE} case. - -@item FIXED_POINT_TYPE -Used to represent the @code{short _Fract}, @code{_Fract}, @code{long -_Fract}, @code{long long _Fract}, @code{short _Accum}, @code{_Accum}, -@code{long _Accum}, and @code{long long _Accum} types. The number of bits -in the fixed-point representation is given by @code{TYPE_PRECISION}, -as in the @code{INTEGER_TYPE} case. There may be padding bits, fractional -bits and integral bits. The number of fractional bits is given by -@code{TYPE_FBIT}, and the number of integral bits is given by @code{TYPE_IBIT}. -The fixed-point type is unsigned if @code{TYPE_UNSIGNED} holds; otherwise, -it is signed. -The fixed-point type is saturating if @code{TYPE_SATURATING} holds; otherwise, -it is not saturating. - -@item COMPLEX_TYPE -Used to represent GCC built-in @code{__complex__} data types. The -@code{TREE_TYPE} is the type of the real and imaginary parts. - -@item ENUMERAL_TYPE -Used to represent an enumeration type. The @code{TYPE_PRECISION} gives -(as an @code{int}), the number of bits used to represent the type. If -there are no negative enumeration constants, @code{TYPE_UNSIGNED} will -hold. The minimum and maximum enumeration constants may be obtained -with @code{TYPE_MIN_VALUE} and @code{TYPE_MAX_VALUE}, respectively; each -of these macros returns an @code{INTEGER_CST}. - -The actual enumeration constants themselves may be obtained by looking -at the @code{TYPE_VALUES}. This macro will return a @code{TREE_LIST}, -containing the constants. The @code{TREE_PURPOSE} of each node will be -an @code{IDENTIFIER_NODE} giving the name of the constant; the -@code{TREE_VALUE} will be an @code{INTEGER_CST} giving the value -assigned to that constant. These constants will appear in the order in -which they were declared. The @code{TREE_TYPE} of each of these -constants will be the type of enumeration type itself. - -@item BOOLEAN_TYPE -Used to represent the @code{bool} type. - -@item POINTER_TYPE -Used to represent pointer types, and pointer to data member types. The -@code{TREE_TYPE} gives the type to which this type points. - -@item REFERENCE_TYPE -Used to represent reference types. The @code{TREE_TYPE} gives the type -to which this type refers. - -@item FUNCTION_TYPE -Used to represent the type of non-member functions and of static member -functions. The @code{TREE_TYPE} gives the return type of the function. -The @code{TYPE_ARG_TYPES} are a @code{TREE_LIST} of the argument types. -The @code{TREE_VALUE} of each node in this list is the type of the -corresponding argument; the @code{TREE_PURPOSE} is an expression for the -default argument value, if any. If the last node in the list is -@code{void_list_node} (a @code{TREE_LIST} node whose @code{TREE_VALUE} -is the @code{void_type_node}), then functions of this type do not take -variable arguments. Otherwise, they do take a variable number of -arguments. - -Note that in C (but not in C++) a function declared like @code{void f()} -is an unprototyped function taking a variable number of arguments; the -@code{TYPE_ARG_TYPES} of such a function will be @code{NULL}. - -@item METHOD_TYPE -Used to represent the type of a non-static member function. Like a -@code{FUNCTION_TYPE}, the return type is given by the @code{TREE_TYPE}. -The type of @code{*this}, i.e., the class of which functions of this -type are a member, is given by the @code{TYPE_METHOD_BASETYPE}. The -@code{TYPE_ARG_TYPES} is the parameter list, as for a -@code{FUNCTION_TYPE}, and includes the @code{this} argument. - -@item ARRAY_TYPE -Used to represent array types. The @code{TREE_TYPE} gives the type of -the elements in the array. If the array-bound is present in the type, -the @code{TYPE_DOMAIN} is an @code{INTEGER_TYPE} whose -@code{TYPE_MIN_VALUE} and @code{TYPE_MAX_VALUE} will be the lower and -upper bounds of the array, respectively. The @code{TYPE_MIN_VALUE} will -always be an @code{INTEGER_CST} for zero, while the -@code{TYPE_MAX_VALUE} will be one less than the number of elements in -the array, i.e., the highest value which may be used to index an element -in the array. - -@item RECORD_TYPE -Used to represent @code{struct} and @code{class} types, as well as -pointers to member functions and similar constructs in other languages. -@code{TYPE_FIELDS} contains the items contained in this type, each of -which can be a @code{FIELD_DECL}, @code{VAR_DECL}, @code{CONST_DECL}, or -@code{TYPE_DECL}. You may not make any assumptions about the ordering -of the fields in the type or whether one or more of them overlap. - -@item UNION_TYPE -Used to represent @code{union} types. Similar to @code{RECORD_TYPE} -except that all @code{FIELD_DECL} nodes in @code{TYPE_FIELD} start at -bit position zero. - -@item QUAL_UNION_TYPE -Used to represent part of a variant record in Ada. Similar to -@code{UNION_TYPE} except that each @code{FIELD_DECL} has a -@code{DECL_QUALIFIER} field, which contains a boolean expression that -indicates whether the field is present in the object. The type will only -have one field, so each field's @code{DECL_QUALIFIER} is only evaluated -if none of the expressions in the previous fields in @code{TYPE_FIELDS} -are nonzero. Normally these expressions will reference a field in the -outer object using a @code{PLACEHOLDER_EXPR}. - -@item LANG_TYPE -This node is used to represent a language-specific type. The front -end must handle it. - -@item OFFSET_TYPE -This node is used to represent a pointer-to-data member. For a data -member @code{X::m} the @code{TYPE_OFFSET_BASETYPE} is @code{X} and the -@code{TREE_TYPE} is the type of @code{m}. - -@end table - -There are variables whose values represent some of the basic types. -These include: -@table @code -@item void_type_node -A node for @code{void}. - -@item integer_type_node -A node for @code{int}. - -@item unsigned_type_node. -A node for @code{unsigned int}. - -@item char_type_node. -A node for @code{char}. -@end table -@noindent -It may sometimes be useful to compare one of these variables with a type -in hand, using @code{same_type_p}. - -@c --------------------------------------------------------------------- -@c Declarations -@c --------------------------------------------------------------------- - -@node Declarations -@section Declarations -@cindex declaration -@cindex variable -@cindex type declaration -@tindex LABEL_DECL -@tindex CONST_DECL -@tindex TYPE_DECL -@tindex VAR_DECL -@tindex PARM_DECL -@tindex DEBUG_EXPR_DECL -@tindex FIELD_DECL -@tindex NAMESPACE_DECL -@tindex RESULT_DECL -@tindex TEMPLATE_DECL -@tindex THUNK_DECL -@findex THUNK_DELTA -@findex DECL_INITIAL -@findex DECL_SIZE -@findex DECL_ALIGN -@findex DECL_EXTERNAL - -This section covers the various kinds of declarations that appear in the -internal representation, except for declarations of functions -(represented by @code{FUNCTION_DECL} nodes), which are described in -@ref{Functions}. - -@menu -* Working with declarations:: Macros and functions that work on -declarations. -* Internal structure:: How declaration nodes are represented. -@end menu - -@node Working with declarations -@subsection Working with declarations - -Some macros can be used with any kind of declaration. These include: -@ftable @code -@item DECL_NAME -This macro returns an @code{IDENTIFIER_NODE} giving the name of the -entity. - -@item TREE_TYPE -This macro returns the type of the entity declared. - -@item EXPR_FILENAME -This macro returns the name of the file in which the entity was -declared, as a @code{char*}. For an entity declared implicitly by the -compiler (like @code{__builtin_memcpy}), this will be the string -@code{""}. - -@item EXPR_LINENO -This macro returns the line number at which the entity was declared, as -an @code{int}. - -@item DECL_ARTIFICIAL -This predicate holds if the declaration was implicitly generated by the -compiler. For example, this predicate will hold of an implicitly -declared member function, or of the @code{TYPE_DECL} implicitly -generated for a class type. Recall that in C++ code like: -@smallexample -struct S @{@}; -@end smallexample -@noindent -is roughly equivalent to C code like: -@smallexample -struct S @{@}; -typedef struct S S; -@end smallexample -The implicitly generated @code{typedef} declaration is represented by a -@code{TYPE_DECL} for which @code{DECL_ARTIFICIAL} holds. - -@end ftable - -The various kinds of declarations include: -@table @code -@item LABEL_DECL -These nodes are used to represent labels in function bodies. For more -information, see @ref{Functions}. These nodes only appear in block -scopes. - -@item CONST_DECL -These nodes are used to represent enumeration constants. The value of -the constant is given by @code{DECL_INITIAL} which will be an -@code{INTEGER_CST} with the same type as the @code{TREE_TYPE} of the -@code{CONST_DECL}, i.e., an @code{ENUMERAL_TYPE}. - -@item RESULT_DECL -These nodes represent the value returned by a function. When a value is -assigned to a @code{RESULT_DECL}, that indicates that the value should -be returned, via bitwise copy, by the function. You can use -@code{DECL_SIZE} and @code{DECL_ALIGN} on a @code{RESULT_DECL}, just as -with a @code{VAR_DECL}. - -@item TYPE_DECL -These nodes represent @code{typedef} declarations. The @code{TREE_TYPE} -is the type declared to have the name given by @code{DECL_NAME}. In -some cases, there is no associated name. - -@item VAR_DECL -These nodes represent variables with namespace or block scope, as well -as static data members. The @code{DECL_SIZE} and @code{DECL_ALIGN} are -analogous to @code{TYPE_SIZE} and @code{TYPE_ALIGN}. For a declaration, -you should always use the @code{DECL_SIZE} and @code{DECL_ALIGN} rather -than the @code{TYPE_SIZE} and @code{TYPE_ALIGN} given by the -@code{TREE_TYPE}, since special attributes may have been applied to the -variable to give it a particular size and alignment. You may use the -predicates @code{DECL_THIS_STATIC} or @code{DECL_THIS_EXTERN} to test -whether the storage class specifiers @code{static} or @code{extern} were -used to declare a variable. - -If this variable is initialized (but does not require a constructor), -the @code{DECL_INITIAL} will be an expression for the initializer. The -initializer should be evaluated, and a bitwise copy into the variable -performed. If the @code{DECL_INITIAL} is the @code{error_mark_node}, -there is an initializer, but it is given by an explicit statement later -in the code; no bitwise copy is required. - -GCC provides an extension that allows either automatic variables, or -global variables, to be placed in particular registers. This extension -is being used for a particular @code{VAR_DECL} if @code{DECL_REGISTER} -holds for the @code{VAR_DECL}, and if @code{DECL_ASSEMBLER_NAME} is not -equal to @code{DECL_NAME}. In that case, @code{DECL_ASSEMBLER_NAME} is -the name of the register into which the variable will be placed. - -@item PARM_DECL -Used to represent a parameter to a function. Treat these nodes -similarly to @code{VAR_DECL} nodes. These nodes only appear in the -@code{DECL_ARGUMENTS} for a @code{FUNCTION_DECL}. - -The @code{DECL_ARG_TYPE} for a @code{PARM_DECL} is the type that will -actually be used when a value is passed to this function. It may be a -wider type than the @code{TREE_TYPE} of the parameter; for example, the -ordinary type might be @code{short} while the @code{DECL_ARG_TYPE} is -@code{int}. - -@item DEBUG_EXPR_DECL -Used to represent an anonymous debug-information temporary created to -hold an expression as it is optimized away, so that its value can be -referenced in debug bind statements. - -@item FIELD_DECL -These nodes represent non-static data members. The @code{DECL_SIZE} and -@code{DECL_ALIGN} behave as for @code{VAR_DECL} nodes. -The position of the field within the parent record is specified by a -combination of three attributes. @code{DECL_FIELD_OFFSET} is the position, -counting in bytes, of the @code{DECL_OFFSET_ALIGN}-bit sized word containing -the bit of the field closest to the beginning of the structure. -@code{DECL_FIELD_BIT_OFFSET} is the bit offset of the first bit of the field -within this word; this may be nonzero even for fields that are not bit-fields, -since @code{DECL_OFFSET_ALIGN} may be greater than the natural alignment -of the field's type. - -If @code{DECL_C_BIT_FIELD} holds, this field is a bit-field. In a bit-field, -@code{DECL_BIT_FIELD_TYPE} also contains the type that was originally -specified for it, while DECL_TYPE may be a modified type with lesser precision, -according to the size of the bit field. - -@item NAMESPACE_DECL -Namespaces provide a name hierarchy for other declarations. They -appear in the @code{DECL_CONTEXT} of other @code{_DECL} nodes. - -@end table - -@node Internal structure -@subsection Internal structure - -@code{DECL} nodes are represented internally as a hierarchy of -structures. - -@menu -* Current structure hierarchy:: The current DECL node structure -hierarchy. -* Adding new DECL node types:: How to add a new DECL node to a -frontend. -@end menu - -@node Current structure hierarchy -@subsubsection Current structure hierarchy - -@table @code - -@item struct tree_decl_minimal -This is the minimal structure to inherit from in order for common -@code{DECL} macros to work. The fields it contains are a unique ID, -source location, context, and name. - -@item struct tree_decl_common -This structure inherits from @code{struct tree_decl_minimal}. It -contains fields that most @code{DECL} nodes need, such as a field to -store alignment, machine mode, size, and attributes. - -@item struct tree_field_decl -This structure inherits from @code{struct tree_decl_common}. It is -used to represent @code{FIELD_DECL}. - -@item struct tree_label_decl -This structure inherits from @code{struct tree_decl_common}. It is -used to represent @code{LABEL_DECL}. - -@item struct tree_translation_unit_decl -This structure inherits from @code{struct tree_decl_common}. It is -used to represent @code{TRANSLATION_UNIT_DECL}. - -@item struct tree_decl_with_rtl -This structure inherits from @code{struct tree_decl_common}. It -contains a field to store the low-level RTL associated with a -@code{DECL} node. - -@item struct tree_result_decl -This structure inherits from @code{struct tree_decl_with_rtl}. It is -used to represent @code{RESULT_DECL}. - -@item struct tree_const_decl -This structure inherits from @code{struct tree_decl_with_rtl}. It is -used to represent @code{CONST_DECL}. - -@item struct tree_parm_decl -This structure inherits from @code{struct tree_decl_with_rtl}. It is -used to represent @code{PARM_DECL}. - -@item struct tree_decl_with_vis -This structure inherits from @code{struct tree_decl_with_rtl}. It -contains fields necessary to store visibility information, as well as -a section name and assembler name. - -@item struct tree_var_decl -This structure inherits from @code{struct tree_decl_with_vis}. It is -used to represent @code{VAR_DECL}. - -@item struct tree_function_decl -This structure inherits from @code{struct tree_decl_with_vis}. It is -used to represent @code{FUNCTION_DECL}. - -@end table -@node Adding new DECL node types -@subsubsection Adding new DECL node types - -Adding a new @code{DECL} tree consists of the following steps - -@table @asis - -@item Add a new tree code for the @code{DECL} node -For language specific @code{DECL} nodes, there is a @file{.def} file -in each frontend directory where the tree code should be added. -For @code{DECL} nodes that are part of the middle-end, the code should -be added to @file{tree.def}. - -@item Create a new structure type for the @code{DECL} node -These structures should inherit from one of the existing structures in -the language hierarchy by using that structure as the first member. - -@smallexample -struct tree_foo_decl -@{ - struct tree_decl_with_vis common; -@} -@end smallexample - -Would create a structure name @code{tree_foo_decl} that inherits from -@code{struct tree_decl_with_vis}. - -For language specific @code{DECL} nodes, this new structure type -should go in the appropriate @file{.h} file. -For @code{DECL} nodes that are part of the middle-end, the structure -type should go in @file{tree.h}. - -@item Add a member to the tree structure enumerator for the node -For garbage collection and dynamic checking purposes, each @code{DECL} -node structure type is required to have a unique enumerator value -specified with it. -For language specific @code{DECL} nodes, this new enumerator value -should go in the appropriate @file{.def} file. -For @code{DECL} nodes that are part of the middle-end, the enumerator -values are specified in @file{treestruct.def}. - -@item Update @code{union tree_node} -In order to make your new structure type usable, it must be added to -@code{union tree_node}. -For language specific @code{DECL} nodes, a new entry should be added -to the appropriate @file{.h} file of the form -@smallexample - struct tree_foo_decl GTY ((tag ("TS_VAR_DECL"))) foo_decl; -@end smallexample -For @code{DECL} nodes that are part of the middle-end, the additional -member goes directly into @code{union tree_node} in @file{tree.h}. - -@item Update dynamic checking info -In order to be able to check whether accessing a named portion of -@code{union tree_node} is legal, and whether a certain @code{DECL} node -contains one of the enumerated @code{DECL} node structures in the -hierarchy, a simple lookup table is used. -This lookup table needs to be kept up to date with the tree structure -hierarchy, or else checking and containment macros will fail -inappropriately. - -For language specific @code{DECL} nodes, their is an @code{init_ts} -function in an appropriate @file{.c} file, which initializes the lookup -table. -Code setting up the table for new @code{DECL} nodes should be added -there. -For each @code{DECL} tree code and enumerator value representing a -member of the inheritance hierarchy, the table should contain 1 if -that tree code inherits (directly or indirectly) from that member. -Thus, a @code{FOO_DECL} node derived from @code{struct decl_with_rtl}, -and enumerator value @code{TS_FOO_DECL}, would be set up as follows -@smallexample -tree_contains_struct[FOO_DECL][TS_FOO_DECL] = 1; -tree_contains_struct[FOO_DECL][TS_DECL_WRTL] = 1; -tree_contains_struct[FOO_DECL][TS_DECL_COMMON] = 1; -tree_contains_struct[FOO_DECL][TS_DECL_MINIMAL] = 1; -@end smallexample - -For @code{DECL} nodes that are part of the middle-end, the setup code -goes into @file{tree.c}. - -@item Add macros to access any new fields and flags - -Each added field or flag should have a macro that is used to access -it, that performs appropriate checking to ensure only the right type of -@code{DECL} nodes access the field. - -These macros generally take the following form -@smallexample -#define FOO_DECL_FIELDNAME(NODE) FOO_DECL_CHECK(NODE)->foo_decl.fieldname -@end smallexample -However, if the structure is simply a base class for further -structures, something like the following should be used -@smallexample -#define BASE_STRUCT_CHECK(T) CONTAINS_STRUCT_CHECK(T, TS_BASE_STRUCT) -#define BASE_STRUCT_FIELDNAME(NODE) \ - (BASE_STRUCT_CHECK(NODE)->base_struct.fieldname -@end smallexample - -Reading them from the generated @file{all-tree.def} file (which in -turn includes all the @file{tree.def} files), @file{gencheck.c} is -used during GCC's build to generate the @code{*_CHECK} macros for all -tree codes. - -@end table - - -@c --------------------------------------------------------------------- -@c Attributes -@c --------------------------------------------------------------------- -@node Attributes -@section Attributes in trees -@cindex attributes - -Attributes, as specified using the @code{__attribute__} keyword, are -represented internally as a @code{TREE_LIST}. The @code{TREE_PURPOSE} -is the name of the attribute, as an @code{IDENTIFIER_NODE}. The -@code{TREE_VALUE} is a @code{TREE_LIST} of the arguments of the -attribute, if any, or @code{NULL_TREE} if there are no arguments; the -arguments are stored as the @code{TREE_VALUE} of successive entries in -the list, and may be identifiers or expressions. The @code{TREE_CHAIN} -of the attribute is the next attribute in a list of attributes applying -to the same declaration or type, or @code{NULL_TREE} if there are no -further attributes in the list. - -Attributes may be attached to declarations and to types; these -attributes may be accessed with the following macros. All attributes -are stored in this way, and many also cause other changes to the -declaration or type or to other internal compiler data structures. - -@deftypefn {Tree Macro} tree DECL_ATTRIBUTES (tree @var{decl}) -This macro returns the attributes on the declaration @var{decl}. -@end deftypefn - -@deftypefn {Tree Macro} tree TYPE_ATTRIBUTES (tree @var{type}) -This macro returns the attributes on the type @var{type}. -@end deftypefn - - -@c --------------------------------------------------------------------- -@c Expressions -@c --------------------------------------------------------------------- - -@node Expression trees -@section Expressions -@cindex expression -@findex TREE_TYPE -@findex TREE_OPERAND - -The internal representation for expressions is for the most part quite -straightforward. However, there are a few facts that one must bear in -mind. In particular, the expression ``tree'' is actually a directed -acyclic graph. (For example there may be many references to the integer -constant zero throughout the source program; many of these will be -represented by the same expression node.) You should not rely on -certain kinds of node being shared, nor should you rely on certain kinds of -nodes being unshared. - -The following macros can be used with all expression nodes: - -@ftable @code -@item TREE_TYPE -Returns the type of the expression. This value may not be precisely the -same type that would be given the expression in the original program. -@end ftable - -In what follows, some nodes that one might expect to always have type -@code{bool} are documented to have either integral or boolean type. At -some point in the future, the C front end may also make use of this same -intermediate representation, and at this point these nodes will -certainly have integral type. The previous sentence is not meant to -imply that the C++ front end does not or will not give these nodes -integral type. - -Below, we list the various kinds of expression nodes. Except where -noted otherwise, the operands to an expression are accessed using the -@code{TREE_OPERAND} macro. For example, to access the first operand to -a binary plus expression @code{expr}, use: - -@smallexample -TREE_OPERAND (expr, 0) -@end smallexample -@noindent - -As this example indicates, the operands are zero-indexed. - - -@menu -* Constants: Constant expressions. -* Storage References:: -* Unary and Binary Expressions:: -* Vectors:: -@end menu - -@node Constant expressions -@subsection Constant expressions -@tindex INTEGER_CST -@findex tree_int_cst_lt -@findex tree_int_cst_equal -@tindex tree_fits_uhwi_p -@tindex tree_fits_shwi_p -@tindex tree_to_uhwi -@tindex tree_to_shwi -@tindex TREE_INT_CST_NUNITS -@tindex TREE_INT_CST_ELT -@tindex TREE_INT_CST_LOW -@tindex REAL_CST -@tindex FIXED_CST -@tindex COMPLEX_CST -@tindex VECTOR_CST -@tindex STRING_CST -@findex TREE_STRING_LENGTH -@findex TREE_STRING_POINTER - -The table below begins with constants, moves on to unary expressions, -then proceeds to binary expressions, and concludes with various other -kinds of expressions: - -@table @code -@item INTEGER_CST -These nodes represent integer constants. Note that the type of these -constants is obtained with @code{TREE_TYPE}; they are not always of type -@code{int}. In particular, @code{char} constants are represented with -@code{INTEGER_CST} nodes. The value of the integer constant @code{e} is -represented in an array of HOST_WIDE_INT. There are enough elements -in the array to represent the value without taking extra elements for -redundant 0s or -1. The number of elements used to represent @code{e} -is available via @code{TREE_INT_CST_NUNITS}. Element @code{i} can be -extracted by using @code{TREE_INT_CST_ELT (e, i)}. -@code{TREE_INT_CST_LOW} is a shorthand for @code{TREE_INT_CST_ELT (e, 0)}. - -The functions @code{tree_fits_shwi_p} and @code{tree_fits_uhwi_p} -can be used to tell if the value is small enough to fit in a -signed HOST_WIDE_INT or an unsigned HOST_WIDE_INT respectively. -The value can then be extracted using @code{tree_to_shwi} and -@code{tree_to_uhwi}. - -@item REAL_CST - -FIXME: Talk about how to obtain representations of this constant, do -comparisons, and so forth. - -@item FIXED_CST - -These nodes represent fixed-point constants. The type of these constants -is obtained with @code{TREE_TYPE}. @code{TREE_FIXED_CST_PTR} points to -a @code{struct fixed_value}; @code{TREE_FIXED_CST} returns the structure -itself. @code{struct fixed_value} contains @code{data} with the size of two -@code{HOST_BITS_PER_WIDE_INT} and @code{mode} as the associated fixed-point -machine mode for @code{data}. - -@item COMPLEX_CST -These nodes are used to represent complex number constants, that is a -@code{__complex__} whose parts are constant nodes. The -@code{TREE_REALPART} and @code{TREE_IMAGPART} return the real and the -imaginary parts respectively. - -@item VECTOR_CST -These nodes are used to represent vector constants, whose parts are -constant nodes. Each individual constant node is either an integer or a -double constant node. The first operand is a @code{TREE_LIST} of the -constant nodes and is accessed through @code{TREE_VECTOR_CST_ELTS}. - -@item STRING_CST -These nodes represent string-constants. The @code{TREE_STRING_LENGTH} -returns the length of the string, as an @code{int}. The -@code{TREE_STRING_POINTER} is a @code{char*} containing the string -itself. The string may not be @code{NUL}-terminated, and it may contain -embedded @code{NUL} characters. Therefore, the -@code{TREE_STRING_LENGTH} includes the trailing @code{NUL} if it is -present. - -For wide string constants, the @code{TREE_STRING_LENGTH} is the number -of bytes in the string, and the @code{TREE_STRING_POINTER} -points to an array of the bytes of the string, as represented on the -target system (that is, as integers in the target endianness). Wide and -non-wide string constants are distinguished only by the @code{TREE_TYPE} -of the @code{STRING_CST}. - -FIXME: The formats of string constants are not well-defined when the -target system bytes are not the same width as host system bytes. - -@end table - -@node Storage References -@subsection References to storage -@tindex ADDR_EXPR -@tindex INDIRECT_REF -@tindex MEM_REF -@tindex ARRAY_REF -@tindex ARRAY_RANGE_REF -@tindex TARGET_MEM_REF -@tindex COMPONENT_REF - -@table @code -@item ARRAY_REF -These nodes represent array accesses. The first operand is the array; -the second is the index. To calculate the address of the memory -accessed, you must scale the index by the size of the type of the array -elements. The type of these expressions must be the type of a component of -the array. The third and fourth operands are used after gimplification -to represent the lower bound and component size but should not be used -directly; call @code{array_ref_low_bound} and @code{array_ref_element_size} -instead. - -@item ARRAY_RANGE_REF -These nodes represent access to a range (or ``slice'') of an array. The -operands are the same as that for @code{ARRAY_REF} and have the same -meanings. The type of these expressions must be an array whose component -type is the same as that of the first operand. The range of that array -type determines the amount of data these expressions access. - -@item TARGET_MEM_REF -These nodes represent memory accesses whose address directly map to -an addressing mode of the target architecture. The first argument -is @code{TMR_SYMBOL} and must be a @code{VAR_DECL} of an object with -a fixed address. The second argument is @code{TMR_BASE} and the -third one is @code{TMR_INDEX}. The fourth argument is -@code{TMR_STEP} and must be an @code{INTEGER_CST}. The fifth -argument is @code{TMR_OFFSET} and must be an @code{INTEGER_CST}. -Any of the arguments may be NULL if the appropriate component -does not appear in the address. Address of the @code{TARGET_MEM_REF} -is determined in the following way. - -@smallexample -&TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET -@end smallexample - -The sixth argument is the reference to the original memory access, which -is preserved for the purposes of the RTL alias analysis. The seventh -argument is a tag representing the results of tree level alias analysis. - -@item ADDR_EXPR -These nodes are used to represent the address of an object. (These -expressions will always have pointer or reference type.) The operand may -be another expression, or it may be a declaration. - -As an extension, GCC allows users to take the address of a label. In -this case, the operand of the @code{ADDR_EXPR} will be a -@code{LABEL_DECL}. The type of such an expression is @code{void*}. - -If the object addressed is not an lvalue, a temporary is created, and -the address of the temporary is used. - -@item INDIRECT_REF -These nodes are used to represent the object pointed to by a pointer. -The operand is the pointer being dereferenced; it will always have -pointer or reference type. - -@item MEM_REF -These nodes are used to represent the object pointed to by a pointer -offset by a constant. -The first operand is the pointer being dereferenced; it will always have -pointer or reference type. The second operand is a pointer constant. -Its type is specifying the type to be used for type-based alias analysis. - -@item COMPONENT_REF -These nodes represent non-static data member accesses. The first -operand is the object (rather than a pointer to it); the second operand -is the @code{FIELD_DECL} for the data member. The third operand represents -the byte offset of the field, but should not be used directly; call -@code{component_ref_field_offset} instead. - - -@end table - -@node Unary and Binary Expressions -@subsection Unary and Binary Expressions -@tindex NEGATE_EXPR -@tindex ABS_EXPR -@tindex BIT_NOT_EXPR -@tindex TRUTH_NOT_EXPR -@tindex PREDECREMENT_EXPR -@tindex PREINCREMENT_EXPR -@tindex POSTDECREMENT_EXPR -@tindex POSTINCREMENT_EXPR -@tindex FIX_TRUNC_EXPR -@tindex FLOAT_EXPR -@tindex COMPLEX_EXPR -@tindex CONJ_EXPR -@tindex REALPART_EXPR -@tindex IMAGPART_EXPR -@tindex NON_LVALUE_EXPR -@tindex NOP_EXPR -@tindex CONVERT_EXPR -@tindex FIXED_CONVERT_EXPR -@tindex THROW_EXPR -@tindex LSHIFT_EXPR -@tindex RSHIFT_EXPR -@tindex BIT_IOR_EXPR -@tindex BIT_XOR_EXPR -@tindex BIT_AND_EXPR -@tindex TRUTH_ANDIF_EXPR -@tindex TRUTH_ORIF_EXPR -@tindex TRUTH_AND_EXPR -@tindex TRUTH_OR_EXPR -@tindex TRUTH_XOR_EXPR -@tindex POINTER_PLUS_EXPR -@tindex PLUS_EXPR -@tindex MINUS_EXPR -@tindex MULT_EXPR -@tindex MULT_HIGHPART_EXPR -@tindex RDIV_EXPR -@tindex TRUNC_DIV_EXPR -@tindex FLOOR_DIV_EXPR -@tindex CEIL_DIV_EXPR -@tindex ROUND_DIV_EXPR -@tindex TRUNC_MOD_EXPR -@tindex FLOOR_MOD_EXPR -@tindex CEIL_MOD_EXPR -@tindex ROUND_MOD_EXPR -@tindex EXACT_DIV_EXPR -@tindex LT_EXPR -@tindex LE_EXPR -@tindex GT_EXPR -@tindex GE_EXPR -@tindex EQ_EXPR -@tindex NE_EXPR -@tindex ORDERED_EXPR -@tindex UNORDERED_EXPR -@tindex UNLT_EXPR -@tindex UNLE_EXPR -@tindex UNGT_EXPR -@tindex UNGE_EXPR -@tindex UNEQ_EXPR -@tindex LTGT_EXPR -@tindex MODIFY_EXPR -@tindex INIT_EXPR -@tindex COMPOUND_EXPR -@tindex COND_EXPR -@tindex CALL_EXPR -@tindex STMT_EXPR -@tindex BIND_EXPR -@tindex LOOP_EXPR -@tindex EXIT_EXPR -@tindex CLEANUP_POINT_EXPR -@tindex CONSTRUCTOR -@tindex COMPOUND_LITERAL_EXPR -@tindex SAVE_EXPR -@tindex TARGET_EXPR -@tindex VA_ARG_EXPR -@tindex ANNOTATE_EXPR - -@table @code -@item NEGATE_EXPR -These nodes represent unary negation of the single operand, for both -integer and floating-point types. The type of negation can be -determined by looking at the type of the expression. - -The behavior of this operation on signed arithmetic overflow is -controlled by the @code{flag_wrapv} and @code{flag_trapv} variables. - -@item ABS_EXPR -These nodes represent the absolute value of the single operand, for -both integer and floating-point types. This is typically used to -implement the @code{abs}, @code{labs} and @code{llabs} builtins for -integer types, and the @code{fabs}, @code{fabsf} and @code{fabsl} -builtins for floating point types. The type of abs operation can -be determined by looking at the type of the expression. - -This node is not used for complex types. To represent the modulus -or complex abs of a complex value, use the @code{BUILT_IN_CABS}, -@code{BUILT_IN_CABSF} or @code{BUILT_IN_CABSL} builtins, as used -to implement the C99 @code{cabs}, @code{cabsf} and @code{cabsl} -built-in functions. - -@item BIT_NOT_EXPR -These nodes represent bitwise complement, and will always have integral -type. The only operand is the value to be complemented. - -@item TRUTH_NOT_EXPR -These nodes represent logical negation, and will always have integral -(or boolean) type. The operand is the value being negated. The type -of the operand and that of the result are always of @code{BOOLEAN_TYPE} -or @code{INTEGER_TYPE}. - -@item PREDECREMENT_EXPR -@itemx PREINCREMENT_EXPR -@itemx POSTDECREMENT_EXPR -@itemx POSTINCREMENT_EXPR -These nodes represent increment and decrement expressions. The value of -the single operand is computed, and the operand incremented or -decremented. In the case of @code{PREDECREMENT_EXPR} and -@code{PREINCREMENT_EXPR}, the value of the expression is the value -resulting after the increment or decrement; in the case of -@code{POSTDECREMENT_EXPR} and @code{POSTINCREMENT_EXPR} is the value -before the increment or decrement occurs. The type of the operand, like -that of the result, will be either integral, boolean, or floating-point. - -@item FIX_TRUNC_EXPR -These nodes represent conversion of a floating-point value to an -integer. The single operand will have a floating-point type, while -the complete expression will have an integral (or boolean) type. The -operand is rounded towards zero. - -@item FLOAT_EXPR -These nodes represent conversion of an integral (or boolean) value to a -floating-point value. The single operand will have integral type, while -the complete expression will have a floating-point type. - -FIXME: How is the operand supposed to be rounded? Is this dependent on -@option{-mieee}? - -@item COMPLEX_EXPR -These nodes are used to represent complex numbers constructed from two -expressions of the same (integer or real) type. The first operand is the -real part and the second operand is the imaginary part. - -@item CONJ_EXPR -These nodes represent the conjugate of their operand. - -@item REALPART_EXPR -@itemx IMAGPART_EXPR -These nodes represent respectively the real and the imaginary parts -of complex numbers (their sole argument). - -@item NON_LVALUE_EXPR -These nodes indicate that their one and only operand is not an lvalue. -A back end can treat these identically to the single operand. - -@item NOP_EXPR -These nodes are used to represent conversions that do not require any -code-generation. For example, conversion of a @code{char*} to an -@code{int*} does not require any code be generated; such a conversion is -represented by a @code{NOP_EXPR}. The single operand is the expression -to be converted. The conversion from a pointer to a reference is also -represented with a @code{NOP_EXPR}. - -@item CONVERT_EXPR -These nodes are similar to @code{NOP_EXPR}s, but are used in those -situations where code may need to be generated. For example, if an -@code{int*} is converted to an @code{int} code may need to be generated -on some platforms. These nodes are never used for C++-specific -conversions, like conversions between pointers to different classes in -an inheritance hierarchy. Any adjustments that need to be made in such -cases are always indicated explicitly. Similarly, a user-defined -conversion is never represented by a @code{CONVERT_EXPR}; instead, the -function calls are made explicit. - -@item FIXED_CONVERT_EXPR -These nodes are used to represent conversions that involve fixed-point -values. For example, from a fixed-point value to another fixed-point value, -from an integer to a fixed-point value, from a fixed-point value to an -integer, from a floating-point value to a fixed-point value, or from -a fixed-point value to a floating-point value. - -@item LSHIFT_EXPR -@itemx RSHIFT_EXPR -These nodes represent left and right shifts, respectively. The first -operand is the value to shift; it will always be of integral type. The -second operand is an expression for the number of bits by which to -shift. Right shift should be treated as arithmetic, i.e., the -high-order bits should be zero-filled when the expression has unsigned -type and filled with the sign bit when the expression has signed type. -Note that the result is undefined if the second operand is larger -than or equal to the first operand's type size. Unlike most nodes, these -can have a vector as first operand and a scalar as second operand. - - -@item BIT_IOR_EXPR -@itemx BIT_XOR_EXPR -@itemx BIT_AND_EXPR -These nodes represent bitwise inclusive or, bitwise exclusive or, and -bitwise and, respectively. Both operands will always have integral -type. - -@item TRUTH_ANDIF_EXPR -@itemx TRUTH_ORIF_EXPR -These nodes represent logical ``and'' and logical ``or'', respectively. -These operators are not strict; i.e., the second operand is evaluated -only if the value of the expression is not determined by evaluation of -the first operand. The type of the operands and that of the result are -always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}. - -@item TRUTH_AND_EXPR -@itemx TRUTH_OR_EXPR -@itemx TRUTH_XOR_EXPR -These nodes represent logical and, logical or, and logical exclusive or. -They are strict; both arguments are always evaluated. There are no -corresponding operators in C or C++, but the front end will sometimes -generate these expressions anyhow, if it can tell that strictness does -not matter. The type of the operands and that of the result are -always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}. - -@item POINTER_PLUS_EXPR -This node represents pointer arithmetic. The first operand is always -a pointer/reference type. The second operand is always an unsigned -integer type compatible with sizetype. This is the only binary -arithmetic operand that can operate on pointer types. - -@item PLUS_EXPR -@itemx MINUS_EXPR -@itemx MULT_EXPR -These nodes represent various binary arithmetic operations. -Respectively, these operations are addition, subtraction (of the second -operand from the first) and multiplication. Their operands may have -either integral or floating type, but there will never be case in which -one operand is of floating type and the other is of integral type. - -The behavior of these operations on signed arithmetic overflow is -controlled by the @code{flag_wrapv} and @code{flag_trapv} variables. - -@item MULT_HIGHPART_EXPR -This node represents the ``high-part'' of a widening multiplication. -For an integral type with @var{b} bits of precision, the result is -the most significant @var{b} bits of the full @math{2@var{b}} product. - -@item RDIV_EXPR -This node represents a floating point division operation. - -@item TRUNC_DIV_EXPR -@itemx FLOOR_DIV_EXPR -@itemx CEIL_DIV_EXPR -@itemx ROUND_DIV_EXPR -These nodes represent integer division operations that return an integer -result. @code{TRUNC_DIV_EXPR} rounds towards zero, @code{FLOOR_DIV_EXPR} -rounds towards negative infinity, @code{CEIL_DIV_EXPR} rounds towards -positive infinity and @code{ROUND_DIV_EXPR} rounds to the closest integer. -Integer division in C and C++ is truncating, i.e.@: @code{TRUNC_DIV_EXPR}. - -The behavior of these operations on signed arithmetic overflow, when -dividing the minimum signed integer by minus one, is controlled by the -@code{flag_wrapv} and @code{flag_trapv} variables. - -@item TRUNC_MOD_EXPR -@itemx FLOOR_MOD_EXPR -@itemx CEIL_MOD_EXPR -@itemx ROUND_MOD_EXPR -These nodes represent the integer remainder or modulus operation. -The integer modulus of two operands @code{a} and @code{b} is -defined as @code{a - (a/b)*b} where the division calculated using -the corresponding division operator. Hence for @code{TRUNC_MOD_EXPR} -this definition assumes division using truncation towards zero, i.e.@: -@code{TRUNC_DIV_EXPR}. Integer remainder in C and C++ uses truncating -division, i.e.@: @code{TRUNC_MOD_EXPR}. - -@item EXACT_DIV_EXPR -The @code{EXACT_DIV_EXPR} code is used to represent integer divisions where -the numerator is known to be an exact multiple of the denominator. This -allows the backend to choose between the faster of @code{TRUNC_DIV_EXPR}, -@code{CEIL_DIV_EXPR} and @code{FLOOR_DIV_EXPR} for the current target. - -@item LT_EXPR -@itemx LE_EXPR -@itemx GT_EXPR -@itemx GE_EXPR -@itemx EQ_EXPR -@itemx NE_EXPR -These nodes represent the less than, less than or equal to, greater -than, greater than or equal to, equal, and not equal comparison -operators. The first and second operands will either be both of integral -type, both of floating type or both of vector type. The result type of -these expressions will always be of integral, boolean or signed integral -vector type. These operations return the result type's zero value for -false, the result type's one value for true, and a vector whose elements -are zero (false) or minus one (true) for vectors. - -For floating point comparisons, if we honor IEEE NaNs and either operand -is NaN, then @code{NE_EXPR} always returns true and the remaining operators -always return false. On some targets, comparisons against an IEEE NaN, -other than equality and inequality, may generate a floating point exception. - -@item ORDERED_EXPR -@itemx UNORDERED_EXPR -These nodes represent non-trapping ordered and unordered comparison -operators. These operations take two floating point operands and -determine whether they are ordered or unordered relative to each other. -If either operand is an IEEE NaN, their comparison is defined to be -unordered, otherwise the comparison is defined to be ordered. The -result type of these expressions will always be of integral or boolean -type. These operations return the result type's zero value for false, -and the result type's one value for true. - -@item UNLT_EXPR -@itemx UNLE_EXPR -@itemx UNGT_EXPR -@itemx UNGE_EXPR -@itemx UNEQ_EXPR -@itemx LTGT_EXPR -These nodes represent the unordered comparison operators. -These operations take two floating point operands and determine whether -the operands are unordered or are less than, less than or equal to, -greater than, greater than or equal to, or equal respectively. For -example, @code{UNLT_EXPR} returns true if either operand is an IEEE -NaN or the first operand is less than the second. With the possible -exception of @code{LTGT_EXPR}, all of these operations are guaranteed -not to generate a floating point exception. The result -type of these expressions will always be of integral or boolean type. -These operations return the result type's zero value for false, -and the result type's one value for true. - -@item MODIFY_EXPR -These nodes represent assignment. The left-hand side is the first -operand; the right-hand side is the second operand. The left-hand side -will be a @code{VAR_DECL}, @code{INDIRECT_REF}, @code{COMPONENT_REF}, or -other lvalue. - -These nodes are used to represent not only assignment with @samp{=} but -also compound assignments (like @samp{+=}), by reduction to @samp{=} -assignment. In other words, the representation for @samp{i += 3} looks -just like that for @samp{i = i + 3}. - -@item INIT_EXPR -These nodes are just like @code{MODIFY_EXPR}, but are used only when a -variable is initialized, rather than assigned to subsequently. This -means that we can assume that the target of the initialization is not -used in computing its own value; any reference to the lhs in computing -the rhs is undefined. - -@item COMPOUND_EXPR -These nodes represent comma-expressions. The first operand is an -expression whose value is computed and thrown away prior to the -evaluation of the second operand. The value of the entire expression is -the value of the second operand. - -@item COND_EXPR -These nodes represent @code{?:} expressions. The first operand -is of boolean or integral type. If it evaluates to a nonzero value, -the second operand should be evaluated, and returned as the value of the -expression. Otherwise, the third operand is evaluated, and returned as -the value of the expression. - -The second operand must have the same type as the entire expression, -unless it unconditionally throws an exception or calls a noreturn -function, in which case it should have void type. The same constraints -apply to the third operand. This allows array bounds checks to be -represented conveniently as @code{(i >= 0 && i < 10) ? i : abort()}. - -As a GNU extension, the C language front-ends allow the second -operand of the @code{?:} operator may be omitted in the source. -For example, @code{x ? : 3} is equivalent to @code{x ? x : 3}, -assuming that @code{x} is an expression without side-effects. -In the tree representation, however, the second operand is always -present, possibly protected by @code{SAVE_EXPR} if the first -argument does cause side-effects. - -@item CALL_EXPR -These nodes are used to represent calls to functions, including -non-static member functions. @code{CALL_EXPR}s are implemented as -expression nodes with a variable number of operands. Rather than using -@code{TREE_OPERAND} to extract them, it is preferable to use the -specialized accessor macros and functions that operate specifically on -@code{CALL_EXPR} nodes. - -@code{CALL_EXPR_FN} returns a pointer to the -function to call; it is always an expression whose type is a -@code{POINTER_TYPE}. - -The number of arguments to the call is returned by @code{call_expr_nargs}, -while the arguments themselves can be accessed with the @code{CALL_EXPR_ARG} -macro. The arguments are zero-indexed and numbered left-to-right. -You can iterate over the arguments using @code{FOR_EACH_CALL_EXPR_ARG}, as in: - -@smallexample -tree call, arg; -call_expr_arg_iterator iter; -FOR_EACH_CALL_EXPR_ARG (arg, iter, call) - /* arg is bound to successive arguments of call. */ - @dots{}; -@end smallexample - -For non-static -member functions, there will be an operand corresponding to the -@code{this} pointer. There will always be expressions corresponding to -all of the arguments, even if the function is declared with default -arguments and some arguments are not explicitly provided at the call -sites. - -@code{CALL_EXPR}s also have a @code{CALL_EXPR_STATIC_CHAIN} operand that -is used to implement nested functions. This operand is otherwise null. - -@item CLEANUP_POINT_EXPR -These nodes represent full-expressions. The single operand is an -expression to evaluate. Any destructor calls engendered by the creation -of temporaries during the evaluation of that expression should be -performed immediately after the expression is evaluated. - -@item CONSTRUCTOR -These nodes represent the brace-enclosed initializers for a structure or an -array. They contain a sequence of component values made out of a vector of -constructor_elt, which is a (@code{INDEX}, @code{VALUE}) pair. - -If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is a @code{RECORD_TYPE}, -@code{UNION_TYPE} or @code{QUAL_UNION_TYPE} then the @code{INDEX} of each -node in the sequence will be a @code{FIELD_DECL} and the @code{VALUE} will -be the expression used to initialize that field. - -If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is an @code{ARRAY_TYPE}, -then the @code{INDEX} of each node in the sequence will be an -@code{INTEGER_CST} or a @code{RANGE_EXPR} of two @code{INTEGER_CST}s. -A single @code{INTEGER_CST} indicates which element of the array is being -assigned to. A @code{RANGE_EXPR} indicates an inclusive range of elements -to initialize. In both cases the @code{VALUE} is the corresponding -initializer. It is re-evaluated for each element of a -@code{RANGE_EXPR}. If the @code{INDEX} is @code{NULL_TREE}, then -the initializer is for the next available array element. - -In the front end, you should not depend on the fields appearing in any -particular order. However, in the middle end, fields must appear in -declaration order. You should not assume that all fields will be -represented. Unrepresented fields will be cleared (zeroed), unless the -CONSTRUCTOR_NO_CLEARING flag is set, in which case their value becomes -undefined. - -@item COMPOUND_LITERAL_EXPR -@findex COMPOUND_LITERAL_EXPR_DECL_EXPR -@findex COMPOUND_LITERAL_EXPR_DECL -These nodes represent ISO C99 compound literals. The -@code{COMPOUND_LITERAL_EXPR_DECL_EXPR} is a @code{DECL_EXPR} -containing an anonymous @code{VAR_DECL} for -the unnamed object represented by the compound literal; the -@code{DECL_INITIAL} of that @code{VAR_DECL} is a @code{CONSTRUCTOR} -representing the brace-enclosed list of initializers in the compound -literal. That anonymous @code{VAR_DECL} can also be accessed directly -by the @code{COMPOUND_LITERAL_EXPR_DECL} macro. - -@item SAVE_EXPR - -A @code{SAVE_EXPR} represents an expression (possibly involving -side-effects) that is used more than once. The side-effects should -occur only the first time the expression is evaluated. Subsequent uses -should just reuse the computed value. The first operand to the -@code{SAVE_EXPR} is the expression to evaluate. The side-effects should -be executed where the @code{SAVE_EXPR} is first encountered in a -depth-first preorder traversal of the expression tree. - -@item TARGET_EXPR -A @code{TARGET_EXPR} represents a temporary object. The first operand -is a @code{VAR_DECL} for the temporary variable. The second operand is -the initializer for the temporary. The initializer is evaluated and, -if non-void, copied (bitwise) into the temporary. If the initializer -is void, that means that it will perform the initialization itself. - -Often, a @code{TARGET_EXPR} occurs on the right-hand side of an -assignment, or as the second operand to a comma-expression which is -itself the right-hand side of an assignment, etc. In this case, we say -that the @code{TARGET_EXPR} is ``normal''; otherwise, we say it is -``orphaned''. For a normal @code{TARGET_EXPR} the temporary variable -should be treated as an alias for the left-hand side of the assignment, -rather than as a new temporary variable. - -The third operand to the @code{TARGET_EXPR}, if present, is a -cleanup-expression (i.e., destructor call) for the temporary. If this -expression is orphaned, then this expression must be executed when the -statement containing this expression is complete. These cleanups must -always be executed in the order opposite to that in which they were -encountered. Note that if a temporary is created on one branch of a -conditional operator (i.e., in the second or third operand to a -@code{COND_EXPR}), the cleanup must be run only if that branch is -actually executed. - -@item VA_ARG_EXPR -This node is used to implement support for the C/C++ variable argument-list -mechanism. It represents expressions like @code{va_arg (ap, type)}. -Its @code{TREE_TYPE} yields the tree representation for @code{type} and -its sole argument yields the representation for @code{ap}. - -@item ANNOTATE_EXPR -This node is used to attach markers to an expression. The first operand -is the annotated expression, the second is an @code{INTEGER_CST} with -a value from @code{enum annot_expr_kind}. -@end table - - -@node Vectors -@subsection Vectors -@tindex VEC_LSHIFT_EXPR -@tindex VEC_RSHIFT_EXPR -@tindex VEC_WIDEN_MULT_HI_EXPR -@tindex VEC_WIDEN_MULT_LO_EXPR -@tindex VEC_UNPACK_HI_EXPR -@tindex VEC_UNPACK_LO_EXPR -@tindex VEC_UNPACK_FLOAT_HI_EXPR -@tindex VEC_UNPACK_FLOAT_LO_EXPR -@tindex VEC_PACK_TRUNC_EXPR -@tindex VEC_PACK_SAT_EXPR -@tindex VEC_PACK_FIX_TRUNC_EXPR -@tindex SAD_EXPR - -@table @code -@item VEC_LSHIFT_EXPR -@itemx VEC_RSHIFT_EXPR -These nodes represent whole vector left and right shifts, respectively. -The first operand is the vector to shift; it will always be of vector type. -The second operand is an expression for the number of bits by which to -shift. Note that the result is undefined if the second operand is larger -than or equal to the first operand's type size. - -@item VEC_WIDEN_MULT_HI_EXPR -@itemx VEC_WIDEN_MULT_LO_EXPR -These nodes represent widening vector multiplication of the high and low -parts of the two input vectors, respectively. Their operands are vectors -that contain the same number of elements (@code{N}) of the same integral type. -The result is a vector that contains half as many elements, of an integral type -whose size is twice as wide. In the case of @code{VEC_WIDEN_MULT_HI_EXPR} the -high @code{N/2} elements of the two vector are multiplied to produce the -vector of @code{N/2} products. In the case of @code{VEC_WIDEN_MULT_LO_EXPR} the -low @code{N/2} elements of the two vector are multiplied to produce the -vector of @code{N/2} products. - -@item VEC_UNPACK_HI_EXPR -@itemx VEC_UNPACK_LO_EXPR -These nodes represent unpacking of the high and low parts of the input vector, -respectively. The single operand is a vector that contains @code{N} elements -of the same integral or floating point type. The result is a vector -that contains half as many elements, of an integral or floating point type -whose size is twice as wide. In the case of @code{VEC_UNPACK_HI_EXPR} the -high @code{N/2} elements of the vector are extracted and widened (promoted). -In the case of @code{VEC_UNPACK_LO_EXPR} the low @code{N/2} elements of the -vector are extracted and widened (promoted). - -@item VEC_UNPACK_FLOAT_HI_EXPR -@itemx VEC_UNPACK_FLOAT_LO_EXPR -These nodes represent unpacking of the high and low parts of the input vector, -where the values are converted from fixed point to floating point. The -single operand is a vector that contains @code{N} elements of the same -integral type. The result is a vector that contains half as many elements -of a floating point type whose size is twice as wide. In the case of -@code{VEC_UNPACK_HI_EXPR} the high @code{N/2} elements of the vector are -extracted, converted and widened. In the case of @code{VEC_UNPACK_LO_EXPR} -the low @code{N/2} elements of the vector are extracted, converted and widened. - -@item VEC_PACK_TRUNC_EXPR -This node represents packing of truncated elements of the two input vectors -into the output vector. Input operands are vectors that contain the same -number of elements of the same integral or floating point type. The result -is a vector that contains twice as many elements of an integral or floating -point type whose size is half as wide. The elements of the two vectors are -demoted and merged (concatenated) to form the output vector. - -@item VEC_PACK_SAT_EXPR -This node represents packing of elements of the two input vectors into the -output vector using saturation. Input operands are vectors that contain -the same number of elements of the same integral type. The result is a -vector that contains twice as many elements of an integral type whose size -is half as wide. The elements of the two vectors are demoted and merged -(concatenated) to form the output vector. - -@item VEC_PACK_FIX_TRUNC_EXPR -This node represents packing of elements of the two input vectors into the -output vector, where the values are converted from floating point -to fixed point. Input operands are vectors that contain the same number -of elements of a floating point type. The result is a vector that contains -twice as many elements of an integral type whose size is half as wide. The -elements of the two vectors are merged (concatenated) to form the output -vector. - -@item VEC_COND_EXPR -These nodes represent @code{?:} expressions. The three operands must be -vectors of the same size and number of elements. The second and third -operands must have the same type as the entire expression. The first -operand is of signed integral vector type. If an element of the first -operand evaluates to a zero value, the corresponding element of the -result is taken from the third operand. If it evaluates to a minus one -value, it is taken from the second operand. It should never evaluate to -any other value currently, but optimizations should not rely on that -property. In contrast with a @code{COND_EXPR}, all operands are always -evaluated. - -@item SAD_EXPR -This node represents the Sum of Absolute Differences operation. The three -operands must be vectors of integral types. The first and second operand -must have the same type. The size of the vector element of the third -operand must be at lease twice of the size of the vector element of the -first and second one. The SAD is calculated between the first and second -operands, added to the third operand, and returned. - -@end table - - -@c --------------------------------------------------------------------- -@c Statements -@c --------------------------------------------------------------------- - -@node Statements -@section Statements -@cindex Statements - -Most statements in GIMPLE are assignment statements, represented by -@code{GIMPLE_ASSIGN}. No other C expressions can appear at statement level; -a reference to a volatile object is converted into a -@code{GIMPLE_ASSIGN}. - -There are also several varieties of complex statements. - -@menu -* Basic Statements:: -* Blocks:: -* Statement Sequences:: -* Empty Statements:: -* Jumps:: -* Cleanups:: -* OpenMP:: -* OpenACC:: -@end menu - -@node Basic Statements -@subsection Basic Statements -@cindex Basic Statements - -@table @code -@item ASM_EXPR - -Used to represent an inline assembly statement. For an inline assembly -statement like: -@smallexample -asm ("mov x, y"); -@end smallexample -The @code{ASM_STRING} macro will return a @code{STRING_CST} node for -@code{"mov x, y"}. If the original statement made use of the -extended-assembly syntax, then @code{ASM_OUTPUTS}, -@code{ASM_INPUTS}, and @code{ASM_CLOBBERS} will be the outputs, inputs, -and clobbers for the statement, represented as @code{STRING_CST} nodes. -The extended-assembly syntax looks like: -@smallexample -asm ("fsinx %1,%0" : "=f" (result) : "f" (angle)); -@end smallexample -The first string is the @code{ASM_STRING}, containing the instruction -template. The next two strings are the output and inputs, respectively; -this statement has no clobbers. As this example indicates, ``plain'' -assembly statements are merely a special case of extended assembly -statements; they have no cv-qualifiers, outputs, inputs, or clobbers. -All of the strings will be @code{NUL}-terminated, and will contain no -embedded @code{NUL}-characters. - -If the assembly statement is declared @code{volatile}, or if the -statement was not an extended assembly statement, and is therefore -implicitly volatile, then the predicate @code{ASM_VOLATILE_P} will hold -of the @code{ASM_EXPR}. - -@item DECL_EXPR - -Used to represent a local declaration. The @code{DECL_EXPR_DECL} macro -can be used to obtain the entity declared. This declaration may be a -@code{LABEL_DECL}, indicating that the label declared is a local label. -(As an extension, GCC allows the declaration of labels with scope.) In -C, this declaration may be a @code{FUNCTION_DECL}, indicating the -use of the GCC nested function extension. For more information, -@pxref{Functions}. - -@item LABEL_EXPR - -Used to represent a label. The @code{LABEL_DECL} declared by this -statement can be obtained with the @code{LABEL_EXPR_LABEL} macro. The -@code{IDENTIFIER_NODE} giving the name of the label can be obtained from -the @code{LABEL_DECL} with @code{DECL_NAME}. - -@item GOTO_EXPR - -Used to represent a @code{goto} statement. The @code{GOTO_DESTINATION} will -usually be a @code{LABEL_DECL}. However, if the ``computed goto'' extension -has been used, the @code{GOTO_DESTINATION} will be an arbitrary expression -indicating the destination. This expression will always have pointer type. - -@item RETURN_EXPR - -Used to represent a @code{return} statement. Operand 0 represents the -value to return. It should either be the @code{RESULT_DECL} for the -containing function, or a @code{MODIFY_EXPR} or @code{INIT_EXPR} -setting the function's @code{RESULT_DECL}. It will be -@code{NULL_TREE} if the statement was just -@smallexample -return; -@end smallexample - -@item LOOP_EXPR -These nodes represent ``infinite'' loops. The @code{LOOP_EXPR_BODY} -represents the body of the loop. It should be executed forever, unless -an @code{EXIT_EXPR} is encountered. - -@item EXIT_EXPR -These nodes represent conditional exits from the nearest enclosing -@code{LOOP_EXPR}. The single operand is the condition; if it is -nonzero, then the loop should be exited. An @code{EXIT_EXPR} will only -appear within a @code{LOOP_EXPR}. - -@item SWITCH_STMT - -Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND} -is the expression on which the switch is occurring. See the documentation -for an @code{IF_STMT} for more information on the representation used -for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch -statement. The @code{SWITCH_STMT_TYPE} is the original type of switch -expression as given in the source, before any compiler conversions. - -@item CASE_LABEL_EXPR - -Use to represent a @code{case} label, range of @code{case} labels, or a -@code{default} label. If @code{CASE_LOW} is @code{NULL_TREE}, then this is a -@code{default} label. Otherwise, if @code{CASE_HIGH} is @code{NULL_TREE}, then -this is an ordinary @code{case} label. In this case, @code{CASE_LOW} is -an expression giving the value of the label. Both @code{CASE_LOW} and -@code{CASE_HIGH} are @code{INTEGER_CST} nodes. These values will have -the same type as the condition expression in the switch statement. - -Otherwise, if both @code{CASE_LOW} and @code{CASE_HIGH} are defined, the -statement is a range of case labels. Such statements originate with the -extension that allows users to write things of the form: -@smallexample -case 2 ... 5: -@end smallexample -The first value will be @code{CASE_LOW}, while the second will be -@code{CASE_HIGH}. - -@end table - - -@node Blocks -@subsection Blocks -@cindex Blocks - -Block scopes and the variables they declare in GENERIC are -expressed using the @code{BIND_EXPR} code, which in previous -versions of GCC was primarily used for the C statement-expression -extension. - -Variables in a block are collected into @code{BIND_EXPR_VARS} in -declaration order through their @code{TREE_CHAIN} field. Any runtime -initialization is moved out of @code{DECL_INITIAL} and into a -statement in the controlled block. When gimplifying from C or C++, -this initialization replaces the @code{DECL_STMT}. These variables -will never require cleanups. The scope of these variables is just the -body - -Variable-length arrays (VLAs) complicate this process, as their -size often refers to variables initialized earlier in the block. -To handle this, we currently split the block at that point, and -move the VLA into a new, inner @code{BIND_EXPR}. This strategy -may change in the future. - -A C++ program will usually contain more @code{BIND_EXPR}s than -there are syntactic blocks in the source code, since several C++ -constructs have implicit scopes associated with them. On the -other hand, although the C++ front end uses pseudo-scopes to -handle cleanups for objects with destructors, these don't -translate into the GIMPLE form; multiple declarations at the same -level use the same @code{BIND_EXPR}. - -@node Statement Sequences -@subsection Statement Sequences -@cindex Statement Sequences - -Multiple statements at the same nesting level are collected into -a @code{STATEMENT_LIST}. Statement lists are modified and -traversed using the interface in @samp{tree-iterator.h}. - -@node Empty Statements -@subsection Empty Statements -@cindex Empty Statements - -Whenever possible, statements with no effect are discarded. But -if they are nested within another construct which cannot be -discarded for some reason, they are instead replaced with an -empty statement, generated by @code{build_empty_stmt}. -Initially, all empty statements were shared, after the pattern of -the Java front end, but this caused a lot of trouble in practice. - -An empty statement is represented as @code{(void)0}. - -@node Jumps -@subsection Jumps -@cindex Jumps - -Other jumps are expressed by either @code{GOTO_EXPR} or -@code{RETURN_EXPR}. - -The operand of a @code{GOTO_EXPR} must be either a label or a -variable containing the address to jump to. - -The operand of a @code{RETURN_EXPR} is either @code{NULL_TREE}, -@code{RESULT_DECL}, or a @code{MODIFY_EXPR} which sets the return -value. It would be nice to move the @code{MODIFY_EXPR} into a -separate statement, but the special return semantics in -@code{expand_return} make that difficult. It may still happen in -the future, perhaps by moving most of that logic into -@code{expand_assignment}. - -@node Cleanups -@subsection Cleanups -@cindex Cleanups - -Destructors for local C++ objects and similar dynamic cleanups are -represented in GIMPLE by a @code{TRY_FINALLY_EXPR}. -@code{TRY_FINALLY_EXPR} has two operands, both of which are a sequence -of statements to execute. The first sequence is executed. When it -completes the second sequence is executed. - -The first sequence may complete in the following ways: - -@enumerate - -@item Execute the last statement in the sequence and fall off the -end. - -@item Execute a goto statement (@code{GOTO_EXPR}) to an ordinary -label outside the sequence. - -@item Execute a return statement (@code{RETURN_EXPR}). - -@item Throw an exception. This is currently not explicitly represented in -GIMPLE. - -@end enumerate - -The second sequence is not executed if the first sequence completes by -calling @code{setjmp} or @code{exit} or any other function that does -not return. The second sequence is also not executed if the first -sequence completes via a non-local goto or a computed goto (in general -the compiler does not know whether such a goto statement exits the -first sequence or not, so we assume that it doesn't). - -After the second sequence is executed, if it completes normally by -falling off the end, execution continues wherever the first sequence -would have continued, by falling off the end, or doing a goto, etc. - -@code{TRY_FINALLY_EXPR} complicates the flow graph, since the cleanup -needs to appear on every edge out of the controlled block; this -reduces the freedom to move code across these edges. Therefore, the -EH lowering pass which runs before most of the optimization passes -eliminates these expressions by explicitly adding the cleanup to each -edge. Rethrowing the exception is represented using @code{RESX_EXPR}. - -@node OpenMP -@subsection OpenMP -@tindex OMP_PARALLEL -@tindex OMP_FOR -@tindex OMP_SECTIONS -@tindex OMP_SINGLE -@tindex OMP_SECTION -@tindex OMP_MASTER -@tindex OMP_ORDERED -@tindex OMP_CRITICAL -@tindex OMP_RETURN -@tindex OMP_CONTINUE -@tindex OMP_ATOMIC -@tindex OMP_CLAUSE - -All the statements starting with @code{OMP_} represent directives and -clauses used by the OpenMP API @w{@uref{http://www.openmp.org/}}. - -@table @code -@item OMP_PARALLEL - -Represents @code{#pragma omp parallel [clause1 @dots{} clauseN]}. It -has four operands: - -Operand @code{OMP_PARALLEL_BODY} is valid while in GENERIC and -High GIMPLE forms. It contains the body of code to be executed -by all the threads. During GIMPLE lowering, this operand becomes -@code{NULL} and the body is emitted linearly after -@code{OMP_PARALLEL}. - -Operand @code{OMP_PARALLEL_CLAUSES} is the list of clauses -associated with the directive. - -Operand @code{OMP_PARALLEL_FN} is created by -@code{pass_lower_omp}, it contains the @code{FUNCTION_DECL} -for the function that will contain the body of the parallel -region. - -Operand @code{OMP_PARALLEL_DATA_ARG} is also created by -@code{pass_lower_omp}. If there are shared variables to be -communicated to the children threads, this operand will contain -the @code{VAR_DECL} that contains all the shared values and -variables. - -@item OMP_FOR - -Represents @code{#pragma omp for [clause1 @dots{} clauseN]}. It has -six operands: - -Operand @code{OMP_FOR_BODY} contains the loop body. - -Operand @code{OMP_FOR_CLAUSES} is the list of clauses -associated with the directive. - -Operand @code{OMP_FOR_INIT} is the loop initialization code of -the form @code{VAR = N1}. - -Operand @code{OMP_FOR_COND} is the loop conditional expression -of the form @code{VAR @{<,>,<=,>=@} N2}. - -Operand @code{OMP_FOR_INCR} is the loop index increment of the -form @code{VAR @{+=,-=@} INCR}. - -Operand @code{OMP_FOR_PRE_BODY} contains side-effect code from -operands @code{OMP_FOR_INIT}, @code{OMP_FOR_COND} and -@code{OMP_FOR_INC}. These side-effects are part of the -@code{OMP_FOR} block but must be evaluated before the start of -loop body. - -The loop index variable @code{VAR} must be a signed integer variable, -which is implicitly private to each thread. Bounds -@code{N1} and @code{N2} and the increment expression -@code{INCR} are required to be loop invariant integer -expressions that are evaluated without any synchronization. The -evaluation order, frequency of evaluation and side-effects are -unspecified by the standard. - -@item OMP_SECTIONS - -Represents @code{#pragma omp sections [clause1 @dots{} clauseN]}. - -Operand @code{OMP_SECTIONS_BODY} contains the sections body, -which in turn contains a set of @code{OMP_SECTION} nodes for -each of the concurrent sections delimited by @code{#pragma omp -section}. - -Operand @code{OMP_SECTIONS_CLAUSES} is the list of clauses -associated with the directive. - -@item OMP_SECTION - -Section delimiter for @code{OMP_SECTIONS}. - -@item OMP_SINGLE - -Represents @code{#pragma omp single}. - -Operand @code{OMP_SINGLE_BODY} contains the body of code to be -executed by a single thread. - -Operand @code{OMP_SINGLE_CLAUSES} is the list of clauses -associated with the directive. - -@item OMP_MASTER - -Represents @code{#pragma omp master}. - -Operand @code{OMP_MASTER_BODY} contains the body of code to be -executed by the master thread. - -@item OMP_ORDERED - -Represents @code{#pragma omp ordered}. - -Operand @code{OMP_ORDERED_BODY} contains the body of code to be -executed in the sequential order dictated by the loop index -variable. - -@item OMP_CRITICAL - -Represents @code{#pragma omp critical [name]}. - -Operand @code{OMP_CRITICAL_BODY} is the critical section. - -Operand @code{OMP_CRITICAL_NAME} is an optional identifier to -label the critical section. - -@item OMP_RETURN - -This does not represent any OpenMP directive, it is an artificial -marker to indicate the end of the body of an OpenMP@. It is used -by the flow graph (@code{tree-cfg.c}) and OpenMP region -building code (@code{omp-low.c}). - -@item OMP_CONTINUE - -Similarly, this instruction does not represent an OpenMP -directive, it is used by @code{OMP_FOR} (and similar codes) as well as -@code{OMP_SECTIONS} to mark the place where the code needs to -loop to the next iteration, or the next section, respectively. - -In some cases, @code{OMP_CONTINUE} is placed right before -@code{OMP_RETURN}. But if there are cleanups that need to -occur right after the looping body, it will be emitted between -@code{OMP_CONTINUE} and @code{OMP_RETURN}. - -@item OMP_ATOMIC - -Represents @code{#pragma omp atomic}. - -Operand 0 is the address at which the atomic operation is to be -performed. - -Operand 1 is the expression to evaluate. The gimplifier tries -three alternative code generation strategies. Whenever possible, -an atomic update built-in is used. If that fails, a -compare-and-swap loop is attempted. If that also fails, a -regular critical section around the expression is used. - -@item OMP_CLAUSE - -Represents clauses associated with one of the @code{OMP_} directives. -Clauses are represented by separate subcodes defined in -@file{tree.h}. Clauses codes can be one of: -@code{OMP_CLAUSE_PRIVATE}, @code{OMP_CLAUSE_SHARED}, -@code{OMP_CLAUSE_FIRSTPRIVATE}, -@code{OMP_CLAUSE_LASTPRIVATE}, @code{OMP_CLAUSE_COPYIN}, -@code{OMP_CLAUSE_COPYPRIVATE}, @code{OMP_CLAUSE_IF}, -@code{OMP_CLAUSE_NUM_THREADS}, @code{OMP_CLAUSE_SCHEDULE}, -@code{OMP_CLAUSE_NOWAIT}, @code{OMP_CLAUSE_ORDERED}, -@code{OMP_CLAUSE_DEFAULT}, @code{OMP_CLAUSE_REDUCTION}, -@code{OMP_CLAUSE_COLLAPSE}, @code{OMP_CLAUSE_UNTIED}, -@code{OMP_CLAUSE_FINAL}, and @code{OMP_CLAUSE_MERGEABLE}. Each code -represents the corresponding OpenMP clause. - -Clauses associated with the same directive are chained together -via @code{OMP_CLAUSE_CHAIN}. Those clauses that accept a list -of variables are restricted to exactly one, accessed with -@code{OMP_CLAUSE_VAR}. Therefore, multiple variables under the -same clause @code{C} need to be represented as multiple @code{C} clauses -chained together. This facilitates adding new clauses during -compilation. - -@end table - -@node OpenACC -@subsection OpenACC -@tindex OACC_CACHE -@tindex OACC_DATA -@tindex OACC_DECLARE -@tindex OACC_ENTER_DATA -@tindex OACC_EXIT_DATA -@tindex OACC_HOST_DATA -@tindex OACC_KERNELS -@tindex OACC_LOOP -@tindex OACC_PARALLEL -@tindex OACC_UPDATE - -All the statements starting with @code{OACC_} represent directives and -clauses used by the OpenACC API @w{@uref{http://www.openacc.org/}}. - -@table @code -@item OACC_CACHE - -Represents @code{#pragma acc cache (var @dots{})}. - -@item OACC_DATA - -Represents @code{#pragma acc data [clause1 @dots{} clauseN]}. - -@item OACC_DECLARE - -Represents @code{#pragma acc declare [clause1 @dots{} clauseN]}. - -@item OACC_ENTER_DATA - -Represents @code{#pragma acc enter data [clause1 @dots{} clauseN]}. - -@item OACC_EXIT_DATA - -Represents @code{#pragma acc exit data [clause1 @dots{} clauseN]}. - -@item OACC_HOST_DATA - -Represents @code{#pragma acc host_data [clause1 @dots{} clauseN]}. - -@item OACC_KERNELS - -Represents @code{#pragma acc kernels [clause1 @dots{} clauseN]}. - -@item OACC_LOOP - -Represents @code{#pragma acc loop [clause1 @dots{} clauseN]}. - -See the description of the @code{OMP_FOR} code. - -@item OACC_PARALLEL - -Represents @code{#pragma acc parallel [clause1 @dots{} clauseN]}. - -@item OACC_UPDATE - -Represents @code{#pragma acc update [clause1 @dots{} clauseN]}. - -@end table - -@c --------------------------------------------------------------------- -@c Functions -@c --------------------------------------------------------------------- - -@node Functions -@section Functions -@cindex function -@tindex FUNCTION_DECL - -A function is represented by a @code{FUNCTION_DECL} node. It stores -the basic pieces of the function such as body, parameters, and return -type as well as information on the surrounding context, visibility, -and linkage. - -@menu -* Function Basics:: Function names, body, and parameters. -* Function Properties:: Context, linkage, etc. -@end menu - -@c --------------------------------------------------------------------- -@c Function Basics -@c --------------------------------------------------------------------- - -@node Function Basics -@subsection Function Basics -@findex DECL_NAME -@findex DECL_ASSEMBLER_NAME -@findex TREE_PUBLIC -@findex DECL_ARTIFICIAL -@findex DECL_FUNCTION_SPECIFIC_TARGET -@findex DECL_FUNCTION_SPECIFIC_OPTIMIZATION - -A function has four core parts: the name, the parameters, the result, -and the body. The following macros and functions access these parts -of a @code{FUNCTION_DECL} as well as other basic features: -@ftable @code -@item DECL_NAME -This macro returns the unqualified name of the function, as an -@code{IDENTIFIER_NODE}. For an instantiation of a function template, -the @code{DECL_NAME} is the unqualified name of the template, not -something like @code{f}. The value of @code{DECL_NAME} is -undefined when used on a constructor, destructor, overloaded operator, -or type-conversion operator, or any function that is implicitly -generated by the compiler. See below for macros that can be used to -distinguish these cases. - -@item DECL_ASSEMBLER_NAME -This macro returns the mangled name of the function, also an -@code{IDENTIFIER_NODE}. This name does not contain leading underscores -on systems that prefix all identifiers with underscores. The mangled -name is computed in the same way on all platforms; if special processing -is required to deal with the object file format used on a particular -platform, it is the responsibility of the back end to perform those -modifications. (Of course, the back end should not modify -@code{DECL_ASSEMBLER_NAME} itself.) - -Using @code{DECL_ASSEMBLER_NAME} will cause additional memory to be -allocated (for the mangled name of the entity) so it should be used -only when emitting assembly code. It should not be used within the -optimizers to determine whether or not two declarations are the same, -even though some of the existing optimizers do use it in that way. -These uses will be removed over time. - -@item DECL_ARGUMENTS -This macro returns the @code{PARM_DECL} for the first argument to the -function. Subsequent @code{PARM_DECL} nodes can be obtained by -following the @code{TREE_CHAIN} links. - -@item DECL_RESULT -This macro returns the @code{RESULT_DECL} for the function. - -@item DECL_SAVED_TREE -This macro returns the complete body of the function. - -@item TREE_TYPE -This macro returns the @code{FUNCTION_TYPE} or @code{METHOD_TYPE} for -the function. - -@item DECL_INITIAL -A function that has a definition in the current translation unit will -have a non-@code{NULL} @code{DECL_INITIAL}. However, back ends should not make -use of the particular value given by @code{DECL_INITIAL}. - -It should contain a tree of @code{BLOCK} nodes that mirrors the scopes -that variables are bound in the function. Each block contains a list -of decls declared in a basic block, a pointer to a chain of blocks at -the next lower scope level, then a pointer to the next block at the -same level and a backpointer to the parent @code{BLOCK} or -@code{FUNCTION_DECL}. So given a function as follows: - -@smallexample -void foo() -@{ - int a; - @{ - int b; - @} - int c; -@} -@end smallexample - -you would get the following: - -@smallexample -tree foo = FUNCTION_DECL; -tree decl_a = VAR_DECL; -tree decl_b = VAR_DECL; -tree decl_c = VAR_DECL; -tree block_a = BLOCK; -tree block_b = BLOCK; -tree block_c = BLOCK; -BLOCK_VARS(block_a) = decl_a; -BLOCK_SUBBLOCKS(block_a) = block_b; -BLOCK_CHAIN(block_a) = block_c; -BLOCK_SUPERCONTEXT(block_a) = foo; -BLOCK_VARS(block_b) = decl_b; -BLOCK_SUPERCONTEXT(block_b) = block_a; -BLOCK_VARS(block_c) = decl_c; -BLOCK_SUPERCONTEXT(block_c) = foo; -DECL_INITIAL(foo) = block_a; -@end smallexample - -@end ftable - -@c --------------------------------------------------------------------- -@c Function Properties -@c --------------------------------------------------------------------- - -@node Function Properties -@subsection Function Properties -@cindex function properties -@cindex statements - -To determine the scope of a function, you can use the -@code{DECL_CONTEXT} macro. This macro will return the class -(either a @code{RECORD_TYPE} or a @code{UNION_TYPE}) or namespace (a -@code{NAMESPACE_DECL}) of which the function is a member. For a virtual -function, this macro returns the class in which the function was -actually defined, not the base class in which the virtual declaration -occurred. - -In C, the @code{DECL_CONTEXT} for a function maybe another function. -This representation indicates that the GNU nested function extension -is in use. For details on the semantics of nested functions, see the -GCC Manual. The nested function can refer to local variables in its -containing function. Such references are not explicitly marked in the -tree structure; back ends must look at the @code{DECL_CONTEXT} for the -referenced @code{VAR_DECL}. If the @code{DECL_CONTEXT} for the -referenced @code{VAR_DECL} is not the same as the function currently -being processed, and neither @code{DECL_EXTERNAL} nor -@code{TREE_STATIC} hold, then the reference is to a local variable in -a containing function, and the back end must take appropriate action. - -@ftable @code -@item DECL_EXTERNAL -This predicate holds if the function is undefined. - -@item TREE_PUBLIC -This predicate holds if the function has external linkage. - -@item TREE_STATIC -This predicate holds if the function has been defined. - -@item TREE_THIS_VOLATILE -This predicate holds if the function does not return normally. - -@item TREE_READONLY -This predicate holds if the function can only read its arguments. - -@item DECL_PURE_P -This predicate holds if the function can only read its arguments, but -may also read global memory. - -@item DECL_VIRTUAL_P -This predicate holds if the function is virtual. - -@item DECL_ARTIFICIAL -This macro holds if the function was implicitly generated by the -compiler, rather than explicitly declared. In addition to implicitly -generated class member functions, this macro holds for the special -functions created to implement static initialization and destruction, to -compute run-time type information, and so forth. - -@item DECL_FUNCTION_SPECIFIC_TARGET -This macro returns a tree node that holds the target options that are -to be used to compile this particular function or @code{NULL_TREE} if -the function is to be compiled with the target options specified on -the command line. - -@item DECL_FUNCTION_SPECIFIC_OPTIMIZATION -This macro returns a tree node that holds the optimization options -that are to be used to compile this particular function or -@code{NULL_TREE} if the function is to be compiled with the -optimization options specified on the command line. - -@end ftable - -@c --------------------------------------------------------------------- -@c Language-dependent trees -@c --------------------------------------------------------------------- - -@node Language-dependent trees -@section Language-dependent trees -@cindex language-dependent trees - -Front ends may wish to keep some state associated with various GENERIC -trees while parsing. To support this, trees provide a set of flags -that may be used by the front end. They are accessed using -@code{TREE_LANG_FLAG_n} where @samp{n} is currently 0 through 6. - -If necessary, a front end can use some language-dependent tree -codes in its GENERIC representation, so long as it provides a -hook for converting them to GIMPLE and doesn't expect them to -work with any (hypothetical) optimizers that run before the -conversion to GIMPLE@. The intermediate representation used while -parsing C and C++ looks very little like GENERIC, but the C and -C++ gimplifier hooks are perfectly happy to take it as input and -spit out GIMPLE@. - - - -@node C and C++ Trees -@section C and C++ Trees - -This section documents the internal representation used by GCC to -represent C and C++ source programs. When presented with a C or C++ -source program, GCC parses the program, performs semantic analysis -(including the generation of error messages), and then produces the -internal representation described here. This representation contains a -complete representation for the entire translation unit provided as -input to the front end. This representation is then typically processed -by a code-generator in order to produce machine code, but could also be -used in the creation of source browsers, intelligent editors, automatic -documentation generators, interpreters, and any other programs needing -the ability to process C or C++ code. - -This section explains the internal representation. In particular, it -documents the internal representation for C and C++ source -constructs, and the macros, functions, and variables that can be used to -access these constructs. The C++ representation is largely a superset -of the representation used in the C front end. There is only one -construct used in C that does not appear in the C++ front end and that -is the GNU ``nested function'' extension. Many of the macros documented -here do not apply in C because the corresponding language constructs do -not appear in C@. - -The C and C++ front ends generate a mix of GENERIC trees and ones -specific to C and C++. These language-specific trees are higher-level -constructs than the ones in GENERIC to make the parser's job easier. -This section describes those trees that aren't part of GENERIC as well -as aspects of GENERIC trees that are treated in a language-specific -manner. - -If you are developing a ``back end'', be it is a code-generator or some -other tool, that uses this representation, you may occasionally find -that you need to ask questions not easily answered by the functions and -macros available here. If that situation occurs, it is quite likely -that GCC already supports the functionality you desire, but that the -interface is simply not documented here. In that case, you should ask -the GCC maintainers (via mail to @email{gcc@@gcc.gnu.org}) about -documenting the functionality you require. Similarly, if you find -yourself writing functions that do not deal directly with your back end, -but instead might be useful to other people using the GCC front end, you -should submit your patches for inclusion in GCC@. - -@menu -* Types for C++:: Fundamental and aggregate types. -* Namespaces:: Namespaces. -* Classes:: Classes. -* Functions for C++:: Overloading and accessors for C++. -* Statements for C++:: Statements specific to C and C++. -* C++ Expressions:: From @code{typeid} to @code{throw}. -@end menu - -@node Types for C++ -@subsection Types for C++ -@tindex UNKNOWN_TYPE -@tindex TYPENAME_TYPE -@tindex TYPEOF_TYPE -@findex cp_type_quals -@findex TYPE_UNQUALIFIED -@findex TYPE_QUAL_CONST -@findex TYPE_QUAL_VOLATILE -@findex TYPE_QUAL_RESTRICT -@findex TYPE_MAIN_VARIANT -@cindex qualified type -@findex TYPE_SIZE -@findex TYPE_ALIGN -@findex TYPE_PRECISION -@findex TYPE_ARG_TYPES -@findex TYPE_METHOD_BASETYPE -@findex TYPE_PTRDATAMEM_P -@findex TYPE_OFFSET_BASETYPE -@findex TREE_TYPE -@findex TYPE_CONTEXT -@findex TYPE_NAME -@findex TYPENAME_TYPE_FULLNAME -@findex TYPE_FIELDS -@findex TYPE_PTROBV_P - -In C++, an array type is not qualified; rather the type of the array -elements is qualified. This situation is reflected in the intermediate -representation. The macros described here will always examine the -qualification of the underlying element type when applied to an array -type. (If the element type is itself an array, then the recursion -continues until a non-array type is found, and the qualification of this -type is examined.) So, for example, @code{CP_TYPE_CONST_P} will hold of -the type @code{const int ()[7]}, denoting an array of seven @code{int}s. - -The following functions and macros deal with cv-qualification of types: -@ftable @code -@item cp_type_quals -This function returns the set of type qualifiers applied to this type. -This value is @code{TYPE_UNQUALIFIED} if no qualifiers have been -applied. The @code{TYPE_QUAL_CONST} bit is set if the type is -@code{const}-qualified. The @code{TYPE_QUAL_VOLATILE} bit is set if the -type is @code{volatile}-qualified. The @code{TYPE_QUAL_RESTRICT} bit is -set if the type is @code{restrict}-qualified. - -@item CP_TYPE_CONST_P -This macro holds if the type is @code{const}-qualified. - -@item CP_TYPE_VOLATILE_P -This macro holds if the type is @code{volatile}-qualified. - -@item CP_TYPE_RESTRICT_P -This macro holds if the type is @code{restrict}-qualified. - -@item CP_TYPE_CONST_NON_VOLATILE_P -This predicate holds for a type that is @code{const}-qualified, but -@emph{not} @code{volatile}-qualified; other cv-qualifiers are ignored as -well: only the @code{const}-ness is tested. - -@end ftable - -A few other macros and functions are usable with all types: -@ftable @code -@item TYPE_SIZE -The number of bits required to represent the type, represented as an -@code{INTEGER_CST}. For an incomplete type, @code{TYPE_SIZE} will be -@code{NULL_TREE}. - -@item TYPE_ALIGN -The alignment of the type, in bits, represented as an @code{int}. - -@item TYPE_NAME -This macro returns a declaration (in the form of a @code{TYPE_DECL}) for -the type. (Note this macro does @emph{not} return an -@code{IDENTIFIER_NODE}, as you might expect, given its name!) You can -look at the @code{DECL_NAME} of the @code{TYPE_DECL} to obtain the -actual name of the type. The @code{TYPE_NAME} will be @code{NULL_TREE} -for a type that is not a built-in type, the result of a typedef, or a -named class type. - -@item CP_INTEGRAL_TYPE -This predicate holds if the type is an integral type. Notice that in -C++, enumerations are @emph{not} integral types. - -@item ARITHMETIC_TYPE_P -This predicate holds if the type is an integral type (in the C++ sense) -or a floating point type. - -@item CLASS_TYPE_P -This predicate holds for a class-type. - -@item TYPE_BUILT_IN -This predicate holds for a built-in type. - -@item TYPE_PTRDATAMEM_P -This predicate holds if the type is a pointer to data member. - -@item TYPE_PTR_P -This predicate holds if the type is a pointer type, and the pointee is -not a data member. - -@item TYPE_PTRFN_P -This predicate holds for a pointer to function type. - -@item TYPE_PTROB_P -This predicate holds for a pointer to object type. Note however that it -does not hold for the generic pointer to object type @code{void *}. You -may use @code{TYPE_PTROBV_P} to test for a pointer to object type as -well as @code{void *}. - -@end ftable - -The table below describes types specific to C and C++ as well as -language-dependent info about GENERIC types. - -@table @code - -@item POINTER_TYPE -Used to represent pointer types, and pointer to data member types. If -@code{TREE_TYPE} -is a pointer to data member type, then @code{TYPE_PTRDATAMEM_P} will hold. -For a pointer to data member type of the form @samp{T X::*}, -@code{TYPE_PTRMEM_CLASS_TYPE} will be the type @code{X}, while -@code{TYPE_PTRMEM_POINTED_TO_TYPE} will be the type @code{T}. - -@item RECORD_TYPE -Used to represent @code{struct} and @code{class} types in C and C++. If -@code{TYPE_PTRMEMFUNC_P} holds, then this type is a pointer-to-member -type. In that case, the @code{TYPE_PTRMEMFUNC_FN_TYPE} is a -@code{POINTER_TYPE} pointing to a @code{METHOD_TYPE}. The -@code{METHOD_TYPE} is the type of a function pointed to by the -pointer-to-member function. If @code{TYPE_PTRMEMFUNC_P} does not hold, -this type is a class type. For more information, @pxref{Classes}. - -@item UNKNOWN_TYPE -This node is used to represent a type the knowledge of which is -insufficient for a sound processing. - -@item TYPENAME_TYPE -Used to represent a construct of the form @code{typename T::A}. The -@code{TYPE_CONTEXT} is @code{T}; the @code{TYPE_NAME} is an -@code{IDENTIFIER_NODE} for @code{A}. If the type is specified via a -template-id, then @code{TYPENAME_TYPE_FULLNAME} yields a -@code{TEMPLATE_ID_EXPR}. The @code{TREE_TYPE} is non-@code{NULL} if the -node is implicitly generated in support for the implicit typename -extension; in which case the @code{TREE_TYPE} is a type node for the -base-class. - -@item TYPEOF_TYPE -Used to represent the @code{__typeof__} extension. The -@code{TYPE_FIELDS} is the expression the type of which is being -represented. - -@end table - - -@c --------------------------------------------------------------------- -@c Namespaces -@c --------------------------------------------------------------------- - -@node Namespaces -@subsection Namespaces -@cindex namespace, scope -@tindex NAMESPACE_DECL - -The root of the entire intermediate representation is the variable -@code{global_namespace}. This is the namespace specified with @code{::} -in C++ source code. All other namespaces, types, variables, functions, -and so forth can be found starting with this namespace. - -However, except for the fact that it is distinguished as the root of the -representation, the global namespace is no different from any other -namespace. Thus, in what follows, we describe namespaces generally, -rather than the global namespace in particular. - -A namespace is represented by a @code{NAMESPACE_DECL} node. - -The following macros and functions can be used on a @code{NAMESPACE_DECL}: - -@ftable @code -@item DECL_NAME -This macro is used to obtain the @code{IDENTIFIER_NODE} corresponding to -the unqualified name of the name of the namespace (@pxref{Identifiers}). -The name of the global namespace is @samp{::}, even though in C++ the -global namespace is unnamed. However, you should use comparison with -@code{global_namespace}, rather than @code{DECL_NAME} to determine -whether or not a namespace is the global one. An unnamed namespace -will have a @code{DECL_NAME} equal to @code{anonymous_namespace_name}. -Within a single translation unit, all unnamed namespaces will have the -same name. - -@item DECL_CONTEXT -This macro returns the enclosing namespace. The @code{DECL_CONTEXT} for -the @code{global_namespace} is @code{NULL_TREE}. - -@item DECL_NAMESPACE_ALIAS -If this declaration is for a namespace alias, then -@code{DECL_NAMESPACE_ALIAS} is the namespace for which this one is an -alias. - -Do not attempt to use @code{cp_namespace_decls} for a namespace which is -an alias. Instead, follow @code{DECL_NAMESPACE_ALIAS} links until you -reach an ordinary, non-alias, namespace, and call -@code{cp_namespace_decls} there. - -@item DECL_NAMESPACE_STD_P -This predicate holds if the namespace is the special @code{::std} -namespace. - -@item cp_namespace_decls -This function will return the declarations contained in the namespace, -including types, overloaded functions, other namespaces, and so forth. -If there are no declarations, this function will return -@code{NULL_TREE}. The declarations are connected through their -@code{TREE_CHAIN} fields. - -Although most entries on this list will be declarations, -@code{TREE_LIST} nodes may also appear. In this case, the -@code{TREE_VALUE} will be an @code{OVERLOAD}. The value of the -@code{TREE_PURPOSE} is unspecified; back ends should ignore this value. -As with the other kinds of declarations returned by -@code{cp_namespace_decls}, the @code{TREE_CHAIN} will point to the next -declaration in this list. - -For more information on the kinds of declarations that can occur on this -list, @xref{Declarations}. Some declarations will not appear on this -list. In particular, no @code{FIELD_DECL}, @code{LABEL_DECL}, or -@code{PARM_DECL} nodes will appear here. - -This function cannot be used with namespaces that have -@code{DECL_NAMESPACE_ALIAS} set. - -@end ftable - -@c --------------------------------------------------------------------- -@c Classes -@c --------------------------------------------------------------------- - -@node Classes -@subsection Classes -@cindex class, scope -@tindex RECORD_TYPE -@tindex UNION_TYPE -@findex CLASSTYPE_DECLARED_CLASS -@findex TYPE_BINFO -@findex BINFO_TYPE -@findex TYPE_FIELDS -@findex TYPE_VFIELD -@findex TYPE_METHODS - -Besides namespaces, the other high-level scoping construct in C++ is the -class. (Throughout this manual the term @dfn{class} is used to mean the -types referred to in the ANSI/ISO C++ Standard as classes; these include -types defined with the @code{class}, @code{struct}, and @code{union} -keywords.) - -A class type is represented by either a @code{RECORD_TYPE} or a -@code{UNION_TYPE}. A class declared with the @code{union} tag is -represented by a @code{UNION_TYPE}, while classes declared with either -the @code{struct} or the @code{class} tag are represented by -@code{RECORD_TYPE}s. You can use the @code{CLASSTYPE_DECLARED_CLASS} -macro to discern whether or not a particular type is a @code{class} as -opposed to a @code{struct}. This macro will be true only for classes -declared with the @code{class} tag. - -Almost all non-function members are available on the @code{TYPE_FIELDS} -list. Given one member, the next can be found by following the -@code{TREE_CHAIN}. You should not depend in any way on the order in -which fields appear on this list. All nodes on this list will be -@samp{DECL} nodes. A @code{FIELD_DECL} is used to represent a non-static -data member, a @code{VAR_DECL} is used to represent a static data -member, and a @code{TYPE_DECL} is used to represent a type. Note that -the @code{CONST_DECL} for an enumeration constant will appear on this -list, if the enumeration type was declared in the class. (Of course, -the @code{TYPE_DECL} for the enumeration type will appear here as well.) -There are no entries for base classes on this list. In particular, -there is no @code{FIELD_DECL} for the ``base-class portion'' of an -object. - -The @code{TYPE_VFIELD} is a compiler-generated field used to point to -virtual function tables. It may or may not appear on the -@code{TYPE_FIELDS} list. However, back ends should handle the -@code{TYPE_VFIELD} just like all the entries on the @code{TYPE_FIELDS} -list. - -The function members are available on the @code{TYPE_METHODS} list. -Again, subsequent members are found by following the @code{TREE_CHAIN} -field. If a function is overloaded, each of the overloaded functions -appears; no @code{OVERLOAD} nodes appear on the @code{TYPE_METHODS} -list. Implicitly declared functions (including default constructors, -copy constructors, assignment operators, and destructors) will appear on -this list as well. - -Every class has an associated @dfn{binfo}, which can be obtained with -@code{TYPE_BINFO}. Binfos are used to represent base-classes. The -binfo given by @code{TYPE_BINFO} is the degenerate case, whereby every -class is considered to be its own base-class. The base binfos for a -particular binfo are held in a vector, whose length is obtained with -@code{BINFO_N_BASE_BINFOS}. The base binfos themselves are obtained -with @code{BINFO_BASE_BINFO} and @code{BINFO_BASE_ITERATE}. To add a -new binfo, use @code{BINFO_BASE_APPEND}. The vector of base binfos can -be obtained with @code{BINFO_BASE_BINFOS}, but normally you do not need -to use that. The class type associated with a binfo is given by -@code{BINFO_TYPE}. It is not always the case that @code{BINFO_TYPE -(TYPE_BINFO (x))}, because of typedefs and qualified types. Neither is -it the case that @code{TYPE_BINFO (BINFO_TYPE (y))} is the same binfo as -@code{y}. The reason is that if @code{y} is a binfo representing a -base-class @code{B} of a derived class @code{D}, then @code{BINFO_TYPE -(y)} will be @code{B}, and @code{TYPE_BINFO (BINFO_TYPE (y))} will be -@code{B} as its own base-class, rather than as a base-class of @code{D}. - -The access to a base type can be found with @code{BINFO_BASE_ACCESS}. -This will produce @code{access_public_node}, @code{access_private_node} -or @code{access_protected_node}. If bases are always public, -@code{BINFO_BASE_ACCESSES} may be @code{NULL}. - -@code{BINFO_VIRTUAL_P} is used to specify whether the binfo is inherited -virtually or not. The other flags, @code{BINFO_MARKED_P} and -@code{BINFO_FLAG_1} to @code{BINFO_FLAG_6} can be used for language -specific use. - -The following macros can be used on a tree node representing a class-type. - -@ftable @code -@item LOCAL_CLASS_P -This predicate holds if the class is local class @emph{i.e.}@: declared -inside a function body. - -@item TYPE_POLYMORPHIC_P -This predicate holds if the class has at least one virtual function -(declared or inherited). - -@item TYPE_HAS_DEFAULT_CONSTRUCTOR -This predicate holds whenever its argument represents a class-type with -default constructor. - -@item CLASSTYPE_HAS_MUTABLE -@itemx TYPE_HAS_MUTABLE_P -These predicates hold for a class-type having a mutable data member. - -@item CLASSTYPE_NON_POD_P -This predicate holds only for class-types that are not PODs. - -@item TYPE_HAS_NEW_OPERATOR -This predicate holds for a class-type that defines -@code{operator new}. - -@item TYPE_HAS_ARRAY_NEW_OPERATOR -This predicate holds for a class-type for which -@code{operator new[]} is defined. - -@item TYPE_OVERLOADS_CALL_EXPR -This predicate holds for class-type for which the function call -@code{operator()} is overloaded. - -@item TYPE_OVERLOADS_ARRAY_REF -This predicate holds for a class-type that overloads -@code{operator[]} - -@item TYPE_OVERLOADS_ARROW -This predicate holds for a class-type for which @code{operator->} is -overloaded. - -@end ftable - -@node Functions for C++ -@subsection Functions for C++ -@cindex function -@tindex FUNCTION_DECL -@tindex OVERLOAD -@findex OVL_CURRENT -@findex OVL_NEXT - -A function is represented by a @code{FUNCTION_DECL} node. A set of -overloaded functions is sometimes represented by an @code{OVERLOAD} node. - -An @code{OVERLOAD} node is not a declaration, so none of the -@samp{DECL_} macros should be used on an @code{OVERLOAD}. An -@code{OVERLOAD} node is similar to a @code{TREE_LIST}. Use -@code{OVL_CURRENT} to get the function associated with an -@code{OVERLOAD} node; use @code{OVL_NEXT} to get the next -@code{OVERLOAD} node in the list of overloaded functions. The macros -@code{OVL_CURRENT} and @code{OVL_NEXT} are actually polymorphic; you can -use them to work with @code{FUNCTION_DECL} nodes as well as with -overloads. In the case of a @code{FUNCTION_DECL}, @code{OVL_CURRENT} -will always return the function itself, and @code{OVL_NEXT} will always -be @code{NULL_TREE}. - -To determine the scope of a function, you can use the -@code{DECL_CONTEXT} macro. This macro will return the class -(either a @code{RECORD_TYPE} or a @code{UNION_TYPE}) or namespace (a -@code{NAMESPACE_DECL}) of which the function is a member. For a virtual -function, this macro returns the class in which the function was -actually defined, not the base class in which the virtual declaration -occurred. - -If a friend function is defined in a class scope, the -@code{DECL_FRIEND_CONTEXT} macro can be used to determine the class in -which it was defined. For example, in -@smallexample -class C @{ friend void f() @{@} @}; -@end smallexample -@noindent -the @code{DECL_CONTEXT} for @code{f} will be the -@code{global_namespace}, but the @code{DECL_FRIEND_CONTEXT} will be the -@code{RECORD_TYPE} for @code{C}. - - -The following macros and functions can be used on a @code{FUNCTION_DECL}: -@ftable @code -@item DECL_MAIN_P -This predicate holds for a function that is the program entry point -@code{::code}. - -@item DECL_LOCAL_FUNCTION_P -This predicate holds if the function was declared at block scope, even -though it has a global scope. - -@item DECL_ANTICIPATED -This predicate holds if the function is a built-in function but its -prototype is not yet explicitly declared. - -@item DECL_EXTERN_C_FUNCTION_P -This predicate holds if the function is declared as an -`@code{extern "C"}' function. - -@item DECL_LINKONCE_P -This macro holds if multiple copies of this function may be emitted in -various translation units. It is the responsibility of the linker to -merge the various copies. Template instantiations are the most common -example of functions for which @code{DECL_LINKONCE_P} holds; G++ -instantiates needed templates in all translation units which require them, -and then relies on the linker to remove duplicate instantiations. - -FIXME: This macro is not yet implemented. - -@item DECL_FUNCTION_MEMBER_P -This macro holds if the function is a member of a class, rather than a -member of a namespace. - -@item DECL_STATIC_FUNCTION_P -This predicate holds if the function a static member function. - -@item DECL_NONSTATIC_MEMBER_FUNCTION_P -This macro holds for a non-static member function. - -@item DECL_CONST_MEMFUNC_P -This predicate holds for a @code{const}-member function. - -@item DECL_VOLATILE_MEMFUNC_P -This predicate holds for a @code{volatile}-member function. - -@item DECL_CONSTRUCTOR_P -This macro holds if the function is a constructor. - -@item DECL_NONCONVERTING_P -This predicate holds if the constructor is a non-converting constructor. - -@item DECL_COMPLETE_CONSTRUCTOR_P -This predicate holds for a function which is a constructor for an object -of a complete type. - -@item DECL_BASE_CONSTRUCTOR_P -This predicate holds for a function which is a constructor for a base -class sub-object. - -@item DECL_COPY_CONSTRUCTOR_P -This predicate holds for a function which is a copy-constructor. - -@item DECL_DESTRUCTOR_P -This macro holds if the function is a destructor. - -@item DECL_COMPLETE_DESTRUCTOR_P -This predicate holds if the function is the destructor for an object a -complete type. - -@item DECL_OVERLOADED_OPERATOR_P -This macro holds if the function is an overloaded operator. - -@item DECL_CONV_FN_P -This macro holds if the function is a type-conversion operator. - -@item DECL_GLOBAL_CTOR_P -This predicate holds if the function is a file-scope initialization -function. - -@item DECL_GLOBAL_DTOR_P -This predicate holds if the function is a file-scope finalization -function. - -@item DECL_THUNK_P -This predicate holds if the function is a thunk. - -These functions represent stub code that adjusts the @code{this} pointer -and then jumps to another function. When the jumped-to function -returns, control is transferred directly to the caller, without -returning to the thunk. The first parameter to the thunk is always the -@code{this} pointer; the thunk should add @code{THUNK_DELTA} to this -value. (The @code{THUNK_DELTA} is an @code{int}, not an -@code{INTEGER_CST}.) - -Then, if @code{THUNK_VCALL_OFFSET} (an @code{INTEGER_CST}) is nonzero -the adjusted @code{this} pointer must be adjusted again. The complete -calculation is given by the following pseudo-code: - -@smallexample -this += THUNK_DELTA -if (THUNK_VCALL_OFFSET) - this += (*((ptrdiff_t **) this))[THUNK_VCALL_OFFSET] -@end smallexample - -Finally, the thunk should jump to the location given -by @code{DECL_INITIAL}; this will always be an expression for the -address of a function. - -@item DECL_NON_THUNK_FUNCTION_P -This predicate holds if the function is @emph{not} a thunk function. - -@item GLOBAL_INIT_PRIORITY -If either @code{DECL_GLOBAL_CTOR_P} or @code{DECL_GLOBAL_DTOR_P} holds, -then this gives the initialization priority for the function. The -linker will arrange that all functions for which -@code{DECL_GLOBAL_CTOR_P} holds are run in increasing order of priority -before @code{main} is called. When the program exits, all functions for -which @code{DECL_GLOBAL_DTOR_P} holds are run in the reverse order. - -@item TYPE_RAISES_EXCEPTIONS -This macro returns the list of exceptions that a (member-)function can -raise. The returned list, if non @code{NULL}, is comprised of nodes -whose @code{TREE_VALUE} represents a type. - -@item TYPE_NOTHROW_P -This predicate holds when the exception-specification of its arguments -is of the form `@code{()}'. - -@item DECL_ARRAY_DELETE_OPERATOR_P -This predicate holds if the function an overloaded -@code{operator delete[]}. - -@end ftable - -@c --------------------------------------------------------------------- -@c Function Bodies -@c --------------------------------------------------------------------- - -@node Statements for C++ -@subsection Statements for C++ -@cindex statements -@tindex BREAK_STMT -@tindex CLEANUP_STMT -@findex CLEANUP_DECL -@findex CLEANUP_EXPR -@tindex CONTINUE_STMT -@tindex DECL_STMT -@findex DECL_STMT_DECL -@tindex DO_STMT -@findex DO_BODY -@findex DO_COND -@tindex EMPTY_CLASS_EXPR -@tindex EXPR_STMT -@findex EXPR_STMT_EXPR -@tindex FOR_STMT -@findex FOR_INIT_STMT -@findex FOR_COND -@findex FOR_EXPR -@findex FOR_BODY -@tindex HANDLER -@tindex IF_STMT -@findex IF_COND -@findex THEN_CLAUSE -@findex ELSE_CLAUSE -@tindex RETURN_STMT -@findex RETURN_EXPR -@tindex SUBOBJECT -@findex SUBOBJECT_CLEANUP -@tindex SWITCH_STMT -@findex SWITCH_COND -@findex SWITCH_BODY -@tindex TRY_BLOCK -@findex TRY_STMTS -@findex TRY_HANDLERS -@findex HANDLER_PARMS -@findex HANDLER_BODY -@findex USING_STMT -@tindex WHILE_STMT -@findex WHILE_BODY -@findex WHILE_COND - -A function that has a definition in the current translation unit will -have a non-@code{NULL} @code{DECL_INITIAL}. However, back ends should not make -use of the particular value given by @code{DECL_INITIAL}. - -The @code{DECL_SAVED_TREE} macro will give the complete body of the -function. - -@subsubsection Statements - -There are tree nodes corresponding to all of the source-level -statement constructs, used within the C and C++ frontends. These are -enumerated here, together with a list of the various macros that can -be used to obtain information about them. There are a few macros that -can be used with all statements: - -@ftable @code -@item STMT_IS_FULL_EXPR_P -In C++, statements normally constitute ``full expressions''; temporaries -created during a statement are destroyed when the statement is complete. -However, G++ sometimes represents expressions by statements; these -statements will not have @code{STMT_IS_FULL_EXPR_P} set. Temporaries -created during such statements should be destroyed when the innermost -enclosing statement with @code{STMT_IS_FULL_EXPR_P} set is exited. - -@end ftable - -Here is the list of the various statement nodes, and the macros used to -access them. This documentation describes the use of these nodes in -non-template functions (including instantiations of template functions). -In template functions, the same nodes are used, but sometimes in -slightly different ways. - -Many of the statements have substatements. For example, a @code{while} -loop will have a body, which is itself a statement. If the substatement -is @code{NULL_TREE}, it is considered equivalent to a statement -consisting of a single @code{;}, i.e., an expression statement in which -the expression has been omitted. A substatement may in fact be a list -of statements, connected via their @code{TREE_CHAIN}s. So, you should -always process the statement tree by looping over substatements, like -this: -@smallexample -void process_stmt (stmt) - tree stmt; -@{ - while (stmt) - @{ - switch (TREE_CODE (stmt)) - @{ - case IF_STMT: - process_stmt (THEN_CLAUSE (stmt)); - /* @r{More processing here.} */ - break; - - @dots{} - @} - - stmt = TREE_CHAIN (stmt); - @} -@} -@end smallexample -In other words, while the @code{then} clause of an @code{if} statement -in C++ can be only one statement (although that one statement may be a -compound statement), the intermediate representation will sometimes use -several statements chained together. - -@table @code -@item BREAK_STMT - -Used to represent a @code{break} statement. There are no additional -fields. - -@item CILK_SPAWN_STMT - -Used to represent a spawning function in the Cilk Plus language extension. -This tree has one field that holds the name of the spawning function. -@code{_Cilk_spawn} can be written in C in the following way: - -@smallexample -@code{_Cilk_spawn} (); -@end smallexample - -Detailed description for usage and functionality of @code{_Cilk_spawn} can be -found at http://www.cilkplus.org - -@item CILK_SYNC_STMT - -This statement is part of the Cilk Plus language extension. It indicates that -the current function cannot continue in parallel with its spawned children. -There are no additional fields. @code{_Cilk_sync} can be written in C in the -following way: - -@smallexample -@code{_Cilk_sync}; -@end smallexample - -@item CLEANUP_STMT - -Used to represent an action that should take place upon exit from the -enclosing scope. Typically, these actions are calls to destructors for -local objects, but back ends cannot rely on this fact. If these nodes -are in fact representing such destructors, @code{CLEANUP_DECL} will be -the @code{VAR_DECL} destroyed. Otherwise, @code{CLEANUP_DECL} will be -@code{NULL_TREE}. In any case, the @code{CLEANUP_EXPR} is the -expression to execute. The cleanups executed on exit from a scope -should be run in the reverse order of the order in which the associated -@code{CLEANUP_STMT}s were encountered. - -@item CONTINUE_STMT - -Used to represent a @code{continue} statement. There are no additional -fields. - -@item CTOR_STMT - -Used to mark the beginning (if @code{CTOR_BEGIN_P} holds) or end (if -@code{CTOR_END_P} holds of the main body of a constructor. See also -@code{SUBOBJECT} for more information on how to use these nodes. - -@item DO_STMT - -Used to represent a @code{do} loop. The body of the loop is given by -@code{DO_BODY} while the termination condition for the loop is given by -@code{DO_COND}. The condition for a @code{do}-statement is always an -expression. - -@item EMPTY_CLASS_EXPR - -Used to represent a temporary object of a class with no data whose -address is never taken. (All such objects are interchangeable.) The -@code{TREE_TYPE} represents the type of the object. - -@item EXPR_STMT - -Used to represent an expression statement. Use @code{EXPR_STMT_EXPR} to -obtain the expression. - -@item FOR_STMT - -Used to represent a @code{for} statement. The @code{FOR_INIT_STMT} is -the initialization statement for the loop. The @code{FOR_COND} is the -termination condition. The @code{FOR_EXPR} is the expression executed -right before the @code{FOR_COND} on each loop iteration; often, this -expression increments a counter. The body of the loop is given by -@code{FOR_BODY}. Note that @code{FOR_INIT_STMT} and @code{FOR_BODY} -return statements, while @code{FOR_COND} and @code{FOR_EXPR} return -expressions. - -@item HANDLER - -Used to represent a C++ @code{catch} block. The @code{HANDLER_TYPE} -is the type of exception that will be caught by this handler; it is -equal (by pointer equality) to @code{NULL} if this handler is for all -types. @code{HANDLER_PARMS} is the @code{DECL_STMT} for the catch -parameter, and @code{HANDLER_BODY} is the code for the block itself. - -@item IF_STMT - -Used to represent an @code{if} statement. The @code{IF_COND} is the -expression. - -If the condition is a @code{TREE_LIST}, then the @code{TREE_PURPOSE} is -a statement (usually a @code{DECL_STMT}). Each time the condition is -evaluated, the statement should be executed. Then, the -@code{TREE_VALUE} should be used as the conditional expression itself. -This representation is used to handle C++ code like this: - -C++ distinguishes between this and @code{COND_EXPR} for handling templates. - -@smallexample -if (int i = 7) @dots{} -@end smallexample - -where there is a new local variable (or variables) declared within the -condition. - -The @code{THEN_CLAUSE} represents the statement given by the @code{then} -condition, while the @code{ELSE_CLAUSE} represents the statement given -by the @code{else} condition. - -@item SUBOBJECT - -In a constructor, these nodes are used to mark the point at which a -subobject of @code{this} is fully constructed. If, after this point, an -exception is thrown before a @code{CTOR_STMT} with @code{CTOR_END_P} set -is encountered, the @code{SUBOBJECT_CLEANUP} must be executed. The -cleanups must be executed in the reverse order in which they appear. - -@item SWITCH_STMT - -Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND} -is the expression on which the switch is occurring. See the documentation -for an @code{IF_STMT} for more information on the representation used -for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch -statement. The @code{SWITCH_STMT_TYPE} is the original type of switch -expression as given in the source, before any compiler conversions. - -@item TRY_BLOCK -Used to represent a @code{try} block. The body of the try block is -given by @code{TRY_STMTS}. Each of the catch blocks is a @code{HANDLER} -node. The first handler is given by @code{TRY_HANDLERS}. Subsequent -handlers are obtained by following the @code{TREE_CHAIN} link from one -handler to the next. The body of the handler is given by -@code{HANDLER_BODY}. - -If @code{CLEANUP_P} holds of the @code{TRY_BLOCK}, then the -@code{TRY_HANDLERS} will not be a @code{HANDLER} node. Instead, it will -be an expression that should be executed if an exception is thrown in -the try block. It must rethrow the exception after executing that code. -And, if an exception is thrown while the expression is executing, -@code{terminate} must be called. - -@item USING_STMT -Used to represent a @code{using} directive. The namespace is given by -@code{USING_STMT_NAMESPACE}, which will be a NAMESPACE_DECL@. This node -is needed inside template functions, to implement using directives -during instantiation. - -@item WHILE_STMT - -Used to represent a @code{while} loop. The @code{WHILE_COND} is the -termination condition for the loop. See the documentation for an -@code{IF_STMT} for more information on the representation used for the -condition. - -The @code{WHILE_BODY} is the body of the loop. - -@end table - -@node C++ Expressions -@subsection C++ Expressions - -This section describes expressions specific to the C and C++ front -ends. - -@table @code -@item TYPEID_EXPR - -Used to represent a @code{typeid} expression. - -@item NEW_EXPR -@itemx VEC_NEW_EXPR - -Used to represent a call to @code{new} and @code{new[]} respectively. - -@item DELETE_EXPR -@itemx VEC_DELETE_EXPR - -Used to represent a call to @code{delete} and @code{delete[]} respectively. - -@item MEMBER_REF - -Represents a reference to a member of a class. - -@item THROW_EXPR - -Represents an instance of @code{throw} in the program. Operand 0, -which is the expression to throw, may be @code{NULL_TREE}. - - -@item AGGR_INIT_EXPR -An @code{AGGR_INIT_EXPR} represents the initialization as the return -value of a function call, or as the result of a constructor. An -@code{AGGR_INIT_EXPR} will only appear as a full-expression, or as the -second operand of a @code{TARGET_EXPR}. @code{AGGR_INIT_EXPR}s have -a representation similar to that of @code{CALL_EXPR}s. You can use -the @code{AGGR_INIT_EXPR_FN} and @code{AGGR_INIT_EXPR_ARG} macros to access -the function to call and the arguments to pass. - -If @code{AGGR_INIT_VIA_CTOR_P} holds of the @code{AGGR_INIT_EXPR}, then -the initialization is via a constructor call. The address of the -@code{AGGR_INIT_EXPR_SLOT} operand, which is always a @code{VAR_DECL}, -is taken, and this value replaces the first argument in the argument -list. - -In either case, the expression is void. - - -@end table - - -@node Java Trees -@section Java Trees diff --git a/contrib/gcc-5.0/gcc/doc/gimple.texi b/contrib/gcc-5.0/gcc/doc/gimple.texi deleted file mode 100644 index 543de90c35..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gimple.texi +++ /dev/null @@ -1,2739 +0,0 @@ -@c Copyright (C) 2008-2015 Free Software Foundation, Inc. -@c Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node GIMPLE -@chapter GIMPLE -@cindex GIMPLE - -GIMPLE is a three-address representation derived from GENERIC by -breaking down GENERIC expressions into tuples of no more than 3 -operands (with some exceptions like function calls). GIMPLE was -heavily influenced by the SIMPLE IL used by the McCAT compiler -project at McGill University, though we have made some different -choices. For one thing, SIMPLE doesn't support @code{goto}. - -Temporaries are introduced to hold intermediate values needed to -compute complex expressions. Additionally, all the control -structures used in GENERIC are lowered into conditional jumps, -lexical scopes are removed and exception regions are converted -into an on the side exception region tree. - -The compiler pass which converts GENERIC into GIMPLE is referred to as -the @samp{gimplifier}. The gimplifier works recursively, generating -GIMPLE tuples out of the original GENERIC expressions. - -One of the early implementation strategies used for the GIMPLE -representation was to use the same internal data structures used -by front ends to represent parse trees. This simplified -implementation because we could leverage existing functionality -and interfaces. However, GIMPLE is a much more restrictive -representation than abstract syntax trees (AST), therefore it -does not require the full structural complexity provided by the -main tree data structure. - -The GENERIC representation of a function is stored in the -@code{DECL_SAVED_TREE} field of the associated @code{FUNCTION_DECL} -tree node. It is converted to GIMPLE by a call to -@code{gimplify_function_tree}. - -If a front end wants to include language-specific tree codes in the tree -representation which it provides to the back end, it must provide a -definition of @code{LANG_HOOKS_GIMPLIFY_EXPR} which knows how to -convert the front end trees to GIMPLE@. Usually such a hook will involve -much of the same code for expanding front end trees to RTL@. This function -can return fully lowered GIMPLE, or it can return GENERIC trees and let the -main gimplifier lower them the rest of the way; this is often simpler. -GIMPLE that is not fully lowered is known as ``High GIMPLE'' and -consists of the IL before the pass @code{pass_lower_cf}. High GIMPLE -contains some container statements like lexical scopes -(represented by @code{GIMPLE_BIND}) and nested expressions (e.g., -@code{GIMPLE_TRY}), while ``Low GIMPLE'' exposes all of the -implicit jumps for control and exception expressions directly in -the IL and EH region trees. - -The C and C++ front ends currently convert directly from front end -trees to GIMPLE, and hand that off to the back end rather than first -converting to GENERIC@. Their gimplifier hooks know about all the -@code{_STMT} nodes and how to convert them to GENERIC forms. There -was some work done on a genericization pass which would run first, but -the existence of @code{STMT_EXPR} meant that in order to convert all -of the C statements into GENERIC equivalents would involve walking the -entire tree anyway, so it was simpler to lower all the way. This -might change in the future if someone writes an optimization pass -which would work better with higher-level trees, but currently the -optimizers all expect GIMPLE@. - -You can request to dump a C-like representation of the GIMPLE form -with the flag @option{-fdump-tree-gimple}. - -@menu -* Tuple representation:: -* Class hierarchy of GIMPLE statements:: -* GIMPLE instruction set:: -* GIMPLE Exception Handling:: -* Temporaries:: -* Operands:: -* Manipulating GIMPLE statements:: -* Tuple specific accessors:: -* GIMPLE sequences:: -* Sequence iterators:: -* Adding a new GIMPLE statement code:: -* Statement and operand traversals:: -@end menu - -@node Tuple representation -@section Tuple representation -@cindex tuples - -GIMPLE instructions are tuples of variable size divided in two -groups: a header describing the instruction and its locations, -and a variable length body with all the operands. Tuples are -organized into a hierarchy with 3 main classes of tuples. - -@subsection @code{gimple_statement_base} (gsbase) -@cindex gimple_statement_base - -This is the root of the hierarchy, it holds basic information -needed by most GIMPLE statements. There are some fields that -may not be relevant to every GIMPLE statement, but those were -moved into the base structure to take advantage of holes left by -other fields (thus making the structure more compact). The -structure takes 4 words (32 bytes) on 64 bit hosts: - -@multitable {@code{references_memory_p}} {Size (bits)} -@item Field @tab Size (bits) -@item @code{code} @tab 8 -@item @code{subcode} @tab 16 -@item @code{no_warning} @tab 1 -@item @code{visited} @tab 1 -@item @code{nontemporal_move} @tab 1 -@item @code{plf} @tab 2 -@item @code{modified} @tab 1 -@item @code{has_volatile_ops} @tab 1 -@item @code{references_memory_p} @tab 1 -@item @code{uid} @tab 32 -@item @code{location} @tab 32 -@item @code{num_ops} @tab 32 -@item @code{bb} @tab 64 -@item @code{block} @tab 63 -@item Total size @tab 32 bytes -@end multitable - -@itemize @bullet -@item @code{code} -Main identifier for a GIMPLE instruction. - -@item @code{subcode} -Used to distinguish different variants of the same basic -instruction or provide flags applicable to a given code. The -@code{subcode} flags field has different uses depending on the code of -the instruction, but mostly it distinguishes instructions of the -same family. The most prominent use of this field is in -assignments, where subcode indicates the operation done on the -RHS of the assignment. For example, a = b + c is encoded as -@code{GIMPLE_ASSIGN }. - -@item @code{no_warning} -Bitflag to indicate whether a warning has already been issued on -this statement. - -@item @code{visited} -General purpose ``visited'' marker. Set and cleared by each pass -when needed. - -@item @code{nontemporal_move} -Bitflag used in assignments that represent non-temporal moves. -Although this bitflag is only used in assignments, it was moved -into the base to take advantage of the bit holes left by the -previous fields. - -@item @code{plf} -Pass Local Flags. This 2-bit mask can be used as general purpose -markers by any pass. Passes are responsible for clearing and -setting these two flags accordingly. - -@item @code{modified} -Bitflag to indicate whether the statement has been modified. -Used mainly by the operand scanner to determine when to re-scan a -statement for operands. - -@item @code{has_volatile_ops} -Bitflag to indicate whether this statement contains operands that -have been marked volatile. - -@item @code{references_memory_p} -Bitflag to indicate whether this statement contains memory -references (i.e., its operands are either global variables, or -pointer dereferences or anything that must reside in memory). - -@item @code{uid} -This is an unsigned integer used by passes that want to assign -IDs to every statement. These IDs must be assigned and used by -each pass. - -@item @code{location} -This is a @code{location_t} identifier to specify source code -location for this statement. It is inherited from the front -end. - -@item @code{num_ops} -Number of operands that this statement has. This specifies the -size of the operand vector embedded in the tuple. Only used in -some tuples, but it is declared in the base tuple to take -advantage of the 32-bit hole left by the previous fields. - -@item @code{bb} -Basic block holding the instruction. - -@item @code{block} -Lexical block holding this statement. Also used for debug -information generation. -@end itemize - -@subsection @code{gimple_statement_with_ops} -@cindex gimple_statement_with_ops - -This tuple is actually split in two: -@code{gimple_statement_with_ops_base} and -@code{gimple_statement_with_ops}. This is needed to accommodate the -way the operand vector is allocated. The operand vector is -defined to be an array of 1 element. So, to allocate a dynamic -number of operands, the memory allocator (@code{gimple_alloc}) simply -allocates enough memory to hold the structure itself plus @code{N -- 1} operands which run ``off the end'' of the structure. For -example, to allocate space for a tuple with 3 operands, -@code{gimple_alloc} reserves @code{sizeof (struct -gimple_statement_with_ops) + 2 * sizeof (tree)} bytes. - -On the other hand, several fields in this tuple need to be shared -with the @code{gimple_statement_with_memory_ops} tuple. So, these -common fields are placed in @code{gimple_statement_with_ops_base} which -is then inherited from the other two tuples. - - -@multitable {@code{def_ops}} {48 + 8 * @code{num_ops} bytes} -@item @code{gsbase} @tab 256 -@item @code{def_ops} @tab 64 -@item @code{use_ops} @tab 64 -@item @code{op} @tab @code{num_ops} * 64 -@item Total size @tab 48 + 8 * @code{num_ops} bytes -@end multitable - -@itemize @bullet -@item @code{gsbase} -Inherited from @code{struct gimple_statement_base}. - -@item @code{def_ops} -Array of pointers into the operand array indicating all the slots that -contain a variable written-to by the statement. This array is -also used for immediate use chaining. Note that it would be -possible to not rely on this array, but the changes required to -implement this are pretty invasive. - -@item @code{use_ops} -Similar to @code{def_ops} but for variables read by the statement. - -@item @code{op} -Array of trees with @code{num_ops} slots. -@end itemize - -@subsection @code{gimple_statement_with_memory_ops} - -This tuple is essentially identical to @code{gimple_statement_with_ops}, -except that it contains 4 additional fields to hold vectors -related memory stores and loads. Similar to the previous case, -the structure is split in two to accommodate for the operand -vector (@code{gimple_statement_with_memory_ops_base} and -@code{gimple_statement_with_memory_ops}). - - -@multitable {@code{vdef_ops}} {80 + 8 * @code{num_ops} bytes} -@item Field @tab Size (bits) -@item @code{gsbase} @tab 256 -@item @code{def_ops} @tab 64 -@item @code{use_ops} @tab 64 -@item @code{vdef_ops} @tab 64 -@item @code{vuse_ops} @tab 64 -@item @code{stores} @tab 64 -@item @code{loads} @tab 64 -@item @code{op} @tab @code{num_ops} * 64 -@item Total size @tab 80 + 8 * @code{num_ops} bytes -@end multitable - -@itemize @bullet -@item @code{vdef_ops} -Similar to @code{def_ops} but for @code{VDEF} operators. There is -one entry per memory symbol written by this statement. This is -used to maintain the memory SSA use-def and def-def chains. - -@item @code{vuse_ops} -Similar to @code{use_ops} but for @code{VUSE} operators. There is -one entry per memory symbol loaded by this statement. This is -used to maintain the memory SSA use-def chains. - -@item @code{stores} -Bitset with all the UIDs for the symbols written-to by the -statement. This is different than @code{vdef_ops} in that all the -affected symbols are mentioned in this set. If memory -partitioning is enabled, the @code{vdef_ops} vector will refer to memory -partitions. Furthermore, no SSA information is stored in this -set. - -@item @code{loads} -Similar to @code{stores}, but for memory loads. (Note that there -is some amount of redundancy here, it should be possible to -reduce memory utilization further by removing these sets). -@end itemize - -All the other tuples are defined in terms of these three basic -ones. Each tuple will add some fields. - - -@node Class hierarchy of GIMPLE statements -@section Class hierarchy of GIMPLE statements -@cindex GIMPLE class hierarchy - -The following diagram shows the C++ inheritance hierarchy of statement -kinds, along with their relationships to @code{GSS_} values (layouts) and -@code{GIMPLE_} values (codes): - -@smallexample - gimple_statement_base - | layout: GSS_BASE - | used for 4 codes: GIMPLE_ERROR_MARK - | GIMPLE_NOP - | GIMPLE_OMP_SECTIONS_SWITCH - | GIMPLE_PREDICT - | - + gimple_statement_with_ops_base - | | (no GSS layout) - | | - | + gimple_statement_with_ops - | | | layout: GSS_WITH_OPS - | | | - | | + gcond - | | | code: GIMPLE_COND - | | | - | | + gdebug - | | | code: GIMPLE_DEBUG - | | | - | | + ggoto - | | | code: GIMPLE_GOTO - | | | - | | + glabel - | | | code: GIMPLE_LABEL - | | | - | | + gswitch - | | code: GIMPLE_SWITCH - | | - | + gimple_statement_with_memory_ops_base - | | layout: GSS_WITH_MEM_OPS_BASE - | | - | + gimple_statement_with_memory_ops - | | | layout: GSS_WITH_MEM_OPS - | | | - | | + gassign - | | | code GIMPLE_ASSIGN - | | | - | | + greturn - | | code GIMPLE_RETURN - | | - | + gcall - | | layout: GSS_CALL, code: GIMPLE_CALL - | | - | + gasm - | | layout: GSS_ASM, code: GIMPLE_ASM - | | - | + gtransaction - | layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION - | - + gimple_statement_omp - | | layout: GSS_OMP. Used for code GIMPLE_OMP_SECTION - | | - | + gomp_critical - | | layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL - | | - | + gomp_for - | | layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR - | | - | + gomp_parallel_layout - | | | layout: GSS_OMP_PARALLEL_LAYOUT - | | | - | | + gimple_statement_omp_taskreg - | | | | - | | | + gomp_parallel - | | | | code: GIMPLE_OMP_PARALLEL - | | | | - | | | + gomp_task - | | | code: GIMPLE_OMP_TASK - | | | - | | + gimple_statement_omp_target - | | code: GIMPLE_OMP_TARGET - | | - | + gomp_sections - | | layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS - | | - | + gimple_statement_omp_single_layout - | | layout: GSS_OMP_SINGLE_LAYOUT - | | - | + gomp_single - | | code: GIMPLE_OMP_SINGLE - | | - | + gomp_teams - | code: GIMPLE_OMP_TEAMS - | - + gbind - | layout: GSS_BIND, code: GIMPLE_BIND - | - + gcatch - | layout: GSS_CATCH, code: GIMPLE_CATCH - | - + geh_filter - | layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER - | - + geh_else - | layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE - | - + geh_mnt - | layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW - | - + gphi - | layout: GSS_PHI, code: GIMPLE_PHI - | - + gimple_statement_eh_ctrl - | | layout: GSS_EH_CTRL - | | - | + gresx - | | code: GIMPLE_RESX - | | - | + geh_dispatch - | code: GIMPLE_EH_DISPATCH - | - + gtry - | layout: GSS_TRY, code: GIMPLE_TRY - | - + gimple_statement_wce - | layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR - | - + gomp_continue - | layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE - | - + gomp_atomic_load - | layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD - | - + gimple_statement_omp_atomic_store_layout - | layout: GSS_OMP_ATOMIC_STORE_LAYOUT, - | code: GIMPLE_OMP_ATOMIC_STORE - | - + gomp_atomic_store - | code: GIMPLE_OMP_ATOMIC_STORE - | - + gomp_return - code: GIMPLE_OMP_RETURN -@end smallexample - - -@node GIMPLE instruction set -@section GIMPLE instruction set -@cindex GIMPLE instruction set - -The following table briefly describes the GIMPLE instruction set. - -@multitable {@code{GIMPLE_OMP_SECTIONS_SWITCH}} {High GIMPLE} {Low GIMPLE} -@item Instruction @tab High GIMPLE @tab Low GIMPLE -@item @code{GIMPLE_ASM} @tab x @tab x -@item @code{GIMPLE_ASSIGN} @tab x @tab x -@item @code{GIMPLE_BIND} @tab x @tab -@item @code{GIMPLE_CALL} @tab x @tab x -@item @code{GIMPLE_CATCH} @tab x @tab -@item @code{GIMPLE_COND} @tab x @tab x -@item @code{GIMPLE_DEBUG} @tab x @tab x -@item @code{GIMPLE_EH_FILTER} @tab x @tab -@item @code{GIMPLE_GOTO} @tab x @tab x -@item @code{GIMPLE_LABEL} @tab x @tab x -@item @code{GIMPLE_NOP} @tab x @tab x -@item @code{GIMPLE_OMP_ATOMIC_LOAD} @tab x @tab x -@item @code{GIMPLE_OMP_ATOMIC_STORE} @tab x @tab x -@item @code{GIMPLE_OMP_CONTINUE} @tab x @tab x -@item @code{GIMPLE_OMP_CRITICAL} @tab x @tab x -@item @code{GIMPLE_OMP_FOR} @tab x @tab x -@item @code{GIMPLE_OMP_MASTER} @tab x @tab x -@item @code{GIMPLE_OMP_ORDERED} @tab x @tab x -@item @code{GIMPLE_OMP_PARALLEL} @tab x @tab x -@item @code{GIMPLE_OMP_RETURN} @tab x @tab x -@item @code{GIMPLE_OMP_SECTION} @tab x @tab x -@item @code{GIMPLE_OMP_SECTIONS} @tab x @tab x -@item @code{GIMPLE_OMP_SECTIONS_SWITCH} @tab x @tab x -@item @code{GIMPLE_OMP_SINGLE} @tab x @tab x -@item @code{GIMPLE_PHI} @tab @tab x -@item @code{GIMPLE_RESX} @tab @tab x -@item @code{GIMPLE_RETURN} @tab x @tab x -@item @code{GIMPLE_SWITCH} @tab x @tab x -@item @code{GIMPLE_TRY} @tab x @tab -@end multitable - -@node GIMPLE Exception Handling -@section Exception Handling -@cindex GIMPLE Exception Handling - -Other exception handling constructs are represented using -@code{GIMPLE_TRY_CATCH}. @code{GIMPLE_TRY_CATCH} has two operands. The -first operand is a sequence of statements to execute. If executing -these statements does not throw an exception, then the second operand -is ignored. Otherwise, if an exception is thrown, then the second -operand of the @code{GIMPLE_TRY_CATCH} is checked. The second -operand may have the following forms: - -@enumerate - -@item A sequence of statements to execute. When an exception occurs, -these statements are executed, and then the exception is rethrown. - -@item A sequence of @code{GIMPLE_CATCH} statements. Each -@code{GIMPLE_CATCH} has a list of applicable exception types and -handler code. If the thrown exception matches one of the caught -types, the associated handler code is executed. If the handler -code falls off the bottom, execution continues after the original -@code{GIMPLE_TRY_CATCH}. - -@item A @code{GIMPLE_EH_FILTER} statement. This has a list of -permitted exception types, and code to handle a match failure. If the -thrown exception does not match one of the allowed types, the -associated match failure code is executed. If the thrown exception -does match, it continues unwinding the stack looking for the next -handler. - -@end enumerate - -Currently throwing an exception is not directly represented in -GIMPLE, since it is implemented by calling a function. At some -point in the future we will want to add some way to express that -the call will throw an exception of a known type. - -Just before running the optimizers, the compiler lowers the -high-level EH constructs above into a set of @samp{goto}s, magic -labels, and EH regions. Continuing to unwind at the end of a -cleanup is represented with a @code{GIMPLE_RESX}. - - -@node Temporaries -@section Temporaries -@cindex Temporaries - -When gimplification encounters a subexpression that is too -complex, it creates a new temporary variable to hold the value of -the subexpression, and adds a new statement to initialize it -before the current statement. These special temporaries are known -as @samp{expression temporaries}, and are allocated using -@code{get_formal_tmp_var}. The compiler tries to always evaluate -identical expressions into the same temporary, to simplify -elimination of redundant calculations. - -We can only use expression temporaries when we know that it will -not be reevaluated before its value is used, and that it will not -be otherwise modified@footnote{These restrictions are derived -from those in Morgan 4.8.}. Other temporaries can be allocated -using @code{get_initialized_tmp_var} or @code{create_tmp_var}. - -Currently, an expression like @code{a = b + 5} is not reduced any -further. We tried converting it to something like -@smallexample -T1 = b + 5; -a = T1; -@end smallexample -but this bloated the representation for minimal benefit. However, a -variable which must live in memory cannot appear in an expression; its -value is explicitly loaded into a temporary first. Similarly, storing -the value of an expression to a memory variable goes through a -temporary. - -@node Operands -@section Operands -@cindex Operands - -In general, expressions in GIMPLE consist of an operation and the -appropriate number of simple operands; these operands must either be a -GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register -variable. More complex operands are factored out into temporaries, so -that -@smallexample -a = b + c + d -@end smallexample -becomes -@smallexample -T1 = b + c; -a = T1 + d; -@end smallexample - -The same rule holds for arguments to a @code{GIMPLE_CALL}. - -The target of an assignment is usually a variable, but can also be a -@code{MEM_REF} or a compound lvalue as described below. - -@menu -* Compound Expressions:: -* Compound Lvalues:: -* Conditional Expressions:: -* Logical Operators:: -@end menu - -@node Compound Expressions -@subsection Compound Expressions -@cindex Compound Expressions - -The left-hand side of a C comma expression is simply moved into a separate -statement. - -@node Compound Lvalues -@subsection Compound Lvalues -@cindex Compound Lvalues - -Currently compound lvalues involving array and structure field references -are not broken down; an expression like @code{a.b[2] = 42} is not reduced -any further (though complex array subscripts are). This restriction is a -workaround for limitations in later optimizers; if we were to convert this -to - -@smallexample -T1 = &a.b; -T1[2] = 42; -@end smallexample - -alias analysis would not remember that the reference to @code{T1[2]} came -by way of @code{a.b}, so it would think that the assignment could alias -another member of @code{a}; this broke @code{struct-alias-1.c}. Future -optimizer improvements may make this limitation unnecessary. - -@node Conditional Expressions -@subsection Conditional Expressions -@cindex Conditional Expressions - -A C @code{?:} expression is converted into an @code{if} statement with -each branch assigning to the same temporary. So, - -@smallexample -a = b ? c : d; -@end smallexample -becomes -@smallexample -if (b == 1) - T1 = c; -else - T1 = d; -a = T1; -@end smallexample - -The GIMPLE level if-conversion pass re-introduces @code{?:} -expression, if appropriate. It is used to vectorize loops with -conditions using vector conditional operations. - -Note that in GIMPLE, @code{if} statements are represented using -@code{GIMPLE_COND}, as described below. - -@node Logical Operators -@subsection Logical Operators -@cindex Logical Operators - -Except when they appear in the condition operand of a -@code{GIMPLE_COND}, logical `and' and `or' operators are simplified -as follows: @code{a = b && c} becomes - -@smallexample -T1 = (bool)b; -if (T1 == true) - T1 = (bool)c; -a = T1; -@end smallexample - -Note that @code{T1} in this example cannot be an expression temporary, -because it has two different assignments. - -@subsection Manipulating operands - -All gimple operands are of type @code{tree}. But only certain -types of trees are allowed to be used as operand tuples. Basic -validation is controlled by the function -@code{get_gimple_rhs_class}, which given a tree code, returns an -@code{enum} with the following values of type @code{enum -gimple_rhs_class} - -@itemize @bullet -@item @code{GIMPLE_INVALID_RHS} -The tree cannot be used as a GIMPLE operand. - -@item @code{GIMPLE_TERNARY_RHS} -The tree is a valid GIMPLE ternary operation. - -@item @code{GIMPLE_BINARY_RHS} -The tree is a valid GIMPLE binary operation. - -@item @code{GIMPLE_UNARY_RHS} -The tree is a valid GIMPLE unary operation. - -@item @code{GIMPLE_SINGLE_RHS} -The tree is a single object, that cannot be split into simpler -operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc). - -This operand class also acts as an escape hatch for tree nodes -that may be flattened out into the operand vector, but would need -more than two slots on the RHS. For instance, a @code{COND_EXPR} -expression of the form @code{(a op b) ? x : y} could be flattened -out on the operand vector using 4 slots, but it would also -require additional processing to distinguish @code{c = a op b} -from @code{c = a op b ? x : y}. Something similar occurs with -@code{ASSERT_EXPR}. In time, these special case tree -expressions should be flattened into the operand vector. -@end itemize - -For tree nodes in the categories @code{GIMPLE_TERNARY_RHS}, -@code{GIMPLE_BINARY_RHS} and @code{GIMPLE_UNARY_RHS}, they cannot be -stored inside tuples directly. They first need to be flattened and -separated into individual components. For instance, given the GENERIC -expression - -@smallexample -a = b + c -@end smallexample - -its tree representation is: - -@smallexample -MODIFY_EXPR , PLUS_EXPR , VAR_DECL >> -@end smallexample - -In this case, the GIMPLE form for this statement is logically -identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR} -on the RHS of the assignment is not represented as a tree, -instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree -and flattened into the GIMPLE tuple as follows: - -@smallexample -GIMPLE_ASSIGN , VAR_DECL , VAR_DECL > -@end smallexample - -@subsection Operand vector allocation - -The operand vector is stored at the bottom of the three tuple -structures that accept operands. This means, that depending on -the code of a given statement, its operand vector will be at -different offsets from the base of the structure. To access -tuple operands use the following accessors - -@deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g) -Returns the number of operands in statement G. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i) -Returns operand @code{I} from statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g) -Returns a pointer into the operand vector for statement @code{G}. This -is computed using an internal table called @code{gimple_ops_offset_}[]. -This table is indexed by the gimple code of @code{G}. - -When the compiler is built, this table is filled-in using the -sizes of the structures used by each statement code defined in -gimple.def. Since the operand vector is at the bottom of the -structure, for a gimple code @code{C} the offset is computed as sizeof -(struct-of @code{C}) - sizeof (tree). - -This mechanism adds one memory indirection to every access when -using @code{gimple_op}(), if this becomes a bottleneck, a pass can -choose to memoize the result from @code{gimple_ops}() and use that to -access the operands. -@end deftypefn - -@subsection Operand validation - -When adding a new operand to a gimple statement, the operand will -be validated according to what each tuple accepts in its operand -vector. These predicates are called by the -@code{gimple_@var{name}_set_...()}. Each tuple will use one of the -following predicates (Note, this list is not exhaustive): - -@deftypefn {GIMPLE function} bool is_gimple_val (tree t) -Returns true if t is a "GIMPLE value", which are all the -non-addressable stack variables (variables for which -@code{is_gimple_reg} returns true) and constants (expressions for which -@code{is_gimple_min_invariant} returns true). -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_addressable (tree t) -Returns true if t is a symbol or memory reference whose address -can be taken. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_asm_val (tree t) -Similar to @code{is_gimple_val} but it also accepts hard registers. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_call_addr (tree t) -Return true if t is a valid expression to use as the function -called by a @code{GIMPLE_CALL}. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_mem_ref_addr (tree t) -Return true if t is a valid expression to use as first operand -of a @code{MEM_REF} expression. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_constant (tree t) -Return true if t is a valid gimple constant. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_min_invariant (tree t) -Return true if t is a valid minimal invariant. This is different -from constants, in that the specific value of t may not be known -at compile time, but it is known that it doesn't change (e.g., -the address of a function local variable). -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_ip_invariant (tree t) -Return true if t is an interprocedural invariant. This means that t -is a valid invariant in all functions (e.g. it can be an address of a -global variable but not of a local one). -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_ip_invariant_address (tree t) -Return true if t is an @code{ADDR_EXPR} that does not change once the -program is running (and which is valid in all functions). -@end deftypefn - - -@subsection Statement validation - -@deftypefn {GIMPLE function} bool is_gimple_assign (gimple g) -Return true if the code of g is @code{GIMPLE_ASSIGN}. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_call (gimple g) -Return true if the code of g is @code{GIMPLE_CALL}. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_debug (gimple g) -Return true if the code of g is @code{GIMPLE_DEBUG}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_assign_cast_p (const_gimple g) -Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast -operation. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_debug_bind_p (gimple g) -Return true if g is a @code{GIMPLE_DEBUG} that binds the value of an -expression to a variable. -@end deftypefn - -@deftypefn {GIMPLE function} bool is_gimple_omp (gimple g) -Return true if g is any of the OpenMP codes. -@end deftypefn - -@node Manipulating GIMPLE statements -@section Manipulating GIMPLE statements -@cindex Manipulating GIMPLE statements - -This section documents all the functions available to handle each -of the GIMPLE instructions. - -@subsection Common accessors -The following are common accessors for gimple statements. - -@deftypefn {GIMPLE function} {enum gimple_code} gimple_code (gimple g) -Return the code for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} basic_block gimple_bb (gimple g) -Return the basic block to which statement @code{G} belongs to. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_block (gimple g) -Return the lexical scope block holding statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt) -Return the type of the main expression computed by @code{STMT}. Return -@code{void_type_node} if @code{STMT} computes nothing. This will only return -something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and -@code{GIMPLE_CALL}. For all other tuple codes, it will return -@code{void_type_node}. -@end deftypefn - -@deftypefn {GIMPLE function} {enum tree_code} gimple_expr_code (gimple stmt) -Return the tree code for the expression computed by @code{STMT}. This -is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and -@code{GIMPLE_COND}. If @code{STMT} is @code{GIMPLE_CALL}, it will return @code{CALL_EXPR}. -For @code{GIMPLE_COND}, it returns the code of the comparison predicate. -For @code{GIMPLE_ASSIGN} it returns the code of the operation performed -by the @code{RHS} of the assignment. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_block (gimple g, tree block) -Set the lexical scope block of @code{G} to @code{BLOCK}. -@end deftypefn - -@deftypefn {GIMPLE function} location_t gimple_locus (gimple g) -Return locus information for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus) -Set locus information for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_locus_empty_p (gimple g) -Return true if @code{G} does not have locus information. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_no_warning_p (gimple stmt) -Return true if no warnings should be emitted for statement @code{STMT}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_visited (gimple stmt, bool visited_p) -Set the visited status on statement @code{STMT} to @code{VISITED_P}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt) -Return the visited status on statement @code{STMT}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p) -Set pass local flag @code{PLF} on statement @code{STMT} to @code{VAL_P}. -@end deftypefn - -@deftypefn {GIMPLE function} {unsigned int} gimple_plf (gimple stmt, enum plf_mask plf) -Return the value of pass local flag @code{PLF} on statement @code{STMT}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_has_ops (gimple g) -Return true if statement @code{G} has register or memory operands. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g) -Return true if statement @code{G} has memory operands. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g) -Return the number of operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g) -Return the array of operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i) -Return operand @code{I} for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_op_ptr (gimple g, unsigned i) -Return a pointer to operand @code{I} for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_op (gimple g, unsigned i, tree op) -Set operand @code{I} of statement @code{G} to @code{OP}. -@end deftypefn - -@deftypefn {GIMPLE function} bitmap gimple_addresses_taken (gimple stmt) -Return the set of symbols that have had their address taken by -@code{STMT}. -@end deftypefn - -@deftypefn {GIMPLE function} {struct def_optype_d *} gimple_def_ops (gimple g) -Return the set of @code{DEF} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_def_ops (gimple g, struct def_optype_d *def) -Set @code{DEF} to be the set of @code{DEF} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {struct use_optype_d *} gimple_use_ops (gimple g) -Return the set of @code{USE} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_use_ops (gimple g, struct use_optype_d *use) -Set @code{USE} to be the set of @code{USE} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {struct voptype_d *} gimple_vuse_ops (gimple g) -Return the set of @code{VUSE} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_vuse_ops (gimple g, struct voptype_d *ops) -Set @code{OPS} to be the set of @code{VUSE} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {struct voptype_d *} gimple_vdef_ops (gimple g) -Return the set of @code{VDEF} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_vdef_ops (gimple g, struct voptype_d *ops) -Set @code{OPS} to be the set of @code{VDEF} operands for statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} bitmap gimple_loaded_syms (gimple g) -Return the set of symbols loaded by statement @code{G}. Each element of -the set is the @code{DECL_UID} of the corresponding symbol. -@end deftypefn - -@deftypefn {GIMPLE function} bitmap gimple_stored_syms (gimple g) -Return the set of symbols stored by statement @code{G}. Each element of -the set is the @code{DECL_UID} of the corresponding symbol. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_modified_p (gimple g) -Return true if statement @code{G} has operands and the modified field -has been set. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt) -Return true if statement @code{STMT} contains volatile operands. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_set_has_volatile_ops (gimple stmt, bool volatilep) -Return true if statement @code{STMT} contains volatile operands. -@end deftypefn - -@deftypefn {GIMPLE function} void update_stmt (gimple s) -Mark statement @code{S} as modified, and update it. -@end deftypefn - -@deftypefn {GIMPLE function} void update_stmt_if_modified (gimple s) -Update statement @code{S} if it has been marked modified. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt) -Return a deep copy of statement @code{STMT}. -@end deftypefn - -@node Tuple specific accessors -@section Tuple specific accessors -@cindex Tuple specific accessors - -@menu -* @code{GIMPLE_ASM}:: -* @code{GIMPLE_ASSIGN}:: -* @code{GIMPLE_BIND}:: -* @code{GIMPLE_CALL}:: -* @code{GIMPLE_CATCH}:: -* @code{GIMPLE_COND}:: -* @code{GIMPLE_DEBUG}:: -* @code{GIMPLE_EH_FILTER}:: -* @code{GIMPLE_LABEL}:: -* @code{GIMPLE_GOTO}:: -* @code{GIMPLE_NOP}:: -* @code{GIMPLE_OMP_ATOMIC_LOAD}:: -* @code{GIMPLE_OMP_ATOMIC_STORE}:: -* @code{GIMPLE_OMP_CONTINUE}:: -* @code{GIMPLE_OMP_CRITICAL}:: -* @code{GIMPLE_OMP_FOR}:: -* @code{GIMPLE_OMP_MASTER}:: -* @code{GIMPLE_OMP_ORDERED}:: -* @code{GIMPLE_OMP_PARALLEL}:: -* @code{GIMPLE_OMP_RETURN}:: -* @code{GIMPLE_OMP_SECTION}:: -* @code{GIMPLE_OMP_SECTIONS}:: -* @code{GIMPLE_OMP_SINGLE}:: -* @code{GIMPLE_PHI}:: -* @code{GIMPLE_RESX}:: -* @code{GIMPLE_RETURN}:: -* @code{GIMPLE_SWITCH}:: -* @code{GIMPLE_TRY}:: -* @code{GIMPLE_WITH_CLEANUP_EXPR}:: -@end menu - - -@node @code{GIMPLE_ASM} -@subsection @code{GIMPLE_ASM} -@cindex @code{GIMPLE_ASM} - -@deftypefn {GIMPLE function} gasm *gimple_build_asm_vec ( @ -const char *string, vec *inputs, @ -vec *outputs, vec *clobbers, @ -vec *labels) -Build a @code{GIMPLE_ASM} statement. This statement is used for -building in-line assembly constructs. @code{STRING} is the assembly -code. @code{INPUTS}, @code{OUTPUTS}, @code{CLOBBERS} and @code{LABELS} -are the inputs, outputs, clobbered registers and labels. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_asm_ninputs (const gasm *g) -Return the number of input operands for @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_asm_noutputs (const gasm *g) -Return the number of output operands for @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_asm_nclobbers (const gasm *g) -Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_asm_input_op (const gasm *g, @ -unsigned index) -Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_asm_set_input_op (gasm *g, @ -unsigned index, tree in_op) -Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_asm_output_op (const gasm *g, @ -unsigned index) -Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_asm_set_output_op (gasm *g, @ -unsigned index, tree out_op) -Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_asm_clobber_op (const gasm *g, @ -unsigned index) -Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gasm *g, @ -unsigned index, tree clobber_op) -Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {const char *} gimple_asm_string (const gasm *g) -Return the string representing the assembly instruction in -@code{GIMPLE_ASM} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_asm_volatile_p (const gasm *g) -Return true if @code{G} is an asm statement marked volatile. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_asm_set_volatile (gasm *g, @ -bool volatile_p) -Mark asm statement @code{G} as volatile or non-volatile based on -@code{VOLATILE_P}. -@end deftypefn - -@node @code{GIMPLE_ASSIGN} -@subsection @code{GIMPLE_ASSIGN} -@cindex @code{GIMPLE_ASSIGN} - -@deftypefn {GIMPLE function} gassign *gimple_build_assign (tree lhs, tree rhs) -Build a @code{GIMPLE_ASSIGN} statement. The left-hand side is an lvalue -passed in lhs. The right-hand side can be either a unary or -binary tree expression. The expression tree rhs will be -flattened and its operands assigned to the corresponding operand -slots in the new statement. This function is useful when you -already have a tree expression that you want to convert into a -tuple. However, try to avoid building expression trees for the -sole purpose of calling this function. If you already have the -operands in separate trees, it is better to use -@code{gimple_build_assign} with @code{enum tree_code} argument and separate -arguments for each operand. -@end deftypefn - -@deftypefn {GIMPLE function} gassign *gimple_build_assign @ -(tree lhs, enum tree_code subcode, tree op1, tree op2, tree op3) -This function is similar to two operand @code{gimple_build_assign}, -but is used to build a @code{GIMPLE_ASSIGN} statement when the operands of the -right-hand side of the assignment are already split into -different operands. - -The left-hand side is an lvalue passed in lhs. Subcode is the -@code{tree_code} for the right-hand side of the assignment. Op1, op2 and op3 -are the operands. -@end deftypefn - -@deftypefn {GIMPLE function} gassign *gimple_build_assign @ -(tree lhs, enum tree_code subcode, tree op1, tree op2) -Like the above 5 operand @code{gimple_build_assign}, but with the last -argument @code{NULL} - this overload should not be used for -@code{GIMPLE_TERNARY_RHS} assignments. -@end deftypefn - -@deftypefn {GIMPLE function} gassign *gimple_build_assign @ -(tree lhs, enum tree_code subcode, tree op1) -Like the above 4 operand @code{gimple_build_assign}, but with the last -argument @code{NULL} - this overload should be used only for -@code{GIMPLE_UNARY_RHS} and @code{GIMPLE_SINGLE_RHS} assignments. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p) -Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of -@code{*SEQ_P}. -@end deftypefn - -@code{DST}/@code{SRC} are the destination and source respectively. You can -pass ungimplified trees in @code{DST} or @code{SRC}, in which -case they will be converted to a gimple operand if necessary. - -This function returns the newly created @code{GIMPLE_ASSIGN} tuple. - -@deftypefn {GIMPLE function} {enum tree_code} gimple_assign_rhs_code (gimple g) -Return the code of the expression computed on the @code{RHS} of -assignment statement @code{G}. -@end deftypefn - - -@deftypefn {GIMPLE function} {enum gimple_rhs_class} gimple_assign_rhs_class (gimple g) -Return the gimple rhs class of the code for the expression -computed on the rhs of assignment statement @code{G}. This will never -return @code{GIMPLE_INVALID_RHS}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g) -Return the @code{LHS} of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_assign_lhs_ptr (gimple g) -Return a pointer to the @code{LHS} of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g) -Return the first operand on the @code{RHS} of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_assign_rhs1_ptr (gimple g) -Return the address of the first operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g) -Return the second operand on the @code{RHS} of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_assign_rhs2_ptr (gimple g) -Return the address of the second operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_assign_rhs3 (gimple g) -Return the third operand on the @code{RHS} of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_assign_rhs3_ptr (gimple g) -Return the address of the third operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs) -Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs) -Set @code{RHS} to be the first operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs) -Set @code{RHS} to be the second operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_assign_set_rhs3 (gimple g, tree rhs) -Set @code{RHS} to be the third operand on the @code{RHS} of assignment -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_assign_cast_p (const_gimple s) -Return true if @code{S} is a type-cast assignment. -@end deftypefn - - -@node @code{GIMPLE_BIND} -@subsection @code{GIMPLE_BIND} -@cindex @code{GIMPLE_BIND} - -@deftypefn {GIMPLE function} gbind *gimple_build_bind (tree vars, @ -gimple_seq body) -Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS} -and a body of statements in sequence @code{BODY}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_bind_vars (const gbind *g) -Return the variables declared in the @code{GIMPLE_BIND} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_set_vars (gbind *g, tree vars) -Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND} -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_append_vars (gbind *g, tree vars) -Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND} -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gbind *g) -Return the GIMPLE sequence contained in the @code{GIMPLE_BIND} statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_set_body (gbind *g, @ -gimple_seq seq) -Set @code{SEQ} to be sequence contained in the @code{GIMPLE_BIND} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_add_stmt (gbind *gs, gimple stmt) -Append a statement to the end of a @code{GIMPLE_BIND}'s body. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_add_seq (gbind *gs, @ -gimple_seq seq) -Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s -body. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_bind_block (const gbind *g) -Return the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} statement -@code{G}. This is analogous to the @code{BIND_EXPR_BLOCK} field in trees. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_bind_set_block (gbind *g, tree block) -Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} -statement @code{G}. -@end deftypefn - - -@node @code{GIMPLE_CALL} -@subsection @code{GIMPLE_CALL} -@cindex @code{GIMPLE_CALL} - -@deftypefn {GIMPLE function} gcall *gimple_build_call (tree fn, @ -unsigned nargs, ...) -Build a @code{GIMPLE_CALL} statement to function @code{FN}. The argument @code{FN} -must be either a @code{FUNCTION_DECL} or a gimple call address as -determined by @code{is_gimple_call_addr}. @code{NARGS} are the number of -arguments. The rest of the arguments follow the argument @code{NARGS}, -and must be trees that are valid as rvalues in gimple (i.e., each -operand is validated with @code{is_gimple_operand}). -@end deftypefn - - -@deftypefn {GIMPLE function} gcall *gimple_build_call_from_tree (tree call_expr) -Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node. The arguments and the -function are taken from the expression directly. This routine -assumes that @code{call_expr} is already in GIMPLE form. That is, its -operands are GIMPLE values and the function call needs no further -simplification. All the call flags in @code{call_expr} are copied over -to the new @code{GIMPLE_CALL}. -@end deftypefn - -@deftypefn {GIMPLE function} gcall *gimple_build_call_vec (tree fn, @ -@code{vec} args) -Identical to @code{gimple_build_call} but the arguments are stored in a -@code{vec}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_lhs (gimple g) -Return the @code{LHS} of call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_call_lhs_ptr (gimple g) -Return a pointer to the @code{LHS} of call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_call_set_lhs (gimple g, tree lhs) -Set @code{LHS} to be the @code{LHS} operand of call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_fn (gimple g) -Return the tree node representing the function called by call -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_call_set_fn (gcall *g, tree fn) -Set @code{FN} to be the function called by call statement @code{G}. This has -to be a gimple value specifying the address of the called -function. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g) -If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it. -Otherwise return @code{NULL}. This function is analogous to -@code{get_callee_fndecl} in @code{GENERIC}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_set_fndecl (gimple g, tree fndecl) -Set the called function to @code{FNDECL}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_return_type (const gcall *g) -Return the type returned by call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_chain (gimple g) -Return the static chain for call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_call_set_chain (gcall *g, tree chain) -Set @code{CHAIN} to be the static chain for call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_call_num_args (gimple g) -Return the number of arguments used by call statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_call_arg (gimple g, unsigned index) -Return the argument at position @code{INDEX} for call statement @code{G}. The -first argument is 0. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_call_arg_ptr (gimple g, unsigned index) -Return a pointer to the argument at position @code{INDEX} for call -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg) -Set @code{ARG} to be the argument at position @code{INDEX} for call statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_call_set_tail (gcall *s) -Mark call statement @code{S} as being a tail call (i.e., a call just -before the exit of a function). These calls are candidate for -tail call optimization. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_call_tail_p (gcall *s) -Return true if @code{GIMPLE_CALL} @code{S} is marked as a tail call. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_call_noreturn_p (gimple s) -Return true if @code{S} is a noreturn call. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gimple_call_copy_skip_args (gcall *stmt, @ -bitmap args_to_skip) -Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments -in the positions marked by the set @code{ARGS_TO_SKIP}. -@end deftypefn - - -@node @code{GIMPLE_CATCH} -@subsection @code{GIMPLE_CATCH} -@cindex @code{GIMPLE_CATCH} - -@deftypefn {GIMPLE function} gcatch *gimple_build_catch (tree types, @ -gimple_seq handler) -Build a @code{GIMPLE_CATCH} statement. @code{TYPES} are the tree types this -catch handles. @code{HANDLER} is a sequence of statements with the code -for the handler. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_catch_types (const gcatch *g) -Return the types handled by @code{GIMPLE_CATCH} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_catch_types_ptr (gcatch *g) -Return a pointer to the types handled by @code{GIMPLE_CATCH} statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_catch_handler (gcatch *g) -Return the GIMPLE sequence representing the body of the handler -of @code{GIMPLE_CATCH} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_catch_set_types (gcatch *g, tree t) -Set @code{T} to be the set of types handled by @code{GIMPLE_CATCH} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_catch_set_handler (gcatch *g, @ -gimple_seq handler) -Set @code{HANDLER} to be the body of @code{GIMPLE_CATCH} @code{G}. -@end deftypefn - - -@node @code{GIMPLE_COND} -@subsection @code{GIMPLE_COND} -@cindex @code{GIMPLE_COND} - -@deftypefn {GIMPLE function} gcond *gimple_build_cond ( @ -enum tree_code pred_code, tree lhs, tree rhs, tree t_label, tree f_label) -Build a @code{GIMPLE_COND} statement. @code{A} @code{GIMPLE_COND} statement compares -@code{LHS} and @code{RHS} and if the condition in @code{PRED_CODE} is true, jump to -the label in @code{t_label}, otherwise jump to the label in @code{f_label}. -@code{PRED_CODE} are relational operator tree codes like @code{EQ_EXPR}, -@code{LT_EXPR}, @code{LE_EXPR}, @code{NE_EXPR}, etc. -@end deftypefn - - -@deftypefn {GIMPLE function} gcond *gimple_build_cond_from_tree (tree cond, @ -tree t_label, tree f_label) -Build a @code{GIMPLE_COND} statement from the conditional expression -tree @code{COND}. @code{T_LABEL} and @code{F_LABEL} are as in @code{gimple_build_cond}. -@end deftypefn - -@deftypefn {GIMPLE function} {enum tree_code} gimple_cond_code (gimple g) -Return the code of the predicate computed by conditional -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_set_code (gcond *g, @ -enum tree_code code) -Set @code{CODE} to be the predicate code for the conditional statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_cond_lhs (gimple g) -Return the @code{LHS} of the predicate computed by conditional statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_set_lhs (gcond *g, tree lhs) -Set @code{LHS} to be the @code{LHS} operand of the predicate computed by -conditional statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g) -Return the @code{RHS} operand of the predicate computed by conditional -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_set_rhs (gcond *g, tree rhs) -Set @code{RHS} to be the @code{RHS} operand of the predicate computed by -conditional statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_cond_true_label (const gcond *g) -Return the label used by conditional statement @code{G} when its -predicate evaluates to true. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_set_true_label (gcond *g, tree label) -Set @code{LABEL} to be the label used by conditional statement @code{G} when -its predicate evaluates to true. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_set_false_label (gcond *g, tree label) -Set @code{LABEL} to be the label used by conditional statement @code{G} when -its predicate evaluates to false. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_cond_false_label (const gcond *g) -Return the label used by conditional statement @code{G} when its -predicate evaluates to false. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_make_false (gcond *g) -Set the conditional @code{COND_STMT} to be of the form 'if (1 == 0)'. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_cond_make_true (gcond *g) -Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'. -@end deftypefn - -@node @code{GIMPLE_DEBUG} -@subsection @code{GIMPLE_DEBUG} -@cindex @code{GIMPLE_DEBUG} -@cindex @code{GIMPLE_DEBUG_BIND} - -@deftypefn {GIMPLE function} gdebug *gimple_build_debug_bind (tree var, @ -tree value, gimple stmt) -Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of -@code{subcode}. The effect of this statement is to tell debug -information generation machinery that the value of user variable -@code{var} is given by @code{value} at that point, and to remain with -that value until @code{var} runs out of scope, a -dynamically-subsequent debug bind statement overrides the binding, or -conflicting values reach a control flow merge point. Even if -components of the @code{value} expression change afterwards, the -variable is supposed to retain the same value, though not necessarily -the same location. - -It is expected that @code{var} be most often a tree for automatic user -variables (@code{VAR_DECL} or @code{PARM_DECL}) that satisfy the -requirements for gimple registers, but it may also be a tree for a -scalarized component of a user variable (@code{ARRAY_REF}, -@code{COMPONENT_REF}), or a debug temporary (@code{DEBUG_EXPR_DECL}). - -As for @code{value}, it can be an arbitrary tree expression, but it is -recommended that it be in a suitable form for a gimple assignment -@code{RHS}. It is not expected that user variables that could appear -as @code{var} ever appear in @code{value}, because in the latter we'd -have their @code{SSA_NAME}s instead, but even if they were not in SSA -form, user variables appearing in @code{value} are to be regarded as -part of the executable code space, whereas those in @code{var} are to -be regarded as part of the source code space. There is no way to -refer to the value bound to a user variable within a @code{value} -expression. - -If @code{value} is @code{GIMPLE_DEBUG_BIND_NOVALUE}, debug information -generation machinery is informed that the variable @code{var} is -unbound, i.e., that its value is indeterminate, which sometimes means -it is really unavailable, and other times that the compiler could not -keep track of it. - -Block and location information for the newly-created stmt are -taken from @code{stmt}, if given. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_debug_bind_get_var (gimple stmt) -Return the user variable @var{var} that is bound at @code{stmt}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_debug_bind_get_value (gimple stmt) -Return the value expression that is bound to a user variable at -@code{stmt}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_debug_bind_get_value_ptr (gimple stmt) -Return a pointer to the value expression that is bound to a user -variable at @code{stmt}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_debug_bind_set_var (gimple stmt, tree var) -Modify the user variable bound at @code{stmt} to @var{var}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_debug_bind_set_value (gimple stmt, tree var) -Modify the value bound to the user variable bound at @code{stmt} to -@var{value}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_debug_bind_reset_value (gimple stmt) -Modify the value bound to the user variable bound at @code{stmt} so -that the variable becomes unbound. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_debug_bind_has_value_p (gimple stmt) -Return @code{TRUE} if @code{stmt} binds a user variable to a value, -and @code{FALSE} if it unbinds the variable. -@end deftypefn - -@node @code{GIMPLE_EH_FILTER} -@subsection @code{GIMPLE_EH_FILTER} -@cindex @code{GIMPLE_EH_FILTER} - -@deftypefn {GIMPLE function} geh_filter *gimple_build_eh_filter (tree types, @ -gimple_seq failure) -Build a @code{GIMPLE_EH_FILTER} statement. @code{TYPES} are the filter's -types. @code{FAILURE} is a sequence with the filter's failure action. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g) -Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_eh_filter_types_ptr (gimple g) -Return a pointer to the types handled by @code{GIMPLE_EH_FILTER} -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g) -Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER} -statement fails. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_eh_filter_set_types (geh_filter *g, @ -tree types) -Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (geh_filter *g, @ -gimple_seq failure) -Set @code{FAILURE} to be the sequence of statements to execute on -failure for @code{GIMPLE_EH_FILTER} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_eh_must_not_throw_fndecl ( @ -geh_mnt *eh_mnt_stmt) -Get the function decl to be called by the MUST_NOT_THROW region. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_eh_must_not_throw_set_fndecl ( @ -geh_mnt *eh_mnt_stmt, tree decl) -Set the function decl to be called by GS to DECL. -@end deftypefn - - -@node @code{GIMPLE_LABEL} -@subsection @code{GIMPLE_LABEL} -@cindex @code{GIMPLE_LABEL} - -@deftypefn {GIMPLE function} glabel *gimple_build_label (tree label) -Build a @code{GIMPLE_LABEL} statement with corresponding to the tree -label, @code{LABEL}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_label_label (const glabel *g) -Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_label_set_label (glabel *g, tree label) -Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} -statement @code{G}. -@end deftypefn - -@node @code{GIMPLE_GOTO} -@subsection @code{GIMPLE_GOTO} -@cindex @code{GIMPLE_GOTO} - -@deftypefn {GIMPLE function} ggoto *gimple_build_goto (tree dest) -Build a @code{GIMPLE_GOTO} statement to label @code{DEST}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g) -Return the destination of the unconditional jump @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_goto_set_dest (ggoto *g, tree dest) -Set @code{DEST} to be the destination of the unconditional jump @code{G}. -@end deftypefn - - -@node @code{GIMPLE_NOP} -@subsection @code{GIMPLE_NOP} -@cindex @code{GIMPLE_NOP} - -@deftypefn {GIMPLE function} gimple gimple_build_nop (void) -Build a @code{GIMPLE_NOP} statement. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_nop_p (gimple g) -Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}. -@end deftypefn - -@node @code{GIMPLE_OMP_ATOMIC_LOAD} -@subsection @code{GIMPLE_OMP_ATOMIC_LOAD} -@cindex @code{GIMPLE_OMP_ATOMIC_LOAD} - -@deftypefn {GIMPLE function} gomp_atomic_load *gimple_build_omp_atomic_load ( @ -tree lhs, tree rhs) -Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement. @code{LHS} is the left-hand -side of the assignment. @code{RHS} is the right-hand side of the -assignment. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs ( @ -gomp_atomic_load *g, tree lhs) -Set the @code{LHS} of an atomic load. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs ( @ -const gomp_atomic_load *g) -Get the @code{LHS} of an atomic load. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs ( @ -gomp_atomic_load *g, tree rhs) -Set the @code{RHS} of an atomic set. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs ( @ -const gomp_atomic_load *g) -Get the @code{RHS} of an atomic set. -@end deftypefn - - -@node @code{GIMPLE_OMP_ATOMIC_STORE} -@subsection @code{GIMPLE_OMP_ATOMIC_STORE} -@cindex @code{GIMPLE_OMP_ATOMIC_STORE} - -@deftypefn {GIMPLE function} gomp_atomic_store *gimple_build_omp_atomic_store ( @ -tree val) -Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be -stored. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val ( @ -gomp_atomic_store *g, tree val) -Set the value being stored in an atomic store. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val ( @ -const gomp_atomic_store *g) -Return the value being stored in an atomic store. -@end deftypefn - -@node @code{GIMPLE_OMP_CONTINUE} -@subsection @code{GIMPLE_OMP_CONTINUE} -@cindex @code{GIMPLE_OMP_CONTINUE} - -@deftypefn {GIMPLE function} gomp_continue *gimple_build_omp_continue ( @ -tree control_def, tree control_use) -Build a @code{GIMPLE_OMP_CONTINUE} statement. @code{CONTROL_DEF} is the -definition of the control variable. @code{CONTROL_USE} is the use of -the control variable. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_control_def ( @ -const gomp_continue *s) -Return the definition of the control variable on a -@code{GIMPLE_OMP_CONTINUE} in @code{S}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr ( @ -gomp_continue *s) -Same as above, but return the pointer. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def ( @ -gomp_continue *s) -Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE} -statement in @code{S}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_control_use ( @ -const gomp_continue *s) -Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE} -in @code{S}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr ( @ -gomp_continue *s) -Same as above, but return the pointer. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use ( @ -gomp_continue *s) -Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement -in @code{S}. -@end deftypefn - - -@node @code{GIMPLE_OMP_CRITICAL} -@subsection @code{GIMPLE_OMP_CRITICAL} -@cindex @code{GIMPLE_OMP_CRITICAL} - -@deftypefn {GIMPLE function} gomp_critical *gimple_build_omp_critical ( @ -gimple_seq body, tree name) -Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of -statements for which only one thread can execute. @code{NAME} is an -optional identifier for this critical block. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_critical_name ( @ -const gomp_critical *g) -Return the name associated with @code{OMP_CRITICAL} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_critical_name_ptr ( @ -gomp_critical *g) -Return a pointer to the name associated with @code{OMP} critical -statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_critical_set_name ( @ -gomp_critical *g, tree name) -Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}. -@end deftypefn - -@node @code{GIMPLE_OMP_FOR} -@subsection @code{GIMPLE_OMP_FOR} -@cindex @code{GIMPLE_OMP_FOR} - -@deftypefn {GIMPLE function} gomp_for *gimple_build_omp_for (gimple_seq body, @ -tree clauses, tree index, tree initial, tree final, tree incr, @ -gimple_seq pre_body, enum tree_code omp_for_cond) -Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements -inside the for loop. @code{CLAUSES}, are any of the loop -construct's clauses. @code{PRE_BODY} is the -sequence of statements that are loop invariant. @code{INDEX} is the -index variable. @code{INITIAL} is the initial value of @code{INDEX}. @code{FINAL} is -final value of @code{INDEX}. OMP_FOR_COND is the predicate used to -compare @code{INDEX} and @code{FINAL}. @code{INCR} is the increment expression. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g) -Return the clauses associated with @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_for_clauses_ptr (gimple g) -Return a pointer to the @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses) -Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g) -Return the index variable for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_for_index_ptr (gimple g) -Return a pointer to the index variable for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index) -Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g) -Return the initial value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_for_initial_ptr (gimple g) -Return a pointer to the initial value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial) -Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g) -Return the final value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_for_final_ptr (gimple g) -turn a pointer to the final value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final) -Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g) -Return the increment value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_for_incr_ptr (gimple g) -Return a pointer to the increment value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr) -Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g) -Return the sequence of statements to execute before the @code{OMP_FOR} -statement @code{G} starts. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body) -Set @code{PRE_BODY} to be the sequence of statements to execute before -the @code{OMP_FOR} statement @code{G} starts. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond) -Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {enum tree_code} gimple_omp_for_cond (gimple g) -Return the condition code associated with @code{OMP_FOR} @code{G}. -@end deftypefn - - -@node @code{GIMPLE_OMP_MASTER} -@subsection @code{GIMPLE_OMP_MASTER} -@cindex @code{GIMPLE_OMP_MASTER} - -@deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body) -Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of -statements to be executed by just the master. -@end deftypefn - - -@node @code{GIMPLE_OMP_ORDERED} -@subsection @code{GIMPLE_OMP_ORDERED} -@cindex @code{GIMPLE_OMP_ORDERED} - -@deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body) -Build a @code{GIMPLE_OMP_ORDERED} statement. -@end deftypefn - -@code{BODY} is the sequence of statements inside a loop that will -executed in sequence. - - -@node @code{GIMPLE_OMP_PARALLEL} -@subsection @code{GIMPLE_OMP_PARALLEL} -@cindex @code{GIMPLE_OMP_PARALLEL} - -@deftypefn {GIMPLE function} gomp_parallel *gimple_build_omp_parallel (@ -gimple_seq body, tree clauses, tree child_fn, tree data_arg) -Build a @code{GIMPLE_OMP_PARALLEL} statement. -@end deftypefn - -@code{BODY} is sequence of statements which are executed in parallel. -@code{CLAUSES}, are the @code{OMP} parallel construct's clauses. @code{CHILD_FN} is -the function created for the parallel threads to execute. -@code{DATA_ARG} are the shared data argument(s). - -@deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g) -Return true if @code{OMP} parallel statement @code{G} has the -@code{GF_OMP_PARALLEL_COMBINED} flag set. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g) -Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g) -Return the body for the @code{OMP} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body) -Set @code{BODY} to be the body for the @code{OMP} statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g) -Return the clauses associated with @code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_clauses_ptr ( @ -gomp_parallel *g) -Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses ( @ -gomp_parallel *g, tree clauses) -Set @code{CLAUSES} to be the list of clauses associated with -@code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn ( @ -const gomp_parallel *g) -Return the child function used to hold the body of @code{OMP_PARALLEL} -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_child_fn_ptr ( @ -gomp_parallel *g) -Return a pointer to the child function used to hold the body of -@code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn ( @ -gomp_parallel *g, tree child_fn) -Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg ( @ -const gomp_parallel *g) -Return the artificial argument used to send variables and values -from the parent to the children threads in @code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_data_arg_ptr ( @ -gomp_parallel *g) -Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg ( @ -gomp_parallel *g, tree data_arg) -Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}. -@end deftypefn - - -@node @code{GIMPLE_OMP_RETURN} -@subsection @code{GIMPLE_OMP_RETURN} -@cindex @code{GIMPLE_OMP_RETURN} - -@deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p) -Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a -non-waiting return. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s) -Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}. -@end deftypefn - - -@deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g) -Return true if @code{OMP} return statement @code{G} has the -@code{GF_OMP_RETURN_NOWAIT} flag set. -@end deftypefn - -@node @code{GIMPLE_OMP_SECTION} -@subsection @code{GIMPLE_OMP_SECTION} -@cindex @code{GIMPLE_OMP_SECTION} - -@deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body) -Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement. -@end deftypefn - -@code{BODY} is the sequence of statements in the section. - -@deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g) -Return true if @code{OMP} section statement @code{G} has the -@code{GF_OMP_SECTION_LAST} flag set. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g) -Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}. -@end deftypefn - -@node @code{GIMPLE_OMP_SECTIONS} -@subsection @code{GIMPLE_OMP_SECTIONS} -@cindex @code{GIMPLE_OMP_SECTIONS} - -@deftypefn {GIMPLE function} gomp_sections *gimple_build_omp_sections ( @ -gimple_seq body, tree clauses) -Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of -section statements. @code{CLAUSES} are any of the @code{OMP} sections -construct's clauses: private, firstprivate, lastprivate, -reduction, and nowait. -@end deftypefn - - -@deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void) -Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g) -Return the control variable associated with the -@code{GIMPLE_OMP_SECTIONS} in @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_sections_control_ptr (gimple g) -Return a pointer to the clauses associated with the -@code{GIMPLE_OMP_SECTIONS} in @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control) -Set @code{CONTROL} to be the set of clauses associated with the -@code{GIMPLE_OMP_SECTIONS} in @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g) -Return the clauses associated with @code{OMP_SECTIONS} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_sections_clauses_ptr (gimple g) -Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses) -Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS} -@code{G}. -@end deftypefn - - -@node @code{GIMPLE_OMP_SINGLE} -@subsection @code{GIMPLE_OMP_SINGLE} -@cindex @code{GIMPLE_OMP_SINGLE} - -@deftypefn {GIMPLE function} gomp_single *gimple_build_omp_single ( @ -gimple_seq body, tree clauses) -Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of -statements that will be executed once. @code{CLAUSES} are any of the -@code{OMP} single construct's clauses: private, firstprivate, -copyprivate, nowait. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g) -Return the clauses associated with @code{OMP_SINGLE} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_omp_single_clauses_ptr (gimple g) -Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_omp_single_set_clauses ( @ -gomp_single *g, tree clauses) -Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}. -@end deftypefn - - -@node @code{GIMPLE_PHI} -@subsection @code{GIMPLE_PHI} -@cindex @code{GIMPLE_PHI} - -@deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g) -Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g) -Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always -be exactly the number of incoming edges for the basic block -holding @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_phi_result (gimple g) -Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {tree *} gimple_phi_result_ptr (gimple g) -Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_phi_set_result (gphi *g, tree result) -Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} {struct phi_arg_d *} gimple_phi_arg (gimple g, index) -Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for -@code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_phi_set_arg (gphi *g, index, @ -struct phi_arg_d * phiarg) -Set @code{PHIARG} to be the argument corresponding to incoming edge -@code{INDEX} for @code{GIMPLE_PHI} @code{G}. -@end deftypefn - -@node @code{GIMPLE_RESX} -@subsection @code{GIMPLE_RESX} -@cindex @code{GIMPLE_RESX} - -@deftypefn {GIMPLE function} gresx *gimple_build_resx (int region) -Build a @code{GIMPLE_RESX} statement which is a statement. This -statement is a placeholder for _Unwind_Resume before we know if a -function call or a branch is needed. @code{REGION} is the exception -region from which control is flowing. -@end deftypefn - -@deftypefn {GIMPLE function} int gimple_resx_region (const gresx *g) -Return the region number for @code{GIMPLE_RESX} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_resx_set_region (gresx *g, int region) -Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}. -@end deftypefn - -@node @code{GIMPLE_RETURN} -@subsection @code{GIMPLE_RETURN} -@cindex @code{GIMPLE_RETURN} - -@deftypefn {GIMPLE function} greturn *gimple_build_return (tree retval) -Build a @code{GIMPLE_RETURN} statement whose return value is retval. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_return_retval (const greturn *g) -Return the return value for @code{GIMPLE_RETURN} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_return_set_retval (greturn *g, @ -tree retval) -Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}. -@end deftypefn - -@node @code{GIMPLE_SWITCH} -@subsection @code{GIMPLE_SWITCH} -@cindex @code{GIMPLE_SWITCH} - -@deftypefn {GIMPLE function} gswitch *gimple_build_switch (tree index, @ -tree default_label, @code{vec} *args) -Build a @code{GIMPLE_SWITCH} statement. @code{INDEX} is the index variable -to switch on, and @code{DEFAULT_LABEL} represents the default label. -@code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees that contain the -non-default case labels. Each label is a tree of code @code{CASE_LABEL_EXPR}. -@end deftypefn - -@deftypefn {GIMPLE function} unsigned gimple_switch_num_labels ( @ -const gswitch *g) -Return the number of labels associated with the switch statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gswitch *g, @ -unsigned nlabels) -Set @code{NLABELS} to be the number of labels for the switch statement -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_switch_index (const gswitch *g) -Return the index variable used by the switch statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_switch_set_index (gswitch *g, @ -tree index) -Set @code{INDEX} to be the index variable for switch statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_switch_label (const gswitch *g, @ -unsigned index) -Return the label numbered @code{INDEX}. The default label is 0, followed -by any labels in a switch statement. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_switch_set_label (gswitch *g, @ -unsigned index, tree label) -Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default -label. -@end deftypefn - -@deftypefn {GIMPLE function} tree gimple_switch_default_label ( @ -const gswitch *g) -Return the default label for a switch statement. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_switch_set_default_label (gswitch *g, @ -tree label) -Set the default label for a switch statement. -@end deftypefn - - -@node @code{GIMPLE_TRY} -@subsection @code{GIMPLE_TRY} -@cindex @code{GIMPLE_TRY} - -@deftypefn {GIMPLE function} gtry *gimple_build_try (gimple_seq eval, @ -gimple_seq cleanup, unsigned int kind) -Build a @code{GIMPLE_TRY} statement. @code{EVAL} is a sequence with the -expression to evaluate. @code{CLEANUP} is a sequence of statements to -run at clean-up time. @code{KIND} is the enumeration value -@code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct -or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally -construct. -@end deftypefn - -@deftypefn {GIMPLE function} {enum gimple_try_flags} gimple_try_kind (gimple g) -Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is -either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g) -Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g) -Return the sequence of statements used as the body for @code{GIMPLE_TRY} -@code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g) -Return the sequence of statements used as the cleanup body for -@code{GIMPLE_TRY} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, @ -bool catch_is_cleanup) -Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_try_set_eval (gtry *g, gimple_seq eval) -Set @code{EVAL} to be the sequence of statements to use as the body for -@code{GIMPLE_TRY} @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_try_set_cleanup (gtry *g, @ -gimple_seq cleanup) -Set @code{CLEANUP} to be the sequence of statements to use as the -cleanup body for @code{GIMPLE_TRY} @code{G}. -@end deftypefn - -@node @code{GIMPLE_WITH_CLEANUP_EXPR} -@subsection @code{GIMPLE_WITH_CLEANUP_EXPR} -@cindex @code{GIMPLE_WITH_CLEANUP_EXPR} - -@deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup) -Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement. @code{CLEANUP} is the -clean-up expression. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g) -Return the cleanup sequence for cleanup statement @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup) -Set @code{CLEANUP} to be the cleanup sequence for @code{G}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g) -Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p) -Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple. -@end deftypefn - - -@node GIMPLE sequences -@section GIMPLE sequences -@cindex GIMPLE sequences - -GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s -used in @code{GENERIC}. They are used to chain statements together, and -when used in conjunction with sequence iterators, provide a -framework for iterating through statements. - -GIMPLE sequences are of type struct @code{gimple_sequence}, but are more -commonly passed by reference to functions dealing with sequences. -The type for a sequence pointer is @code{gimple_seq} which is the same -as struct @code{gimple_sequence} *. When declaring a local sequence, -you can define a local variable of type struct @code{gimple_sequence}. -When declaring a sequence allocated on the garbage collected -heap, use the function @code{gimple_seq_alloc} documented below. - -There are convenience functions for iterating through sequences -in the section entitled Sequence Iterators. - -Below is a list of functions to manipulate and query sequences. - -@deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g) -Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is -not @code{NULL}. If *@code{SEQ} is @code{NULL}, allocate a sequence before linking. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src) -Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not -@code{NULL}. If *@code{DEST} is @code{NULL}, allocate a new sequence before -appending. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src) -Perform a deep copy of sequence @code{SRC} and return the result. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq) -Reverse the order of the statements in the sequence @code{SEQ}. Return -@code{SEQ}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s) -Return the first statement in sequence @code{S}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s) -Return the last statement in sequence @code{S}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last) -Set the last statement in sequence @code{S} to the statement in @code{LAST}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first) -Set the first statement in sequence @code{S} to the statement in @code{FIRST}. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s) -Initialize sequence @code{S} to an empty sequence. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void) -Allocate a new sequence in the garbage collected store and return -it. -@end deftypefn - -@deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src) -Copy the sequence @code{SRC} into the sequence @code{DEST}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s) -Return true if the sequence @code{S} is empty. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb) -Returns the sequence of statements in @code{BB}. -@end deftypefn - -@deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq) -Sets the sequence of statements in @code{BB} to @code{SEQ}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq) -Determine whether @code{SEQ} contains exactly one statement. -@end deftypefn - -@node Sequence iterators -@section Sequence iterators -@cindex Sequence iterators - -Sequence iterators are convenience constructs for iterating -through statements in a sequence. Given a sequence @code{SEQ}, here is -a typical use of gimple sequence iterators: - -@smallexample -gimple_stmt_iterator gsi; - -for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) - @{ - gimple g = gsi_stmt (gsi); - /* Do something with gimple statement @code{G}. */ - @} -@end smallexample - -Backward iterations are possible: - -@smallexample - for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi)) -@end smallexample - -Forward and backward iterations on basic blocks are possible with -@code{gsi_start_bb} and @code{gsi_last_bb}. - -In the documentation below we sometimes refer to enum -@code{gsi_iterator_update}. The valid options for this enumeration are: - -@itemize @bullet -@item @code{GSI_NEW_STMT} -Only valid when a single statement is added. Move the iterator to it. - -@item @code{GSI_SAME_STMT} -Leave the iterator at the same statement. - -@item @code{GSI_CONTINUE_LINKING} -Move iterator to whatever position is suitable for linking other -statements in the same direction. -@end itemize - -Below is a list of the functions used to manipulate and use -statement iterators. - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq) -Return a new iterator pointing to the sequence @code{SEQ}'s first -statement. If @code{SEQ} is empty, the iterator's basic block is @code{NULL}. -Use @code{gsi_start_bb} instead when the iterator needs to always have -the correct basic block set. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb) -Return a new iterator pointing to the first statement in basic -block @code{BB}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq) -Return a new iterator initially pointing to the last statement of -sequence @code{SEQ}. If @code{SEQ} is empty, the iterator's basic block is -@code{NULL}. Use @code{gsi_last_bb} instead when the iterator needs to always -have the correct basic block set. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb) -Return a new iterator pointing to the last statement in basic -block @code{BB}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i) -Return @code{TRUE} if at the end of @code{I}. -@end deftypefn - -@deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i) -Return @code{TRUE} if we're one statement before the end of @code{I}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i) -Advance the iterator to the next gimple statement. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i) -Advance the iterator to the previous gimple statement. -@end deftypefn - -@deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i) -Return the current stmt. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb) -Return a block statement iterator that points to the first -non-label statement in block @code{BB}. -@end deftypefn - -@deftypefn {GIMPLE function} {gimple *} gsi_stmt_ptr (gimple_stmt_iterator *i) -Return a pointer to the current stmt. -@end deftypefn - -@deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i) -Return the basic block associated with this iterator. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i) -Return the sequence associated with this iterator. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info) -Remove the current stmt from the sequence. The iterator is -updated to point to the next statement. When @code{REMOVE_EH_INFO} is -true we remove the statement pointed to by iterator @code{I} from the @code{EH} -tables. Otherwise we do not modify the @code{EH} tables. Generally, -@code{REMOVE_EH_INFO} should be true when the statement is going to be -removed from the @code{IL} and not reinserted elsewhere. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode) -Links the sequence of statements @code{SEQ} before the statement pointed -by iterator @code{I}. @code{MODE} indicates what to do with the iterator -after insertion (see @code{enum gsi_iterator_update} above). -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode) -Links statement @code{G} before the statement pointed-to by iterator @code{I}. -Updates iterator @code{I} according to @code{MODE}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, @ -gimple_seq seq, enum gsi_iterator_update mode) -Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}. -@code{MODE} is as in @code{gsi_insert_after}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, @ -gimple g, enum gsi_iterator_update mode) -Links statement @code{G} after the statement pointed-to by iterator @code{I}. -@code{MODE} is as in @code{gsi_insert_after}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i) -Move all statements in the sequence after @code{I} to a new sequence. -Return this new sequence. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i) -Move all statements in the sequence before @code{I} to a new sequence. -Return this new sequence. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, @ -gimple stmt, bool update_eh_info) -Replace the statement pointed-to by @code{I} to @code{STMT}. If @code{UPDATE_EH_INFO} -is true, the exception handling information of the original -statement is moved to the new statement. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, @ -gimple stmt, enum gsi_iterator_update mode) -Insert statement @code{STMT} before the statement pointed-to by iterator -@code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE} -specifies how to update iterator @code{I} after insertion (see enum -@code{gsi_iterator_update}). -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, @ -gimple_seq seq, enum gsi_iterator_update mode) -Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, @ -gimple stmt, enum gsi_iterator_update mode) -Insert statement @code{STMT} after the statement pointed-to by iterator -@code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE} -specifies how to update iterator @code{I} after insertion (see enum -@code{gsi_iterator_update}). -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, @ -gimple_seq seq, enum gsi_iterator_update mode) -Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}. -@end deftypefn - -@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt) -Finds iterator for @code{STMT}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, @ -gimple_stmt_iterator *to) -Move the statement at @code{FROM} so it comes right after the statement -at @code{TO}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, @ -gimple_stmt_iterator *to) -Move the statement at @code{FROM} so it comes right before the statement -at @code{TO}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, @ -basic_block bb) -Move the statement at @code{FROM} to the end of basic block @code{BB}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt) -Add @code{STMT} to the pending list of edge @code{E}. No actual insertion is -made until a call to @code{gsi_commit_edge_inserts}() is made. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq) -Add the sequence of statements in @code{SEQ} to the pending list of edge -@code{E}. No actual insertion is made until a call to -@code{gsi_commit_edge_inserts}() is made. -@end deftypefn - -@deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt) -Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}. If a new -block has to be created, it is returned. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb) -Commit insertions pending at edge @code{E}. If a new block is created, -set @code{NEW_BB} to this block, otherwise set it to @code{NULL}. -@end deftypefn - -@deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void) -This routine will commit all pending edge insertions, creating -any new basic blocks which are necessary. -@end deftypefn - - -@node Adding a new GIMPLE statement code -@section Adding a new GIMPLE statement code -@cindex Adding a new GIMPLE statement code - -The first step in adding a new GIMPLE statement code, is -modifying the file @code{gimple.def}, which contains all the GIMPLE -codes. Then you must add a corresponding gimple_statement_base subclass -located in @code{gimple.h}. This in turn, will require you to add a -corresponding @code{GTY} tag in @code{gsstruct.def}, and code to handle -this tag in @code{gss_for_code} which is located in @code{gimple.c}. - -In order for the garbage collector to know the size of the -structure you created in @code{gimple.h}, you need to add a case to -handle your new GIMPLE statement in @code{gimple_size} which is located -in @code{gimple.c}. - -You will probably want to create a function to build the new -gimple statement in @code{gimple.c}. The function should be called -@code{gimple_build_@var{new-tuple-name}}, and should return the new tuple -as a pointer to the appropriate gimple_statement_base subclass. - -If your new statement requires accessors for any members or -operands it may have, put simple inline accessors in -@code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a -corresponding prototype in @code{gimple.h}. - -You should add the new statement subclass to the class hierarchy diagram -in @code{gimple.texi}. - - -@node Statement and operand traversals -@section Statement and operand traversals -@cindex Statement and operand traversals - -There are two functions available for walking statements and -sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq}, -accordingly, and a third function for walking the operands in a -statement: @code{walk_gimple_op}. - -@deftypefn {GIMPLE function} tree walk_gimple_stmt (gimple_stmt_iterator *gsi, @ - walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi) -This function is used to walk the current statement in @code{GSI}, -optionally using traversal state stored in @code{WI}. If @code{WI} is @code{NULL}, no -state is kept during the traversal. - -The callback @code{CALLBACK_STMT} is called. If @code{CALLBACK_STMT} returns -true, it means that the callback function has handled all the -operands of the statement and it is not necessary to walk its -operands. - -If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is -called on each operand of the statement via @code{walk_gimple_op}. If -@code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining -operands are not scanned. - -The return value is that returned by the last call to -@code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified. -@end deftypefn - - -@deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, @ - walk_tree_fn callback_op, struct walk_stmt_info *wi) -Use this function to walk the operands of statement @code{STMT}. Every -operand is walked via @code{walk_tree} with optional state information -in @code{WI}. - -@code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}. -Additional parameters to @code{walk_tree} must be stored in @code{WI}. For -each operand @code{OP}, @code{walk_tree} is called as: - -@smallexample -walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{PSET}) -@end smallexample - -If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining -operands are not scanned. The return value is that returned by -the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is -specified. -@end deftypefn - - -@deftypefn {GIMPLE function} tree walk_gimple_seq (gimple_seq seq, @ - walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi) -This function walks all the statements in the sequence @code{SEQ} -calling @code{walk_gimple_stmt} on each one. @code{WI} is as in -@code{walk_gimple_stmt}. If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk -is stopped and the value returned. Otherwise, all the statements -are walked and @code{NULL_TREE} returned. -@end deftypefn diff --git a/contrib/gcc-5.0/gcc/doc/gnu.texi b/contrib/gcc-5.0/gcc/doc/gnu.texi deleted file mode 100644 index 641fe30725..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gnu.texi +++ /dev/null @@ -1,20 +0,0 @@ -@c Copyright (C) 2001 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node GNU Project -@unnumbered The GNU Project and GNU/Linux - -The GNU Project was launched in 1984 to develop a complete Unix-like -operating system which is free software: the GNU system. (GNU is a -recursive acronym for ``GNU's Not Unix''; it is pronounced -``guh-NEW''@.) Variants of the GNU operating system, which use the -kernel Linux, are now widely used; though these systems are often -referred to as ``Linux'', they are more accurately called GNU/Linux -systems. - -For more information, see: -@smallexample -@uref{http://www.gnu.org/} -@uref{http://www.gnu.org/gnu/linux-and-gnu.html} -@end smallexample diff --git a/contrib/gcc-5.0/gcc/doc/gty.texi b/contrib/gcc-5.0/gcc/doc/gty.texi deleted file mode 100644 index 5e0a46599c..0000000000 --- a/contrib/gcc-5.0/gcc/doc/gty.texi +++ /dev/null @@ -1,705 +0,0 @@ -@c Copyright (C) 2002-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Type Information -@chapter Memory Management and Type Information -@cindex GGC -@findex GTY - -GCC uses some fairly sophisticated memory management techniques, which -involve determining information about GCC's data structures from GCC's -source code and using this information to perform garbage collection and -implement precompiled headers. - -A full C++ parser would be too complicated for this task, so a limited -subset of C++ is interpreted and special markers are used to determine -what parts of the source to look at. All @code{struct}, @code{union} -and @code{template} structure declarations that define data structures -that are allocated under control of the garbage collector must be -marked. All global variables that hold pointers to garbage-collected -memory must also be marked. Finally, all global variables that need -to be saved and restored by a precompiled header must be marked. (The -precompiled header mechanism can only save static variables if they're -scalar. Complex data structures must be allocated in garbage-collected -memory to be saved in a precompiled header.) - -The full format of a marker is -@smallexample -GTY (([@var{option}] [(@var{param})], [@var{option}] [(@var{param})] @dots{})) -@end smallexample -@noindent -but in most cases no options are needed. The outer double parentheses -are still necessary, though: @code{GTY(())}. Markers can appear: - -@itemize @bullet -@item -In a structure definition, before the open brace; -@item -In a global variable declaration, after the keyword @code{static} or -@code{extern}; and -@item -In a structure field definition, before the name of the field. -@end itemize - -Here are some examples of marking simple data structures and globals. - -@smallexample -struct GTY(()) @var{tag} -@{ - @var{fields}@dots{} -@}; - -typedef struct GTY(()) @var{tag} -@{ - @var{fields}@dots{} -@} *@var{typename}; - -static GTY(()) struct @var{tag} *@var{list}; /* @r{points to GC memory} */ -static GTY(()) int @var{counter}; /* @r{save counter in a PCH} */ -@end smallexample - -The parser understands simple typedefs such as -@code{typedef struct @var{tag} *@var{name};} and -@code{typedef int @var{name};}. -These don't need to be marked. - -Since @code{gengtype}'s understanding of C++ is limited, there are -several constructs and declarations that are not supported inside -classes/structures marked for automatic GC code generation. The -following C++ constructs produce a @code{gengtype} error on -structures/classes marked for automatic GC code generation: - -@itemize @bullet -@item -Type definitions inside classes/structures are not supported. -@item -Enumerations inside classes/structures are not supported. -@end itemize - -If you have a class or structure using any of the above constructs, -you need to mark that class as @code{GTY ((user))} and provide your -own marking routines (see section @ref{User GC} for details). - -It is always valid to include function definitions inside classes. -Those are always ignored by @code{gengtype}, as it only cares about -data members. - -@menu -* GTY Options:: What goes inside a @code{GTY(())}. -* Inheritance and GTY:: Adding GTY to a class hierarchy. -* User GC:: Adding user-provided GC marking routines. -* GGC Roots:: Making global variables GGC roots. -* Files:: How the generated files work. -* Invoking the garbage collector:: How to invoke the garbage collector. -* Troubleshooting:: When something does not work as expected. -@end menu - -@node GTY Options -@section The Inside of a @code{GTY(())} - -Sometimes the C code is not enough to fully describe the type -structure. Extra information can be provided with @code{GTY} options -and additional markers. Some options take a parameter, which may be -either a string or a type name, depending on the parameter. If an -option takes no parameter, it is acceptable either to omit the -parameter entirely, or to provide an empty string as a parameter. For -example, @code{@w{GTY ((skip))}} and @code{@w{GTY ((skip ("")))}} are -equivalent. - -When the parameter is a string, often it is a fragment of C code. Four -special escapes may be used in these strings, to refer to pieces of -the data structure being marked: - -@cindex % in GTY option -@table @code -@item %h -The current structure. -@item %1 -The structure that immediately contains the current structure. -@item %0 -The outermost structure that contains the current structure. -@item %a -A partial expression of the form @code{[i1][i2]@dots{}} that indexes -the array item currently being marked. -@end table - -For instance, suppose that you have a structure of the form -@smallexample -struct A @{ - @dots{} -@}; -struct B @{ - struct A foo[12]; -@}; -@end smallexample -@noindent -and @code{b} is a variable of type @code{struct B}. When marking -@samp{b.foo[11]}, @code{%h} would expand to @samp{b.foo[11]}, -@code{%0} and @code{%1} would both expand to @samp{b}, and @code{%a} -would expand to @samp{[11]}. - -As in ordinary C, adjacent strings will be concatenated; this is -helpful when you have a complicated expression. -@smallexample -@group -GTY ((chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE" - " ? TYPE_NEXT_VARIANT (&%h.generic)" - " : TREE_CHAIN (&%h.generic)"))) -@end group -@end smallexample - -The available options are: - -@table @code -@findex length -@item length ("@var{expression}") - -There are two places the type machinery will need to be explicitly told -the length of an array of non-atomic objects. The first case is when a -structure ends in a variable-length array, like this: -@smallexample -struct GTY(()) rtvec_def @{ - int num_elem; /* @r{number of elements} */ - rtx GTY ((length ("%h.num_elem"))) elem[1]; -@}; -@end smallexample - -In this case, the @code{length} option is used to override the specified -array length (which should usually be @code{1}). The parameter of the -option is a fragment of C code that calculates the length. - -The second case is when a structure or a global variable contains a -pointer to an array, like this: -@smallexample -struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; -@end smallexample -In this case, @code{iter} has been allocated by writing something like -@smallexample - x->iter = ggc_alloc_cleared_vec_gimple_omp_for_iter (collapse); -@end smallexample -and the @code{collapse} provides the length of the field. - -This second use of @code{length} also works on global variables, like: -@verbatim -static GTY((length("reg_known_value_size"))) rtx *reg_known_value; -@end verbatim - -Note that the @code{length} option is only meant for use with arrays of -non-atomic objects, that is, objects that contain pointers pointing to -other GTY-managed objects. For other GC-allocated arrays and strings -you should use @code{atomic}. - -@findex skip -@item skip - -If @code{skip} is applied to a field, the type machinery will ignore it. -This is somewhat dangerous; the only safe use is in a union when one -field really isn't ever used. - -@findex for_user -Use this to mark types that need to be marked by user gc routines, but are not -refered to in a template argument. So if you have some user gc type T1 and a -non user gc type T2 you can give T2 the for_user option so that the marking -functions for T1 can call non mangled functions to mark T2. - -@findex desc -@findex tag -@findex default -@item desc ("@var{expression}") -@itemx tag ("@var{constant}") -@itemx default - -The type machinery needs to be told which field of a @code{union} is -currently active. This is done by giving each field a constant -@code{tag} value, and then specifying a discriminator using @code{desc}. -The value of the expression given by @code{desc} is compared against -each @code{tag} value, each of which should be different. If no -@code{tag} is matched, the field marked with @code{default} is used if -there is one, otherwise no field in the union will be marked. - -In the @code{desc} option, the ``current structure'' is the union that -it discriminates. Use @code{%1} to mean the structure containing it. -There are no escapes available to the @code{tag} option, since it is a -constant. - -For example, -@smallexample -struct GTY(()) tree_binding -@{ - struct tree_common common; - union tree_binding_u @{ - tree GTY ((tag ("0"))) scope; - struct cp_binding_level * GTY ((tag ("1"))) level; - @} GTY ((desc ("BINDING_HAS_LEVEL_P ((tree)&%0)"))) xscope; - tree value; -@}; -@end smallexample - -In this example, the value of BINDING_HAS_LEVEL_P when applied to a -@code{struct tree_binding *} is presumed to be 0 or 1. If 1, the type -mechanism will treat the field @code{level} as being present and if 0, -will treat the field @code{scope} as being present. - -The @code{desc} and @code{tag} options can also be used for inheritance -to denote which subclass an instance is. See @ref{Inheritance and GTY} -for more information. - -@findex cache -@item cache - -When the @code{cache} option is applied to a global variable gt_clear_cache is -called on that variable between the mark and sweep phases of garbage -collection. The gt_clear_cache function is free to mark blocks as used, or to -clear pointers in the variable. - -@findex deletable -@item deletable - -@code{deletable}, when applied to a global variable, indicates that when -garbage collection runs, there's no need to mark anything pointed to -by this variable, it can just be set to @code{NULL} instead. This is used -to keep a list of free structures around for re-use. - -@findex mark_hook -@item mark_hook ("@var{hook-routine-name}") - -If provided for a structure or union type, the given -@var{hook-routine-name} (between double-quotes) is the name of a -routine called when the garbage collector has just marked the data as -reachable. This routine should not change the data, or call any ggc -routine. Its only argument is a pointer to the just marked (const) -structure or union. - -@findex maybe_undef -@item maybe_undef - -When applied to a field, @code{maybe_undef} indicates that it's OK if -the structure that this fields points to is never defined, so long as -this field is always @code{NULL}. This is used to avoid requiring -backends to define certain optional structures. It doesn't work with -language frontends. - -@findex nested_ptr -@item nested_ptr (@var{type}, "@var{to expression}", "@var{from expression}") - -The type machinery expects all pointers to point to the start of an -object. Sometimes for abstraction purposes it's convenient to have -a pointer which points inside an object. So long as it's possible to -convert the original object to and from the pointer, such pointers -can still be used. @var{type} is the type of the original object, -the @var{to expression} returns the pointer given the original object, -and the @var{from expression} returns the original object given -the pointer. The pointer will be available using the @code{%h} -escape. - -@findex chain_next -@findex chain_prev -@findex chain_circular -@item chain_next ("@var{expression}") -@itemx chain_prev ("@var{expression}") -@itemx chain_circular ("@var{expression}") - -It's helpful for the type machinery to know if objects are often -chained together in long lists; this lets it generate code that uses -less stack space by iterating along the list instead of recursing down -it. @code{chain_next} is an expression for the next item in the list, -@code{chain_prev} is an expression for the previous item. For singly -linked lists, use only @code{chain_next}; for doubly linked lists, use -both. The machinery requires that taking the next item of the -previous item gives the original item. @code{chain_circular} is similar -to @code{chain_next}, but can be used for circular single linked lists. - -@findex reorder -@item reorder ("@var{function name}") - -Some data structures depend on the relative ordering of pointers. If -the precompiled header machinery needs to change that ordering, it -will call the function referenced by the @code{reorder} option, before -changing the pointers in the object that's pointed to by the field the -option applies to. The function must take four arguments, with the -signature @samp{@w{void *, void *, gt_pointer_operator, void *}}. -The first parameter is a pointer to the structure that contains the -object being updated, or the object itself if there is no containing -structure. The second parameter is a cookie that should be ignored. -The third parameter is a routine that, given a pointer, will update it -to its correct new value. The fourth parameter is a cookie that must -be passed to the second parameter. - -PCH cannot handle data structures that depend on the absolute values -of pointers. @code{reorder} functions can be expensive. When -possible, it is better to depend on properties of the data, like an ID -number or the hash of a string instead. - -@findex atomic -@item atomic - -The @code{atomic} option can only be used with pointers. It informs -the GC machinery that the memory that the pointer points to does not -contain any pointers, and hence it should be treated by the GC and PCH -machinery as an ``atomic'' block of memory that does not need to be -examined when scanning memory for pointers. In particular, the -machinery will not scan that memory for pointers to mark them as -reachable (when marking pointers for GC) or to relocate them (when -writing a PCH file). - -The @code{atomic} option differs from the @code{skip} option. -@code{atomic} keeps the memory under Garbage Collection, but makes the -GC ignore the contents of the memory. @code{skip} is more drastic in -that it causes the pointer and the memory to be completely ignored by -the Garbage Collector. So, memory marked as @code{atomic} is -automatically freed when no longer reachable, while memory marked as -@code{skip} is not. - -The @code{atomic} option must be used with great care, because all -sorts of problem can occur if used incorrectly, that is, if the memory -the pointer points to does actually contain a pointer. - -Here is an example of how to use it: -@smallexample -struct GTY(()) my_struct @{ - int number_of_elements; - unsigned int * GTY ((atomic)) elements; -@}; -@end smallexample -In this case, @code{elements} is a pointer under GC, and the memory it -points to needs to be allocated using the Garbage Collector, and will -be freed automatically by the Garbage Collector when it is no longer -referenced. But the memory that the pointer points to is an array of -@code{unsigned int} elements, and the GC must not try to scan it to -find pointers to mark or relocate, which is why it is marked with the -@code{atomic} option. - -Note that, currently, global variables can not be marked with -@code{atomic}; only fields of a struct can. This is a known -limitation. It would be useful to be able to mark global pointers -with @code{atomic} to make the PCH machinery aware of them so that -they are saved and restored correctly to PCH files. - -@findex special -@item special ("@var{name}") - -The @code{special} option is used to mark types that have to be dealt -with by special case machinery. The parameter is the name of the -special case. See @file{gengtype.c} for further details. Avoid -adding new special cases unless there is no other alternative. - -@findex user -@item user - -The @code{user} option indicates that the code to mark structure -fields is completely handled by user-provided routines. See section -@ref{User GC} for details on what functions need to be provided. -@end table - -@node Inheritance and GTY -@section Support for inheritance -gengtype has some support for simple class hierarchies. You can use -this to have gengtype autogenerate marking routines, provided: - -@itemize @bullet -@item -There must be a concrete base class, with a discriminator expression -that can be used to identify which subclass an instance is. -@item -Only single inheritance is used. -@item -None of the classes within the hierarchy are templates. -@end itemize - -If your class hierarchy does not fit in this pattern, you must use -@ref{User GC} instead. - -The base class and its discriminator must be identified using the ``desc'' -option. Each concrete subclass must use the ``tag'' option to identify -which value of the discriminator it corresponds to. - -Every class in the hierarchy must have a @code{GTY(())} marker, as -gengtype will only attempt to parse classes that have such a marker -@footnote{Classes lacking such a marker will not be identified as being -part of the hierarchy, and so the marking routines will not handle them, -leading to a assertion failure within the marking routines due to an -unknown tag value (assuming that assertions are enabled).}. - -@smallexample -class GTY((desc("%h.kind"), tag("0"))) example_base -@{ -public: - int kind; - tree a; -@}; - -class GTY((tag("1")) some_subclass : public example_base -@{ -public: - tree b; -@}; - -class GTY((tag("2")) some_other_subclass : public example_base -@{ -public: - tree c; -@}; -@end smallexample - -The generated marking routines for the above will contain a ``switch'' -on ``kind'', visiting all appropriate fields. For example, if kind is -2, it will cast to ``some_other_subclass'' and visit fields a, b, and c. - -@node User GC -@section Support for user-provided GC marking routines -@cindex user gc -The garbage collector supports types for which no automatic marking -code is generated. For these types, the user is required to provide -three functions: one to act as a marker for garbage collection, and -two functions to act as marker and pointer walker for pre-compiled -headers. - -Given a structure @code{struct GTY((user)) my_struct}, the following functions -should be defined to mark @code{my_struct}: - -@smallexample -void gt_ggc_mx (my_struct *p) -@{ - /* This marks field 'fld'. */ - gt_ggc_mx (p->fld); -@} - -void gt_pch_nx (my_struct *p) -@{ - /* This marks field 'fld'. */ - gt_pch_nx (tp->fld); -@} - -void gt_pch_nx (my_struct *p, gt_pointer_operator op, void *cookie) -@{ - /* For every field 'fld', call the given pointer operator. */ - op (&(tp->fld), cookie); -@} -@end smallexample - -In general, each marker @code{M} should call @code{M} for every -pointer field in the structure. Fields that are not allocated in GC -or are not pointers must be ignored. - -For embedded lists (e.g., structures with a @code{next} or @code{prev} -pointer), the marker must follow the chain and mark every element in -it. - -Note that the rules for the pointer walker @code{gt_pch_nx (my_struct -*, gt_pointer_operator, void *)} are slightly different. In this -case, the operation @code{op} must be applied to the @emph{address} of -every pointer field. - -@subsection User-provided marking routines for template types -When a template type @code{TP} is marked with @code{GTY}, all -instances of that type are considered user-provided types. This means -that the individual instances of @code{TP} do not need to be marked -with @code{GTY}. The user needs to provide template functions to mark -all the fields of the type. - -The following code snippets represent all the functions that need to -be provided. Note that type @code{TP} may reference to more than one -type. In these snippets, there is only one type @code{T}, but there -could be more. - -@smallexample -template -void gt_ggc_mx (TP *tp) -@{ - extern void gt_ggc_mx (T&); - - /* This marks field 'fld' of type 'T'. */ - gt_ggc_mx (tp->fld); -@} - -template -void gt_pch_nx (TP *tp) -@{ - extern void gt_pch_nx (T&); - - /* This marks field 'fld' of type 'T'. */ - gt_pch_nx (tp->fld); -@} - -template -void gt_pch_nx (TP *tp, gt_pointer_operator op, void *cookie) -@{ - /* For every field 'fld' of 'tp' with type 'T *', call the given - pointer operator. */ - op (&(tp->fld), cookie); -@} - -template -void gt_pch_nx (TP *tp, gt_pointer_operator, void *cookie) -@{ - extern void gt_pch_nx (T *, gt_pointer_operator, void *); - - /* For every field 'fld' of 'tp' with type 'T', call the pointer - walker for all the fields of T. */ - gt_pch_nx (&(tp->fld), op, cookie); -@} -@end smallexample - -Support for user-defined types is currently limited. The following -restrictions apply: - -@enumerate -@item Type @code{TP} and all the argument types @code{T} must be -marked with @code{GTY}. - -@item Type @code{TP} can only have type names in its argument list. - -@item The pointer walker functions are different for @code{TP} and -@code{TP}. In the case of @code{TP}, references to -@code{T} must be handled by calling @code{gt_pch_nx} (which -will, in turn, walk all the pointers inside fields of @code{T}). -In the case of @code{TP}, references to @code{T *} must be -handled by calling the @code{op} function on the address of the -pointer (see the code snippets above). -@end enumerate - -@node GGC Roots -@section Marking Roots for the Garbage Collector -@cindex roots, marking -@cindex marking roots - -In addition to keeping track of types, the type machinery also locates -the global variables (@dfn{roots}) that the garbage collector starts -at. Roots must be declared using one of the following syntaxes: - -@itemize @bullet -@item -@code{extern GTY(([@var{options}])) @var{type} @var{name};} -@item -@code{static GTY(([@var{options}])) @var{type} @var{name};} -@end itemize -@noindent -The syntax -@itemize @bullet -@item -@code{GTY(([@var{options}])) @var{type} @var{name};} -@end itemize -@noindent -is @emph{not} accepted. There should be an @code{extern} declaration -of such a variable in a header somewhere---mark that, not the -definition. Or, if the variable is only used in one file, make it -@code{static}. - -@node Files -@section Source Files Containing Type Information -@cindex generated files -@cindex files, generated - -Whenever you add @code{GTY} markers to a source file that previously -had none, or create a new source file containing @code{GTY} markers, -there are three things you need to do: - -@enumerate -@item -You need to add the file to the list of source files the type -machinery scans. There are four cases: - -@enumerate a -@item -For a back-end file, this is usually done -automatically; if not, you should add it to @code{target_gtfiles} in -the appropriate port's entries in @file{config.gcc}. - -@item -For files shared by all front ends, add the filename to the -@code{GTFILES} variable in @file{Makefile.in}. - -@item -For files that are part of one front end, add the filename to the -@code{gtfiles} variable defined in the appropriate -@file{config-lang.in}. -Headers should appear before non-headers in this list. - -@item -For files that are part of some but not all front ends, add the -filename to the @code{gtfiles} variable of @emph{all} the front ends -that use it. -@end enumerate - -@item -If the file was a header file, you'll need to check that it's included -in the right place to be visible to the generated files. For a back-end -header file, this should be done automatically. For a front-end header -file, it needs to be included by the same file that includes -@file{gtype-@var{lang}.h}. For other header files, it needs to be -included in @file{gtype-desc.c}, which is a generated file, so add it to -@code{ifiles} in @code{open_base_file} in @file{gengtype.c}. - -For source files that aren't header files, the machinery will generate a -header file that should be included in the source file you just changed. -The file will be called @file{gt-@var{path}.h} where @var{path} is the -pathname relative to the @file{gcc} directory with slashes replaced by -@verb{|-|}, so for example the header file to be included in -@file{cp/parser.c} is called @file{gt-cp-parser.c}. The -generated header file should be included after everything else in the -source file. Don't forget to mention this file as a dependency in the -@file{Makefile}! - -@end enumerate - -For language frontends, there is another file that needs to be included -somewhere. It will be called @file{gtype-@var{lang}.h}, where -@var{lang} is the name of the subdirectory the language is contained in. - -Plugins can add additional root tables. Run the @code{gengtype} -utility in plugin mode as @code{gengtype -P pluginout.h @var{source-dir} -@var{file-list} @var{plugin*.c}} with your plugin files -@var{plugin*.c} using @code{GTY} to generate the @var{pluginout.h} file. -The GCC build tree is needed to be present in that mode. - - -@node Invoking the garbage collector -@section How to invoke the garbage collector -@cindex garbage collector, invocation -@findex ggc_collect - -The GCC garbage collector GGC is only invoked explicitly. In contrast -with many other garbage collectors, it is not implicitly invoked by -allocation routines when a lot of memory has been consumed. So the -only way to have GGC reclaim storage is to call the @code{ggc_collect} -function explicitly. This call is an expensive operation, as it may -have to scan the entire heap. Beware that local variables (on the GCC -call stack) are not followed by such an invocation (as many other -garbage collectors do): you should reference all your data from static -or external @code{GTY}-ed variables, and it is advised to call -@code{ggc_collect} with a shallow call stack. The GGC is an exact mark -and sweep garbage collector (so it does not scan the call stack for -pointers). In practice GCC passes don't often call @code{ggc_collect} -themselves, because it is called by the pass manager between passes. - -At the time of the @code{ggc_collect} call all pointers in the GC-marked -structures must be valid or @code{NULL}. In practice this means that -there should not be uninitialized pointer fields in the structures even -if your code never reads or writes those fields at a particular -instance. One way to ensure this is to use cleared versions of -allocators unless all the fields are initialized manually immediately -after allocation. - -@node Troubleshooting -@section Troubleshooting the garbage collector -@cindex garbage collector, troubleshooting - -With the current garbage collector implementation, most issues should -show up as GCC compilation errors. Some of the most commonly -encountered issues are described below. - -@itemize @bullet -@item Gengtype does not produce allocators for a @code{GTY}-marked type. -Gengtype checks if there is at least one possible path from GC roots to -at least one instance of each type before outputting allocators. If -there is no such path, the @code{GTY} markers will be ignored and no -allocators will be output. Solve this by making sure that there exists -at least one such path. If creating it is unfeasible or raises a ``code -smell'', consider if you really must use GC for allocating such type. - -@item Link-time errors about undefined @code{gt_ggc_r_foo_bar} and -similarly-named symbols. Check if your @file{foo_bar} source file has -@code{#include "gt-foo_bar.h"} as its very last line. - -@end itemize diff --git a/contrib/gcc-5.0/gcc/doc/headerdirs.texi b/contrib/gcc-5.0/gcc/doc/headerdirs.texi deleted file mode 100644 index ce284ec1f7..0000000000 --- a/contrib/gcc-5.0/gcc/doc/headerdirs.texi +++ /dev/null @@ -1,32 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Header Dirs -@chapter Standard Header File Directories - -@code{GCC_INCLUDE_DIR} means the same thing for native and cross. It is -where GCC stores its private include files, and also where GCC -stores the fixed include files. A cross compiled GCC runs -@code{fixincludes} on the header files in @file{$(tooldir)/include}. -(If the cross compilation header files need to be fixed, they must be -installed before GCC is built. If the cross compilation header files -are already suitable for GCC, nothing special need be done). - -@code{GPLUSPLUS_INCLUDE_DIR} means the same thing for native and cross. It -is where @command{g++} looks first for header files. The C++ library -installs only target independent header files in that directory. - -@code{LOCAL_INCLUDE_DIR} is used only by native compilers. GCC -doesn't install anything there. It is normally -@file{/usr/local/include}. This is where local additions to a packaged -system should place header files. - -@code{CROSS_INCLUDE_DIR} is used only by cross compilers. GCC -doesn't install anything there. - -@code{TOOL_INCLUDE_DIR} is used for both native and cross compilers. It -is the place for other packages to install header files that GCC will -use. For a cross-compiler, this is the equivalent of -@file{/usr/include}. When you build a cross-compiler, -@code{fixincludes} processes any header files in this directory. diff --git a/contrib/gcc-5.0/gcc/doc/hostconfig.texi b/contrib/gcc-5.0/gcc/doc/hostconfig.texi deleted file mode 100644 index 9e1e4868e5..0000000000 --- a/contrib/gcc-5.0/gcc/doc/hostconfig.texi +++ /dev/null @@ -1,229 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gccint.texi. - -@node Host Config -@chapter Host Configuration -@cindex host configuration - -Most details about the machine and system on which the compiler is -actually running are detected by the @command{configure} script. Some -things are impossible for @command{configure} to detect; these are -described in two ways, either by macros defined in a file named -@file{xm-@var{machine}.h} or by hook functions in the file specified -by the @var{out_host_hook_obj} variable in @file{config.gcc}. (The -intention is that very few hosts will need a header file but nearly -every fully supported host will need to override some hooks.) - -If you need to define only a few macros, and they have simple -definitions, consider using the @code{xm_defines} variable in your -@file{config.gcc} entry instead of creating a host configuration -header. @xref{System Config}. - -@menu -* Host Common:: Things every host probably needs implemented. -* Filesystem:: Your host can't have the letter `a' in filenames? -* Host Misc:: Rare configuration options for hosts. -@end menu - -@node Host Common -@section Host Common -@cindex host hooks -@cindex host functions - -Some things are just not portable, even between similar operating systems, -and are too difficult for autoconf to detect. They get implemented using -hook functions in the file specified by the @var{host_hook_obj} -variable in @file{config.gcc}. - -@deftypefn {Host Hook} void HOST_HOOKS_EXTRA_SIGNALS (void) -This host hook is used to set up handling for extra signals. The most -common thing to do in this hook is to detect stack overflow. -@end deftypefn - -@deftypefn {Host Hook} {void *} HOST_HOOKS_GT_PCH_GET_ADDRESS (size_t @ - @var{size}, int @var{fd}) -This host hook returns the address of some space that is likely to be -free in some subsequent invocation of the compiler. We intend to load -the PCH data at this address such that the data need not be relocated. -The area should be able to hold @var{size} bytes. If the host uses -@code{mmap}, @var{fd} is an open file descriptor that can be used for -probing. -@end deftypefn - -@deftypefn {Host Hook} int HOST_HOOKS_GT_PCH_USE_ADDRESS (void * @var{address}, @ - size_t @var{size}, int @var{fd}, size_t @var{offset}) -This host hook is called when a PCH file is about to be loaded. -We want to load @var{size} bytes from @var{fd} at @var{offset} -into memory at @var{address}. The given address will be the result of -a previous invocation of @code{HOST_HOOKS_GT_PCH_GET_ADDRESS}. -Return @minus{}1 if we couldn't allocate @var{size} bytes at @var{address}. -Return 0 if the memory is allocated but the data is not loaded. Return 1 -if the hook has performed everything. - -If the implementation uses reserved address space, free any reserved -space beyond @var{size}, regardless of the return value. If no PCH will -be loaded, this hook may be called with @var{size} zero, in which case -all reserved address space should be freed. - -Do not try to handle values of @var{address} that could not have been -returned by this executable; just return @minus{}1. Such values usually -indicate an out-of-date PCH file (built by some other GCC executable), -and such a PCH file won't work. -@end deftypefn - -@deftypefn {Host Hook} size_t HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY (void); -This host hook returns the alignment required for allocating virtual -memory. Usually this is the same as getpagesize, but on some hosts the -alignment for reserving memory differs from the pagesize for committing -memory. -@end deftypefn - -@node Filesystem -@section Host Filesystem -@cindex configuration file -@cindex @file{xm-@var{machine}.h} - -GCC needs to know a number of things about the semantics of the host -machine's filesystem. Filesystems with Unix and MS-DOS semantics are -automatically detected. For other systems, you can define the -following macros in @file{xm-@var{machine}.h}. - -@ftable @code -@item HAVE_DOS_BASED_FILE_SYSTEM -This macro is automatically defined by @file{system.h} if the host -file system obeys the semantics defined by MS-DOS instead of Unix. -DOS file systems are case insensitive, file specifications may begin -with a drive letter, and both forward slash and backslash (@samp{/} -and @samp{\}) are directory separators. - -@item DIR_SEPARATOR -@itemx DIR_SEPARATOR_2 -If defined, these macros expand to character constants specifying -separators for directory names within a file specification. -@file{system.h} will automatically give them appropriate values on -Unix and MS-DOS file systems. If your file system is neither of -these, define one or both appropriately in @file{xm-@var{machine}.h}. - -However, operating systems like VMS, where constructing a pathname is -more complicated than just stringing together directory names -separated by a special character, should not define either of these -macros. - -@item PATH_SEPARATOR -If defined, this macro should expand to a character constant -specifying the separator for elements of search paths. The default -value is a colon (@samp{:}). DOS-based systems usually, but not -always, use semicolon (@samp{;}). - -@item VMS -Define this macro if the host system is VMS@. - -@item HOST_OBJECT_SUFFIX -Define this macro to be a C string representing the suffix for object -files on your host machine. If you do not define this macro, GCC will -use @samp{.o} as the suffix for object files. - -@item HOST_EXECUTABLE_SUFFIX -Define this macro to be a C string representing the suffix for -executable files on your host machine. If you do not define this macro, -GCC will use the null string as the suffix for executable files. - -@item HOST_BIT_BUCKET -A pathname defined by the host operating system, which can be opened as -a file and written to, but all the information written is discarded. -This is commonly known as a @dfn{bit bucket} or @dfn{null device}. If -you do not define this macro, GCC will use @samp{/dev/null} as the bit -bucket. If the host does not support a bit bucket, define this macro to -an invalid filename. - -@item UPDATE_PATH_HOST_CANONICALIZE (@var{path}) -If defined, a C statement (sans semicolon) that performs host-dependent -canonicalization when a path used in a compilation driver or -preprocessor is canonicalized. @var{path} is a malloc-ed path to be -canonicalized. If the C statement does canonicalize @var{path} into a -different buffer, the old path should be freed and the new buffer should -have been allocated with malloc. - -@item DUMPFILE_FORMAT -Define this macro to be a C string representing the format to use for -constructing the index part of debugging dump file names. The resultant -string must fit in fifteen bytes. The full filename will be the -concatenation of: the prefix of the assembler file name, the string -resulting from applying this format to an index number, and a string -unique to each dump file kind, e.g.@: @samp{rtl}. - -If you do not define this macro, GCC will use @samp{.%02d.}. You should -define this macro if using the default will create an invalid file name. - -@item DELETE_IF_ORDINARY -Define this macro to be a C statement (sans semicolon) that performs -host-dependent removal of ordinary temp files in the compilation driver. - -If you do not define this macro, GCC will use the default version. You -should define this macro if the default version does not reliably remove -the temp file as, for example, on VMS which allows multiple versions -of a file. - -@item HOST_LACKS_INODE_NUMBERS -Define this macro if the host filesystem does not report meaningful inode -numbers in struct stat. -@end ftable - -@node Host Misc -@section Host Misc -@cindex configuration file -@cindex @file{xm-@var{machine}.h} - -@ftable @code -@item FATAL_EXIT_CODE -A C expression for the status code to be returned when the compiler -exits after serious errors. The default is the system-provided macro -@samp{EXIT_FAILURE}, or @samp{1} if the system doesn't define that -macro. Define this macro only if these defaults are incorrect. - -@item SUCCESS_EXIT_CODE -A C expression for the status code to be returned when the compiler -exits without serious errors. (Warnings are not serious errors.) The -default is the system-provided macro @samp{EXIT_SUCCESS}, or @samp{0} if -the system doesn't define that macro. Define this macro only if these -defaults are incorrect. - -@item USE_C_ALLOCA -Define this macro if GCC should use the C implementation of @code{alloca} -provided by @file{libiberty.a}. This only affects how some parts of the -compiler itself allocate memory. It does not change code generation. - -When GCC is built with a compiler other than itself, the C @code{alloca} -is always used. This is because most other implementations have serious -bugs. You should define this macro only on a system where no -stack-based @code{alloca} can possibly work. For instance, if a system -has a small limit on the size of the stack, GCC's builtin @code{alloca} -will not work reliably. - -@item COLLECT2_HOST_INITIALIZATION -If defined, a C statement (sans semicolon) that performs host-dependent -initialization when @code{collect2} is being initialized. - -@item GCC_DRIVER_HOST_INITIALIZATION -If defined, a C statement (sans semicolon) that performs host-dependent -initialization when a compilation driver is being initialized. - -@item HOST_LONG_LONG_FORMAT -If defined, the string used to indicate an argument of type @code{long -long} to functions like @code{printf}. The default value is -@code{"ll"}. - -@item HOST_LONG_FORMAT -If defined, the string used to indicate an argument of type @code{long} -to functions like @code{printf}. The default value is @code{"l"}. - -@item HOST_PTR_PRINTF -If defined, the string used to indicate an argument of type @code{void *} -to functions like @code{printf}. The default value is @code{"%p"}. -@end ftable - -In addition, if @command{configure} generates an incorrect definition of -any of the macros in @file{auto-host.h}, you can override that -definition in a host configuration header. If you need to do this, -first see if it is possible to fix @command{configure}. diff --git a/contrib/gcc-5.0/gcc/doc/implement-c.texi b/contrib/gcc-5.0/gcc/doc/implement-c.texi deleted file mode 100644 index 333651f764..0000000000 --- a/contrib/gcc-5.0/gcc/doc/implement-c.texi +++ /dev/null @@ -1,738 +0,0 @@ -@c Copyright (C) 2001-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node C Implementation -@chapter C Implementation-Defined Behavior -@cindex implementation-defined behavior, C language - -A conforming implementation of ISO C is required to document its -choice of behavior in each of the areas that are designated -``implementation defined''. The following lists all such areas, -along with the section numbers from the ISO/IEC 9899:1990, ISO/IEC -9899:1999 and ISO/IEC 9899:2011 standards. Some areas are only -implementation-defined in one version of the standard. - -Some choices depend on the externally determined ABI for the platform -(including standard character encodings) which GCC follows; these are -listed as ``determined by ABI'' below. @xref{Compatibility, , Binary -Compatibility}, and @uref{http://gcc.gnu.org/readings.html}. Some -choices are documented in the preprocessor manual. -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. Some choices are made by the -library and operating system (or other environment when compiling for -a freestanding environment); refer to their documentation for details. - -@menu -* Translation implementation:: -* Environment implementation:: -* Identifiers implementation:: -* Characters implementation:: -* Integers implementation:: -* Floating point implementation:: -* Arrays and pointers implementation:: -* Hints implementation:: -* Structures unions enumerations and bit-fields implementation:: -* Qualifiers implementation:: -* Declarators implementation:: -* Statements implementation:: -* Preprocessing directives implementation:: -* Library functions implementation:: -* Architecture implementation:: -* Locale-specific behavior implementation:: -@end menu - -@node Translation implementation -@section Translation - -@itemize @bullet -@item -@cite{How a diagnostic is identified (C90 3.7, C99 and C11 3.10, C90, -C99 and C11 5.1.1.3).} - -Diagnostics consist of all the output sent to stderr by GCC@. - -@item -@cite{Whether each nonempty sequence of white-space characters other than -new-line is retained or replaced by one space character in translation -phase 3 (C90, C99 and C11 5.1.1.2).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@end itemize - -@node Environment implementation -@section Environment - -The behavior of most of these points are dependent on the implementation -of the C library, and are not defined by GCC itself. - -@itemize @bullet -@item -@cite{The mapping between physical source file multibyte characters -and the source character set in translation phase 1 (C90, C99 and C11 -5.1.1.2).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@end itemize - -@node Identifiers implementation -@section Identifiers - -@itemize @bullet -@item -@cite{Which additional multibyte characters may appear in identifiers -and their correspondence to universal character names (C99 and C11 6.4.2).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{The number of significant initial characters in an identifier -(C90 6.1.2, C90, C99 and C11 5.2.4.1, C99 and C11 6.4.2).} - -For internal names, all characters are significant. For external names, -the number of significant characters are defined by the linker; for -almost all targets, all characters are significant. - -@item -@cite{Whether case distinctions are significant in an identifier with -external linkage (C90 6.1.2).} - -This is a property of the linker. C99 and C11 require that case distinctions -are always significant in identifiers with external linkage and -systems without this property are not supported by GCC@. - -@end itemize - -@node Characters implementation -@section Characters - -@itemize @bullet -@item -@cite{The number of bits in a byte (C90 3.4, C99 and C11 3.6).} - -Determined by ABI@. - -@item -@cite{The values of the members of the execution character set (C90, -C99 and C11 5.2.1).} - -Determined by ABI@. - -@item -@cite{The unique value of the member of the execution character set produced -for each of the standard alphabetic escape sequences (C90, C99 and C11 -5.2.2).} - -Determined by ABI@. - -@item -@cite{The value of a @code{char} object into which has been stored any -character other than a member of the basic execution character set -(C90 6.1.2.5, C99 and C11 6.2.5).} - -Determined by ABI@. - -@item -@cite{Which of @code{signed char} or @code{unsigned char} has the same -range, representation, and behavior as ``plain'' @code{char} (C90 -6.1.2.5, C90 6.2.1.1, C99 and C11 6.2.5, C99 and C11 6.3.1.1).} - -@opindex fsigned-char -@opindex funsigned-char -Determined by ABI@. The options @option{-funsigned-char} and -@option{-fsigned-char} change the default. @xref{C Dialect Options, , -Options Controlling C Dialect}. - -@item -@cite{The mapping of members of the source character set (in character -constants and string literals) to members of the execution character -set (C90 6.1.3.4, C99 and C11 6.4.4.4, C90, C99 and C11 5.1.1.2).} - -Determined by ABI@. - -@item -@cite{The value of an integer character constant containing more than one -character or containing a character or escape sequence that does not map -to a single-byte execution character (C90 6.1.3.4, C99 and C11 6.4.4.4).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{The value of a wide character constant containing more than one -multibyte character or a single multibyte character that maps to -multiple members of the extended execution character set, or -containing a multibyte character or escape sequence not represented in -the extended execution character set (C90 6.1.3.4, C99 and C11 -6.4.4.4).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{The current locale used to convert a wide character constant consisting -of a single multibyte character that maps to a member of the extended -execution character set into a corresponding wide character code (C90 -6.1.3.4, C99 and C11 6.4.4.4).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{Whether differently-prefixed wide string literal tokens can be -concatenated and, if so, the treatment of the resulting multibyte -character sequence (C11 6.4.5).} - -Such tokens may not be concatenated. - -@item -@cite{The current locale used to convert a wide string literal into -corresponding wide character codes (C90 6.1.4, C99 and C11 6.4.5).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{The value of a string literal containing a multibyte character or escape -sequence not represented in the execution character set (C90 6.1.4, -C99 and C11 6.4.5).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. - -@item -@cite{The encoding of any of @code{wchar_t}, @code{char16_t}, and -@code{char32_t} where the corresponding standard encoding macro -(@code{__STDC_ISO_10646__}, @code{__STDC_UTF_16__}, or -@code{__STDC_UTF_32__}) is not defined (C11 6.10.8.2).} - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. @code{char16_t} and -@code{char32_t} literals are always encoded in UTF-16 and UTF-32 -respectively. - -@end itemize - -@node Integers implementation -@section Integers - -@itemize @bullet -@item -@cite{Any extended integer types that exist in the implementation (C99 -and C11 6.2.5).} - -GCC does not support any extended integer types. -@c The __mode__ attribute might create types of precisions not -@c otherwise supported, but the syntax isn't right for use everywhere -@c the standard type names might be used. Predefined typedefs should -@c be used if any extended integer types are to be defined. The -@c __int128_t and __uint128_t typedefs are not extended integer types -@c as they are generally longer than the ABI-specified intmax_t. - -@item -@cite{Whether signed integer types are represented using sign and magnitude, -two's complement, or one's complement, and whether the extraordinary value -is a trap representation or an ordinary value (C99 and C11 6.2.6.2).} - -GCC supports only two's complement integer types, and all bit patterns -are ordinary values. - -@item -@cite{The rank of any extended integer type relative to another extended -integer type with the same precision (C99 and C11 6.3.1.1).} - -GCC does not support any extended integer types. -@c If it did, there would only be one of each precision and signedness. - -@item -@cite{The result of, or the signal raised by, converting an integer to a -signed integer type when the value cannot be represented in an object of -that type (C90 6.2.1.2, C99 and C11 6.3.1.3).} - -For conversion to a type of width @math{N}, the value is reduced -modulo @math{2^N} to be within range of the type; no signal is raised. - -@item -@cite{The results of some bitwise operations on signed integers (C90 -6.3, C99 and C11 6.5).} - -Bitwise operators act on the representation of the value including -both the sign and value bits, where the sign bit is considered -immediately above the highest-value value bit. Signed @samp{>>} acts -on negative numbers by sign extension. - -GCC does not use the latitude given in C99 and C11 only to treat certain -aspects of signed @samp{<<} as undefined, but this is subject to -change. - -@item -@cite{The sign of the remainder on integer division (C90 6.3.5).} - -GCC always follows the C99 and C11 requirement that the result of division is -truncated towards zero. - -@end itemize - -@node Floating point implementation -@section Floating Point - -@itemize @bullet -@item -@cite{The accuracy of the floating-point operations and of the library -functions in @code{} and @code{} that return floating-point -results (C90, C99 and C11 5.2.4.2.2).} - -The accuracy is unknown. - -@item -@cite{The rounding behaviors characterized by non-standard values -of @code{FLT_ROUNDS} @gol -(C90, C99 and C11 5.2.4.2.2).} - -GCC does not use such values. - -@item -@cite{The evaluation methods characterized by non-standard negative -values of @code{FLT_EVAL_METHOD} (C99 and C11 5.2.4.2.2).} - -GCC does not use such values. - -@item -@cite{The direction of rounding when an integer is converted to a -floating-point number that cannot exactly represent the original -value (C90 6.2.1.3, C99 and C11 6.3.1.4).} - -C99 Annex F is followed. - -@item -@cite{The direction of rounding when a floating-point number is -converted to a narrower floating-point number (C90 6.2.1.4, C99 and C11 -6.3.1.5).} - -C99 Annex F is followed. - -@item -@cite{How the nearest representable value or the larger or smaller -representable value immediately adjacent to the nearest representable -value is chosen for certain floating constants (C90 6.1.3.1, C99 and C11 -6.4.4.2).} - -C99 Annex F is followed. - -@item -@cite{Whether and how floating expressions are contracted when not -disallowed by the @code{FP_CONTRACT} pragma (C99 and C11 6.5).} - -Expressions are currently only contracted if @option{-ffp-contract=fast}, -@option{-funsafe-math-optimizations} or @option{-ffast-math} are used. -This is subject to change. - -@item -@cite{The default state for the @code{FENV_ACCESS} pragma (C99 and C11 -7.6.1).} - -This pragma is not implemented, but the default is to ``off'' unless -@option{-frounding-math} is used in which case it is ``on''. - -@item -@cite{Additional floating-point exceptions, rounding modes, environments, -and classifications, and their macro names (C99 and C11 7.6, C99 and -C11 7.12).} - -This is dependent on the implementation of the C library, and is not -defined by GCC itself. - -@item -@cite{The default state for the @code{FP_CONTRACT} pragma (C99 and C11 -7.12.2).} - -This pragma is not implemented. Expressions are currently only -contracted if @option{-ffp-contract=fast}, -@option{-funsafe-math-optimizations} or @option{-ffast-math} are used. -This is subject to change. - -@item -@cite{Whether the ``inexact'' floating-point exception can be raised -when the rounded result actually does equal the mathematical result -in an IEC 60559 conformant implementation (C99 F.9).} - -This is dependent on the implementation of the C library, and is not -defined by GCC itself. - -@item -@cite{Whether the ``underflow'' (and ``inexact'') floating-point -exception can be raised when a result is tiny but not inexact in an -IEC 60559 conformant implementation (C99 F.9).} - -This is dependent on the implementation of the C library, and is not -defined by GCC itself. - -@end itemize - -@node Arrays and pointers implementation -@section Arrays and Pointers - -@itemize @bullet -@item -@cite{The result of converting a pointer to an integer or -vice versa (C90 6.3.4, C99 and C11 6.3.2.3).} - -A cast from pointer to integer discards most-significant bits if the -pointer representation is larger than the integer type, -sign-extends@footnote{Future versions of GCC may zero-extend, or use -a target-defined @code{ptr_extend} pattern. Do not rely on sign extension.} -if the pointer representation is smaller than the integer type, otherwise -the bits are unchanged. -@c ??? We've always claimed that pointers were unsigned entities. -@c Shouldn't we therefore be doing zero-extension? If so, the bug -@c is in convert_to_integer, where we call type_for_size and request -@c a signed integral type. On the other hand, it might be most useful -@c for the target if we extend according to POINTERS_EXTEND_UNSIGNED. - -A cast from integer to pointer discards most-significant bits if the -pointer representation is smaller than the integer type, extends according -to the signedness of the integer type if the pointer representation -is larger than the integer type, otherwise the bits are unchanged. - -When casting from pointer to integer and back again, the resulting -pointer must reference the same object as the original pointer, otherwise -the behavior is undefined. That is, one may not use integer arithmetic to -avoid the undefined behavior of pointer arithmetic as proscribed in -C99 and C11 6.5.6/8. - -@item -@cite{The size of the result of subtracting two pointers to elements -of the same array (C90 6.3.6, C99 and C11 6.5.6).} - -The value is as specified in the standard and the type is determined -by the ABI@. - -@end itemize - -@node Hints implementation -@section Hints - -@itemize @bullet -@item -@cite{The extent to which suggestions made by using the @code{register} -storage-class specifier are effective (C90 6.5.1, C99 and C11 6.7.1).} - -The @code{register} specifier affects code generation only in these ways: - -@itemize @bullet -@item -When used as part of the register variable extension, see -@ref{Explicit Reg Vars}. - -@item -When @option{-O0} is in use, the compiler allocates distinct stack -memory for all variables that do not have the @code{register} -storage-class specifier; if @code{register} is specified, the variable -may have a shorter lifespan than the code would indicate and may never -be placed in memory. - -@item -On some rare x86 targets, @code{setjmp} doesn't save the registers in -all circumstances. In those cases, GCC doesn't allocate any variables -in registers unless they are marked @code{register}. - -@end itemize - -@item -@cite{The extent to which suggestions made by using the inline function -specifier are effective (C99 and C11 6.7.4).} - -GCC will not inline any functions if the @option{-fno-inline} option is -used or if @option{-O0} is used. Otherwise, GCC may still be unable to -inline a function for many reasons; the @option{-Winline} option may be -used to determine if a function has not been inlined and why not. - -@end itemize - -@node Structures unions enumerations and bit-fields implementation -@section Structures, Unions, Enumerations, and Bit-Fields - -@itemize @bullet -@item -@cite{A member of a union object is accessed using a member of a -different type (C90 6.3.2.3).} - -The relevant bytes of the representation of the object are treated as -an object of the type used for the access. @xref{Type-punning}. This -may be a trap representation. - -@item -@cite{Whether a ``plain'' @code{int} bit-field is treated as a -@code{signed int} bit-field or as an @code{unsigned int} bit-field -(C90 6.5.2, C90 6.5.2.1, C99 and C11 6.7.2, C99 and C11 6.7.2.1).} - -@opindex funsigned-bitfields -By default it is treated as @code{signed int} but this may be changed -by the @option{-funsigned-bitfields} option. - -@item -@cite{Allowable bit-field types other than @code{_Bool}, @code{signed int}, -and @code{unsigned int} (C99 and C11 6.7.2.1).} - -Other integer types, such as @code{long int}, and enumerated types are -permitted even in strictly conforming mode. - -@item -@cite{Whether atomic types are permitted for bit-fields (C11 6.7.2.1).} - -Atomic types are not permitted for bit-fields. - -@item -@cite{Whether a bit-field can straddle a storage-unit boundary (C90 -6.5.2.1, C99 and C11 6.7.2.1).} - -Determined by ABI@. - -@item -@cite{The order of allocation of bit-fields within a unit (C90 -6.5.2.1, C99 and C11 6.7.2.1).} - -Determined by ABI@. - -@item -@cite{The alignment of non-bit-field members of structures (C90 -6.5.2.1, C99 and C11 6.7.2.1).} - -Determined by ABI@. - -@item -@cite{The integer type compatible with each enumerated type (C90 -6.5.2.2, C99 and C11 6.7.2.2).} - -@opindex fshort-enums -Normally, the type is @code{unsigned int} if there are no negative -values in the enumeration, otherwise @code{int}. If -@option{-fshort-enums} is specified, then if there are negative values -it is the first of @code{signed char}, @code{short} and @code{int} -that can represent all the values, otherwise it is the first of -@code{unsigned char}, @code{unsigned short} and @code{unsigned int} -that can represent all the values. -@c On a few unusual targets with 64-bit int, this doesn't agree with -@c the code and one of the types accessed via mode attributes (which -@c are not currently considered extended integer types) may be used. -@c If these types are made extended integer types, it would still be -@c the case that -fshort-enums stops the implementation from -@c conforming to C90 on those targets. - -On some targets, @option{-fshort-enums} is the default; this is -determined by the ABI@. - -@end itemize - -@node Qualifiers implementation -@section Qualifiers - -@itemize @bullet -@item -@cite{What constitutes an access to an object that has volatile-qualified -type (C90 6.5.3, C99 and C11 6.7.3).} - -Such an object is normally accessed by pointers and used for accessing -hardware. In most expressions, it is intuitively obvious what is a read -and what is a write. For example - -@smallexample -volatile int *dst = @var{somevalue}; -volatile int *src = @var{someothervalue}; -*dst = *src; -@end smallexample - -@noindent -will cause a read of the volatile object pointed to by @var{src} and store the -value into the volatile object pointed to by @var{dst}. There is no -guarantee that these reads and writes are atomic, especially for objects -larger than @code{int}. - -However, if the volatile storage is not being modified, and the value of -the volatile storage is not used, then the situation is less obvious. -For example - -@smallexample -volatile int *src = @var{somevalue}; -*src; -@end smallexample - -According to the C standard, such an expression is an rvalue whose type -is the unqualified version of its original type, i.e. @code{int}. Whether -GCC interprets this as a read of the volatile object being pointed to or -only as a request to evaluate the expression for its side-effects depends -on this type. - -If it is a scalar type, or on most targets an aggregate type whose only -member object is of a scalar type, or a union type whose member objects -are of scalar types, the expression is interpreted by GCC as a read of -the volatile object; in the other cases, the expression is only evaluated -for its side-effects. - -@end itemize - -@node Declarators implementation -@section Declarators - -@itemize @bullet -@item -@cite{The maximum number of declarators that may modify an arithmetic, -structure or union type (C90 6.5.4).} - -GCC is only limited by available memory. - -@end itemize - -@node Statements implementation -@section Statements - -@itemize @bullet -@item -@cite{The maximum number of @code{case} values in a @code{switch} -statement (C90 6.6.4.2).} - -GCC is only limited by available memory. - -@end itemize - -@node Preprocessing directives implementation -@section Preprocessing Directives - -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}, for details of these aspects of -implementation-defined behavior. - -@itemize @bullet -@item -@cite{The locations within @code{#pragma} directives where header name -preprocessing tokens are recognized (C11 6.4, C11 6.4.7).} - -@item -@cite{How sequences in both forms of header names are mapped to headers -or external source file names (C90 6.1.7, C99 and C11 6.4.7).} - -@item -@cite{Whether the value of a character constant in a constant expression -that controls conditional inclusion matches the value of the same character -constant in the execution character set (C90 6.8.1, C99 and C11 6.10.1).} - -@item -@cite{Whether the value of a single-character character constant in a -constant expression that controls conditional inclusion may have a -negative value (C90 6.8.1, C99 and C11 6.10.1).} - -@item -@cite{The places that are searched for an included @samp{<>} delimited -header, and how the places are specified or the header is -identified (C90 6.8.2, C99 and C11 6.10.2).} - -@item -@cite{How the named source file is searched for in an included @samp{""} -delimited header (C90 6.8.2, C99 and C11 6.10.2).} - -@item -@cite{The method by which preprocessing tokens (possibly resulting from -macro expansion) in a @code{#include} directive are combined into a header -name (C90 6.8.2, C99 and C11 6.10.2).} - -@item -@cite{The nesting limit for @code{#include} processing (C90 6.8.2, C99 -and C11 6.10.2).} - -@item -@cite{Whether the @samp{#} operator inserts a @samp{\} character before -the @samp{\} character that begins a universal character name in a -character constant or string literal (C99 and C11 6.10.3.2).} - -@item -@cite{The behavior on each recognized non-@code{STDC #pragma} -directive (C90 6.8.6, C99 and C11 6.10.6).} - -@xref{Pragmas, , Pragmas, cpp, The C Preprocessor}, for details of -pragmas accepted by GCC on all targets. @xref{Pragmas, , Pragmas -Accepted by GCC}, for details of target-specific pragmas. - -@item -@cite{The definitions for @code{__DATE__} and @code{__TIME__} when -respectively, the date and time of translation are not available (C90 -6.8.8, C99 6.10.8, C11 6.10.8.1).} - -@end itemize - -@node Library functions implementation -@section Library Functions - -The behavior of most of these points are dependent on the implementation -of the C library, and are not defined by GCC itself. - -@itemize @bullet -@item -@cite{The null pointer constant to which the macro @code{NULL} expands -(C90 7.1.6, C99 7.17, C11 7.19).} - -In @code{}, @code{NULL} expands to @code{((void *)0)}. GCC -does not provide the other headers which define @code{NULL} and some -library implementations may use other definitions in those headers. - -@end itemize - -@node Architecture implementation -@section Architecture - -@itemize @bullet -@item -@cite{The values or expressions assigned to the macros specified in the -headers @code{}, @code{}, and @code{} -(C90, C99 and C11 5.2.4.2, C99 7.18.2, C99 7.18.3, C11 7.20.2, C11 7.20.3).} - -Determined by ABI@. - -@item -@cite{The result of attempting to indirectly access an object with -automatic or thread storage duration from a thread other than the one -with which it is associated (C11 6.2.4).} - -Such accesses are supported, subject to the same requirements for -synchronization for concurrent accesses as for concurrent accesses to -any object. - -@item -@cite{The number, order, and encoding of bytes in any object -(when not explicitly specified in this International Standard) (C99 -and C11 6.2.6.1).} - -Determined by ABI@. - -@item -@cite{Whether any extended alignments are supported and the contexts -in which they are supported (C11 6.2.8).} - -Extended alignments up to @math{2^{28}} (bytes) are supported for -objects of automatic storage duration. Alignments supported for -objects of static and thread storage duration are determined by the -ABI. - -@item -@cite{Valid alignment values other than those returned by an _Alignof -expression for fundamental types, if any (C11 6.2.8).} - -Valid alignments are powers of 2 up to and including @math{2^{28}}. - -@item -@cite{The value of the result of the @code{sizeof} and @code{_Alignof} -operators (C90 6.3.3.4, C99 and C11 6.5.3.4).} - -Determined by ABI@. - -@end itemize - -@node Locale-specific behavior implementation -@section Locale-Specific Behavior - -The behavior of these points are dependent on the implementation -of the C library, and are not defined by GCC itself. diff --git a/contrib/gcc-5.0/gcc/doc/implement-cxx.texi b/contrib/gcc-5.0/gcc/doc/implement-cxx.texi deleted file mode 100644 index 66176e5636..0000000000 --- a/contrib/gcc-5.0/gcc/doc/implement-cxx.texi +++ /dev/null @@ -1,62 +0,0 @@ -@c Copyright (C) 2009-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node C++ Implementation -@chapter C++ Implementation-Defined Behavior -@cindex implementation-defined behavior, C++ language - -A conforming implementation of ISO C++ is required to document its -choice of behavior in each of the areas that are designated -``implementation defined''. The following lists all such areas, -along with the section numbers from the ISO/IEC 14882:1998 and ISO/IEC -14882:2003 standards. Some areas are only implementation-defined in -one version of the standard. - -Some choices depend on the externally determined ABI for the platform -(including standard character encodings) which GCC follows; these are -listed as ``determined by ABI'' below. @xref{Compatibility, , Binary -Compatibility}, and @uref{http://gcc.gnu.org/readings.html}. Some -choices are documented in the preprocessor manual. -@xref{Implementation-defined behavior, , Implementation-defined -behavior, cpp, The C Preprocessor}. Some choices are documented in -the corresponding document for the C language. @xref{C -Implementation}. Some choices are made by the library and operating -system (or other environment when compiling for a freestanding -environment); refer to their documentation for details. - -@menu -* Conditionally-supported behavior:: -* Exception handling:: -@end menu - -@node Conditionally-supported behavior -@section Conditionally-Supported Behavior - -@cite{Each implementation shall include documentation that identifies -all conditionally-supported constructs that it does not support (C++0x -1.4).} - -@itemize @bullet -@item -@cite{Whether an argument of class type with a non-trivial copy -constructor or destructor can be passed to ... (C++0x 5.2.2).} - -Such argument passing is supported, using the same -pass-by-invisible-reference approach used for normal function -arguments of such types. - -@end itemize - -@node Exception handling -@section Exception Handling - -@itemize @bullet -@item -@cite{In the situation where no matching handler is found, it is -implementation-defined whether or not the stack is unwound before -std::terminate() is called (C++98 15.5.1).} - -The stack is not unwound before std::terminate is called. - -@end itemize diff --git a/contrib/gcc-5.0/gcc/doc/include/fdl.texi b/contrib/gcc-5.0/gcc/doc/include/fdl.texi deleted file mode 100644 index 8f3d7be2e8..0000000000 --- a/contrib/gcc-5.0/gcc/doc/include/fdl.texi +++ /dev/null @@ -1,540 +0,0 @@ -@ignore -@c Set file name and title for man page. -@setfilename gfdl -@settitle GNU Free Documentation License -@c man begin SEEALSO -gpl(7), fsf-funding(7). -@c man end -@c man begin COPYRIGHT -Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. -@uref{http://fsf.org/} - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@c This file is intended to be included within another document, -@c hence no sectioning command or @node. -@c man end -@end ignore -@c Special handling for inclusion in the install manual. -@ifset gfdlhtml -@ifnothtml -@comment node-name, next, previous, up -@node GNU Free Documentation License, Concept Index, Old, Top -@end ifnothtml -@html -

Installing GCC: GNU Free Documentation License

-@end html -@ifnothtml -@unnumbered GNU Free Documentation License -@end ifnothtml -@end ifset -@c man begin DESCRIPTION -@ifclear gfdlhtml -@node GNU Free Documentation License -@unnumbered GNU Free Documentation License -@end ifclear - -@cindex FDL, GNU Free Documentation License -@center Version 1.3, 3 November 2008 - -@display -Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. -@uref{http://fsf.org/} - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@enumerate 0 -@item -PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -functional and useful document @dfn{free} in the sense of freedom: to -assure everyone the effective freedom to copy and redistribute it, -with or without modifying it, either commercially or noncommercially. -Secondarily, this License preserves for the author and publisher a way -to get credit for their work, while not being considered responsible -for modifications made by others. - -This License is a kind of ``copyleft'', which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - -@item -APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work, in any medium, that -contains a notice placed by the copyright holder saying it can be -distributed under the terms of this License. Such a notice grants a -world-wide, royalty-free license, unlimited in duration, to use that -work under the conditions stated herein. The ``Document'', below, -refers to any such manual or work. Any member of the public is a -licensee, and is addressed as ``you''. You accept the license if you -copy, modify or distribute the work in a way requiring permission -under copyright law. - -A ``Modified Version'' of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A ``Secondary Section'' is a named appendix or a front-matter section -of the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall -subject (or to related matters) and contains nothing that could fall -directly within that overall subject. (Thus, if the Document is in -part a textbook of mathematics, a Secondary Section may not explain -any mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The ``Invariant Sections'' are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. If a -section does not fit the above definition of Secondary then it is not -allowed to be designated as Invariant. The Document may contain zero -Invariant Sections. If the Document does not identify any Invariant -Sections then there are none. - -The ``Cover Texts'' are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. A Front-Cover Text may -be at most 5 words, and a Back-Cover Text may be at most 25 words. - -A ``Transparent'' copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, that is suitable for revising the document -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup, or absence of markup, has been arranged to thwart -or discourage subsequent modification by readers is not Transparent. -An image format is not Transparent if used for any substantial amount -of text. A copy that is not ``Transparent'' is called ``Opaque''. - -Examples of suitable formats for Transparent copies include plain -@sc{ascii} without markup, Texinfo input format, La@TeX{} input -format, @acronym{SGML} or @acronym{XML} using a publicly available -@acronym{DTD}, and standard-conforming simple @acronym{HTML}, -PostScript or @acronym{PDF} designed for human modification. Examples -of transparent image formats include @acronym{PNG}, @acronym{XCF} and -@acronym{JPG}. Opaque formats include proprietary formats that can be -read and edited only by proprietary word processors, @acronym{SGML} or -@acronym{XML} for which the @acronym{DTD} and/or processing tools are -not generally available, and the machine-generated @acronym{HTML}, -PostScript or @acronym{PDF} produced by some word processors for -output purposes only. - -The ``Title Page'' means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, ``Title Page'' means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - -The ``publisher'' means any person or entity that distributes copies -of the Document to the public. - -A section ``Entitled XYZ'' means a named subunit of the Document whose -title either is precisely XYZ or contains XYZ in parentheses following -text that translates XYZ in another language. (Here XYZ stands for a -specific section name mentioned below, such as ``Acknowledgements'', -``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' -of such a section when you modify the Document means that it remains a -section ``Entitled XYZ'' according to this definition. - -The Document may include Warranty Disclaimers next to the notice which -states that this License applies to the Document. These Warranty -Disclaimers are considered to be included by reference in this -License, but only as regards disclaiming warranties: any other -implication that these Warranty Disclaimers may have is void and has -no effect on the meaning of this License. - -@item -VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - -@item -COPYING IN QUANTITY - -If you publish printed copies (or copies in media that commonly have -printed covers) of the Document, numbering more than 100, and the -Document's license notice requires Cover Texts, you must enclose the -copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a computer-network location from which the general network-using -public has access to download using public-standard network protocols -a complete Transparent copy of the Document, free of added material. -If you use the latter option, you must take reasonably prudent steps, -when you begin distribution of Opaque copies in quantity, to ensure -that this Transparent copy will remain thus accessible at the stated -location until at least one year after the last time you distribute an -Opaque copy (directly or through your agents or retailers) of that -edition to the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - -@item -MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -@enumerate A -@item -Use in the Title Page (and on the covers, if any) a title distinct -from that of the Document, and from those of previous versions -(which should, if there were any, be listed in the History section -of the Document). You may use the same title as a previous version -if the original publisher of that version gives permission. - -@item -List on the Title Page, as authors, one or more persons or entities -responsible for authorship of the modifications in the Modified -Version, together with at least five of the principal authors of the -Document (all of its principal authors, if it has fewer than five), -unless they release you from this requirement. - -@item -State on the Title page the name of the publisher of the -Modified Version, as the publisher. - -@item -Preserve all the copyright notices of the Document. - -@item -Add an appropriate copyright notice for your modifications -adjacent to the other copyright notices. - -@item -Include, immediately after the copyright notices, a license notice -giving the public permission to use the Modified Version under the -terms of this License, in the form shown in the Addendum below. - -@item -Preserve in that license notice the full lists of Invariant Sections -and required Cover Texts given in the Document's license notice. - -@item -Include an unaltered copy of this License. - -@item -Preserve the section Entitled ``History'', Preserve its Title, and add -to it an item stating at least the title, year, new authors, and -publisher of the Modified Version as given on the Title Page. If -there is no section Entitled ``History'' in the Document, create one -stating the title, year, authors, and publisher of the Document as -given on its Title Page, then add an item describing the Modified -Version as stated in the previous sentence. - -@item -Preserve the network location, if any, given in the Document for -public access to a Transparent copy of the Document, and likewise -the network locations given in the Document for previous versions -it was based on. These may be placed in the ``History'' section. -You may omit a network location for a work that was published at -least four years before the Document itself, or if the original -publisher of the version it refers to gives permission. - -@item -For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve -the Title of the section, and preserve in the section all the -substance and tone of each of the contributor acknowledgements and/or -dedications given therein. - -@item -Preserve all the Invariant Sections of the Document, -unaltered in their text and in their titles. Section numbers -or the equivalent are not considered part of the section titles. - -@item -Delete any section Entitled ``Endorsements''. Such a section -may not be included in the Modified Version. - -@item -Do not retitle any existing section to be Entitled ``Endorsements'' or -to conflict in title with any Invariant Section. - -@item -Preserve any Warranty Disclaimers. -@end enumerate - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section Entitled ``Endorsements'', provided it contains -nothing but endorsements of your Modified Version by various -parties---for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - -@item -COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice, and that you preserve all their Warranty Disclaimers. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections Entitled ``History'' -in the various original documents, forming one section Entitled -``History''; likewise combine any sections Entitled ``Acknowledgements'', -and any sections Entitled ``Dedications''. You must delete all -sections Entitled ``Endorsements.'' - -@item -COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - -@item -AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, is called an ``aggregate'' if the copyright -resulting from the compilation is not used to limit the legal rights -of the compilation's users beyond what the individual works permit. -When the Document is included in an aggregate, this License does not -apply to the other works in the aggregate which are not themselves -derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one half of -the entire aggregate, the Document's Cover Texts may be placed on -covers that bracket the Document within the aggregate, or the -electronic equivalent of covers if the Document is in electronic form. -Otherwise they must appear on printed covers that bracket the whole -aggregate. - -@item -TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License, and all the license notices in the -Document, and any Warranty Disclaimers, provided that you also include -the original English version of this License and the original versions -of those notices and disclaimers. In case of a disagreement between -the translation and the original version of this License or a notice -or disclaimer, the original version will prevail. - -If a section in the Document is Entitled ``Acknowledgements'', -``Dedications'', or ``History'', the requirement (section 4) to Preserve -its Title (section 1) will typically require changing the actual -title. - -@item -TERMINATION - -You may not copy, modify, sublicense, or distribute the Document -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense, or distribute it is void, and -will automatically terminate your rights under this License. - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, receipt of a copy of some or all of the same material does -not give you any rights to use it. - -@item -FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. See -@uref{http://www.gnu.org/copyleft/}. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License ``or any later version'' applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. If the Document -specifies that a proxy can decide which future versions of this -License can be used, that proxy's public statement of acceptance of a -version permanently authorizes you to choose that version for the -Document. - -@item -RELICENSING - -``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any -World Wide Web server that publishes copyrightable works and also -provides prominent facilities for anybody to edit those works. A -public wiki that anybody can edit is an example of such a server. A -``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the -site means any set of copyrightable works thus published on the MMC -site. - -``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 -license published by Creative Commons Corporation, a not-for-profit -corporation with a principal place of business in San Francisco, -California, as well as future copyleft versions of that license -published by that same organization. - -``Incorporate'' means to publish or republish a Document, in whole or -in part, as part of another Document. - -An MMC is ``eligible for relicensing'' if it is licensed under this -License, and if all works that were first published under this License -somewhere other than this MMC, and subsequently incorporated in whole -or in part into the MMC, (1) had no cover texts or invariant sections, -and (2) were thus incorporated prior to November 1, 2008. - -The operator of an MMC Site may republish an MMC contained in the site -under CC-BY-SA on the same site at any time before August 1, 2009, -provided the MMC is eligible for relicensing. - -@end enumerate - -@page -@unnumberedsec ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - -@smallexample -@group - Copyright (C) @var{year} @var{your name}. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. -@end group -@end smallexample - -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with...Texts.'' line with this: - -@smallexample -@group - with the Invariant Sections being @var{list their titles}, with - the Front-Cover Texts being @var{list}, and with the Back-Cover Texts - being @var{list}. -@end group -@end smallexample - -If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. - -@c Local Variables: -@c ispell-local-pdict: "ispell-dict" -@c End: - -@c man end diff --git a/contrib/gcc-5.0/gcc/doc/include/funding.texi b/contrib/gcc-5.0/gcc/doc/include/funding.texi deleted file mode 100644 index d1583fabc0..0000000000 --- a/contrib/gcc-5.0/gcc/doc/include/funding.texi +++ /dev/null @@ -1,60 +0,0 @@ -@ignore -@c Set file name and title for man page. -@setfilename fsf-funding -@settitle Funding Free Software -@c man begin SEEALSO -gpl(7), gfdl(7). -@c man end -@end ignore -@node Funding -@c man begin DESCRIPTION -@unnumbered Funding Free Software - -If you want to have more free software a few years from now, it makes -sense for you to help encourage people to contribute funds for its -development. The most effective approach known is to encourage -commercial redistributors to donate. - -Users of free software systems can boost the pace of development by -encouraging for-a-fee distributors to donate part of their selling price -to free software developers---the Free Software Foundation, and others. - -The way to convince distributors to do this is to demand it and expect -it from them. So when you compare distributors, judge them partly by -how much they give to free software development. Show distributors -they must compete to be the one who gives the most. - -To make this approach work, you must insist on numbers that you can -compare, such as, ``We will donate ten dollars to the Frobnitz project -for each disk sold.'' Don't be satisfied with a vague promise, such as -``A portion of the profits are donated,'' since it doesn't give a basis -for comparison. - -Even a precise fraction ``of the profits from this disk'' is not very -meaningful, since creative accounting and unrelated business decisions -can greatly alter what fraction of the sales price counts as profit. -If the price you pay is $50, ten percent of the profit is probably -less than a dollar; it might be a few cents, or nothing at all. - -Some redistributors do development work themselves. This is useful too; -but to keep everyone honest, you need to inquire how much they do, and -what kind. Some kinds of development make much more long-term -difference than others. For example, maintaining a separate version of -a program contributes very little; maintaining the standard version of a -program for the whole community contributes much. Easy new ports -contribute little, since someone else would surely do them; difficult -ports such as adding a new CPU to the GNU Compiler Collection contribute more; -major new features or packages contribute the most. - -By establishing the idea that supporting further development is ``the -proper thing to do'' when distributing free software for a fee, we can -assure a steady flow of resources into making more free software. -@c man end - -@display -@c man begin COPYRIGHT -Copyright @copyright{} 1994 Free Software Foundation, Inc. -Verbatim copying and redistribution of this section is permitted -without royalty; alteration is not permitted. -@c man end -@end display diff --git a/contrib/gcc-5.0/gcc/doc/include/gcc-common.texi b/contrib/gcc-5.0/gcc/doc/include/gcc-common.texi deleted file mode 100644 index b0d06725c7..0000000000 --- a/contrib/gcc-5.0/gcc/doc/include/gcc-common.texi +++ /dev/null @@ -1,73 +0,0 @@ -@c Copyright (C) 2001-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@c Version number and development mode. -@c version-GCC is @set to the base GCC version number. -@c DEVELOPMENT is @set for an in-development version, @clear for a -@c release version (corresponding to ``experimental''/anything else -@c in gcc/DEV-PHASE). - -@include gcc-vers.texi - -@c Common macros to support generating man pages: - -@macro gcctabopt{body} -@code{\body\} -@end macro -@macro gccoptlist{body} -@smallexample -\body\ -@end smallexample -@end macro -@c Makeinfo handles the above macro OK, TeX needs manual line breaks; -@c they get lost at some point in handling the macro. But if @macro is -@c used here rather than @alias, it produces double line breaks. -@iftex -@alias gol = * -@end iftex -@ifnottex -@macro gol -@end macro -@end ifnottex - -@c For FSF printing, define FSFPRINT. Also update the ISBN and last -@c printing date for the manual being printed. -@c @set FSFPRINT -@ifset FSFPRINT -@smallbook -@finalout -@c Cause even numbered pages to be printed on the left hand side of -@c the page and odd numbered pages to be printed on the right hand -@c side of the page. Using this, you can print on both sides of a -@c sheet of paper and have the text on the same part of the sheet. - -@c The text on right hand pages is pushed towards the right hand -@c margin and the text on left hand pages is pushed toward the left -@c hand margin. -@c (To provide the reverse effect, set bindingoffset to -0.75in.) -@tex -\global\bindingoffset=0.75in -\global\normaloffset =0.75in -@end tex -@end ifset - -@c Macro to generate a "For the N.N.N version" subtitle on the title -@c page of TeX documentation. This macro should be used in the -@c titlepage environment after the title and any other subtitles have -@c been placed, and before any authors are placed. -@macro versionsubtitle -@ifclear DEVELOPMENT -@subtitle For @sc{gcc} version @value{version-GCC} -@end ifclear -@ifset DEVELOPMENT -@subtitle For @sc{gcc} version @value{version-GCC} (pre-release) -@end ifset -@ifset VERSION_PACKAGE -@sp 1 -@subtitle @value{VERSION_PACKAGE} -@end ifset -@c Even if there are no authors, the second titlepage line should be -@c forced to the bottom of the page. -@vskip 0pt plus 1filll -@end macro diff --git a/contrib/gcc-5.0/gcc/doc/include/gpl_v3.texi b/contrib/gcc-5.0/gcc/doc/include/gpl_v3.texi deleted file mode 100644 index 3180677736..0000000000 --- a/contrib/gcc-5.0/gcc/doc/include/gpl_v3.texi +++ /dev/null @@ -1,733 +0,0 @@ -@ignore -@c Set file name and title for man page. -@setfilename gpl -@settitle GNU General Public License -@c man begin SEEALSO -gfdl(7), fsf-funding(7). -@c man end -@c man begin COPYRIGHT -Copyright @copyright{} 2007 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. -@c man end -@end ignore -@node Copying -@c man begin DESCRIPTION -@unnumbered GNU General Public License -@center Version 3, 29 June 2007 - -@c This file is intended to be included in another file. - -@display -Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. -@end display - -@heading Preamble - -The GNU General Public License is a free, copyleft license for -software and other kinds of works. - -The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom -to share and change all versions of a program--to make sure it remains -free software for all its users. We, the Free Software Foundation, -use the GNU General Public License for most of our software; it -applies also to any other work released this way by its authors. You -can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you -have certain responsibilities if you distribute copies of the -software, or if you modify it: responsibilities to respect the freedom -of others. - -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, -receive or can get the source code. And you must show them these -terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - -Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the -manufacturer can do so. This is fundamentally incompatible with the -aim of protecting users' freedom to change the software. The -systematic pattern of such abuse occurs in the area of products for -individuals to use, which is precisely where it is most unacceptable. -Therefore, we have designed this version of the GPL to prohibit the -practice for those products. If such problems arise substantially in -other domains, we stand ready to extend this provision to those -domains in future versions of the GPL, as needed to protect the -freedom of users. - -Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish -to avoid the special danger that patents applied to a free program -could make it effectively proprietary. To prevent this, the GPL -assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and -modification follow. - -@heading TERMS AND CONDITIONS - -@enumerate 0 -@item Definitions. - -``This License'' refers to version 3 of the GNU General Public License. - -``Copyright'' also means copyright-like laws that apply to other kinds -of works, such as semiconductor masks. - -``The Program'' refers to any copyrightable work licensed under this -License. Each licensee is addressed as ``you''. ``Licensees'' and -``recipients'' may be individuals or organizations. - -To ``modify'' a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of -an exact copy. The resulting work is called a ``modified version'' of -the earlier work or a work ``based on'' the earlier work. - -A ``covered work'' means either the unmodified Program or a work based -on the Program. - -To ``propagate'' a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - -To ``convey'' a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user -through a computer network, with no transfer of a copy, is not -conveying. - -An interactive user interface displays ``Appropriate Legal Notices'' to -the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - -@item Source Code. - -The ``source code'' for a work means the preferred form of the work for -making modifications to it. ``Object code'' means any non-source form -of a work. - -A ``Standard Interface'' means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - -The ``System Libraries'' of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -``Major Component'', in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - -The ``Corresponding Source'' for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can -regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same -work. - -@item Basic Permissions. - -All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, -without conditions so long as your license otherwise remains in force. -You may convey covered works to others for the sole purpose of having -them make modifications exclusively for you, or provide you with -facilities for running those works, provided that you comply with the -terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for -you must do so exclusively on your behalf, under your direction and -control, on terms that prohibit them from making any copies of your -copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - -@item Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such -circumvention is effected by exercising rights under this License with -respect to the covered work, and you disclaim any intention to limit -operation or modification of the work as a means of enforcing, against -the work's users, your or third parties' legal rights to forbid -circumvention of technological measures. - -@item Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - -@item Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these -conditions: - -@enumerate a -@item -The work must carry prominent notices stating that you modified it, -and giving a relevant date. - -@item -The work must carry prominent notices stating that it is released -under this License and any conditions added under section 7. This -requirement modifies the requirement in section 4 to ``keep intact all -notices''. - -@item -You must license the entire work, as a whole, under this License to -anyone who comes into possession of a copy. This License will -therefore apply, along with any applicable section 7 additional terms, -to the whole of the work, and all its parts, regardless of how they -are packaged. This License gives no permission to license the work in -any other way, but it does not invalidate such permission if you have -separately received it. - -@item -If the work has interactive user interfaces, each must display -Appropriate Legal Notices; however, if the Program has interactive -interfaces that do not display Appropriate Legal Notices, your work -need not make them do so. -@end enumerate - -A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -``aggregate'' if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -@item Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of -sections 4 and 5, provided that you also convey the machine-readable -Corresponding Source under the terms of this License, in one of these -ways: - -@enumerate a -@item -Convey the object code in, or embodied in, a physical product -(including a physical distribution medium), accompanied by the -Corresponding Source fixed on a durable physical medium customarily -used for software interchange. - -@item -Convey the object code in, or embodied in, a physical product -(including a physical distribution medium), accompanied by a written -offer, valid for at least three years and valid for as long as you -offer spare parts or customer support for that product model, to give -anyone who possesses the object code either (1) a copy of the -Corresponding Source for all the software in the product that is -covered by this License, on a durable physical medium customarily used -for software interchange, for a price no more than your reasonable -cost of physically performing this conveying of source, or (2) access -to copy the Corresponding Source from a network server at no charge. - -@item -Convey individual copies of the object code with a copy of the written -offer to provide the Corresponding Source. This alternative is -allowed only occasionally and noncommercially, and only if you -received the object code with such an offer, in accord with subsection -6b. - -@item -Convey the object code by offering access from a designated place -(gratis or for a charge), and offer equivalent access to the -Corresponding Source in the same way through the same place at no -further charge. You need not require recipients to copy the -Corresponding Source along with the object code. If the place to copy -the object code is a network server, the Corresponding Source may be -on a different server (operated by you or a third party) that supports -equivalent copying facilities, provided you maintain clear directions -next to the object code saying where to find the Corresponding Source. -Regardless of what server hosts the Corresponding Source, you remain -obligated to ensure that it is available for as long as needed to -satisfy these requirements. - -@item -Convey the object code using peer-to-peer transmission, provided you -inform other peers where the object code and Corresponding Source of -the work are being offered to the general public at no charge under -subsection 6d. - -@end enumerate - -A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - -A ``User Product'' is either (1) a ``consumer product'', which means any -tangible personal property which is normally used for personal, -family, or household purposes, or (2) anything designed or sold for -incorporation into a dwelling. In determining whether a product is a -consumer product, doubtful cases shall be resolved in favor of -coverage. For a particular product received by a particular user, -``normally used'' refers to a typical or common use of that class of -product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected -to use, the product. A product is a consumer product regardless of -whether the product has substantial commercial, industrial or -non-consumer uses, unless such uses represent the only significant -mode of use of the product. - -``Installation Information'' for a User Product means any methods, -procedures, authorization keys, or other information required to -install and execute modified versions of a covered work in that User -Product from a modified version of its Corresponding Source. The -information must suffice to ensure that the continued functioning of -the modified object code is in no case prevented or interfered with -solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or -updates for a work that has been modified or installed by the -recipient, or for the User Product in which it has been modified or -installed. Access to a network may be denied when the modification -itself materially and adversely affects the operation of the network -or violates the rules and protocols for communication across the -network. - -Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - -@item Additional Terms. - -``Additional permissions'' are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders -of that material) supplement the terms of this License with terms: - -@enumerate a -@item -Disclaiming warranty or limiting liability differently from the terms -of sections 15 and 16 of this License; or - -@item -Requiring preservation of specified reasonable legal notices or author -attributions in that material or in the Appropriate Legal Notices -displayed by works containing it; or - -@item -Prohibiting misrepresentation of the origin of that material, or -requiring that modified versions of such material be marked in -reasonable ways as different from the original version; or - -@item -Limiting the use for publicity purposes of names of licensors or -authors of the material; or - -@item -Declining to grant rights under trademark law for use of some trade -names, trademarks, or service marks; or - -@item -Requiring indemnification of licensors and authors of that material by -anyone who conveys the material (or modified versions of it) with -contractual assumptions of liability to the recipient, for any -liability that these contractual assumptions directly impose on those -licensors and authors. -@end enumerate - -All other non-permissive additional terms are considered ``further -restrictions'' within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; the -above requirements apply either way. - -@item Termination. - -You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - -@item Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run -a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - -@item Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - -An ``entity transaction'' is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - -@item Patents. - -A ``contributor'' is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's ``contributor version''. - -A contributor's ``essential patent claims'' are all patent claims owned -or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, ``control'' includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - -In the following three paragraphs, a ``patent license'' is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To ``grant'' such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - -If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. ``Knowingly relying'' means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - -A patent license is ``discriminatory'' if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on -the non-exercise of one or more of the rights that are specifically -granted under this License. You may not convey a covered work if you -are a party to an arrangement with a third party that is in the -business of distributing software, under which you make payment to the -third party based on the extent of your activity of conveying the -work, and under which the third party grants, to any of the parties -who would receive the covered work from you, a discriminatory patent -license (a) in connection with copies of the covered work conveyed by -you (or copies made from those copies), or (b) primarily for and in -connection with specific products or compilations that contain the -covered work, unless you entered into that arrangement, or that patent -license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - -@item No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey -a covered work so as to satisfy simultaneously your obligations under -this License and any other pertinent obligations, then as a -consequence you may not convey it at all. For example, if you agree -to terms that obligate you to collect a royalty for further conveying -from those to whom you convey the Program, the only way you could -satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -@item Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - -@item Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies that a certain numbered version of the GNU General Public -License ``or any later version'' applies to it, you have the option of -following the terms and conditions either of that numbered version or -of any later version published by the Free Software Foundation. If -the Program does not specify a version number of the GNU General -Public License, you may choose any version ever published by the Free -Software Foundation. - -If the Program specifies that a proxy can decide which future versions -of the GNU General Public License can be used, that proxy's public -statement of acceptance of a version permanently authorizes you to -choose that version for the Program. - -Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - -@item Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -@item Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR -CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR -LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM -TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER -PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -@item Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - -@end enumerate - -@heading END OF TERMS AND CONDITIONS - -@heading How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the ``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and a brief idea of what it does.} -Copyright (C) @var{year} @var{name of author} - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or (at -your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see @url{http://www.gnu.org/licenses/}. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - -@smallexample -@var{program} Copyright (C) @var{year} @var{name of author} -This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}. -This is free software, and you are welcome to redistribute it -under certain conditions; type @samp{show c} for details. -@end smallexample - -The hypothetical commands @samp{show w} and @samp{show c} should show -the appropriate parts of the General Public License. Of course, your -program's commands might be different; for a GUI interface, you would -use an ``about box''. - -You should also get your employer (if you work as a programmer) or school, -if any, to sign a ``copyright disclaimer'' for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -@url{http://www.gnu.org/licenses/}. - -The GNU General Public License does not permit incorporating your -program into proprietary programs. If your program is a subroutine -library, you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use -the GNU Lesser General Public License instead of this License. But -first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}. -@c man end diff --git a/contrib/gcc-5.0/gcc/doc/interface.texi b/contrib/gcc-5.0/gcc/doc/interface.texi deleted file mode 100644 index 26f6dd938a..0000000000 --- a/contrib/gcc-5.0/gcc/doc/interface.texi +++ /dev/null @@ -1,70 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Interface -@chapter Interfacing to GCC Output -@cindex interfacing to GCC output -@cindex run-time conventions -@cindex function call conventions -@cindex conventions, run-time - -GCC is normally configured to use the same function calling convention -normally in use on the target system. This is done with the -machine-description macros described (@pxref{Target Macros}). - -@cindex unions, returning -@cindex structures, returning -@cindex returning structures and unions -However, returning of structure and union values is done differently on -some target machines. As a result, functions compiled with PCC -returning such types cannot be called from code compiled with GCC, -and vice versa. This does not cause trouble often because few Unix -library routines return structures or unions. - -GCC code returns structures and unions that are 1, 2, 4 or 8 bytes -long in the same registers used for @code{int} or @code{double} return -values. (GCC typically allocates variables of such types in -registers also.) Structures and unions of other sizes are returned by -storing them into an address passed by the caller (usually in a -register). The target hook @code{TARGET_STRUCT_VALUE_RTX} -tells GCC where to pass this address. - -By contrast, PCC on most target machines returns structures and unions -of any size by copying the data into an area of static storage, and then -returning the address of that storage as if it were a pointer value. -The caller must copy the data from that memory area to the place where -the value is wanted. This is slower than the method used by GCC, and -fails to be reentrant. - -On some target machines, such as RISC machines and the 80386, the -standard system convention is to pass to the subroutine the address of -where to return the value. On these machines, GCC has been -configured to be compatible with the standard compiler, when this method -is used. It may not be compatible for structures of 1, 2, 4 or 8 bytes. - -@cindex argument passing -@cindex passing arguments -GCC uses the system's standard convention for passing arguments. On -some machines, the first few arguments are passed in registers; in -others, all are passed on the stack. It would be possible to use -registers for argument passing on any machine, and this would probably -result in a significant speedup. But the result would be complete -incompatibility with code that follows the standard convention. So this -change is practical only if you are switching to GCC as the sole C -compiler for the system. We may implement register argument passing on -certain machines once we have a complete GNU system so that we can -compile the libraries with GCC@. - -On some machines (particularly the SPARC), certain types of arguments -are passed ``by invisible reference''. This means that the value is -stored in memory, and the address of the memory location is passed to -the subroutine. - -@cindex @code{longjmp} and automatic variables -If you use @code{longjmp}, beware of automatic variables. ISO C says that -automatic variables that are not declared @code{volatile} have undefined -values after a @code{longjmp}. And this is all GCC promises to do, -because it is very difficult to restore register variables correctly, and -one of GCC's features is that it can put variables in registers without -your asking it to. diff --git a/contrib/gcc-5.0/gcc/doc/invoke.texi b/contrib/gcc-5.0/gcc/doc/invoke.texi deleted file mode 100644 index c058710234..0000000000 --- a/contrib/gcc-5.0/gcc/doc/invoke.texi +++ /dev/null @@ -1,24252 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@ignore -@c man begin INCLUDE -@include gcc-vers.texi -@c man end - -@c man begin COPYRIGHT -Copyright @copyright{} 1988-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``GNU General Public License'' and ``Funding -Free Software'', the Front-Cover texts being (a) (see below), and with -the Back-Cover Texts being (b) (see below). A copy of the license is -included in the gfdl(7) man page. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@c man end -@c Set file name and title for the man page. -@setfilename gcc -@settitle GNU project C and C++ compiler -@c man begin SYNOPSIS -gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] - [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] - [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}] - [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] - [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] - [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] - [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} - -Only the most useful options are listed here; see below for the -remainder. @command{g++} accepts mostly the same options as @command{gcc}. -@c man end -@c man begin SEEALSO -gpl(7), gfdl(7), fsf-funding(7), -cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) -and the Info entries for @file{gcc}, @file{cpp}, @file{as}, -@file{ld}, @file{binutils} and @file{gdb}. -@c man end -@c man begin BUGS -For instructions on reporting bugs, see -@w{@value{BUGURL}}. -@c man end -@c man begin AUTHOR -See the Info entry for @command{gcc}, or -@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, -for contributors to GCC@. -@c man end -@end ignore - -@node Invoking GCC -@chapter GCC Command Options -@cindex GCC command options -@cindex command options -@cindex options, GCC command - -@c man begin DESCRIPTION -When you invoke GCC, it normally does preprocessing, compilation, -assembly and linking. The ``overall options'' allow you to stop this -process at an intermediate stage. For example, the @option{-c} option -says not to run the linker. Then the output consists of object files -output by the assembler. - -Other options are passed on to one stage of processing. Some options -control the preprocessor and others the compiler itself. Yet other -options control the assembler and linker; most of these are not -documented here, since you rarely need to use any of them. - -@cindex C compilation options -Most of the command-line options that you can use with GCC are useful -for C programs; when an option is only useful with another language -(usually C++), the explanation says so explicitly. If the description -for a particular option does not mention a source language, you can use -that option with all supported languages. - -@cindex C++ compilation options -@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special -options for compiling C++ programs. - -@cindex grouping options -@cindex options, grouping -The @command{gcc} program accepts options and file names as operands. Many -options have multi-letter names; therefore multiple single-letter options -may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d --v}}. - -@cindex order of options -@cindex options, order -You can mix options and other arguments. For the most part, the order -you use doesn't matter. Order does matter when you use several -options of the same kind; for example, if you specify @option{-L} more -than once, the directories are searched in the order specified. Also, -the placement of the @option{-l} option is significant. - -Many options have long names starting with @samp{-f} or with -@samp{-W}---for example, -@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of -these have both positive and negative forms; the negative form of -@option{-ffoo} is @option{-fno-foo}. This manual documents -only one of these two forms, whichever one is not the default. - -@c man end - -@xref{Option Index}, for an index to GCC's options. - -@menu -* Option Summary:: Brief list of all options, without explanations. -* Overall Options:: Controlling the kind of output: - an executable, object files, assembler files, - or preprocessed source. -* Invoking G++:: Compiling C++ programs. -* C Dialect Options:: Controlling the variant of C language compiled. -* C++ Dialect Options:: Variations on C++. -* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C - and Objective-C++. -* Language Independent Options:: Controlling how diagnostics should be - formatted. -* Warning Options:: How picky should the compiler be? -* Debugging Options:: Symbol tables, measurements, and debugging dumps. -* Optimize Options:: How much optimization? -* Preprocessor Options:: Controlling header files and macro definitions. - Also, getting dependency information for Make. -* Assembler Options:: Passing options to the assembler. -* Link Options:: Specifying libraries and so on. -* Directory Options:: Where to find header files and libraries. - Where to find the compiler executable files. -* Spec Files:: How to pass switches to sub-processes. -* Target Options:: Running a cross-compiler, or an old version of GCC. -* Submodel Options:: Specifying minor hardware or convention variations, - such as 68010 vs 68020. -* Code Gen Options:: Specifying conventions for function calls, data layout - and register usage. -* Environment Variables:: Env vars that affect GCC. -* Precompiled Headers:: Compiling a header once, and using it many times. -@end menu - -@c man begin OPTIONS - -@node Option Summary -@section Option Summary - -Here is a summary of all the options, grouped by type. Explanations are -in the following sections. - -@table @emph -@item Overall Options -@xref{Overall Options,,Options Controlling the Kind of Output}. -@gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol --pipe -pass-exit-codes @gol --x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol ---version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol --fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} - -@item C Language Options -@xref{C Dialect Options,,Options Controlling C Dialect}. -@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol --aux-info @var{filename} -fallow-parameterless-variadic-functions @gol --fno-asm -fno-builtin -fno-builtin-@var{function} @gol --fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol --fms-extensions -fplan9-extensions -trigraphs -traditional -traditional-cpp @gol --fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol --fsigned-bitfields -fsigned-char @gol --funsigned-bitfields -funsigned-char} - -@item C++ Language Options -@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. -@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol --fconstexpr-depth=@var{n} -ffriend-injection @gol --fno-elide-constructors @gol --fno-enforce-eh-specs @gol --ffor-scope -fno-for-scope -fno-gnu-keywords @gol --fno-implicit-templates @gol --fno-implicit-inline-templates @gol --fno-implement-inlines -fms-extensions @gol --fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol --fno-optional-diags -fpermissive @gol --fno-pretty-templates @gol --frepo -fno-rtti -fsized-deallocation @gol --fstats -ftemplate-backtrace-limit=@var{n} @gol --ftemplate-depth=@var{n} @gol --fno-threadsafe-statics -fuse-cxa-atexit @gol --fno-weak -nostdinc++ @gol --fvisibility-inlines-hidden @gol --fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol --fvtv-counts -fvtv-debug @gol --fvisibility-ms-compat @gol --fext-numeric-literals @gol --Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol --Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol --Wnoexcept -Wnon-virtual-dtor -Wreorder @gol --Weffc++ -Wstrict-null-sentinel @gol --Wno-non-template-friend -Wold-style-cast @gol --Woverloaded-virtual -Wno-pmf-conversions @gol --Wsign-promo} - -@item Objective-C and Objective-C++ Language Options -@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling -Objective-C and Objective-C++ Dialects}. -@gccoptlist{-fconstant-string-class=@var{class-name} @gol --fgnu-runtime -fnext-runtime @gol --fno-nil-receivers @gol --fobjc-abi-version=@var{n} @gol --fobjc-call-cxx-cdtors @gol --fobjc-direct-dispatch @gol --fobjc-exceptions @gol --fobjc-gc @gol --fobjc-nilcheck @gol --fobjc-std=objc1 @gol --fno-local-ivars @gol --fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol --freplace-objc-classes @gol --fzero-link @gol --gen-decls @gol --Wassign-intercept @gol --Wno-protocol -Wselector @gol --Wstrict-selector-match @gol --Wundeclared-selector} - -@item Language Independent Options -@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. -@gccoptlist{-fmessage-length=@var{n} @gol --fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol --fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol --fno-diagnostics-show-option -fno-diagnostics-show-caret} - -@item Warning Options -@xref{Warning Options,,Options to Request or Suppress Warnings}. -@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol --pedantic-errors @gol --w -Wextra -Wall -Waddress -Waggregate-return @gol --Waggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol --Wbool-compare @gol --Wno-attributes -Wno-builtin-macro-redefined @gol --Wc90-c99-compat -Wc99-c11-compat @gol --Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol --Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol --Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol --Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol --Wdisabled-optimization @gol --Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol --Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol --Wno-endif-labels -Werror -Werror=* @gol --Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol --Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol --Wformat-security -Wformat-signedness -Wformat-y2k @gol --Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol --Wignored-qualifiers -Wincompatible-pointer-types @gol --Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol --Winit-self -Winline -Wno-int-conversion @gol --Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol --Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol --Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol --Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol --Wmissing-field-initializers -Wmissing-include-dirs @gol --Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol - -Wodr -Wno-overflow -Wopenmp-simd @gol --Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol --Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol --Wpointer-arith -Wno-pointer-to-int-cast @gol --Wredundant-decls -Wno-return-local-addr @gol --Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol --Wshift-count-negative -Wshift-count-overflow @gol --Wsign-compare -Wsign-conversion -Wfloat-conversion @gol --Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol --Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol --Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol --Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol --Wsuggest-final-types @gol -Wsuggest-final-methods @gol -Wsuggest-override @gol --Wmissing-format-attribute @gol --Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol --Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol --Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol --Wunsuffixed-float-constants -Wunused -Wunused-function @gol --Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol --Wno-unused-result -Wunused-value @gol -Wunused-variable @gol --Wunused-but-set-parameter -Wunused-but-set-variable @gol --Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol --Wvla -Wvolatile-register-var -Wwrite-strings @gol --Wzero-as-null-pointer-constant} - -@item C and Objective-C-only Warning Options -@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol --Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol --Wold-style-declaration -Wold-style-definition @gol --Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol --Wdeclaration-after-statement -Wpointer-sign} - -@item Debugging Options -@xref{Debugging Options,,Options for Debugging Your Program or GCC}. -@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol --fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol --fasan-shadow-offset=@var{number} -fsanitize-undefined-trap-on-error @gol --fcheck-pointer-bounds -fchkp-check-incomplete-type @gol --fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol --fchkp-narrow-to-innermost-array -fchkp-optimize @gol --fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol --fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol --fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol --fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol --fchkp-instrument-calls -fchkp-instrument-marked-only @gol --fchkp-use-wrappers @gol --fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol --fdisable-ipa-@var{pass_name} @gol --fdisable-rtl-@var{pass_name} @gol --fdisable-rtl-@var{pass-name}=@var{range-list} @gol --fdisable-tree-@var{pass_name} @gol --fdisable-tree-@var{pass-name}=@var{range-list} @gol --fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol --fdump-translation-unit@r{[}-@var{n}@r{]} @gol --fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol --fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol --fdump-passes @gol --fdump-statistics @gol --fdump-tree-all @gol --fdump-tree-original@r{[}-@var{n}@r{]} @gol --fdump-tree-optimized@r{[}-@var{n}@r{]} @gol --fdump-tree-cfg -fdump-tree-alias @gol --fdump-tree-ch @gol --fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol --fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol --fdump-tree-gimple@r{[}-raw@r{]} @gol --fdump-tree-dom@r{[}-@var{n}@r{]} @gol --fdump-tree-dse@r{[}-@var{n}@r{]} @gol --fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol --fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol --fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol --fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol --fdump-tree-nrv -fdump-tree-vect @gol --fdump-tree-sink @gol --fdump-tree-sra@r{[}-@var{n}@r{]} @gol --fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol --fdump-tree-fre@r{[}-@var{n}@r{]} @gol --fdump-tree-vtable-verify @gol --fdump-tree-vrp@r{[}-@var{n}@r{]} @gol --fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol --fdump-final-insns=@var{file} @gol --fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol --feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol --feliminate-unused-debug-symbols -femit-class-debug-always @gol --fenable-@var{kind}-@var{pass} @gol --fenable-@var{kind}-@var{pass}=@var{range-list} @gol --fdebug-types-section -fmem-report-wpa @gol --fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol --fopt-info @gol --fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol --frandom-seed=@var{number} -fsched-verbose=@var{n} @gol --fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol --fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol --fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol --g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol --ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol --gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol --gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol --fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol --fdebug-prefix-map=@var{old}=@var{new} @gol --femit-struct-debug-baseonly -femit-struct-debug-reduced @gol --femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol --p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol --print-multi-directory -print-multi-lib -print-multi-os-directory @gol --print-prog-name=@var{program} -print-search-dirs -Q @gol --print-sysroot -print-sysroot-headers-suffix @gol --save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} - -@item Optimization Options -@xref{Optimize Options,,Options that Control Optimization}. -@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol --falign-jumps[=@var{n}] @gol --falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol --fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol --fauto-inc-dec -fbranch-probabilities @gol --fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol --fbtr-bb-exclusive -fcaller-saves @gol --fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol --fcompare-elim -fcprop-registers -fcrossjumping @gol --fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol --fcx-limited-range @gol --fdata-sections -fdce -fdelayed-branch @gol --fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol --fdevirtualize-at-ltrans -fdse @gol --fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol --ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol --fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol --fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol --fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol --fif-conversion2 -findirect-inlining @gol --finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol --finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol --fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol --fira-algorithm=@var{algorithm} @gol --fira-region=@var{region} -fira-hoist-pressure @gol --fira-loop-pressure -fno-ira-share-save-slots @gol --fno-ira-share-spill-slots -fira-verbose=@var{n} @gol --fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol --fivopts -fkeep-inline-functions -fkeep-static-consts @gol --flive-range-shrinkage @gol --floop-block -floop-interchange -floop-strip-mine @gol --floop-unroll-and-jam -floop-nest-optimize @gol --floop-parallelize-all -flra-remat -flto -flto-compression-level @gol --flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol --fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol --fmove-loop-invariants -fno-branch-count-reg @gol --fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol --fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol --fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol --fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol --fomit-frame-pointer -foptimize-sibling-calls @gol --fpartial-inlining -fpeel-loops -fpredictive-commoning @gol --fprefetch-loop-arrays -fprofile-report @gol --fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol --fprofile-generate=@var{path} @gol --fprofile-use -fprofile-use=@var{path} -fprofile-values @gol --fprofile-reorder-functions @gol --freciprocal-math -free -frename-registers -freorder-blocks @gol --freorder-blocks-and-partition -freorder-functions @gol --frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol --frounding-math -fsched2-use-superblocks -fsched-pressure @gol --fsched-spec-load -fsched-spec-load-dangerous @gol --fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol --fsched-group-heuristic -fsched-critical-path-heuristic @gol --fsched-spec-insn-heuristic -fsched-rank-heuristic @gol --fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol --fschedule-fusion @gol --fschedule-insns -fschedule-insns2 -fsection-anchors @gol --fselective-scheduling -fselective-scheduling2 @gol --fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol --fsemantic-interposition @gol --fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol --fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt @gol --fstack-protector -fstack-protector-all -fstack-protector-strong @gol --fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol --fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol --ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol --ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol --ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol --ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol --ftree-loop-if-convert-stores -ftree-loop-im @gol --ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol --ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol --ftree-loop-vectorize @gol --ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol --ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol --ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol --ftree-vectorize -ftree-vrp @gol --funit-at-a-time -funroll-all-loops -funroll-loops @gol --funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol --fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol --fweb -fwhole-program -fwpa -fuse-linker-plugin @gol ---param @var{name}=@var{value} --O -O0 -O1 -O2 -O3 -Os -Ofast -Og} - -@item Preprocessor Options -@xref{Preprocessor Options,,Options Controlling the Preprocessor}. -@gccoptlist{-A@var{question}=@var{answer} @gol --A-@var{question}@r{[}=@var{answer}@r{]} @gol --C -dD -dI -dM -dN @gol --D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol --idirafter @var{dir} @gol --include @var{file} -imacros @var{file} @gol --iprefix @var{file} -iwithprefix @var{dir} @gol --iwithprefixbefore @var{dir} -isystem @var{dir} @gol --imultilib @var{dir} -isysroot @var{dir} @gol --M -MM -MF -MG -MP -MQ -MT -nostdinc @gol --P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol --remap -trigraphs -undef -U@var{macro} @gol --Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp} - -@item Assembler Option -@xref{Assembler Options,,Passing Options to the Assembler}. -@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} - -@item Linker Options -@xref{Link Options,,Options for Linking}. -@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol --nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol --s -static -static-libgcc -static-libstdc++ @gol --static-libasan -static-libtsan -static-liblsan -static-libubsan @gol --static-libmpx -static-libmpxwrappers @gol --shared -shared-libgcc -symbolic @gol --T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol --u @var{symbol} -z @var{keyword}} - -@item Directory Options -@xref{Directory Options,,Options for Directory Search}. -@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol --iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol ---sysroot=@var{dir} --no-sysroot-suffix} - -@item Machine Dependent Options -@xref{Submodel Options,,Hardware Models and Configurations}. -@c This list is ordered alphanumerically by subsection name. -@c Try and put the significant identifier (CPU or system) first, -@c so users have a clue at guessing where the ones they want will be. - -@emph{AArch64 Options} -@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol --mgeneral-regs-only @gol --mcmodel=tiny -mcmodel=small -mcmodel=large @gol --mstrict-align @gol --momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol --mtls-dialect=desc -mtls-dialect=traditional @gol --mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol --march=@var{name} -mcpu=@var{name} -mtune=@var{name}} - -@emph{Adapteva Epiphany Options} -@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol --mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol --msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol --mround-nearest -mlong-calls -mshort-calls -msmall16 @gol --mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol --msplit-vecmove-early -m1reg-@var{reg}} - -@emph{ARC Options} -@gccoptlist{-mbarrel-shifter @gol --mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol --mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol --mea -mno-mpy -mmul32x16 -mmul64 @gol --mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol --mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol --mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol --mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol --mucb-mcount -mvolatile-cache @gol --malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol --mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol --mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol --mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol --mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol --mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}} - -@emph{ARM Options} -@gccoptlist{-mapcs-frame -mno-apcs-frame @gol --mabi=@var{name} @gol --mapcs-stack-check -mno-apcs-stack-check @gol --mapcs-float -mno-apcs-float @gol --mapcs-reentrant -mno-apcs-reentrant @gol --msched-prolog -mno-sched-prolog @gol --mlittle-endian -mbig-endian @gol --mfloat-abi=@var{name} @gol --mfp16-format=@var{name} --mthumb-interwork -mno-thumb-interwork @gol --mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol --mtune=@var{name} -mprint-tune-info @gol --mstructure-size-boundary=@var{n} @gol --mabort-on-noreturn @gol --mlong-calls -mno-long-calls @gol --msingle-pic-base -mno-single-pic-base @gol --mpic-register=@var{reg} @gol --mnop-fun-dllimport @gol --mpoke-function-name @gol --mthumb -marm @gol --mtpcs-frame -mtpcs-leaf-frame @gol --mcaller-super-interworking -mcallee-super-interworking @gol --mtp=@var{name} -mtls-dialect=@var{dialect} @gol --mword-relocations @gol --mfix-cortex-m3-ldrd @gol --munaligned-access @gol --mneon-for-64bits @gol --mslow-flash-data @gol --masm-syntax-unified @gol --mrestrict-it} - -@emph{AVR Options} -@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol --mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol --mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert} - -@emph{Blackfin Options} -@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol --msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol --mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol --mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol --mno-id-shared-library -mshared-library-id=@var{n} @gol --mleaf-id-shared-library -mno-leaf-id-shared-library @gol --msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol --mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol --micplb} - -@emph{C6X Options} -@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol --msim -msdata=@var{sdata-type}} - -@emph{CRIS Options} -@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol --mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol --metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol --mstack-align -mdata-align -mconst-align @gol --m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol --melf -maout -melinux -mlinux -sim -sim2 @gol --mmul-bug-workaround -mno-mul-bug-workaround} - -@emph{CR16 Options} -@gccoptlist{-mmac @gol --mcr16cplus -mcr16c @gol --msim -mint32 -mbit-ops --mdata-model=@var{model}} - -@emph{Darwin Options} -@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol --arch_only -bind_at_load -bundle -bundle_loader @gol --client_name -compatibility_version -current_version @gol --dead_strip @gol --dependency-file -dylib_file -dylinker_install_name @gol --dynamic -dynamiclib -exported_symbols_list @gol --filelist -flat_namespace -force_cpusubtype_ALL @gol --force_flat_namespace -headerpad_max_install_names @gol --iframework @gol --image_base -init -install_name -keep_private_externs @gol --multi_module -multiply_defined -multiply_defined_unused @gol --noall_load -no_dead_strip_inits_and_terms @gol --nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol --pagezero_size -prebind -prebind_all_twolevel_modules @gol --private_bundle -read_only_relocs -sectalign @gol --sectobjectsymbols -whyload -seg1addr @gol --sectcreate -sectobjectsymbols -sectorder @gol --segaddr -segs_read_only_addr -segs_read_write_addr @gol --seg_addr_table -seg_addr_table_filename -seglinkedit @gol --segprot -segs_read_only_addr -segs_read_write_addr @gol --single_module -static -sub_library -sub_umbrella @gol --twolevel_namespace -umbrella -undefined @gol --unexported_symbols_list -weak_reference_mismatches @gol --whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol --mkernel -mone-byte-bool} - -@emph{DEC Alpha Options} -@gccoptlist{-mno-fp-regs -msoft-float @gol --mieee -mieee-with-inexact -mieee-conformant @gol --mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol --mtrap-precision=@var{mode} -mbuild-constants @gol --mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol --mbwx -mmax -mfix -mcix @gol --mfloat-vax -mfloat-ieee @gol --mexplicit-relocs -msmall-data -mlarge-data @gol --msmall-text -mlarge-text @gol --mmemory-latency=@var{time}} - -@emph{FR30 Options} -@gccoptlist{-msmall-model -mno-lsim} - -@emph{FRV Options} -@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol --mhard-float -msoft-float @gol --malloc-cc -mfixed-cc -mdword -mno-dword @gol --mdouble -mno-double @gol --mmedia -mno-media -mmuladd -mno-muladd @gol --mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol --mlinked-fp -mlong-calls -malign-labels @gol --mlibrary-pic -macc-4 -macc-8 @gol --mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol --moptimize-membar -mno-optimize-membar @gol --mscc -mno-scc -mcond-exec -mno-cond-exec @gol --mvliw-branch -mno-vliw-branch @gol --mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol --mno-nested-cond-exec -mtomcat-stats @gol --mTLS -mtls @gol --mcpu=@var{cpu}} - -@emph{GNU/Linux Options} -@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol --tno-android-cc -tno-android-ld} - -@emph{H8/300 Options} -@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} - -@emph{HPPA Options} -@gccoptlist{-march=@var{architecture-type} @gol --mdisable-fpregs -mdisable-indexing @gol --mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol --mfixed-range=@var{register-range} @gol --mjump-in-delay -mlinker-opt -mlong-calls @gol --mlong-load-store -mno-disable-fpregs @gol --mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol --mno-jump-in-delay -mno-long-load-store @gol --mno-portable-runtime -mno-soft-float @gol --mno-space-regs -msoft-float -mpa-risc-1-0 @gol --mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol --mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol --munix=@var{unix-std} -nolibdld -static -threads} - -@emph{IA-64 Options} -@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol --mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol --mconstant-gp -mauto-pic -mfused-madd @gol --minline-float-divide-min-latency @gol --minline-float-divide-max-throughput @gol --mno-inline-float-divide @gol --minline-int-divide-min-latency @gol --minline-int-divide-max-throughput @gol --mno-inline-int-divide @gol --minline-sqrt-min-latency -minline-sqrt-max-throughput @gol --mno-inline-sqrt @gol --mdwarf2-asm -mearly-stop-bits @gol --mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol --mtune=@var{cpu-type} -milp32 -mlp64 @gol --msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol --msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol --msched-spec-ldc -msched-spec-control-ldc @gol --msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol --msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol --msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol --msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} - -@emph{LM32 Options} -@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol --msign-extend-enabled -muser-enabled} - -@emph{M32R/D Options} -@gccoptlist{-m32r2 -m32rx -m32r @gol --mdebug @gol --malign-loops -mno-align-loops @gol --missue-rate=@var{number} @gol --mbranch-cost=@var{number} @gol --mmodel=@var{code-size-model-type} @gol --msdata=@var{sdata-type} @gol --mno-flush-func -mflush-func=@var{name} @gol --mno-flush-trap -mflush-trap=@var{number} @gol --G @var{num}} - -@emph{M32C Options} -@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} - -@emph{M680x0 Options} -@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol --m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol --m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol --mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol --mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol --mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol --malign-int -mstrict-align -msep-data -mno-sep-data @gol --mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol --mxgot -mno-xgot} - -@emph{MCore Options} -@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol --mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol --m4byte-functions -mno-4byte-functions -mcallgraph-data @gol --mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol --mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} - -@emph{MeP Options} -@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol --mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol --mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol --mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol --mtiny=@var{n}} - -@emph{MicroBlaze Options} -@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol --mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol --mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol --mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol --mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}} - -@emph{MIPS Options} -@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol --mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol --mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol --mips16 -mno-mips16 -mflip-mips16 @gol --minterlink-compressed -mno-interlink-compressed @gol --minterlink-mips16 -mno-interlink-mips16 @gol --mabi=@var{abi} -mabicalls -mno-abicalls @gol --mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol --mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol --mno-float -msingle-float -mdouble-float @gol --modd-spreg -mno-odd-spreg @gol --mabs=@var{mode} -mnan=@var{encoding} @gol --mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol --mmcu -mmno-mcu @gol --meva -mno-eva @gol --mvirt -mno-virt @gol --mxpa -mno-xpa @gol --mmicromips -mno-micromips @gol --mfpu=@var{fpu-type} @gol --msmartmips -mno-smartmips @gol --mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol --mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol --mlong64 -mlong32 -msym32 -mno-sym32 @gol --G@var{num} -mlocal-sdata -mno-local-sdata @gol --mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol --membedded-data -mno-embedded-data @gol --muninit-const-in-rodata -mno-uninit-const-in-rodata @gol --mcode-readable=@var{setting} @gol --msplit-addresses -mno-split-addresses @gol --mexplicit-relocs -mno-explicit-relocs @gol --mcheck-zero-division -mno-check-zero-division @gol --mdivide-traps -mdivide-breaks @gol --mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol --mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol --mfix-24k -mno-fix-24k @gol --mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol --mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol --mfix-vr4120 -mno-fix-vr4120 @gol --mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol --mflush-func=@var{func} -mno-flush-func @gol --mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol --mfp-exceptions -mno-fp-exceptions @gol --mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol --mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address} - -@emph{MMIX Options} -@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol --mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol --melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol --mno-base-addresses -msingle-exit -mno-single-exit} - -@emph{MN10300 Options} -@gccoptlist{-mmult-bug -mno-mult-bug @gol --mno-am33 -mam33 -mam33-2 -mam34 @gol --mtune=@var{cpu-type} @gol --mreturn-pointer-on-d0 @gol --mno-crt0 -mrelax -mliw -msetlb} - -@emph{Moxie Options} -@gccoptlist{-meb -mel -mmul.x -mno-crt0} - -@emph{MSP430 Options} -@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol --mhwmult= -minrt} - -@emph{NDS32 Options} -@gccoptlist{-mbig-endian -mlittle-endian @gol --mreduced-regs -mfull-regs @gol --mcmov -mno-cmov @gol --mperf-ext -mno-perf-ext @gol --mv3push -mno-v3push @gol --m16bit -mno-16bit @gol --misr-vector-size=@var{num} @gol --mcache-block-size=@var{num} @gol --march=@var{arch} @gol --mcmodel=@var{code-model} @gol --mctor-dtor -mrelax} - -@emph{Nios II Options} -@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol --mel -meb @gol --mno-bypass-cache -mbypass-cache @gol --mno-cache-volatile -mcache-volatile @gol --mno-fast-sw-div -mfast-sw-div @gol --mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol --mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol --mcustom-fpu-cfg=@var{name} @gol --mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}} - -@emph{Nvidia PTX Options} -@gccoptlist{-m32 -m64 -mmainkernel} - -@emph{PDP-11 Options} -@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol --mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol --mint16 -mno-int32 -mfloat32 -mno-float64 @gol --mfloat64 -mno-float32 -mabshi -mno-abshi @gol --mbranch-expensive -mbranch-cheap @gol --munix-asm -mdec-asm} - -@emph{picoChip Options} -@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol --msymbol-as-address -mno-inefficient-warnings} - -@emph{PowerPC Options} -See RS/6000 and PowerPC Options. - -@emph{RL78 Options} -@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol --m64bit-doubles -m32bit-doubles} - -@emph{RS/6000 and PowerPC Options} -@gccoptlist{-mcpu=@var{cpu-type} @gol --mtune=@var{cpu-type} @gol --mcmodel=@var{code-model} @gol --mpowerpc64 @gol --maltivec -mno-altivec @gol --mpowerpc-gpopt -mno-powerpc-gpopt @gol --mpowerpc-gfxopt -mno-powerpc-gfxopt @gol --mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol --mfprnd -mno-fprnd @gol --mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol --mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol --m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol --malign-power -malign-natural @gol --msoft-float -mhard-float -mmultiple -mno-multiple @gol --msingle-float -mdouble-float -msimple-fpu @gol --mstring -mno-string -mupdate -mno-update @gol --mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol --mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol --mstrict-align -mno-strict-align -mrelocatable @gol --mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol --mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol --mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol --mprioritize-restricted-insns=@var{priority} @gol --msched-costly-dep=@var{dependence_type} @gol --minsert-sched-nops=@var{scheme} @gol --mcall-sysv -mcall-netbsd @gol --maix-struct-return -msvr4-struct-return @gol --mabi=@var{abi-type} -msecure-plt -mbss-plt @gol --mblock-move-inline-limit=@var{num} @gol --misel -mno-isel @gol --misel=yes -misel=no @gol --mspe -mno-spe @gol --mspe=yes -mspe=no @gol --mpaired @gol --mgen-cell-microcode -mwarn-cell-microcode @gol --mvrsave -mno-vrsave @gol --mmulhw -mno-mulhw @gol --mdlmzb -mno-dlmzb @gol --mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol --mprototype -mno-prototype @gol --msim -mmvme -mads -myellowknife -memb -msdata @gol --msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol --mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol --mno-recip-precision @gol --mveclibabi=@var{type} -mfriz -mno-friz @gol --mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol --msave-toc-indirect -mno-save-toc-indirect @gol --mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol --mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol --mquad-memory -mno-quad-memory @gol --mquad-memory-atomic -mno-quad-memory-atomic @gol --mcompat-align-parm -mno-compat-align-parm @gol --mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol --mupper-regs -mno-upper-regs} - -@emph{RX Options} -@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol --mcpu=@gol --mbig-endian-data -mlittle-endian-data @gol --msmall-data @gol --msim -mno-sim@gol --mas100-syntax -mno-as100-syntax@gol --mrelax@gol --mmax-constant-size=@gol --mint-register=@gol --mpid@gol --mno-warn-multiple-fast-interrupts@gol --msave-acc-in-interrupts} - -@emph{S/390 and zSeries Options} -@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol --mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol --mlong-double-64 -mlong-double-128 @gol --mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol --msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol --m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol --mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol --mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol --mhotpatch=@var{halfwords},@var{halfwords}} - -@emph{Score Options} -@gccoptlist{-meb -mel @gol --mnhwloop @gol --muls @gol --mmac @gol --mscore5 -mscore5u -mscore7 -mscore7d} - -@emph{SH Options} -@gccoptlist{-m1 -m2 -m2e @gol --m2a-nofpu -m2a-single-only -m2a-single -m2a @gol --m3 -m3e @gol --m4-nofpu -m4-single-only -m4-single -m4 @gol --m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol --m5-64media -m5-64media-nofpu @gol --m5-32media -m5-32media-nofpu @gol --m5-compact -m5-compact-nofpu @gol --mb -ml -mdalign -mrelax @gol --mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol --mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol --mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol --mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol --mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol --maccumulate-outgoing-args -minvalid-symbols @gol --matomic-model=@var{atomic-model} @gol --mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol --mcbranch-force-delay-slot @gol --mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol --mpretend-cmove -mtas} - -@emph{Solaris 2 Options} -@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol --pthreads -pthread} - -@emph{SPARC Options} -@gccoptlist{-mcpu=@var{cpu-type} @gol --mtune=@var{cpu-type} @gol --mcmodel=@var{code-model} @gol --mmemory-model=@var{mem-model} @gol --m32 -m64 -mapp-regs -mno-app-regs @gol --mfaster-structs -mno-faster-structs -mflat -mno-flat @gol --mfpu -mno-fpu -mhard-float -msoft-float @gol --mhard-quad-float -msoft-quad-float @gol --mstack-bias -mno-stack-bias @gol --munaligned-doubles -mno-unaligned-doubles @gol --muser-mode -mno-user-mode @gol --mv8plus -mno-v8plus -mvis -mno-vis @gol --mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol --mcbcond -mno-cbcond @gol --mfmaf -mno-fmaf -mpopc -mno-popc @gol --mfix-at697f -mfix-ut699} - -@emph{SPU Options} -@gccoptlist{-mwarn-reloc -merror-reloc @gol --msafe-dma -munsafe-dma @gol --mbranch-hints @gol --msmall-mem -mlarge-mem -mstdmain @gol --mfixed-range=@var{register-range} @gol --mea32 -mea64 @gol --maddress-space-conversion -mno-address-space-conversion @gol --mcache-size=@var{cache-size} @gol --matomic-updates -mno-atomic-updates} - -@emph{System V Options} -@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} - -@emph{TILE-Gx Options} -@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol --mcmodel=@var{code-model}} - -@emph{TILEPro Options} -@gccoptlist{-mcpu=@var{cpu} -m32} - -@emph{V850 Options} -@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol --mprolog-function -mno-prolog-function -mspace @gol --mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol --mapp-regs -mno-app-regs @gol --mdisable-callt -mno-disable-callt @gol --mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol --mv850e -mv850 -mv850e3v5 @gol --mloop @gol --mrelax @gol --mlong-jumps @gol --msoft-float @gol --mhard-float @gol --mgcc-abi @gol --mrh850-abi @gol --mbig-switch} - -@emph{VAX Options} -@gccoptlist{-mg -mgnu -munix} - -@emph{Visium Options} -@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol --mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} - -@emph{VMS Options} -@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol --mpointer-size=@var{size}} - -@emph{VxWorks Options} -@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol --Xbind-lazy -Xbind-now} - -@emph{x86 Options} -@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol --mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol --mfpmath=@var{unit} @gol --masm=@var{dialect} -mno-fancy-math-387 @gol --mno-fp-ret-in-387 -msoft-float @gol --mno-wide-multiply -mrtd -malign-double @gol --mpreferred-stack-boundary=@var{num} @gol --mincoming-stack-boundary=@var{num} @gol --mcld -mcx16 -msahf -mmovbe -mcrc32 @gol --mrecip -mrecip=@var{opt} @gol --mvzeroupper -mprefer-avx128 @gol --mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol --mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol --maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol --mclflushopt -mxsavec -mxsaves @gol --msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol --mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mthreads @gol --mno-align-stringops -minline-all-stringops @gol --minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol --mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol --mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol --m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol --mregparm=@var{num} -msseregparm @gol --mveclibabi=@var{type} -mvect8-ret-in-mem @gol --mpc32 -mpc64 -mpc80 -mstackrealign @gol --momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol --mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol --m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol --msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol --mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol --malign-data=@var{type} -mstack-protector-guard=@var{guard}} - -@emph{x86 Windows Options} -@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol --mnop-fun-dllimport -mthread @gol --municode -mwin32 -mwindows -fno-set-stack-executable} - -@emph{Xstormy16 Options} -@gccoptlist{-msim} - -@emph{Xtensa Options} -@gccoptlist{-mconst16 -mno-const16 @gol --mfused-madd -mno-fused-madd @gol --mforce-no-pic @gol --mserialize-volatile -mno-serialize-volatile @gol --mtext-section-literals -mno-text-section-literals @gol --mtarget-align -mno-target-align @gol --mlongcalls -mno-longcalls} - -@emph{zSeries Options} -See S/390 and zSeries Options. - -@item Code Generation Options -@xref{Code Gen Options,,Options for Code Generation Conventions}. -@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol --ffixed-@var{reg} -fexceptions @gol --fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol --fasynchronous-unwind-tables @gol --fno-gnu-unique @gol --finhibit-size-directive -finstrument-functions @gol --finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol --finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol --fno-common -fno-ident @gol --fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol --fno-jump-tables @gol --frecord-gcc-switches @gol --freg-struct-return -fshort-enums @gol --fshort-double -fshort-wchar @gol --fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol --fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol --fno-stack-limit -fsplit-stack @gol --fleading-underscore -ftls-model=@var{model} @gol --fstack-reuse=@var{reuse_level} @gol --ftrapv -fwrapv -fbounds-check @gol --fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol --fstrict-volatile-bitfields -fsync-libcalls} -@end table - - -@node Overall Options -@section Options Controlling the Kind of Output - -Compilation can involve up to four stages: preprocessing, compilation -proper, assembly and linking, always in that order. GCC is capable of -preprocessing and compiling several files either into several -assembler input files, or into one assembler input file; then each -assembler input file produces an object file, and linking combines all -the object files (those newly compiled, and those specified as input) -into an executable file. - -@cindex file name suffix -For any given input file, the file name suffix determines what kind of -compilation is done: - -@table @gcctabopt -@item @var{file}.c -C source code that must be preprocessed. - -@item @var{file}.i -C source code that should not be preprocessed. - -@item @var{file}.ii -C++ source code that should not be preprocessed. - -@item @var{file}.m -Objective-C source code. Note that you must link with the @file{libobjc} -library to make an Objective-C program work. - -@item @var{file}.mi -Objective-C source code that should not be preprocessed. - -@item @var{file}.mm -@itemx @var{file}.M -Objective-C++ source code. Note that you must link with the @file{libobjc} -library to make an Objective-C++ program work. Note that @samp{.M} refers -to a literal capital M@. - -@item @var{file}.mii -Objective-C++ source code that should not be preprocessed. - -@item @var{file}.h -C, C++, Objective-C or Objective-C++ header file to be turned into a -precompiled header (default), or C, C++ header file to be turned into an -Ada spec (via the @option{-fdump-ada-spec} switch). - -@item @var{file}.cc -@itemx @var{file}.cp -@itemx @var{file}.cxx -@itemx @var{file}.cpp -@itemx @var{file}.CPP -@itemx @var{file}.c++ -@itemx @var{file}.C -C++ source code that must be preprocessed. Note that in @samp{.cxx}, -the last two letters must both be literally @samp{x}. Likewise, -@samp{.C} refers to a literal capital C@. - -@item @var{file}.mm -@itemx @var{file}.M -Objective-C++ source code that must be preprocessed. - -@item @var{file}.mii -Objective-C++ source code that should not be preprocessed. - -@item @var{file}.hh -@itemx @var{file}.H -@itemx @var{file}.hp -@itemx @var{file}.hxx -@itemx @var{file}.hpp -@itemx @var{file}.HPP -@itemx @var{file}.h++ -@itemx @var{file}.tcc -C++ header file to be turned into a precompiled header or Ada spec. - -@item @var{file}.f -@itemx @var{file}.for -@itemx @var{file}.ftn -Fixed form Fortran source code that should not be preprocessed. - -@item @var{file}.F -@itemx @var{file}.FOR -@itemx @var{file}.fpp -@itemx @var{file}.FPP -@itemx @var{file}.FTN -Fixed form Fortran source code that must be preprocessed (with the traditional -preprocessor). - -@item @var{file}.f90 -@itemx @var{file}.f95 -@itemx @var{file}.f03 -@itemx @var{file}.f08 -Free form Fortran source code that should not be preprocessed. - -@item @var{file}.F90 -@itemx @var{file}.F95 -@itemx @var{file}.F03 -@itemx @var{file}.F08 -Free form Fortran source code that must be preprocessed (with the -traditional preprocessor). - -@item @var{file}.go -Go source code. - -@c FIXME: Descriptions of Java file types. -@c @var{file}.java -@c @var{file}.class -@c @var{file}.zip -@c @var{file}.jar - -@item @var{file}.ads -Ada source code file that contains a library unit declaration (a -declaration of a package, subprogram, or generic, or a generic -instantiation), or a library unit renaming declaration (a package, -generic, or subprogram renaming declaration). Such files are also -called @dfn{specs}. - -@item @var{file}.adb -Ada source code file containing a library unit body (a subprogram or -package body). Such files are also called @dfn{bodies}. - -@c GCC also knows about some suffixes for languages not yet included: -@c Pascal: -@c @var{file}.p -@c @var{file}.pas -@c Ratfor: -@c @var{file}.r - -@item @var{file}.s -Assembler code. - -@item @var{file}.S -@itemx @var{file}.sx -Assembler code that must be preprocessed. - -@item @var{other} -An object file to be fed straight into linking. -Any file name with no recognized suffix is treated this way. -@end table - -@opindex x -You can specify the input language explicitly with the @option{-x} option: - -@table @gcctabopt -@item -x @var{language} -Specify explicitly the @var{language} for the following input files -(rather than letting the compiler choose a default based on the file -name suffix). This option applies to all following input files until -the next @option{-x} option. Possible values for @var{language} are: -@smallexample -c c-header cpp-output -c++ c++-header c++-cpp-output -objective-c objective-c-header objective-c-cpp-output -objective-c++ objective-c++-header objective-c++-cpp-output -assembler assembler-with-cpp -ada -f77 f77-cpp-input f95 f95-cpp-input -go -java -@end smallexample - -@item -x none -Turn off any specification of a language, so that subsequent files are -handled according to their file name suffixes (as they are if @option{-x} -has not been used at all). - -@item -pass-exit-codes -@opindex pass-exit-codes -Normally the @command{gcc} program exits with the code of 1 if any -phase of the compiler returns a non-success return code. If you specify -@option{-pass-exit-codes}, the @command{gcc} program instead returns with -the numerically highest error produced by any phase returning an error -indication. The C, C++, and Fortran front ends return 4 if an internal -compiler error is encountered. -@end table - -If you only want some of the stages of compilation, you can use -@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and -one of the options @option{-c}, @option{-S}, or @option{-E} to say where -@command{gcc} is to stop. Note that some combinations (for example, -@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. - -@table @gcctabopt -@item -c -@opindex c -Compile or assemble the source files, but do not link. The linking -stage simply is not done. The ultimate output is in the form of an -object file for each source file. - -By default, the object file name for a source file is made by replacing -the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. - -Unrecognized input files, not requiring compilation or assembly, are -ignored. - -@item -S -@opindex S -Stop after the stage of compilation proper; do not assemble. The output -is in the form of an assembler code file for each non-assembler input -file specified. - -By default, the assembler file name for a source file is made by -replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. - -Input files that don't require compilation are ignored. - -@item -E -@opindex E -Stop after the preprocessing stage; do not run the compiler proper. The -output is in the form of preprocessed source code, which is sent to the -standard output. - -Input files that don't require preprocessing are ignored. - -@cindex output file option -@item -o @var{file} -@opindex o -Place output in file @var{file}. This applies to whatever -sort of output is being produced, whether it be an executable file, -an object file, an assembler file or preprocessed C code. - -If @option{-o} is not specified, the default is to put an executable -file in @file{a.out}, the object file for -@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its -assembler file in @file{@var{source}.s}, a precompiled header file in -@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on -standard output. - -@item -v -@opindex v -Print (on standard error output) the commands executed to run the stages -of compilation. Also print the version number of the compiler driver -program and of the preprocessor and the compiler proper. - -@item -### -@opindex ### -Like @option{-v} except the commands are not executed and arguments -are quoted unless they contain only alphanumeric characters or @code{./-_}. -This is useful for shell scripts to capture the driver-generated command lines. - -@item -pipe -@opindex pipe -Use pipes rather than temporary files for communication between the -various stages of compilation. This fails to work on some systems where -the assembler is unable to read from a pipe; but the GNU assembler has -no trouble. - -@item --help -@opindex help -Print (on the standard output) a description of the command-line options -understood by @command{gcc}. If the @option{-v} option is also specified -then @option{--help} is also passed on to the various processes -invoked by @command{gcc}, so that they can display the command-line options -they accept. If the @option{-Wextra} option has also been specified -(prior to the @option{--help} option), then command-line options that -have no documentation associated with them are also displayed. - -@item --target-help -@opindex target-help -Print (on the standard output) a description of target-specific command-line -options for each tool. For some targets extra target-specific -information may also be printed. - -@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} -Print (on the standard output) a description of the command-line -options understood by the compiler that fit into all specified classes -and qualifiers. These are the supported classes: - -@table @asis -@item @samp{optimizers} -Display all of the optimization options supported by the -compiler. - -@item @samp{warnings} -Display all of the options controlling warning messages -produced by the compiler. - -@item @samp{target} -Display target-specific options. Unlike the -@option{--target-help} option however, target-specific options of the -linker and assembler are not displayed. This is because those -tools do not currently support the extended @option{--help=} syntax. - -@item @samp{params} -Display the values recognized by the @option{--param} -option. - -@item @var{language} -Display the options supported for @var{language}, where -@var{language} is the name of one of the languages supported in this -version of GCC@. - -@item @samp{common} -Display the options that are common to all languages. -@end table - -These are the supported qualifiers: - -@table @asis -@item @samp{undocumented} -Display only those options that are undocumented. - -@item @samp{joined} -Display options taking an argument that appears after an equal -sign in the same continuous piece of text, such as: -@samp{--help=target}. - -@item @samp{separate} -Display options taking an argument that appears as a separate word -following the original option, such as: @samp{-o output-file}. -@end table - -Thus for example to display all the undocumented target-specific -switches supported by the compiler, use: - -@smallexample ---help=target,undocumented -@end smallexample - -The sense of a qualifier can be inverted by prefixing it with the -@samp{^} character, so for example to display all binary warning -options (i.e., ones that are either on or off and that do not take an -argument) that have a description, use: - -@smallexample ---help=warnings,^joined,^undocumented -@end smallexample - -The argument to @option{--help=} should not consist solely of inverted -qualifiers. - -Combining several classes is possible, although this usually -restricts the output so much that there is nothing to display. One -case where it does work, however, is when one of the classes is -@var{target}. For example, to display all the target-specific -optimization options, use: - -@smallexample ---help=target,optimizers -@end smallexample - -The @option{--help=} option can be repeated on the command line. Each -successive use displays its requested class of options, skipping -those that have already been displayed. - -If the @option{-Q} option appears on the command line before the -@option{--help=} option, then the descriptive text displayed by -@option{--help=} is changed. Instead of describing the displayed -options, an indication is given as to whether the option is enabled, -disabled or set to a specific value (assuming that the compiler -knows this at the point where the @option{--help=} option is used). - -Here is a truncated example from the ARM port of @command{gcc}: - -@smallexample - % gcc -Q -mabi=2 --help=target -c - The following options are target specific: - -mabi= 2 - -mabort-on-noreturn [disabled] - -mapcs [disabled] -@end smallexample - -The output is sensitive to the effects of previous command-line -options, so for example it is possible to find out which optimizations -are enabled at @option{-O2} by using: - -@smallexample --Q -O2 --help=optimizers -@end smallexample - -Alternatively you can discover which binary optimizations are enabled -by @option{-O3} by using: - -@smallexample -gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts -gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts -diff /tmp/O2-opts /tmp/O3-opts | grep enabled -@end smallexample - -@item -no-canonical-prefixes -@opindex no-canonical-prefixes -Do not expand any symbolic links, resolve references to @samp{/../} -or @samp{/./}, or make the path absolute when generating a relative -prefix. - -@item --version -@opindex version -Display the version number and copyrights of the invoked GCC@. - -@item -wrapper -@opindex wrapper -Invoke all subcommands under a wrapper program. The name of the -wrapper program and its parameters are passed as a comma separated -list. - -@smallexample -gcc -c t.c -wrapper gdb,--args -@end smallexample - -@noindent -This invokes all subprograms of @command{gcc} under -@samp{gdb --args}, thus the invocation of @command{cc1} is -@samp{gdb --args cc1 @dots{}}. - -@item -fplugin=@var{name}.so -@opindex fplugin -Load the plugin code in file @var{name}.so, assumed to be a -shared object to be dlopen'd by the compiler. The base name of -the shared object file is used to identify the plugin for the -purposes of argument parsing (See -@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). -Each plugin should define the callback functions specified in the -Plugins API. - -@item -fplugin-arg-@var{name}-@var{key}=@var{value} -@opindex fplugin-arg -Define an argument called @var{key} with a value of @var{value} -for the plugin called @var{name}. - -@item -fdump-ada-spec@r{[}-slim@r{]} -@opindex fdump-ada-spec -For C and C++ source and include files, generate corresponding Ada specs. -@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, -GNAT User's Guide}, which provides detailed documentation on this feature. - -@item -fada-spec-parent=@var{unit} -@opindex fada-spec-parent -In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate -Ada specs as child units of parent @var{unit}. - -@item -fdump-go-spec=@var{file} -@opindex fdump-go-spec -For input files in any language, generate corresponding Go -declarations in @var{file}. This generates Go @code{const}, -@code{type}, @code{var}, and @code{func} declarations which may be a -useful way to start writing a Go interface to code written in some -other language. - -@include @value{srcdir}/../libiberty/at-file.texi -@end table - -@node Invoking G++ -@section Compiling C++ Programs - -@cindex suffixes for C++ source -@cindex C++ source file suffixes -C++ source files conventionally use one of the suffixes @samp{.C}, -@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or -@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, -@samp{.H}, or (for shared template code) @samp{.tcc}; and -preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes -files with these names and compiles them as C++ programs even if you -call the compiler the same way as for compiling C programs (usually -with the name @command{gcc}). - -@findex g++ -@findex c++ -However, the use of @command{gcc} does not add the C++ library. -@command{g++} is a program that calls GCC and automatically specifies linking -against the C++ library. It treats @samp{.c}, -@samp{.h} and @samp{.i} files as C++ source files instead of C source -files unless @option{-x} is used. This program is also useful when -precompiling a C header file with a @samp{.h} extension for use in C++ -compilations. On many systems, @command{g++} is also installed with -the name @command{c++}. - -@cindex invoking @command{g++} -When you compile C++ programs, you may specify many of the same -command-line options that you use for compiling programs in any -language; or command-line options meaningful for C and related -languages; or options that are meaningful only for C++ programs. -@xref{C Dialect Options,,Options Controlling C Dialect}, for -explanations of options for languages related to C@. -@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for -explanations of options that are meaningful only for C++ programs. - -@node C Dialect Options -@section Options Controlling C Dialect -@cindex dialect options -@cindex language dialect options -@cindex options, dialect - -The following options control the dialect of C (or languages derived -from C, such as C++, Objective-C and Objective-C++) that the compiler -accepts: - -@table @gcctabopt -@cindex ANSI support -@cindex ISO support -@item -ansi -@opindex ansi -In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is -equivalent to @option{-std=c++98}. - -This turns off certain features of GCC that are incompatible with ISO -C90 (when compiling C code), or of standard C++ (when compiling C++ code), -such as the @code{asm} and @code{typeof} keywords, and -predefined macros such as @code{unix} and @code{vax} that identify the -type of system you are using. It also enables the undesirable and -rarely used ISO trigraph feature. For the C compiler, -it disables recognition of C++ style @samp{//} comments as well as -the @code{inline} keyword. - -The alternate keywords @code{__asm__}, @code{__extension__}, -@code{__inline__} and @code{__typeof__} continue to work despite -@option{-ansi}. You would not want to use them in an ISO C program, of -course, but it is useful to put them in header files that might be included -in compilations done with @option{-ansi}. Alternate predefined macros -such as @code{__unix__} and @code{__vax__} are also available, with or -without @option{-ansi}. - -The @option{-ansi} option does not cause non-ISO programs to be -rejected gratuitously. For that, @option{-Wpedantic} is required in -addition to @option{-ansi}. @xref{Warning Options}. - -The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} -option is used. Some header files may notice this macro and refrain -from declaring certain functions or defining certain macros that the -ISO standard doesn't call for; this is to avoid interfering with any -programs that might use these names for other things. - -Functions that are normally built in but do not have semantics -defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in -functions when @option{-ansi} is used. @xref{Other Builtins,,Other -built-in functions provided by GCC}, for details of the functions -affected. - -@item -std= -@opindex std -Determine the language standard. @xref{Standards,,Language Standards -Supported by GCC}, for details of these standard versions. This option -is currently only supported when compiling C or C++. - -The compiler can accept several base standards, such as @samp{c90} or -@samp{c++98}, and GNU dialects of those standards, such as -@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the -compiler accepts all programs following that standard plus those -using GNU extensions that do not contradict it. For example, -@option{-std=c90} turns off certain features of GCC that are -incompatible with ISO C90, such as the @code{asm} and @code{typeof} -keywords, but not other GNU extensions that do not have a meaning in -ISO C90, such as omitting the middle term of a @code{?:} -expression. On the other hand, when a GNU dialect of a standard is -specified, all features supported by the compiler are enabled, even when -those features change the meaning of the base standard. As a result, some -strict-conforming programs may be rejected. The particular standard -is used by @option{-Wpedantic} to identify which features are GNU -extensions given that version of the standard. For example -@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} -comments, while @option{-std=gnu99 -Wpedantic} does not. - -A value for this option must be provided; possible values are - -@table @samp -@item c90 -@itemx c89 -@itemx iso9899:1990 -Support all ISO C90 programs (certain GNU extensions that conflict -with ISO C90 are disabled). Same as @option{-ansi} for C code. - -@item iso9899:199409 -ISO C90 as modified in amendment 1. - -@item c99 -@itemx c9x -@itemx iso9899:1999 -@itemx iso9899:199x -ISO C99. This standard is substantially completely supported, modulo -bugs and floating-point issues -(mainly but not entirely relating to optional C99 features from -Annexes F and G). See -@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The -names @samp{c9x} and @samp{iso9899:199x} are deprecated. - -@item c11 -@itemx c1x -@itemx iso9899:2011 -ISO C11, the 2011 revision of the ISO C standard. This standard is -substantially completely supported, modulo bugs, floating-point issues -(mainly but not entirely relating to optional C11 features from -Annexes F and G) and the optional Annexes K (Bounds-checking -interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. - -@item gnu90 -@itemx gnu89 -GNU dialect of ISO C90 (including some C99 features). - -@item gnu99 -@itemx gnu9x -GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. - -@item gnu11 -@itemx gnu1x -GNU dialect of ISO C11. This is the default for C code. -The name @samp{gnu1x} is deprecated. - -@item c++98 -@itemx c++03 -The 1998 ISO C++ standard plus the 2003 technical corrigendum and some -additional defect reports. Same as @option{-ansi} for C++ code. - -@item gnu++98 -@itemx gnu++03 -GNU dialect of @option{-std=c++98}. This is the default for -C++ code. - -@item c++11 -@itemx c++0x -The 2011 ISO C++ standard plus amendments. -The name @samp{c++0x} is deprecated. - -@item gnu++11 -@itemx gnu++0x -GNU dialect of @option{-std=c++11}. -The name @samp{gnu++0x} is deprecated. - -@item c++14 -@itemx c++1y -The 2014 ISO C++ standard plus amendments. -The name @samp{c++1y} is deprecated. - -@item gnu++14 -@itemx gnu++1y -GNU dialect of @option{-std=c++14}. -The name @samp{gnu++1y} is deprecated. - -@item c++1z -The next revision of the ISO C++ standard, tentatively planned for -2017. Support is highly experimental, and will almost certainly -change in incompatible ways in future releases. - -@item gnu++1z -GNU dialect of @option{-std=c++1z}. Support is highly experimental, -and will almost certainly change in incompatible ways in future -releases. -@end table - -@item -fgnu89-inline -@opindex fgnu89-inline -The option @option{-fgnu89-inline} tells GCC to use the traditional -GNU semantics for @code{inline} functions when in C99 mode. -@xref{Inline,,An Inline Function is As Fast As a Macro}. -Using this option is roughly equivalent to adding the -@code{gnu_inline} function attribute to all inline functions -(@pxref{Function Attributes}). - -The option @option{-fno-gnu89-inline} explicitly tells GCC to use the -C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it -specifies the default behavior). -This option is not supported in @option{-std=c90} or -@option{-std=gnu90} mode. - -The preprocessor macros @code{__GNUC_GNU_INLINE__} and -@code{__GNUC_STDC_INLINE__} may be used to check which semantics are -in effect for @code{inline} functions. @xref{Common Predefined -Macros,,,cpp,The C Preprocessor}. - -@item -aux-info @var{filename} -@opindex aux-info -Output to the given filename prototyped declarations for all functions -declared and/or defined in a translation unit, including those in header -files. This option is silently ignored in any language other than C@. - -Besides declarations, the file indicates, in comments, the origin of -each declaration (source file and line), whether the declaration was -implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or -@samp{O} for old, respectively, in the first character after the line -number and the colon), and whether it came from a declaration or a -definition (@samp{C} or @samp{F}, respectively, in the following -character). In the case of function definitions, a K&R-style list of -arguments followed by their declarations is also provided, inside -comments, after the declaration. - -@item -fallow-parameterless-variadic-functions -@opindex fallow-parameterless-variadic-functions -Accept variadic functions without named parameters. - -Although it is possible to define such a function, this is not very -useful as it is not possible to read the arguments. This is only -supported for C as this construct is allowed by C++. - -@item -fno-asm -@opindex fno-asm -Do not recognize @code{asm}, @code{inline} or @code{typeof} as a -keyword, so that code can use these words as identifiers. You can use -the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} -instead. @option{-ansi} implies @option{-fno-asm}. - -In C++, this switch only affects the @code{typeof} keyword, since -@code{asm} and @code{inline} are standard keywords. You may want to -use the @option{-fno-gnu-keywords} flag instead, which has the same -effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this -switch only affects the @code{asm} and @code{typeof} keywords, since -@code{inline} is a standard keyword in ISO C99. - -@item -fno-builtin -@itemx -fno-builtin-@var{function} -@opindex fno-builtin -@cindex built-in functions -Don't recognize built-in functions that do not begin with -@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in -functions provided by GCC}, for details of the functions affected, -including those which are not built-in functions when @option{-ansi} or -@option{-std} options for strict ISO C conformance are used because they -do not have an ISO standard meaning. - -GCC normally generates special code to handle certain built-in functions -more efficiently; for instance, calls to @code{alloca} may become single -instructions which adjust the stack directly, and calls to @code{memcpy} -may become inline copy loops. The resulting code is often both smaller -and faster, but since the function calls no longer appear as such, you -cannot set a breakpoint on those calls, nor can you change the behavior -of the functions by linking with a different library. In addition, -when a function is recognized as a built-in function, GCC may use -information about that function to warn about problems with calls to -that function, or to generate more efficient code, even if the -resulting code still contains calls to that function. For example, -warnings are given with @option{-Wformat} for bad calls to -@code{printf} when @code{printf} is built in and @code{strlen} is -known not to modify global memory. - -With the @option{-fno-builtin-@var{function}} option -only the built-in function @var{function} is -disabled. @var{function} must not begin with @samp{__builtin_}. If a -function is named that is not built-in in this version of GCC, this -option is ignored. There is no corresponding -@option{-fbuiltin-@var{function}} option; if you wish to enable -built-in functions selectively when using @option{-fno-builtin} or -@option{-ffreestanding}, you may define macros such as: - -@smallexample -#define abs(n) __builtin_abs ((n)) -#define strcpy(d, s) __builtin_strcpy ((d), (s)) -@end smallexample - -@item -fhosted -@opindex fhosted -@cindex hosted environment - -Assert that compilation targets a hosted environment. This implies -@option{-fbuiltin}. A hosted environment is one in which the -entire standard library is available, and in which @code{main} has a return -type of @code{int}. Examples are nearly everything except a kernel. -This is equivalent to @option{-fno-freestanding}. - -@item -ffreestanding -@opindex ffreestanding -@cindex hosted environment - -Assert that compilation targets a freestanding environment. This -implies @option{-fno-builtin}. A freestanding environment -is one in which the standard library may not exist, and program startup may -not necessarily be at @code{main}. The most obvious example is an OS kernel. -This is equivalent to @option{-fno-hosted}. - -@xref{Standards,,Language Standards Supported by GCC}, for details of -freestanding and hosted environments. - -@item -fopenacc -@opindex fopenacc -@cindex OpenACC accelerator programming -Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and -@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the -compiler generates accelerated code according to the OpenACC Application -Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option -implies @option{-pthread}, and thus is only supported on targets that -have support for @option{-pthread}. - -Note that this is an experimental feature, incomplete, and subject to -change in future versions of GCC. See -@w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information. - -@item -fopenmp -@opindex fopenmp -@cindex OpenMP parallel -Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and -@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the -compiler generates parallel code according to the OpenMP Application -Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option -implies @option{-pthread}, and thus is only supported on targets that -have support for @option{-pthread}. @option{-fopenmp} implies -@option{-fopenmp-simd}. - -@item -fopenmp-simd -@opindex fopenmp-simd -@cindex OpenMP SIMD -@cindex SIMD -Enable handling of OpenMP's SIMD directives with @code{#pragma omp} -in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives -are ignored. - -@item -fcilkplus -@opindex fcilkplus -@cindex Enable Cilk Plus -Enable the usage of Cilk Plus language extension features for C/C++. -When the option @option{-fcilkplus} is specified, enable the usage of -the Cilk Plus Language extension features for C/C++. The present -implementation follows ABI version 1.2. This is an experimental -feature that is only partially complete, and whose interface may -change in future versions of GCC as the official specification -changes. Currently, all features but @code{_Cilk_for} have been -implemented. - -@item -fgnu-tm -@opindex fgnu-tm -When the option @option{-fgnu-tm} is specified, the compiler -generates code for the Linux variant of Intel's current Transactional -Memory ABI specification document (Revision 1.1, May 6 2009). This is -an experimental feature whose interface may change in future versions -of GCC, as the official specification changes. Please note that not -all architectures are supported for this feature. - -For more information on GCC's support for transactional memory, -@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU -Transactional Memory Library}. - -Note that the transactional memory feature is not supported with -non-call exceptions (@option{-fnon-call-exceptions}). - -@item -fms-extensions -@opindex fms-extensions -Accept some non-standard constructs used in Microsoft header files. - -In C++ code, this allows member names in structures to be similar -to previous types declarations. - -@smallexample -typedef int UOW; -struct ABC @{ - UOW UOW; -@}; -@end smallexample - -Some cases of unnamed fields in structures and unions are only -accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union -fields within structs/unions}, for details. - -Note that this option is off for all targets but x86 -targets using ms-abi. - -@item -fplan9-extensions -@opindex fplan9-extensions -Accept some non-standard constructs used in Plan 9 code. - -This enables @option{-fms-extensions}, permits passing pointers to -structures with anonymous fields to functions that expect pointers to -elements of the type of the field, and permits referring to anonymous -fields declared using a typedef. @xref{Unnamed Fields,,Unnamed -struct/union fields within structs/unions}, for details. This is only -supported for C, not C++. - -@item -trigraphs -@opindex trigraphs -Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} -options for strict ISO C conformance) implies @option{-trigraphs}. - -@cindex traditional C language -@cindex C language, traditional -@item -traditional -@itemx -traditional-cpp -@opindex traditional-cpp -@opindex traditional -Formerly, these options caused GCC to attempt to emulate a pre-standard -C compiler. They are now only supported with the @option{-E} switch. -The preprocessor continues to support a pre-standard mode. See the GNU -CPP manual for details. - -@item -fcond-mismatch -@opindex fcond-mismatch -Allow conditional expressions with mismatched types in the second and -third arguments. The value of such an expression is void. This option -is not supported for C++. - -@item -flax-vector-conversions -@opindex flax-vector-conversions -Allow implicit conversions between vectors with differing numbers of -elements and/or incompatible element types. This option should not be -used for new code. - -@item -funsigned-char -@opindex funsigned-char -Let the type @code{char} be unsigned, like @code{unsigned char}. - -Each kind of machine has a default for what @code{char} should -be. It is either like @code{unsigned char} by default or like -@code{signed char} by default. - -Ideally, a portable program should always use @code{signed char} or -@code{unsigned char} when it depends on the signedness of an object. -But many programs have been written to use plain @code{char} and -expect it to be signed, or expect it to be unsigned, depending on the -machines they were written for. This option, and its inverse, let you -make such a program work with the opposite default. - -The type @code{char} is always a distinct type from each of -@code{signed char} or @code{unsigned char}, even though its behavior -is always just like one of those two. - -@item -fsigned-char -@opindex fsigned-char -Let the type @code{char} be signed, like @code{signed char}. - -Note that this is equivalent to @option{-fno-unsigned-char}, which is -the negative form of @option{-funsigned-char}. Likewise, the option -@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. - -@item -fsigned-bitfields -@itemx -funsigned-bitfields -@itemx -fno-signed-bitfields -@itemx -fno-unsigned-bitfields -@opindex fsigned-bitfields -@opindex funsigned-bitfields -@opindex fno-signed-bitfields -@opindex fno-unsigned-bitfields -These options control whether a bit-field is signed or unsigned, when the -declaration does not use either @code{signed} or @code{unsigned}. By -default, such a bit-field is signed, because this is consistent: the -basic integer types such as @code{int} are signed types. -@end table - -@node C++ Dialect Options -@section Options Controlling C++ Dialect - -@cindex compiler options, C++ -@cindex C++ options, command-line -@cindex options, C++ -This section describes the command-line options that are only meaningful -for C++ programs. You can also use most of the GNU compiler options -regardless of what language your program is in. For example, you -might compile a file @file{firstClass.C} like this: - -@smallexample -g++ -g -frepo -O -c firstClass.C -@end smallexample - -@noindent -In this example, only @option{-frepo} is an option meant -only for C++ programs; you can use the other options with any -language supported by GCC@. - -Here is a list of options that are @emph{only} for compiling C++ programs: - -@table @gcctabopt - -@item -fabi-version=@var{n} -@opindex fabi-version -Use version @var{n} of the C++ ABI@. The default is version 0. - -Version 0 refers to the version conforming most closely to -the C++ ABI specification. Therefore, the ABI obtained using version 0 -will change in different versions of G++ as ABI bugs are fixed. - -Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. - -Version 2 is the version of the C++ ABI that first appeared in G++ -3.4, and was the default through G++ 4.9. - -Version 3 corrects an error in mangling a constant address as a -template argument. - -Version 4, which first appeared in G++ 4.5, implements a standard -mangling for vector types. - -Version 5, which first appeared in G++ 4.6, corrects the mangling of -attribute const/volatile on function pointer types, decltype of a -plain decl, and use of a function parameter in the declaration of -another parameter. - -Version 6, which first appeared in G++ 4.7, corrects the promotion -behavior of C++11 scoped enums and the mangling of template argument -packs, const/static_cast, prefix ++ and --, and a class scope function -used as a template argument. - -Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a -builtin type and corrects the mangling of lambdas in default argument -scope. - -Version 8, which first appeared in G++ 4.9, corrects the substitution -behavior of function types with function-cv-qualifiers. - -See also @option{-Wabi}. - -@item -fabi-compat-version=@var{n} -@opindex fabi-compat-version -On targets that support strong aliases, G++ -works around mangling changes by creating an alias with the correct -mangled name when defining a symbol with an incorrect mangled name. -This switch specifies which ABI version to use for the alias. - -With @option{-fabi-version=0} (the default), this defaults to 2. If -another ABI version is explicitly selected, this defaults to 0. - -The compatibility version is also set by @option{-Wabi=@var{n}}. - -@item -fno-access-control -@opindex fno-access-control -Turn off all access checking. This switch is mainly useful for working -around bugs in the access control code. - -@item -fcheck-new -@opindex fcheck-new -Check that the pointer returned by @code{operator new} is non-null -before attempting to modify the storage allocated. This check is -normally unnecessary because the C++ standard specifies that -@code{operator new} only returns @code{0} if it is declared -@code{throw()}, in which case the compiler always checks the -return value even without this option. In all other cases, when -@code{operator new} has a non-empty exception specification, memory -exhaustion is signalled by throwing @code{std::bad_alloc}. See also -@samp{new (nothrow)}. - -@item -fconstexpr-depth=@var{n} -@opindex fconstexpr-depth -Set the maximum nested evaluation depth for C++11 constexpr functions -to @var{n}. A limit is needed to detect endless recursion during -constant expression evaluation. The minimum specified by the standard -is 512. - -@item -fdeduce-init-list -@opindex fdeduce-init-list -Enable deduction of a template type parameter as -@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: - -@smallexample -template auto forward(T t) -> decltype (realfn (t)) -@{ - return realfn (t); -@} - -void f() -@{ - forward(@{1,2@}); // call forward> -@} -@end smallexample - -This deduction was implemented as a possible extension to the -originally proposed semantics for the C++11 standard, but was not part -of the final standard, so it is disabled by default. This option is -deprecated, and may be removed in a future version of G++. - -@item -ffriend-injection -@opindex ffriend-injection -Inject friend functions into the enclosing namespace, so that they are -visible outside the scope of the class in which they are declared. -Friend functions were documented to work this way in the old Annotated -C++ Reference Manual. -However, in ISO C++ a friend function that is not declared -in an enclosing scope can only be found using argument dependent -lookup. GCC defaults to the standard behavior. - -This option is for compatibility, and may be removed in a future -release of G++. - -@item -fno-elide-constructors -@opindex fno-elide-constructors -The C++ standard allows an implementation to omit creating a temporary -that is only used to initialize another object of the same type. -Specifying this option disables that optimization, and forces G++ to -call the copy constructor in all cases. - -@item -fno-enforce-eh-specs -@opindex fno-enforce-eh-specs -Don't generate code to check for violation of exception specifications -at run time. This option violates the C++ standard, but may be useful -for reducing code size in production builds, much like defining -@code{NDEBUG}. This does not give user code permission to throw -exceptions in violation of the exception specifications; the compiler -still optimizes based on the specifications, so throwing an -unexpected exception results in undefined behavior at run time. - -@item -fextern-tls-init -@itemx -fno-extern-tls-init -@opindex fextern-tls-init -@opindex fno-extern-tls-init -The C++11 and OpenMP standards allow @code{thread_local} and -@code{threadprivate} variables to have dynamic (runtime) -initialization. To support this, any use of such a variable goes -through a wrapper function that performs any necessary initialization. -When the use and definition of the variable are in the same -translation unit, this overhead can be optimized away, but when the -use is in a different translation unit there is significant overhead -even if the variable doesn't actually need dynamic initialization. If -the programmer can be sure that no use of the variable in a -non-defining TU needs to trigger dynamic initialization (either -because the variable is statically initialized, or a use of the -variable in the defining TU will be executed before any uses in -another TU), they can avoid this overhead with the -@option{-fno-extern-tls-init} option. - -On targets that support symbol aliases, the default is -@option{-fextern-tls-init}. On targets that do not support symbol -aliases, the default is @option{-fno-extern-tls-init}. - -@item -ffor-scope -@itemx -fno-for-scope -@opindex ffor-scope -@opindex fno-for-scope -If @option{-ffor-scope} is specified, the scope of variables declared in -a @i{for-init-statement} is limited to the @code{for} loop itself, -as specified by the C++ standard. -If @option{-fno-for-scope} is specified, the scope of variables declared in -a @i{for-init-statement} extends to the end of the enclosing scope, -as was the case in old versions of G++, and other (traditional) -implementations of C++. - -If neither flag is given, the default is to follow the standard, -but to allow and give a warning for old-style code that would -otherwise be invalid, or have different behavior. - -@item -fno-gnu-keywords -@opindex fno-gnu-keywords -Do not recognize @code{typeof} as a keyword, so that code can use this -word as an identifier. You can use the keyword @code{__typeof__} instead. -@option{-ansi} implies @option{-fno-gnu-keywords}. - -@item -fno-implicit-templates -@opindex fno-implicit-templates -Never emit code for non-inline templates that are instantiated -implicitly (i.e.@: by use); only emit code for explicit instantiations. -@xref{Template Instantiation}, for more information. - -@item -fno-implicit-inline-templates -@opindex fno-implicit-inline-templates -Don't emit code for implicit instantiations of inline templates, either. -The default is to handle inlines differently so that compiles with and -without optimization need the same set of explicit instantiations. - -@item -fno-implement-inlines -@opindex fno-implement-inlines -To save space, do not emit out-of-line copies of inline functions -controlled by @code{#pragma implementation}. This causes linker -errors if these functions are not inlined everywhere they are called. - -@item -fms-extensions -@opindex fms-extensions -Disable Wpedantic warnings about constructs used in MFC, such as implicit -int and getting a pointer to member function via non-standard syntax. - -@item -fno-nonansi-builtins -@opindex fno-nonansi-builtins -Disable built-in declarations of functions that are not mandated by -ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, -@code{index}, @code{bzero}, @code{conjf}, and other related functions. - -@item -fnothrow-opt -@opindex fnothrow-opt -Treat a @code{throw()} exception specification as if it were a -@code{noexcept} specification to reduce or eliminate the text size -overhead relative to a function with no exception specification. If -the function has local variables of types with non-trivial -destructors, the exception specification actually makes the -function smaller because the EH cleanups for those variables can be -optimized away. The semantic effect is that an exception thrown out of -a function with such an exception specification results in a call -to @code{terminate} rather than @code{unexpected}. - -@item -fno-operator-names -@opindex fno-operator-names -Do not treat the operator name keywords @code{and}, @code{bitand}, -@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as -synonyms as keywords. - -@item -fno-optional-diags -@opindex fno-optional-diags -Disable diagnostics that the standard says a compiler does not need to -issue. Currently, the only such diagnostic issued by G++ is the one for -a name having multiple meanings within a class. - -@item -fpermissive -@opindex fpermissive -Downgrade some diagnostics about nonconformant code from errors to -warnings. Thus, using @option{-fpermissive} allows some -nonconforming code to compile. - -@item -fno-pretty-templates -@opindex fno-pretty-templates -When an error message refers to a specialization of a function -template, the compiler normally prints the signature of the -template followed by the template arguments and any typedefs or -typenames in the signature (e.g. @code{void f(T) [with T = int]} -rather than @code{void f(int)}) so that it's clear which template is -involved. When an error message refers to a specialization of a class -template, the compiler omits any template arguments that match -the default template arguments for that template. If either of these -behaviors make it harder to understand the error message rather than -easier, you can use @option{-fno-pretty-templates} to disable them. - -@item -frepo -@opindex frepo -Enable automatic template instantiation at link time. This option also -implies @option{-fno-implicit-templates}. @xref{Template -Instantiation}, for more information. - -@item -fno-rtti -@opindex fno-rtti -Disable generation of information about every class with virtual -functions for use by the C++ run-time type identification features -(@code{dynamic_cast} and @code{typeid}). If you don't use those parts -of the language, you can save some space by using this flag. Note that -exception handling uses the same information, but G++ generates it as -needed. The @code{dynamic_cast} operator can still be used for casts that -do not require run-time type information, i.e.@: casts to @code{void *} or to -unambiguous base classes. - -@item -fsized-deallocation -@opindex fsized-deallocation -Enable the built-in global declarations -@smallexample -void operator delete (void *, std::size_t) noexcept; -void operator delete[] (void *, std::size_t) noexcept; -@end smallexample -as introduced in C++14. This is useful for user-defined replacement -deallocation functions that, for example, use the size of the object -to make deallocation faster. Enabled by default under -@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} -warns about places that might want to add a definition. - -@item -fstats -@opindex fstats -Emit statistics about front-end processing at the end of the compilation. -This information is generally only useful to the G++ development team. - -@item -fstrict-enums -@opindex fstrict-enums -Allow the compiler to optimize using the assumption that a value of -enumerated type can only be one of the values of the enumeration (as -defined in the C++ standard; basically, a value that can be -represented in the minimum number of bits needed to represent all the -enumerators). This assumption may not be valid if the program uses a -cast to convert an arbitrary integer value to the enumerated type. - -@item -ftemplate-backtrace-limit=@var{n} -@opindex ftemplate-backtrace-limit -Set the maximum number of template instantiation notes for a single -warning or error to @var{n}. The default value is 10. - -@item -ftemplate-depth=@var{n} -@opindex ftemplate-depth -Set the maximum instantiation depth for template classes to @var{n}. -A limit on the template instantiation depth is needed to detect -endless recursions during template class instantiation. ANSI/ISO C++ -conforming programs must not rely on a maximum depth greater than 17 -(changed to 1024 in C++11). The default value is 900, as the compiler -can run out of stack space before hitting 1024 in some situations. - -@item -fno-threadsafe-statics -@opindex fno-threadsafe-statics -Do not emit the extra code to use the routines specified in the C++ -ABI for thread-safe initialization of local statics. You can use this -option to reduce code size slightly in code that doesn't need to be -thread-safe. - -@item -fuse-cxa-atexit -@opindex fuse-cxa-atexit -Register destructors for objects with static storage duration with the -@code{__cxa_atexit} function rather than the @code{atexit} function. -This option is required for fully standards-compliant handling of static -destructors, but only works if your C library supports -@code{__cxa_atexit}. - -@item -fno-use-cxa-get-exception-ptr -@opindex fno-use-cxa-get-exception-ptr -Don't use the @code{__cxa_get_exception_ptr} runtime routine. This -causes @code{std::uncaught_exception} to be incorrect, but is necessary -if the runtime routine is not available. - -@item -fvisibility-inlines-hidden -@opindex fvisibility-inlines-hidden -This switch declares that the user does not attempt to compare -pointers to inline functions or methods where the addresses of the two functions -are taken in different shared objects. - -The effect of this is that GCC may, effectively, mark inline methods with -@code{__attribute__ ((visibility ("hidden")))} so that they do not -appear in the export table of a DSO and do not require a PLT indirection -when used within the DSO@. Enabling this option can have a dramatic effect -on load and link times of a DSO as it massively reduces the size of the -dynamic export table when the library makes heavy use of templates. - -The behavior of this switch is not quite the same as marking the -methods as hidden directly, because it does not affect static variables -local to the function or cause the compiler to deduce that -the function is defined in only one shared object. - -You may mark a method as having a visibility explicitly to negate the -effect of the switch for that method. For example, if you do want to -compare pointers to a particular inline method, you might mark it as -having default visibility. Marking the enclosing class with explicit -visibility has no effect. - -Explicitly instantiated inline methods are unaffected by this option -as their linkage might otherwise cross a shared library boundary. -@xref{Template Instantiation}. - -@item -fvisibility-ms-compat -@opindex fvisibility-ms-compat -This flag attempts to use visibility settings to make GCC's C++ -linkage model compatible with that of Microsoft Visual Studio. - -The flag makes these changes to GCC's linkage model: - -@enumerate -@item -It sets the default visibility to @code{hidden}, like -@option{-fvisibility=hidden}. - -@item -Types, but not their members, are not hidden by default. - -@item -The One Definition Rule is relaxed for types without explicit -visibility specifications that are defined in more than one -shared object: those declarations are permitted if they are -permitted when this option is not used. -@end enumerate - -In new code it is better to use @option{-fvisibility=hidden} and -export those classes that are intended to be externally visible. -Unfortunately it is possible for code to rely, perhaps accidentally, -on the Visual Studio behavior. - -Among the consequences of these changes are that static data members -of the same type with the same name but defined in different shared -objects are different, so changing one does not change the other; -and that pointers to function members defined in different shared -objects may not compare equal. When this flag is given, it is a -violation of the ODR to define types with the same name differently. - -@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} -@opindex fvtable-verify -Turn on (or off, if using @option{-fvtable-verify=none}) the security -feature that verifies at run time, for every virtual call, that -the vtable pointer through which the call is made is valid for the type of -the object, and has not been corrupted or overwritten. If an invalid vtable -pointer is detected at run time, an error is reported and execution of the -program is immediately halted. - -This option causes run-time data structures to be built at program startup, -which are used for verifying the vtable pointers. -The options @samp{std} and @samp{preinit} -control the timing of when these data structures are built. In both cases the -data structures are built before execution reaches @code{main}. Using -@option{-fvtable-verify=std} causes the data structures to be built after -shared libraries have been loaded and initialized. -@option{-fvtable-verify=preinit} causes them to be built before shared -libraries have been loaded and initialized. - -If this option appears multiple times in the command line with different -values specified, @samp{none} takes highest priority over both @samp{std} and -@samp{preinit}; @samp{preinit} takes priority over @samp{std}. - -@item -fvtv-debug -@opindex fvtv-debug -When used in conjunction with @option{-fvtable-verify=std} or -@option{-fvtable-verify=preinit}, causes debug versions of the -runtime functions for the vtable verification feature to be called. -This flag also causes the compiler to log information about which -vtable pointers it finds for each class. -This information is written to a file named @file{vtv_set_ptr_data.log} -in the directory named by the environment variable @env{VTV_LOGS_DIR} -if that is defined or the current working directory otherwise. - -Note: This feature @emph{appends} data to the log file. If you want a fresh log -file, be sure to delete any existing one. - -@item -fvtv-counts -@opindex fvtv-counts -This is a debugging flag. When used in conjunction with -@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this -causes the compiler to keep track of the total number of virtual calls -it encounters and the number of verifications it inserts. It also -counts the number of calls to certain run-time library functions -that it inserts and logs this information for each compilation unit. -The compiler writes this information to a file named -@file{vtv_count_data.log} in the directory named by the environment -variable @env{VTV_LOGS_DIR} if that is defined or the current working -directory otherwise. It also counts the size of the vtable pointer sets -for each class, and writes this information to @file{vtv_class_set_sizes.log} -in the same directory. - -Note: This feature @emph{appends} data to the log files. To get fresh log -files, be sure to delete any existing ones. - -@item -fno-weak -@opindex fno-weak -Do not use weak symbol support, even if it is provided by the linker. -By default, G++ uses weak symbols if they are available. This -option exists only for testing, and should not be used by end-users; -it results in inferior code and has no benefits. This option may -be removed in a future release of G++. - -@item -nostdinc++ -@opindex nostdinc++ -Do not search for header files in the standard directories specific to -C++, but do still search the other standard directories. (This option -is used when building the C++ library.) -@end table - -In addition, these optimization, warning, and code generation options -have meanings only for C++ programs: - -@table @gcctabopt -@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} -@opindex Wabi -@opindex Wno-abi -When an explicit @option{-fabi-version=@var{n}} option is used, causes -G++ to warn when it generates code that is probably not compatible with the -vendor-neutral C++ ABI@. Since G++ now defaults to -@option{-fabi-version=0}, @option{-Wabi} has no effect unless either -an older ABI version is selected (with @option{-fabi-version=@var{n}}) -or an older compatibility version is selected (with -@option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}). - -Although an effort has been made to warn about -all such cases, there are probably some cases that are not warned about, -even though G++ is generating incompatible code. There may also be -cases where warnings are emitted even though the code that is generated -is compatible. - -You should rewrite your code to avoid these warnings if you are -concerned about the fact that code generated by G++ may not be binary -compatible with code generated by other compilers. - -@option{-Wabi} can also be used with an explicit version number to -warn about compatibility with a particular @option{-fabi-version} -level, e.g. @option{-Wabi=2} to warn about changes relative to -@option{-fabi-version=2}. Specifying a version number also sets -@option{-fabi-compat-version=@var{n}}. - -The known incompatibilities in @option{-fabi-version=2} (which was the -default from GCC 3.4 to 4.9) include: - -@itemize @bullet - -@item -A template with a non-type template parameter of reference type was -mangled incorrectly: -@smallexample -extern int N; -template struct S @{@}; -void n (S) @{2@} -@end smallexample - -This was fixed in @option{-fabi-version=3}. - -@item -SIMD vector types declared using @code{__attribute ((vector_size))} were -mangled in a non-standard way that does not allow for overloading of -functions taking vectors of different sizes. - -The mangling was changed in @option{-fabi-version=4}. - -@item -@code{__attribute ((const))} and @code{noreturn} were mangled as type -qualifiers, and @code{decltype} of a plain declaration was folded away. - -These mangling issues were fixed in @option{-fabi-version=5}. - -@item -Scoped enumerators passed as arguments to a variadic function are -promoted like unscoped enumerators, causing @code{va_arg} to complain. -On most targets this does not actually affect the parameter passing -ABI, as there is no way to pass an argument smaller than @code{int}. - -Also, the ABI changed the mangling of template argument packs, -@code{const_cast}, @code{static_cast}, prefix increment/decrement, and -a class scope function used as a template argument. - -These issues were corrected in @option{-fabi-version=6}. - -@item -Lambdas in default argument scope were mangled incorrectly, and the -ABI changed the mangling of @code{nullptr_t}. - -These issues were corrected in @option{-fabi-version=7}. - -@item -When mangling a function type with function-cv-qualifiers, the -un-qualified function type was incorrectly treated as a substitution -candidate. - -This was fixed in @option{-fabi-version=8}. -@end itemize - -It also warns about psABI-related changes. The known psABI changes at this -point include: - -@itemize @bullet - -@item -For SysV/x86-64, unions with @code{long double} members are -passed in memory as specified in psABI. For example: - -@smallexample -union U @{ - long double ld; - int i; -@}; -@end smallexample - -@noindent -@code{union U} is always passed in memory. - -@end itemize - -@item -Wabi-tag @r{(C++ and Objective-C++ only)} -@opindex Wabi-tag -@opindex -Wabi-tag -Warn when a type with an ABI tag is used in a context that does not -have that ABI tag. See @ref{C++ Attributes} for more information -about ABI tags. - -@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} -@opindex Wctor-dtor-privacy -@opindex Wno-ctor-dtor-privacy -Warn when a class seems unusable because all the constructors or -destructors in that class are private, and it has neither friends nor -public static member functions. Also warn if there are no non-private -methods, and there's at least one private member function that isn't -a constructor or destructor. - -@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} -@opindex Wdelete-non-virtual-dtor -@opindex Wno-delete-non-virtual-dtor -Warn when @code{delete} is used to destroy an instance of a class that -has virtual functions and non-virtual destructor. It is unsafe to delete -an instance of a derived class through a pointer to a base class if the -base class does not have a virtual destructor. This warning is enabled -by @option{-Wall}. - -@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} -@opindex Wliteral-suffix -@opindex Wno-literal-suffix -Warn when a string or character literal is followed by a ud-suffix which does -not begin with an underscore. As a conforming extension, GCC treats such -suffixes as separate preprocessing tokens in order to maintain backwards -compatibility with code that uses formatting macros from @code{}. -For example: - -@smallexample -#define __STDC_FORMAT_MACROS -#include -#include - -int main() @{ - int64_t i64 = 123; - printf("My int64: %"PRId64"\n", i64); -@} -@end smallexample - -In this case, @code{PRId64} is treated as a separate preprocessing token. - -This warning is enabled by default. - -@item -Wnarrowing @r{(C++ and Objective-C++ only)} -@opindex Wnarrowing -@opindex Wno-narrowing -Warn when a narrowing conversion prohibited by C++11 occurs within -@samp{@{ @}}, e.g. - -@smallexample -int i = @{ 2.2 @}; // error: narrowing from double to int -@end smallexample - -This flag is included in @option{-Wall} and @option{-Wc++11-compat}. - -With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for -non-constants the diagnostic required by the standard. Note that this -does not affect the meaning of well-formed code; narrowing conversions -are still considered ill-formed in SFINAE context. - -@item -Wnoexcept @r{(C++ and Objective-C++ only)} -@opindex Wnoexcept -@opindex Wno-noexcept -Warn when a noexcept-expression evaluates to false because of a call -to a function that does not have a non-throwing exception -specification (i.e. @code{throw()} or @code{noexcept}) but is known by -the compiler to never throw an exception. - -@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} -@opindex Wnon-virtual-dtor -@opindex Wno-non-virtual-dtor -Warn when a class has virtual functions and an accessible non-virtual -destructor itself or in an accessible polymorphic base class, in which -case it is possible but unsafe to delete an instance of a derived -class through a pointer to the class itself or base class. This -warning is automatically enabled if @option{-Weffc++} is specified. - -@item -Wreorder @r{(C++ and Objective-C++ only)} -@opindex Wreorder -@opindex Wno-reorder -@cindex reordering, warning -@cindex warning for reordering of member initializers -Warn when the order of member initializers given in the code does not -match the order in which they must be executed. For instance: - -@smallexample -struct A @{ - int i; - int j; - A(): j (0), i (1) @{ @} -@}; -@end smallexample - -@noindent -The compiler rearranges the member initializers for @code{i} -and @code{j} to match the declaration order of the members, emitting -a warning to that effect. This warning is enabled by @option{-Wall}. - -@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} -@opindex fext-numeric-literals -@opindex fno-ext-numeric-literals -Accept imaginary, fixed-point, or machine-defined -literal number suffixes as GNU extensions. -When this option is turned off these suffixes are treated -as C++11 user-defined literal numeric suffixes. -This is on by default for all pre-C++11 dialects and all GNU dialects: -@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, -@option{-std=gnu++14}. -This option is off by default -for ISO C++11 onwards (@option{-std=c++11}, ...). -@end table - -The following @option{-W@dots{}} options are not affected by @option{-Wall}. - -@table @gcctabopt -@item -Weffc++ @r{(C++ and Objective-C++ only)} -@opindex Weffc++ -@opindex Wno-effc++ -Warn about violations of the following style guidelines from Scott Meyers' -@cite{Effective C++} series of books: - -@itemize @bullet -@item -Define a copy constructor and an assignment operator for classes -with dynamically-allocated memory. - -@item -Prefer initialization to assignment in constructors. - -@item -Have @code{operator=} return a reference to @code{*this}. - -@item -Don't try to return a reference when you must return an object. - -@item -Distinguish between prefix and postfix forms of increment and -decrement operators. - -@item -Never overload @code{&&}, @code{||}, or @code{,}. - -@end itemize - -This option also enables @option{-Wnon-virtual-dtor}, which is also -one of the effective C++ recommendations. However, the check is -extended to warn about the lack of virtual destructor in accessible -non-polymorphic bases classes too. - -When selecting this option, be aware that the standard library -headers do not obey all of these guidelines; use @samp{grep -v} -to filter out those warnings. - -@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} -@opindex Wstrict-null-sentinel -@opindex Wno-strict-null-sentinel -Warn about the use of an uncasted @code{NULL} as sentinel. When -compiling only with GCC this is a valid sentinel, as @code{NULL} is defined -to @code{__null}. Although it is a null pointer constant rather than a -null pointer, it is guaranteed to be of the same size as a pointer. -But this use is not portable across different compilers. - -@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} -@opindex Wno-non-template-friend -@opindex Wnon-template-friend -Disable warnings when non-templatized friend functions are declared -within a template. Since the advent of explicit template specification -support in G++, if the name of the friend is an unqualified-id (i.e., -@samp{friend foo(int)}), the C++ language specification demands that the -friend declare or define an ordinary, nontemplate function. (Section -14.5.3). Before G++ implemented explicit specification, unqualified-ids -could be interpreted as a particular specialization of a templatized -function. Because this non-conforming behavior is no longer the default -behavior for G++, @option{-Wnon-template-friend} allows the compiler to -check existing code for potential trouble spots and is on by default. -This new compiler behavior can be turned off with -@option{-Wno-non-template-friend}, which keeps the conformant compiler code -but disables the helpful warning. - -@item -Wold-style-cast @r{(C++ and Objective-C++ only)} -@opindex Wold-style-cast -@opindex Wno-old-style-cast -Warn if an old-style (C-style) cast to a non-void type is used within -a C++ program. The new-style casts (@code{dynamic_cast}, -@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are -less vulnerable to unintended effects and much easier to search for. - -@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} -@opindex Woverloaded-virtual -@opindex Wno-overloaded-virtual -@cindex overloaded virtual function, warning -@cindex warning for overloaded virtual function -Warn when a function declaration hides virtual functions from a -base class. For example, in: - -@smallexample -struct A @{ - virtual void f(); -@}; - -struct B: public A @{ - void f(int); -@}; -@end smallexample - -the @code{A} class version of @code{f} is hidden in @code{B}, and code -like: - -@smallexample -B* b; -b->f(); -@end smallexample - -@noindent -fails to compile. - -@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} -@opindex Wno-pmf-conversions -@opindex Wpmf-conversions -Disable the diagnostic for converting a bound pointer to member function -to a plain pointer. - -@item -Wsign-promo @r{(C++ and Objective-C++ only)} -@opindex Wsign-promo -@opindex Wno-sign-promo -Warn when overload resolution chooses a promotion from unsigned or -enumerated type to a signed type, over a conversion to an unsigned type of -the same size. Previous versions of G++ tried to preserve -unsignedness, but the standard mandates the current behavior. -@end table - -@node Objective-C and Objective-C++ Dialect Options -@section Options Controlling Objective-C and Objective-C++ Dialects - -@cindex compiler options, Objective-C and Objective-C++ -@cindex Objective-C and Objective-C++ options, command-line -@cindex options, Objective-C and Objective-C++ -(NOTE: This manual does not describe the Objective-C and Objective-C++ -languages themselves. @xref{Standards,,Language Standards -Supported by GCC}, for references.) - -This section describes the command-line options that are only meaningful -for Objective-C and Objective-C++ programs. You can also use most of -the language-independent GNU compiler options. -For example, you might compile a file @file{some_class.m} like this: - -@smallexample -gcc -g -fgnu-runtime -O -c some_class.m -@end smallexample - -@noindent -In this example, @option{-fgnu-runtime} is an option meant only for -Objective-C and Objective-C++ programs; you can use the other options with -any language supported by GCC@. - -Note that since Objective-C is an extension of the C language, Objective-C -compilations may also use options specific to the C front-end (e.g., -@option{-Wtraditional}). Similarly, Objective-C++ compilations may use -C++-specific options (e.g., @option{-Wabi}). - -Here is a list of options that are @emph{only} for compiling Objective-C -and Objective-C++ programs: - -@table @gcctabopt -@item -fconstant-string-class=@var{class-name} -@opindex fconstant-string-class -Use @var{class-name} as the name of the class to instantiate for each -literal string specified with the syntax @code{@@"@dots{}"}. The default -class name is @code{NXConstantString} if the GNU runtime is being used, and -@code{NSConstantString} if the NeXT runtime is being used (see below). The -@option{-fconstant-cfstrings} option, if also present, overrides the -@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals -to be laid out as constant CoreFoundation strings. - -@item -fgnu-runtime -@opindex fgnu-runtime -Generate object code compatible with the standard GNU Objective-C -runtime. This is the default for most types of systems. - -@item -fnext-runtime -@opindex fnext-runtime -Generate output compatible with the NeXT runtime. This is the default -for NeXT-based systems, including Darwin and Mac OS X@. The macro -@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is -used. - -@item -fno-nil-receivers -@opindex fno-nil-receivers -Assume that all Objective-C message dispatches (@code{[receiver -message:arg]}) in this translation unit ensure that the receiver is -not @code{nil}. This allows for more efficient entry points in the -runtime to be used. This option is only available in conjunction with -the NeXT runtime and ABI version 0 or 1. - -@item -fobjc-abi-version=@var{n} -@opindex fobjc-abi-version -Use version @var{n} of the Objective-C ABI for the selected runtime. -This option is currently supported only for the NeXT runtime. In that -case, Version 0 is the traditional (32-bit) ABI without support for -properties and other Objective-C 2.0 additions. Version 1 is the -traditional (32-bit) ABI with support for properties and other -Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If -nothing is specified, the default is Version 0 on 32-bit target -machines, and Version 2 on 64-bit target machines. - -@item -fobjc-call-cxx-cdtors -@opindex fobjc-call-cxx-cdtors -For each Objective-C class, check if any of its instance variables is a -C++ object with a non-trivial default constructor. If so, synthesize a -special @code{- (id) .cxx_construct} instance method which runs -non-trivial default constructors on any such instance variables, in order, -and then return @code{self}. Similarly, check if any instance variable -is a C++ object with a non-trivial destructor, and if so, synthesize a -special @code{- (void) .cxx_destruct} method which runs -all such default destructors, in reverse order. - -The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} -methods thusly generated only operate on instance variables -declared in the current Objective-C class, and not those inherited -from superclasses. It is the responsibility of the Objective-C -runtime to invoke all such methods in an object's inheritance -hierarchy. The @code{- (id) .cxx_construct} methods are invoked -by the runtime immediately after a new object instance is allocated; -the @code{- (void) .cxx_destruct} methods are invoked immediately -before the runtime deallocates an object instance. - -As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has -support for invoking the @code{- (id) .cxx_construct} and -@code{- (void) .cxx_destruct} methods. - -@item -fobjc-direct-dispatch -@opindex fobjc-direct-dispatch -Allow fast jumps to the message dispatcher. On Darwin this is -accomplished via the comm page. - -@item -fobjc-exceptions -@opindex fobjc-exceptions -Enable syntactic support for structured exception handling in -Objective-C, similar to what is offered by C++ and Java. This option -is required to use the Objective-C keywords @code{@@try}, -@code{@@throw}, @code{@@catch}, @code{@@finally} and -@code{@@synchronized}. This option is available with both the GNU -runtime and the NeXT runtime (but not available in conjunction with -the NeXT runtime on Mac OS X 10.2 and earlier). - -@item -fobjc-gc -@opindex fobjc-gc -Enable garbage collection (GC) in Objective-C and Objective-C++ -programs. This option is only available with the NeXT runtime; the -GNU runtime has a different garbage collection implementation that -does not require special compiler flags. - -@item -fobjc-nilcheck -@opindex fobjc-nilcheck -For the NeXT runtime with version 2 of the ABI, check for a nil -receiver in method invocations before doing the actual method call. -This is the default and can be disabled using -@option{-fno-objc-nilcheck}. Class methods and super calls are never -checked for nil in this way no matter what this flag is set to. -Currently this flag does nothing when the GNU runtime, or an older -version of the NeXT runtime ABI, is used. - -@item -fobjc-std=objc1 -@opindex fobjc-std -Conform to the language syntax of Objective-C 1.0, the language -recognized by GCC 4.0. This only affects the Objective-C additions to -the C/C++ language; it does not affect conformance to C/C++ standards, -which is controlled by the separate C/C++ dialect option flags. When -this option is used with the Objective-C or Objective-C++ compiler, -any Objective-C syntax that is not recognized by GCC 4.0 is rejected. -This is useful if you need to make sure that your Objective-C code can -be compiled with older versions of GCC@. - -@item -freplace-objc-classes -@opindex freplace-objc-classes -Emit a special marker instructing @command{ld(1)} not to statically link in -the resulting object file, and allow @command{dyld(1)} to load it in at -run time instead. This is used in conjunction with the Fix-and-Continue -debugging mode, where the object file in question may be recompiled and -dynamically reloaded in the course of program execution, without the need -to restart the program itself. Currently, Fix-and-Continue functionality -is only available in conjunction with the NeXT runtime on Mac OS X 10.3 -and later. - -@item -fzero-link -@opindex fzero-link -When compiling for the NeXT runtime, the compiler ordinarily replaces calls -to @code{objc_getClass("@dots{}")} (when the name of the class is known at -compile time) with static class references that get initialized at load time, -which improves run-time performance. Specifying the @option{-fzero-link} flag -suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} -to be retained. This is useful in Zero-Link debugging mode, since it allows -for individual class implementations to be modified during program execution. -The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} -regardless of command-line options. - -@item -fno-local-ivars -@opindex fno-local-ivars -@opindex flocal-ivars -By default instance variables in Objective-C can be accessed as if -they were local variables from within the methods of the class they're -declared in. This can lead to shadowing between instance variables -and other variables declared either locally inside a class method or -globally with the same name. Specifying the @option{-fno-local-ivars} -flag disables this behavior thus avoiding variable shadowing issues. - -@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} -@opindex fivar-visibility -Set the default instance variable visibility to the specified option -so that instance variables declared outside the scope of any access -modifier directives default to the specified visibility. - -@item -gen-decls -@opindex gen-decls -Dump interface declarations for all classes seen in the source file to a -file named @file{@var{sourcename}.decl}. - -@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} -@opindex Wassign-intercept -@opindex Wno-assign-intercept -Warn whenever an Objective-C assignment is being intercepted by the -garbage collector. - -@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} -@opindex Wno-protocol -@opindex Wprotocol -If a class is declared to implement a protocol, a warning is issued for -every method in the protocol that is not implemented by the class. The -default behavior is to issue a warning for every method not explicitly -implemented in the class, even if a method implementation is inherited -from the superclass. If you use the @option{-Wno-protocol} option, then -methods inherited from the superclass are considered to be implemented, -and no warning is issued for them. - -@item -Wselector @r{(Objective-C and Objective-C++ only)} -@opindex Wselector -@opindex Wno-selector -Warn if multiple methods of different types for the same selector are -found during compilation. The check is performed on the list of methods -in the final stage of compilation. Additionally, a check is performed -for each selector appearing in a @code{@@selector(@dots{})} -expression, and a corresponding method for that selector has been found -during compilation. Because these checks scan the method table only at -the end of compilation, these warnings are not produced if the final -stage of compilation is not reached, for example because an error is -found during compilation, or because the @option{-fsyntax-only} option is -being used. - -@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} -@opindex Wstrict-selector-match -@opindex Wno-strict-selector-match -Warn if multiple methods with differing argument and/or return types are -found for a given selector when attempting to send a message using this -selector to a receiver of type @code{id} or @code{Class}. When this flag -is off (which is the default behavior), the compiler omits such warnings -if any differences found are confined to types that share the same size -and alignment. - -@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} -@opindex Wundeclared-selector -@opindex Wno-undeclared-selector -Warn if a @code{@@selector(@dots{})} expression referring to an -undeclared selector is found. A selector is considered undeclared if no -method with that name has been declared before the -@code{@@selector(@dots{})} expression, either explicitly in an -@code{@@interface} or @code{@@protocol} declaration, or implicitly in -an @code{@@implementation} section. This option always performs its -checks as soon as a @code{@@selector(@dots{})} expression is found, -while @option{-Wselector} only performs its checks in the final stage of -compilation. This also enforces the coding style convention -that methods and selectors must be declared before being used. - -@item -print-objc-runtime-info -@opindex print-objc-runtime-info -Generate C header describing the largest structure that is passed by -value, if any. - -@end table - -@node Language Independent Options -@section Options to Control Diagnostic Messages Formatting -@cindex options to control diagnostics formatting -@cindex diagnostic messages -@cindex message formatting - -Traditionally, diagnostic messages have been formatted irrespective of -the output device's aspect (e.g.@: its width, @dots{}). You can use the -options described below -to control the formatting algorithm for diagnostic messages, -e.g.@: how many characters per line, how often source location -information should be reported. Note that some language front ends may not -honor these options. - -@table @gcctabopt -@item -fmessage-length=@var{n} -@opindex fmessage-length -Try to format error messages so that they fit on lines of about -@var{n} characters. If @var{n} is zero, then no line-wrapping is -done; each error message appears on a single line. This is the -default for all front ends. - -@item -fdiagnostics-show-location=once -@opindex fdiagnostics-show-location -Only meaningful in line-wrapping mode. Instructs the diagnostic messages -reporter to emit source location information @emph{once}; that is, in -case the message is too long to fit on a single physical line and has to -be wrapped, the source location won't be emitted (as prefix) again, -over and over, in subsequent continuation lines. This is the default -behavior. - -@item -fdiagnostics-show-location=every-line -Only meaningful in line-wrapping mode. Instructs the diagnostic -messages reporter to emit the same source location information (as -prefix) for physical lines that result from the process of breaking -a message which is too long to fit on a single line. - -@item -fdiagnostics-color[=@var{WHEN}] -@itemx -fno-diagnostics-color -@opindex fdiagnostics-color -@cindex highlight, color, colour -@vindex GCC_COLORS @r{environment variable} -Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, -or @samp{auto}. The default depends on how the compiler has been configured, -it can be any of the above @var{WHEN} options or also @samp{never} -if @env{GCC_COLORS} environment variable isn't present in the environment, -and @samp{auto} otherwise. -@samp{auto} means to use color only when the standard error is a terminal. -The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are -aliases for @option{-fdiagnostics-color=always} and -@option{-fdiagnostics-color=never}, respectively. - -The colors are defined by the environment variable @env{GCC_COLORS}. -Its value is a colon-separated list of capabilities and Select Graphic -Rendition (SGR) substrings. SGR commands are interpreted by the -terminal or terminal emulator. (See the section in the documentation -of your text terminal for permitted values and their meanings as -character attributes.) These substring values are integers in decimal -representation and can be concatenated with semicolons. -Common values to concatenate include -@samp{1} for bold, -@samp{4} for underline, -@samp{5} for blink, -@samp{7} for inverse, -@samp{39} for default foreground color, -@samp{30} to @samp{37} for foreground colors, -@samp{90} to @samp{97} for 16-color mode foreground colors, -@samp{38;5;0} to @samp{38;5;255} -for 88-color and 256-color modes foreground colors, -@samp{49} for default background color, -@samp{40} to @samp{47} for background colors, -@samp{100} to @samp{107} for 16-color mode background colors, -and @samp{48;5;0} to @samp{48;5;255} -for 88-color and 256-color modes background colors. - -The default @env{GCC_COLORS} is -@smallexample -error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01 -@end smallexample -@noindent -where @samp{01;31} is bold red, @samp{01;35} is bold magenta, -@samp{01;36} is bold cyan, @samp{01;32} is bold green and -@samp{01} is bold. Setting @env{GCC_COLORS} to the empty -string disables colors. -Supported capabilities are as follows. - -@table @code -@item error= -@vindex error GCC_COLORS @r{capability} -SGR substring for error: markers. - -@item warning= -@vindex warning GCC_COLORS @r{capability} -SGR substring for warning: markers. - -@item note= -@vindex note GCC_COLORS @r{capability} -SGR substring for note: markers. - -@item caret= -@vindex caret GCC_COLORS @r{capability} -SGR substring for caret line. - -@item locus= -@vindex locus GCC_COLORS @r{capability} -SGR substring for location information, @samp{file:line} or -@samp{file:line:column} etc. - -@item quote= -@vindex quote GCC_COLORS @r{capability} -SGR substring for information printed within quotes. -@end table - -@item -fno-diagnostics-show-option -@opindex fno-diagnostics-show-option -@opindex fdiagnostics-show-option -By default, each diagnostic emitted includes text indicating the -command-line option that directly controls the diagnostic (if such an -option is known to the diagnostic machinery). Specifying the -@option{-fno-diagnostics-show-option} flag suppresses that behavior. - -@item -fno-diagnostics-show-caret -@opindex fno-diagnostics-show-caret -@opindex fdiagnostics-show-caret -By default, each diagnostic emitted includes the original source line -and a caret '^' indicating the column. This option suppresses this -information. The source line is truncated to @var{n} characters, if -the @option{-fmessage-length=n} option is given. When the output is done -to the terminal, the width is limited to the width given by the -@env{COLUMNS} environment variable or, if not set, to the terminal width. - -@end table - -@node Warning Options -@section Options to Request or Suppress Warnings -@cindex options to control warnings -@cindex warning messages -@cindex messages, warning -@cindex suppressing warnings - -Warnings are diagnostic messages that report constructions that -are not inherently erroneous but that are risky or suggest there -may have been an error. - -The following language-independent options do not enable specific -warnings but control the kinds of diagnostics produced by GCC@. - -@table @gcctabopt -@cindex syntax checking -@item -fsyntax-only -@opindex fsyntax-only -Check the code for syntax errors, but don't do anything beyond that. - -@item -fmax-errors=@var{n} -@opindex fmax-errors -Limits the maximum number of error messages to @var{n}, at which point -GCC bails out rather than attempting to continue processing the source -code. If @var{n} is 0 (the default), there is no limit on the number -of error messages produced. If @option{-Wfatal-errors} is also -specified, then @option{-Wfatal-errors} takes precedence over this -option. - -@item -w -@opindex w -Inhibit all warning messages. - -@item -Werror -@opindex Werror -@opindex Wno-error -Make all warnings into errors. - -@item -Werror= -@opindex Werror= -@opindex Wno-error= -Make the specified warning into an error. The specifier for a warning -is appended; for example @option{-Werror=switch} turns the warnings -controlled by @option{-Wswitch} into errors. This switch takes a -negative form, to be used to negate @option{-Werror} for specific -warnings; for example @option{-Wno-error=switch} makes -@option{-Wswitch} warnings not be errors, even when @option{-Werror} -is in effect. - -The warning message for each controllable warning includes the -option that controls the warning. That option can then be used with -@option{-Werror=} and @option{-Wno-error=} as described above. -(Printing of the option in the warning message can be disabled using the -@option{-fno-diagnostics-show-option} flag.) - -Note that specifying @option{-Werror=}@var{foo} automatically implies -@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not -imply anything. - -@item -Wfatal-errors -@opindex Wfatal-errors -@opindex Wno-fatal-errors -This option causes the compiler to abort compilation on the first error -occurred rather than trying to keep going and printing further error -messages. - -@end table - -You can request many specific warnings with options beginning with -@samp{-W}, for example @option{-Wimplicit} to request warnings on -implicit declarations. Each of these specific warning options also -has a negative form beginning @samp{-Wno-} to turn off warnings; for -example, @option{-Wno-implicit}. This manual lists only one of the -two forms, whichever is not the default. For further -language-specific options also refer to @ref{C++ Dialect Options} and -@ref{Objective-C and Objective-C++ Dialect Options}. - -Some options, such as @option{-Wall} and @option{-Wextra}, turn on other -options, such as @option{-Wunused}, which may turn on further options, -such as @option{-Wunused-value}. The combined effect of positive and -negative forms is that more specific options have priority over less -specific ones, independently of their position in the command-line. For -options of the same specificity, the last one takes effect. Options -enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect -as if they appeared at the end of the command-line. - -When an unrecognized warning option is requested (e.g., -@option{-Wunknown-warning}), GCC emits a diagnostic stating -that the option is not recognized. However, if the @option{-Wno-} form -is used, the behavior is slightly different: no diagnostic is -produced for @option{-Wno-unknown-warning} unless other diagnostics -are being produced. This allows the use of new @option{-Wno-} options -with old compilers, but if something goes wrong, the compiler -warns that an unrecognized option is present. - -@table @gcctabopt -@item -Wpedantic -@itemx -pedantic -@opindex pedantic -@opindex Wpedantic -Issue all the warnings demanded by strict ISO C and ISO C++; -reject all programs that use forbidden extensions, and some other -programs that do not follow ISO C and ISO C++. For ISO C, follows the -version of the ISO C standard specified by any @option{-std} option used. - -Valid ISO C and ISO C++ programs should compile properly with or without -this option (though a rare few require @option{-ansi} or a -@option{-std} option specifying the required version of ISO C)@. However, -without this option, certain GNU extensions and traditional C and C++ -features are supported as well. With this option, they are rejected. - -@option{-Wpedantic} does not cause warning messages for use of the -alternate keywords whose names begin and end with @samp{__}. Pedantic -warnings are also disabled in the expression that follows -@code{__extension__}. However, only system header files should use -these escape routes; application programs should avoid them. -@xref{Alternate Keywords}. - -Some users try to use @option{-Wpedantic} to check programs for strict ISO -C conformance. They soon find that it does not do quite what they want: -it finds some non-ISO practices, but not all---only those for which -ISO C @emph{requires} a diagnostic, and some others for which -diagnostics have been added. - -A feature to report any failure to conform to ISO C might be useful in -some instances, but would require considerable additional work and would -be quite different from @option{-Wpedantic}. We don't have plans to -support such a feature in the near future. - -Where the standard specified with @option{-std} represents a GNU -extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a -corresponding @dfn{base standard}, the version of ISO C on which the GNU -extended dialect is based. Warnings from @option{-Wpedantic} are given -where they are required by the base standard. (It does not make sense -for such warnings to be given only for features not in the specified GNU -C dialect, since by definition the GNU dialects of C include all -features the compiler supports with the given option, and there would be -nothing to warn about.) - -@item -pedantic-errors -@opindex pedantic-errors -Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) -requires a diagnostic, in some cases where there is undefined behavior -at compile-time and in some other cases that do not prevent compilation -of programs that are valid according to the standard. This is not -equivalent to @option{-Werror=pedantic}, since there are errors enabled -by this option and not enabled by the latter and vice versa. - -@item -Wall -@opindex Wall -@opindex Wno-all -This enables all the warnings about constructions that some users -consider questionable, and that are easy to avoid (or modify to -prevent the warning), even in conjunction with macros. This also -enables some language-specific warnings described in @ref{C++ Dialect -Options} and @ref{Objective-C and Objective-C++ Dialect Options}. - -@option{-Wall} turns on the following warning flags: - -@gccoptlist{-Waddress @gol --Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol --Wc++11-compat -Wc++14-compat@gol --Wchar-subscripts @gol --Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol --Wimplicit-int @r{(C and Objective-C only)} @gol --Wimplicit-function-declaration @r{(C and Objective-C only)} @gol --Wcomment @gol --Wformat @gol --Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol --Wmaybe-uninitialized @gol --Wmissing-braces @r{(only for C/ObjC)} @gol --Wnonnull @gol --Wopenmp-simd @gol --Wparentheses @gol --Wpointer-sign @gol --Wreorder @gol --Wreturn-type @gol --Wsequence-point @gol --Wsign-compare @r{(only in C++)} @gol --Wstrict-aliasing @gol --Wstrict-overflow=1 @gol --Wswitch @gol --Wtrigraphs @gol --Wuninitialized @gol --Wunknown-pragmas @gol --Wunused-function @gol --Wunused-label @gol --Wunused-value @gol --Wunused-variable @gol --Wvolatile-register-var @gol -} - -Note that some warning flags are not implied by @option{-Wall}. Some of -them warn about constructions that users generally do not consider -questionable, but which occasionally you might wish to check for; -others warn about constructions that are necessary or hard to avoid in -some cases, and there is no simple way to modify the code to suppress -the warning. Some of them are enabled by @option{-Wextra} but many of -them must be enabled individually. - -@item -Wextra -@opindex W -@opindex Wextra -@opindex Wno-extra -This enables some extra warning flags that are not enabled by -@option{-Wall}. (This option used to be called @option{-W}. The older -name is still supported, but the newer name is more descriptive.) - -@gccoptlist{-Wclobbered @gol --Wempty-body @gol --Wignored-qualifiers @gol --Wmissing-field-initializers @gol --Wmissing-parameter-type @r{(C only)} @gol --Wold-style-declaration @r{(C only)} @gol --Woverride-init @gol --Wsign-compare @gol --Wtype-limits @gol --Wuninitialized @gol --Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol --Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol -} - -The option @option{-Wextra} also prints warning messages for the -following cases: - -@itemize @bullet - -@item -A pointer is compared against integer zero with @code{<}, @code{<=}, -@code{>}, or @code{>=}. - -@item -(C++ only) An enumerator and a non-enumerator both appear in a -conditional expression. - -@item -(C++ only) Ambiguous virtual bases. - -@item -(C++ only) Subscripting an array that has been declared @code{register}. - -@item -(C++ only) Taking the address of a variable that has been declared -@code{register}. - -@item -(C++ only) A base class is not initialized in a derived class's copy -constructor. - -@end itemize - -@item -Wchar-subscripts -@opindex Wchar-subscripts -@opindex Wno-char-subscripts -Warn if an array subscript has type @code{char}. This is a common cause -of error, as programmers often forget that this type is signed on some -machines. -This warning is enabled by @option{-Wall}. - -@item -Wcomment -@opindex Wcomment -@opindex Wno-comment -Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} -comment, or whenever a Backslash-Newline appears in a @samp{//} comment. -This warning is enabled by @option{-Wall}. - -@item -Wno-coverage-mismatch -@opindex Wno-coverage-mismatch -Warn if feedback profiles do not match when using the -@option{-fprofile-use} option. -If a source file is changed between compiling with @option{-fprofile-gen} and -with @option{-fprofile-use}, the files with the profile feedback can fail -to match the source file and GCC cannot use the profile feedback -information. By default, this warning is enabled and is treated as an -error. @option{-Wno-coverage-mismatch} can be used to disable the -warning or @option{-Wno-error=coverage-mismatch} can be used to -disable the error. Disabling the error for this warning can result in -poorly optimized code and is useful only in the -case of very minor changes such as bug fixes to an existing code-base. -Completely disabling the warning is not recommended. - -@item -Wno-cpp -@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} - -Suppress warning messages emitted by @code{#warning} directives. - -@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} -@opindex Wdouble-promotion -@opindex Wno-double-promotion -Give a warning when a value of type @code{float} is implicitly -promoted to @code{double}. CPUs with a 32-bit ``single-precision'' -floating-point unit implement @code{float} in hardware, but emulate -@code{double} in software. On such a machine, doing computations -using @code{double} values is much more expensive because of the -overhead required for software emulation. - -It is easy to accidentally do computations with @code{double} because -floating-point literals are implicitly of type @code{double}. For -example, in: -@smallexample -@group -float area(float radius) -@{ - return 3.14159 * radius * radius; -@} -@end group -@end smallexample -the compiler performs the entire computation with @code{double} -because the floating-point literal is a @code{double}. - -@item -Wformat -@itemx -Wformat=@var{n} -@opindex Wformat -@opindex Wno-format -@opindex ffreestanding -@opindex fno-builtin -@opindex Wformat= -Check calls to @code{printf} and @code{scanf}, etc., to make sure that -the arguments supplied have types appropriate to the format string -specified, and that the conversions specified in the format string make -sense. This includes standard functions, and others specified by format -attributes (@pxref{Function Attributes}), in the @code{printf}, -@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, -not in the C standard) families (or other target-specific families). -Which functions are checked without format attributes having been -specified depends on the standard version selected, and such checks of -functions without the attribute specified are disabled by -@option{-ffreestanding} or @option{-fno-builtin}. - -The formats are checked against the format features supported by GNU -libc version 2.2. These include all ISO C90 and C99 features, as well -as features from the Single Unix Specification and some BSD and GNU -extensions. Other library implementations may not support all these -features; GCC does not support warning about features that go beyond a -particular library's limitations. However, if @option{-Wpedantic} is used -with @option{-Wformat}, warnings are given about format features not -in the selected standard version (but not for @code{strfmon} formats, -since those are not in any version of the C standard). @xref{C Dialect -Options,,Options Controlling C Dialect}. - -@table @gcctabopt -@item -Wformat=1 -@itemx -Wformat -@opindex Wformat -@opindex Wformat=1 -Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and -@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since -@option{-Wformat} also checks for null format arguments for several -functions, @option{-Wformat} also implies @option{-Wnonnull}. Some -aspects of this level of format checking can be disabled by the -options: @option{-Wno-format-contains-nul}, -@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. -@option{-Wformat} is enabled by @option{-Wall}. - -@item -Wno-format-contains-nul -@opindex Wno-format-contains-nul -@opindex Wformat-contains-nul -If @option{-Wformat} is specified, do not warn about format strings that -contain NUL bytes. - -@item -Wno-format-extra-args -@opindex Wno-format-extra-args -@opindex Wformat-extra-args -If @option{-Wformat} is specified, do not warn about excess arguments to a -@code{printf} or @code{scanf} format function. The C standard specifies -that such arguments are ignored. - -Where the unused arguments lie between used arguments that are -specified with @samp{$} operand number specifications, normally -warnings are still given, since the implementation could not know what -type to pass to @code{va_arg} to skip the unused arguments. However, -in the case of @code{scanf} formats, this option suppresses the -warning if the unused arguments are all pointers, since the Single -Unix Specification says that such unused arguments are allowed. - -@item -Wno-format-zero-length -@opindex Wno-format-zero-length -@opindex Wformat-zero-length -If @option{-Wformat} is specified, do not warn about zero-length formats. -The C standard specifies that zero-length formats are allowed. - - -@item -Wformat=2 -@opindex Wformat=2 -Enable @option{-Wformat} plus additional format checks. Currently -equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security --Wformat-y2k}. - -@item -Wformat-nonliteral -@opindex Wformat-nonliteral -@opindex Wno-format-nonliteral -If @option{-Wformat} is specified, also warn if the format string is not a -string literal and so cannot be checked, unless the format function -takes its format arguments as a @code{va_list}. - -@item -Wformat-security -@opindex Wformat-security -@opindex Wno-format-security -If @option{-Wformat} is specified, also warn about uses of format -functions that represent possible security problems. At present, this -warns about calls to @code{printf} and @code{scanf} functions where the -format string is not a string literal and there are no format arguments, -as in @code{printf (foo);}. This may be a security hole if the format -string came from untrusted input and contains @samp{%n}. (This is -currently a subset of what @option{-Wformat-nonliteral} warns about, but -in future warnings may be added to @option{-Wformat-security} that are not -included in @option{-Wformat-nonliteral}.) - -@item -Wformat-signedness -@opindex Wformat-signedness -@opindex Wno-format-signedness -If @option{-Wformat} is specified, also warn if the format string -requires an unsigned argument and the argument is signed and vice versa. - -@item -Wformat-y2k -@opindex Wformat-y2k -@opindex Wno-format-y2k -If @option{-Wformat} is specified, also warn about @code{strftime} -formats that may yield only a two-digit year. -@end table - -@item -Wnonnull -@opindex Wnonnull -@opindex Wno-nonnull -Warn about passing a null pointer for arguments marked as -requiring a non-null value by the @code{nonnull} function attribute. - -@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It -can be disabled with the @option{-Wno-nonnull} option. - -@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} -@opindex Winit-self -@opindex Wno-init-self -Warn about uninitialized variables that are initialized with themselves. -Note this option can only be used with the @option{-Wuninitialized} option. - -For example, GCC warns about @code{i} being uninitialized in the -following snippet only when @option{-Winit-self} has been specified: -@smallexample -@group -int f() -@{ - int i = i; - return i; -@} -@end group -@end smallexample - -This warning is enabled by @option{-Wall} in C++. - -@item -Wimplicit-int @r{(C and Objective-C only)} -@opindex Wimplicit-int -@opindex Wno-implicit-int -Warn when a declaration does not specify a type. -This warning is enabled by @option{-Wall}. - -@item -Wimplicit-function-declaration @r{(C and Objective-C only)} -@opindex Wimplicit-function-declaration -@opindex Wno-implicit-function-declaration -Give a warning whenever a function is used before being declared. In -C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is -enabled by default and it is made into an error by -@option{-pedantic-errors}. This warning is also enabled by -@option{-Wall}. - -@item -Wimplicit @r{(C and Objective-C only)} -@opindex Wimplicit -@opindex Wno-implicit -Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. -This warning is enabled by @option{-Wall}. - -@item -Wignored-qualifiers @r{(C and C++ only)} -@opindex Wignored-qualifiers -@opindex Wno-ignored-qualifiers -Warn if the return type of a function has a type qualifier -such as @code{const}. For ISO C such a type qualifier has no effect, -since the value returned by a function is not an lvalue. -For C++, the warning is only emitted for scalar types or @code{void}. -ISO C prohibits qualified @code{void} return types on function -definitions, so such return types always receive a warning -even without this option. - -This warning is also enabled by @option{-Wextra}. - -@item -Wmain -@opindex Wmain -@opindex Wno-main -Warn if the type of @code{main} is suspicious. @code{main} should be -a function with external linkage, returning int, taking either zero -arguments, two, or three arguments of appropriate types. This warning -is enabled by default in C++ and is enabled by either @option{-Wall} -or @option{-Wpedantic}. - -@item -Wmissing-braces -@opindex Wmissing-braces -@opindex Wno-missing-braces -Warn if an aggregate or union initializer is not fully bracketed. In -the following example, the initializer for @code{a} is not fully -bracketed, but that for @code{b} is fully bracketed. This warning is -enabled by @option{-Wall} in C. - -@smallexample -int a[2][2] = @{ 0, 1, 2, 3 @}; -int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; -@end smallexample - -This warning is enabled by @option{-Wall}. - -@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} -@opindex Wmissing-include-dirs -@opindex Wno-missing-include-dirs -Warn if a user-supplied include directory does not exist. - -@item -Wparentheses -@opindex Wparentheses -@opindex Wno-parentheses -Warn if parentheses are omitted in certain contexts, such -as when there is an assignment in a context where a truth value -is expected, or when operators are nested whose precedence people -often get confused about. - -Also warn if a comparison like @code{x<=y<=z} appears; this is -equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different -interpretation from that of ordinary mathematical notation. - -Also warn about constructions where there may be confusion to which -@code{if} statement an @code{else} branch belongs. Here is an example of -such a case: - -@smallexample -@group -@{ - if (a) - if (b) - foo (); - else - bar (); -@} -@end group -@end smallexample - -In C/C++, every @code{else} branch belongs to the innermost possible -@code{if} statement, which in this example is @code{if (b)}. This is -often not what the programmer expected, as illustrated in the above -example by indentation the programmer chose. When there is the -potential for this confusion, GCC issues a warning when this flag -is specified. To eliminate the warning, add explicit braces around -the innermost @code{if} statement so there is no way the @code{else} -can belong to the enclosing @code{if}. The resulting code -looks like this: - -@smallexample -@group -@{ - if (a) - @{ - if (b) - foo (); - else - bar (); - @} -@} -@end group -@end smallexample - -Also warn for dangerous uses of the GNU extension to -@code{?:} with omitted middle operand. When the condition -in the @code{?}: operator is a boolean expression, the omitted value is -always 1. Often programmers expect it to be a value computed -inside the conditional expression instead. - -This warning is enabled by @option{-Wall}. - -@item -Wsequence-point -@opindex Wsequence-point -@opindex Wno-sequence-point -Warn about code that may have undefined semantics because of violations -of sequence point rules in the C and C++ standards. - -The C and C++ standards define the order in which expressions in a C/C++ -program are evaluated in terms of @dfn{sequence points}, which represent -a partial ordering between the execution of parts of the program: those -executed before the sequence point, and those executed after it. These -occur after the evaluation of a full expression (one which is not part -of a larger expression), after the evaluation of the first operand of a -@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a -function is called (but after the evaluation of its arguments and the -expression denoting the called function), and in certain other places. -Other than as expressed by the sequence point rules, the order of -evaluation of subexpressions of an expression is not specified. All -these rules describe only a partial order rather than a total order, -since, for example, if two functions are called within one expression -with no sequence point between them, the order in which the functions -are called is not specified. However, the standards committee have -ruled that function calls do not overlap. - -It is not specified when between sequence points modifications to the -values of objects take effect. Programs whose behavior depends on this -have undefined behavior; the C and C++ standards specify that ``Between -the previous and next sequence point an object shall have its stored -value modified at most once by the evaluation of an expression. -Furthermore, the prior value shall be read only to determine the value -to be stored.''. If a program breaks these rules, the results on any -particular implementation are entirely unpredictable. - -Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] -= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not -diagnosed by this option, and it may give an occasional false positive -result, but in general it has been found fairly effective at detecting -this sort of problem in programs. - -The standard is worded confusingly, therefore there is some debate -over the precise meaning of the sequence point rules in subtle cases. -Links to discussions of the problem, including proposed formal -definitions, may be found on the GCC readings page, at -@uref{http://gcc.gnu.org/@/readings.html}. - -This warning is enabled by @option{-Wall} for C and C++. - -@item -Wno-return-local-addr -@opindex Wno-return-local-addr -@opindex Wreturn-local-addr -Do not warn about returning a pointer (or in C++, a reference) to a -variable that goes out of scope after the function returns. - -@item -Wreturn-type -@opindex Wreturn-type -@opindex Wno-return-type -Warn whenever a function is defined with a return type that defaults -to @code{int}. Also warn about any @code{return} statement with no -return value in a function whose return type is not @code{void} -(falling off the end of the function body is considered returning -without a value), and about a @code{return} statement with an -expression in a function whose return type is @code{void}. - -For C++, a function without return type always produces a diagnostic -message, even when @option{-Wno-return-type} is specified. The only -exceptions are @code{main} and functions defined in system headers. - -This warning is enabled by @option{-Wall}. - -@item -Wshift-count-negative -@opindex Wshift-count-negative -@opindex Wno-shift-count-negative -Warn if shift count is negative. This warning is enabled by default. - -@item -Wshift-count-overflow -@opindex Wshift-count-overflow -@opindex Wno-shift-count-overflow -Warn if shift count >= width of type. This warning is enabled by default. - -@item -Wswitch -@opindex Wswitch -@opindex Wno-switch -Warn whenever a @code{switch} statement has an index of enumerated type -and lacks a @code{case} for one or more of the named codes of that -enumeration. (The presence of a @code{default} label prevents this -warning.) @code{case} labels outside the enumeration range also -provoke warnings when this option is used (even if there is a -@code{default} label). -This warning is enabled by @option{-Wall}. - -@item -Wswitch-default -@opindex Wswitch-default -@opindex Wno-switch-default -Warn whenever a @code{switch} statement does not have a @code{default} -case. - -@item -Wswitch-enum -@opindex Wswitch-enum -@opindex Wno-switch-enum -Warn whenever a @code{switch} statement has an index of enumerated type -and lacks a @code{case} for one or more of the named codes of that -enumeration. @code{case} labels outside the enumeration range also -provoke warnings when this option is used. The only difference -between @option{-Wswitch} and this option is that this option gives a -warning about an omitted enumeration code even if there is a -@code{default} label. - -@item -Wswitch-bool -@opindex Wswitch-bool -@opindex Wno-switch-bool -Warn whenever a @code{switch} statement has an index of boolean type. -It is possible to suppress this warning by casting the controlling -expression to a type other than @code{bool}. For example: -@smallexample -@group -switch ((int) (a == 4)) - @{ - @dots{} - @} -@end group -@end smallexample -This warning is enabled by default for C and C++ programs. - -@item -Wsync-nand @r{(C and C++ only)} -@opindex Wsync-nand -@opindex Wno-sync-nand -Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} -built-in functions are used. These functions changed semantics in GCC 4.4. - -@item -Wtrigraphs -@opindex Wtrigraphs -@opindex Wno-trigraphs -Warn if any trigraphs are encountered that might change the meaning of -the program (trigraphs within comments are not warned about). -This warning is enabled by @option{-Wall}. - -@item -Wunused-but-set-parameter -@opindex Wunused-but-set-parameter -@opindex Wno-unused-but-set-parameter -Warn whenever a function parameter is assigned to, but otherwise unused -(aside from its declaration). - -To suppress this warning use the @code{unused} attribute -(@pxref{Variable Attributes}). - -This warning is also enabled by @option{-Wunused} together with -@option{-Wextra}. - -@item -Wunused-but-set-variable -@opindex Wunused-but-set-variable -@opindex Wno-unused-but-set-variable -Warn whenever a local variable is assigned to, but otherwise unused -(aside from its declaration). -This warning is enabled by @option{-Wall}. - -To suppress this warning use the @code{unused} attribute -(@pxref{Variable Attributes}). - -This warning is also enabled by @option{-Wunused}, which is enabled -by @option{-Wall}. - -@item -Wunused-function -@opindex Wunused-function -@opindex Wno-unused-function -Warn whenever a static function is declared but not defined or a -non-inline static function is unused. -This warning is enabled by @option{-Wall}. - -@item -Wunused-label -@opindex Wunused-label -@opindex Wno-unused-label -Warn whenever a label is declared but not used. -This warning is enabled by @option{-Wall}. - -To suppress this warning use the @code{unused} attribute -(@pxref{Variable Attributes}). - -@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} -@opindex Wunused-local-typedefs -Warn when a typedef locally defined in a function is not used. -This warning is enabled by @option{-Wall}. - -@item -Wunused-parameter -@opindex Wunused-parameter -@opindex Wno-unused-parameter -Warn whenever a function parameter is unused aside from its declaration. - -To suppress this warning use the @code{unused} attribute -(@pxref{Variable Attributes}). - -@item -Wno-unused-result -@opindex Wunused-result -@opindex Wno-unused-result -Do not warn if a caller of a function marked with attribute -@code{warn_unused_result} (@pxref{Function Attributes}) does not use -its return value. The default is @option{-Wunused-result}. - -@item -Wunused-variable -@opindex Wunused-variable -@opindex Wno-unused-variable -Warn whenever a local variable or non-constant static variable is unused -aside from its declaration. -This warning is enabled by @option{-Wall}. - -To suppress this warning use the @code{unused} attribute -(@pxref{Variable Attributes}). - -@item -Wunused-value -@opindex Wunused-value -@opindex Wno-unused-value -Warn whenever a statement computes a result that is explicitly not -used. To suppress this warning cast the unused expression to -@code{void}. This includes an expression-statement or the left-hand -side of a comma expression that contains no side effects. For example, -an expression such as @code{x[i,j]} causes a warning, while -@code{x[(void)i,j]} does not. - -This warning is enabled by @option{-Wall}. - -@item -Wunused -@opindex Wunused -@opindex Wno-unused -All the above @option{-Wunused} options combined. - -In order to get a warning about an unused function parameter, you must -either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies -@option{-Wunused}), or separately specify @option{-Wunused-parameter}. - -@item -Wuninitialized -@opindex Wuninitialized -@opindex Wno-uninitialized -Warn if an automatic variable is used without first being initialized -or if a variable may be clobbered by a @code{setjmp} call. In C++, -warn if a non-static reference or non-static @code{const} member -appears in a class without constructors. - -If you want to warn about code that uses the uninitialized value of the -variable in its own initializer, use the @option{-Winit-self} option. - -These warnings occur for individual uninitialized or clobbered -elements of structure, union or array variables as well as for -variables that are uninitialized or clobbered as a whole. They do -not occur for variables or elements declared @code{volatile}. Because -these warnings depend on optimization, the exact variables or elements -for which there are warnings depends on the precise optimization -options and version of GCC used. - -Note that there may be no warning about a variable that is used only -to compute a value that itself is never used, because such -computations may be deleted by data flow analysis before the warnings -are printed. - -@item -Wmaybe-uninitialized -@opindex Wmaybe-uninitialized -@opindex Wno-maybe-uninitialized -For an automatic variable, if there exists a path from the function -entry to a use of the variable that is initialized, but there exist -some other paths for which the variable is not initialized, the compiler -emits a warning if it cannot prove the uninitialized paths are not -executed at run time. These warnings are made optional because GCC is -not smart enough to see all the reasons why the code might be correct -in spite of appearing to have an error. Here is one example of how -this can happen: - -@smallexample -@group -@{ - int x; - switch (y) - @{ - case 1: x = 1; - break; - case 2: x = 4; - break; - case 3: x = 5; - @} - foo (x); -@} -@end group -@end smallexample - -@noindent -If the value of @code{y} is always 1, 2 or 3, then @code{x} is -always initialized, but GCC doesn't know this. To suppress the -warning, you need to provide a default case with assert(0) or -similar code. - -@cindex @code{longjmp} warnings -This option also warns when a non-volatile automatic variable might be -changed by a call to @code{longjmp}. These warnings as well are possible -only in optimizing compilation. - -The compiler sees only the calls to @code{setjmp}. It cannot know -where @code{longjmp} will be called; in fact, a signal handler could -call it at any point in the code. As a result, you may get a warning -even when there is in fact no problem because @code{longjmp} cannot -in fact be called at the place that would cause a problem. - -Some spurious warnings can be avoided if you declare all the functions -you use that never return as @code{noreturn}. @xref{Function -Attributes}. - -This warning is enabled by @option{-Wall} or @option{-Wextra}. - -@item -Wunknown-pragmas -@opindex Wunknown-pragmas -@opindex Wno-unknown-pragmas -@cindex warning for unknown pragmas -@cindex unknown pragmas, warning -@cindex pragmas, warning of unknown -Warn when a @code{#pragma} directive is encountered that is not understood by -GCC@. If this command-line option is used, warnings are even issued -for unknown pragmas in system header files. This is not the case if -the warnings are only enabled by the @option{-Wall} command-line option. - -@item -Wno-pragmas -@opindex Wno-pragmas -@opindex Wpragmas -Do not warn about misuses of pragmas, such as incorrect parameters, -invalid syntax, or conflicts between pragmas. See also -@option{-Wunknown-pragmas}. - -@item -Wstrict-aliasing -@opindex Wstrict-aliasing -@opindex Wno-strict-aliasing -This option is only active when @option{-fstrict-aliasing} is active. -It warns about code that might break the strict aliasing rules that the -compiler is using for optimization. The warning does not catch all -cases, but does attempt to catch the more common pitfalls. It is -included in @option{-Wall}. -It is equivalent to @option{-Wstrict-aliasing=3} - -@item -Wstrict-aliasing=n -@opindex Wstrict-aliasing=n -This option is only active when @option{-fstrict-aliasing} is active. -It warns about code that might break the strict aliasing rules that the -compiler is using for optimization. -Higher levels correspond to higher accuracy (fewer false positives). -Higher levels also correspond to more effort, similar to the way @option{-O} -works. -@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. - -Level 1: Most aggressive, quick, least accurate. -Possibly useful when higher levels -do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few -false negatives. However, it has many false positives. -Warns for all pointer conversions between possibly incompatible types, -even if never dereferenced. Runs in the front end only. - -Level 2: Aggressive, quick, not too precise. -May still have many false positives (not as many as level 1 though), -and few false negatives (but possibly more than level 1). -Unlike level 1, it only warns when an address is taken. Warns about -incomplete types. Runs in the front end only. - -Level 3 (default for @option{-Wstrict-aliasing}): -Should have very few false positives and few false -negatives. Slightly slower than levels 1 or 2 when optimization is enabled. -Takes care of the common pun+dereference pattern in the front end: -@code{*(int*)&some_float}. -If optimization is enabled, it also runs in the back end, where it deals -with multiple statement cases using flow-sensitive points-to information. -Only warns when the converted pointer is dereferenced. -Does not warn about incomplete types. - -@item -Wstrict-overflow -@itemx -Wstrict-overflow=@var{n} -@opindex Wstrict-overflow -@opindex Wno-strict-overflow -This option is only active when @option{-fstrict-overflow} is active. -It warns about cases where the compiler optimizes based on the -assumption that signed overflow does not occur. Note that it does not -warn about all cases where the code might overflow: it only warns -about cases where the compiler implements some optimization. Thus -this warning depends on the optimization level. - -An optimization that assumes that signed overflow does not occur is -perfectly safe if the values of the variables involved are such that -overflow never does, in fact, occur. Therefore this warning can -easily give a false positive: a warning about code that is not -actually a problem. To help focus on important issues, several -warning levels are defined. No warnings are issued for the use of -undefined signed overflow when estimating how many iterations a loop -requires, in particular when determining whether a loop will be -executed at all. - -@table @gcctabopt -@item -Wstrict-overflow=1 -Warn about cases that are both questionable and easy to avoid. For -example, with @option{-fstrict-overflow}, the compiler simplifies -@code{x + 1 > x} to @code{1}. This level of -@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels -are not, and must be explicitly requested. - -@item -Wstrict-overflow=2 -Also warn about other cases where a comparison is simplified to a -constant. For example: @code{abs (x) >= 0}. This can only be -simplified when @option{-fstrict-overflow} is in effect, because -@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than -zero. @option{-Wstrict-overflow} (with no level) is the same as -@option{-Wstrict-overflow=2}. - -@item -Wstrict-overflow=3 -Also warn about other cases where a comparison is simplified. For -example: @code{x + 1 > 1} is simplified to @code{x > 0}. - -@item -Wstrict-overflow=4 -Also warn about other simplifications not covered by the above cases. -For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. - -@item -Wstrict-overflow=5 -Also warn about cases where the compiler reduces the magnitude of a -constant involved in a comparison. For example: @code{x + 2 > y} is -simplified to @code{x + 1 >= y}. This is reported only at the -highest warning level because this simplification applies to many -comparisons, so this warning level gives a very large number of -false positives. -@end table - -@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} -@opindex Wsuggest-attribute= -@opindex Wno-suggest-attribute= -Warn for cases where adding an attribute may be beneficial. The -attributes currently supported are listed below. - -@table @gcctabopt -@item -Wsuggest-attribute=pure -@itemx -Wsuggest-attribute=const -@itemx -Wsuggest-attribute=noreturn -@opindex Wsuggest-attribute=pure -@opindex Wno-suggest-attribute=pure -@opindex Wsuggest-attribute=const -@opindex Wno-suggest-attribute=const -@opindex Wsuggest-attribute=noreturn -@opindex Wno-suggest-attribute=noreturn - -Warn about functions that might be candidates for attributes -@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for -functions visible in other compilation units or (in the case of @code{pure} and -@code{const}) if it cannot prove that the function returns normally. A function -returns normally if it doesn't contain an infinite loop or return abnormally -by throwing, calling @code{abort} or trapping. This analysis requires option -@option{-fipa-pure-const}, which is enabled by default at @option{-O} and -higher. Higher optimization levels improve the accuracy of the analysis. - -@item -Wsuggest-attribute=format -@itemx -Wmissing-format-attribute -@opindex Wsuggest-attribute=format -@opindex Wmissing-format-attribute -@opindex Wno-suggest-attribute=format -@opindex Wno-missing-format-attribute -@opindex Wformat -@opindex Wno-format - -Warn about function pointers that might be candidates for @code{format} -attributes. Note these are only possible candidates, not absolute ones. -GCC guesses that function pointers with @code{format} attributes that -are used in assignment, initialization, parameter passing or return -statements should have a corresponding @code{format} attribute in the -resulting type. I.e.@: the left-hand side of the assignment or -initialization, the type of the parameter variable, or the return type -of the containing function respectively should also have a @code{format} -attribute to avoid the warning. - -GCC also warns about function definitions that might be -candidates for @code{format} attributes. Again, these are only -possible candidates. GCC guesses that @code{format} attributes -might be appropriate for any function that calls a function like -@code{vprintf} or @code{vscanf}, but this might not always be the -case, and some functions for which @code{format} attributes are -appropriate may not be detected. -@end table - -@item -Wsuggest-final-types -@opindex Wno-suggest-final-types -@opindex Wsuggest-final-types -Warn about types with virtual methods where code quality would be improved -if the type were declared with the C++11 @code{final} specifier, -or, if possible, -declared in an anonymous namespace. This allows GCC to more aggressively -devirtualize the polymorphic calls. This warning is more effective with link -time optimization, where the information about the class hierarchy graph is -more complete. - -@item -Wsuggest-final-methods -@opindex Wno-suggest-final-methods -@opindex Wsuggest-final-methods -Warn about virtual methods where code quality would be improved if the method -were declared with the C++11 @code{final} specifier, -or, if possible, its type were -declared in an anonymous namespace or with the @code{final} specifier. -This warning is -more effective with link time optimization, where the information about the -class hierarchy graph is more complete. It is recommended to first consider -suggestions of @option{-Wsuggest-final-types} and then rebuild with new -annotations. - -@item -Wsuggest-override -Warn about overriding virtual functions that are not marked with the override -keyword. - -@item -Warray-bounds -@itemx -Warray-bounds=@var{n} -@opindex Wno-array-bounds -@opindex Warray-bounds -This option is only active when @option{-ftree-vrp} is active -(default for @option{-O2} and above). It warns about subscripts to arrays -that are always out of bounds. This warning is enabled by @option{-Wall}. - -@table @gcctabopt -@item -Warray-bounds=1 -This is the warning level of @option{-Warray-bounds} and is enabled -by @option{-Wall}; higher levels are not, and must be explicitly requested. - -@item -Warray-bounds=2 -This warning level also warns about out of bounds access for -arrays at the end of a struct and for arrays accessed through -pointers. This warning level may give a larger number of -false positives and is deactivated by default. -@end table - - -@item -Wbool-compare -@opindex Wno-bool-compare -@opindex Wbool-compare -Warn about boolean expression compared with an integer value different from -@code{true}/@code{false}. For instance, the following comparison is -always false: -@smallexample -int n = 5; -@dots{} -if ((n > 1) == 2) @{ @dots{} @} -@end smallexample -This warning is enabled by @option{-Wall}. - -@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} -@opindex Wno-discarded-qualifiers -@opindex Wdiscarded-qualifiers -Do not warn if type qualifiers on pointers are being discarded. -Typically, the compiler warns if a @code{const char *} variable is -passed to a function that takes a @code{char *} parameter. This option -can be used to suppress such a warning. - -@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} -@opindex Wno-discarded-array-qualifiers -@opindex Wdiscarded-array-qualifiers -Do not warn if type qualifiers on arrays which are pointer targets -are being discarded. Typically, the compiler warns if a -@code{const int (*)[]} variable is passed to a function that -takes a @code{int (*)[]} parameter. This option can be used to -suppress such a warning. - -@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} -@opindex Wno-incompatible-pointer-types -@opindex Wincompatible-pointer-types -Do not warn when there is a conversion between pointers that have incompatible -types. This warning is for cases not covered by @option{-Wno-pointer-sign}, -which warns for pointer argument passing or assignment with different -signedness. - -@item -Wno-int-conversion @r{(C and Objective-C only)} -@opindex Wno-int-conversion -@opindex Wint-conversion -Do not warn about incompatible integer to pointer and pointer to integer -conversions. This warning is about implicit conversions; for explicit -conversions the warnings @option{-Wno-int-to-pointer-cast} and -@option{-Wno-pointer-to-int-cast} may be used. - -@item -Wno-div-by-zero -@opindex Wno-div-by-zero -@opindex Wdiv-by-zero -Do not warn about compile-time integer division by zero. Floating-point -division by zero is not warned about, as it can be a legitimate way of -obtaining infinities and NaNs. - -@item -Wsystem-headers -@opindex Wsystem-headers -@opindex Wno-system-headers -@cindex warnings from system headers -@cindex system headers, warnings from -Print warning messages for constructs found in system header files. -Warnings from system headers are normally suppressed, on the assumption -that they usually do not indicate real problems and would only make the -compiler output harder to read. Using this command-line option tells -GCC to emit warnings from system headers as if they occurred in user -code. However, note that using @option{-Wall} in conjunction with this -option does @emph{not} warn about unknown pragmas in system -headers---for that, @option{-Wunknown-pragmas} must also be used. - -@item -Wtrampolines -@opindex Wtrampolines -@opindex Wno-trampolines -Warn about trampolines generated for pointers to nested functions. -A trampoline is a small piece of data or code that is created at run -time on the stack when the address of a nested function is taken, and is -used to call the nested function indirectly. For some targets, it is -made up of data only and thus requires no special treatment. But, for -most targets, it is made up of code and thus requires the stack to be -made executable in order for the program to work properly. - -@item -Wfloat-equal -@opindex Wfloat-equal -@opindex Wno-float-equal -Warn if floating-point values are used in equality comparisons. - -The idea behind this is that sometimes it is convenient (for the -programmer) to consider floating-point values as approximations to -infinitely precise real numbers. If you are doing this, then you need -to compute (by analyzing the code, or in some other way) the maximum or -likely maximum error that the computation introduces, and allow for it -when performing comparisons (and when producing output, but that's a -different problem). In particular, instead of testing for equality, you -should check to see whether the two values have ranges that overlap; and -this is done with the relational operators, so equality comparisons are -probably mistaken. - -@item -Wtraditional @r{(C and Objective-C only)} -@opindex Wtraditional -@opindex Wno-traditional -Warn about certain constructs that behave differently in traditional and -ISO C@. Also warn about ISO C constructs that have no traditional C -equivalent, and/or problematic constructs that should be avoided. - -@itemize @bullet -@item -Macro parameters that appear within string literals in the macro body. -In traditional C macro replacement takes place within string literals, -but in ISO C it does not. - -@item -In traditional C, some preprocessor directives did not exist. -Traditional preprocessors only considered a line to be a directive -if the @samp{#} appeared in column 1 on the line. Therefore -@option{-Wtraditional} warns about directives that traditional C -understands but ignores because the @samp{#} does not appear as the -first character on the line. It also suggests you hide directives like -@code{#pragma} not understood by traditional C by indenting them. Some -traditional implementations do not recognize @code{#elif}, so this option -suggests avoiding it altogether. - -@item -A function-like macro that appears without arguments. - -@item -The unary plus operator. - -@item -The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point -constant suffixes. (Traditional C does support the @samp{L} suffix on integer -constants.) Note, these suffixes appear in macros defined in the system -headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{}. -Use of these macros in user code might normally lead to spurious -warnings, however GCC's integrated preprocessor has enough context to -avoid warning in these cases. - -@item -A function declared external in one block and then used after the end of -the block. - -@item -A @code{switch} statement has an operand of type @code{long}. - -@item -A non-@code{static} function declaration follows a @code{static} one. -This construct is not accepted by some traditional C compilers. - -@item -The ISO type of an integer constant has a different width or -signedness from its traditional type. This warning is only issued if -the base of the constant is ten. I.e.@: hexadecimal or octal values, which -typically represent bit patterns, are not warned about. - -@item -Usage of ISO string concatenation is detected. - -@item -Initialization of automatic aggregates. - -@item -Identifier conflicts with labels. Traditional C lacks a separate -namespace for labels. - -@item -Initialization of unions. If the initializer is zero, the warning is -omitted. This is done under the assumption that the zero initializer in -user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing -initializer warnings and relies on default initialization to zero in the -traditional C case. - -@item -Conversions by prototypes between fixed/floating-point values and vice -versa. The absence of these prototypes when compiling with traditional -C causes serious problems. This is a subset of the possible -conversion warnings; for the full set use @option{-Wtraditional-conversion}. - -@item -Use of ISO C style function definitions. This warning intentionally is -@emph{not} issued for prototype declarations or variadic functions -because these ISO C features appear in your code when using -libiberty's traditional C compatibility macros, @code{PARAMS} and -@code{VPARAMS}. This warning is also bypassed for nested functions -because that feature is already a GCC extension and thus not relevant to -traditional C compatibility. -@end itemize - -@item -Wtraditional-conversion @r{(C and Objective-C only)} -@opindex Wtraditional-conversion -@opindex Wno-traditional-conversion -Warn if a prototype causes a type conversion that is different from what -would happen to the same argument in the absence of a prototype. This -includes conversions of fixed point to floating and vice versa, and -conversions changing the width or signedness of a fixed-point argument -except when the same as the default promotion. - -@item -Wdeclaration-after-statement @r{(C and Objective-C only)} -@opindex Wdeclaration-after-statement -@opindex Wno-declaration-after-statement -Warn when a declaration is found after a statement in a block. This -construct, known from C++, was introduced with ISO C99 and is by default -allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. - -@item -Wundef -@opindex Wundef -@opindex Wno-undef -Warn if an undefined identifier is evaluated in an @code{#if} directive. - -@item -Wno-endif-labels -@opindex Wno-endif-labels -@opindex Wendif-labels -Do not warn whenever an @code{#else} or an @code{#endif} are followed by text. - -@item -Wshadow -@opindex Wshadow -@opindex Wno-shadow -Warn whenever a local variable or type declaration shadows another -variable, parameter, type, class member (in C++), or instance variable -(in Objective-C) or whenever a built-in function is shadowed. Note -that in C++, the compiler warns if a local variable shadows an -explicit typedef, but not if it shadows a struct/class/enum. - -@item -Wno-shadow-ivar @r{(Objective-C only)} -@opindex Wno-shadow-ivar -@opindex Wshadow-ivar -Do not warn whenever a local variable shadows an instance variable in an -Objective-C method. - -@item -Wlarger-than=@var{len} -@opindex Wlarger-than=@var{len} -@opindex Wlarger-than-@var{len} -Warn whenever an object of larger than @var{len} bytes is defined. - -@item -Wframe-larger-than=@var{len} -@opindex Wframe-larger-than -Warn if the size of a function frame is larger than @var{len} bytes. -The computation done to determine the stack frame size is approximate -and not conservative. -The actual requirements may be somewhat greater than @var{len} -even if you do not get a warning. In addition, any space allocated -via @code{alloca}, variable-length arrays, or related constructs -is not included by the compiler when determining -whether or not to issue a warning. - -@item -Wno-free-nonheap-object -@opindex Wno-free-nonheap-object -@opindex Wfree-nonheap-object -Do not warn when attempting to free an object that was not allocated -on the heap. - -@item -Wstack-usage=@var{len} -@opindex Wstack-usage -Warn if the stack usage of a function might be larger than @var{len} bytes. -The computation done to determine the stack usage is conservative. -Any space allocated via @code{alloca}, variable-length arrays, or related -constructs is included by the compiler when determining whether or not to -issue a warning. - -The message is in keeping with the output of @option{-fstack-usage}. - -@itemize -@item -If the stack usage is fully static but exceeds the specified amount, it's: - -@smallexample - warning: stack usage is 1120 bytes -@end smallexample -@item -If the stack usage is (partly) dynamic but bounded, it's: - -@smallexample - warning: stack usage might be 1648 bytes -@end smallexample -@item -If the stack usage is (partly) dynamic and not bounded, it's: - -@smallexample - warning: stack usage might be unbounded -@end smallexample -@end itemize - -@item -Wunsafe-loop-optimizations -@opindex Wunsafe-loop-optimizations -@opindex Wno-unsafe-loop-optimizations -Warn if the loop cannot be optimized because the compiler cannot -assume anything on the bounds of the loop indices. With -@option{-funsafe-loop-optimizations} warn if the compiler makes -such assumptions. - -@item -Wno-pedantic-ms-format @r{(MinGW targets only)} -@opindex Wno-pedantic-ms-format -@opindex Wpedantic-ms-format -When used in combination with @option{-Wformat} -and @option{-pedantic} without GNU extensions, this option -disables the warnings about non-ISO @code{printf} / @code{scanf} format -width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, -which depend on the MS runtime. - -@item -Wpointer-arith -@opindex Wpointer-arith -@opindex Wno-pointer-arith -Warn about anything that depends on the ``size of'' a function type or -of @code{void}. GNU C assigns these types a size of 1, for -convenience in calculations with @code{void *} pointers and pointers -to functions. In C++, warn also when an arithmetic operation involves -@code{NULL}. This warning is also enabled by @option{-Wpedantic}. - -@item -Wtype-limits -@opindex Wtype-limits -@opindex Wno-type-limits -Warn if a comparison is always true or always false due to the limited -range of the data type, but do not warn for constant expressions. For -example, warn if an unsigned variable is compared against zero with -@code{<} or @code{>=}. This warning is also enabled by -@option{-Wextra}. - -@item -Wbad-function-cast @r{(C and Objective-C only)} -@opindex Wbad-function-cast -@opindex Wno-bad-function-cast -Warn when a function call is cast to a non-matching type. -For example, warn if a call to a function returning an integer type -is cast to a pointer type. - -@item -Wc90-c99-compat @r{(C and Objective-C only)} -@opindex Wc90-c99-compat -@opindex Wno-c90-c99-compat -Warn about features not present in ISO C90, but present in ISO C99. -For instance, warn about use of variable length arrays, @code{long long} -type, @code{bool} type, compound literals, designated initializers, and so -on. This option is independent of the standards mode. Warnings are disabled -in the expression that follows @code{__extension__}. - -@item -Wc99-c11-compat @r{(C and Objective-C only)} -@opindex Wc99-c11-compat -@opindex Wno-c99-c11-compat -Warn about features not present in ISO C99, but present in ISO C11. -For instance, warn about use of anonymous structures and unions, -@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, -@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, -and so on. This option is independent of the standards mode. Warnings are -disabled in the expression that follows @code{__extension__}. - -@item -Wc++-compat @r{(C and Objective-C only)} -@opindex Wc++-compat -Warn about ISO C constructs that are outside of the common subset of -ISO C and ISO C++, e.g.@: request for implicit conversion from -@code{void *} to a pointer to non-@code{void} type. - -@item -Wc++11-compat @r{(C++ and Objective-C++ only)} -@opindex Wc++11-compat -Warn about C++ constructs whose meaning differs between ISO C++ 1998 -and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords -in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is -enabled by @option{-Wall}. - -@item -Wc++14-compat @r{(C++ and Objective-C++ only)} -@opindex Wc++14-compat -Warn about C++ constructs whose meaning differs between ISO C++ 2011 -and ISO C++ 2014. This warning is enabled by @option{-Wall}. - -@item -Wcast-qual -@opindex Wcast-qual -@opindex Wno-cast-qual -Warn whenever a pointer is cast so as to remove a type qualifier from -the target type. For example, warn if a @code{const char *} is cast -to an ordinary @code{char *}. - -Also warn when making a cast that introduces a type qualifier in an -unsafe way. For example, casting @code{char **} to @code{const char **} -is unsafe, as in this example: - -@smallexample - /* p is char ** value. */ - const char **q = (const char **) p; - /* Assignment of readonly string to const char * is OK. */ - *q = "string"; - /* Now char** pointer points to read-only memory. */ - **p = 'b'; -@end smallexample - -@item -Wcast-align -@opindex Wcast-align -@opindex Wno-cast-align -Warn whenever a pointer is cast such that the required alignment of the -target is increased. For example, warn if a @code{char *} is cast to -an @code{int *} on machines where integers can only be accessed at -two- or four-byte boundaries. - -@item -Wwrite-strings -@opindex Wwrite-strings -@opindex Wno-write-strings -When compiling C, give string constants the type @code{const -char[@var{length}]} so that copying the address of one into a -non-@code{const} @code{char *} pointer produces a warning. These -warnings help you find at compile time code that can try to write -into a string constant, but only if you have been very careful about -using @code{const} in declarations and prototypes. Otherwise, it is -just a nuisance. This is why we did not make @option{-Wall} request -these warnings. - -When compiling C++, warn about the deprecated conversion from string -literals to @code{char *}. This warning is enabled by default for C++ -programs. - -@item -Wclobbered -@opindex Wclobbered -@opindex Wno-clobbered -Warn for variables that might be changed by @code{longjmp} or -@code{vfork}. This warning is also enabled by @option{-Wextra}. - -@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} -@opindex Wconditionally-supported -@opindex Wno-conditionally-supported -Warn for conditionally-supported (C++11 [intro.defs]) constructs. - -@item -Wconversion -@opindex Wconversion -@opindex Wno-conversion -Warn for implicit conversions that may alter a value. This includes -conversions between real and integer, like @code{abs (x)} when -@code{x} is @code{double}; conversions between signed and unsigned, -like @code{unsigned ui = -1}; and conversions to smaller types, like -@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs -((int) x)} and @code{ui = (unsigned) -1}, or if the value is not -changed by the conversion like in @code{abs (2.0)}. Warnings about -conversions between signed and unsigned integers can be disabled by -using @option{-Wno-sign-conversion}. - -For C++, also warn for confusing overload resolution for user-defined -conversions; and conversions that never use a type conversion -operator: conversions to @code{void}, the same type, a base class or a -reference to them. Warnings about conversions between signed and -unsigned integers are disabled by default in C++ unless -@option{-Wsign-conversion} is explicitly enabled. - -@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} -@opindex Wconversion-null -@opindex Wno-conversion-null -Do not warn for conversions between @code{NULL} and non-pointer -types. @option{-Wconversion-null} is enabled by default. - -@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} -@opindex Wzero-as-null-pointer-constant -@opindex Wno-zero-as-null-pointer-constant -Warn when a literal '0' is used as null pointer constant. This can -be useful to facilitate the conversion to @code{nullptr} in C++11. - -@item -Wdate-time -@opindex Wdate-time -@opindex Wno-date-time -Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} -are encountered as they might prevent bit-wise-identical reproducible -compilations. - -@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} -@opindex Wdelete-incomplete -@opindex Wno-delete-incomplete -Warn when deleting a pointer to incomplete type, which may cause -undefined behavior at runtime. This warning is enabled by default. - -@item -Wuseless-cast @r{(C++ and Objective-C++ only)} -@opindex Wuseless-cast -@opindex Wno-useless-cast -Warn when an expression is casted to its own type. - -@item -Wempty-body -@opindex Wempty-body -@opindex Wno-empty-body -Warn if an empty body occurs in an @code{if}, @code{else} or @code{do -while} statement. This warning is also enabled by @option{-Wextra}. - -@item -Wenum-compare -@opindex Wenum-compare -@opindex Wno-enum-compare -Warn about a comparison between values of different enumerated types. -In C++ enumeral mismatches in conditional expressions are also -diagnosed and the warning is enabled by default. In C this warning is -enabled by @option{-Wall}. - -@item -Wjump-misses-init @r{(C, Objective-C only)} -@opindex Wjump-misses-init -@opindex Wno-jump-misses-init -Warn if a @code{goto} statement or a @code{switch} statement jumps -forward across the initialization of a variable, or jumps backward to a -label after the variable has been initialized. This only warns about -variables that are initialized when they are declared. This warning is -only supported for C and Objective-C; in C++ this sort of branch is an -error in any case. - -@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It -can be disabled with the @option{-Wno-jump-misses-init} option. - -@item -Wsign-compare -@opindex Wsign-compare -@opindex Wno-sign-compare -@cindex warning for comparison of signed and unsigned values -@cindex comparison of signed and unsigned values, warning -@cindex signed and unsigned values, comparison warning -Warn when a comparison between signed and unsigned values could produce -an incorrect result when the signed value is converted to unsigned. -This warning is also enabled by @option{-Wextra}; to get the other warnings -of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}. - -@item -Wsign-conversion -@opindex Wsign-conversion -@opindex Wno-sign-conversion -Warn for implicit conversions that may change the sign of an integer -value, like assigning a signed integer expression to an unsigned -integer variable. An explicit cast silences the warning. In C, this -option is enabled also by @option{-Wconversion}. - -@item -Wfloat-conversion -@opindex Wfloat-conversion -@opindex Wno-float-conversion -Warn for implicit conversions that reduce the precision of a real value. -This includes conversions from real to integer, and from higher precision -real to lower precision real values. This option is also enabled by -@option{-Wconversion}. - -@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} -@opindex Wsized-deallocation -@opindex Wno-sized-deallocation -Warn about a definition of an unsized deallocation function -@smallexample -void operator delete (void *) noexcept; -void operator delete[] (void *) noexcept; -@end smallexample -without a definition of the corresponding sized deallocation function -@smallexample -void operator delete (void *, std::size_t) noexcept; -void operator delete[] (void *, std::size_t) noexcept; -@end smallexample -or vice versa. Enabled by @option{-Wextra} along with -@option{-fsized-deallocation}. - -@item -Wsizeof-pointer-memaccess -@opindex Wsizeof-pointer-memaccess -@opindex Wno-sizeof-pointer-memaccess -Warn for suspicious length parameters to certain string and memory built-in -functions if the argument uses @code{sizeof}. This warning warns e.g.@: -about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array, -but a pointer, and suggests a possible fix, or about -@code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by -@option{-Wall}. - -@item -Wsizeof-array-argument -@opindex Wsizeof-array-argument -@opindex Wno-sizeof-array-argument -Warn when the @code{sizeof} operator is applied to a parameter that is -declared as an array in a function definition. This warning is enabled by -default for C and C++ programs. - -@item -Wmemset-transposed-args -@opindex Wmemset-transposed-args -@opindex Wno-memset-transposed-args -Warn for suspicious calls to the @code{memset} built-in function, if the -second argument is not zero and the third argument is zero. This warns e.g.@ -about @code{memset (buf, sizeof buf, 0)} where most probably -@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics -is only emitted if the third argument is literal zero, if it is some expression -that is folded to zero, or e.g. a cast of zero to some type etc., it -is far less likely that user has mistakenly exchanged the arguments and -no warning is emitted. This warning is enabled by @option{-Wall}. - -@item -Waddress -@opindex Waddress -@opindex Wno-address -Warn about suspicious uses of memory addresses. These include using -the address of a function in a conditional expression, such as -@code{void func(void); if (func)}, and comparisons against the memory -address of a string literal, such as @code{if (x == "abc")}. Such -uses typically indicate a programmer error: the address of a function -always evaluates to true, so their use in a conditional usually -indicate that the programmer forgot the parentheses in a function -call; and comparisons against string literals result in unspecified -behavior and are not portable in C, so they usually indicate that the -programmer intended to use @code{strcmp}. This warning is enabled by -@option{-Wall}. - -@item -Wlogical-op -@opindex Wlogical-op -@opindex Wno-logical-op -Warn about suspicious uses of logical operators in expressions. -This includes using logical operators in contexts where a -bit-wise operator is likely to be expected. - -@item -Wlogical-not-parentheses -@opindex Wlogical-not-parentheses -@opindex Wno-logical-not-parentheses -Warn about logical not used on the left hand side operand of a comparison. -This option does not warn if the RHS operand is of a boolean type. Its -purpose is to detect suspicious code like the following: -@smallexample -int a; -@dots{} -if (!a > 1) @{ @dots{} @} -@end smallexample - -It is possible to suppress the warning by wrapping the LHS into -parentheses: -@smallexample -if ((!a) > 1) @{ @dots{} @} -@end smallexample - -This warning is enabled by @option{-Wall}. - -@item -Waggregate-return -@opindex Waggregate-return -@opindex Wno-aggregate-return -Warn if any functions that return structures or unions are defined or -called. (In languages where you can return an array, this also elicits -a warning.) - -@item -Wno-aggressive-loop-optimizations -@opindex Wno-aggressive-loop-optimizations -@opindex Waggressive-loop-optimizations -Warn if in a loop with constant number of iterations the compiler detects -undefined behavior in some statement during one or more of the iterations. - -@item -Wno-attributes -@opindex Wno-attributes -@opindex Wattributes -Do not warn if an unexpected @code{__attribute__} is used, such as -unrecognized attributes, function attributes applied to variables, -etc. This does not stop errors for incorrect use of supported -attributes. - -@item -Wno-builtin-macro-redefined -@opindex Wno-builtin-macro-redefined -@opindex Wbuiltin-macro-redefined -Do not warn if certain built-in macros are redefined. This suppresses -warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, -@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. - -@item -Wstrict-prototypes @r{(C and Objective-C only)} -@opindex Wstrict-prototypes -@opindex Wno-strict-prototypes -Warn if a function is declared or defined without specifying the -argument types. (An old-style function definition is permitted without -a warning if preceded by a declaration that specifies the argument -types.) - -@item -Wold-style-declaration @r{(C and Objective-C only)} -@opindex Wold-style-declaration -@opindex Wno-old-style-declaration -Warn for obsolescent usages, according to the C Standard, in a -declaration. For example, warn if storage-class specifiers like -@code{static} are not the first things in a declaration. This warning -is also enabled by @option{-Wextra}. - -@item -Wold-style-definition @r{(C and Objective-C only)} -@opindex Wold-style-definition -@opindex Wno-old-style-definition -Warn if an old-style function definition is used. A warning is given -even if there is a previous prototype. - -@item -Wmissing-parameter-type @r{(C and Objective-C only)} -@opindex Wmissing-parameter-type -@opindex Wno-missing-parameter-type -A function parameter is declared without a type specifier in K&R-style -functions: - -@smallexample -void foo(bar) @{ @} -@end smallexample - -This warning is also enabled by @option{-Wextra}. - -@item -Wmissing-prototypes @r{(C and Objective-C only)} -@opindex Wmissing-prototypes -@opindex Wno-missing-prototypes -Warn if a global function is defined without a previous prototype -declaration. This warning is issued even if the definition itself -provides a prototype. Use this option to detect global functions -that do not have a matching prototype declaration in a header file. -This option is not valid for C++ because all function declarations -provide prototypes and a non-matching declaration declares an -overload rather than conflict with an earlier declaration. -Use @option{-Wmissing-declarations} to detect missing declarations in C++. - -@item -Wmissing-declarations -@opindex Wmissing-declarations -@opindex Wno-missing-declarations -Warn if a global function is defined without a previous declaration. -Do so even if the definition itself provides a prototype. -Use this option to detect global functions that are not declared in -header files. In C, no warnings are issued for functions with previous -non-prototype declarations; use @option{-Wmissing-prototypes} to detect -missing prototypes. In C++, no warnings are issued for function templates, -or for inline functions, or for functions in anonymous namespaces. - -@item -Wmissing-field-initializers -@opindex Wmissing-field-initializers -@opindex Wno-missing-field-initializers -@opindex W -@opindex Wextra -@opindex Wno-extra -Warn if a structure's initializer has some fields missing. For -example, the following code causes such a warning, because -@code{x.h} is implicitly zero: - -@smallexample -struct s @{ int f, g, h; @}; -struct s x = @{ 3, 4 @}; -@end smallexample - -This option does not warn about designated initializers, so the following -modification does not trigger a warning: - -@smallexample -struct s @{ int f, g, h; @}; -struct s x = @{ .f = 3, .g = 4 @}; -@end smallexample - -In C++ this option does not warn either about the empty @{ @} -initializer, for example: - -@smallexample -struct s @{ int f, g, h; @}; -s x = @{ @}; -@end smallexample - -This warning is included in @option{-Wextra}. To get other @option{-Wextra} -warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. - -@item -Wno-multichar -@opindex Wno-multichar -@opindex Wmultichar -Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. -Usually they indicate a typo in the user's code, as they have -implementation-defined values, and should not be used in portable code. - -@item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]} -@opindex Wnormalized= -@opindex Wnormalized -@opindex Wno-normalized -@cindex NFC -@cindex NFKC -@cindex character set, input normalization -In ISO C and ISO C++, two identifiers are different if they are -different sequences of characters. However, sometimes when characters -outside the basic ASCII character set are used, you can have two -different character sequences that look the same. To avoid confusion, -the ISO 10646 standard sets out some @dfn{normalization rules} which -when applied ensure that two sequences that look the same are turned into -the same sequence. GCC can warn you if you are using identifiers that -have not been normalized; this option controls that warning. - -There are four levels of warning supported by GCC@. The default is -@option{-Wnormalized=nfc}, which warns about any identifier that is -not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the -recommended form for most uses. It is equivalent to -@option{-Wnormalized}. - -Unfortunately, there are some characters allowed in identifiers by -ISO C and ISO C++ that, when turned into NFC, are not allowed in -identifiers. That is, there's no way to use these symbols in portable -ISO C or C++ and have all your identifiers in NFC@. -@option{-Wnormalized=id} suppresses the warning for these characters. -It is hoped that future versions of the standards involved will correct -this, which is why this option is not the default. - -You can switch the warning off for all characters by writing -@option{-Wnormalized=none} or @option{-Wno-normalized}. You should -only do this if you are using some other normalization scheme (like -``D''), because otherwise you can easily create bugs that are -literally impossible to see. - -Some characters in ISO 10646 have distinct meanings but look identical -in some fonts or display methodologies, especially once formatting has -been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL -LETTER N'', displays just like a regular @code{n} that has been -placed in a superscript. ISO 10646 defines the @dfn{NFKC} -normalization scheme to convert all these into a standard form as -well, and GCC warns if your code is not in NFKC if you use -@option{-Wnormalized=nfkc}. This warning is comparable to warning -about every identifier that contains the letter O because it might be -confused with the digit 0, and so is not the default, but may be -useful as a local coding convention if the programming environment -cannot be fixed to display these characters distinctly. - -@item -Wno-deprecated -@opindex Wno-deprecated -@opindex Wdeprecated -Do not warn about usage of deprecated features. @xref{Deprecated Features}. - -@item -Wno-deprecated-declarations -@opindex Wno-deprecated-declarations -@opindex Wdeprecated-declarations -Do not warn about uses of functions (@pxref{Function Attributes}), -variables (@pxref{Variable Attributes}), and types (@pxref{Type -Attributes}) marked as deprecated by using the @code{deprecated} -attribute. - -@item -Wno-overflow -@opindex Wno-overflow -@opindex Woverflow -Do not warn about compile-time overflow in constant expressions. - -@item -Wno-odr -@opindex Wno-odr -@opindex Wodr -Warn about One Definition Rule violations during link-time optimization. -Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. - -@item -Wopenmp-simd -@opindex Wopenm-simd -Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus -simd directive set by user. The @option{-fsimd-cost-model=unlimited} -option can be used to relax the cost model. - -@item -Woverride-init @r{(C and Objective-C only)} -@opindex Woverride-init -@opindex Wno-override-init -@opindex W -@opindex Wextra -@opindex Wno-extra -Warn if an initialized field without side effects is overridden when -using designated initializers (@pxref{Designated Inits, , Designated -Initializers}). - -This warning is included in @option{-Wextra}. To get other -@option{-Wextra} warnings without this one, use @option{-Wextra --Wno-override-init}. - -@item -Wpacked -@opindex Wpacked -@opindex Wno-packed -Warn if a structure is given the packed attribute, but the packed -attribute has no effect on the layout or size of the structure. -Such structures may be mis-aligned for little benefit. For -instance, in this code, the variable @code{f.x} in @code{struct bar} -is misaligned even though @code{struct bar} does not itself -have the packed attribute: - -@smallexample -@group -struct foo @{ - int x; - char a, b, c, d; -@} __attribute__((packed)); -struct bar @{ - char z; - struct foo f; -@}; -@end group -@end smallexample - -@item -Wpacked-bitfield-compat -@opindex Wpacked-bitfield-compat -@opindex Wno-packed-bitfield-compat -The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute -on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but -the change can lead to differences in the structure layout. GCC -informs you when the offset of such a field has changed in GCC 4.4. -For example there is no longer a 4-bit padding between field @code{a} -and @code{b} in this structure: - -@smallexample -struct foo -@{ - char a:4; - char b:8; -@} __attribute__ ((packed)); -@end smallexample - -This warning is enabled by default. Use -@option{-Wno-packed-bitfield-compat} to disable this warning. - -@item -Wpadded -@opindex Wpadded -@opindex Wno-padded -Warn if padding is included in a structure, either to align an element -of the structure or to align the whole structure. Sometimes when this -happens it is possible to rearrange the fields of the structure to -reduce the padding and so make the structure smaller. - -@item -Wredundant-decls -@opindex Wredundant-decls -@opindex Wno-redundant-decls -Warn if anything is declared more than once in the same scope, even in -cases where multiple declaration is valid and changes nothing. - -@item -Wnested-externs @r{(C and Objective-C only)} -@opindex Wnested-externs -@opindex Wno-nested-externs -Warn if an @code{extern} declaration is encountered within a function. - -@item -Wno-inherited-variadic-ctor -@opindex Winherited-variadic-ctor -@opindex Wno-inherited-variadic-ctor -Suppress warnings about use of C++11 inheriting constructors when the -base class inherited from has a C variadic constructor; the warning is -on by default because the ellipsis is not inherited. - -@item -Winline -@opindex Winline -@opindex Wno-inline -Warn if a function that is declared as inline cannot be inlined. -Even with this option, the compiler does not warn about failures to -inline functions declared in system headers. - -The compiler uses a variety of heuristics to determine whether or not -to inline a function. For example, the compiler takes into account -the size of the function being inlined and the amount of inlining -that has already been done in the current function. Therefore, -seemingly insignificant changes in the source program can cause the -warnings produced by @option{-Winline} to appear or disappear. - -@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} -@opindex Wno-invalid-offsetof -@opindex Winvalid-offsetof -Suppress warnings from applying the @code{offsetof} macro to a non-POD -type. According to the 2014 ISO C++ standard, applying @code{offsetof} -to a non-standard-layout type is undefined. In existing C++ implementations, -however, @code{offsetof} typically gives meaningful results. -This flag is for users who are aware that they are -writing nonportable code and who have deliberately chosen to ignore the -warning about it. - -The restrictions on @code{offsetof} may be relaxed in a future version -of the C++ standard. - -@item -Wno-int-to-pointer-cast -@opindex Wno-int-to-pointer-cast -@opindex Wint-to-pointer-cast -Suppress warnings from casts to pointer type of an integer of a -different size. In C++, casting to a pointer type of smaller size is -an error. @option{Wint-to-pointer-cast} is enabled by default. - - -@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} -@opindex Wno-pointer-to-int-cast -@opindex Wpointer-to-int-cast -Suppress warnings from casts from a pointer to an integer type of a -different size. - -@item -Winvalid-pch -@opindex Winvalid-pch -@opindex Wno-invalid-pch -Warn if a precompiled header (@pxref{Precompiled Headers}) is found in -the search path but can't be used. - -@item -Wlong-long -@opindex Wlong-long -@opindex Wno-long-long -Warn if @code{long long} type is used. This is enabled by either -@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 -modes. To inhibit the warning messages, use @option{-Wno-long-long}. - -@item -Wvariadic-macros -@opindex Wvariadic-macros -@opindex Wno-variadic-macros -Warn if variadic macros are used in ISO C90 mode, or if the GNU -alternate syntax is used in ISO C99 mode. This is enabled by either -@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning -messages, use @option{-Wno-variadic-macros}. - -@item -Wvarargs -@opindex Wvarargs -@opindex Wno-varargs -Warn upon questionable usage of the macros used to handle variable -arguments like @code{va_start}. This is default. To inhibit the -warning messages, use @option{-Wno-varargs}. - -@item -Wvector-operation-performance -@opindex Wvector-operation-performance -@opindex Wno-vector-operation-performance -Warn if vector operation is not implemented via SIMD capabilities of the -architecture. Mainly useful for the performance tuning. -Vector operation can be implemented @code{piecewise}, which means that the -scalar operation is performed on every vector element; -@code{in parallel}, which means that the vector operation is implemented -using scalars of wider type, which normally is more performance efficient; -and @code{as a single scalar}, which means that vector fits into a -scalar type. - -@item -Wno-virtual-move-assign -@opindex Wvirtual-move-assign -@opindex Wno-virtual-move-assign -Suppress warnings about inheriting from a virtual base with a -non-trivial C++11 move assignment operator. This is dangerous because -if the virtual base is reachable along more than one path, it is -moved multiple times, which can mean both objects end up in the -moved-from state. If the move assignment operator is written to avoid -moving from a moved-from object, this warning can be disabled. - -@item -Wvla -@opindex Wvla -@opindex Wno-vla -Warn if variable length array is used in the code. -@option{-Wno-vla} prevents the @option{-Wpedantic} warning of -the variable length array. - -@item -Wvolatile-register-var -@opindex Wvolatile-register-var -@opindex Wno-volatile-register-var -Warn if a register variable is declared volatile. The volatile -modifier does not inhibit all optimizations that may eliminate reads -and/or writes to register variables. This warning is enabled by -@option{-Wall}. - -@item -Wdisabled-optimization -@opindex Wdisabled-optimization -@opindex Wno-disabled-optimization -Warn if a requested optimization pass is disabled. This warning does -not generally indicate that there is anything wrong with your code; it -merely indicates that GCC's optimizers are unable to handle the code -effectively. Often, the problem is that your code is too big or too -complex; GCC refuses to optimize programs when the optimization -itself is likely to take inordinate amounts of time. - -@item -Wpointer-sign @r{(C and Objective-C only)} -@opindex Wpointer-sign -@opindex Wno-pointer-sign -Warn for pointer argument passing or assignment with different signedness. -This option is only supported for C and Objective-C@. It is implied by -@option{-Wall} and by @option{-Wpedantic}, which can be disabled with -@option{-Wno-pointer-sign}. - -@item -Wstack-protector -@opindex Wstack-protector -@opindex Wno-stack-protector -This option is only active when @option{-fstack-protector} is active. It -warns about functions that are not protected against stack smashing. - -@item -Woverlength-strings -@opindex Woverlength-strings -@opindex Wno-overlength-strings -Warn about string constants that are longer than the ``minimum -maximum'' length specified in the C standard. Modern compilers -generally allow string constants that are much longer than the -standard's minimum limit, but very portable programs should avoid -using longer strings. - -The limit applies @emph{after} string constant concatenation, and does -not count the trailing NUL@. In C90, the limit was 509 characters; in -C99, it was raised to 4095. C++98 does not specify a normative -minimum maximum, so we do not diagnose overlength strings in C++@. - -This option is implied by @option{-Wpedantic}, and can be disabled with -@option{-Wno-overlength-strings}. - -@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} -@opindex Wunsuffixed-float-constants - -Issue a warning for any floating constant that does not have -a suffix. When used together with @option{-Wsystem-headers} it -warns about such constants in system header files. This can be useful -when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma -from the decimal floating-point extension to C99. - -@item -Wno-designated-init @r{(C and Objective-C only)} -Suppress warnings when a positional initializer is used to initialize -a structure that has been marked with the @code{designated_init} -attribute. - -@end table - -@node Debugging Options -@section Options for Debugging Your Program or GCC -@cindex options, debugging -@cindex debugging information options - -GCC has various special options that are used for debugging -either your program or GCC: - -@table @gcctabopt -@item -g -@opindex g -Produce debugging information in the operating system's native format -(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging -information. - -On most systems that use stabs format, @option{-g} enables use of extra -debugging information that only GDB can use; this extra information -makes debugging work better in GDB but probably makes other debuggers -crash or -refuse to read the program. If you want to control for certain whether -to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, -@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). - -GCC allows you to use @option{-g} with -@option{-O}. The shortcuts taken by optimized code may occasionally -produce surprising results: some variables you declared may not exist -at all; flow of control may briefly move where you did not expect it; -some statements may not be executed because they compute constant -results or their values are already at hand; some statements may -execute in different places because they have been moved out of loops. - -Nevertheless it proves possible to debug optimized output. This makes -it reasonable to use the optimizer for programs that might have bugs. - -The following options are useful when GCC is generated with the -capability for more than one debugging format. - -@item -gsplit-dwarf -@opindex gsplit-dwarf -Separate as much dwarf debugging information as possible into a -separate output file with the extension .dwo. This option allows -the build system to avoid linking files with debug information. To -be useful, this option requires a debugger capable of reading .dwo -files. - -@item -ggdb -@opindex ggdb -Produce debugging information for use by GDB@. This means to use the -most expressive format available (DWARF 2, stabs, or the native format -if neither of those are supported), including GDB extensions if at all -possible. - -@item -gpubnames -@opindex gpubnames -Generate dwarf .debug_pubnames and .debug_pubtypes sections. - -@item -ggnu-pubnames -@opindex ggnu-pubnames -Generate .debug_pubnames and .debug_pubtypes sections in a format -suitable for conversion into a GDB@ index. This option is only useful -with a linker that can produce GDB@ index version 7. - -@item -gstabs -@opindex gstabs -Produce debugging information in stabs format (if that is supported), -without GDB extensions. This is the format used by DBX on most BSD -systems. On MIPS, Alpha and System V Release 4 systems this option -produces stabs debugging output that is not understood by DBX or SDB@. -On System V Release 4 systems this option requires the GNU assembler. - -@item -feliminate-unused-debug-symbols -@opindex feliminate-unused-debug-symbols -Produce debugging information in stabs format (if that is supported), -for only symbols that are actually used. - -@item -femit-class-debug-always -@opindex femit-class-debug-always -Instead of emitting debugging information for a C++ class in only one -object file, emit it in all object files using the class. This option -should be used only with debuggers that are unable to handle the way GCC -normally emits debugging information for classes because using this -option increases the size of debugging information by as much as a -factor of two. - -@item -fdebug-types-section -@opindex fdebug-types-section -@opindex fno-debug-types-section -When using DWARF Version 4 or higher, type DIEs can be put into -their own @code{.debug_types} section instead of making them part of the -@code{.debug_info} section. It is more efficient to put them in a separate -comdat sections since the linker can then remove duplicates. -But not all DWARF consumers support @code{.debug_types} sections yet -and on some objects @code{.debug_types} produces larger instead of smaller -debugging information. - -@item -gstabs+ -@opindex gstabs+ -Produce debugging information in stabs format (if that is supported), -using GNU extensions understood only by the GNU debugger (GDB)@. The -use of these extensions is likely to make other debuggers crash or -refuse to read the program. - -@item -gcoff -@opindex gcoff -Produce debugging information in COFF format (if that is supported). -This is the format used by SDB on most System V systems prior to -System V Release 4. - -@item -gxcoff -@opindex gxcoff -Produce debugging information in XCOFF format (if that is supported). -This is the format used by the DBX debugger on IBM RS/6000 systems. - -@item -gxcoff+ -@opindex gxcoff+ -Produce debugging information in XCOFF format (if that is supported), -using GNU extensions understood only by the GNU debugger (GDB)@. The -use of these extensions is likely to make other debuggers crash or -refuse to read the program, and may cause assemblers other than the GNU -assembler (GAS) to fail with an error. - -@item -gdwarf-@var{version} -@opindex gdwarf-@var{version} -Produce debugging information in DWARF format (if that is supported). -The value of @var{version} may be either 2, 3, 4 or 5; the default version -for most targets is 4. DWARF Version 5 is only experimental. - -Note that with DWARF Version 2, some ports require and always -use some non-conflicting DWARF 3 extensions in the unwind tables. - -Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} -for maximum benefit. - -@item -grecord-gcc-switches -@opindex grecord-gcc-switches -This switch causes the command-line options used to invoke the -compiler that may affect code generation to be appended to the -DW_AT_producer attribute in DWARF debugging information. The options -are concatenated with spaces separating them from each other and from -the compiler version. See also @option{-frecord-gcc-switches} for another -way of storing compiler options into the object file. This is the default. - -@item -gno-record-gcc-switches -@opindex gno-record-gcc-switches -Disallow appending command-line options to the DW_AT_producer attribute -in DWARF debugging information. - -@item -gstrict-dwarf -@opindex gstrict-dwarf -Disallow using extensions of later DWARF standard version than selected -with @option{-gdwarf-@var{version}}. On most targets using non-conflicting -DWARF extensions from later standard versions is allowed. - -@item -gno-strict-dwarf -@opindex gno-strict-dwarf -Allow using extensions of later DWARF standard version than selected with -@option{-gdwarf-@var{version}}. - -@item -gz@r{[}=@var{type}@r{]} -@opindex gz -Produce compressed debug sections in DWARF format, if that is supported. -If @var{type} is not given, the default type depends on the capabilities -of the assembler and linker used. @var{type} may be one of -@samp{none} (don't compress debug sections), @samp{zlib} (use zlib -compression in ELF gABI format), or @samp{zlib-gnu} (use zlib -compression in traditional GNU format). If the linker doesn't support -writing compressed debug sections, the option is rejected. Otherwise, -if the assembler does not support them, @option{-gz} is silently ignored -when producing object files. - -@item -gvms -@opindex gvms -Produce debugging information in Alpha/VMS debug format (if that is -supported). This is the format used by DEBUG on Alpha/VMS systems. - -@item -g@var{level} -@itemx -ggdb@var{level} -@itemx -gstabs@var{level} -@itemx -gcoff@var{level} -@itemx -gxcoff@var{level} -@itemx -gvms@var{level} -Request debugging information and also use @var{level} to specify how -much information. The default level is 2. - -Level 0 produces no debug information at all. Thus, @option{-g0} negates -@option{-g}. - -Level 1 produces minimal information, enough for making backtraces in -parts of the program that you don't plan to debug. This includes -descriptions of functions and external variables, and line number -tables, but no information about local variables. - -Level 3 includes extra information, such as all the macro definitions -present in the program. Some debuggers support macro expansion when -you use @option{-g3}. - -@option{-gdwarf-2} does not accept a concatenated debug level, because -GCC used to support an option @option{-gdwarf} that meant to generate -debug information in version 1 of the DWARF format (which is very -different from version 2), and it would have been too confusing. That -debug format is long obsolete, but the option cannot be changed now. -Instead use an additional @option{-g@var{level}} option to change the -debug level for DWARF. - -@item -gtoggle -@opindex gtoggle -Turn off generation of debug info, if leaving out this option -generates it, or turn it on at level 2 otherwise. The position of this -argument in the command line does not matter; it takes effect after all -other options are processed, and it does so only once, no matter how -many times it is given. This is mainly intended to be used with -@option{-fcompare-debug}. - -@item -fsanitize=address -@opindex fsanitize=address -Enable AddressSanitizer, a fast memory error detector. -Memory access instructions are instrumented to detect -out-of-bounds and use-after-free bugs. -See @uref{http://code.google.com/p/address-sanitizer/} for -more details. The run-time behavior can be influenced using the -@env{ASAN_OPTIONS} environment variable; see -@url{https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags} for -a list of supported options. - -@item -fsanitize=kernel-address -@opindex fsanitize=kernel-address -Enable AddressSanitizer for Linux kernel. -See @uref{http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel} for more details. - -@item -fsanitize=thread -@opindex fsanitize=thread -Enable ThreadSanitizer, a fast data race detector. -Memory access instructions are instrumented to detect -data race bugs. See @uref{http://code.google.com/p/thread-sanitizer/} for more -details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} -environment variable; see -@url{https://code.google.com/p/thread-sanitizer/wiki/Flags} for a list of -supported options. - -@item -fsanitize=leak -@opindex fsanitize=leak -Enable LeakSanitizer, a memory leak detector. -This option only matters for linking of executables and if neither -@option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that -case the executable is linked against a library that overrides @code{malloc} -and other allocator functions. See -@uref{https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer} for more -details. The run-time behavior can be influenced using the -@env{LSAN_OPTIONS} environment variable. - -@item -fsanitize=undefined -@opindex fsanitize=undefined -Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. -Various computations are instrumented to detect undefined behavior -at runtime. Current suboptions are: - -@table @gcctabopt - -@item -fsanitize=shift -@opindex fsanitize=shift -This option enables checking that the result of a shift operation is -not undefined. Note that what exactly is considered undefined differs -slightly between C and C++, as well as between ISO C90 and C99, etc. - -@item -fsanitize=integer-divide-by-zero -@opindex fsanitize=integer-divide-by-zero -Detect integer division by zero as well as @code{INT_MIN / -1} division. - -@item -fsanitize=unreachable -@opindex fsanitize=unreachable -With this option, the compiler turns the @code{__builtin_unreachable} -call into a diagnostics message call instead. When reaching the -@code{__builtin_unreachable} call, the behavior is undefined. - -@item -fsanitize=vla-bound -@opindex fsanitize=vla-bound -This option instructs the compiler to check that the size of a variable -length array is positive. - -@item -fsanitize=null -@opindex fsanitize=null -This option enables pointer checking. Particularly, the application -built with this option turned on will issue an error message when it -tries to dereference a NULL pointer, or if a reference (possibly an -rvalue reference) is bound to a NULL pointer, or if a method is invoked -on an object pointed by a NULL pointer. - -@item -fsanitize=return -@opindex fsanitize=return -This option enables return statement checking. Programs -built with this option turned on will issue an error message -when the end of a non-void function is reached without actually -returning a value. This option works in C++ only. - -@item -fsanitize=signed-integer-overflow -@opindex fsanitize=signed-integer-overflow -This option enables signed integer overflow checking. We check that -the result of @code{+}, @code{*}, and both unary and binary @code{-} -does not overflow in the signed arithmetics. Note, integer promotion -rules must be taken into account. That is, the following is not an -overflow: -@smallexample -signed char a = SCHAR_MAX; -a++; -@end smallexample - -@item -fsanitize=bounds -@opindex fsanitize=bounds -This option enables instrumentation of array bounds. Various out of bounds -accesses are detected. Flexible array members, flexible array member-like -arrays, and initializers of variables with static storage are not instrumented. - -@item -fsanitize=alignment -@opindex fsanitize=alignment - -This option enables checking of alignment of pointers when they are -dereferenced, or when a reference is bound to insufficiently aligned target, -or when a method or constructor is invoked on insufficiently aligned object. - -@item -fsanitize=object-size -@opindex fsanitize=object-size -This option enables instrumentation of memory references using the -@code{__builtin_object_size} function. Various out of bounds pointer -accesses are detected. - -@item -fsanitize=float-divide-by-zero -@opindex fsanitize=float-divide-by-zero -Detect floating-point division by zero. Unlike other similar options, -@option{-fsanitize=float-divide-by-zero} is not enabled by -@option{-fsanitize=undefined}, since floating-point division by zero can -be a legitimate way of obtaining infinities and NaNs. - -@item -fsanitize=float-cast-overflow -@opindex fsanitize=float-cast-overflow -This option enables floating-point type to integer conversion checking. -We check that the result of the conversion does not overflow. -Unlike other similar options, @option{-fsanitize=float-cast-overflow} is -not enabled by @option{-fsanitize=undefined}. -This option does not work well with @code{FE_INVALID} exceptions enabled. - -@item -fsanitize=nonnull-attribute -@opindex fsanitize=nonnull-attribute - -This option enables instrumentation of calls, checking whether null values -are not passed to arguments marked as requiring a non-null value by the -@code{nonnull} function attribute. - -@item -fsanitize=returns-nonnull-attribute -@opindex fsanitize=returns-nonnull-attribute - -This option enables instrumentation of return statements in functions -marked with @code{returns_nonnull} function attribute, to detect returning -of null values from such functions. - -@item -fsanitize=bool -@opindex fsanitize=bool - -This option enables instrumentation of loads from bool. If a value other -than 0/1 is loaded, a run-time error is issued. - -@item -fsanitize=enum -@opindex fsanitize=enum - -This option enables instrumentation of loads from an enum type. If -a value outside the range of values for the enum type is loaded, -a run-time error is issued. - -@item -fsanitize=vptr -@opindex fsanitize=vptr - -This option enables instrumentation of C++ member function calls, member -accesses and some conversions between pointers to base and derived classes, -to verify the referenced object has the correct dynamic type. - -@end table - -While @option{-ftrapv} causes traps for signed overflows to be emitted, -@option{-fsanitize=undefined} gives a diagnostic message. -This currently works only for the C family of languages. - -@item -fno-sanitize=all -@opindex fno-sanitize=all - -This option disables all previously enabled sanitizers. -@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used -together. - -@item -fasan-shadow-offset=@var{number} -@opindex fasan-shadow-offset -This option forces GCC to use custom shadow offset in AddressSanitizer checks. -It is useful for experimenting with different shadow memory layouts in -Kernel AddressSanitizer. - -@item -fsanitize-recover@r{[}=@var{opts}@r{]} -@opindex fsanitize-recover -@opindex fno-sanitize-recover -@option{-fsanitize-recover=} controls error recovery mode for sanitizers -mentioned in comma-separated list of @var{opts}. Enabling this option -for a sanitizer component causes it to attempt to continue -running the program as if no error happened. This means multiple -runtime errors can be reported in a single program run, and the exit -code of the program may indicate success even when errors -have been reported. The @option{-fno-sanitize-recover=} option -can be used to alter -this behavior: only the first detected error is reported -and program then exits with a non-zero exit code. - -Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions -except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), -@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and -@option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default. -@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also -accepted, the former enables recovery for all sanitizers that support it, -the latter disables recovery for all sanitizers that support it. - -Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to -@smallexample --fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero -@end smallexample -@noindent -Similarly @option{-fno-sanitize-recover} is equivalent to -@smallexample --fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero -@end smallexample - -@item -fsanitize-undefined-trap-on-error -@opindex fsanitize-undefined-trap-on-error -The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to -report undefined behavior using @code{__builtin_trap} rather than -a @code{libubsan} library routine. The advantage of this is that the -@code{libubsan} library is not needed and is not linked in, so this -is usable even in freestanding environments. - -@item -fcheck-pointer-bounds -@opindex fcheck-pointer-bounds -@opindex fno-check-pointer-bounds -@cindex Pointer Bounds Checker options -Enable Pointer Bounds Checker instrumentation. Each memory reference -is instrumented with checks of the pointer used for memory access against -bounds associated with that pointer. - -Currently there -is only an implementation for Intel MPX available, thus x86 target -and @option{-mmpx} are required to enable this feature. -MPX-based instrumentation requires -a runtime library to enable MPX in hardware and handle bounds -violation signals. By default when @option{-fcheck-pointer-bounds} -and @option{-mmpx} options are used to link a program, the GCC driver -links against the @file{libmpx} runtime library and @file{libmpxwrappers} -library. It also passes '-z bndplt' to a linker in case it supports this -option (which is checked on libmpx configuration). Note that old versions -of linker may ignore option. Gold linker doesn't support '-z bndplt' -option. With no '-z bndplt' support in linker all calls to dynamic libraries -lose passed bounds reducing overall protection level. It's highly -recommended to use linker with '-z bndplt' support. In case such linker -is not available it is adviced to always use @option{-static-libmpxwrappers} -for better protection level or use @option{-static} to completely avoid -external calls to dynamic libraries. MPX-based instrumentation -may be used for debugging and also may be included in production code -to increase program security. Depending on usage, you may -have different requirements for the runtime library. The current version -of the MPX runtime library is more oriented for use as a debugging -tool. MPX runtime library usage implies @option{-lpthread}. See -also @option{-static-libmpx}. The runtime library behavior can be -influenced using various @env{CHKP_RT_*} environment variables. See -@uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler} -for more details. - -Generated instrumentation may be controlled by various -@option{-fchkp-*} options and by the @code{bnd_variable_size} -structure field attribute (@pxref{Type Attributes}) and -@code{bnd_legacy}, and @code{bnd_instrument} function attributes -(@pxref{Function Attributes}). GCC also provides a number of built-in -functions for controlling the Pointer Bounds Checker. @xref{Pointer -Bounds Checker builtins}, for more information. - -@item -fchkp-check-incomplete-type -@opindex fchkp-check-incomplete-type -@opindex fno-chkp-check-incomplete-type -Generate pointer bounds checks for variables with incomplete type. -Enabled by default. - -@item -fchkp-narrow-bounds -@opindex fchkp-narrow-bounds -@opindex fno-chkp-narrow-bounds -Controls bounds used by Pointer Bounds Checker for pointers to object -fields. If narrowing is enabled then field bounds are used. Otherwise -object bounds are used. See also @option{-fchkp-narrow-to-innermost-array} -and @option{-fchkp-first-field-has-own-bounds}. Enabled by default. - -@item -fchkp-first-field-has-own-bounds -@opindex fchkp-first-field-has-own-bounds -@opindex fno-chkp-first-field-has-own-bounds -Forces Pointer Bounds Checker to use narrowed bounds for the address of the -first field in the structure. By default a pointer to the first field has -the same bounds as a pointer to the whole structure. - -@item -fchkp-narrow-to-innermost-array -@opindex fchkp-narrow-to-innermost-array -@opindex fno-chkp-narrow-to-innermost-array -Forces Pointer Bounds Checker to use bounds of the innermost arrays in -case of nested static array access. By default this option is disabled and -bounds of the outermost array are used. - -@item -fchkp-optimize -@opindex fchkp-optimize -@opindex fno-chkp-optimize -Enables Pointer Bounds Checker optimizations. Enabled by default at -optimization levels @option{-O}, @option{-O2}, @option{-O3}. - -@item -fchkp-use-fast-string-functions -@opindex fchkp-use-fast-string-functions -@opindex fno-chkp-use-fast-string-functions -Enables use of @code{*_nobnd} versions of string functions (not copying bounds) -by Pointer Bounds Checker. Disabled by default. - -@item -fchkp-use-nochk-string-functions -@opindex fchkp-use-nochk-string-functions -@opindex fno-chkp-use-nochk-string-functions -Enables use of @code{*_nochk} versions of string functions (not checking bounds) -by Pointer Bounds Checker. Disabled by default. - -@item -fchkp-use-static-bounds -@opindex fchkp-use-static-bounds -@opindex fno-chkp-use-static-bounds -Allow Pointer Bounds Checker to generate static bounds holding -bounds of static variables. Enabled by default. - -@item -fchkp-use-static-const-bounds -@opindex fchkp-use-static-const-bounds -@opindex fno-chkp-use-static-const-bounds -Use statically-initialized bounds for constant bounds instead of -generating them each time they are required. By default enabled when -@option{-fchkp-use-static-bounds} is enabled. - -@item -fchkp-treat-zero-dynamic-size-as-infinite -@opindex fchkp-treat-zero-dynamic-size-as-infinite -@opindex fno-chkp-treat-zero-dynamic-size-as-infinite -With this option, objects with incomplete type whose -dynamically-obtained size is zero are treated as having infinite size -instead by Pointer Bounds -Checker. This option may be helpful if a program is linked with a library -missing size information for some symbols. Disabled by default. - -@item -fchkp-check-read -@opindex fchkp-check-read -@opindex fno-chkp-check-read -Instructs Pointer Bounds Checker to generate checks for all read -accesses to memory. Enabled by default. - -@item -fchkp-check-write -@opindex fchkp-check-write -@opindex fno-chkp-check-write -Instructs Pointer Bounds Checker to generate checks for all write -accesses to memory. Enabled by default. - -@item -fchkp-store-bounds -@opindex fchkp-store-bounds -@opindex fno-chkp-store-bounds -Instructs Pointer Bounds Checker to generate bounds stores for -pointer writes. Enabled by default. - -@item -fchkp-instrument-calls -@opindex fchkp-instrument-calls -@opindex fno-chkp-instrument-calls -Instructs Pointer Bounds Checker to pass pointer bounds to calls. -Enabled by default. - -@item -fchkp-instrument-marked-only -@opindex fchkp-instrument-marked-only -@opindex fno-chkp-instrument-marked-only -Instructs Pointer Bounds Checker to instrument only functions -marked with the @code{bnd_instrument} attribute -(@pxref{Function Attributes}). Disabled by default. - -@item -fchkp-use-wrappers -@opindex fchkp-use-wrappers -@opindex fno-chkp-use-wrappers -Allows Pointer Bounds Checker to replace calls to built-in functions -with calls to wrapper functions. When @option{-fchkp-use-wrappers} -is used to link a program, the GCC driver automatically links -against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}. -Enabled by default. - -@item -fdump-final-insns@r{[}=@var{file}@r{]} -@opindex fdump-final-insns -Dump the final internal representation (RTL) to @var{file}. If the -optional argument is omitted (or if @var{file} is @code{.}), the name -of the dump file is determined by appending @code{.gkd} to the -compilation output file name. - -@item -fcompare-debug@r{[}=@var{opts}@r{]} -@opindex fcompare-debug -@opindex fno-compare-debug -If no error occurs during compilation, run the compiler a second time, -adding @var{opts} and @option{-fcompare-debug-second} to the arguments -passed to the second compilation. Dump the final internal -representation in both compilations, and print an error if they differ. - -If the equal sign is omitted, the default @option{-gtoggle} is used. - -The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty -and nonzero, implicitly enables @option{-fcompare-debug}. If -@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, -then it is used for @var{opts}, otherwise the default @option{-gtoggle} -is used. - -@option{-fcompare-debug=}, with the equal sign but without @var{opts}, -is equivalent to @option{-fno-compare-debug}, which disables the dumping -of the final representation and the second compilation, preventing even -@env{GCC_COMPARE_DEBUG} from taking effect. - -To verify full coverage during @option{-fcompare-debug} testing, set -@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, -which GCC rejects as an invalid option in any actual compilation -(rather than preprocessing, assembly or linking). To get just a -warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug -not overridden} will do. - -@item -fcompare-debug-second -@opindex fcompare-debug-second -This option is implicitly passed to the compiler for the second -compilation requested by @option{-fcompare-debug}, along with options to -silence warnings, and omitting other options that would cause -side-effect compiler outputs to files or to the standard output. Dump -files and preserved temporary files are renamed so as to contain the -@code{.gk} additional extension during the second compilation, to avoid -overwriting those generated by the first. - -When this option is passed to the compiler driver, it causes the -@emph{first} compilation to be skipped, which makes it useful for little -other than debugging the compiler proper. - -@item -feliminate-dwarf2-dups -@opindex feliminate-dwarf2-dups -Compress DWARF 2 debugging information by eliminating duplicated -information about each symbol. This option only makes sense when -generating DWARF 2 debugging information with @option{-gdwarf-2}. - -@item -femit-struct-debug-baseonly -@opindex femit-struct-debug-baseonly -Emit debug information for struct-like types -only when the base name of the compilation source file -matches the base name of file in which the struct is defined. - -This option substantially reduces the size of debugging information, -but at significant potential loss in type information to the debugger. -See @option{-femit-struct-debug-reduced} for a less aggressive option. -See @option{-femit-struct-debug-detailed} for more detailed control. - -This option works only with DWARF 2. - -@item -femit-struct-debug-reduced -@opindex femit-struct-debug-reduced -Emit debug information for struct-like types -only when the base name of the compilation source file -matches the base name of file in which the type is defined, -unless the struct is a template or defined in a system header. - -This option significantly reduces the size of debugging information, -with some potential loss in type information to the debugger. -See @option{-femit-struct-debug-baseonly} for a more aggressive option. -See @option{-femit-struct-debug-detailed} for more detailed control. - -This option works only with DWARF 2. - -@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} -@opindex femit-struct-debug-detailed -Specify the struct-like types -for which the compiler generates debug information. -The intent is to reduce duplicate struct debug information -between different object files within the same program. - -This option is a detailed version of -@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, -which serves for most needs. - -A specification has the syntax@* -[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) - -The optional first word limits the specification to -structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). -A struct type is used directly when it is the type of a variable, member. -Indirect uses arise through pointers to structs. -That is, when use of an incomplete struct is valid, the use is indirect. -An example is -@samp{struct one direct; struct two * indirect;}. - -The optional second word limits the specification to -ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). -Generic structs are a bit complicated to explain. -For C++, these are non-explicit specializations of template classes, -or non-template classes within the above. -Other programming languages have generics, -but @option{-femit-struct-debug-detailed} does not yet implement them. - -The third word specifies the source files for those -structs for which the compiler should emit debug information. -The values @samp{none} and @samp{any} have the normal meaning. -The value @samp{base} means that -the base of name of the file in which the type declaration appears -must match the base of the name of the main compilation file. -In practice, this means that when compiling @file{foo.c}, debug information -is generated for types declared in that file and @file{foo.h}, -but not other header files. -The value @samp{sys} means those types satisfying @samp{base} -or declared in system or compiler headers. - -You may need to experiment to determine the best settings for your application. - -The default is @option{-femit-struct-debug-detailed=all}. - -This option works only with DWARF 2. - -@item -fno-merge-debug-strings -@opindex fmerge-debug-strings -@opindex fno-merge-debug-strings -Direct the linker to not merge together strings in the debugging -information that are identical in different object files. Merging is -not supported by all assemblers or linkers. Merging decreases the size -of the debug information in the output file at the cost of increasing -link processing time. Merging is enabled by default. - -@item -fdebug-prefix-map=@var{old}=@var{new} -@opindex fdebug-prefix-map -When compiling files in directory @file{@var{old}}, record debugging -information describing them as in @file{@var{new}} instead. - -@item -fno-dwarf2-cfi-asm -@opindex fdwarf2-cfi-asm -@opindex fno-dwarf2-cfi-asm -Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section -instead of using GAS @code{.cfi_*} directives. - -@cindex @command{prof} -@item -p -@opindex p -Generate extra code to write profile information suitable for the -analysis program @command{prof}. You must use this option when compiling -the source files you want data about, and you must also use it when -linking. - -@cindex @command{gprof} -@item -pg -@opindex pg -Generate extra code to write profile information suitable for the -analysis program @command{gprof}. You must use this option when compiling -the source files you want data about, and you must also use it when -linking. - -@item -Q -@opindex Q -Makes the compiler print out each function name as it is compiled, and -print some statistics about each pass when it finishes. - -@item -ftime-report -@opindex ftime-report -Makes the compiler print some statistics about the time consumed by each -pass when it finishes. - -@item -fmem-report -@opindex fmem-report -Makes the compiler print some statistics about permanent memory -allocation when it finishes. - -@item -fmem-report-wpa -@opindex fmem-report-wpa -Makes the compiler print some statistics about permanent memory -allocation for the WPA phase only. - -@item -fpre-ipa-mem-report -@opindex fpre-ipa-mem-report -@item -fpost-ipa-mem-report -@opindex fpost-ipa-mem-report -Makes the compiler print some statistics about permanent memory -allocation before or after interprocedural optimization. - -@item -fprofile-report -@opindex fprofile-report -Makes the compiler print some statistics about consistency of the -(estimated) profile and effect of individual passes. - -@item -fstack-usage -@opindex fstack-usage -Makes the compiler output stack usage information for the program, on a -per-function basis. The filename for the dump is made by appending -@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of -the output file, if explicitly specified and it is not an executable, -otherwise it is the basename of the source file. An entry is made up -of three fields: - -@itemize -@item -The name of the function. -@item -A number of bytes. -@item -One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. -@end itemize - -The qualifier @code{static} means that the function manipulates the stack -statically: a fixed number of bytes are allocated for the frame on function -entry and released on function exit; no stack adjustments are otherwise made -in the function. The second field is this fixed number of bytes. - -The qualifier @code{dynamic} means that the function manipulates the stack -dynamically: in addition to the static allocation described above, stack -adjustments are made in the body of the function, for example to push/pop -arguments around function calls. If the qualifier @code{bounded} is also -present, the amount of these adjustments is bounded at compile time and -the second field is an upper bound of the total amount of stack used by -the function. If it is not present, the amount of these adjustments is -not bounded at compile time and the second field only represents the -bounded part. - -@item -fprofile-arcs -@opindex fprofile-arcs -Add code so that program flow @dfn{arcs} are instrumented. During -execution the program records how many times each branch and call is -executed and how many times it is taken or returns. When the compiled -program exits it saves this data to a file called -@file{@var{auxname}.gcda} for each source file. The data may be used for -profile-directed optimizations (@option{-fbranch-probabilities}), or for -test coverage analysis (@option{-ftest-coverage}). Each object file's -@var{auxname} is generated from the name of the output file, if -explicitly specified and it is not the final executable, otherwise it is -the basename of the source file. In both cases any suffix is removed -(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or -@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). -@xref{Cross-profiling}. - -@cindex @command{gcov} -@item --coverage -@opindex coverage - -This option is used to compile and link code instrumented for coverage -analysis. The option is a synonym for @option{-fprofile-arcs} -@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when -linking). See the documentation for those options for more details. - -@itemize - -@item -Compile the source files with @option{-fprofile-arcs} plus optimization -and code generation options. For test coverage analysis, use the -additional @option{-ftest-coverage} option. You do not need to profile -every source file in a program. - -@item -Link your object files with @option{-lgcov} or @option{-fprofile-arcs} -(the latter implies the former). - -@item -Run the program on a representative workload to generate the arc profile -information. This may be repeated any number of times. You can run -concurrent instances of your program, and provided that the file system -supports locking, the data files will be correctly updated. Also -@code{fork} calls are detected and correctly handled (double counting -will not happen). - -@item -For profile-directed optimizations, compile the source files again with -the same optimization and code generation options plus -@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that -Control Optimization}). - -@item -For test coverage analysis, use @command{gcov} to produce human readable -information from the @file{.gcno} and @file{.gcda} files. Refer to the -@command{gcov} documentation for further information. - -@end itemize - -With @option{-fprofile-arcs}, for each function of your program GCC -creates a program flow graph, then finds a spanning tree for the graph. -Only arcs that are not on the spanning tree have to be instrumented: the -compiler adds code to count the number of times that these arcs are -executed. When an arc is the only exit or only entrance to a block, the -instrumentation code can be added to the block; otherwise, a new basic -block must be created to hold the instrumentation code. - -@need 2000 -@item -ftest-coverage -@opindex ftest-coverage -Produce a notes file that the @command{gcov} code-coverage utility -(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to -show program coverage. Each source file's note file is called -@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option -above for a description of @var{auxname} and instructions on how to -generate test coverage data. Coverage data matches the source files -more closely if you do not optimize. - -@item -fdbg-cnt-list -@opindex fdbg-cnt-list -Print the name and the counter upper bound for all debug counters. - - -@item -fdbg-cnt=@var{counter-value-list} -@opindex fdbg-cnt -Set the internal debug counter upper bound. @var{counter-value-list} -is a comma-separated list of @var{name}:@var{value} pairs -which sets the upper bound of each debug counter @var{name} to @var{value}. -All debug counters have the initial upper bound of @code{UINT_MAX}; -thus @code{dbg_cnt} returns true always unless the upper bound -is set by this option. -For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, -@code{dbg_cnt(dce)} returns true only for first 10 invocations. - -@item -fenable-@var{kind}-@var{pass} -@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} -@opindex fdisable- -@opindex fenable- - -This is a set of options that are used to explicitly disable/enable -optimization passes. These options are intended for use for debugging GCC. -Compiler users should use regular options for enabling/disabling -passes instead. - -@table @gcctabopt - -@item -fdisable-ipa-@var{pass} -Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is -statically invoked in the compiler multiple times, the pass name should be -appended with a sequential number starting from 1. - -@item -fdisable-rtl-@var{pass} -@itemx -fdisable-rtl-@var{pass}=@var{range-list} -Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is -statically invoked in the compiler multiple times, the pass name should be -appended with a sequential number starting from 1. @var{range-list} is a -comma-separated list of function ranges or assembler names. Each range is a number -pair separated by a colon. The range is inclusive in both ends. If the range -is trivial, the number pair can be simplified as a single number. If the -function's call graph node's @var{uid} falls within one of the specified ranges, -the @var{pass} is disabled for that function. The @var{uid} is shown in the -function header of a dump file, and the pass names can be dumped by using -option @option{-fdump-passes}. - -@item -fdisable-tree-@var{pass} -@itemx -fdisable-tree-@var{pass}=@var{range-list} -Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of -option arguments. - -@item -fenable-ipa-@var{pass} -Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is -statically invoked in the compiler multiple times, the pass name should be -appended with a sequential number starting from 1. - -@item -fenable-rtl-@var{pass} -@itemx -fenable-rtl-@var{pass}=@var{range-list} -Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument -description and examples. - -@item -fenable-tree-@var{pass} -@itemx -fenable-tree-@var{pass}=@var{range-list} -Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description -of option arguments. - -@end table - -Here are some examples showing uses of these options. - -@smallexample - -# disable ccp1 for all functions - -fdisable-tree-ccp1 -# disable complete unroll for function whose cgraph node uid is 1 - -fenable-tree-cunroll=1 -# disable gcse2 for functions at the following ranges [1,1], -# [300,400], and [400,1000] -# disable gcse2 for functions foo and foo2 - -fdisable-rtl-gcse2=foo,foo2 -# disable early inlining - -fdisable-tree-einline -# disable ipa inlining - -fdisable-ipa-inline -# enable tree full unroll - -fenable-tree-unroll - -@end smallexample - -@item -d@var{letters} -@itemx -fdump-rtl-@var{pass} -@itemx -fdump-rtl-@var{pass}=@var{filename} -@opindex d -@opindex fdump-rtl-@var{pass} -Says to make debugging dumps during compilation at times specified by -@var{letters}. This is used for debugging the RTL-based passes of the -compiler. The file names for most of the dumps are made by appending -a pass number and a word to the @var{dumpname}, and the files are -created in the directory of the output file. In case of -@option{=@var{filename}} option, the dump is output on the given file -instead of the pass numbered dump files. Note that the pass number is -computed statically as passes get registered into the pass manager. -Thus the numbering is not related to the dynamic order of execution of -passes. In particular, a pass installed by a plugin could have a -number over 200 even if it executed quite early. @var{dumpname} is -generated from the name of the output file, if explicitly specified -and it is not an executable, otherwise it is the basename of the -source file. These switches may have different effects when -@option{-E} is used for preprocessing. - -Debug dumps can be enabled with a @option{-fdump-rtl} switch or some -@option{-d} option @var{letters}. Here are the possible -letters for use in @var{pass} and @var{letters}, and their meanings: - -@table @gcctabopt - -@item -fdump-rtl-alignments -@opindex fdump-rtl-alignments -Dump after branch alignments have been computed. - -@item -fdump-rtl-asmcons -@opindex fdump-rtl-asmcons -Dump after fixing rtl statements that have unsatisfied in/out constraints. - -@item -fdump-rtl-auto_inc_dec -@opindex fdump-rtl-auto_inc_dec -Dump after auto-inc-dec discovery. This pass is only run on -architectures that have auto inc or auto dec instructions. - -@item -fdump-rtl-barriers -@opindex fdump-rtl-barriers -Dump after cleaning up the barrier instructions. - -@item -fdump-rtl-bbpart -@opindex fdump-rtl-bbpart -Dump after partitioning hot and cold basic blocks. - -@item -fdump-rtl-bbro -@opindex fdump-rtl-bbro -Dump after block reordering. - -@item -fdump-rtl-btl1 -@itemx -fdump-rtl-btl2 -@opindex fdump-rtl-btl2 -@opindex fdump-rtl-btl2 -@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping -after the two branch -target load optimization passes. - -@item -fdump-rtl-bypass -@opindex fdump-rtl-bypass -Dump after jump bypassing and control flow optimizations. - -@item -fdump-rtl-combine -@opindex fdump-rtl-combine -Dump after the RTL instruction combination pass. - -@item -fdump-rtl-compgotos -@opindex fdump-rtl-compgotos -Dump after duplicating the computed gotos. - -@item -fdump-rtl-ce1 -@itemx -fdump-rtl-ce2 -@itemx -fdump-rtl-ce3 -@opindex fdump-rtl-ce1 -@opindex fdump-rtl-ce2 -@opindex fdump-rtl-ce3 -@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and -@option{-fdump-rtl-ce3} enable dumping after the three -if conversion passes. - -@item -fdump-rtl-cprop_hardreg -@opindex fdump-rtl-cprop_hardreg -Dump after hard register copy propagation. - -@item -fdump-rtl-csa -@opindex fdump-rtl-csa -Dump after combining stack adjustments. - -@item -fdump-rtl-cse1 -@itemx -fdump-rtl-cse2 -@opindex fdump-rtl-cse1 -@opindex fdump-rtl-cse2 -@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after -the two common subexpression elimination passes. - -@item -fdump-rtl-dce -@opindex fdump-rtl-dce -Dump after the standalone dead code elimination passes. - -@item -fdump-rtl-dbr -@opindex fdump-rtl-dbr -Dump after delayed branch scheduling. - -@item -fdump-rtl-dce1 -@itemx -fdump-rtl-dce2 -@opindex fdump-rtl-dce1 -@opindex fdump-rtl-dce2 -@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after -the two dead store elimination passes. - -@item -fdump-rtl-eh -@opindex fdump-rtl-eh -Dump after finalization of EH handling code. - -@item -fdump-rtl-eh_ranges -@opindex fdump-rtl-eh_ranges -Dump after conversion of EH handling range regions. - -@item -fdump-rtl-expand -@opindex fdump-rtl-expand -Dump after RTL generation. - -@item -fdump-rtl-fwprop1 -@itemx -fdump-rtl-fwprop2 -@opindex fdump-rtl-fwprop1 -@opindex fdump-rtl-fwprop2 -@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable -dumping after the two forward propagation passes. - -@item -fdump-rtl-gcse1 -@itemx -fdump-rtl-gcse2 -@opindex fdump-rtl-gcse1 -@opindex fdump-rtl-gcse2 -@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping -after global common subexpression elimination. - -@item -fdump-rtl-init-regs -@opindex fdump-rtl-init-regs -Dump after the initialization of the registers. - -@item -fdump-rtl-initvals -@opindex fdump-rtl-initvals -Dump after the computation of the initial value sets. - -@item -fdump-rtl-into_cfglayout -@opindex fdump-rtl-into_cfglayout -Dump after converting to cfglayout mode. - -@item -fdump-rtl-ira -@opindex fdump-rtl-ira -Dump after iterated register allocation. - -@item -fdump-rtl-jump -@opindex fdump-rtl-jump -Dump after the second jump optimization. - -@item -fdump-rtl-loop2 -@opindex fdump-rtl-loop2 -@option{-fdump-rtl-loop2} enables dumping after the rtl -loop optimization passes. - -@item -fdump-rtl-mach -@opindex fdump-rtl-mach -Dump after performing the machine dependent reorganization pass, if that -pass exists. - -@item -fdump-rtl-mode_sw -@opindex fdump-rtl-mode_sw -Dump after removing redundant mode switches. - -@item -fdump-rtl-rnreg -@opindex fdump-rtl-rnreg -Dump after register renumbering. - -@item -fdump-rtl-outof_cfglayout -@opindex fdump-rtl-outof_cfglayout -Dump after converting from cfglayout mode. - -@item -fdump-rtl-peephole2 -@opindex fdump-rtl-peephole2 -Dump after the peephole pass. - -@item -fdump-rtl-postreload -@opindex fdump-rtl-postreload -Dump after post-reload optimizations. - -@item -fdump-rtl-pro_and_epilogue -@opindex fdump-rtl-pro_and_epilogue -Dump after generating the function prologues and epilogues. - -@item -fdump-rtl-sched1 -@itemx -fdump-rtl-sched2 -@opindex fdump-rtl-sched1 -@opindex fdump-rtl-sched2 -@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping -after the basic block scheduling passes. - -@item -fdump-rtl-ree -@opindex fdump-rtl-ree -Dump after sign/zero extension elimination. - -@item -fdump-rtl-seqabstr -@opindex fdump-rtl-seqabstr -Dump after common sequence discovery. - -@item -fdump-rtl-shorten -@opindex fdump-rtl-shorten -Dump after shortening branches. - -@item -fdump-rtl-sibling -@opindex fdump-rtl-sibling -Dump after sibling call optimizations. - -@item -fdump-rtl-split1 -@itemx -fdump-rtl-split2 -@itemx -fdump-rtl-split3 -@itemx -fdump-rtl-split4 -@itemx -fdump-rtl-split5 -@opindex fdump-rtl-split1 -@opindex fdump-rtl-split2 -@opindex fdump-rtl-split3 -@opindex fdump-rtl-split4 -@opindex fdump-rtl-split5 -These options enable dumping after five rounds of -instruction splitting. - -@item -fdump-rtl-sms -@opindex fdump-rtl-sms -Dump after modulo scheduling. This pass is only run on some -architectures. - -@item -fdump-rtl-stack -@opindex fdump-rtl-stack -Dump after conversion from GCC's ``flat register file'' registers to the -x87's stack-like registers. This pass is only run on x86 variants. - -@item -fdump-rtl-subreg1 -@itemx -fdump-rtl-subreg2 -@opindex fdump-rtl-subreg1 -@opindex fdump-rtl-subreg2 -@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after -the two subreg expansion passes. - -@item -fdump-rtl-unshare -@opindex fdump-rtl-unshare -Dump after all rtl has been unshared. - -@item -fdump-rtl-vartrack -@opindex fdump-rtl-vartrack -Dump after variable tracking. - -@item -fdump-rtl-vregs -@opindex fdump-rtl-vregs -Dump after converting virtual registers to hard registers. - -@item -fdump-rtl-web -@opindex fdump-rtl-web -Dump after live range splitting. - -@item -fdump-rtl-regclass -@itemx -fdump-rtl-subregs_of_mode_init -@itemx -fdump-rtl-subregs_of_mode_finish -@itemx -fdump-rtl-dfinit -@itemx -fdump-rtl-dfinish -@opindex fdump-rtl-regclass -@opindex fdump-rtl-subregs_of_mode_init -@opindex fdump-rtl-subregs_of_mode_finish -@opindex fdump-rtl-dfinit -@opindex fdump-rtl-dfinish -These dumps are defined but always produce empty files. - -@item -da -@itemx -fdump-rtl-all -@opindex da -@opindex fdump-rtl-all -Produce all the dumps listed above. - -@item -dA -@opindex dA -Annotate the assembler output with miscellaneous debugging information. - -@item -dD -@opindex dD -Dump all macro definitions, at the end of preprocessing, in addition to -normal output. - -@item -dH -@opindex dH -Produce a core dump whenever an error occurs. - -@item -dp -@opindex dp -Annotate the assembler output with a comment indicating which -pattern and alternative is used. The length of each instruction is -also printed. - -@item -dP -@opindex dP -Dump the RTL in the assembler output as a comment before each instruction. -Also turns on @option{-dp} annotation. - -@item -dx -@opindex dx -Just generate RTL for a function instead of compiling it. Usually used -with @option{-fdump-rtl-expand}. -@end table - -@item -fdump-noaddr -@opindex fdump-noaddr -When doing debugging dumps, suppress address output. This makes it more -feasible to use diff on debugging dumps for compiler invocations with -different compiler binaries and/or different -text / bss / data / heap / stack / dso start locations. - -@item -freport-bug -@opindex freport-bug -Collect and dump debug information into temporary file if ICE in C/C++ -compiler occured. - -@item -fdump-unnumbered -@opindex fdump-unnumbered -When doing debugging dumps, suppress instruction numbers and address output. -This makes it more feasible to use diff on debugging dumps for compiler -invocations with different options, in particular with and without -@option{-g}. - -@item -fdump-unnumbered-links -@opindex fdump-unnumbered-links -When doing debugging dumps (see @option{-d} option above), suppress -instruction numbers for the links to the previous and next instructions -in a sequence. - -@item -fdump-translation-unit @r{(C++ only)} -@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} -@opindex fdump-translation-unit -Dump a representation of the tree structure for the entire translation -unit to a file. The file name is made by appending @file{.tu} to the -source file name, and the file is created in the same directory as the -output file. If the @samp{-@var{options}} form is used, @var{options} -controls the details of the dump as described for the -@option{-fdump-tree} options. - -@item -fdump-class-hierarchy @r{(C++ only)} -@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} -@opindex fdump-class-hierarchy -Dump a representation of each class's hierarchy and virtual function -table layout to a file. The file name is made by appending -@file{.class} to the source file name, and the file is created in the -same directory as the output file. If the @samp{-@var{options}} form -is used, @var{options} controls the details of the dump as described -for the @option{-fdump-tree} options. - -@item -fdump-ipa-@var{switch} -@opindex fdump-ipa -Control the dumping at various stages of inter-procedural analysis -language tree to a file. The file name is generated by appending a -switch specific suffix to the source file name, and the file is created -in the same directory as the output file. The following dumps are -possible: - -@table @samp -@item all -Enables all inter-procedural analysis dumps. - -@item cgraph -Dumps information about call-graph optimization, unused function removal, -and inlining decisions. - -@item inline -Dump after function inlining. - -@end table - -@item -fdump-passes -@opindex fdump-passes -Dump the list of optimization passes that are turned on and off by -the current command-line options. - -@item -fdump-statistics-@var{option} -@opindex fdump-statistics -Enable and control dumping of pass statistics in a separate file. The -file name is generated by appending a suffix ending in -@samp{.statistics} to the source file name, and the file is created in -the same directory as the output file. If the @samp{-@var{option}} -form is used, @samp{-stats} causes counters to be summed over the -whole compilation unit while @samp{-details} dumps every event as -the passes generate them. The default with no option is to sum -counters for each function compiled. - -@item -fdump-tree-@var{switch} -@itemx -fdump-tree-@var{switch}-@var{options} -@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} -@opindex fdump-tree -Control the dumping at various stages of processing the intermediate -language tree to a file. The file name is generated by appending a -switch-specific suffix to the source file name, and the file is -created in the same directory as the output file. In case of -@option{=@var{filename}} option, the dump is output on the given file -instead of the auto named dump files. If the @samp{-@var{options}} -form is used, @var{options} is a list of @samp{-} separated options -which control the details of the dump. Not all options are applicable -to all dumps; those that are not meaningful are ignored. The -following options are available - -@table @samp -@item address -Print the address of each node. Usually this is not meaningful as it -changes according to the environment and source file. Its primary use -is for tying up a dump file with a debug environment. -@item asmname -If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that -in the dump instead of @code{DECL_NAME}. Its primary use is ease of -use working backward from mangled names in the assembly file. -@item slim -When dumping front-end intermediate representations, inhibit dumping -of members of a scope or body of a function merely because that scope -has been reached. Only dump such items when they are directly reachable -by some other path. - -When dumping pretty-printed trees, this option inhibits dumping the -bodies of control structures. - -When dumping RTL, print the RTL in slim (condensed) form instead of -the default LISP-like representation. -@item raw -Print a raw representation of the tree. By default, trees are -pretty-printed into a C-like representation. -@item details -Enable more detailed dumps (not honored by every dump option). Also -include information from the optimization passes. -@item stats -Enable dumping various statistics about the pass (not honored by every dump -option). -@item blocks -Enable showing basic block boundaries (disabled in raw dumps). -@item graph -For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), -dump a representation of the control flow graph suitable for viewing with -GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in -the file is pretty-printed as a subgraph, so that GraphViz can render them -all in a single plot. - -This option currently only works for RTL dumps, and the RTL is always -dumped in slim form. -@item vops -Enable showing virtual operands for every statement. -@item lineno -Enable showing line numbers for statements. -@item uid -Enable showing the unique ID (@code{DECL_UID}) for each variable. -@item verbose -Enable showing the tree dump for each statement. -@item eh -Enable showing the EH region number holding each statement. -@item scev -Enable showing scalar evolution analysis details. -@item optimized -Enable showing optimization information (only available in certain -passes). -@item missed -Enable showing missed optimization information (only available in certain -passes). -@item note -Enable other detailed optimization information (only available in -certain passes). -@item =@var{filename} -Instead of an auto named dump file, output into the given file -name. The file names @file{stdout} and @file{stderr} are treated -specially and are considered already open standard streams. For -example, - -@smallexample -gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump - -fdump-tree-pre=stderr file.c -@end smallexample - -outputs vectorizer dump into @file{foo.dump}, while the PRE dump is -output on to @file{stderr}. If two conflicting dump filenames are -given for the same pass, then the latter option overrides the earlier -one. - -@item all -Turn on all options, except @option{raw}, @option{slim}, @option{verbose} -and @option{lineno}. - -@item optall -Turn on all optimization options, i.e., @option{optimized}, -@option{missed}, and @option{note}. -@end table - -The following tree dumps are possible: -@table @samp - -@item original -@opindex fdump-tree-original -Dump before any tree based optimization, to @file{@var{file}.original}. - -@item optimized -@opindex fdump-tree-optimized -Dump after all tree based optimization, to @file{@var{file}.optimized}. - -@item gimple -@opindex fdump-tree-gimple -Dump each function before and after the gimplification pass to a file. The -file name is made by appending @file{.gimple} to the source file name. - -@item cfg -@opindex fdump-tree-cfg -Dump the control flow graph of each function to a file. The file name is -made by appending @file{.cfg} to the source file name. - -@item ch -@opindex fdump-tree-ch -Dump each function after copying loop headers. The file name is made by -appending @file{.ch} to the source file name. - -@item ssa -@opindex fdump-tree-ssa -Dump SSA related information to a file. The file name is made by appending -@file{.ssa} to the source file name. - -@item alias -@opindex fdump-tree-alias -Dump aliasing information for each function. The file name is made by -appending @file{.alias} to the source file name. - -@item ccp -@opindex fdump-tree-ccp -Dump each function after CCP@. The file name is made by appending -@file{.ccp} to the source file name. - -@item storeccp -@opindex fdump-tree-storeccp -Dump each function after STORE-CCP@. The file name is made by appending -@file{.storeccp} to the source file name. - -@item pre -@opindex fdump-tree-pre -Dump trees after partial redundancy elimination. The file name is made -by appending @file{.pre} to the source file name. - -@item fre -@opindex fdump-tree-fre -Dump trees after full redundancy elimination. The file name is made -by appending @file{.fre} to the source file name. - -@item copyprop -@opindex fdump-tree-copyprop -Dump trees after copy propagation. The file name is made -by appending @file{.copyprop} to the source file name. - -@item store_copyprop -@opindex fdump-tree-store_copyprop -Dump trees after store copy-propagation. The file name is made -by appending @file{.store_copyprop} to the source file name. - -@item dce -@opindex fdump-tree-dce -Dump each function after dead code elimination. The file name is made by -appending @file{.dce} to the source file name. - -@item sra -@opindex fdump-tree-sra -Dump each function after performing scalar replacement of aggregates. The -file name is made by appending @file{.sra} to the source file name. - -@item sink -@opindex fdump-tree-sink -Dump each function after performing code sinking. The file name is made -by appending @file{.sink} to the source file name. - -@item dom -@opindex fdump-tree-dom -Dump each function after applying dominator tree optimizations. The file -name is made by appending @file{.dom} to the source file name. - -@item dse -@opindex fdump-tree-dse -Dump each function after applying dead store elimination. The file -name is made by appending @file{.dse} to the source file name. - -@item phiopt -@opindex fdump-tree-phiopt -Dump each function after optimizing PHI nodes into straightline code. The file -name is made by appending @file{.phiopt} to the source file name. - -@item forwprop -@opindex fdump-tree-forwprop -Dump each function after forward propagating single use variables. The file -name is made by appending @file{.forwprop} to the source file name. - -@item copyrename -@opindex fdump-tree-copyrename -Dump each function after applying the copy rename optimization. The file -name is made by appending @file{.copyrename} to the source file name. - -@item nrv -@opindex fdump-tree-nrv -Dump each function after applying the named return value optimization on -generic trees. The file name is made by appending @file{.nrv} to the source -file name. - -@item vect -@opindex fdump-tree-vect -Dump each function after applying vectorization of loops. The file name is -made by appending @file{.vect} to the source file name. - -@item slp -@opindex fdump-tree-slp -Dump each function after applying vectorization of basic blocks. The file name -is made by appending @file{.slp} to the source file name. - -@item vrp -@opindex fdump-tree-vrp -Dump each function after Value Range Propagation (VRP). The file name -is made by appending @file{.vrp} to the source file name. - -@item all -@opindex fdump-tree-all -Enable all the available tree dumps with the flags provided in this option. -@end table - -@item -fopt-info -@itemx -fopt-info-@var{options} -@itemx -fopt-info-@var{options}=@var{filename} -@opindex fopt-info -Controls optimization dumps from various optimization passes. If the -@samp{-@var{options}} form is used, @var{options} is a list of -@samp{-} separated option keywords to select the dump details and -optimizations. - -The @var{options} can be divided into two groups: options describing the -verbosity of the dump, and options describing which optimizations -should be included. The options from both the groups can be freely -mixed as they are non-overlapping. However, in case of any conflicts, -the later options override the earlier options on the command -line. - -The following options control the dump verbosity: - -@table @samp -@item optimized -Print information when an optimization is successfully applied. It is -up to a pass to decide which information is relevant. For example, the -vectorizer passes print the source location of loops which are -successfully vectorized. -@item missed -Print information about missed optimizations. Individual passes -control which information to include in the output. -@item note -Print verbose information about optimizations, such as certain -transformations, more detailed messages about decisions etc. -@item all -Print detailed optimization information. This includes -@samp{optimized}, @samp{missed}, and @samp{note}. -@end table - -One or more of the following option keywords can be used to describe a -group of optimizations: - -@table @samp -@item ipa -Enable dumps from all interprocedural optimizations. -@item loop -Enable dumps from all loop optimizations. -@item inline -Enable dumps from all inlining optimizations. -@item vec -Enable dumps from all vectorization optimizations. -@item optall -Enable dumps from all optimizations. This is a superset of -the optimization groups listed above. -@end table - -If @var{options} is -omitted, it defaults to @samp{optimized-optall}, which means to dump all -info about successful optimizations from all the passes. - -If the @var{filename} is provided, then the dumps from all the -applicable optimizations are concatenated into the @var{filename}. -Otherwise the dump is output onto @file{stderr}. Though multiple -@option{-fopt-info} options are accepted, only one of them can include -a @var{filename}. If other filenames are provided then all but the -first such option are ignored. - -Note that the output @var{filename} is overwritten -in case of multiple translation units. If a combined output from -multiple translation units is desired, @file{stderr} should be used -instead. - -In the following example, the optimization info is output to -@file{stderr}: - -@smallexample -gcc -O3 -fopt-info -@end smallexample - -This example: -@smallexample -gcc -O3 -fopt-info-missed=missed.all -@end smallexample - -@noindent -outputs missed optimization report from all the passes into -@file{missed.all}, and this one: - -@smallexample -gcc -O2 -ftree-vectorize -fopt-info-vec-missed -@end smallexample - -@noindent -prints information about missed optimization opportunities from -vectorization passes on @file{stderr}. -Note that @option{-fopt-info-vec-missed} is equivalent to -@option{-fopt-info-missed-vec}. - -As another example, -@smallexample -gcc -O3 -fopt-info-inline-optimized-missed=inline.txt -@end smallexample - -@noindent -outputs information about missed optimizations as well as -optimized locations from all the inlining passes into -@file{inline.txt}. - -Finally, consider: - -@smallexample -gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt -@end smallexample - -@noindent -Here the two output filenames @file{vec.miss} and @file{loop.opt} are -in conflict since only one output file is allowed. In this case, only -the first option takes effect and the subsequent options are -ignored. Thus only @file{vec.miss} is produced which contains -dumps from the vectorizer about missed opportunities. - -@item -frandom-seed=@var{number} -@opindex frandom-seed -This option provides a seed that GCC uses in place of -random numbers in generating certain symbol names -that have to be different in every compiled file. It is also used to -place unique stamps in coverage data files and the object files that -produce them. You can use the @option{-frandom-seed} option to produce -reproducibly identical object files. - -The @var{number} should be different for every file you compile. - -@item -fsched-verbose=@var{n} -@opindex fsched-verbose -On targets that use instruction scheduling, this option controls the -amount of debugging output the scheduler prints. This information is -written to standard error, unless @option{-fdump-rtl-sched1} or -@option{-fdump-rtl-sched2} is specified, in which case it is output -to the usual dump listing file, @file{.sched1} or @file{.sched2} -respectively. However for @var{n} greater than nine, the output is -always printed to standard error. - -For @var{n} greater than zero, @option{-fsched-verbose} outputs the -same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. -For @var{n} greater than one, it also output basic block probabilities, -detailed ready list information and unit/insn info. For @var{n} greater -than two, it includes RTL at abort point, control-flow and regions info. -And for @var{n} over four, @option{-fsched-verbose} also includes -dependence info. - -@item -save-temps -@itemx -save-temps=cwd -@opindex save-temps -Store the usual ``temporary'' intermediate files permanently; place them -in the current directory and name them based on the source file. Thus, -compiling @file{foo.c} with @option{-c -save-temps} produces files -@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a -preprocessed @file{foo.i} output file even though the compiler now -normally uses an integrated preprocessor. - -When used in combination with the @option{-x} command-line option, -@option{-save-temps} is sensible enough to avoid over writing an -input source file with the same extension as an intermediate file. -The corresponding intermediate file may be obtained by renaming the -source file before using @option{-save-temps}. - -If you invoke GCC in parallel, compiling several different source -files that share a common base name in different subdirectories or the -same source file compiled for multiple output destinations, it is -likely that the different parallel compilers will interfere with each -other, and overwrite the temporary files. For instance: - -@smallexample -gcc -save-temps -o outdir1/foo.o indir1/foo.c& -gcc -save-temps -o outdir2/foo.o indir2/foo.c& -@end smallexample - -may result in @file{foo.i} and @file{foo.o} being written to -simultaneously by both compilers. - -@item -save-temps=obj -@opindex save-temps=obj -Store the usual ``temporary'' intermediate files permanently. If the -@option{-o} option is used, the temporary files are based on the -object file. If the @option{-o} option is not used, the -@option{-save-temps=obj} switch behaves like @option{-save-temps}. - -For example: - -@smallexample -gcc -save-temps=obj -c foo.c -gcc -save-temps=obj -c bar.c -o dir/xbar.o -gcc -save-temps=obj foobar.c -o dir2/yfoobar -@end smallexample - -@noindent -creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, -@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and -@file{dir2/yfoobar.o}. - -@item -time@r{[}=@var{file}@r{]} -@opindex time -Report the CPU time taken by each subprocess in the compilation -sequence. For C source files, this is the compiler proper and assembler -(plus the linker if linking is done). - -Without the specification of an output file, the output looks like this: - -@smallexample -# cc1 0.12 0.01 -# as 0.00 0.01 -@end smallexample - -The first number on each line is the ``user time'', that is time spent -executing the program itself. The second number is ``system time'', -time spent executing operating system routines on behalf of the program. -Both numbers are in seconds. - -With the specification of an output file, the output is appended to the -named file, and it looks like this: - -@smallexample -0.12 0.01 cc1 @var{options} -0.00 0.01 as @var{options} -@end smallexample - -The ``user time'' and the ``system time'' are moved before the program -name, and the options passed to the program are displayed, so that one -can later tell what file was being compiled, and with which options. - -@item -fvar-tracking -@opindex fvar-tracking -Run variable tracking pass. It computes where variables are stored at each -position in code. Better debugging information is then generated -(if the debugging information format supports this information). - -It is enabled by default when compiling with optimization (@option{-Os}, -@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and -the debug info format supports it. - -@item -fvar-tracking-assignments -@opindex fvar-tracking-assignments -@opindex fno-var-tracking-assignments -Annotate assignments to user variables early in the compilation and -attempt to carry the annotations over throughout the compilation all the -way to the end, in an attempt to improve debug information while -optimizing. Use of @option{-gdwarf-4} is recommended along with it. - -It can be enabled even if var-tracking is disabled, in which case -annotations are created and maintained, but discarded at the end. -By default, this flag is enabled together with @option{-fvar-tracking}, -except when selective scheduling is enabled. - -@item -fvar-tracking-assignments-toggle -@opindex fvar-tracking-assignments-toggle -@opindex fno-var-tracking-assignments-toggle -Toggle @option{-fvar-tracking-assignments}, in the same way that -@option{-gtoggle} toggles @option{-g}. - -@item -print-file-name=@var{library} -@opindex print-file-name -Print the full absolute name of the library file @var{library} that -would be used when linking---and don't do anything else. With this -option, GCC does not compile or link anything; it just prints the -file name. - -@item -print-multi-directory -@opindex print-multi-directory -Print the directory name corresponding to the multilib selected by any -other switches present in the command line. This directory is supposed -to exist in @env{GCC_EXEC_PREFIX}. - -@item -print-multi-lib -@opindex print-multi-lib -Print the mapping from multilib directory names to compiler switches -that enable them. The directory name is separated from the switches by -@samp{;}, and each switch starts with an @samp{@@} instead of the -@samp{-}, without spaces between multiple switches. This is supposed to -ease shell processing. - -@item -print-multi-os-directory -@opindex print-multi-os-directory -Print the path to OS libraries for the selected -multilib, relative to some @file{lib} subdirectory. If OS libraries are -present in the @file{lib} subdirectory and no multilibs are used, this is -usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} -sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or -@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} -subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. - -@item -print-multiarch -@opindex print-multiarch -Print the path to OS libraries for the selected multiarch, -relative to some @file{lib} subdirectory. - -@item -print-prog-name=@var{program} -@opindex print-prog-name -Like @option{-print-file-name}, but searches for a program such as @command{cpp}. - -@item -print-libgcc-file-name -@opindex print-libgcc-file-name -Same as @option{-print-file-name=libgcc.a}. - -This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} -but you do want to link with @file{libgcc.a}. You can do: - -@smallexample -gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` -@end smallexample - -@item -print-search-dirs -@opindex print-search-dirs -Print the name of the configured installation directory and a list of -program and library directories @command{gcc} searches---and don't do anything else. - -This is useful when @command{gcc} prints the error message -@samp{installation problem, cannot exec cpp0: No such file or directory}. -To resolve this you either need to put @file{cpp0} and the other compiler -components where @command{gcc} expects to find them, or you can set the environment -variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. -Don't forget the trailing @samp{/}. -@xref{Environment Variables}. - -@item -print-sysroot -@opindex print-sysroot -Print the target sysroot directory that is used during -compilation. This is the target sysroot specified either at configure -time or using the @option{--sysroot} option, possibly with an extra -suffix that depends on compilation options. If no target sysroot is -specified, the option prints nothing. - -@item -print-sysroot-headers-suffix -@opindex print-sysroot-headers-suffix -Print the suffix added to the target sysroot when searching for -headers, or give an error if the compiler is not configured with such -a suffix---and don't do anything else. - -@item -dumpmachine -@opindex dumpmachine -Print the compiler's target machine (for example, -@samp{i686-pc-linux-gnu})---and don't do anything else. - -@item -dumpversion -@opindex dumpversion -Print the compiler version (for example, @code{3.0})---and don't do -anything else. - -@item -dumpspecs -@opindex dumpspecs -Print the compiler's built-in specs---and don't do anything else. (This -is used when GCC itself is being built.) @xref{Spec Files}. - -@item -fno-eliminate-unused-debug-types -@opindex feliminate-unused-debug-types -@opindex fno-eliminate-unused-debug-types -Normally, when producing DWARF 2 output, GCC avoids producing debug symbol -output for types that are nowhere used in the source file being compiled. -Sometimes it is useful to have GCC emit debugging -information for all types declared in a compilation -unit, regardless of whether or not they are actually used -in that compilation unit, for example -if, in the debugger, you want to cast a value to a type that is -not actually used in your program (but is declared). More often, -however, this results in a significant amount of wasted space. -@end table - -@node Optimize Options -@section Options That Control Optimization -@cindex optimize options -@cindex options, optimization - -These options control various sorts of optimizations. - -Without any optimization option, the compiler's goal is to reduce the -cost of compilation and to make debugging produce the expected -results. Statements are independent: if you stop the program with a -breakpoint between statements, you can then assign a new value to any -variable or change the program counter to any other statement in the -function and get exactly the results you expect from the source -code. - -Turning on optimization flags makes the compiler attempt to improve -the performance and/or code size at the expense of compilation time -and possibly the ability to debug the program. - -The compiler performs optimization based on the knowledge it has of the -program. Compiling multiple files at once to a single output file mode allows -the compiler to use information gained from all of the files when compiling -each of them. - -Not all optimizations are controlled directly by a flag. Only -optimizations that have a flag are listed in this section. - -Most optimizations are only enabled if an @option{-O} level is set on -the command line. Otherwise they are disabled, even if individual -optimization flags are specified. - -Depending on the target and how GCC was configured, a slightly different -set of optimizations may be enabled at each @option{-O} level than -those listed here. You can invoke GCC with @option{-Q --help=optimizers} -to find out the exact set of optimizations that are enabled at each level. -@xref{Overall Options}, for examples. - -@table @gcctabopt -@item -O -@itemx -O1 -@opindex O -@opindex O1 -Optimize. Optimizing compilation takes somewhat more time, and a lot -more memory for a large function. - -With @option{-O}, the compiler tries to reduce code size and execution -time, without performing any optimizations that take a great deal of -compilation time. - -@option{-O} turns on the following optimization flags: -@gccoptlist{ --fauto-inc-dec @gol --fbranch-count-reg @gol --fcombine-stack-adjustments @gol --fcompare-elim @gol --fcprop-registers @gol --fdce @gol --fdefer-pop @gol --fdelayed-branch @gol --fdse @gol --fforward-propagate @gol --fguess-branch-probability @gol --fif-conversion2 @gol --fif-conversion @gol --finline-functions-called-once @gol --fipa-pure-const @gol --fipa-profile @gol --fipa-reference @gol --fmerge-constants @gol --fmove-loop-invariants @gol --fshrink-wrap @gol --fsplit-wide-types @gol --ftree-bit-ccp @gol --ftree-ccp @gol --fssa-phiopt @gol --ftree-ch @gol --ftree-copy-prop @gol --ftree-copyrename @gol --ftree-dce @gol --ftree-dominator-opts @gol --ftree-dse @gol --ftree-forwprop @gol --ftree-fre @gol --ftree-phiprop @gol --ftree-sink @gol --ftree-slsr @gol --ftree-sra @gol --ftree-pta @gol --ftree-ter @gol --funit-at-a-time} - -@option{-O} also turns on @option{-fomit-frame-pointer} on machines -where doing so does not interfere with debugging. - -@item -O2 -@opindex O2 -Optimize even more. GCC performs nearly all supported optimizations -that do not involve a space-speed tradeoff. -As compared to @option{-O}, this option increases both compilation time -and the performance of the generated code. - -@option{-O2} turns on all optimization flags specified by @option{-O}. It -also turns on the following optimization flags: -@gccoptlist{-fthread-jumps @gol --falign-functions -falign-jumps @gol --falign-loops -falign-labels @gol --fcaller-saves @gol --fcrossjumping @gol --fcse-follow-jumps -fcse-skip-blocks @gol --fdelete-null-pointer-checks @gol --fdevirtualize -fdevirtualize-speculatively @gol --fexpensive-optimizations @gol --fgcse -fgcse-lm @gol --fhoist-adjacent-loads @gol --finline-small-functions @gol --findirect-inlining @gol --fipa-cp @gol --fipa-cp-alignment @gol --fipa-sra @gol --fipa-icf @gol --fisolate-erroneous-paths-dereference @gol --flra-remat @gol --foptimize-sibling-calls @gol --foptimize-strlen @gol --fpartial-inlining @gol --fpeephole2 @gol --freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol --frerun-cse-after-loop @gol --fsched-interblock -fsched-spec @gol --fschedule-insns -fschedule-insns2 @gol --fstrict-aliasing -fstrict-overflow @gol --ftree-builtin-call-dce @gol --ftree-switch-conversion -ftree-tail-merge @gol --ftree-pre @gol --ftree-vrp @gol --fipa-ra} - -Please note the warning under @option{-fgcse} about -invoking @option{-O2} on programs that use computed gotos. - -@item -O3 -@opindex O3 -Optimize yet more. @option{-O3} turns on all optimizations specified -by @option{-O2} and also turns on the @option{-finline-functions}, -@option{-funswitch-loops}, @option{-fpredictive-commoning}, -@option{-fgcse-after-reload}, @option{-ftree-loop-vectorize}, -@option{-ftree-loop-distribute-patterns}, -@option{-ftree-slp-vectorize}, @option{-fvect-cost-model}, -@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options. - -@item -O0 -@opindex O0 -Reduce compilation time and make debugging produce the expected -results. This is the default. - -@item -Os -@opindex Os -Optimize for size. @option{-Os} enables all @option{-O2} optimizations that -do not typically increase code size. It also performs further -optimizations designed to reduce code size. - -@option{-Os} disables the following optimization flags: -@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol --falign-labels -freorder-blocks -freorder-blocks-and-partition @gol --fprefetch-loop-arrays} - -@item -Ofast -@opindex Ofast -Disregard strict standards compliance. @option{-Ofast} enables all -@option{-O3} optimizations. It also enables optimizations that are not -valid for all standard-compliant programs. -It turns on @option{-ffast-math} and the Fortran-specific -@option{-fno-protect-parens} and @option{-fstack-arrays}. - -@item -Og -@opindex Og -Optimize debugging experience. @option{-Og} enables optimizations -that do not interfere with debugging. It should be the optimization -level of choice for the standard edit-compile-debug cycle, offering -a reasonable level of optimization while maintaining fast compilation -and a good debugging experience. - -If you use multiple @option{-O} options, with or without level numbers, -the last such option is the one that is effective. -@end table - -Options of the form @option{-f@var{flag}} specify machine-independent -flags. Most flags have both positive and negative forms; the negative -form of @option{-ffoo} is @option{-fno-foo}. In the table -below, only one of the forms is listed---the one you typically -use. You can figure out the other form by either removing @samp{no-} -or adding it. - -The following options control specific optimizations. They are either -activated by @option{-O} options or are related to ones that are. You -can use the following flags in the rare cases when ``fine-tuning'' of -optimizations to be performed is desired. - -@table @gcctabopt -@item -fno-defer-pop -@opindex fno-defer-pop -Always pop the arguments to each function call as soon as that function -returns. For machines that must pop arguments after a function call, -the compiler normally lets arguments accumulate on the stack for several -function calls and pops them all at once. - -Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fforward-propagate -@opindex fforward-propagate -Perform a forward propagation pass on RTL@. The pass tries to combine two -instructions and checks if the result can be simplified. If loop unrolling -is active, two passes are performed and the second is scheduled after -loop unrolling. - -This option is enabled by default at optimization levels @option{-O}, -@option{-O2}, @option{-O3}, @option{-Os}. - -@item -ffp-contract=@var{style} -@opindex ffp-contract -@option{-ffp-contract=off} disables floating-point expression contraction. -@option{-ffp-contract=fast} enables floating-point expression contraction -such as forming of fused multiply-add operations if the target has -native support for them. -@option{-ffp-contract=on} enables floating-point expression contraction -if allowed by the language standard. This is currently not implemented -and treated equal to @option{-ffp-contract=off}. - -The default is @option{-ffp-contract=fast}. - -@item -fomit-frame-pointer -@opindex fomit-frame-pointer -Don't keep the frame pointer in a register for functions that -don't need one. This avoids the instructions to save, set up and -restore frame pointers; it also makes an extra register available -in many functions. @strong{It also makes debugging impossible on -some machines.} - -On some machines, such as the VAX, this flag has no effect, because -the standard calling sequence automatically handles the frame pointer -and nothing is saved by pretending it doesn't exist. The -machine-description macro @code{FRAME_POINTER_REQUIRED} controls -whether a target machine supports this flag. @xref{Registers,,Register -Usage, gccint, GNU Compiler Collection (GCC) Internals}. - -The default setting (when not optimizing for -size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is -@option{-fomit-frame-pointer}. You can configure GCC with the -@option{--enable-frame-pointer} configure option to change the default. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -foptimize-sibling-calls -@opindex foptimize-sibling-calls -Optimize sibling and tail recursive calls. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -foptimize-strlen -@opindex foptimize-strlen -Optimize various standard C string functions (e.g. @code{strlen}, -@code{strchr} or @code{strcpy}) and -their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -fno-inline -@opindex fno-inline -Do not expand any functions inline apart from those marked with -the @code{always_inline} attribute. This is the default when not -optimizing. - -Single functions can be exempted from inlining by marking them -with the @code{noinline} attribute. - -@item -finline-small-functions -@opindex finline-small-functions -Integrate functions into their callers when their body is smaller than expected -function call code (so overall size of program gets smaller). The compiler -heuristically decides which functions are simple enough to be worth integrating -in this way. This inlining applies to all functions, even those not declared -inline. - -Enabled at level @option{-O2}. - -@item -findirect-inlining -@opindex findirect-inlining -Inline also indirect calls that are discovered to be known at compile -time thanks to previous inlining. This option has any effect only -when inlining itself is turned on by the @option{-finline-functions} -or @option{-finline-small-functions} options. - -Enabled at level @option{-O2}. - -@item -finline-functions -@opindex finline-functions -Consider all functions for inlining, even if they are not declared inline. -The compiler heuristically decides which functions are worth integrating -in this way. - -If all calls to a given function are integrated, and the function is -declared @code{static}, then the function is normally not output as -assembler code in its own right. - -Enabled at level @option{-O3}. - -@item -finline-functions-called-once -@opindex finline-functions-called-once -Consider all @code{static} functions called once for inlining into their -caller even if they are not marked @code{inline}. If a call to a given -function is integrated, then the function is not output as assembler code -in its own right. - -Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. - -@item -fearly-inlining -@opindex fearly-inlining -Inline functions marked by @code{always_inline} and functions whose body seems -smaller than the function call overhead early before doing -@option{-fprofile-generate} instrumentation and real inlining pass. Doing so -makes profiling significantly cheaper and usually inlining faster on programs -having large chains of nested wrapper functions. - -Enabled by default. - -@item -fipa-sra -@opindex fipa-sra -Perform interprocedural scalar replacement of aggregates, removal of -unused parameters and replacement of parameters passed by reference -by parameters passed by value. - -Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. - -@item -finline-limit=@var{n} -@opindex finline-limit -By default, GCC limits the size of functions that can be inlined. This flag -allows coarse control of this limit. @var{n} is the size of functions that -can be inlined in number of pseudo instructions. - -Inlining is actually controlled by a number of parameters, which may be -specified individually by using @option{--param @var{name}=@var{value}}. -The @option{-finline-limit=@var{n}} option sets some of these parameters -as follows: - -@table @gcctabopt -@item max-inline-insns-single -is set to @var{n}/2. -@item max-inline-insns-auto -is set to @var{n}/2. -@end table - -See below for a documentation of the individual -parameters controlling inlining and for the defaults of these parameters. - -@emph{Note:} there may be no value to @option{-finline-limit} that results -in default behavior. - -@emph{Note:} pseudo instruction represents, in this particular context, an -abstract measurement of function's size. In no way does it represent a count -of assembly instructions and as such its exact meaning might change from one -release to an another. - -@item -fno-keep-inline-dllexport -@opindex fno-keep-inline-dllexport -This is a more fine-grained version of @option{-fkeep-inline-functions}, -which applies only to functions that are declared using the @code{dllexport} -attribute or declspec (@xref{Function Attributes,,Declaring Attributes of -Functions}.) - -@item -fkeep-inline-functions -@opindex fkeep-inline-functions -In C, emit @code{static} functions that are declared @code{inline} -into the object file, even if the function has been inlined into all -of its callers. This switch does not affect functions using the -@code{extern inline} extension in GNU C90@. In C++, emit any and all -inline functions into the object file. - -@item -fkeep-static-consts -@opindex fkeep-static-consts -Emit variables declared @code{static const} when optimization isn't turned -on, even if the variables aren't referenced. - -GCC enables this option by default. If you want to force the compiler to -check if a variable is referenced, regardless of whether or not -optimization is turned on, use the @option{-fno-keep-static-consts} option. - -@item -fmerge-constants -@opindex fmerge-constants -Attempt to merge identical constants (string constants and floating-point -constants) across compilation units. - -This option is the default for optimized compilation if the assembler and -linker support it. Use @option{-fno-merge-constants} to inhibit this -behavior. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fmerge-all-constants -@opindex fmerge-all-constants -Attempt to merge identical constants and identical variables. - -This option implies @option{-fmerge-constants}. In addition to -@option{-fmerge-constants} this considers e.g.@: even constant initialized -arrays or initialized constant variables with integral or floating-point -types. Languages like C or C++ require each variable, including multiple -instances of the same variable in recursive calls, to have distinct locations, -so using this option results in non-conforming -behavior. - -@item -fmodulo-sched -@opindex fmodulo-sched -Perform swing modulo scheduling immediately before the first scheduling -pass. This pass looks at innermost loops and reorders their -instructions by overlapping different iterations. - -@item -fmodulo-sched-allow-regmoves -@opindex fmodulo-sched-allow-regmoves -Perform more aggressive SMS-based modulo scheduling with register moves -allowed. By setting this flag certain anti-dependences edges are -deleted, which triggers the generation of reg-moves based on the -life-range analysis. This option is effective only with -@option{-fmodulo-sched} enabled. - -@item -fno-branch-count-reg -@opindex fno-branch-count-reg -Do not use ``decrement and branch'' instructions on a count register, -but instead generate a sequence of instructions that decrement a -register, compare it against zero, then branch based upon the result. -This option is only meaningful on architectures that support such -instructions, which include x86, PowerPC, IA-64 and S/390. - -Enabled by default at @option{-O1} and higher. - -The default is @option{-fbranch-count-reg}. - -@item -fno-function-cse -@opindex fno-function-cse -Do not put function addresses in registers; make each instruction that -calls a constant function contain the function's address explicitly. - -This option results in less efficient code, but some strange hacks -that alter the assembler output may be confused by the optimizations -performed when this option is not used. - -The default is @option{-ffunction-cse} - -@item -fno-zero-initialized-in-bss -@opindex fno-zero-initialized-in-bss -If the target supports a BSS section, GCC by default puts variables that -are initialized to zero into BSS@. This can save space in the resulting -code. - -This option turns off this behavior because some programs explicitly -rely on variables going to the data section---e.g., so that the -resulting executable can find the beginning of that section and/or make -assumptions based on that. - -The default is @option{-fzero-initialized-in-bss}. - -@item -fthread-jumps -@opindex fthread-jumps -Perform optimizations that check to see if a jump branches to a -location where another comparison subsumed by the first is found. If -so, the first branch is redirected to either the destination of the -second branch or a point immediately following it, depending on whether -the condition is known to be true or false. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fsplit-wide-types -@opindex fsplit-wide-types -When using a type that occupies multiple registers, such as @code{long -long} on a 32-bit system, split the registers apart and allocate them -independently. This normally generates better code for those types, -but may make debugging more difficult. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, -@option{-Os}. - -@item -fcse-follow-jumps -@opindex fcse-follow-jumps -In common subexpression elimination (CSE), scan through jump instructions -when the target of the jump is not reached by any other path. For -example, when CSE encounters an @code{if} statement with an -@code{else} clause, CSE follows the jump when the condition -tested is false. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fcse-skip-blocks -@opindex fcse-skip-blocks -This is similar to @option{-fcse-follow-jumps}, but causes CSE to -follow jumps that conditionally skip over blocks. When CSE -encounters a simple @code{if} statement with no else clause, -@option{-fcse-skip-blocks} causes CSE to follow the jump around the -body of the @code{if}. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -frerun-cse-after-loop -@opindex frerun-cse-after-loop -Re-run common subexpression elimination after loop optimizations are -performed. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fgcse -@opindex fgcse -Perform a global common subexpression elimination pass. -This pass also performs global constant and copy propagation. - -@emph{Note:} When compiling a program using computed gotos, a GCC -extension, you may get better run-time performance if you disable -the global common subexpression elimination pass by adding -@option{-fno-gcse} to the command line. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fgcse-lm -@opindex fgcse-lm -When @option{-fgcse-lm} is enabled, global common subexpression elimination -attempts to move loads that are only killed by stores into themselves. This -allows a loop containing a load/store sequence to be changed to a load outside -the loop, and a copy/store within the loop. - -Enabled by default when @option{-fgcse} is enabled. - -@item -fgcse-sm -@opindex fgcse-sm -When @option{-fgcse-sm} is enabled, a store motion pass is run after -global common subexpression elimination. This pass attempts to move -stores out of loops. When used in conjunction with @option{-fgcse-lm}, -loops containing a load/store sequence can be changed to a load before -the loop and a store after the loop. - -Not enabled at any optimization level. - -@item -fgcse-las -@opindex fgcse-las -When @option{-fgcse-las} is enabled, the global common subexpression -elimination pass eliminates redundant loads that come after stores to the -same memory location (both partial and full redundancies). - -Not enabled at any optimization level. - -@item -fgcse-after-reload -@opindex fgcse-after-reload -When @option{-fgcse-after-reload} is enabled, a redundant load elimination -pass is performed after reload. The purpose of this pass is to clean up -redundant spilling. - -@item -faggressive-loop-optimizations -@opindex faggressive-loop-optimizations -This option tells the loop optimizer to use language constraints to -derive bounds for the number of iterations of a loop. This assumes that -loop code does not invoke undefined behavior by for example causing signed -integer overflows or out-of-bound array accesses. The bounds for the -number of iterations of a loop are used to guide loop unrolling and peeling -and loop exit test optimizations. -This option is enabled by default. - -@item -funsafe-loop-optimizations -@opindex funsafe-loop-optimizations -This option tells the loop optimizer to assume that loop indices do not -overflow, and that loops with nontrivial exit condition are not -infinite. This enables a wider range of loop optimizations even if -the loop optimizer itself cannot prove that these assumptions are valid. -If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you -if it finds this kind of loop. - -@item -fcrossjumping -@opindex fcrossjumping -Perform cross-jumping transformation. -This transformation unifies equivalent code and saves code size. The -resulting code may or may not perform better than without cross-jumping. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fauto-inc-dec -@opindex fauto-inc-dec -Combine increments or decrements of addresses with memory accesses. -This pass is always skipped on architectures that do not have -instructions to support this. Enabled by default at @option{-O} and -higher on architectures that support this. - -@item -fdce -@opindex fdce -Perform dead code elimination (DCE) on RTL@. -Enabled by default at @option{-O} and higher. - -@item -fdse -@opindex fdse -Perform dead store elimination (DSE) on RTL@. -Enabled by default at @option{-O} and higher. - -@item -fif-conversion -@opindex fif-conversion -Attempt to transform conditional jumps into branch-less equivalents. This -includes use of conditional moves, min, max, set flags and abs instructions, and -some tricks doable by standard arithmetics. The use of conditional execution -on chips where it is available is controlled by @option{-fif-conversion2}. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fif-conversion2 -@opindex fif-conversion2 -Use conditional execution (where available) to transform conditional jumps into -branch-less equivalents. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fdeclone-ctor-dtor -@opindex fdeclone-ctor-dtor -The C++ ABI requires multiple entry points for constructors and -destructors: one for a base subobject, one for a complete object, and -one for a virtual destructor that calls operator delete afterwards. -For a hierarchy with virtual bases, the base and complete variants are -clones, which means two copies of the function. With this option, the -base and complete variants are changed to be thunks that call a common -implementation. - -Enabled by @option{-Os}. - -@item -fdelete-null-pointer-checks -@opindex fdelete-null-pointer-checks -Assume that programs cannot safely dereference null pointers, and that -no code or data element resides there. This enables simple constant -folding optimizations at all optimization levels. In addition, other -optimization passes in GCC use this flag to control global dataflow -analyses that eliminate useless checks for null pointers; these assume -that if a pointer is checked after it has already been dereferenced, -it cannot be null. - -Note however that in some environments this assumption is not true. -Use @option{-fno-delete-null-pointer-checks} to disable this optimization -for programs that depend on that behavior. - -Some targets, especially embedded ones, disable this option at all levels. -Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, -@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information -are enabled independently at different optimization levels. - -@item -fdevirtualize -@opindex fdevirtualize -Attempt to convert calls to virtual functions to direct calls. This -is done both within a procedure and interprocedurally as part of -indirect inlining (@option{-findirect-inlining}) and interprocedural constant -propagation (@option{-fipa-cp}). -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fdevirtualize-speculatively -@opindex fdevirtualize-speculatively -Attempt to convert calls to virtual functions to speculative direct calls. -Based on the analysis of the type inheritance graph, determine for a given call -the set of likely targets. If the set is small, preferably of size 1, change -the call into a conditional deciding between direct and indirect calls. The -speculative calls enable more optimizations, such as inlining. When they seem -useless after further optimization, they are converted back into original form. - -@item -fdevirtualize-at-ltrans -@opindex fdevirtualize-at-ltrans -Stream extra information needed for aggressive devirtualization when running -the link-time optimizer in local transformation mode. -This option enables more devirtualization but -significantly increases the size of streamed data. For this reason it is -disabled by default. - -@item -fexpensive-optimizations -@opindex fexpensive-optimizations -Perform a number of minor optimizations that are relatively expensive. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -free -@opindex free -Attempt to remove redundant extension instructions. This is especially -helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit -registers after writing to their lower 32-bit half. - -Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, -@option{-O3}, @option{-Os}. - -@item -fno-lifetime-dse -@opindex fno-lifetime-dse -In C++ the value of an object is only affected by changes within its -lifetime: when the constructor begins, the object has an indeterminate -value, and any changes during the lifetime of the object are dead when -the object is destroyed. Normally dead store elimination will take -advantage of this; if your code relies on the value of the object -storage persisting beyond the lifetime of the object, you can use this -flag to disable this optimization. - -@item -flive-range-shrinkage -@opindex flive-range-shrinkage -Attempt to decrease register pressure through register live range -shrinkage. This is helpful for fast processors with small or moderate -size register sets. - -@item -fira-algorithm=@var{algorithm} -@opindex fira-algorithm -Use the specified coloring algorithm for the integrated register -allocator. The @var{algorithm} argument can be @samp{priority}, which -specifies Chow's priority coloring, or @samp{CB}, which specifies -Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented -for all architectures, but for those targets that do support it, it is -the default because it generates better code. - -@item -fira-region=@var{region} -@opindex fira-region -Use specified regions for the integrated register allocator. The -@var{region} argument should be one of the following: - -@table @samp - -@item all -Use all loops as register allocation regions. -This can give the best results for machines with a small and/or -irregular register set. - -@item mixed -Use all loops except for loops with small register pressure -as the regions. This value usually gives -the best results in most cases and for most architectures, -and is enabled by default when compiling with optimization for speed -(@option{-O}, @option{-O2}, @dots{}). - -@item one -Use all functions as a single region. -This typically results in the smallest code size, and is enabled by default for -@option{-Os} or @option{-O0}. - -@end table - -@item -fira-hoist-pressure -@opindex fira-hoist-pressure -Use IRA to evaluate register pressure in the code hoisting pass for -decisions to hoist expressions. This option usually results in smaller -code, but it can slow the compiler down. - -This option is enabled at level @option{-Os} for all targets. - -@item -fira-loop-pressure -@opindex fira-loop-pressure -Use IRA to evaluate register pressure in loops for decisions to move -loop invariants. This option usually results in generation -of faster and smaller code on machines with large register files (>= 32 -registers), but it can slow the compiler down. - -This option is enabled at level @option{-O3} for some targets. - -@item -fno-ira-share-save-slots -@opindex fno-ira-share-save-slots -Disable sharing of stack slots used for saving call-used hard -registers living through a call. Each hard register gets a -separate stack slot, and as a result function stack frames are -larger. - -@item -fno-ira-share-spill-slots -@opindex fno-ira-share-spill-slots -Disable sharing of stack slots allocated for pseudo-registers. Each -pseudo-register that does not get a hard register gets a separate -stack slot, and as a result function stack frames are larger. - -@item -fira-verbose=@var{n} -@opindex fira-verbose -Control the verbosity of the dump file for the integrated register allocator. -The default value is 5. If the value @var{n} is greater or equal to 10, -the dump output is sent to stderr using the same format as @var{n} minus 10. - -@item -flra-remat -@opindex flra-remat -Enable CFG-sensitive rematerialization in LRA. Instead of loading -values of spilled pseudos, LRA tries to rematerialize (recalculate) -values if it is profitable. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fdelayed-branch -@opindex fdelayed-branch -If supported for the target machine, attempt to reorder instructions -to exploit instruction slots available after delayed branch -instructions. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fschedule-insns -@opindex fschedule-insns -If supported for the target machine, attempt to reorder instructions to -eliminate execution stalls due to required data being unavailable. This -helps machines that have slow floating point or memory load instructions -by allowing other instructions to be issued until the result of the load -or floating-point instruction is required. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -fschedule-insns2 -@opindex fschedule-insns2 -Similar to @option{-fschedule-insns}, but requests an additional pass of -instruction scheduling after register allocation has been done. This is -especially useful on machines with a relatively small number of -registers and where memory load instructions take more than one cycle. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fno-sched-interblock -@opindex fno-sched-interblock -Don't schedule instructions across basic blocks. This is normally -enabled by default when scheduling before register allocation, i.e.@: -with @option{-fschedule-insns} or at @option{-O2} or higher. - -@item -fno-sched-spec -@opindex fno-sched-spec -Don't allow speculative motion of non-load instructions. This is normally -enabled by default when scheduling before register allocation, i.e.@: -with @option{-fschedule-insns} or at @option{-O2} or higher. - -@item -fsched-pressure -@opindex fsched-pressure -Enable register pressure sensitive insn scheduling before register -allocation. This only makes sense when scheduling before register -allocation is enabled, i.e.@: with @option{-fschedule-insns} or at -@option{-O2} or higher. Usage of this option can improve the -generated code and decrease its size by preventing register pressure -increase above the number of available hard registers and subsequent -spills in register allocation. - -@item -fsched-spec-load -@opindex fsched-spec-load -Allow speculative motion of some load instructions. This only makes -sense when scheduling before register allocation, i.e.@: with -@option{-fschedule-insns} or at @option{-O2} or higher. - -@item -fsched-spec-load-dangerous -@opindex fsched-spec-load-dangerous -Allow speculative motion of more load instructions. This only makes -sense when scheduling before register allocation, i.e.@: with -@option{-fschedule-insns} or at @option{-O2} or higher. - -@item -fsched-stalled-insns -@itemx -fsched-stalled-insns=@var{n} -@opindex fsched-stalled-insns -Define how many insns (if any) can be moved prematurely from the queue -of stalled insns into the ready list during the second scheduling pass. -@option{-fno-sched-stalled-insns} means that no insns are moved -prematurely, @option{-fsched-stalled-insns=0} means there is no limit -on how many queued insns can be moved prematurely. -@option{-fsched-stalled-insns} without a value is equivalent to -@option{-fsched-stalled-insns=1}. - -@item -fsched-stalled-insns-dep -@itemx -fsched-stalled-insns-dep=@var{n} -@opindex fsched-stalled-insns-dep -Define how many insn groups (cycles) are examined for a dependency -on a stalled insn that is a candidate for premature removal from the queue -of stalled insns. This has an effect only during the second scheduling pass, -and only if @option{-fsched-stalled-insns} is used. -@option{-fno-sched-stalled-insns-dep} is equivalent to -@option{-fsched-stalled-insns-dep=0}. -@option{-fsched-stalled-insns-dep} without a value is equivalent to -@option{-fsched-stalled-insns-dep=1}. - -@item -fsched2-use-superblocks -@opindex fsched2-use-superblocks -When scheduling after register allocation, use superblock scheduling. -This allows motion across basic block boundaries, -resulting in faster schedules. This option is experimental, as not all machine -descriptions used by GCC model the CPU closely enough to avoid unreliable -results from the algorithm. - -This only makes sense when scheduling after register allocation, i.e.@: with -@option{-fschedule-insns2} or at @option{-O2} or higher. - -@item -fsched-group-heuristic -@opindex fsched-group-heuristic -Enable the group heuristic in the scheduler. This heuristic favors -the instruction that belongs to a schedule group. This is enabled -by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} -or @option{-fschedule-insns2} or at @option{-O2} or higher. - -@item -fsched-critical-path-heuristic -@opindex fsched-critical-path-heuristic -Enable the critical-path heuristic in the scheduler. This heuristic favors -instructions on the critical path. This is enabled by default when -scheduling is enabled, i.e.@: with @option{-fschedule-insns} -or @option{-fschedule-insns2} or at @option{-O2} or higher. - -@item -fsched-spec-insn-heuristic -@opindex fsched-spec-insn-heuristic -Enable the speculative instruction heuristic in the scheduler. This -heuristic favors speculative instructions with greater dependency weakness. -This is enabled by default when scheduling is enabled, i.e.@: -with @option{-fschedule-insns} or @option{-fschedule-insns2} -or at @option{-O2} or higher. - -@item -fsched-rank-heuristic -@opindex fsched-rank-heuristic -Enable the rank heuristic in the scheduler. This heuristic favors -the instruction belonging to a basic block with greater size or frequency. -This is enabled by default when scheduling is enabled, i.e.@: -with @option{-fschedule-insns} or @option{-fschedule-insns2} or -at @option{-O2} or higher. - -@item -fsched-last-insn-heuristic -@opindex fsched-last-insn-heuristic -Enable the last-instruction heuristic in the scheduler. This heuristic -favors the instruction that is less dependent on the last instruction -scheduled. This is enabled by default when scheduling is enabled, -i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or -at @option{-O2} or higher. - -@item -fsched-dep-count-heuristic -@opindex fsched-dep-count-heuristic -Enable the dependent-count heuristic in the scheduler. This heuristic -favors the instruction that has more instructions depending on it. -This is enabled by default when scheduling is enabled, i.e.@: -with @option{-fschedule-insns} or @option{-fschedule-insns2} or -at @option{-O2} or higher. - -@item -freschedule-modulo-scheduled-loops -@opindex freschedule-modulo-scheduled-loops -Modulo scheduling is performed before traditional scheduling. If a loop -is modulo scheduled, later scheduling passes may change its schedule. -Use this option to control that behavior. - -@item -fselective-scheduling -@opindex fselective-scheduling -Schedule instructions using selective scheduling algorithm. Selective -scheduling runs instead of the first scheduler pass. - -@item -fselective-scheduling2 -@opindex fselective-scheduling2 -Schedule instructions using selective scheduling algorithm. Selective -scheduling runs instead of the second scheduler pass. - -@item -fsel-sched-pipelining -@opindex fsel-sched-pipelining -Enable software pipelining of innermost loops during selective scheduling. -This option has no effect unless one of @option{-fselective-scheduling} or -@option{-fselective-scheduling2} is turned on. - -@item -fsel-sched-pipelining-outer-loops -@opindex fsel-sched-pipelining-outer-loops -When pipelining loops during selective scheduling, also pipeline outer loops. -This option has no effect unless @option{-fsel-sched-pipelining} is turned on. - -@item -fsemantic-interposition -@opindex fsemantic-interposition -Some object formats, like ELF, allow interposing of symbols by the -dynamic linker. -This means that for symbols exported from the DSO, the compiler cannot perform -interprocedural propagation, inlining and other optimizations in anticipation -that the function or variable in question may change. While this feature is -useful, for example, to rewrite memory allocation functions by a debugging -implementation, it is expensive in the terms of code quality. -With @option{-fno-semantic-interposition} the compiler assumes that -if interposition happens for functions the overwriting function will have -precisely the same semantics (and side effects). -Similarly if interposition happens -for variables, the constructor of the variable will be the same. The flag -has no effect for functions explicitly declared inline -(where it is never allowed for interposition to change semantics) -and for symbols explicitly declared weak. - -@item -fshrink-wrap -@opindex fshrink-wrap -Emit function prologues only before parts of the function that need it, -rather than at the top of the function. This flag is enabled by default at -@option{-O} and higher. - -@item -fcaller-saves -@opindex fcaller-saves -Enable allocation of values to registers that are clobbered by -function calls, by emitting extra instructions to save and restore the -registers around such calls. Such allocation is done only when it -seems to result in better code. - -This option is always enabled by default on certain machines, usually -those which have no call-preserved registers to use instead. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fcombine-stack-adjustments -@opindex fcombine-stack-adjustments -Tracks stack adjustments (pushes and pops) and stack memory references -and then tries to find ways to combine them. - -Enabled by default at @option{-O1} and higher. - -@item -fipa-ra -@opindex fipa-ra -Use caller save registers for allocation if those registers are not used by -any called function. In that case it is not necessary to save and restore -them around calls. This is only possible if called functions are part of -same compilation unit as current function and they are compiled before it. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fconserve-stack -@opindex fconserve-stack -Attempt to minimize stack usage. The compiler attempts to use less -stack space, even if that makes the program slower. This option -implies setting the @option{large-stack-frame} parameter to 100 -and the @option{large-stack-frame-growth} parameter to 400. - -@item -ftree-reassoc -@opindex ftree-reassoc -Perform reassociation on trees. This flag is enabled by default -at @option{-O} and higher. - -@item -ftree-pre -@opindex ftree-pre -Perform partial redundancy elimination (PRE) on trees. This flag is -enabled by default at @option{-O2} and @option{-O3}. - -@item -ftree-partial-pre -@opindex ftree-partial-pre -Make partial redundancy elimination (PRE) more aggressive. This flag is -enabled by default at @option{-O3}. - -@item -ftree-forwprop -@opindex ftree-forwprop -Perform forward propagation on trees. This flag is enabled by default -at @option{-O} and higher. - -@item -ftree-fre -@opindex ftree-fre -Perform full redundancy elimination (FRE) on trees. The difference -between FRE and PRE is that FRE only considers expressions -that are computed on all paths leading to the redundant computation. -This analysis is faster than PRE, though it exposes fewer redundancies. -This flag is enabled by default at @option{-O} and higher. - -@item -ftree-phiprop -@opindex ftree-phiprop -Perform hoisting of loads from conditional pointers on trees. This -pass is enabled by default at @option{-O} and higher. - -@item -fhoist-adjacent-loads -@opindex fhoist-adjacent-loads -Speculatively hoist loads from both branches of an if-then-else if the -loads are from adjacent locations in the same structure and the target -architecture has a conditional move instruction. This flag is enabled -by default at @option{-O2} and higher. - -@item -ftree-copy-prop -@opindex ftree-copy-prop -Perform copy propagation on trees. This pass eliminates unnecessary -copy operations. This flag is enabled by default at @option{-O} and -higher. - -@item -fipa-pure-const -@opindex fipa-pure-const -Discover which functions are pure or constant. -Enabled by default at @option{-O} and higher. - -@item -fipa-reference -@opindex fipa-reference -Discover which static variables do not escape the -compilation unit. -Enabled by default at @option{-O} and higher. - -@item -fipa-pta -@opindex fipa-pta -Perform interprocedural pointer analysis and interprocedural modification -and reference analysis. This option can cause excessive memory and -compile-time usage on large compilation units. It is not enabled by -default at any optimization level. - -@item -fipa-profile -@opindex fipa-profile -Perform interprocedural profile propagation. The functions called only from -cold functions are marked as cold. Also functions executed once (such as -@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold -functions and loop less parts of functions executed once are then optimized for -size. -Enabled by default at @option{-O} and higher. - -@item -fipa-cp -@opindex fipa-cp -Perform interprocedural constant propagation. -This optimization analyzes the program to determine when values passed -to functions are constants and then optimizes accordingly. -This optimization can substantially increase performance -if the application has constants passed to functions. -This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. - -@item -fipa-cp-clone -@opindex fipa-cp-clone -Perform function cloning to make interprocedural constant propagation stronger. -When enabled, interprocedural constant propagation performs function cloning -when externally visible function can be called with constant arguments. -Because this optimization can create multiple copies of functions, -it may significantly increase code size -(see @option{--param ipcp-unit-growth=@var{value}}). -This flag is enabled by default at @option{-O3}. - -@item -fipa-cp-alignment -@opindex -fipa-cp-alignment -When enabled, this optimization propagates alignment of function -parameters to support better vectorization and string operations. - -This flag is enabled by default at @option{-O2} and @option{-Os}. It -requires that @option{-fipa-cp} is enabled. - -@item -fipa-icf -@opindex fipa-icf -Perform Identical Code Folding for functions and read-only variables. -The optimization reduces code size and may disturb unwind stacks by replacing -a function by equivalent one with a different name. The optimization works -more effectively with link time optimization enabled. - -Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF -works on different levels and thus the optimizations are not same - there are -equivalences that are found only by GCC and equivalences found only by Gold. - -This flag is enabled by default at @option{-O2} and @option{-Os}. - -@item -fisolate-erroneous-paths-dereference -@opindex fisolate-erroneous-paths-dereference -Detect paths that trigger erroneous or undefined behavior due to -dereferencing a null pointer. Isolate those paths from the main control -flow and turn the statement with erroneous or undefined behavior into a trap. -This flag is enabled by default at @option{-O2} and higher. - -@item -fisolate-erroneous-paths-attribute -@opindex fisolate-erroneous-paths-attribute -Detect paths that trigger erroneous or undefined behavior due a null value -being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} -attribute. Isolate those paths from the main control flow and turn the -statement with erroneous or undefined behavior into a trap. This is not -currently enabled, but may be enabled by @option{-O2} in the future. - -@item -ftree-sink -@opindex ftree-sink -Perform forward store motion on trees. This flag is -enabled by default at @option{-O} and higher. - -@item -ftree-bit-ccp -@opindex ftree-bit-ccp -Perform sparse conditional bit constant propagation on trees and propagate -pointer alignment information. -This pass only operates on local scalar variables and is enabled by default -at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. - -@item -ftree-ccp -@opindex ftree-ccp -Perform sparse conditional constant propagation (CCP) on trees. This -pass only operates on local scalar variables and is enabled by default -at @option{-O} and higher. - -@item -fssa-phiopt -@opindex fssa-phiopt -Perform pattern matching on SSA PHI nodes to optimize conditional -code. This pass is enabled by default at @option{-O} and higher. - -@item -ftree-switch-conversion -@opindex ftree-switch-conversion -Perform conversion of simple initializations in a switch to -initializations from a scalar array. This flag is enabled by default -at @option{-O2} and higher. - -@item -ftree-tail-merge -@opindex ftree-tail-merge -Look for identical code sequences. When found, replace one with a jump to the -other. This optimization is known as tail merging or cross jumping. This flag -is enabled by default at @option{-O2} and higher. The compilation time -in this pass can -be limited using @option{max-tail-merge-comparisons} parameter and -@option{max-tail-merge-iterations} parameter. - -@item -ftree-dce -@opindex ftree-dce -Perform dead code elimination (DCE) on trees. This flag is enabled by -default at @option{-O} and higher. - -@item -ftree-builtin-call-dce -@opindex ftree-builtin-call-dce -Perform conditional dead code elimination (DCE) for calls to built-in functions -that may set @code{errno} but are otherwise side-effect free. This flag is -enabled by default at @option{-O2} and higher if @option{-Os} is not also -specified. - -@item -ftree-dominator-opts -@opindex ftree-dominator-opts -Perform a variety of simple scalar cleanups (constant/copy -propagation, redundancy elimination, range propagation and expression -simplification) based on a dominator tree traversal. This also -performs jump threading (to reduce jumps to jumps). This flag is -enabled by default at @option{-O} and higher. - -@item -ftree-dse -@opindex ftree-dse -Perform dead store elimination (DSE) on trees. A dead store is a store into -a memory location that is later overwritten by another store without -any intervening loads. In this case the earlier store can be deleted. This -flag is enabled by default at @option{-O} and higher. - -@item -ftree-ch -@opindex ftree-ch -Perform loop header copying on trees. This is beneficial since it increases -effectiveness of code motion optimizations. It also saves one jump. This flag -is enabled by default at @option{-O} and higher. It is not enabled -for @option{-Os}, since it usually increases code size. - -@item -ftree-loop-optimize -@opindex ftree-loop-optimize -Perform loop optimizations on trees. This flag is enabled by default -at @option{-O} and higher. - -@item -ftree-loop-linear -@opindex ftree-loop-linear -Perform loop interchange transformations on tree. Same as -@option{-floop-interchange}. To use this code transformation, GCC has -to be configured with @option{--with-isl} to enable the Graphite loop -transformation infrastructure. - -@item -floop-interchange -@opindex floop-interchange -Perform loop interchange transformations on loops. Interchanging two -nested loops switches the inner and outer loops. For example, given a -loop like: -@smallexample -DO J = 1, M - DO I = 1, N - A(J, I) = A(J, I) * C - ENDDO -ENDDO -@end smallexample -@noindent -loop interchange transforms the loop as if it were written: -@smallexample -DO I = 1, N - DO J = 1, M - A(J, I) = A(J, I) * C - ENDDO -ENDDO -@end smallexample -which can be beneficial when @code{N} is larger than the caches, -because in Fortran, the elements of an array are stored in memory -contiguously by column, and the original loop iterates over rows, -potentially creating at each access a cache miss. This optimization -applies to all the languages supported by GCC and is not limited to -Fortran. To use this code transformation, GCC has to be configured -with @option{--with-isl} to enable the Graphite loop transformation -infrastructure. - -@item -floop-strip-mine -@opindex floop-strip-mine -Perform loop strip mining transformations on loops. Strip mining -splits a loop into two nested loops. The outer loop has strides -equal to the strip size and the inner loop has strides of the -original loop within a strip. The strip length can be changed -using the @option{loop-block-tile-size} parameter. For example, -given a loop like: -@smallexample -DO I = 1, N - A(I) = A(I) + C -ENDDO -@end smallexample -@noindent -loop strip mining transforms the loop as if it were written: -@smallexample -DO II = 1, N, 51 - DO I = II, min (II + 50, N) - A(I) = A(I) + C - ENDDO -ENDDO -@end smallexample -This optimization applies to all the languages supported by GCC and is -not limited to Fortran. To use this code transformation, GCC has to -be configured with @option{--with-isl} to enable the Graphite loop -transformation infrastructure. - -@item -floop-block -@opindex floop-block -Perform loop blocking transformations on loops. Blocking strip mines -each loop in the loop nest such that the memory accesses of the -element loops fit inside caches. The strip length can be changed -using the @option{loop-block-tile-size} parameter. For example, given -a loop like: -@smallexample -DO I = 1, N - DO J = 1, M - A(J, I) = B(I) + C(J) - ENDDO -ENDDO -@end smallexample -@noindent -loop blocking transforms the loop as if it were written: -@smallexample -DO II = 1, N, 51 - DO JJ = 1, M, 51 - DO I = II, min (II + 50, N) - DO J = JJ, min (JJ + 50, M) - A(J, I) = B(I) + C(J) - ENDDO - ENDDO - ENDDO -ENDDO -@end smallexample -which can be beneficial when @code{M} is larger than the caches, -because the innermost loop iterates over a smaller amount of data -which can be kept in the caches. This optimization applies to all the -languages supported by GCC and is not limited to Fortran. To use this -code transformation, GCC has to be configured with @option{--with-isl} -to enable the Graphite loop transformation infrastructure. - -@item -fgraphite-identity -@opindex fgraphite-identity -Enable the identity transformation for graphite. For every SCoP we generate -the polyhedral representation and transform it back to gimple. Using -@option{-fgraphite-identity} we can check the costs or benefits of the -GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations -are also performed by the code generator ISL, like index splitting and -dead code elimination in loops. - -@item -floop-nest-optimize -@opindex floop-nest-optimize -Enable the ISL based loop nest optimizer. This is a generic loop nest -optimizer based on the Pluto optimization algorithms. It calculates a loop -structure optimized for data-locality and parallelism. This option -is experimental. - -@item -floop-unroll-and-jam -@opindex floop-unroll-and-jam -Enable unroll and jam for the ISL based loop nest optimizer. The unroll -factor can be changed using the @option{loop-unroll-jam-size} parameter. -The unrolled dimension (counting from the most inner one) can be changed -using the @option{loop-unroll-jam-depth} parameter. . - -@item -floop-parallelize-all -@opindex floop-parallelize-all -Use the Graphite data dependence analysis to identify loops that can -be parallelized. Parallelize all the loops that can be analyzed to -not contain loop carried dependences without checking that it is -profitable to parallelize the loops. - -@item -fcheck-data-deps -@opindex fcheck-data-deps -Compare the results of several data dependence analyzers. This option -is used for debugging the data dependence analyzers. - -@item -ftree-loop-if-convert -@opindex ftree-loop-if-convert -Attempt to transform conditional jumps in the innermost loops to -branch-less equivalents. The intent is to remove control-flow from -the innermost loops in order to improve the ability of the -vectorization pass to handle these loops. This is enabled by default -if vectorization is enabled. - -@item -ftree-loop-if-convert-stores -@opindex ftree-loop-if-convert-stores -Attempt to also if-convert conditional jumps containing memory writes. -This transformation can be unsafe for multi-threaded programs as it -transforms conditional memory writes into unconditional memory writes. -For example, -@smallexample -for (i = 0; i < N; i++) - if (cond) - A[i] = expr; -@end smallexample -is transformed to -@smallexample -for (i = 0; i < N; i++) - A[i] = cond ? expr : A[i]; -@end smallexample -potentially producing data races. - -@item -ftree-loop-distribution -@opindex ftree-loop-distribution -Perform loop distribution. This flag can improve cache performance on -big loop bodies and allow further loop optimizations, like -parallelization or vectorization, to take place. For example, the loop -@smallexample -DO I = 1, N - A(I) = B(I) + C - D(I) = E(I) * F -ENDDO -@end smallexample -is transformed to -@smallexample -DO I = 1, N - A(I) = B(I) + C -ENDDO -DO I = 1, N - D(I) = E(I) * F -ENDDO -@end smallexample - -@item -ftree-loop-distribute-patterns -@opindex ftree-loop-distribute-patterns -Perform loop distribution of patterns that can be code generated with -calls to a library. This flag is enabled by default at @option{-O3}. - -This pass distributes the initialization loops and generates a call to -memset zero. For example, the loop -@smallexample -DO I = 1, N - A(I) = 0 - B(I) = A(I) + I -ENDDO -@end smallexample -is transformed to -@smallexample -DO I = 1, N - A(I) = 0 -ENDDO -DO I = 1, N - B(I) = A(I) + I -ENDDO -@end smallexample -and the initialization loop is transformed into a call to memset zero. - -@item -ftree-loop-im -@opindex ftree-loop-im -Perform loop invariant motion on trees. This pass moves only invariants that -are hard to handle at RTL level (function calls, operations that expand to -nontrivial sequences of insns). With @option{-funswitch-loops} it also moves -operands of conditions that are invariant out of the loop, so that we can use -just trivial invariantness analysis in loop unswitching. The pass also includes -store motion. - -@item -ftree-loop-ivcanon -@opindex ftree-loop-ivcanon -Create a canonical counter for number of iterations in loops for which -determining number of iterations requires complicated analysis. Later -optimizations then may determine the number easily. Useful especially -in connection with unrolling. - -@item -fivopts -@opindex fivopts -Perform induction variable optimizations (strength reduction, induction -variable merging and induction variable elimination) on trees. - -@item -ftree-parallelize-loops=n -@opindex ftree-parallelize-loops -Parallelize loops, i.e., split their iteration space to run in n threads. -This is only possible for loops whose iterations are independent -and can be arbitrarily reordered. The optimization is only -profitable on multiprocessor machines, for loops that are CPU-intensive, -rather than constrained e.g.@: by memory bandwidth. This option -implies @option{-pthread}, and thus is only supported on targets -that have support for @option{-pthread}. - -@item -ftree-pta -@opindex ftree-pta -Perform function-local points-to analysis on trees. This flag is -enabled by default at @option{-O} and higher. - -@item -ftree-sra -@opindex ftree-sra -Perform scalar replacement of aggregates. This pass replaces structure -references with scalars to prevent committing structures to memory too -early. This flag is enabled by default at @option{-O} and higher. - -@item -ftree-copyrename -@opindex ftree-copyrename -Perform copy renaming on trees. This pass attempts to rename compiler -temporaries to other variables at copy locations, usually resulting in -variable names which more closely resemble the original variables. This flag -is enabled by default at @option{-O} and higher. - -@item -ftree-coalesce-inlined-vars -@opindex ftree-coalesce-inlined-vars -Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to -combine small user-defined variables too, but only if they are inlined -from other functions. It is a more limited form of -@option{-ftree-coalesce-vars}. This may harm debug information of such -inlined variables, but it keeps variables of the inlined-into -function apart from each other, such that they are more likely to -contain the expected values in a debugging session. - -@item -ftree-coalesce-vars -@opindex ftree-coalesce-vars -Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to -combine small user-defined variables too, instead of just compiler -temporaries. This may severely limit the ability to debug an optimized -program compiled with @option{-fno-var-tracking-assignments}. In the -negated form, this flag prevents SSA coalescing of user variables, -including inlined ones. This option is enabled by default. - -@item -ftree-ter -@opindex ftree-ter -Perform temporary expression replacement during the SSA->normal phase. Single -use/single def temporaries are replaced at their use location with their -defining expression. This results in non-GIMPLE code, but gives the expanders -much more complex trees to work on resulting in better RTL generation. This is -enabled by default at @option{-O} and higher. - -@item -ftree-slsr -@opindex ftree-slsr -Perform straight-line strength reduction on trees. This recognizes related -expressions involving multiplications and replaces them by less expensive -calculations when possible. This is enabled by default at @option{-O} and -higher. - -@item -ftree-vectorize -@opindex ftree-vectorize -Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} -and @option{-ftree-slp-vectorize} if not explicitly specified. - -@item -ftree-loop-vectorize -@opindex ftree-loop-vectorize -Perform loop vectorization on trees. This flag is enabled by default at -@option{-O3} and when @option{-ftree-vectorize} is enabled. - -@item -ftree-slp-vectorize -@opindex ftree-slp-vectorize -Perform basic block vectorization on trees. This flag is enabled by default at -@option{-O3} and when @option{-ftree-vectorize} is enabled. - -@item -fvect-cost-model=@var{model} -@opindex fvect-cost-model -Alter the cost model used for vectorization. The @var{model} argument -should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. -With the @samp{unlimited} model the vectorized code-path is assumed -to be profitable while with the @samp{dynamic} model a runtime check -guards the vectorized code-path to enable it only for iteration -counts that will likely execute faster than when executing the original -scalar loop. The @samp{cheap} model disables vectorization of -loops where doing so would be cost prohibitive for example due to -required runtime checks for data dependence or alignment but otherwise -is equal to the @samp{dynamic} model. -The default cost model depends on other optimization flags and is -either @samp{dynamic} or @samp{cheap}. - -@item -fsimd-cost-model=@var{model} -@opindex fsimd-cost-model -Alter the cost model used for vectorization of loops marked with the OpenMP -or Cilk Plus simd directive. The @var{model} argument should be one of -@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} -have the same meaning as described in @option{-fvect-cost-model} and by -default a cost model defined with @option{-fvect-cost-model} is used. - -@item -ftree-vrp -@opindex ftree-vrp -Perform Value Range Propagation on trees. This is similar to the -constant propagation pass, but instead of values, ranges of values are -propagated. This allows the optimizers to remove unnecessary range -checks like array bound checks and null pointer checks. This is -enabled by default at @option{-O2} and higher. Null pointer check -elimination is only done if @option{-fdelete-null-pointer-checks} is -enabled. - -@item -fsplit-ivs-in-unroller -@opindex fsplit-ivs-in-unroller -Enables expression of values of induction variables in later iterations -of the unrolled loop using the value in the first iteration. This breaks -long dependency chains, thus improving efficiency of the scheduling passes. - -A combination of @option{-fweb} and CSE is often sufficient to obtain the -same effect. However, that is not reliable in cases where the loop body -is more complicated than a single basic block. It also does not work at all -on some architectures due to restrictions in the CSE pass. - -This optimization is enabled by default. - -@item -fvariable-expansion-in-unroller -@opindex fvariable-expansion-in-unroller -With this option, the compiler creates multiple copies of some -local variables when unrolling a loop, which can result in superior code. - -@item -fpartial-inlining -@opindex fpartial-inlining -Inline parts of functions. This option has any effect only -when inlining itself is turned on by the @option{-finline-functions} -or @option{-finline-small-functions} options. - -Enabled at level @option{-O2}. - -@item -fpredictive-commoning -@opindex fpredictive-commoning -Perform predictive commoning optimization, i.e., reusing computations -(especially memory loads and stores) performed in previous -iterations of loops. - -This option is enabled at level @option{-O3}. - -@item -fprefetch-loop-arrays -@opindex fprefetch-loop-arrays -If supported by the target machine, generate instructions to prefetch -memory to improve the performance of loops that access large arrays. - -This option may generate better or worse code; results are highly -dependent on the structure of loops within the source code. - -Disabled at level @option{-Os}. - -@item -fno-peephole -@itemx -fno-peephole2 -@opindex fno-peephole -@opindex fno-peephole2 -Disable any machine-specific peephole optimizations. The difference -between @option{-fno-peephole} and @option{-fno-peephole2} is in how they -are implemented in the compiler; some targets use one, some use the -other, a few use both. - -@option{-fpeephole} is enabled by default. -@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fno-guess-branch-probability -@opindex fno-guess-branch-probability -Do not guess branch probabilities using heuristics. - -GCC uses heuristics to guess branch probabilities if they are -not provided by profiling feedback (@option{-fprofile-arcs}). These -heuristics are based on the control flow graph. If some branch probabilities -are specified by @code{__builtin_expect}, then the heuristics are -used to guess branch probabilities for the rest of the control flow graph, -taking the @code{__builtin_expect} info into account. The interactions -between the heuristics and @code{__builtin_expect} can be complex, and in -some cases, it may be useful to disable the heuristics so that the effects -of @code{__builtin_expect} are easier to understand. - -The default is @option{-fguess-branch-probability} at levels -@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -freorder-blocks -@opindex freorder-blocks -Reorder basic blocks in the compiled function in order to reduce number of -taken branches and improve code locality. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -freorder-blocks-and-partition -@opindex freorder-blocks-and-partition -In addition to reordering basic blocks in the compiled function, in order -to reduce number of taken branches, partitions hot and cold basic blocks -into separate sections of the assembly and .o files, to improve -paging and cache locality performance. - -This optimization is automatically turned off in the presence of -exception handling, for linkonce sections, for functions with a user-defined -section attribute and on any architecture that does not support named -sections. - -Enabled for x86 at levels @option{-O2}, @option{-O3}. - -@item -freorder-functions -@opindex freorder-functions -Reorder functions in the object file in order to -improve code locality. This is implemented by using special -subsections @code{.text.hot} for most frequently executed functions and -@code{.text.unlikely} for unlikely executed functions. Reordering is done by -the linker so object file format must support named sections and linker must -place them in a reasonable way. - -Also profile feedback must be available to make this option effective. See -@option{-fprofile-arcs} for details. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fstrict-aliasing -@opindex fstrict-aliasing -Allow the compiler to assume the strictest aliasing rules applicable to -the language being compiled. For C (and C++), this activates -optimizations based on the type of expressions. In particular, an -object of one type is assumed never to reside at the same address as an -object of a different type, unless the types are almost the same. For -example, an @code{unsigned int} can alias an @code{int}, but not a -@code{void*} or a @code{double}. A character type may alias any other -type. - -@anchor{Type-punning}Pay special attention to code like this: -@smallexample -union a_union @{ - int i; - double d; -@}; - -int f() @{ - union a_union t; - t.d = 3.0; - return t.i; -@} -@end smallexample -The practice of reading from a different union member than the one most -recently written to (called ``type-punning'') is common. Even with -@option{-fstrict-aliasing}, type-punning is allowed, provided the memory -is accessed through the union type. So, the code above works as -expected. @xref{Structures unions enumerations and bit-fields -implementation}. However, this code might not: -@smallexample -int f() @{ - union a_union t; - int* ip; - t.d = 3.0; - ip = &t.i; - return *ip; -@} -@end smallexample - -Similarly, access by taking the address, casting the resulting pointer -and dereferencing the result has undefined behavior, even if the cast -uses a union type, e.g.: -@smallexample -int f() @{ - double d = 3.0; - return ((union a_union *) &d)->i; -@} -@end smallexample - -The @option{-fstrict-aliasing} option is enabled at levels -@option{-O2}, @option{-O3}, @option{-Os}. - -@item -fstrict-overflow -@opindex fstrict-overflow -Allow the compiler to assume strict signed overflow rules, depending -on the language being compiled. For C (and C++) this means that -overflow when doing arithmetic with signed numbers is undefined, which -means that the compiler may assume that it does not happen. This -permits various optimizations. For example, the compiler assumes -that an expression like @code{i + 10 > i} is always true for -signed @code{i}. This assumption is only valid if signed overflow is -undefined, as the expression is false if @code{i + 10} overflows when -using twos complement arithmetic. When this option is in effect any -attempt to determine whether an operation on signed numbers -overflows must be written carefully to not actually involve overflow. - -This option also allows the compiler to assume strict pointer -semantics: given a pointer to an object, if adding an offset to that -pointer does not produce a pointer to the same object, the addition is -undefined. This permits the compiler to conclude that @code{p + u > -p} is always true for a pointer @code{p} and unsigned integer -@code{u}. This assumption is only valid because pointer wraparound is -undefined, as the expression is false if @code{p + u} overflows using -twos complement arithmetic. - -See also the @option{-fwrapv} option. Using @option{-fwrapv} means -that integer signed overflow is fully defined: it wraps. When -@option{-fwrapv} is used, there is no difference between -@option{-fstrict-overflow} and @option{-fno-strict-overflow} for -integers. With @option{-fwrapv} certain types of overflow are -permitted. For example, if the compiler gets an overflow when doing -arithmetic on constants, the overflowed value can still be used with -@option{-fwrapv}, but not otherwise. - -The @option{-fstrict-overflow} option is enabled at levels -@option{-O2}, @option{-O3}, @option{-Os}. - -@item -falign-functions -@itemx -falign-functions=@var{n} -@opindex falign-functions -Align the start of functions to the next power-of-two greater than -@var{n}, skipping up to @var{n} bytes. For instance, -@option{-falign-functions=32} aligns functions to the next 32-byte -boundary, but @option{-falign-functions=24} aligns to the next -32-byte boundary only if this can be done by skipping 23 bytes or less. - -@option{-fno-align-functions} and @option{-falign-functions=1} are -equivalent and mean that functions are not aligned. - -Some assemblers only support this flag when @var{n} is a power of two; -in that case, it is rounded up. - -If @var{n} is not specified or is zero, use a machine-dependent default. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -falign-labels -@itemx -falign-labels=@var{n} -@opindex falign-labels -Align all branch targets to a power-of-two boundary, skipping up to -@var{n} bytes like @option{-falign-functions}. This option can easily -make code slower, because it must insert dummy operations for when the -branch target is reached in the usual flow of the code. - -@option{-fno-align-labels} and @option{-falign-labels=1} are -equivalent and mean that labels are not aligned. - -If @option{-falign-loops} or @option{-falign-jumps} are applicable and -are greater than this value, then their values are used instead. - -If @var{n} is not specified or is zero, use a machine-dependent default -which is very likely to be @samp{1}, meaning no alignment. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -falign-loops -@itemx -falign-loops=@var{n} -@opindex falign-loops -Align loops to a power-of-two boundary, skipping up to @var{n} bytes -like @option{-falign-functions}. If the loops are -executed many times, this makes up for any execution of the dummy -operations. - -@option{-fno-align-loops} and @option{-falign-loops=1} are -equivalent and mean that loops are not aligned. - -If @var{n} is not specified or is zero, use a machine-dependent default. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -falign-jumps -@itemx -falign-jumps=@var{n} -@opindex falign-jumps -Align branch targets to a power-of-two boundary, for branch targets -where the targets can only be reached by jumping, skipping up to @var{n} -bytes like @option{-falign-functions}. In this case, no dummy operations -need be executed. - -@option{-fno-align-jumps} and @option{-falign-jumps=1} are -equivalent and mean that loops are not aligned. - -If @var{n} is not specified or is zero, use a machine-dependent default. - -Enabled at levels @option{-O2}, @option{-O3}. - -@item -funit-at-a-time -@opindex funit-at-a-time -This option is left for compatibility reasons. @option{-funit-at-a-time} -has no effect, while @option{-fno-unit-at-a-time} implies -@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. - -Enabled by default. - -@item -fno-toplevel-reorder -@opindex fno-toplevel-reorder -Do not reorder top-level functions, variables, and @code{asm} -statements. Output them in the same order that they appear in the -input file. When this option is used, unreferenced static variables -are not removed. This option is intended to support existing code -that relies on a particular ordering. For new code, it is better to -use attributes when possible. - -Enabled at level @option{-O0}. When disabled explicitly, it also implies -@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some -targets. - -@item -fweb -@opindex fweb -Constructs webs as commonly used for register allocation purposes and assign -each web individual pseudo register. This allows the register allocation pass -to operate on pseudos directly, but also strengthens several other optimization -passes, such as CSE, loop optimizer and trivial dead code remover. It can, -however, make debugging impossible, since variables no longer stay in a -``home register''. - -Enabled by default with @option{-funroll-loops}. - -@item -fwhole-program -@opindex fwhole-program -Assume that the current compilation unit represents the whole program being -compiled. All public functions and variables with the exception of @code{main} -and those merged by attribute @code{externally_visible} become static functions -and in effect are optimized more aggressively by interprocedural optimizers. - -This option should not be used in combination with @option{-flto}. -Instead relying on a linker plugin should provide safer and more precise -information. - -@item -flto[=@var{n}] -@opindex flto -This option runs the standard link-time optimizer. When invoked -with source code, it generates GIMPLE (one of GCC's internal -representations) and writes it to special ELF sections in the object -file. When the object files are linked together, all the function -bodies are read from these ELF sections and instantiated as if they -had been part of the same translation unit. - -To use the link-time optimizer, @option{-flto} and optimization -options should be specified at compile time and during the final link. -For example: - -@smallexample -gcc -c -O2 -flto foo.c -gcc -c -O2 -flto bar.c -gcc -o myprog -flto -O2 foo.o bar.o -@end smallexample - -The first two invocations to GCC save a bytecode representation -of GIMPLE into special ELF sections inside @file{foo.o} and -@file{bar.o}. The final invocation reads the GIMPLE bytecode from -@file{foo.o} and @file{bar.o}, merges the two files into a single -internal image, and compiles the result as usual. Since both -@file{foo.o} and @file{bar.o} are merged into a single image, this -causes all the interprocedural analyses and optimizations in GCC to -work across the two files as if they were a single one. This means, -for example, that the inliner is able to inline functions in -@file{bar.o} into functions in @file{foo.o} and vice-versa. - -Another (simpler) way to enable link-time optimization is: - -@smallexample -gcc -o myprog -flto -O2 foo.c bar.c -@end smallexample - -The above generates bytecode for @file{foo.c} and @file{bar.c}, -merges them together into a single GIMPLE representation and optimizes -them as usual to produce @file{myprog}. - -The only important thing to keep in mind is that to enable link-time -optimizations you need to use the GCC driver to perform the link-step. -GCC then automatically performs link-time optimization if any of the -objects involved were compiled with the @option{-flto} command-line option. -You generally -should specify the optimization options to be used for link-time -optimization though GCC tries to be clever at guessing an -optimization level to use from the options used at compile-time -if you fail to specify one at link-time. You can always override -the automatic decision to do link-time optimization at link-time -by passing @option{-fno-lto} to the link command. - -To make whole program optimization effective, it is necessary to make -certain whole program assumptions. The compiler needs to know -what functions and variables can be accessed by libraries and runtime -outside of the link-time optimized unit. When supported by the linker, -the linker plugin (see @option{-fuse-linker-plugin}) passes information -to the compiler about used and externally visible symbols. When -the linker plugin is not available, @option{-fwhole-program} should be -used to allow the compiler to make these assumptions, which leads -to more aggressive optimization decisions. - -When @option{-fuse-linker-plugin} is not enabled then, when a file is -compiled with @option{-flto}, the generated object file is larger than -a regular object file because it contains GIMPLE bytecodes and the usual -final code (see @option{-ffat-lto-objects}. This means that -object files with LTO information can be linked as normal object -files; if @option{-fno-lto} is passed to the linker, no -interprocedural optimizations are applied. Note that when -@option{-fno-fat-lto-objects} is enabled the compile-stage is faster -but you cannot perform a regular, non-LTO link on them. - -Additionally, the optimization flags used to compile individual files -are not necessarily related to those used at link time. For instance, - -@smallexample -gcc -c -O0 -ffat-lto-objects -flto foo.c -gcc -c -O0 -ffat-lto-objects -flto bar.c -gcc -o myprog -O3 foo.o bar.o -@end smallexample - -This produces individual object files with unoptimized assembler -code, but the resulting binary @file{myprog} is optimized at -@option{-O3}. If, instead, the final binary is generated with -@option{-fno-lto}, then @file{myprog} is not optimized. - -When producing the final binary, GCC only -applies link-time optimizations to those files that contain bytecode. -Therefore, you can mix and match object files and libraries with -GIMPLE bytecodes and final object code. GCC automatically selects -which files to optimize in LTO mode and which files to link without -further processing. - -There are some code generation flags preserved by GCC when -generating bytecodes, as they need to be used during the final link -stage. Generally options specified at link-time override those -specified at compile-time. - -If you do not specify an optimization level option @option{-O} at -link-time then GCC computes one based on the optimization levels -used when compiling the object files. The highest optimization -level wins here. - -Currently, the following options and their setting are take from -the first object file that explicitely specified it: -@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, -@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} -and all the @option{-m} target flags. - -Certain ABI changing flags are required to match in all compilation-units -and trying to override this at link-time with a conflicting value -is ignored. This includes options such as @option{-freg-struct-return} -and @option{-fpcc-struct-return}. - -Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, -@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} -are passed through to the link stage and merged conservatively for -conflicting translation units. Specifically -@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take -precedence and for example @option{-ffp-contract=off} takes precedence -over @option{-ffp-contract=fast}. You can override them at linke-time. - -It is recommended that you compile all the files participating in the -same link with the same options and also specify those options at -link time. - -If LTO encounters objects with C linkage declared with incompatible -types in separate translation units to be linked together (undefined -behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be -issued. The behavior is still undefined at run time. Similar -diagnostics may be raised for other languages. - -Another feature of LTO is that it is possible to apply interprocedural -optimizations on files written in different languages: - -@smallexample -gcc -c -flto foo.c -g++ -c -flto bar.cc -gfortran -c -flto baz.f90 -g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran -@end smallexample - -Notice that the final link is done with @command{g++} to get the C++ -runtime libraries and @option{-lgfortran} is added to get the Fortran -runtime libraries. In general, when mixing languages in LTO mode, you -should use the same link command options as when mixing languages in a -regular (non-LTO) compilation. - -If object files containing GIMPLE bytecode are stored in a library archive, say -@file{libfoo.a}, it is possible to extract and use them in an LTO link if you -are using a linker with plugin support. To create static libraries suitable -for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} -and @command{ranlib}; -to show the symbols of object files with GIMPLE bytecode, use -@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} -and @command{nm} have been compiled with plugin support. At link time, use the the -flag @option{-fuse-linker-plugin} to ensure that the library participates in -the LTO optimization process: - -@smallexample -gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo -@end smallexample - -With the linker plugin enabled, the linker extracts the needed -GIMPLE files from @file{libfoo.a} and passes them on to the running GCC -to make them part of the aggregated GIMPLE image to be optimized. - -If you are not using a linker with plugin support and/or do not -enable the linker plugin, then the objects inside @file{libfoo.a} -are extracted and linked as usual, but they do not participate -in the LTO optimization process. In order to make a static library suitable -for both LTO optimization and usual linkage, compile its object files with -@option{-flto} @option{-ffat-lto-objects}. - -Link-time optimizations do not require the presence of the whole program to -operate. If the program does not require any symbols to be exported, it is -possible to combine @option{-flto} and @option{-fwhole-program} to allow -the interprocedural optimizers to use more aggressive assumptions which may -lead to improved optimization opportunities. -Use of @option{-fwhole-program} is not needed when linker plugin is -active (see @option{-fuse-linker-plugin}). - -The current implementation of LTO makes no -attempt to generate bytecode that is portable between different -types of hosts. The bytecode files are versioned and there is a -strict version check, so bytecode files generated in one version of -GCC do not work with an older or newer version of GCC. - -Link-time optimization does not work well with generation of debugging -information. Combining @option{-flto} with -@option{-g} is currently experimental and expected to produce unexpected -results. - -If you specify the optional @var{n}, the optimization and code -generation done at link time is executed in parallel using @var{n} -parallel jobs by utilizing an installed @command{make} program. The -environment variable @env{MAKE} may be used to override the program -used. The default value for @var{n} is 1. - -You can also specify @option{-flto=jobserver} to use GNU make's -job server mode to determine the number of parallel jobs. This -is useful when the Makefile calling GCC is already executing in parallel. -You must prepend a @samp{+} to the command recipe in the parent Makefile -for this to work. This option likely only works if @env{MAKE} is -GNU make. - -@item -flto-partition=@var{alg} -@opindex flto-partition -Specify the partitioning algorithm used by the link-time optimizer. -The value is either @samp{1to1} to specify a partitioning mirroring -the original source files or @samp{balanced} to specify partitioning -into equally sized chunks (whenever possible) or @samp{max} to create -new partition for every symbol where possible. Specifying @samp{none} -as an algorithm disables partitioning and streaming completely. -The default value is @samp{balanced}. While @samp{1to1} can be used -as an workaround for various code ordering issues, the @samp{max} -partitioning is intended for internal testing only. -The value @samp{one} specifies that exactly one partition should be -used while the value @samp{none} bypasses partitioning and executes -the link-time optimization step directly from the WPA phase. - -@item -flto-odr-type-merging -@opindex flto-odr-type-merging -Enable streaming of mangled types names of C++ types and their unification -at linktime. This increases size of LTO object files, but enable -diagnostics about One Definition Rule violations. - -@item -flto-compression-level=@var{n} -@opindex flto-compression-level -This option specifies the level of compression used for intermediate -language written to LTO object files, and is only meaningful in -conjunction with LTO mode (@option{-flto}). Valid -values are 0 (no compression) to 9 (maximum compression). Values -outside this range are clamped to either 0 or 9. If the option is not -given, a default balanced compression setting is used. - -@item -flto-report -@opindex flto-report -Prints a report with internal details on the workings of the link-time -optimizer. The contents of this report vary from version to version. -It is meant to be useful to GCC developers when processing object -files in LTO mode (via @option{-flto}). - -Disabled by default. - -@item -flto-report-wpa -@opindex flto-report-wpa -Like @option{-flto-report}, but only print for the WPA phase of Link -Time Optimization. - -@item -fuse-linker-plugin -@opindex fuse-linker-plugin -Enables the use of a linker plugin during link-time optimization. This -option relies on plugin support in the linker, which is available in gold -or in GNU ld 2.21 or newer. - -This option enables the extraction of object files with GIMPLE bytecode out -of library archives. This improves the quality of optimization by exposing -more code to the link-time optimizer. This information specifies what -symbols can be accessed externally (by non-LTO object or during dynamic -linking). Resulting code quality improvements on binaries (and shared -libraries that use hidden visibility) are similar to @option{-fwhole-program}. -See @option{-flto} for a description of the effect of this flag and how to -use it. - -This option is enabled by default when LTO support in GCC is enabled -and GCC was configured for use with -a linker supporting plugins (GNU ld 2.21 or newer or gold). - -@item -ffat-lto-objects -@opindex ffat-lto-objects -Fat LTO objects are object files that contain both the intermediate language -and the object code. This makes them usable for both LTO linking and normal -linking. This option is effective only when compiling with @option{-flto} -and is ignored at link time. - -@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but -requires the complete toolchain to be aware of LTO. It requires a linker with -linker plugin support for basic functionality. Additionally, -@command{nm}, @command{ar} and @command{ranlib} -need to support linker plugins to allow a full-featured build environment -(capable of building static libraries etc). GCC provides the @command{gcc-ar}, -@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options -to these tools. With non fat LTO makefiles need to be modified to use them. - -The default is @option{-fno-fat-lto-objects} on targets with linker plugin -support. - -@item -fcompare-elim -@opindex fcompare-elim -After register allocation and post-register allocation instruction splitting, -identify arithmetic instructions that compute processor flags similar to a -comparison operation based on that arithmetic. If possible, eliminate the -explicit comparison operation. - -This pass only applies to certain targets that cannot explicitly represent -the comparison operation before register allocation is complete. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fcprop-registers -@opindex fcprop-registers -After register allocation and post-register allocation instruction splitting, -perform a copy-propagation pass to try to reduce scheduling dependencies -and occasionally eliminate the copy. - -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. - -@item -fprofile-correction -@opindex fprofile-correction -Profiles collected using an instrumented binary for multi-threaded programs may -be inconsistent due to missed counter updates. When this option is specified, -GCC uses heuristics to correct or smooth out such inconsistencies. By -default, GCC emits an error message when an inconsistent profile is detected. - -@item -fprofile-dir=@var{path} -@opindex fprofile-dir - -Set the directory to search for the profile data files in to @var{path}. -This option affects only the profile data generated by -@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} -and used by @option{-fprofile-use} and @option{-fbranch-probabilities} -and its related options. Both absolute and relative paths can be used. -By default, GCC uses the current directory as @var{path}, thus the -profile data file appears in the same directory as the object file. - -@item -fprofile-generate -@itemx -fprofile-generate=@var{path} -@opindex fprofile-generate - -Enable options usually used for instrumenting application to produce -profile useful for later recompilation with profile feedback based -optimization. You must use @option{-fprofile-generate} both when -compiling and when linking your program. - -The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}. - -If @var{path} is specified, GCC looks at the @var{path} to find -the profile feedback data files. See @option{-fprofile-dir}. - -@item -fprofile-use -@itemx -fprofile-use=@var{path} -@opindex fprofile-use -Enable profile feedback-directed optimizations, -and the following optimizations -which are generally profitable only with profile feedback available: -@option{-fbranch-probabilities}, @option{-fvpt}, -@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, -@option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}. - -By default, GCC emits an error message if the feedback profiles do not -match the source code. This error can be turned into a warning by using -@option{-Wcoverage-mismatch}. Note this may result in poorly optimized -code. - -If @var{path} is specified, GCC looks at the @var{path} to find -the profile feedback data files. See @option{-fprofile-dir}. - -@item -fauto-profile -@itemx -fauto-profile=@var{path} -@opindex fauto-profile -Enable sampling-based feedback-directed optimizations, -and the following optimizations -which are generally profitable only with profile feedback available: -@option{-fbranch-probabilities}, @option{-fvpt}, -@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, -@option{-ftree-vectorize}, -@option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone}, -@option{-fpredictive-commoning}, @option{-funswitch-loops}, -@option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}. - -@var{path} is the name of a file containing AutoFDO profile information. -If omitted, it defaults to @file{fbdata.afdo} in the current directory. - -Producing an AutoFDO profile data file requires running your program -with the @command{perf} utility on a supported GNU/Linux target system. -For more information, see @uref{https://perf.wiki.kernel.org/}. - -E.g. -@smallexample -perf record -e br_inst_retired:near_taken -b -o perf.data \ - -- your_program -@end smallexample - -Then use the @command{create_gcov} tool to convert the raw profile data -to a format that can be used by GCC.@ You must also supply the -unstripped binary for your program to this tool. -See @uref{https://github.com/google/autofdo}. - -E.g. -@smallexample -create_gcov --binary=your_program.unstripped --profile=perf.data \ - --gcov=profile.afdo -@end smallexample -@end table - -The following options control compiler behavior regarding floating-point -arithmetic. These options trade off between speed and -correctness. All must be specifically enabled. - -@table @gcctabopt -@item -ffloat-store -@opindex ffloat-store -Do not store floating-point variables in registers, and inhibit other -options that might change whether a floating-point value is taken from a -register or memory. - -@cindex floating-point precision -This option prevents undesirable excess precision on machines such as -the 68000 where the floating registers (of the 68881) keep more -precision than a @code{double} is supposed to have. Similarly for the -x86 architecture. For most programs, the excess precision does only -good, but a few programs rely on the precise definition of IEEE floating -point. Use @option{-ffloat-store} for such programs, after modifying -them to store all pertinent intermediate computations into variables. - -@item -fexcess-precision=@var{style} -@opindex fexcess-precision -This option allows further control over excess precision on machines -where floating-point registers have more precision than the IEEE -@code{float} and @code{double} types and the processor does not -support operations rounding to those types. By default, -@option{-fexcess-precision=fast} is in effect; this means that -operations are carried out in the precision of the registers and that -it is unpredictable when rounding to the types specified in the source -code takes place. When compiling C, if -@option{-fexcess-precision=standard} is specified then excess -precision follows the rules specified in ISO C99; in particular, -both casts and assignments cause values to be rounded to their -semantic types (whereas @option{-ffloat-store} only affects -assignments). This option is enabled by default for C if a strict -conformance option such as @option{-std=c99} is used. - -@opindex mfpmath -@option{-fexcess-precision=standard} is not implemented for languages -other than C, and has no effect if -@option{-funsafe-math-optimizations} or @option{-ffast-math} is -specified. On the x86, it also has no effect if @option{-mfpmath=sse} -or @option{-mfpmath=sse+387} is specified; in the former case, IEEE -semantics apply without excess precision, and in the latter, rounding -is unpredictable. - -@item -ffast-math -@opindex ffast-math -Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, -@option{-ffinite-math-only}, @option{-fno-rounding-math}, -@option{-fno-signaling-nans} and @option{-fcx-limited-range}. - -This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. - -This option is not turned on by any @option{-O} option besides -@option{-Ofast} since it can result in incorrect output for programs -that depend on an exact implementation of IEEE or ISO rules/specifications -for math functions. It may, however, yield faster code for programs -that do not require the guarantees of these specifications. - -@item -fno-math-errno -@opindex fno-math-errno -Do not set @code{errno} after calling math functions that are executed -with a single instruction, e.g., @code{sqrt}. A program that relies on -IEEE exceptions for math error handling may want to use this flag -for speed while maintaining IEEE arithmetic compatibility. - -This option is not turned on by any @option{-O} option since -it can result in incorrect output for programs that depend on -an exact implementation of IEEE or ISO rules/specifications for -math functions. It may, however, yield faster code for programs -that do not require the guarantees of these specifications. - -The default is @option{-fmath-errno}. - -On Darwin systems, the math library never sets @code{errno}. There is -therefore no reason for the compiler to consider the possibility that -it might, and @option{-fno-math-errno} is the default. - -@item -funsafe-math-optimizations -@opindex funsafe-math-optimizations - -Allow optimizations for floating-point arithmetic that (a) assume -that arguments and results are valid and (b) may violate IEEE or -ANSI standards. When used at link-time, it may include libraries -or startup files that change the default FPU control word or other -similar optimizations. - -This option is not turned on by any @option{-O} option since -it can result in incorrect output for programs that depend on -an exact implementation of IEEE or ISO rules/specifications for -math functions. It may, however, yield faster code for programs -that do not require the guarantees of these specifications. -Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, -@option{-fassociative-math} and @option{-freciprocal-math}. - -The default is @option{-fno-unsafe-math-optimizations}. - -@item -fassociative-math -@opindex fassociative-math - -Allow re-association of operands in series of floating-point operations. -This violates the ISO C and C++ language standard by possibly changing -computation result. NOTE: re-ordering may change the sign of zero as -well as ignore NaNs and inhibit or create underflow or overflow (and -thus cannot be used on code that relies on rounding behavior like -@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons -and thus may not be used when ordered comparisons are required. -This option requires that both @option{-fno-signed-zeros} and -@option{-fno-trapping-math} be in effect. Moreover, it doesn't make -much sense with @option{-frounding-math}. For Fortran the option -is automatically enabled when both @option{-fno-signed-zeros} and -@option{-fno-trapping-math} are in effect. - -The default is @option{-fno-associative-math}. - -@item -freciprocal-math -@opindex freciprocal-math - -Allow the reciprocal of a value to be used instead of dividing by -the value if this enables optimizations. For example @code{x / y} -can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} -is subject to common subexpression elimination. Note that this loses -precision and increases the number of flops operating on the value. - -The default is @option{-fno-reciprocal-math}. - -@item -ffinite-math-only -@opindex ffinite-math-only -Allow optimizations for floating-point arithmetic that assume -that arguments and results are not NaNs or +-Infs. - -This option is not turned on by any @option{-O} option since -it can result in incorrect output for programs that depend on -an exact implementation of IEEE or ISO rules/specifications for -math functions. It may, however, yield faster code for programs -that do not require the guarantees of these specifications. - -The default is @option{-fno-finite-math-only}. - -@item -fno-signed-zeros -@opindex fno-signed-zeros -Allow optimizations for floating-point arithmetic that ignore the -signedness of zero. IEEE arithmetic specifies the behavior of -distinct +0.0 and @minus{}0.0 values, which then prohibits simplification -of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). -This option implies that the sign of a zero result isn't significant. - -The default is @option{-fsigned-zeros}. - -@item -fno-trapping-math -@opindex fno-trapping-math -Compile code assuming that floating-point operations cannot generate -user-visible traps. These traps include division by zero, overflow, -underflow, inexact result and invalid operation. This option requires -that @option{-fno-signaling-nans} be in effect. Setting this option may -allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. - -This option should never be turned on by any @option{-O} option since -it can result in incorrect output for programs that depend on -an exact implementation of IEEE or ISO rules/specifications for -math functions. - -The default is @option{-ftrapping-math}. - -@item -frounding-math -@opindex frounding-math -Disable transformations and optimizations that assume default floating-point -rounding behavior. This is round-to-zero for all floating point -to integer conversions, and round-to-nearest for all other arithmetic -truncations. This option should be specified for programs that change -the FP rounding mode dynamically, or that may be executed with a -non-default rounding mode. This option disables constant folding of -floating-point expressions at compile time (which may be affected by -rounding mode) and arithmetic transformations that are unsafe in the -presence of sign-dependent rounding modes. - -The default is @option{-fno-rounding-math}. - -This option is experimental and does not currently guarantee to -disable all GCC optimizations that are affected by rounding mode. -Future versions of GCC may provide finer control of this setting -using C99's @code{FENV_ACCESS} pragma. This command-line option -will be used to specify the default state for @code{FENV_ACCESS}. - -@item -fsignaling-nans -@opindex fsignaling-nans -Compile code assuming that IEEE signaling NaNs may generate user-visible -traps during floating-point operations. Setting this option disables -optimizations that may change the number of exceptions visible with -signaling NaNs. This option implies @option{-ftrapping-math}. - -This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to -be defined. - -The default is @option{-fno-signaling-nans}. - -This option is experimental and does not currently guarantee to -disable all GCC optimizations that affect signaling NaN behavior. - -@item -fsingle-precision-constant -@opindex fsingle-precision-constant -Treat floating-point constants as single precision instead of -implicitly converting them to double-precision constants. - -@item -fcx-limited-range -@opindex fcx-limited-range -When enabled, this option states that a range reduction step is not -needed when performing complex division. Also, there is no checking -whether the result of a complex multiplication or division is @code{NaN -+ I*NaN}, with an attempt to rescue the situation in that case. The -default is @option{-fno-cx-limited-range}, but is enabled by -@option{-ffast-math}. - -This option controls the default setting of the ISO C99 -@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to -all languages. - -@item -fcx-fortran-rules -@opindex fcx-fortran-rules -Complex multiplication and division follow Fortran rules. Range -reduction is done as part of complex division, but there is no checking -whether the result of a complex multiplication or division is @code{NaN -+ I*NaN}, with an attempt to rescue the situation in that case. - -The default is @option{-fno-cx-fortran-rules}. - -@end table - -The following options control optimizations that may improve -performance, but are not enabled by any @option{-O} options. This -section includes experimental options that may produce broken code. - -@table @gcctabopt -@item -fbranch-probabilities -@opindex fbranch-probabilities -After running a program compiled with @option{-fprofile-arcs} -(@pxref{Debugging Options,, Options for Debugging Your Program or -@command{gcc}}), you can compile it a second time using -@option{-fbranch-probabilities}, to improve optimizations based on -the number of times each branch was taken. When a program -compiled with @option{-fprofile-arcs} exits, it saves arc execution -counts to a file called @file{@var{sourcename}.gcda} for each source -file. The information in this data file is very dependent on the -structure of the generated code, so you must use the same source code -and the same optimization options for both compilations. - -With @option{-fbranch-probabilities}, GCC puts a -@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. -These can be used to improve optimization. Currently, they are only -used in one place: in @file{reorg.c}, instead of guessing which path a -branch is most likely to take, the @samp{REG_BR_PROB} values are used to -exactly determine which path is taken more often. - -@item -fprofile-values -@opindex fprofile-values -If combined with @option{-fprofile-arcs}, it adds code so that some -data about values of expressions in the program is gathered. - -With @option{-fbranch-probabilities}, it reads back the data gathered -from profiling values of expressions for usage in optimizations. - -Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. - -@item -fprofile-reorder-functions -@opindex fprofile-reorder-functions -Function reordering based on profile instrumentation collects -first time of execution of a function and orders these functions -in ascending order. - -Enabled with @option{-fprofile-use}. - -@item -fvpt -@opindex fvpt -If combined with @option{-fprofile-arcs}, this option instructs the compiler -to add code to gather information about values of expressions. - -With @option{-fbranch-probabilities}, it reads back the data gathered -and actually performs the optimizations based on them. -Currently the optimizations include specialization of division operations -using the knowledge about the value of the denominator. - -@item -frename-registers -@opindex frename-registers -Attempt to avoid false dependencies in scheduled code by making use -of registers left over after register allocation. This optimization -most benefits processors with lots of registers. Depending on the -debug information format adopted by the target, however, it can -make debugging impossible, since variables no longer stay in -a ``home register''. - -Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}. - -@item -fschedule-fusion -@opindex fschedule-fusion -Performs a target dependent pass over the instruction stream to schedule -instructions of same type together because target machine can execute them -more efficiently if they are adjacent to each other in the instruction flow. - -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. - -@item -ftracer -@opindex ftracer -Perform tail duplication to enlarge superblock size. This transformation -simplifies the control flow of the function allowing other optimizations to do -a better job. - -Enabled with @option{-fprofile-use}. - -@item -funroll-loops -@opindex funroll-loops -Unroll loops whose number of iterations can be determined at compile time or -upon entry to the loop. @option{-funroll-loops} implies -@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. -It also turns on complete loop peeling (i.e.@: complete removal of loops with -a small constant number of iterations). This option makes code larger, and may -or may not make it run faster. - -Enabled with @option{-fprofile-use}. - -@item -funroll-all-loops -@opindex funroll-all-loops -Unroll all loops, even if their number of iterations is uncertain when -the loop is entered. This usually makes programs run more slowly. -@option{-funroll-all-loops} implies the same options as -@option{-funroll-loops}. - -@item -fpeel-loops -@opindex fpeel-loops -Peels loops for which there is enough information that they do not -roll much (from profile feedback). It also turns on complete loop peeling -(i.e.@: complete removal of loops with small constant number of iterations). - -Enabled with @option{-fprofile-use}. - -@item -fmove-loop-invariants -@opindex fmove-loop-invariants -Enables the loop invariant motion pass in the RTL loop optimizer. Enabled -at level @option{-O1} - -@item -funswitch-loops -@opindex funswitch-loops -Move branches with loop invariant conditions out of the loop, with duplicates -of the loop on both branches (modified according to result of the condition). - -@item -ffunction-sections -@itemx -fdata-sections -@opindex ffunction-sections -@opindex fdata-sections -Place each function or data item into its own section in the output -file if the target supports arbitrary sections. The name of the -function or the name of the data item determines the section's name -in the output file. - -Use these options on systems where the linker can perform optimizations -to improve locality of reference in the instruction space. Most systems -using the ELF object format and SPARC processors running Solaris 2 have -linkers with such optimizations. AIX may have these optimizations in -the future. - -Only use these options when there are significant benefits from doing -so. When you specify these options, the assembler and linker -create larger object and executable files and are also slower. -You cannot use @command{gprof} on all systems if you -specify this option, and you may have problems with debugging if -you specify both this option and @option{-g}. - -@item -fbranch-target-load-optimize -@opindex fbranch-target-load-optimize -Perform branch target register load optimization before prologue / epilogue -threading. -The use of target registers can typically be exposed only during reload, -thus hoisting loads out of loops and doing inter-block scheduling needs -a separate optimization pass. - -@item -fbranch-target-load-optimize2 -@opindex fbranch-target-load-optimize2 -Perform branch target register load optimization after prologue / epilogue -threading. - -@item -fbtr-bb-exclusive -@opindex fbtr-bb-exclusive -When performing branch target register load optimization, don't reuse -branch target registers within any basic block. - -@item -fstack-protector -@opindex fstack-protector -Emit extra code to check for buffer overflows, such as stack smashing -attacks. This is done by adding a guard variable to functions with -vulnerable objects. This includes functions that call @code{alloca}, and -functions with buffers larger than 8 bytes. The guards are initialized -when a function is entered and then checked when the function exits. -If a guard check fails, an error message is printed and the program exits. - -@item -fstack-protector-all -@opindex fstack-protector-all -Like @option{-fstack-protector} except that all functions are protected. - -@item -fstack-protector-strong -@opindex fstack-protector-strong -Like @option{-fstack-protector} but includes additional functions to -be protected --- those that have local array definitions, or have -references to local frame addresses. - -@item -fstack-protector-explicit -@opindex fstack-protector-explicit -Like @option{-fstack-protector} but only protects those functions which -have the @code{stack_protect} attribute - -@item -fstdarg-opt -@opindex fstdarg-opt -Optimize the prologue of variadic argument functions with respect to usage of -those arguments. - -@item -fsection-anchors -@opindex fsection-anchors -Try to reduce the number of symbolic address calculations by using -shared ``anchor'' symbols to address nearby objects. This transformation -can help to reduce the number of GOT entries and GOT accesses on some -targets. - -For example, the implementation of the following function @code{foo}: - -@smallexample -static int a, b, c; -int foo (void) @{ return a + b + c; @} -@end smallexample - -@noindent -usually calculates the addresses of all three variables, but if you -compile it with @option{-fsection-anchors}, it accesses the variables -from a common anchor point instead. The effect is similar to the -following pseudocode (which isn't valid C): - -@smallexample -int foo (void) -@{ - register int *xr = &x; - return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; -@} -@end smallexample - -Not all targets support this option. - -@item --param @var{name}=@var{value} -@opindex param -In some places, GCC uses various constants to control the amount of -optimization that is done. For example, GCC does not inline functions -that contain more than a certain number of instructions. You can -control some of these constants on the command line using the -@option{--param} option. - -The names of specific parameters, and the meaning of the values, are -tied to the internals of the compiler, and are subject to change -without notice in future releases. - -In each case, the @var{value} is an integer. The allowable choices for -@var{name} are: - -@table @gcctabopt -@item predictable-branch-outcome -When branch is predicted to be taken with probability lower than this threshold -(in percent), then it is considered well predictable. The default is 10. - -@item max-crossjump-edges -The maximum number of incoming edges to consider for cross-jumping. -The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in -the number of edges incoming to each block. Increasing values mean -more aggressive optimization, making the compilation time increase with -probably small improvement in executable size. - -@item min-crossjump-insns -The minimum number of instructions that must be matched at the end -of two blocks before cross-jumping is performed on them. This -value is ignored in the case where all instructions in the block being -cross-jumped from are matched. The default value is 5. - -@item max-grow-copy-bb-insns -The maximum code size expansion factor when copying basic blocks -instead of jumping. The expansion is relative to a jump instruction. -The default value is 8. - -@item max-goto-duplication-insns -The maximum number of instructions to duplicate to a block that jumps -to a computed goto. To avoid @math{O(N^2)} behavior in a number of -passes, GCC factors computed gotos early in the compilation process, -and unfactors them as late as possible. Only computed jumps at the -end of a basic blocks with no more than max-goto-duplication-insns are -unfactored. The default value is 8. - -@item max-delay-slot-insn-search -The maximum number of instructions to consider when looking for an -instruction to fill a delay slot. If more than this arbitrary number of -instructions are searched, the time savings from filling the delay slot -are minimal, so stop searching. Increasing values mean more -aggressive optimization, making the compilation time increase with probably -small improvement in execution time. - -@item max-delay-slot-live-search -When trying to fill delay slots, the maximum number of instructions to -consider when searching for a block with valid live register -information. Increasing this arbitrarily chosen value means more -aggressive optimization, increasing the compilation time. This parameter -should be removed when the delay slot code is rewritten to maintain the -control-flow graph. - -@item max-gcse-memory -The approximate maximum amount of memory that can be allocated in -order to perform the global common subexpression elimination -optimization. If more memory than specified is required, the -optimization is not done. - -@item max-gcse-insertion-ratio -If the ratio of expression insertions to deletions is larger than this value -for any expression, then RTL PRE inserts or removes the expression and thus -leaves partially redundant computations in the instruction stream. The default value is 20. - -@item max-pending-list-length -The maximum number of pending dependencies scheduling allows -before flushing the current state and starting over. Large functions -with few branches or calls can create excessively large lists which -needlessly consume memory and resources. - -@item max-modulo-backtrack-attempts -The maximum number of backtrack attempts the scheduler should make -when modulo scheduling a loop. Larger values can exponentially increase -compilation time. - -@item max-inline-insns-single -Several parameters control the tree inliner used in GCC@. -This number sets the maximum number of instructions (counted in GCC's -internal representation) in a single function that the tree inliner -considers for inlining. This only affects functions declared -inline and methods implemented in a class declaration (C++). -The default value is 400. - -@item max-inline-insns-auto -When you use @option{-finline-functions} (included in @option{-O3}), -a lot of functions that would otherwise not be considered for inlining -by the compiler are investigated. To those functions, a different -(more restrictive) limit compared to functions declared inline can -be applied. -The default value is 40. - -@item inline-min-speedup -When estimated performance improvement of caller + callee runtime exceeds this -threshold (in precent), the function can be inlined regardless the limit on -@option{--param max-inline-insns-single} and @option{--param -max-inline-insns-auto}. - -@item large-function-insns -The limit specifying really large functions. For functions larger than this -limit after inlining, inlining is constrained by -@option{--param large-function-growth}. This parameter is useful primarily -to avoid extreme compilation time caused by non-linear algorithms used by the -back end. -The default value is 2700. - -@item large-function-growth -Specifies maximal growth of large function caused by inlining in percents. -The default value is 100 which limits large function growth to 2.0 times -the original size. - -@item large-unit-insns -The limit specifying large translation unit. Growth caused by inlining of -units larger than this limit is limited by @option{--param inline-unit-growth}. -For small units this might be too tight. -For example, consider a unit consisting of function A -that is inline and B that just calls A three times. If B is small relative to -A, the growth of unit is 300\% and yet such inlining is very sane. For very -large units consisting of small inlineable functions, however, the overall unit -growth limit is needed to avoid exponential explosion of code size. Thus for -smaller units, the size is increased to @option{--param large-unit-insns} -before applying @option{--param inline-unit-growth}. The default is 10000. - -@item inline-unit-growth -Specifies maximal overall growth of the compilation unit caused by inlining. -The default value is 15 which limits unit growth to 1.15 times the original -size. Cold functions (either marked cold via an attribute or by profile -feedback) are not accounted into the unit size. - -@item ipcp-unit-growth -Specifies maximal overall growth of the compilation unit caused by -interprocedural constant propagation. The default value is 10 which limits -unit growth to 1.1 times the original size. - -@item large-stack-frame -The limit specifying large stack frames. While inlining the algorithm is trying -to not grow past this limit too much. The default value is 256 bytes. - -@item large-stack-frame-growth -Specifies maximal growth of large stack frames caused by inlining in percents. -The default value is 1000 which limits large stack frame growth to 11 times -the original size. - -@item max-inline-insns-recursive -@itemx max-inline-insns-recursive-auto -Specifies the maximum number of instructions an out-of-line copy of a -self-recursive inline -function can grow into by performing recursive inlining. - -@option{--param max-inline-insns-recursive} applies to functions -declared inline. -For functions not declared inline, recursive inlining -happens only when @option{-finline-functions} (included in @option{-O3}) is -enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The -default value is 450. - -@item max-inline-recursive-depth -@itemx max-inline-recursive-depth-auto -Specifies the maximum recursion depth used for recursive inlining. - -@option{--param max-inline-recursive-depth} applies to functions -declared inline. For functions not declared inline, recursive inlining -happens only when @option{-finline-functions} (included in @option{-O3}) is -enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The -default value is 8. - -@item min-inline-recursive-probability -Recursive inlining is profitable only for function having deep recursion -in average and can hurt for function having little recursion depth by -increasing the prologue size or complexity of function body to other -optimizers. - -When profile feedback is available (see @option{-fprofile-generate}) the actual -recursion depth can be guessed from probability that function recurses via a -given call expression. This parameter limits inlining only to call expressions -whose probability exceeds the given threshold (in percents). -The default value is 10. - -@item early-inlining-insns -Specify growth that the early inliner can make. In effect it increases -the amount of inlining for code having a large abstraction penalty. -The default value is 14. - -@item max-early-inliner-iterations -Limit of iterations of the early inliner. This basically bounds -the number of nested indirect calls the early inliner can resolve. -Deeper chains are still handled by late inlining. - -@item comdat-sharing-probability -Probability (in percent) that C++ inline function with comdat visibility -are shared across multiple compilation units. The default value is 20. - -@item profile-func-internal-id -A parameter to control whether to use function internal id in profile -database lookup. If the value is 0, the compiler uses an id that -is based on function assembler name and filename, which makes old profile -data more tolerant to source changes such as function reordering etc. -The default value is 0. - -@item min-vect-loop-bound -The minimum number of iterations under which loops are not vectorized -when @option{-ftree-vectorize} is used. The number of iterations after -vectorization needs to be greater than the value specified by this option -to allow vectorization. The default value is 0. - -@item gcse-cost-distance-ratio -Scaling factor in calculation of maximum distance an expression -can be moved by GCSE optimizations. This is currently supported only in the -code hoisting pass. The bigger the ratio, the more aggressive code hoisting -is with simple expressions, i.e., the expressions that have cost -less than @option{gcse-unrestricted-cost}. Specifying 0 disables -hoisting of simple expressions. The default value is 10. - -@item gcse-unrestricted-cost -Cost, roughly measured as the cost of a single typical machine -instruction, at which GCSE optimizations do not constrain -the distance an expression can travel. This is currently -supported only in the code hoisting pass. The lesser the cost, -the more aggressive code hoisting is. Specifying 0 -allows all expressions to travel unrestricted distances. -The default value is 3. - -@item max-hoist-depth -The depth of search in the dominator tree for expressions to hoist. -This is used to avoid quadratic behavior in hoisting algorithm. -The value of 0 does not limit on the search, but may slow down compilation -of huge functions. The default value is 30. - -@item max-tail-merge-comparisons -The maximum amount of similar bbs to compare a bb with. This is used to -avoid quadratic behavior in tree tail merging. The default value is 10. - -@item max-tail-merge-iterations -The maximum amount of iterations of the pass over the function. This is used to -limit compilation time in tree tail merging. The default value is 2. - -@item max-unrolled-insns -The maximum number of instructions that a loop may have to be unrolled. -If a loop is unrolled, this parameter also determines how many times -the loop code is unrolled. - -@item max-average-unrolled-insns -The maximum number of instructions biased by probabilities of their execution -that a loop may have to be unrolled. If a loop is unrolled, -this parameter also determines how many times the loop code is unrolled. - -@item max-unroll-times -The maximum number of unrollings of a single loop. - -@item max-peeled-insns -The maximum number of instructions that a loop may have to be peeled. -If a loop is peeled, this parameter also determines how many times -the loop code is peeled. - -@item max-peel-times -The maximum number of peelings of a single loop. - -@item max-peel-branches -The maximum number of branches on the hot path through the peeled sequence. - -@item max-completely-peeled-insns -The maximum number of insns of a completely peeled loop. - -@item max-completely-peel-times -The maximum number of iterations of a loop to be suitable for complete peeling. - -@item max-completely-peel-loop-nest-depth -The maximum depth of a loop nest suitable for complete peeling. - -@item max-unswitch-insns -The maximum number of insns of an unswitched loop. - -@item max-unswitch-level -The maximum number of branches unswitched in a single loop. - -@item lim-expensive -The minimum cost of an expensive expression in the loop invariant motion. - -@item iv-consider-all-candidates-bound -Bound on number of candidates for induction variables, below which -all candidates are considered for each use in induction variable -optimizations. If there are more candidates than this, -only the most relevant ones are considered to avoid quadratic time complexity. - -@item iv-max-considered-uses -The induction variable optimizations give up on loops that contain more -induction variable uses. - -@item iv-always-prune-cand-set-bound -If the number of candidates in the set is smaller than this value, -always try to remove unnecessary ivs from the set -when adding a new one. - -@item scev-max-expr-size -Bound on size of expressions used in the scalar evolutions analyzer. -Large expressions slow the analyzer. - -@item scev-max-expr-complexity -Bound on the complexity of the expressions in the scalar evolutions analyzer. -Complex expressions slow the analyzer. - -@item omega-max-vars -The maximum number of variables in an Omega constraint system. -The default value is 128. - -@item omega-max-geqs -The maximum number of inequalities in an Omega constraint system. -The default value is 256. - -@item omega-max-eqs -The maximum number of equalities in an Omega constraint system. -The default value is 128. - -@item omega-max-wild-cards -The maximum number of wildcard variables that the Omega solver is -able to insert. The default value is 18. - -@item omega-hash-table-size -The size of the hash table in the Omega solver. The default value is -550. - -@item omega-max-keys -The maximal number of keys used by the Omega solver. The default -value is 500. - -@item omega-eliminate-redundant-constraints -When set to 1, use expensive methods to eliminate all redundant -constraints. The default value is 0. - -@item vect-max-version-for-alignment-checks -The maximum number of run-time checks that can be performed when -doing loop versioning for alignment in the vectorizer. - -@item vect-max-version-for-alias-checks -The maximum number of run-time checks that can be performed when -doing loop versioning for alias in the vectorizer. - -@item vect-max-peeling-for-alignment -The maximum number of loop peels to enhance access alignment -for vectorizer. Value -1 means 'no limit'. - -@item max-iterations-to-track -The maximum number of iterations of a loop the brute-force algorithm -for analysis of the number of iterations of the loop tries to evaluate. - -@item hot-bb-count-ws-permille -A basic block profile count is considered hot if it contributes to -the given permillage (i.e. 0...1000) of the entire profiled execution. - -@item hot-bb-frequency-fraction -Select fraction of the entry block frequency of executions of basic block in -function given basic block needs to have to be considered hot. - -@item max-predicted-iterations -The maximum number of loop iterations we predict statically. This is useful -in cases where a function contains a single loop with known bound and -another loop with unknown bound. -The known number of iterations is predicted correctly, while -the unknown number of iterations average to roughly 10. This means that the -loop without bounds appears artificially cold relative to the other one. - -@item builtin-expect-probability -Control the probability of the expression having the specified value. This -parameter takes a percentage (i.e. 0 ... 100) as input. -The default probability of 90 is obtained empirically. - -@item align-threshold - -Select fraction of the maximal frequency of executions of a basic block in -a function to align the basic block. - -@item align-loop-iterations - -A loop expected to iterate at least the selected number of iterations is -aligned. - -@item tracer-dynamic-coverage -@itemx tracer-dynamic-coverage-feedback - -This value is used to limit superblock formation once the given percentage of -executed instructions is covered. This limits unnecessary code size -expansion. - -The @option{tracer-dynamic-coverage-feedback} parameter -is used only when profile -feedback is available. The real profiles (as opposed to statically estimated -ones) are much less balanced allowing the threshold to be larger value. - -@item tracer-max-code-growth -Stop tail duplication once code growth has reached given percentage. This is -a rather artificial limit, as most of the duplicates are eliminated later in -cross jumping, so it may be set to much higher values than is the desired code -growth. - -@item tracer-min-branch-ratio - -Stop reverse growth when the reverse probability of best edge is less than this -threshold (in percent). - -@item tracer-min-branch-ratio -@itemx tracer-min-branch-ratio-feedback - -Stop forward growth if the best edge has probability lower than this -threshold. - -Similarly to @option{tracer-dynamic-coverage} two values are present, one for -compilation for profile feedback and one for compilation without. The value -for compilation with profile feedback needs to be more conservative (higher) in -order to make tracer effective. - -@item max-cse-path-length - -The maximum number of basic blocks on path that CSE considers. -The default is 10. - -@item max-cse-insns -The maximum number of instructions CSE processes before flushing. -The default is 1000. - -@item ggc-min-expand - -GCC uses a garbage collector to manage its own memory allocation. This -parameter specifies the minimum percentage by which the garbage -collector's heap should be allowed to expand between collections. -Tuning this may improve compilation speed; it has no effect on code -generation. - -The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when -RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is -the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If -GCC is not able to calculate RAM on a particular platform, the lower -bound of 30% is used. Setting this parameter and -@option{ggc-min-heapsize} to zero causes a full collection to occur at -every opportunity. This is extremely slow, but can be useful for -debugging. - -@item ggc-min-heapsize - -Minimum size of the garbage collector's heap before it begins bothering -to collect garbage. The first collection occurs after the heap expands -by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, -tuning this may improve compilation speed, and has no effect on code -generation. - -The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that -tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but -with a lower bound of 4096 (four megabytes) and an upper bound of -131072 (128 megabytes). If GCC is not able to calculate RAM on a -particular platform, the lower bound is used. Setting this parameter -very large effectively disables garbage collection. Setting this -parameter and @option{ggc-min-expand} to zero causes a full collection -to occur at every opportunity. - -@item max-reload-search-insns -The maximum number of instruction reload should look backward for equivalent -register. Increasing values mean more aggressive optimization, making the -compilation time increase with probably slightly better performance. -The default value is 100. - -@item max-cselib-memory-locations -The maximum number of memory locations cselib should take into account. -Increasing values mean more aggressive optimization, making the compilation time -increase with probably slightly better performance. The default value is 500. - -@item reorder-blocks-duplicate -@itemx reorder-blocks-duplicate-feedback - -Used by the basic block reordering pass to decide whether to use unconditional -branch or duplicate the code on its destination. Code is duplicated when its -estimated size is smaller than this value multiplied by the estimated size of -unconditional jump in the hot spots of the program. - -The @option{reorder-block-duplicate-feedback} parameter -is used only when profile -feedback is available. It may be set to higher values than -@option{reorder-block-duplicate} since information about the hot spots is more -accurate. - -@item max-sched-ready-insns -The maximum number of instructions ready to be issued the scheduler should -consider at any given time during the first scheduling pass. Increasing -values mean more thorough searches, making the compilation time increase -with probably little benefit. The default value is 100. - -@item max-sched-region-blocks -The maximum number of blocks in a region to be considered for -interblock scheduling. The default value is 10. - -@item max-pipeline-region-blocks -The maximum number of blocks in a region to be considered for -pipelining in the selective scheduler. The default value is 15. - -@item max-sched-region-insns -The maximum number of insns in a region to be considered for -interblock scheduling. The default value is 100. - -@item max-pipeline-region-insns -The maximum number of insns in a region to be considered for -pipelining in the selective scheduler. The default value is 200. - -@item min-spec-prob -The minimum probability (in percents) of reaching a source block -for interblock speculative scheduling. The default value is 40. - -@item max-sched-extend-regions-iters -The maximum number of iterations through CFG to extend regions. -A value of 0 (the default) disables region extensions. - -@item max-sched-insn-conflict-delay -The maximum conflict delay for an insn to be considered for speculative motion. -The default value is 3. - -@item sched-spec-prob-cutoff -The minimal probability of speculation success (in percents), so that -speculative insns are scheduled. -The default value is 40. - -@item sched-spec-state-edge-prob-cutoff -The minimum probability an edge must have for the scheduler to save its -state across it. -The default value is 10. - -@item sched-mem-true-dep-cost -Minimal distance (in CPU cycles) between store and load targeting same -memory locations. The default value is 1. - -@item selsched-max-lookahead -The maximum size of the lookahead window of selective scheduling. It is a -depth of search for available instructions. -The default value is 50. - -@item selsched-max-sched-times -The maximum number of times that an instruction is scheduled during -selective scheduling. This is the limit on the number of iterations -through which the instruction may be pipelined. The default value is 2. - -@item selsched-max-insns-to-rename -The maximum number of best instructions in the ready list that are considered -for renaming in the selective scheduler. The default value is 2. - -@item sms-min-sc -The minimum value of stage count that swing modulo scheduler -generates. The default value is 2. - -@item max-last-value-rtl -The maximum size measured as number of RTLs that can be recorded in an expression -in combiner for a pseudo register as last known value of that register. The default -is 10000. - -@item max-combine-insns -The maximum number of instructions the RTL combiner tries to combine. -The default value is 2 at @option{-Og} and 4 otherwise. - -@item integer-share-limit -Small integer constants can use a shared data structure, reducing the -compiler's memory usage and increasing its speed. This sets the maximum -value of a shared integer constant. The default value is 256. - -@item ssp-buffer-size -The minimum size of buffers (i.e.@: arrays) that receive stack smashing -protection when @option{-fstack-protection} is used. - -@item min-size-for-stack-sharing -The minimum size of variables taking part in stack slot sharing when not -optimizing. The default value is 32. - -@item max-jump-thread-duplication-stmts -Maximum number of statements allowed in a block that needs to be -duplicated when threading jumps. - -@item max-fields-for-field-sensitive -Maximum number of fields in a structure treated in -a field sensitive manner during pointer analysis. The default is zero -for @option{-O0} and @option{-O1}, -and 100 for @option{-Os}, @option{-O2}, and @option{-O3}. - -@item prefetch-latency -Estimate on average number of instructions that are executed before -prefetch finishes. The distance prefetched ahead is proportional -to this constant. Increasing this number may also lead to less -streams being prefetched (see @option{simultaneous-prefetches}). - -@item simultaneous-prefetches -Maximum number of prefetches that can run at the same time. - -@item l1-cache-line-size -The size of cache line in L1 cache, in bytes. - -@item l1-cache-size -The size of L1 cache, in kilobytes. - -@item l2-cache-size -The size of L2 cache, in kilobytes. - -@item min-insn-to-prefetch-ratio -The minimum ratio between the number of instructions and the -number of prefetches to enable prefetching in a loop. - -@item prefetch-min-insn-to-mem-ratio -The minimum ratio between the number of instructions and the -number of memory references to enable prefetching in a loop. - -@item use-canonical-types -Whether the compiler should use the ``canonical'' type system. By -default, this should always be 1, which uses a more efficient internal -mechanism for comparing types in C++ and Objective-C++. However, if -bugs in the canonical type system are causing compilation failures, -set this value to 0 to disable canonical types. - -@item switch-conversion-max-branch-ratio -Switch initialization conversion refuses to create arrays that are -bigger than @option{switch-conversion-max-branch-ratio} times the number of -branches in the switch. - -@item max-partial-antic-length -Maximum length of the partial antic set computed during the tree -partial redundancy elimination optimization (@option{-ftree-pre}) when -optimizing at @option{-O3} and above. For some sorts of source code -the enhanced partial redundancy elimination optimization can run away, -consuming all of the memory available on the host machine. This -parameter sets a limit on the length of the sets that are computed, -which prevents the runaway behavior. Setting a value of 0 for -this parameter allows an unlimited set length. - -@item sccvn-max-scc-size -Maximum size of a strongly connected component (SCC) during SCCVN -processing. If this limit is hit, SCCVN processing for the whole -function is not done and optimizations depending on it are -disabled. The default maximum SCC size is 10000. - -@item sccvn-max-alias-queries-per-access -Maximum number of alias-oracle queries we perform when looking for -redundancies for loads and stores. If this limit is hit the search -is aborted and the load or store is not considered redundant. The -number of queries is algorithmically limited to the number of -stores on all paths from the load to the function entry. -The default maxmimum number of queries is 1000. - -@item ira-max-loops-num -IRA uses regional register allocation by default. If a function -contains more loops than the number given by this parameter, only at most -the given number of the most frequently-executed loops form regions -for regional register allocation. The default value of the -parameter is 100. - -@item ira-max-conflict-table-size -Although IRA uses a sophisticated algorithm to compress the conflict -table, the table can still require excessive amounts of memory for -huge functions. If the conflict table for a function could be more -than the size in MB given by this parameter, the register allocator -instead uses a faster, simpler, and lower-quality -algorithm that does not require building a pseudo-register conflict table. -The default value of the parameter is 2000. - -@item ira-loop-reserved-regs -IRA can be used to evaluate more accurate register pressure in loops -for decisions to move loop invariants (see @option{-O3}). The number -of available registers reserved for some other purposes is given -by this parameter. The default value of the parameter is 2, which is -the minimal number of registers needed by typical instructions. -This value is the best found from numerous experiments. - -@item lra-inheritance-ebb-probability-cutoff -LRA tries to reuse values reloaded in registers in subsequent insns. -This optimization is called inheritance. EBB is used as a region to -do this optimization. The parameter defines a minimal fall-through -edge probability in percentage used to add BB to inheritance EBB in -LRA. The default value of the parameter is 40. The value was chosen -from numerous runs of SPEC2000 on x86-64. - -@item loop-invariant-max-bbs-in-loop -Loop invariant motion can be very expensive, both in compilation time and -in amount of needed compile-time memory, with very large loops. Loops -with more basic blocks than this parameter won't have loop invariant -motion optimization performed on them. The default value of the -parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above. - -@item loop-max-datarefs-for-datadeps -Building data dapendencies is expensive for very large loops. This -parameter limits the number of data references in loops that are -considered for data dependence analysis. These large loops are no -handled by the optimizations using loop data dependencies. -The default value is 1000. - -@item max-vartrack-size -Sets a maximum number of hash table slots to use during variable -tracking dataflow analysis of any function. If this limit is exceeded -with variable tracking at assignments enabled, analysis for that -function is retried without it, after removing all debug insns from -the function. If the limit is exceeded even without debug insns, var -tracking analysis is completely disabled for the function. Setting -the parameter to zero makes it unlimited. - -@item max-vartrack-expr-depth -Sets a maximum number of recursion levels when attempting to map -variable names or debug temporaries to value expressions. This trades -compilation time for more complete debug information. If this is set too -low, value expressions that are available and could be represented in -debug information may end up not being used; setting this higher may -enable the compiler to find more complex debug expressions, but compile -time and memory use may grow. The default is 12. - -@item min-nondebug-insn-uid -Use uids starting at this parameter for nondebug insns. The range below -the parameter is reserved exclusively for debug insns created by -@option{-fvar-tracking-assignments}, but debug insns may get -(non-overlapping) uids above it if the reserved range is exhausted. - -@item ipa-sra-ptr-growth-factor -IPA-SRA replaces a pointer to an aggregate with one or more new -parameters only when their cumulative size is less or equal to -@option{ipa-sra-ptr-growth-factor} times the size of the original -pointer parameter. - -@item sra-max-scalarization-size-Ospeed -@item sra-max-scalarization-size-Osize -The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to -replace scalar parts of aggregates with uses of independent scalar -variables. These parameters control the maximum size, in storage units, -of aggregate which is considered for replacement when compiling for -speed -(@option{sra-max-scalarization-size-Ospeed}) or size -(@option{sra-max-scalarization-size-Osize}) respectively. - -@item tm-max-aggregate-size -When making copies of thread-local variables in a transaction, this -parameter specifies the size in bytes after which variables are -saved with the logging functions as opposed to save/restore code -sequence pairs. This option only applies when using -@option{-fgnu-tm}. - -@item graphite-max-nb-scop-params -To avoid exponential effects in the Graphite loop transforms, the -number of parameters in a Static Control Part (SCoP) is bounded. The -default value is 10 parameters. A variable whose value is unknown at -compilation time and defined outside a SCoP is a parameter of the SCoP. - -@item graphite-max-bbs-per-function -To avoid exponential effects in the detection of SCoPs, the size of -the functions analyzed by Graphite is bounded. The default value is -100 basic blocks. - -@item loop-block-tile-size -Loop blocking or strip mining transforms, enabled with -@option{-floop-block} or @option{-floop-strip-mine}, strip mine each -loop in the loop nest by a given number of iterations. The strip -length can be changed using the @option{loop-block-tile-size} -parameter. The default value is 51 iterations. - -@item loop-unroll-jam-size -Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The -default value is 4. - -@item loop-unroll-jam-depth -Specify the dimension to be unrolled (counting from the most inner loop) -for the @option{-floop-unroll-and-jam}. The default value is 2. - -@item ipa-cp-value-list-size -IPA-CP attempts to track all possible values and types passed to a function's -parameter in order to propagate them and perform devirtualization. -@option{ipa-cp-value-list-size} is the maximum number of values and types it -stores per one formal parameter of a function. - -@item ipa-cp-eval-threshold -IPA-CP calculates its own score of cloning profitability heuristics -and performs those cloning opportunities with scores that exceed -@option{ipa-cp-eval-threshold}. - -@item ipa-cp-recursion-penalty -Percentage penalty the recursive functions will receive when they -are evaluated for cloning. - -@item ipa-cp-single-call-penalty -Percentage penalty functions containg a single call to another -function will receive when they are evaluated for cloning. - - -@item ipa-max-agg-items -IPA-CP is also capable to propagate a number of scalar values passed -in an aggregate. @option{ipa-max-agg-items} controls the maximum -number of such values per one parameter. - -@item ipa-cp-loop-hint-bonus -When IPA-CP determines that a cloning candidate would make the number -of iterations of a loop known, it adds a bonus of -@option{ipa-cp-loop-hint-bonus} to the profitability score of -the candidate. - -@item ipa-cp-array-index-hint-bonus -When IPA-CP determines that a cloning candidate would make the index of -an array access known, it adds a bonus of -@option{ipa-cp-array-index-hint-bonus} to the profitability -score of the candidate. - -@item ipa-max-aa-steps -During its analysis of function bodies, IPA-CP employs alias analysis -in order to track values pointed to by function parameters. In order -not spend too much time analyzing huge functions, it gives up and -consider all memory clobbered after examining -@option{ipa-max-aa-steps} statements modifying memory. - -@item lto-partitions -Specify desired number of partitions produced during WHOPR compilation. -The number of partitions should exceed the number of CPUs used for compilation. -The default value is 32. - -@item lto-minpartition -Size of minimal partition for WHOPR (in estimated instructions). -This prevents expenses of splitting very small programs into too many -partitions. - -@item cxx-max-namespaces-for-diagnostic-help -The maximum number of namespaces to consult for suggestions when C++ -name lookup fails for an identifier. The default is 1000. - -@item sink-frequency-threshold -The maximum relative execution frequency (in percents) of the target block -relative to a statement's original block to allow statement sinking of a -statement. Larger numbers result in more aggressive statement sinking. -The default value is 75. A small positive adjustment is applied for -statements with memory operands as those are even more profitable so sink. - -@item max-stores-to-sink -The maximum number of conditional stores paires that can be sunk. Set to 0 -if either vectorization (@option{-ftree-vectorize}) or if-conversion -(@option{-ftree-loop-if-convert}) is disabled. The default is 2. - -@item allow-store-data-races -Allow optimizers to introduce new data races on stores. -Set to 1 to allow, otherwise to 0. This option is enabled by default -at optimization level @option{-Ofast}. - -@item case-values-threshold -The smallest number of different values for which it is best to use a -jump-table instead of a tree of conditional branches. If the value is -0, use the default for the machine. The default is 0. - -@item tree-reassoc-width -Set the maximum number of instructions executed in parallel in -reassociated tree. This parameter overrides target dependent -heuristics used by default if has non zero value. - -@item sched-pressure-algorithm -Choose between the two available implementations of -@option{-fsched-pressure}. Algorithm 1 is the original implementation -and is the more likely to prevent instructions from being reordered. -Algorithm 2 was designed to be a compromise between the relatively -conservative approach taken by algorithm 1 and the rather aggressive -approach taken by the default scheduler. It relies more heavily on -having a regular register file and accurate register pressure classes. -See @file{haifa-sched.c} in the GCC sources for more details. - -The default choice depends on the target. - -@item max-slsr-cand-scan -Set the maximum number of existing candidates that are considered when -seeking a basis for a new straight-line strength reduction candidate. - -@item asan-globals -Enable buffer overflow detection for global objects. This kind -of protection is enabled by default if you are using -@option{-fsanitize=address} option. -To disable global objects protection use @option{--param asan-globals=0}. - -@item asan-stack -Enable buffer overflow detection for stack objects. This kind of -protection is enabled by default when using@option{-fsanitize=address}. -To disable stack protection use @option{--param asan-stack=0} option. - -@item asan-instrument-reads -Enable buffer overflow detection for memory reads. This kind of -protection is enabled by default when using @option{-fsanitize=address}. -To disable memory reads protection use -@option{--param asan-instrument-reads=0}. - -@item asan-instrument-writes -Enable buffer overflow detection for memory writes. This kind of -protection is enabled by default when using @option{-fsanitize=address}. -To disable memory writes protection use -@option{--param asan-instrument-writes=0} option. - -@item asan-memintrin -Enable detection for built-in functions. This kind of protection -is enabled by default when using @option{-fsanitize=address}. -To disable built-in functions protection use -@option{--param asan-memintrin=0}. - -@item asan-use-after-return -Enable detection of use-after-return. This kind of protection -is enabled by default when using @option{-fsanitize=address} option. -To disable use-after-return detection use -@option{--param asan-use-after-return=0}. - -@item asan-instrumentation-with-call-threshold -If number of memory accesses in function being instrumented -is greater or equal to this number, use callbacks instead of inline checks. -E.g. to disable inline code use -@option{--param asan-instrumentation-with-call-threshold=0}. - -@item chkp-max-ctor-size -Static constructors generated by Pointer Bounds Checker may become very -large and significantly increase compile time at optimization level -@option{-O1} and higher. This parameter is a maximum nubmer of statements -in a single generated constructor. Default value is 5000. - -@item max-fsm-thread-path-insns -Maximum number of instructions to copy when duplicating blocks on a -finite state automaton jump thread path. The default is 100. - -@item max-fsm-thread-length -Maximum number of basic blocks on a finite state automaton jump thread -path. The default is 10. - -@item max-fsm-thread-paths -Maximum number of new jump thread paths to create for a finite state -automaton. The default is 50. - -@end table -@end table - -@node Preprocessor Options -@section Options Controlling the Preprocessor -@cindex preprocessor options -@cindex options, preprocessor - -These options control the C preprocessor, which is run on each C source -file before actual compilation. - -If you use the @option{-E} option, nothing is done except preprocessing. -Some of these options make sense only together with @option{-E} because -they cause the preprocessor output to be unsuitable for actual -compilation. - -@table @gcctabopt -@item -Wp,@var{option} -@opindex Wp -You can use @option{-Wp,@var{option}} to bypass the compiler driver -and pass @var{option} directly through to the preprocessor. If -@var{option} contains commas, it is split into multiple options at the -commas. However, many options are modified, translated or interpreted -by the compiler driver before being passed to the preprocessor, and -@option{-Wp} forcibly bypasses this phase. The preprocessor's direct -interface is undocumented and subject to change, so whenever possible -you should avoid using @option{-Wp} and let the driver handle the -options instead. - -@item -Xpreprocessor @var{option} -@opindex Xpreprocessor -Pass @var{option} as an option to the preprocessor. You can use this to -supply system-specific preprocessor options that GCC does not -recognize. - -If you want to pass an option that takes an argument, you must use -@option{-Xpreprocessor} twice, once for the option and once for the argument. - -@item -no-integrated-cpp -@opindex no-integrated-cpp -Perform preprocessing as a separate pass before compilation. -By default, GCC performs preprocessing as an integrated part of -input tokenization and parsing. -If this option is provided, the appropriate language front end -(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, -and Objective-C, respectively) is instead invoked twice, -once for preprocessing only and once for actual compilation -of the preprocessed input. -This option may be useful in conjunction with the @option{-B} or -@option{-wrapper} options to specify an alternate preprocessor or -perform additional processing of the program source between -normal preprocessing and compilation. -@end table - -@include cppopts.texi - -@node Assembler Options -@section Passing Options to the Assembler - -@c prevent bad page break with this line -You can pass options to the assembler. - -@table @gcctabopt -@item -Wa,@var{option} -@opindex Wa -Pass @var{option} as an option to the assembler. If @var{option} -contains commas, it is split into multiple options at the commas. - -@item -Xassembler @var{option} -@opindex Xassembler -Pass @var{option} as an option to the assembler. You can use this to -supply system-specific assembler options that GCC does not -recognize. - -If you want to pass an option that takes an argument, you must use -@option{-Xassembler} twice, once for the option and once for the argument. - -@end table - -@node Link Options -@section Options for Linking -@cindex link options -@cindex options, linking - -These options come into play when the compiler links object files into -an executable output file. They are meaningless if the compiler is -not doing a link step. - -@table @gcctabopt -@cindex file names -@item @var{object-file-name} -A file name that does not end in a special recognized suffix is -considered to name an object file or library. (Object files are -distinguished from libraries by the linker according to the file -contents.) If linking is done, these object files are used as input -to the linker. - -@item -c -@itemx -S -@itemx -E -@opindex c -@opindex S -@opindex E -If any of these options is used, then the linker is not run, and -object file names should not be used as arguments. @xref{Overall -Options}. - -@item -fuse-ld=bfd -@opindex fuse-ld=bfd -Use the @command{bfd} linker instead of the default linker. - -@item -fuse-ld=gold -@opindex fuse-ld=gold -Use the @command{gold} linker instead of the default linker. - -@cindex Libraries -@item -l@var{library} -@itemx -l @var{library} -@opindex l -Search the library named @var{library} when linking. (The second -alternative with the library as a separate argument is only for -POSIX compliance and is not recommended.) - -It makes a difference where in the command you write this option; the -linker searches and processes libraries and object files in the order they -are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} -after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers -to functions in @samp{z}, those functions may not be loaded. - -The linker searches a standard list of directories for the library, -which is actually a file named @file{lib@var{library}.a}. The linker -then uses this file as if it had been specified precisely by name. - -The directories searched include several standard system directories -plus any that you specify with @option{-L}. - -Normally the files found this way are library files---archive files -whose members are object files. The linker handles an archive file by -scanning through it for members which define symbols that have so far -been referenced but not defined. But if the file that is found is an -ordinary object file, it is linked in the usual fashion. The only -difference between using an @option{-l} option and specifying a file name -is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} -and searches several directories. - -@item -lobjc -@opindex lobjc -You need this special case of the @option{-l} option in order to -link an Objective-C or Objective-C++ program. - -@item -nostartfiles -@opindex nostartfiles -Do not use the standard system startup files when linking. -The standard system libraries are used normally, unless @option{-nostdlib} -or @option{-nodefaultlibs} is used. - -@item -nodefaultlibs -@opindex nodefaultlibs -Do not use the standard system libraries when linking. -Only the libraries you specify are passed to the linker, and options -specifying linkage of the system libraries, such as @option{-static-libgcc} -or @option{-shared-libgcc}, are ignored. -The standard startup files are used normally, unless @option{-nostartfiles} -is used. - -The compiler may generate calls to @code{memcmp}, -@code{memset}, @code{memcpy} and @code{memmove}. -These entries are usually resolved by entries in -libc. These entry points should be supplied through some other -mechanism when this option is specified. - -@item -nostdlib -@opindex nostdlib -Do not use the standard system startup files or libraries when linking. -No startup files and only the libraries you specify are passed to -the linker, and options specifying linkage of the system libraries, such as -@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. - -The compiler may generate calls to @code{memcmp}, @code{memset}, -@code{memcpy} and @code{memmove}. -These entries are usually resolved by entries in -libc. These entry points should be supplied through some other -mechanism when this option is specified. - -@cindex @option{-lgcc}, use with @option{-nostdlib} -@cindex @option{-nostdlib} and unresolved references -@cindex unresolved references and @option{-nostdlib} -@cindex @option{-lgcc}, use with @option{-nodefaultlibs} -@cindex @option{-nodefaultlibs} and unresolved references -@cindex unresolved references and @option{-nodefaultlibs} -One of the standard libraries bypassed by @option{-nostdlib} and -@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines -which GCC uses to overcome shortcomings of particular machines, or special -needs for some languages. -(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler -Collection (GCC) Internals}, -for more discussion of @file{libgcc.a}.) -In most cases, you need @file{libgcc.a} even when you want to avoid -other standard libraries. In other words, when you specify @option{-nostdlib} -or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. -This ensures that you have no unresolved references to internal GCC -library subroutines. -(An example of such an internal subroutine is @code{__main}, used to ensure C++ -constructors are called; @pxref{Collect2,,@code{collect2}, gccint, -GNU Compiler Collection (GCC) Internals}.) - -@item -pie -@opindex pie -Produce a position independent executable on targets that support it. -For predictable results, you must also specify the same set of options -used for compilation (@option{-fpie}, @option{-fPIE}, -or model suboptions) when you specify this linker option. - -@item -rdynamic -@opindex rdynamic -Pass the flag @option{-export-dynamic} to the ELF linker, on targets -that support it. This instructs the linker to add all symbols, not -only used ones, to the dynamic symbol table. This option is needed -for some uses of @code{dlopen} or to allow obtaining backtraces -from within a program. - -@item -s -@opindex s -Remove all symbol table and relocation information from the executable. - -@item -static -@opindex static -On systems that support dynamic linking, this prevents linking with the shared -libraries. On other systems, this option has no effect. - -@item -shared -@opindex shared -Produce a shared object which can then be linked with other objects to -form an executable. Not all systems support this option. For predictable -results, you must also specify the same set of options used for compilation -(@option{-fpic}, @option{-fPIC}, or model suboptions) when -you specify this linker option.@footnote{On some systems, @samp{gcc -shared} -needs to build supplementary stub code for constructors to work. On -multi-libbed systems, @samp{gcc -shared} must select the correct support -libraries to link against. Failing to supply the correct flags may lead -to subtle defects. Supplying them in cases where they are not necessary -is innocuous.} - -@item -shared-libgcc -@itemx -static-libgcc -@opindex shared-libgcc -@opindex static-libgcc -On systems that provide @file{libgcc} as a shared library, these options -force the use of either the shared or static version, respectively. -If no shared version of @file{libgcc} was built when the compiler was -configured, these options have no effect. - -There are several situations in which an application should use the -shared @file{libgcc} instead of the static version. The most common -of these is when the application wishes to throw and catch exceptions -across different shared libraries. In that case, each of the libraries -as well as the application itself should use the shared @file{libgcc}. - -Therefore, the G++ and GCJ drivers automatically add -@option{-shared-libgcc} whenever you build a shared library or a main -executable, because C++ and Java programs typically use exceptions, so -this is the right thing to do. - -If, instead, you use the GCC driver to create shared libraries, you may -find that they are not always linked with the shared @file{libgcc}. -If GCC finds, at its configuration time, that you have a non-GNU linker -or a GNU linker that does not support option @option{--eh-frame-hdr}, -it links the shared version of @file{libgcc} into shared libraries -by default. Otherwise, it takes advantage of the linker and optimizes -away the linking with the shared version of @file{libgcc}, linking with -the static version of libgcc by default. This allows exceptions to -propagate through such shared libraries, without incurring relocation -costs at library load time. - -However, if a library or main executable is supposed to throw or catch -exceptions, you must link it using the G++ or GCJ driver, as appropriate -for the languages used in the program, or using the option -@option{-shared-libgcc}, such that it is linked with the shared -@file{libgcc}. - -@item -static-libasan -@opindex static-libasan -When the @option{-fsanitize=address} option is used to link a program, -the GCC driver automatically links against @option{libasan}. If -@file{libasan} is available as a shared library, and the @option{-static} -option is not used, then this links against the shared version of -@file{libasan}. The @option{-static-libasan} option directs the GCC -driver to link @file{libasan} statically, without necessarily linking -other libraries statically. - -@item -static-libtsan -@opindex static-libtsan -When the @option{-fsanitize=thread} option is used to link a program, -the GCC driver automatically links against @option{libtsan}. If -@file{libtsan} is available as a shared library, and the @option{-static} -option is not used, then this links against the shared version of -@file{libtsan}. The @option{-static-libtsan} option directs the GCC -driver to link @file{libtsan} statically, without necessarily linking -other libraries statically. - -@item -static-liblsan -@opindex static-liblsan -When the @option{-fsanitize=leak} option is used to link a program, -the GCC driver automatically links against @option{liblsan}. If -@file{liblsan} is available as a shared library, and the @option{-static} -option is not used, then this links against the shared version of -@file{liblsan}. The @option{-static-liblsan} option directs the GCC -driver to link @file{liblsan} statically, without necessarily linking -other libraries statically. - -@item -static-libubsan -@opindex static-libubsan -When the @option{-fsanitize=undefined} option is used to link a program, -the GCC driver automatically links against @option{libubsan}. If -@file{libubsan} is available as a shared library, and the @option{-static} -option is not used, then this links against the shared version of -@file{libubsan}. The @option{-static-libubsan} option directs the GCC -driver to link @file{libubsan} statically, without necessarily linking -other libraries statically. - -@item -static-libmpx -@opindex static-libmpx -When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are -used to link a program, the GCC driver automatically links against -@file{libmpx}. If @file{libmpx} is available as a shared library, -and the @option{-static} option is not used, then this links against -the shared version of @file{libmpx}. The @option{-static-libmpx} -option directs the GCC driver to link @file{libmpx} statically, -without necessarily linking other libraries statically. - -@item -static-libmpxwrappers -@opindex static-libmpxwrappers -When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used -to link a program without also using @option{-fno-chkp-use-wrappers}, the -GCC driver automatically links against @file{libmpxwrappers}. If -@file{libmpxwrappers} is available as a shared library, and the -@option{-static} option is not used, then this links against the shared -version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers} -option directs the GCC driver to link @file{libmpxwrappers} statically, -without necessarily linking other libraries statically. - -@item -static-libstdc++ -@opindex static-libstdc++ -When the @command{g++} program is used to link a C++ program, it -normally automatically links against @option{libstdc++}. If -@file{libstdc++} is available as a shared library, and the -@option{-static} option is not used, then this links against the -shared version of @file{libstdc++}. That is normally fine. However, it -is sometimes useful to freeze the version of @file{libstdc++} used by -the program without going all the way to a fully static link. The -@option{-static-libstdc++} option directs the @command{g++} driver to -link @file{libstdc++} statically, without necessarily linking other -libraries statically. - -@item -symbolic -@opindex symbolic -Bind references to global symbols when building a shared object. Warn -about any unresolved references (unless overridden by the link editor -option @option{-Xlinker -z -Xlinker defs}). Only a few systems support -this option. - -@item -T @var{script} -@opindex T -@cindex linker script -Use @var{script} as the linker script. This option is supported by most -systems using the GNU linker. On some targets, such as bare-board -targets without an operating system, the @option{-T} option may be required -when linking to avoid references to undefined symbols. - -@item -Xlinker @var{option} -@opindex Xlinker -Pass @var{option} as an option to the linker. You can use this to -supply system-specific linker options that GCC does not recognize. - -If you want to pass an option that takes a separate argument, you must use -@option{-Xlinker} twice, once for the option and once for the argument. -For example, to pass @option{-assert definitions}, you must write -@option{-Xlinker -assert -Xlinker definitions}. It does not work to write -@option{-Xlinker "-assert definitions"}, because this passes the entire -string as a single argument, which is not what the linker expects. - -When using the GNU linker, it is usually more convenient to pass -arguments to linker options using the @option{@var{option}=@var{value}} -syntax than as separate arguments. For example, you can specify -@option{-Xlinker -Map=output.map} rather than -@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support -this syntax for command-line options. - -@item -Wl,@var{option} -@opindex Wl -Pass @var{option} as an option to the linker. If @var{option} contains -commas, it is split into multiple options at the commas. You can use this -syntax to pass an argument to the option. -For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the -linker. When using the GNU linker, you can also get the same effect with -@option{-Wl,-Map=output.map}. - -@item -u @var{symbol} -@opindex u -Pretend the symbol @var{symbol} is undefined, to force linking of -library modules to define it. You can use @option{-u} multiple times with -different symbols to force loading of additional library modules. - -@item -z @var{keyword} -@opindex z -@option{-z} is passed directly on to the linker along with the keyword -@var{keyword}. See the section in the documentation of your linker for -permitted values and their meanings. -@end table - -@node Directory Options -@section Options for Directory Search -@cindex directory options -@cindex options, directory search -@cindex search path - -These options specify directories to search for header files, for -libraries and for parts of the compiler: - -@table @gcctabopt -@item -I@var{dir} -@opindex I -Add the directory @var{dir} to the head of the list of directories to be -searched for header files. This can be used to override a system header -file, substituting your own version, since these directories are -searched before the system header file directories. However, you should -not use this option to add directories that contain vendor-supplied -system header files (use @option{-isystem} for that). If you use more than -one @option{-I} option, the directories are scanned in left-to-right -order; the standard system directories come after. - -If a standard system include directory, or a directory specified with -@option{-isystem}, is also specified with @option{-I}, the @option{-I} -option is ignored. The directory is still searched but as a -system directory at its normal position in the system include chain. -This is to ensure that GCC's procedure to fix buggy system headers and -the ordering for the @code{include_next} directive are not inadvertently changed. -If you really need to change the search order for system directories, -use the @option{-nostdinc} and/or @option{-isystem} options. - -@item -iplugindir=@var{dir} -@opindex iplugindir= -Set the directory to search for plugins that are passed -by @option{-fplugin=@var{name}} instead of -@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant -to be used by the user, but only passed by the driver. - -@item -iquote@var{dir} -@opindex iquote -Add the directory @var{dir} to the head of the list of directories to -be searched for header files only for the case of @code{#include -"@var{file}"}; they are not searched for @code{#include <@var{file}>}, -otherwise just like @option{-I}. - -@item -L@var{dir} -@opindex L -Add directory @var{dir} to the list of directories to be searched -for @option{-l}. - -@item -B@var{prefix} -@opindex B -This option specifies where to find the executables, libraries, -include files, and data files of the compiler itself. - -The compiler driver program runs one or more of the subprograms -@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries -@var{prefix} as a prefix for each program it tries to run, both with and -without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). - -For each subprogram to be run, the compiler driver first tries the -@option{-B} prefix, if any. If that name is not found, or if @option{-B} -is not specified, the driver tries two standard prefixes, -@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of -those results in a file name that is found, the unmodified program -name is searched for using the directories specified in your -@env{PATH} environment variable. - -The compiler checks to see if the path provided by @option{-B} -refers to a directory, and if necessary it adds a directory -separator character at the end of the path. - -@option{-B} prefixes that effectively specify directory names also apply -to libraries in the linker, because the compiler translates these -options into @option{-L} options for the linker. They also apply to -include files in the preprocessor, because the compiler translates these -options into @option{-isystem} options for the preprocessor. In this case, -the compiler appends @samp{include} to the prefix. - -The runtime support file @file{libgcc.a} can also be searched for using -the @option{-B} prefix, if needed. If it is not found there, the two -standard prefixes above are tried, and that is all. The file is left -out of the link if it is not found by those means. - -Another way to specify a prefix much like the @option{-B} prefix is to use -the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment -Variables}. - -As a special kludge, if the path provided by @option{-B} is -@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to -9, then it is replaced by @file{[dir/]include}. This is to help -with boot-strapping the compiler. - -@item -specs=@var{file} -@opindex specs -Process @var{file} after the compiler reads in the standard @file{specs} -file, in order to override the defaults which the @command{gcc} driver -program uses when determining what switches to pass to @command{cc1}, -@command{cc1plus}, @command{as}, @command{ld}, etc. More than one -@option{-specs=@var{file}} can be specified on the command line, and they -are processed in order, from left to right. - -@item --sysroot=@var{dir} -@opindex sysroot -Use @var{dir} as the logical root directory for headers and libraries. -For example, if the compiler normally searches for headers in -@file{/usr/include} and libraries in @file{/usr/lib}, it instead -searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. - -If you use both this option and the @option{-isysroot} option, then -the @option{--sysroot} option applies to libraries, but the -@option{-isysroot} option applies to header files. - -The GNU linker (beginning with version 2.16) has the necessary support -for this option. If your linker does not support this option, the -header file aspect of @option{--sysroot} still works, but the -library aspect does not. - -@item --no-sysroot-suffix -@opindex no-sysroot-suffix -For some targets, a suffix is added to the root directory specified -with @option{--sysroot}, depending on the other options used, so that -headers may for example be found in -@file{@var{dir}/@var{suffix}/usr/include} instead of -@file{@var{dir}/usr/include}. This option disables the addition of -such a suffix. - -@item -I- -@opindex I- -This option has been deprecated. Please use @option{-iquote} instead for -@option{-I} directories before the @option{-I-} and remove the @option{-I-} -option. -Any directories you specify with @option{-I} options before the @option{-I-} -option are searched only for the case of @code{#include "@var{file}"}; -they are not searched for @code{#include <@var{file}>}. - -If additional directories are specified with @option{-I} options after -the @option{-I-} option, these directories are searched for all @code{#include} -directives. (Ordinarily @emph{all} @option{-I} directories are used -this way.) - -In addition, the @option{-I-} option inhibits the use of the current -directory (where the current input file came from) as the first search -directory for @code{#include "@var{file}"}. There is no way to -override this effect of @option{-I-}. With @option{-I.} you can specify -searching the directory that is current when the compiler is -invoked. That is not exactly the same as what the preprocessor does -by default, but it is often satisfactory. - -@option{-I-} does not inhibit the use of the standard system directories -for header files. Thus, @option{-I-} and @option{-nostdinc} are -independent. -@end table - -@c man end - -@node Spec Files -@section Specifying Subprocesses and the Switches to Pass to Them -@cindex Spec Files - -@command{gcc} is a driver program. It performs its job by invoking a -sequence of other programs to do the work of compiling, assembling and -linking. GCC interprets its command-line parameters and uses these to -deduce which programs it should invoke, and which command-line options -it ought to place on their command lines. This behavior is controlled -by @dfn{spec strings}. In most cases there is one spec string for each -program that GCC can invoke, but a few programs have multiple spec -strings to control their behavior. The spec strings built into GCC can -be overridden by using the @option{-specs=} command-line switch to specify -a spec file. - -@dfn{Spec files} are plaintext files that are used to construct spec -strings. They consist of a sequence of directives separated by blank -lines. The type of directive is determined by the first non-whitespace -character on the line, which can be one of the following: - -@table @code -@item %@var{command} -Issues a @var{command} to the spec file processor. The commands that can -appear here are: - -@table @code -@item %include <@var{file}> -@cindex @code{%include} -Search for @var{file} and insert its text at the current point in the -specs file. - -@item %include_noerr <@var{file}> -@cindex @code{%include_noerr} -Just like @samp{%include}, but do not generate an error message if the include -file cannot be found. - -@item %rename @var{old_name} @var{new_name} -@cindex @code{%rename} -Rename the spec string @var{old_name} to @var{new_name}. - -@end table - -@item *[@var{spec_name}]: -This tells the compiler to create, override or delete the named spec -string. All lines after this directive up to the next directive or -blank line are considered to be the text for the spec string. If this -results in an empty string then the spec is deleted. (Or, if the -spec did not exist, then nothing happens.) Otherwise, if the spec -does not currently exist a new spec is created. If the spec does -exist then its contents are overridden by the text of this -directive, unless the first character of that text is the @samp{+} -character, in which case the text is appended to the spec. - -@item [@var{suffix}]: -Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive -and up to the next directive or blank line are considered to make up the -spec string for the indicated suffix. When the compiler encounters an -input file with the named suffix, it processes the spec string in -order to work out how to compile that file. For example: - -@smallexample -.ZZ: -z-compile -input %i -@end smallexample - -This says that any input file whose name ends in @samp{.ZZ} should be -passed to the program @samp{z-compile}, which should be invoked with the -command-line switch @option{-input} and with the result of performing the -@samp{%i} substitution. (See below.) - -As an alternative to providing a spec string, the text following a -suffix directive can be one of the following: - -@table @code -@item @@@var{language} -This says that the suffix is an alias for a known @var{language}. This is -similar to using the @option{-x} command-line switch to GCC to specify a -language explicitly. For example: - -@smallexample -.ZZ: -@@c++ -@end smallexample - -Says that .ZZ files are, in fact, C++ source files. - -@item #@var{name} -This causes an error messages saying: - -@smallexample -@var{name} compiler not installed on this system. -@end smallexample -@end table - -GCC already has an extensive list of suffixes built into it. -This directive adds an entry to the end of the list of suffixes, but -since the list is searched from the end backwards, it is effectively -possible to override earlier entries using this technique. - -@end table - -GCC has the following spec strings built into it. Spec files can -override these strings or create their own. Note that individual -targets can also add their own spec strings to this list. - -@smallexample -asm Options to pass to the assembler -asm_final Options to pass to the assembler post-processor -cpp Options to pass to the C preprocessor -cc1 Options to pass to the C compiler -cc1plus Options to pass to the C++ compiler -endfile Object files to include at the end of the link -link Options to pass to the linker -lib Libraries to include on the command line to the linker -libgcc Decides which GCC support library to pass to the linker -linker Sets the name of the linker -predefines Defines to be passed to the C preprocessor -signed_char Defines to pass to CPP to say whether @code{char} is signed - by default -startfile Object files to include at the start of the link -@end smallexample - -Here is a small example of a spec file: - -@smallexample -%rename lib old_lib - -*lib: ---start-group -lgcc -lc -leval1 --end-group %(old_lib) -@end smallexample - -This example renames the spec called @samp{lib} to @samp{old_lib} and -then overrides the previous definition of @samp{lib} with a new one. -The new definition adds in some extra command-line options before -including the text of the old definition. - -@dfn{Spec strings} are a list of command-line options to be passed to their -corresponding program. In addition, the spec strings can contain -@samp{%}-prefixed sequences to substitute variable text or to -conditionally insert text into the command line. Using these constructs -it is possible to generate quite complex command lines. - -Here is a table of all defined @samp{%}-sequences for spec -strings. Note that spaces are not generated automatically around the -results of expanding these sequences. Therefore you can concatenate them -together or combine them with constant text in a single argument. - -@table @code -@item %% -Substitute one @samp{%} into the program name or argument. - -@item %i -Substitute the name of the input file being processed. - -@item %b -Substitute the basename of the input file being processed. -This is the substring up to (and not including) the last period -and not including the directory. - -@item %B -This is the same as @samp{%b}, but include the file suffix (text after -the last period). - -@item %d -Marks the argument containing or following the @samp{%d} as a -temporary file name, so that that file is deleted if GCC exits -successfully. Unlike @samp{%g}, this contributes no text to the -argument. - -@item %g@var{suffix} -Substitute a file name that has suffix @var{suffix} and is chosen -once per compilation, and mark the argument in the same way as -@samp{%d}. To reduce exposure to denial-of-service attacks, the file -name is now chosen in a way that is hard to predict even when previously -chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} -might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches -the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is -treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} -was simply substituted with a file name chosen once per compilation, -without regard to any appended suffix (which was therefore treated -just like ordinary text), making such attacks more likely to succeed. - -@item %u@var{suffix} -Like @samp{%g}, but generates a new temporary file name -each time it appears instead of once per compilation. - -@item %U@var{suffix} -Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a -new one if there is no such last file name. In the absence of any -@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share -the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} -involves the generation of two distinct file names, one -for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was -simply substituted with a file name chosen for the previous @samp{%u}, -without regard to any appended suffix. - -@item %j@var{suffix} -Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is -writable, and if @option{-save-temps} is not used; -otherwise, substitute the name -of a temporary file, just like @samp{%u}. This temporary file is not -meant for communication between processes, but rather as a junk -disposal mechanism. - -@item %|@var{suffix} -@itemx %m@var{suffix} -Like @samp{%g}, except if @option{-pipe} is in effect. In that case -@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at -all. These are the two most common ways to instruct a program that it -should read from standard input or write to standard output. If you -need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} -construct: see for example @file{f/lang-specs.h}. - -@item %.@var{SUFFIX} -Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args -when it is subsequently output with @samp{%*}. @var{SUFFIX} is -terminated by the next space or %. - -@item %w -Marks the argument containing or following the @samp{%w} as the -designated output file of this compilation. This puts the argument -into the sequence of arguments that @samp{%o} substitutes. - -@item %o -Substitutes the names of all the output files, with spaces -automatically placed around them. You should write spaces -around the @samp{%o} as well or the results are undefined. -@samp{%o} is for use in the specs for running the linker. -Input files whose names have no recognized suffix are not compiled -at all, but they are included among the output files, so they are -linked. - -@item %O -Substitutes the suffix for object files. Note that this is -handled specially when it immediately follows @samp{%g, %u, or %U}, -because of the need for those to form complete file names. The -handling is such that @samp{%O} is treated exactly as if it had already -been substituted, except that @samp{%g, %u, and %U} do not currently -support additional @var{suffix} characters following @samp{%O} as they do -following, for example, @samp{.o}. - -@item %p -Substitutes the standard macro predefinitions for the -current target machine. Use this when running @command{cpp}. - -@item %P -Like @samp{%p}, but puts @samp{__} before and after the name of each -predefined macro, except for macros that start with @samp{__} or with -@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO -C@. - -@item %I -Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), -@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), -@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) -and @option{-imultilib} as necessary. - -@item %s -Current argument is the name of a library or startup file of some sort. -Search for that file in a standard list of directories and substitute -the full name found. The current working directory is included in the -list of directories scanned. - -@item %T -Current argument is the name of a linker script. Search for that file -in the current list of directories to scan for libraries. If the file -is located insert a @option{--script} option into the command line -followed by the full path name found. If the file is not found then -generate an error message. Note: the current working directory is not -searched. - -@item %e@var{str} -Print @var{str} as an error message. @var{str} is terminated by a newline. -Use this when inconsistent options are detected. - -@item %(@var{name}) -Substitute the contents of spec string @var{name} at this point. - -@item %x@{@var{option}@} -Accumulate an option for @samp{%X}. - -@item %X -Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} -spec string. - -@item %Y -Output the accumulated assembler options specified by @option{-Wa}. - -@item %Z -Output the accumulated preprocessor options specified by @option{-Wp}. - -@item %a -Process the @code{asm} spec. This is used to compute the -switches to be passed to the assembler. - -@item %A -Process the @code{asm_final} spec. This is a spec string for -passing switches to an assembler post-processor, if such a program is -needed. - -@item %l -Process the @code{link} spec. This is the spec for computing the -command line passed to the linker. Typically it makes use of the -@samp{%L %G %S %D and %E} sequences. - -@item %D -Dump out a @option{-L} option for each directory that GCC believes might -contain startup files. If the target supports multilibs then the -current multilib directory is prepended to each of these paths. - -@item %L -Process the @code{lib} spec. This is a spec string for deciding which -libraries are included on the command line to the linker. - -@item %G -Process the @code{libgcc} spec. This is a spec string for deciding -which GCC support library is included on the command line to the linker. - -@item %S -Process the @code{startfile} spec. This is a spec for deciding which -object files are the first ones passed to the linker. Typically -this might be a file named @file{crt0.o}. - -@item %E -Process the @code{endfile} spec. This is a spec string that specifies -the last object files that are passed to the linker. - -@item %C -Process the @code{cpp} spec. This is used to construct the arguments -to be passed to the C preprocessor. - -@item %1 -Process the @code{cc1} spec. This is used to construct the options to be -passed to the actual C compiler (@command{cc1}). - -@item %2 -Process the @code{cc1plus} spec. This is used to construct the options to be -passed to the actual C++ compiler (@command{cc1plus}). - -@item %* -Substitute the variable part of a matched option. See below. -Note that each comma in the substituted string is replaced by -a single space. - -@item %<@code{S} -Remove all occurrences of @code{-S} from the command line. Note---this -command is position dependent. @samp{%} commands in the spec string -before this one see @code{-S}, @samp{%} commands in the spec string -after this one do not. - -@item %:@var{function}(@var{args}) -Call the named function @var{function}, passing it @var{args}. -@var{args} is first processed as a nested spec string, then split -into an argument vector in the usual fashion. The function returns -a string which is processed as if it had appeared literally as part -of the current spec. - -The following built-in spec functions are provided: - -@table @code -@item @code{getenv} -The @code{getenv} spec function takes two arguments: an environment -variable name and a string. If the environment variable is not -defined, a fatal error is issued. Otherwise, the return value is the -value of the environment variable concatenated with the string. For -example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: - -@smallexample -%:getenv(TOPDIR /include) -@end smallexample - -expands to @file{/path/to/top/include}. - -@item @code{if-exists} -The @code{if-exists} spec function takes one argument, an absolute -pathname to a file. If the file exists, @code{if-exists} returns the -pathname. Here is a small example of its usage: - -@smallexample -*startfile: -crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s -@end smallexample - -@item @code{if-exists-else} -The @code{if-exists-else} spec function is similar to the @code{if-exists} -spec function, except that it takes two arguments. The first argument is -an absolute pathname to a file. If the file exists, @code{if-exists-else} -returns the pathname. If it does not exist, it returns the second argument. -This way, @code{if-exists-else} can be used to select one file or another, -based on the existence of the first. Here is a small example of its usage: - -@smallexample -*startfile: -crt0%O%s %:if-exists(crti%O%s) \ -%:if-exists-else(crtbeginT%O%s crtbegin%O%s) -@end smallexample - -@item @code{replace-outfile} -The @code{replace-outfile} spec function takes two arguments. It looks for the -first argument in the outfiles array and replaces it with the second argument. Here -is a small example of its usage: - -@smallexample -%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} -@end smallexample - -@item @code{remove-outfile} -The @code{remove-outfile} spec function takes one argument. It looks for the -first argument in the outfiles array and removes it. Here is a small example -its usage: - -@smallexample -%:remove-outfile(-lm) -@end smallexample - -@item @code{pass-through-libs} -The @code{pass-through-libs} spec function takes any number of arguments. It -finds any @option{-l} options and any non-options ending in @file{.a} (which it -assumes are the names of linker input library archive files) and returns a -result containing all the found arguments each prepended by -@option{-plugin-opt=-pass-through=} and joined by spaces. This list is -intended to be passed to the LTO linker plugin. - -@smallexample -%:pass-through-libs(%G %L %G) -@end smallexample - -@item @code{print-asm-header} -The @code{print-asm-header} function takes no arguments and simply -prints a banner like: - -@smallexample -Assembler options -================= - -Use "-Wa,OPTION" to pass "OPTION" to the assembler. -@end smallexample - -It is used to separate compiler options from assembler options -in the @option{--target-help} output. -@end table - -@item %@{@code{S}@} -Substitutes the @code{-S} switch, if that switch is given to GCC@. -If that switch is not specified, this substitutes nothing. Note that -the leading dash is omitted when specifying this option, and it is -automatically inserted if the substitution is performed. Thus the spec -string @samp{%@{foo@}} matches the command-line option @option{-foo} -and outputs the command-line option @option{-foo}. - -@item %W@{@code{S}@} -Like %@{@code{S}@} but mark last argument supplied within as a file to be -deleted on failure. - -@item %@{@code{S}*@} -Substitutes all the switches specified to GCC whose names start -with @code{-S}, but which also take an argument. This is used for -switches like @option{-o}, @option{-D}, @option{-I}, etc. -GCC considers @option{-o foo} as being -one switch whose name starts with @samp{o}. %@{o*@} substitutes this -text, including the space. Thus two arguments are generated. - -@item %@{@code{S}*&@code{T}*@} -Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options -(the order of @code{S} and @code{T} in the spec is not significant). -There can be any number of ampersand-separated variables; for each the -wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. - -@item %@{@code{S}:@code{X}@} -Substitutes @code{X}, if the @option{-S} switch is given to GCC@. - -@item %@{!@code{S}:@code{X}@} -Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. - -@item %@{@code{S}*:@code{X}@} -Substitutes @code{X} if one or more switches whose names start with -@code{-S} are specified to GCC@. Normally @code{X} is substituted only -once, no matter how many such switches appeared. However, if @code{%*} -appears somewhere in @code{X}, then @code{X} is substituted once -for each matching switch, with the @code{%*} replaced by the part of -that switch matching the @code{*}. - -If @code{%*} appears as the last part of a spec sequence then a space -is added after the end of the last substitution. If there is more -text in the sequence, however, then a space is not generated. This -allows the @code{%*} substitution to be used as part of a larger -string. For example, a spec string like this: - -@smallexample -%@{mcu=*:--script=%*/memory.ld@} -@end smallexample - -@noindent -when matching an option like @option{-mcu=newchip} produces: - -@smallexample ---script=newchip/memory.ld -@end smallexample - -@item %@{.@code{S}:@code{X}@} -Substitutes @code{X}, if processing a file with suffix @code{S}. - -@item %@{!.@code{S}:@code{X}@} -Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. - -@item %@{,@code{S}:@code{X}@} -Substitutes @code{X}, if processing a file for language @code{S}. - -@item %@{!,@code{S}:@code{X}@} -Substitutes @code{X}, if not processing a file for language @code{S}. - -@item %@{@code{S}|@code{P}:@code{X}@} -Substitutes @code{X} if either @code{-S} or @code{-P} is given to -GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and -@code{*} sequences as well, although they have a stronger binding than -the @samp{|}. If @code{%*} appears in @code{X}, all of the -alternatives must be starred, and only the first matching alternative -is substituted. - -For example, a spec string like this: - -@smallexample -%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} -@end smallexample - -@noindent -outputs the following command-line options from the following input -command-line options: - -@smallexample -fred.c -foo -baz -jim.d -bar -boggle --d fred.c -foo -baz -boggle --d jim.d -bar -baz -boggle -@end smallexample - -@item %@{S:X; T:Y; :D@} - -If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is -given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can -be as many clauses as you need. This may be combined with @code{.}, -@code{,}, @code{!}, @code{|}, and @code{*} as needed. - - -@end table - -The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar -construct may contain other nested @samp{%} constructs or spaces, or -even newlines. They are processed as usual, as described above. -Trailing white space in @code{X} is ignored. White space may also -appear anywhere on the left side of the colon in these constructs, -except between @code{.} or @code{*} and the corresponding word. - -The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are -handled specifically in these constructs. If another value of -@option{-O} or the negated form of a @option{-f}, @option{-m}, or -@option{-W} switch is found later in the command line, the earlier -switch value is ignored, except with @{@code{S}*@} where @code{S} is -just one letter, which passes all matching options. - -The character @samp{|} at the beginning of the predicate text is used to -indicate that a command should be piped to the following command, but -only if @option{-pipe} is specified. - -It is built into GCC which switches take arguments and which do not. -(You might think it would be useful to generalize this to allow each -compiler's spec to say which switches take arguments. But this cannot -be done in a consistent fashion. GCC cannot even decide which input -files have been specified without knowing which switches take arguments, -and it must know which input files to compile in order to tell which -compilers to run). - -GCC also knows implicitly that arguments starting in @option{-l} are to be -treated as compiler output files, and passed to the linker in their -proper position among the other output files. - -@c man begin OPTIONS - -@node Target Options -@section Specifying Target Machine and Compiler Version -@cindex target options -@cindex cross compiling -@cindex specifying machine version -@cindex specifying compiler version and target machine -@cindex compiler version, specifying -@cindex target machine, specifying - -The usual way to run GCC is to run the executable called @command{gcc}, or -@command{@var{machine}-gcc} when cross-compiling, or -@command{@var{machine}-gcc-@var{version}} to run a version other than the -one that was installed last. - -@node Submodel Options -@section Hardware Models and Configurations -@cindex submodel options -@cindex specifying hardware config -@cindex hardware models and configurations, specifying -@cindex machine dependent options - -Each target machine types can have its own -special options, starting with @samp{-m}, to choose among various -hardware models or configurations---for example, 68010 vs 68020, -floating coprocessor or none. A single installed version of the -compiler can compile for any model or configuration, according to the -options specified. - -Some configurations of the compiler also support additional special -options, usually for compatibility with other compilers on the same -platform. - -@c This list is ordered alphanumerically by subsection name. -@c It should be the same order and spelling as these options are listed -@c in Machine Dependent Options - -@menu -* AArch64 Options:: -* Adapteva Epiphany Options:: -* ARC Options:: -* ARM Options:: -* AVR Options:: -* Blackfin Options:: -* C6X Options:: -* CRIS Options:: -* CR16 Options:: -* Darwin Options:: -* DEC Alpha Options:: -* FR30 Options:: -* FRV Options:: -* GNU/Linux Options:: -* H8/300 Options:: -* HPPA Options:: -* IA-64 Options:: -* LM32 Options:: -* M32C Options:: -* M32R/D Options:: -* M680x0 Options:: -* MCore Options:: -* MeP Options:: -* MicroBlaze Options:: -* MIPS Options:: -* MMIX Options:: -* MN10300 Options:: -* Moxie Options:: -* MSP430 Options:: -* NDS32 Options:: -* Nios II Options:: -* Nvidia PTX Options:: -* PDP-11 Options:: -* picoChip Options:: -* PowerPC Options:: -* RL78 Options:: -* RS/6000 and PowerPC Options:: -* RX Options:: -* S/390 and zSeries Options:: -* Score Options:: -* SH Options:: -* Solaris 2 Options:: -* SPARC Options:: -* SPU Options:: -* System V Options:: -* TILE-Gx Options:: -* TILEPro Options:: -* V850 Options:: -* VAX Options:: -* Visium Options:: -* VMS Options:: -* VxWorks Options:: -* x86 Options:: -* x86 Windows Options:: -* Xstormy16 Options:: -* Xtensa Options:: -* zSeries Options:: -@end menu - -@node AArch64 Options -@subsection AArch64 Options -@cindex AArch64 Options - -These options are defined for AArch64 implementations: - -@table @gcctabopt - -@item -mabi=@var{name} -@opindex mabi -Generate code for the specified data model. Permissible values -are @samp{ilp32} for SysV-like data model where int, long int and pointer -are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit, -but long int and pointer are 64-bit. - -The default depends on the specific target configuration. Note that -the LP64 and ILP32 ABIs are not link-compatible; you must compile your -entire program with the same ABI, and link with a compatible set of libraries. - -@item -mbig-endian -@opindex mbig-endian -Generate big-endian code. This is the default when GCC is configured for an -@samp{aarch64_be-*-*} target. - -@item -mgeneral-regs-only -@opindex mgeneral-regs-only -Generate code which uses only the general registers. - -@item -mlittle-endian -@opindex mlittle-endian -Generate little-endian code. This is the default when GCC is configured for an -@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. - -@item -mcmodel=tiny -@opindex mcmodel=tiny -Generate code for the tiny code model. The program and its statically defined -symbols must be within 1GB of each other. Pointers are 64 bits. Programs can -be statically or dynamically linked. This model is not fully implemented and -mostly treated as @samp{small}. - -@item -mcmodel=small -@opindex mcmodel=small -Generate code for the small code model. The program and its statically defined -symbols must be within 4GB of each other. Pointers are 64 bits. Programs can -be statically or dynamically linked. This is the default code model. - -@item -mcmodel=large -@opindex mcmodel=large -Generate code for the large code model. This makes no assumptions about -addresses and sizes of sections. Pointers are 64 bits. Programs can be -statically linked only. - -@item -mstrict-align -@opindex mstrict-align -Do not assume that unaligned memory references are handled by the system. - -@item -momit-leaf-frame-pointer -@itemx -mno-omit-leaf-frame-pointer -@opindex momit-leaf-frame-pointer -@opindex mno-omit-leaf-frame-pointer -Omit or keep the frame pointer in leaf functions. The former behaviour is the -default. - -@item -mtls-dialect=desc -@opindex mtls-dialect=desc -Use TLS descriptors as the thread-local storage mechanism for dynamic accesses -of TLS variables. This is the default. - -@item -mtls-dialect=traditional -@opindex mtls-dialect=traditional -Use traditional TLS as the thread-local storage mechanism for dynamic accesses -of TLS variables. - -@item -mfix-cortex-a53-835769 -@itemx -mno-fix-cortex-a53-835769 -@opindex mfix-cortex-a53-835769 -@opindex mno-fix-cortex-a53-835769 -Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. -This involves inserting a NOP instruction between memory instructions and -64-bit integer multiply-accumulate instructions. - -@item -march=@var{name} -@opindex march -Specify the name of the target architecture, optionally suffixed by one or -more feature modifiers. This option has the form -@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the -only permissible value for @var{arch} is @samp{armv8-a}. The permissible -values for @var{feature} are documented in the sub-section below. - -Where conflicting feature modifiers are specified, the right-most feature is -used. - -GCC uses this name to determine what kind of instructions it can emit when -generating assembly code. - -Where @option{-march} is specified without either of @option{-mtune} -or @option{-mcpu} also being specified, the code is tuned to perform -well across a range of target processors implementing the target -architecture. - -@item -mtune=@var{name} -@opindex mtune -Specify the name of the target processor for which GCC should tune the -performance of the code. Permissible values for this option are: -@samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}, -@samp{cortex-a72}, @samp{thunderx}, @samp{xgene1}. - -Additionally, this option can specify that GCC should tune the performance -of the code for a big.LITTLE system. Permissible values for this -option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}. - -Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} -are specified, the code is tuned to perform well across a range -of target processors. - -This option cannot be suffixed by feature modifiers. - -@item -mcpu=@var{name} -@opindex mcpu -Specify the name of the target processor, optionally suffixed by one or more -feature modifiers. This option has the form -@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the -permissible values for @var{cpu} are the same as those available for -@option{-mtune}. - -The permissible values for @var{feature} are documented in the sub-section -below. - -Where conflicting feature modifiers are specified, the right-most feature is -used. - -GCC uses this name to determine what kind of instructions it can emit when -generating assembly code (as if by @option{-march}) and to determine -the target processor for which to tune for performance (as if -by @option{-mtune}). Where this option is used in conjunction -with @option{-march} or @option{-mtune}, those options take precedence -over the appropriate part of this option. -@end table - -@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers -@cindex @option{-march} feature modifiers -@cindex @option{-mcpu} feature modifiers -Feature modifiers used with @option{-march} and @option{-mcpu} can be one -the following: - -@table @samp -@item crc -Enable CRC extension. -@item crypto -Enable Crypto extension. This implies Advanced SIMD is enabled. -@item fp -Enable floating-point instructions. -@item simd -Enable Advanced SIMD instructions. This implies floating-point instructions -are enabled. This is the default for all current possible values for options -@option{-march} and @option{-mcpu=}. -@end table - -@node Adapteva Epiphany Options -@subsection Adapteva Epiphany Options - -These @samp{-m} options are defined for Adapteva Epiphany: - -@table @gcctabopt -@item -mhalf-reg-file -@opindex mhalf-reg-file -Don't allocate any register in the range @code{r32}@dots{}@code{r63}. -That allows code to run on hardware variants that lack these registers. - -@item -mprefer-short-insn-regs -@opindex mprefer-short-insn-regs -Preferrentially allocate registers that allow short instruction generation. -This can result in increased instruction count, so this may either reduce or -increase overall code size. - -@item -mbranch-cost=@var{num} -@opindex mbranch-cost -Set the cost of branches to roughly @var{num} ``simple'' instructions. -This cost is only a heuristic and is not guaranteed to produce -consistent results across releases. - -@item -mcmove -@opindex mcmove -Enable the generation of conditional moves. - -@item -mnops=@var{num} -@opindex mnops -Emit @var{num} NOPs before every other generated instruction. - -@item -mno-soft-cmpsf -@opindex mno-soft-cmpsf -For single-precision floating-point comparisons, emit an @code{fsub} instruction -and test the flags. This is faster than a software comparison, but can -get incorrect results in the presence of NaNs, or when two different small -numbers are compared such that their difference is calculated as zero. -The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, -software comparisons. - -@item -mstack-offset=@var{num} -@opindex mstack-offset -Set the offset between the top of the stack and the stack pointer. -E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} -can be used by leaf functions without stack allocation. -Values other than @samp{8} or @samp{16} are untested and unlikely to work. -Note also that this option changes the ABI; compiling a program with a -different stack offset than the libraries have been compiled with -generally does not work. -This option can be useful if you want to evaluate if a different stack -offset would give you better code, but to actually use a different stack -offset to build working programs, it is recommended to configure the -toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. - -@item -mno-round-nearest -@opindex mno-round-nearest -Make the scheduler assume that the rounding mode has been set to -truncating. The default is @option{-mround-nearest}. - -@item -mlong-calls -@opindex mlong-calls -If not otherwise specified by an attribute, assume all calls might be beyond -the offset range of the @code{b} / @code{bl} instructions, and therefore load the -function address into a register before performing a (otherwise direct) call. -This is the default. - -@item -mshort-calls -@opindex short-calls -If not otherwise specified by an attribute, assume all direct calls are -in the range of the @code{b} / @code{bl} instructions, so use these instructions -for direct calls. The default is @option{-mlong-calls}. - -@item -msmall16 -@opindex msmall16 -Assume addresses can be loaded as 16-bit unsigned values. This does not -apply to function addresses for which @option{-mlong-calls} semantics -are in effect. - -@item -mfp-mode=@var{mode} -@opindex mfp-mode -Set the prevailing mode of the floating-point unit. -This determines the floating-point mode that is provided and expected -at function call and return time. Making this mode match the mode you -predominantly need at function start can make your programs smaller and -faster by avoiding unnecessary mode switches. - -@var{mode} can be set to one the following values: - -@table @samp -@item caller -Any mode at function entry is valid, and retained or restored when -the function returns, and when it calls other functions. -This mode is useful for compiling libraries or other compilation units -you might want to incorporate into different programs with different -prevailing FPU modes, and the convenience of being able to use a single -object file outweighs the size and speed overhead for any extra -mode switching that might be needed, compared with what would be needed -with a more specific choice of prevailing FPU mode. - -@item truncate -This is the mode used for floating-point calculations with -truncating (i.e.@: round towards zero) rounding mode. That includes -conversion from floating point to integer. - -@item round-nearest -This is the mode used for floating-point calculations with -round-to-nearest-or-even rounding mode. - -@item int -This is the mode used to perform integer calculations in the FPU, e.g.@: -integer multiply, or integer multiply-and-accumulate. -@end table - -The default is @option{-mfp-mode=caller} - -@item -mnosplit-lohi -@itemx -mno-postinc -@itemx -mno-postmodify -@opindex mnosplit-lohi -@opindex mno-postinc -@opindex mno-postmodify -Code generation tweaks that disable, respectively, splitting of 32-bit -loads, generation of post-increment addresses, and generation of -post-modify addresses. The defaults are @option{msplit-lohi}, -@option{-mpost-inc}, and @option{-mpost-modify}. - -@item -mnovect-double -@opindex mno-vect-double -Change the preferred SIMD mode to SImode. The default is -@option{-mvect-double}, which uses DImode as preferred SIMD mode. - -@item -max-vect-align=@var{num} -@opindex max-vect-align -The maximum alignment for SIMD vector mode types. -@var{num} may be 4 or 8. The default is 8. -Note that this is an ABI change, even though many library function -interfaces are unaffected if they don't use SIMD vector modes -in places that affect size and/or alignment of relevant types. - -@item -msplit-vecmove-early -@opindex msplit-vecmove-early -Split vector moves into single word moves before reload. In theory this -can give better register allocation, but so far the reverse seems to be -generally the case. - -@item -m1reg-@var{reg} -@opindex m1reg- -Specify a register to hold the constant @minus{}1, which makes loading small negative -constants and certain bitmasks faster. -Allowable values for @var{reg} are @samp{r43} and @samp{r63}, -which specify use of that register as a fixed register, -and @samp{none}, which means that no register is used for this -purpose. The default is @option{-m1reg-none}. - -@end table - -@node ARC Options -@subsection ARC Options -@cindex ARC options - -The following options control the architecture variant for which code -is being compiled: - -@c architecture variants -@table @gcctabopt - -@item -mbarrel-shifter -@opindex mbarrel-shifter -Generate instructions supported by barrel shifter. This is the default -unless @option{-mcpu=ARC601} is in effect. - -@item -mcpu=@var{cpu} -@opindex mcpu -Set architecture type, register usage, and instruction scheduling -parameters for @var{cpu}. There are also shortcut alias options -available for backward compatibility and convenience. Supported -values for @var{cpu} are - -@table @samp -@opindex mA6 -@opindex mARC600 -@item ARC600 -Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. - -@item ARC601 -@opindex mARC601 -Compile for ARC601. Alias: @option{-mARC601}. - -@item ARC700 -@opindex mA7 -@opindex mARC700 -Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. -This is the default when configured with @option{--with-cpu=arc700}@. -@end table - -@item -mdpfp -@opindex mdpfp -@itemx -mdpfp-compact -@opindex mdpfp-compact -FPX: Generate Double Precision FPX instructions, tuned for the compact -implementation. - -@item -mdpfp-fast -@opindex mdpfp-fast -FPX: Generate Double Precision FPX instructions, tuned for the fast -implementation. - -@item -mno-dpfp-lrsr -@opindex mno-dpfp-lrsr -Disable LR and SR instructions from using FPX extension aux registers. - -@item -mea -@opindex mea -Generate Extended arithmetic instructions. Currently only -@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are -supported. This is always enabled for @option{-mcpu=ARC700}. - -@item -mno-mpy -@opindex mno-mpy -Do not generate mpy instructions for ARC700. - -@item -mmul32x16 -@opindex mmul32x16 -Generate 32x16 bit multiply and mac instructions. - -@item -mmul64 -@opindex mmul64 -Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}. - -@item -mnorm -@opindex mnorm -Generate norm instruction. This is the default if @option{-mcpu=ARC700} -is in effect. - -@item -mspfp -@opindex mspfp -@itemx -mspfp-compact -@opindex mspfp-compact -FPX: Generate Single Precision FPX instructions, tuned for the compact -implementation. - -@item -mspfp-fast -@opindex mspfp-fast -FPX: Generate Single Precision FPX instructions, tuned for the fast -implementation. - -@item -msimd -@opindex msimd -Enable generation of ARC SIMD instructions via target-specific -builtins. Only valid for @option{-mcpu=ARC700}. - -@item -msoft-float -@opindex msoft-float -This option ignored; it is provided for compatibility purposes only. -Software floating point code is emitted by default, and this default -can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or -@samp{mspfp-fast} for single precision, and @samp{mdpfp}, -@samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision. - -@item -mswap -@opindex mswap -Generate swap instructions. - -@end table - -The following options are passed through to the assembler, and also -define preprocessor macro symbols. - -@c Flags used by the assembler, but for which we define preprocessor -@c macro symbols as well. -@table @gcctabopt -@item -mdsp-packa -@opindex mdsp-packa -Passed down to the assembler to enable the DSP Pack A extensions. -Also sets the preprocessor symbol @code{__Xdsp_packa}. - -@item -mdvbf -@opindex mdvbf -Passed down to the assembler to enable the dual viterbi butterfly -extension. Also sets the preprocessor symbol @code{__Xdvbf}. - -@c ARC700 4.10 extension instruction -@item -mlock -@opindex mlock -Passed down to the assembler to enable the Locked Load/Store -Conditional extension. Also sets the preprocessor symbol -@code{__Xlock}. - -@item -mmac-d16 -@opindex mmac-d16 -Passed down to the assembler. Also sets the preprocessor symbol -@code{__Xxmac_d16}. - -@item -mmac-24 -@opindex mmac-24 -Passed down to the assembler. Also sets the preprocessor symbol -@code{__Xxmac_24}. - -@c ARC700 4.10 extension instruction -@item -mrtsc -@opindex mrtsc -Passed down to the assembler to enable the 64-bit Time-Stamp Counter -extension instruction. Also sets the preprocessor symbol -@code{__Xrtsc}. - -@c ARC700 4.10 extension instruction -@item -mswape -@opindex mswape -Passed down to the assembler to enable the swap byte ordering -extension instruction. Also sets the preprocessor symbol -@code{__Xswape}. - -@item -mtelephony -@opindex mtelephony -Passed down to the assembler to enable dual and single operand -instructions for telephony. Also sets the preprocessor symbol -@code{__Xtelephony}. - -@item -mxy -@opindex mxy -Passed down to the assembler to enable the XY Memory extension. Also -sets the preprocessor symbol @code{__Xxy}. - -@end table - -The following options control how the assembly code is annotated: - -@c Assembly annotation options -@table @gcctabopt -@item -misize -@opindex misize -Annotate assembler instructions with estimated addresses. - -@item -mannotate-align -@opindex mannotate-align -Explain what alignment considerations lead to the decision to make an -instruction short or long. - -@end table - -The following options are passed through to the linker: - -@c options passed through to the linker -@table @gcctabopt -@item -marclinux -@opindex marclinux -Passed through to the linker, to specify use of the @code{arclinux} emulation. -This option is enabled by default in tool chains built for -@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets -when profiling is not requested. - -@item -marclinux_prof -@opindex marclinux_prof -Passed through to the linker, to specify use of the -@code{arclinux_prof} emulation. This option is enabled by default in -tool chains built for @w{@code{arc-linux-uclibc}} and -@w{@code{arceb-linux-uclibc}} targets when profiling is requested. - -@end table - -The following options control the semantics of generated code: - -@c semantically relevant code generation options -@table @gcctabopt -@item -mepilogue-cfi -@opindex mepilogue-cfi -Enable generation of call frame information for epilogues. - -@item -mno-epilogue-cfi -@opindex mno-epilogue-cfi -Disable generation of call frame information for epilogues. - -@item -mlong-calls -@opindex mlong-calls -Generate call insns as register indirect calls, thus providing access -to the full 32-bit address range. - -@item -mmedium-calls -@opindex mmedium-calls -Don't use less than 25 bit addressing range for calls, which is the -offset available for an unconditional branch-and-link -instruction. Conditional execution of function calls is suppressed, to -allow use of the 25-bit range, rather than the 21-bit range with -conditional branch-and-link. This is the default for tool chains built -for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. - -@item -mno-sdata -@opindex mno-sdata -Do not generate sdata references. This is the default for tool chains -built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} -targets. - -@item -mucb-mcount -@opindex mucb-mcount -Instrument with mcount calls as used in UCB code. I.e. do the -counting in the callee, not the caller. By default ARC instrumentation -counts in the caller. - -@item -mvolatile-cache -@opindex mvolatile-cache -Use ordinarily cached memory accesses for volatile references. This is the -default. - -@item -mno-volatile-cache -@opindex mno-volatile-cache -Enable cache bypass for volatile references. - -@end table - -The following options fine tune code generation: -@c code generation tuning options -@table @gcctabopt -@item -malign-call -@opindex malign-call -Do alignment optimizations for call instructions. - -@item -mauto-modify-reg -@opindex mauto-modify-reg -Enable the use of pre/post modify with register displacement. - -@item -mbbit-peephole -@opindex mbbit-peephole -Enable bbit peephole2. - -@item -mno-brcc -@opindex mno-brcc -This option disables a target-specific pass in @file{arc_reorg} to -generate @code{BRcc} instructions. It has no effect on @code{BRcc} -generation driven by the combiner pass. - -@item -mcase-vector-pcrel -@opindex mcase-vector-pcrel -Use pc-relative switch case tables - this enables case table shortening. -This is the default for @option{-Os}. - -@item -mcompact-casesi -@opindex mcompact-casesi -Enable compact casesi pattern. -This is the default for @option{-Os}. - -@item -mno-cond-exec -@opindex mno-cond-exec -Disable ARCompact specific pass to generate conditional execution instructions. -Due to delay slot scheduling and interactions between operand numbers, -literal sizes, instruction lengths, and the support for conditional execution, -the target-independent pass to generate conditional execution is often lacking, -so the ARC port has kept a special pass around that tries to find more -conditional execution generating opportunities after register allocation, -branch shortening, and delay slot scheduling have been done. This pass -generally, but not always, improves performance and code size, at the cost of -extra compilation time, which is why there is an option to switch it off. -If you have a problem with call instructions exceeding their allowable -offset range because they are conditionalized, you should consider using -@option{-mmedium-calls} instead. - -@item -mearly-cbranchsi -@opindex mearly-cbranchsi -Enable pre-reload use of the cbranchsi pattern. - -@item -mexpand-adddi -@opindex mexpand-adddi -Expand @code{adddi3} and @code{subdi3} at rtl generation time into -@code{add.f}, @code{adc} etc. - -@item -mindexed-loads -@opindex mindexed-loads -Enable the use of indexed loads. This can be problematic because some -optimizers then assume that indexed stores exist, which is not -the case. - -@item -mlra -@opindex mlra -Enable Local Register Allocation. This is still experimental for ARC, -so by default the compiler uses standard reload -(i.e. @option{-mno-lra}). - -@item -mlra-priority-none -@opindex mlra-priority-none -Don't indicate any priority for target registers. - -@item -mlra-priority-compact -@opindex mlra-priority-compact -Indicate target register priority for r0..r3 / r12..r15. - -@item -mlra-priority-noncompact -@opindex mlra-priority-noncompact -Reduce target regsiter priority for r0..r3 / r12..r15. - -@item -mno-millicode -@opindex mno-millicode -When optimizing for size (using @option{-Os}), prologues and epilogues -that have to save or restore a large number of registers are often -shortened by using call to a special function in libgcc; this is -referred to as a @emph{millicode} call. As these calls can pose -performance issues, and/or cause linking issues when linking in a -nonstandard way, this option is provided to turn off millicode call -generation. - -@item -mmixed-code -@opindex mmixed-code -Tweak register allocation to help 16-bit instruction generation. -This generally has the effect of decreasing the average instruction size -while increasing the instruction count. - -@item -mq-class -@opindex mq-class -Enable 'q' instruction alternatives. -This is the default for @option{-Os}. - -@item -mRcq -@opindex mRcq -Enable Rcq constraint handling - most short code generation depends on this. -This is the default. - -@item -mRcw -@opindex mRcw -Enable Rcw constraint handling - ccfsm condexec mostly depends on this. -This is the default. - -@item -msize-level=@var{level} -@opindex msize-level -Fine-tune size optimization with regards to instruction lengths and alignment. -The recognized values for @var{level} are: -@table @samp -@item 0 -No size optimization. This level is deprecated and treated like @samp{1}. - -@item 1 -Short instructions are used opportunistically. - -@item 2 -In addition, alignment of loops and of code after barriers are dropped. - -@item 3 -In addition, optional data alignment is dropped, and the option @option{Os} is enabled. - -@end table - -This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, -the behavior when this is not set is equivalent to level @samp{1}. - -@item -mtune=@var{cpu} -@opindex mtune -Set instruction scheduling parameters for @var{cpu}, overriding any implied -by @option{-mcpu=}. - -Supported values for @var{cpu} are - -@table @samp -@item ARC600 -Tune for ARC600 cpu. - -@item ARC601 -Tune for ARC601 cpu. - -@item ARC700 -Tune for ARC700 cpu with standard multiplier block. - -@item ARC700-xmac -Tune for ARC700 cpu with XMAC block. - -@item ARC725D -Tune for ARC725D cpu. - -@item ARC750D -Tune for ARC750D cpu. - -@end table - -@item -mmultcost=@var{num} -@opindex mmultcost -Cost to assume for a multiply instruction, with @samp{4} being equal to a -normal instruction. - -@item -munalign-prob-threshold=@var{probability} -@opindex munalign-prob-threshold -Set probability threshold for unaligning branches. -When tuning for @samp{ARC700} and optimizing for speed, branches without -filled delay slot are preferably emitted unaligned and long, unless -profiling indicates that the probability for the branch to be taken -is below @var{probability}. @xref{Cross-profiling}. -The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. - -@end table - -The following options are maintained for backward compatibility, but -are now deprecated and will be removed in a future release: - -@c Deprecated options -@table @gcctabopt - -@item -margonaut -@opindex margonaut -Obsolete FPX. - -@item -mbig-endian -@opindex mbig-endian -@itemx -EB -@opindex EB -Compile code for big endian targets. Use of these options is now -deprecated. Users wanting big-endian code, should use the -@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when -building the tool chain, for which big-endian is the default. - -@item -mlittle-endian -@opindex mlittle-endian -@itemx -EL -@opindex EL -Compile code for little endian targets. Use of these options is now -deprecated. Users wanting little-endian code should use the -@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when -building the tool chain, for which little-endian is the default. - -@item -mbarrel_shifter -@opindex mbarrel_shifter -Replaced by @option{-mbarrel-shifter}. - -@item -mdpfp_compact -@opindex mdpfp_compact -Replaced by @option{-mdpfp-compact}. - -@item -mdpfp_fast -@opindex mdpfp_fast -Replaced by @option{-mdpfp-fast}. - -@item -mdsp_packa -@opindex mdsp_packa -Replaced by @option{-mdsp-packa}. - -@item -mEA -@opindex mEA -Replaced by @option{-mea}. - -@item -mmac_24 -@opindex mmac_24 -Replaced by @option{-mmac-24}. - -@item -mmac_d16 -@opindex mmac_d16 -Replaced by @option{-mmac-d16}. - -@item -mspfp_compact -@opindex mspfp_compact -Replaced by @option{-mspfp-compact}. - -@item -mspfp_fast -@opindex mspfp_fast -Replaced by @option{-mspfp-fast}. - -@item -mtune=@var{cpu} -@opindex mtune -Values @samp{arc600}, @samp{arc601}, @samp{arc700} and -@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, -@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively - -@item -multcost=@var{num} -@opindex multcost -Replaced by @option{-mmultcost}. - -@end table - -@node ARM Options -@subsection ARM Options -@cindex ARM options - -These @samp{-m} options are defined for the ARM port: - -@table @gcctabopt -@item -mabi=@var{name} -@opindex mabi -Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, -@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. - -@item -mapcs-frame -@opindex mapcs-frame -Generate a stack frame that is compliant with the ARM Procedure Call -Standard for all functions, even if this is not strictly necessary for -correct execution of the code. Specifying @option{-fomit-frame-pointer} -with this option causes the stack frames not to be generated for -leaf functions. The default is @option{-mno-apcs-frame}. -This option is deprecated. - -@item -mapcs -@opindex mapcs -This is a synonym for @option{-mapcs-frame} and is deprecated. - -@ignore -@c not currently implemented -@item -mapcs-stack-check -@opindex mapcs-stack-check -Generate code to check the amount of stack space available upon entry to -every function (that actually uses some stack space). If there is -insufficient space available then either the function -@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is -called, depending upon the amount of stack space required. The runtime -system is required to provide these functions. The default is -@option{-mno-apcs-stack-check}, since this produces smaller code. - -@c not currently implemented -@item -mapcs-float -@opindex mapcs-float -Pass floating-point arguments using the floating-point registers. This is -one of the variants of the APCS@. This option is recommended if the -target hardware has a floating-point unit or if a lot of floating-point -arithmetic is going to be performed by the code. The default is -@option{-mno-apcs-float}, since the size of integer-only code is -slightly increased if @option{-mapcs-float} is used. - -@c not currently implemented -@item -mapcs-reentrant -@opindex mapcs-reentrant -Generate reentrant, position-independent code. The default is -@option{-mno-apcs-reentrant}. -@end ignore - -@item -mthumb-interwork -@opindex mthumb-interwork -Generate code that supports calling between the ARM and Thumb -instruction sets. Without this option, on pre-v5 architectures, the -two instruction sets cannot be reliably used inside one program. The -default is @option{-mno-thumb-interwork}, since slightly larger code -is generated when @option{-mthumb-interwork} is specified. In AAPCS -configurations this option is meaningless. - -@item -mno-sched-prolog -@opindex mno-sched-prolog -Prevent the reordering of instructions in the function prologue, or the -merging of those instruction with the instructions in the function's -body. This means that all functions start with a recognizable set -of instructions (or in fact one of a choice from a small set of -different function prologues), and this information can be used to -locate the start of functions inside an executable piece of code. The -default is @option{-msched-prolog}. - -@item -mfloat-abi=@var{name} -@opindex mfloat-abi -Specifies which floating-point ABI to use. Permissible values -are: @samp{soft}, @samp{softfp} and @samp{hard}. - -Specifying @samp{soft} causes GCC to generate output containing -library calls for floating-point operations. -@samp{softfp} allows the generation of code using hardware floating-point -instructions, but still uses the soft-float calling conventions. -@samp{hard} allows generation of floating-point instructions -and uses FPU-specific calling conventions. - -The default depends on the specific target configuration. Note that -the hard-float and soft-float ABIs are not link-compatible; you must -compile your entire program with the same ABI, and link with a -compatible set of libraries. - -@item -mlittle-endian -@opindex mlittle-endian -Generate code for a processor running in little-endian mode. This is -the default for all standard configurations. - -@item -mbig-endian -@opindex mbig-endian -Generate code for a processor running in big-endian mode; the default is -to compile code for a little-endian processor. - -@item -march=@var{name} -@opindex march -This specifies the name of the target ARM architecture. GCC uses this -name to determine what kind of instructions it can emit when generating -assembly code. This option can be used in conjunction with or instead -of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, -@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, -@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, -@samp{armv6}, @samp{armv6j}, -@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, -@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m}, -@samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, -@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. - -@option{-march=armv7ve} is the armv7-a architecture with virtualization -extensions. - -@option{-march=armv8-a+crc} enables code generation for the ARMv8-A -architecture together with the optional CRC32 extensions. - -@option{-march=native} causes the compiler to auto-detect the architecture -of the build computer. At present, this feature is only supported on -GNU/Linux, and not all architectures are recognized. If the auto-detect -is unsuccessful the option has no effect. - -@item -mtune=@var{name} -@opindex mtune -This option specifies the name of the target ARM processor for -which GCC should tune the performance of the code. -For some ARM implementations better performance can be obtained by using -this option. -Permissible names are: @samp{arm2}, @samp{arm250}, -@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, -@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, -@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, -@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, -@samp{arm720}, -@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, -@samp{arm710t}, @samp{arm720t}, @samp{arm740t}, -@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, -@samp{strongarm1110}, -@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, -@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, -@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, -@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, -@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, -@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, -@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, -@samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, -@samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53}, -@samp{cortex-a57}, @samp{cortex-a72}, -@samp{cortex-r4}, -@samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7}, -@samp{cortex-m4}, -@samp{cortex-m3}, -@samp{cortex-m1}, -@samp{cortex-m0}, -@samp{cortex-m0plus}, -@samp{cortex-m1.small-multiply}, -@samp{cortex-m0.small-multiply}, -@samp{cortex-m0plus.small-multiply}, -@samp{marvell-pj4}, -@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, -@samp{fa526}, @samp{fa626}, -@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, -@samp{xgene1}. - -Additionally, this option can specify that GCC should tune the performance -of the code for a big.LITTLE system. Permissible names are: -@samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53}, -@samp{cortex-a72.cortex-a53}. - -@option{-mtune=generic-@var{arch}} specifies that GCC should tune the -performance for a blend of processors within architecture @var{arch}. -The aim is to generate code that run well on the current most popular -processors, balancing between optimizations that benefit some CPUs in the -range, and avoiding performance pitfalls of other CPUs. The effects of -this option may change in future GCC versions as CPU models come and go. - -@option{-mtune=native} causes the compiler to auto-detect the CPU -of the build computer. At present, this feature is only supported on -GNU/Linux, and not all architectures are recognized. If the auto-detect is -unsuccessful the option has no effect. - -@item -mcpu=@var{name} -@opindex mcpu -This specifies the name of the target ARM processor. GCC uses this name -to derive the name of the target ARM architecture (as if specified -by @option{-march}) and the ARM processor type for which to tune for -performance (as if specified by @option{-mtune}). Where this option -is used in conjunction with @option{-march} or @option{-mtune}, -those options take precedence over the appropriate part of this option. - -Permissible names for this option are the same as those for -@option{-mtune}. - -@option{-mcpu=generic-@var{arch}} is also permissible, and is -equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. -See @option{-mtune} for more information. - -@option{-mcpu=native} causes the compiler to auto-detect the CPU -of the build computer. At present, this feature is only supported on -GNU/Linux, and not all architectures are recognized. If the auto-detect -is unsuccessful the option has no effect. - -@item -mfpu=@var{name} -@opindex mfpu -This specifies what floating-point hardware (or hardware emulation) is -available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3}, -@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, -@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, -@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, -@samp{fpv5-d16}, @samp{fpv5-sp-d16}, -@samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}. - -If @option{-msoft-float} is specified this specifies the format of -floating-point values. - -If the selected floating-point hardware includes the NEON extension -(e.g. @option{-mfpu}=@samp{neon}), note that floating-point -operations are not generated by GCC's auto-vectorization pass unless -@option{-funsafe-math-optimizations} is also specified. This is -because NEON hardware does not fully implement the IEEE 754 standard for -floating-point arithmetic (in particular denormal values are treated as -zero), so the use of NEON instructions may lead to a loss of precision. - -@item -mfp16-format=@var{name} -@opindex mfp16-format -Specify the format of the @code{__fp16} half-precision floating-point type. -Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; -the default is @samp{none}, in which case the @code{__fp16} type is not -defined. @xref{Half-Precision}, for more information. - -@item -mstructure-size-boundary=@var{n} -@opindex mstructure-size-boundary -The sizes of all structures and unions are rounded up to a multiple -of the number of bits set by this option. Permissible values are 8, 32 -and 64. The default value varies for different toolchains. For the COFF -targeted toolchain the default value is 8. A value of 64 is only allowed -if the underlying ABI supports it. - -Specifying a larger number can produce faster, more efficient code, but -can also increase the size of the program. Different values are potentially -incompatible. Code compiled with one value cannot necessarily expect to -work with code or libraries compiled with another value, if they exchange -information using structures or unions. - -@item -mabort-on-noreturn -@opindex mabort-on-noreturn -Generate a call to the function @code{abort} at the end of a -@code{noreturn} function. It is executed if the function tries to -return. - -@item -mlong-calls -@itemx -mno-long-calls -@opindex mlong-calls -@opindex mno-long-calls -Tells the compiler to perform function calls by first loading the -address of the function into a register and then performing a subroutine -call on this register. This switch is needed if the target function -lies outside of the 64-megabyte addressing range of the offset-based -version of subroutine call instruction. - -Even if this switch is enabled, not all function calls are turned -into long calls. The heuristic is that static functions, functions -that have the @code{short_call} attribute, functions that are inside -the scope of a @code{#pragma no_long_calls} directive, and functions whose -definitions have already been compiled within the current compilation -unit are not turned into long calls. The exceptions to this rule are -that weak function definitions, functions with the @code{long_call} -attribute or the @code{section} attribute, and functions that are within -the scope of a @code{#pragma long_calls} directive are always -turned into long calls. - -This feature is not enabled by default. Specifying -@option{-mno-long-calls} restores the default behavior, as does -placing the function calls within the scope of a @code{#pragma -long_calls_off} directive. Note these switches have no effect on how -the compiler generates code to handle function calls via function -pointers. - -@item -msingle-pic-base -@opindex msingle-pic-base -Treat the register used for PIC addressing as read-only, rather than -loading it in the prologue for each function. The runtime system is -responsible for initializing this register with an appropriate value -before execution begins. - -@item -mpic-register=@var{reg} -@opindex mpic-register -Specify the register to be used for PIC addressing. -For standard PIC base case, the default is any suitable register -determined by compiler. For single PIC base case, the default is -@samp{R9} if target is EABI based or stack-checking is enabled, -otherwise the default is @samp{R10}. - -@item -mpic-data-is-text-relative -@opindex mpic-data-is-text-relative -Assume that each data segments are relative to text segment at load time. -Therefore, it permits addressing data using PC-relative operations. -This option is on by default for targets other than VxWorks RTP. - -@item -mpoke-function-name -@opindex mpoke-function-name -Write the name of each function into the text section, directly -preceding the function prologue. The generated code is similar to this: - -@smallexample - t0 - .ascii "arm_poke_function_name", 0 - .align - t1 - .word 0xff000000 + (t1 - t0) - arm_poke_function_name - mov ip, sp - stmfd sp!, @{fp, ip, lr, pc@} - sub fp, ip, #4 -@end smallexample - -When performing a stack backtrace, code can inspect the value of -@code{pc} stored at @code{fp + 0}. If the trace function then looks at -location @code{pc - 12} and the top 8 bits are set, then we know that -there is a function name embedded immediately preceding this location -and has length @code{((pc[-3]) & 0xff000000)}. - -@item -mthumb -@itemx -marm -@opindex marm -@opindex mthumb - -Select between generating code that executes in ARM and Thumb -states. The default for most configurations is to generate code -that executes in ARM state, but the default can be changed by -configuring GCC with the @option{--with-mode=}@var{state} -configure option. - -@item -mtpcs-frame -@opindex mtpcs-frame -Generate a stack frame that is compliant with the Thumb Procedure Call -Standard for all non-leaf functions. (A leaf function is one that does -not call any other functions.) The default is @option{-mno-tpcs-frame}. - -@item -mtpcs-leaf-frame -@opindex mtpcs-leaf-frame -Generate a stack frame that is compliant with the Thumb Procedure Call -Standard for all leaf functions. (A leaf function is one that does -not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. - -@item -mcallee-super-interworking -@opindex mcallee-super-interworking -Gives all externally visible functions in the file being compiled an ARM -instruction set header which switches to Thumb mode before executing the -rest of the function. This allows these functions to be called from -non-interworking code. This option is not valid in AAPCS configurations -because interworking is enabled by default. - -@item -mcaller-super-interworking -@opindex mcaller-super-interworking -Allows calls via function pointers (including virtual functions) to -execute correctly regardless of whether the target code has been -compiled for interworking or not. There is a small overhead in the cost -of executing a function pointer if this option is enabled. This option -is not valid in AAPCS configurations because interworking is enabled -by default. - -@item -mtp=@var{name} -@opindex mtp -Specify the access model for the thread local storage pointer. The valid -models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, -@samp{cp15}, which fetches the thread pointer from @code{cp15} directly -(supported in the arm6k architecture), and @samp{auto}, which uses the -best available method for the selected processor. The default setting is -@samp{auto}. - -@item -mtls-dialect=@var{dialect} -@opindex mtls-dialect -Specify the dialect to use for accessing thread local storage. Two -@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The -@samp{gnu} dialect selects the original GNU scheme for supporting -local and global dynamic TLS models. The @samp{gnu2} dialect -selects the GNU descriptor scheme, which provides better performance -for shared libraries. The GNU descriptor scheme is compatible with -the original scheme, but does require new assembler, linker and -library support. Initial and local exec TLS models are unaffected by -this option and always use the original scheme. - -@item -mword-relocations -@opindex mword-relocations -Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). -This is enabled by default on targets (uClinux, SymbianOS) where the runtime -loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} -is specified. - -@item -mfix-cortex-m3-ldrd -@opindex mfix-cortex-m3-ldrd -Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions -with overlapping destination and base registers are used. This option avoids -generating these instructions. This option is enabled by default when -@option{-mcpu=cortex-m3} is specified. - -@item -munaligned-access -@itemx -mno-unaligned-access -@opindex munaligned-access -@opindex mno-unaligned-access -Enables (or disables) reading and writing of 16- and 32- bit values -from addresses that are not 16- or 32- bit aligned. By default -unaligned access is disabled for all pre-ARMv6 and all ARMv6-M -architectures, and enabled for all other architectures. If unaligned -access is not enabled then words in packed data structures are -accessed a byte at a time. - -The ARM attribute @code{Tag_CPU_unaligned_access} is set in the -generated object file to either true or false, depending upon the -setting of this option. If unaligned access is enabled then the -preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also -defined. - -@item -mneon-for-64bits -@opindex mneon-for-64bits -Enables using Neon to handle scalar 64-bits operations. This is -disabled by default since the cost of moving data from core registers -to Neon is high. - -@item -mslow-flash-data -@opindex mslow-flash-data -Assume loading data from flash is slower than fetching instruction. -Therefore literal load is minimized for better performance. -This option is only supported when compiling for ARMv7 M-profile and -off by default. - -@item -masm-syntax-unified -@opindex masm-syntax-unified -Assume inline assembler is using unified asm syntax. The default is -currently off which implies divided syntax. Currently this option is -available only for Thumb1 and has no effect on ARM state and Thumb2. -However, this may change in future releases of GCC. Divided syntax -should be considered deprecated. - -@item -mrestrict-it -@opindex mrestrict-it -Restricts generation of IT blocks to conform to the rules of ARMv8. -IT blocks can only contain a single 16-bit instruction from a select -set of instructions. This option is on by default for ARMv8 Thumb mode. - -@item -mprint-tune-info -@opindex mprint-tune-info -Print CPU tuning information as comment in assembler file. This is -an option used only for regression testing of the compiler and not -intended for ordinary use in compiling code. This option is disabled -by default. -@end table - -@node AVR Options -@subsection AVR Options -@cindex AVR Options - -These options are defined for AVR implementations: - -@table @gcctabopt -@item -mmcu=@var{mcu} -@opindex mmcu -Specify Atmel AVR instruction set architectures (ISA) or MCU type. - -The default for this option is@tie{}@samp{avr2}. - -GCC supports the following AVR devices and ISAs: - -@include avr-mmcu.texi - -@item -maccumulate-args -@opindex maccumulate-args -Accumulate outgoing function arguments and acquire/release the needed -stack space for outgoing function arguments once in function -prologue/epilogue. Without this option, outgoing arguments are pushed -before calling a function and popped afterwards. - -Popping the arguments after the function call can be expensive on -AVR so that accumulating the stack space might lead to smaller -executables because arguments need not to be removed from the -stack after such a function call. - -This option can lead to reduced code size for functions that perform -several calls to functions that get their arguments on the stack like -calls to printf-like functions. - -@item -mbranch-cost=@var{cost} -@opindex mbranch-cost -Set the branch costs for conditional branch instructions to -@var{cost}. Reasonable values for @var{cost} are small, non-negative -integers. The default branch cost is 0. - -@item -mcall-prologues -@opindex mcall-prologues -Functions prologues/epilogues are expanded as calls to appropriate -subroutines. Code size is smaller. - -@item -mint8 -@opindex mint8 -Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a -@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, -and @code{long long} is 4 bytes. Please note that this option does not -conform to the C standards, but it results in smaller code -size. - -@item -mn-flash=@var{num} -@opindex mn-flash -Assume that the flash memory has a size of -@var{num} times 64@tie{}KiB. - -@item -mno-interrupts -@opindex mno-interrupts -Generated code is not compatible with hardware interrupts. -Code size is smaller. - -@item -mrelax -@opindex mrelax -Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter -@code{RCALL} resp.@: @code{RJMP} instruction if applicable. -Setting @option{-mrelax} just adds the @option{--mlink-relax} option to -the assembler's command line and the @option{--relax} option to the -linker's command line. - -Jump relaxing is performed by the linker because jump offsets are not -known before code is located. Therefore, the assembler code generated by the -compiler is the same, but the instructions in the executable may -differ from instructions in the assembler code. - -Relaxing must be turned on if linker stubs are needed, see the -section on @code{EIND} and linker stubs below. - -@item -mrmw -@opindex mrmw -Assume that the device supports the Read-Modify-Write -instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. - -@item -msp8 -@opindex msp8 -Treat the stack pointer register as an 8-bit register, -i.e.@: assume the high byte of the stack pointer is zero. -In general, you don't need to set this option by hand. - -This option is used internally by the compiler to select and -build multilibs for architectures @code{avr2} and @code{avr25}. -These architectures mix devices with and without @code{SPH}. -For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} -the compiler driver adds or removes this option from the compiler -proper's command line, because the compiler then knows if the device -or architecture has an 8-bit stack pointer and thus no @code{SPH} -register or not. - -@item -mstrict-X -@opindex mstrict-X -Use address register @code{X} in a way proposed by the hardware. This means -that @code{X} is only used in indirect, post-increment or -pre-decrement addressing. - -Without this option, the @code{X} register may be used in the same way -as @code{Y} or @code{Z} which then is emulated by additional -instructions. -For example, loading a value with @code{X+const} addressing with a -small non-negative @code{const < 64} to a register @var{Rn} is -performed as - -@example -adiw r26, const ; X += const -ld @var{Rn}, X ; @var{Rn} = *X -sbiw r26, const ; X -= const -@end example - -@item -mtiny-stack -@opindex mtiny-stack -Only change the lower 8@tie{}bits of the stack pointer. - -@item -nodevicelib -@opindex nodevicelib -Don't link against AVR-LibC's device specific library @code{libdev.a}. - -@item -Waddr-space-convert -@opindex Waddr-space-convert -Warn about conversions between address spaces in the case where the -resulting address space is not contained in the incoming address space. -@end table - -@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash -@cindex @code{EIND} -Pointers in the implementation are 16@tie{}bits wide. -The address of a function or label is represented as word address so -that indirect jumps and calls can target any code address in the -range of 64@tie{}Ki words. - -In order to facilitate indirect jump on devices with more than 128@tie{}Ki -bytes of program memory space, there is a special function register called -@code{EIND} that serves as most significant part of the target address -when @code{EICALL} or @code{EIJMP} instructions are used. - -Indirect jumps and calls on these devices are handled as follows by -the compiler and are subject to some limitations: - -@itemize @bullet - -@item -The compiler never sets @code{EIND}. - -@item -The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP} -instructions or might read @code{EIND} directly in order to emulate an -indirect call/jump by means of a @code{RET} instruction. - -@item -The compiler assumes that @code{EIND} never changes during the startup -code or during the application. In particular, @code{EIND} is not -saved/restored in function or interrupt service routine -prologue/epilogue. - -@item -For indirect calls to functions and computed goto, the linker -generates @emph{stubs}. Stubs are jump pads sometimes also called -@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. -The stub contains a direct jump to the desired address. - -@item -Linker relaxation must be turned on so that the linker generates -the stubs correctly in all situations. See the compiler option -@option{-mrelax} and the linker option @option{--relax}. -There are corner cases where the linker is supposed to generate stubs -but aborts without relaxation and without a helpful error message. - -@item -The default linker script is arranged for code with @code{EIND = 0}. -If code is supposed to work for a setup with @code{EIND != 0}, a custom -linker script has to be used in order to place the sections whose -name start with @code{.trampolines} into the segment where @code{EIND} -points to. - -@item -The startup code from libgcc never sets @code{EIND}. -Notice that startup code is a blend of code from libgcc and AVR-LibC. -For the impact of AVR-LibC on @code{EIND}, see the -@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. - -@item -It is legitimate for user-specific startup code to set up @code{EIND} -early, for example by means of initialization code located in -section @code{.init3}. Such code runs prior to general startup code -that initializes RAM and calls constructors, but after the bit -of startup code from AVR-LibC that sets @code{EIND} to the segment -where the vector table is located. -@example -#include - -static void -__attribute__((section(".init3"),naked,used,no_instrument_function)) -init3_set_eind (void) -@{ - __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" - "out %i0,r24" :: "n" (&EIND) : "r24","memory"); -@} -@end example - -@noindent -The @code{__trampolines_start} symbol is defined in the linker script. - -@item -Stubs are generated automatically by the linker if -the following two conditions are met: -@itemize @minus - -@item The address of a label is taken by means of the @code{gs} modifier -(short for @emph{generate stubs}) like so: -@example -LDI r24, lo8(gs(@var{func})) -LDI r25, hi8(gs(@var{func})) -@end example -@item The final location of that label is in a code segment -@emph{outside} the segment where the stubs are located. -@end itemize - -@item -The compiler emits such @code{gs} modifiers for code labels in the -following situations: -@itemize @minus -@item Taking address of a function or code label. -@item Computed goto. -@item If prologue-save function is used, see @option{-mcall-prologues} -command-line option. -@item Switch/case dispatch tables. If you do not want such dispatch -tables you can specify the @option{-fno-jump-tables} command-line option. -@item C and C++ constructors/destructors called during startup/shutdown. -@item If the tools hit a @code{gs()} modifier explained above. -@end itemize - -@item -Jumping to non-symbolic addresses like so is @emph{not} supported: - -@example -int main (void) -@{ - /* Call function at word address 0x2 */ - return ((int(*)(void)) 0x2)(); -@} -@end example - -Instead, a stub has to be set up, i.e.@: the function has to be called -through a symbol (@code{func_4} in the example): - -@example -int main (void) -@{ - extern int func_4 (void); - - /* Call function at byte address 0x4 */ - return func_4(); -@} -@end example - -and the application be linked with @option{-Wl,--defsym,func_4=0x4}. -Alternatively, @code{func_4} can be defined in the linker script. -@end itemize - -@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers -@cindex @code{RAMPD} -@cindex @code{RAMPX} -@cindex @code{RAMPY} -@cindex @code{RAMPZ} -Some AVR devices support memories larger than the 64@tie{}KiB range -that can be accessed with 16-bit pointers. To access memory locations -outside this 64@tie{}KiB range, the contentent of a @code{RAMP} -register is used as high part of the address: -The @code{X}, @code{Y}, @code{Z} address register is concatenated -with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function -register, respectively, to get a wide address. Similarly, -@code{RAMPD} is used together with direct addressing. - -@itemize -@item -The startup code initializes the @code{RAMP} special function -registers with zero. - -@item -If a @ref{AVR Named Address Spaces,named address space} other than -generic or @code{__flash} is used, then @code{RAMPZ} is set -as needed before the operation. - -@item -If the device supports RAM larger than 64@tie{}KiB and the compiler -needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} -is reset to zero after the operation. - -@item -If the device comes with a specific @code{RAMP} register, the ISR -prologue/epilogue saves/restores that SFR and initializes it with -zero in case the ISR code might (implicitly) use it. - -@item -RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. -If you use inline assembler to read from locations outside the -16-bit address range and change one of the @code{RAMP} registers, -you must reset it to zero after the access. - -@end itemize - -@subsubsection AVR Built-in Macros - -GCC defines several built-in macros so that the user code can test -for the presence or absence of features. Almost any of the following -built-in macros are deduced from device capabilities and thus -triggered by the @option{-mmcu=} command-line option. - -For even more AVR-specific built-in macros see -@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. - -@table @code - -@item __AVR_ARCH__ -Build-in macro that resolves to a decimal number that identifies the -architecture and depends on the @option{-mmcu=@var{mcu}} option. -Possible values are: - -@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, -@code{4}, @code{5}, @code{51}, @code{6} - -for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, -@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, - -respectively and - -@code{100}, @code{102}, @code{104}, -@code{105}, @code{106}, @code{107} - -for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4}, -@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. -If @var{mcu} specifies a device, this built-in macro is set -accordingly. For example, with @option{-mmcu=atmega8} the macro is -defined to @code{4}. - -@item __AVR_@var{Device}__ -Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects -the device's name. For example, @option{-mmcu=atmega8} defines the -built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines -@code{__AVR_ATtiny261A__}, etc. - -The built-in macros' names follow -the scheme @code{__AVR_@var{Device}__} where @var{Device} is -the device name as from the AVR user manual. The difference between -@var{Device} in the built-in macro and @var{device} in -@option{-mmcu=@var{device}} is that the latter is always lowercase. - -If @var{device} is not a device but only a core architecture like -@samp{avr51}, this macro is not defined. - -@item __AVR_DEVICE_NAME__ -Setting @option{-mmcu=@var{device}} defines this built-in macro to -the device's name. For example, with @option{-mmcu=atmega8} the macro -is defined to @code{atmega8}. - -If @var{device} is not a device but only a core architecture like -@samp{avr51}, this macro is not defined. - -@item __AVR_XMEGA__ -The device / architecture belongs to the XMEGA family of devices. - -@item __AVR_HAVE_ELPM__ -The device has the the @code{ELPM} instruction. - -@item __AVR_HAVE_ELPMX__ -The device has the @code{ELPM R@var{n},Z} and @code{ELPM -R@var{n},Z+} instructions. - -@item __AVR_HAVE_MOVW__ -The device has the @code{MOVW} instruction to perform 16-bit -register-register moves. - -@item __AVR_HAVE_LPMX__ -The device has the @code{LPM R@var{n},Z} and -@code{LPM R@var{n},Z+} instructions. - -@item __AVR_HAVE_MUL__ -The device has a hardware multiplier. - -@item __AVR_HAVE_JMP_CALL__ -The device has the @code{JMP} and @code{CALL} instructions. -This is the case for devices with at least 16@tie{}KiB of program -memory. - -@item __AVR_HAVE_EIJMP_EICALL__ -@itemx __AVR_3_BYTE_PC__ -The device has the @code{EIJMP} and @code{EICALL} instructions. -This is the case for devices with more than 128@tie{}KiB of program memory. -This also means that the program counter -(PC) is 3@tie{}bytes wide. - -@item __AVR_2_BYTE_PC__ -The program counter (PC) is 2@tie{}bytes wide. This is the case for devices -with up to 128@tie{}KiB of program memory. - -@item __AVR_HAVE_8BIT_SP__ -@itemx __AVR_HAVE_16BIT_SP__ -The stack pointer (SP) register is treated as 8-bit respectively -16-bit register by the compiler. -The definition of these macros is affected by @option{-mtiny-stack}. - -@item __AVR_HAVE_SPH__ -@itemx __AVR_SP8__ -The device has the SPH (high part of stack pointer) special function -register or has an 8-bit stack pointer, respectively. -The definition of these macros is affected by @option{-mmcu=} and -in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also -by @option{-msp8}. - -@item __AVR_HAVE_RAMPD__ -@itemx __AVR_HAVE_RAMPX__ -@itemx __AVR_HAVE_RAMPY__ -@itemx __AVR_HAVE_RAMPZ__ -The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, -@code{RAMPZ} special function register, respectively. - -@item __NO_INTERRUPTS__ -This macro reflects the @option{-mno-interrupts} command-line option. - -@item __AVR_ERRATA_SKIP__ -@itemx __AVR_ERRATA_SKIP_JMP_CALL__ -Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit -instructions because of a hardware erratum. Skip instructions are -@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. -The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also -set. - -@item __AVR_ISA_RMW__ -The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). - -@item __AVR_SFR_OFFSET__=@var{offset} -Instructions that can address I/O special function registers directly -like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different -address as if addressed by an instruction to access RAM like @code{LD} -or @code{STS}. This offset depends on the device architecture and has -to be subtracted from the RAM address in order to get the -respective I/O@tie{}address. - -@item __WITH_AVRLIBC__ -The compiler is configured to be used together with AVR-Libc. -See the @option{--with-avrlibc} configure option. - -@end table - -@node Blackfin Options -@subsection Blackfin Options -@cindex Blackfin Options - -@table @gcctabopt -@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} -@opindex mcpu= -Specifies the name of the target Blackfin processor. Currently, @var{cpu} -can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, -@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, -@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, -@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, -@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, -@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, -@samp{bf561}, @samp{bf592}. - -The optional @var{sirevision} specifies the silicon revision of the target -Blackfin processor. Any workarounds available for the targeted silicon revision -are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. -If @var{sirevision} is @samp{any}, all workarounds for the targeted processor -are enabled. The @code{__SILICON_REVISION__} macro is defined to two -hexadecimal digits representing the major and minor numbers in the silicon -revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} -is not defined. If @var{sirevision} is @samp{any}, the -@code{__SILICON_REVISION__} is defined to be @code{0xffff}. -If this optional @var{sirevision} is not used, GCC assumes the latest known -silicon revision of the targeted Blackfin processor. - -GCC defines a preprocessor macro for the specified @var{cpu}. -For the @samp{bfin-elf} toolchain, this option causes the hardware BSP -provided by libgloss to be linked in if @option{-msim} is not given. - -Without this option, @samp{bf532} is used as the processor by default. - -Note that support for @samp{bf561} is incomplete. For @samp{bf561}, -only the preprocessor macro is defined. - -@item -msim -@opindex msim -Specifies that the program will be run on the simulator. This causes -the simulator BSP provided by libgloss to be linked in. This option -has effect only for @samp{bfin-elf} toolchain. -Certain other options, such as @option{-mid-shared-library} and -@option{-mfdpic}, imply @option{-msim}. - -@item -momit-leaf-frame-pointer -@opindex momit-leaf-frame-pointer -Don't keep the frame pointer in a register for leaf functions. This -avoids the instructions to save, set up and restore frame pointers and -makes an extra register available in leaf functions. The option -@option{-fomit-frame-pointer} removes the frame pointer for all functions, -which might make debugging harder. - -@item -mspecld-anomaly -@opindex mspecld-anomaly -When enabled, the compiler ensures that the generated code does not -contain speculative loads after jump instructions. If this option is used, -@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. - -@item -mno-specld-anomaly -@opindex mno-specld-anomaly -Don't generate extra code to prevent speculative loads from occurring. - -@item -mcsync-anomaly -@opindex mcsync-anomaly -When enabled, the compiler ensures that the generated code does not -contain CSYNC or SSYNC instructions too soon after conditional branches. -If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. - -@item -mno-csync-anomaly -@opindex mno-csync-anomaly -Don't generate extra code to prevent CSYNC or SSYNC instructions from -occurring too soon after a conditional branch. - -@item -mlow-64k -@opindex mlow-64k -When enabled, the compiler is free to take advantage of the knowledge that -the entire program fits into the low 64k of memory. - -@item -mno-low-64k -@opindex mno-low-64k -Assume that the program is arbitrarily large. This is the default. - -@item -mstack-check-l1 -@opindex mstack-check-l1 -Do stack checking using information placed into L1 scratchpad memory by the -uClinux kernel. - -@item -mid-shared-library -@opindex mid-shared-library -Generate code that supports shared libraries via the library ID method. -This allows for execute in place and shared libraries in an environment -without virtual memory management. This option implies @option{-fPIC}. -With a @samp{bfin-elf} target, this option implies @option{-msim}. - -@item -mno-id-shared-library -@opindex mno-id-shared-library -Generate code that doesn't assume ID-based shared libraries are being used. -This is the default. - -@item -mleaf-id-shared-library -@opindex mleaf-id-shared-library -Generate code that supports shared libraries via the library ID method, -but assumes that this library or executable won't link against any other -ID shared libraries. That allows the compiler to use faster code for jumps -and calls. - -@item -mno-leaf-id-shared-library -@opindex mno-leaf-id-shared-library -Do not assume that the code being compiled won't link against any ID shared -libraries. Slower code is generated for jump and call insns. - -@item -mshared-library-id=n -@opindex mshared-library-id -Specifies the identification number of the ID-based shared library being -compiled. Specifying a value of 0 generates more compact code; specifying -other values forces the allocation of that number to the current -library but is no more space- or time-efficient than omitting this option. - -@item -msep-data -@opindex msep-data -Generate code that allows the data segment to be located in a different -area of memory from the text segment. This allows for execute in place in -an environment without virtual memory management by eliminating relocations -against the text section. - -@item -mno-sep-data -@opindex mno-sep-data -Generate code that assumes that the data segment follows the text segment. -This is the default. - -@item -mlong-calls -@itemx -mno-long-calls -@opindex mlong-calls -@opindex mno-long-calls -Tells the compiler to perform function calls by first loading the -address of the function into a register and then performing a subroutine -call on this register. This switch is needed if the target function -lies outside of the 24-bit addressing range of the offset-based -version of subroutine call instruction. - -This feature is not enabled by default. Specifying -@option{-mno-long-calls} restores the default behavior. Note these -switches have no effect on how the compiler generates code to handle -function calls via function pointers. - -@item -mfast-fp -@opindex mfast-fp -Link with the fast floating-point library. This library relaxes some of -the IEEE floating-point standard's rules for checking inputs against -Not-a-Number (NAN), in the interest of performance. - -@item -minline-plt -@opindex minline-plt -Enable inlining of PLT entries in function calls to functions that are -not known to bind locally. It has no effect without @option{-mfdpic}. - -@item -mmulticore -@opindex mmulticore -Build a standalone application for multicore Blackfin processors. -This option causes proper start files and link scripts supporting -multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. -It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. - -This option can be used with @option{-mcorea} or @option{-mcoreb}, which -selects the one-application-per-core programming model. Without -@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core -programming model is used. In this model, the main function of Core B -should be named as @code{coreb_main}. - -If this option is not used, the single-core application programming -model is used. - -@item -mcorea -@opindex mcorea -Build a standalone application for Core A of BF561 when using -the one-application-per-core programming model. Proper start files -and link scripts are used to support Core A, and the macro -@code{__BFIN_COREA} is defined. -This option can only be used in conjunction with @option{-mmulticore}. - -@item -mcoreb -@opindex mcoreb -Build a standalone application for Core B of BF561 when using -the one-application-per-core programming model. Proper start files -and link scripts are used to support Core B, and the macro -@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} -should be used instead of @code{main}. -This option can only be used in conjunction with @option{-mmulticore}. - -@item -msdram -@opindex msdram -Build a standalone application for SDRAM. Proper start files and -link scripts are used to put the application into SDRAM, and the macro -@code{__BFIN_SDRAM} is defined. -The loader should initialize SDRAM before loading the application. - -@item -micplb -@opindex micplb -Assume that ICPLBs are enabled at run time. This has an effect on certain -anomaly workarounds. For Linux targets, the default is to assume ICPLBs -are enabled; for standalone applications the default is off. -@end table - -@node C6X Options -@subsection C6X Options -@cindex C6X Options - -@table @gcctabopt -@item -march=@var{name} -@opindex march -This specifies the name of the target architecture. GCC uses this -name to determine what kind of instructions it can emit when generating -assembly code. Permissible names are: @samp{c62x}, -@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. - -@item -mbig-endian -@opindex mbig-endian -Generate code for a big-endian target. - -@item -mlittle-endian -@opindex mlittle-endian -Generate code for a little-endian target. This is the default. - -@item -msim -@opindex msim -Choose startup files and linker script suitable for the simulator. - -@item -msdata=default -@opindex msdata=default -Put small global and static data in the @code{.neardata} section, -which is pointed to by register @code{B14}. Put small uninitialized -global and static data in the @code{.bss} section, which is adjacent -to the @code{.neardata} section. Put small read-only data into the -@code{.rodata} section. The corresponding sections used for large -pieces of data are @code{.fardata}, @code{.far} and @code{.const}. - -@item -msdata=all -@opindex msdata=all -Put all data, not just small objects, into the sections reserved for -small data, and use addressing relative to the @code{B14} register to -access them. - -@item -msdata=none -@opindex msdata=none -Make no use of the sections reserved for small data, and use absolute -addresses to access all data. Put all initialized global and static -data in the @code{.fardata} section, and all uninitialized data in the -@code{.far} section. Put all constant data into the @code{.const} -section. -@end table - -@node CRIS Options -@subsection CRIS Options -@cindex CRIS Options - -These options are defined specifically for the CRIS ports. - -@table @gcctabopt -@item -march=@var{architecture-type} -@itemx -mcpu=@var{architecture-type} -@opindex march -@opindex mcpu -Generate code for the specified architecture. The choices for -@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for -respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. -Default is @samp{v0} except for cris-axis-linux-gnu, where the default is -@samp{v10}. - -@item -mtune=@var{architecture-type} -@opindex mtune -Tune to @var{architecture-type} everything applicable about the generated -code, except for the ABI and the set of available instructions. The -choices for @var{architecture-type} are the same as for -@option{-march=@var{architecture-type}}. - -@item -mmax-stack-frame=@var{n} -@opindex mmax-stack-frame -Warn when the stack frame of a function exceeds @var{n} bytes. - -@item -metrax4 -@itemx -metrax100 -@opindex metrax4 -@opindex metrax100 -The options @option{-metrax4} and @option{-metrax100} are synonyms for -@option{-march=v3} and @option{-march=v8} respectively. - -@item -mmul-bug-workaround -@itemx -mno-mul-bug-workaround -@opindex mmul-bug-workaround -@opindex mno-mul-bug-workaround -Work around a bug in the @code{muls} and @code{mulu} instructions for CPU -models where it applies. This option is active by default. - -@item -mpdebug -@opindex mpdebug -Enable CRIS-specific verbose debug-related information in the assembly -code. This option also has the effect of turning off the @samp{#NO_APP} -formatted-code indicator to the assembler at the beginning of the -assembly file. - -@item -mcc-init -@opindex mcc-init -Do not use condition-code results from previous instruction; always emit -compare and test instructions before use of condition codes. - -@item -mno-side-effects -@opindex mno-side-effects -Do not emit instructions with side effects in addressing modes other than -post-increment. - -@item -mstack-align -@itemx -mno-stack-align -@itemx -mdata-align -@itemx -mno-data-align -@itemx -mconst-align -@itemx -mno-const-align -@opindex mstack-align -@opindex mno-stack-align -@opindex mdata-align -@opindex mno-data-align -@opindex mconst-align -@opindex mno-const-align -These options (@samp{no-} options) arrange (eliminate arrangements) for the -stack frame, individual data and constants to be aligned for the maximum -single data access size for the chosen CPU model. The default is to -arrange for 32-bit alignment. ABI details such as structure layout are -not affected by these options. - -@item -m32-bit -@itemx -m16-bit -@itemx -m8-bit -@opindex m32-bit -@opindex m16-bit -@opindex m8-bit -Similar to the stack- data- and const-align options above, these options -arrange for stack frame, writable data and constants to all be 32-bit, -16-bit or 8-bit aligned. The default is 32-bit alignment. - -@item -mno-prologue-epilogue -@itemx -mprologue-epilogue -@opindex mno-prologue-epilogue -@opindex mprologue-epilogue -With @option{-mno-prologue-epilogue}, the normal function prologue and -epilogue which set up the stack frame are omitted and no return -instructions or return sequences are generated in the code. Use this -option only together with visual inspection of the compiled code: no -warnings or errors are generated when call-saved registers must be saved, -or storage for local variables needs to be allocated. - -@item -mno-gotplt -@itemx -mgotplt -@opindex mno-gotplt -@opindex mgotplt -With @option{-fpic} and @option{-fPIC}, don't generate (do generate) -instruction sequences that load addresses for functions from the PLT part -of the GOT rather than (traditional on other architectures) calls to the -PLT@. The default is @option{-mgotplt}. - -@item -melf -@opindex melf -Legacy no-op option only recognized with the cris-axis-elf and -cris-axis-linux-gnu targets. - -@item -mlinux -@opindex mlinux -Legacy no-op option only recognized with the cris-axis-linux-gnu target. - -@item -sim -@opindex sim -This option, recognized for the cris-axis-elf, arranges -to link with input-output functions from a simulator library. Code, -initialized data and zero-initialized data are allocated consecutively. - -@item -sim2 -@opindex sim2 -Like @option{-sim}, but pass linker options to locate initialized data at -0x40000000 and zero-initialized data at 0x80000000. -@end table - -@node CR16 Options -@subsection CR16 Options -@cindex CR16 Options - -These options are defined specifically for the CR16 ports. - -@table @gcctabopt - -@item -mmac -@opindex mmac -Enable the use of multiply-accumulate instructions. Disabled by default. - -@item -mcr16cplus -@itemx -mcr16c -@opindex mcr16cplus -@opindex mcr16c -Generate code for CR16C or CR16C+ architecture. CR16C+ architecture -is default. - -@item -msim -@opindex msim -Links the library libsim.a which is in compatible with simulator. Applicable -to ELF compiler only. - -@item -mint32 -@opindex mint32 -Choose integer type as 32-bit wide. - -@item -mbit-ops -@opindex mbit-ops -Generates @code{sbit}/@code{cbit} instructions for bit manipulations. - -@item -mdata-model=@var{model} -@opindex mdata-model -Choose a data model. The choices for @var{model} are @samp{near}, -@samp{far} or @samp{medium}. @samp{medium} is default. -However, @samp{far} is not valid with @option{-mcr16c}, as the -CR16C architecture does not support the far data model. -@end table - -@node Darwin Options -@subsection Darwin Options -@cindex Darwin options - -These options are defined for all architectures running the Darwin operating -system. - -FSF GCC on Darwin does not create ``fat'' object files; it creates -an object file for the single architecture that GCC was built to -target. Apple's GCC on Darwin does create ``fat'' files if multiple -@option{-arch} options are used; it does so by running the compiler or -linker multiple times and joining the results together with -@file{lipo}. - -The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or -@samp{i686}) is determined by the flags that specify the ISA -that GCC is targeting, like @option{-mcpu} or @option{-march}. The -@option{-force_cpusubtype_ALL} option can be used to override this. - -The Darwin tools vary in their behavior when presented with an ISA -mismatch. The assembler, @file{as}, only permits instructions to -be used that are valid for the subtype of the file it is generating, -so you cannot put 64-bit instructions in a @samp{ppc750} object file. -The linker for shared libraries, @file{/usr/bin/libtool}, fails -and prints an error if asked to create a shared library with a less -restrictive subtype than its input files (for instance, trying to put -a @samp{ppc970} object file in a @samp{ppc7400} library). The linker -for executables, @command{ld}, quietly gives the executable the most -restrictive subtype of any of its input files. - -@table @gcctabopt -@item -F@var{dir} -@opindex F -Add the framework directory @var{dir} to the head of the list of -directories to be searched for header files. These directories are -interleaved with those specified by @option{-I} options and are -scanned in a left-to-right order. - -A framework directory is a directory with frameworks in it. A -framework is a directory with a @file{Headers} and/or -@file{PrivateHeaders} directory contained directly in it that ends -in @file{.framework}. The name of a framework is the name of this -directory excluding the @file{.framework}. Headers associated with -the framework are found in one of those two directories, with -@file{Headers} being searched first. A subframework is a framework -directory that is in a framework's @file{Frameworks} directory. -Includes of subframework headers can only appear in a header of a -framework that contains the subframework, or in a sibling subframework -header. Two subframeworks are siblings if they occur in the same -framework. A subframework should not have the same name as a -framework; a warning is issued if this is violated. Currently a -subframework cannot have subframeworks; in the future, the mechanism -may be extended to support this. The standard frameworks can be found -in @file{/System/Library/Frameworks} and -@file{/Library/Frameworks}. An example include looks like -@code{#include }, where @file{Framework} denotes -the name of the framework and @file{header.h} is found in the -@file{PrivateHeaders} or @file{Headers} directory. - -@item -iframework@var{dir} -@opindex iframework -Like @option{-F} except the directory is a treated as a system -directory. The main difference between this @option{-iframework} and -@option{-F} is that with @option{-iframework} the compiler does not -warn about constructs contained within header files found via -@var{dir}. This option is valid only for the C family of languages. - -@item -gused -@opindex gused -Emit debugging information for symbols that are used. For stabs -debugging format, this enables @option{-feliminate-unused-debug-symbols}. -This is by default ON@. - -@item -gfull -@opindex gfull -Emit debugging information for all symbols and types. - -@item -mmacosx-version-min=@var{version} -The earliest version of MacOS X that this executable will run on -is @var{version}. Typical values of @var{version} include @code{10.1}, -@code{10.2}, and @code{10.3.9}. - -If the compiler was built to use the system's headers by default, -then the default for this option is the system version on which the -compiler is running, otherwise the default is to make choices that -are compatible with as many systems and code bases as possible. - -@item -mkernel -@opindex mkernel -Enable kernel development mode. The @option{-mkernel} option sets -@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, -@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, -@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where -applicable. This mode also sets @option{-mno-altivec}, -@option{-msoft-float}, @option{-fno-builtin} and -@option{-mlong-branch} for PowerPC targets. - -@item -mone-byte-bool -@opindex mone-byte-bool -Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. -By default @code{sizeof(bool)} is @code{4} when compiling for -Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this -option has no effect on x86. - -@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC -to generate code that is not binary compatible with code generated -without that switch. Using this switch may require recompiling all -other modules in a program, including system libraries. Use this -switch to conform to a non-default data model. - -@item -mfix-and-continue -@itemx -ffix-and-continue -@itemx -findirect-data -@opindex mfix-and-continue -@opindex ffix-and-continue -@opindex findirect-data -Generate code suitable for fast turnaround development, such as to -allow GDB to dynamically load @file{.o} files into already-running -programs. @option{-findirect-data} and @option{-ffix-and-continue} -are provided for backwards compatibility. - -@item -all_load -@opindex all_load -Loads all members of static archive libraries. -See man ld(1) for more information. - -@item -arch_errors_fatal -@opindex arch_errors_fatal -Cause the errors having to do with files that have the wrong architecture -to be fatal. - -@item -bind_at_load -@opindex bind_at_load -Causes the output file to be marked such that the dynamic linker will -bind all undefined references when the file is loaded or launched. - -@item -bundle -@opindex bundle -Produce a Mach-o bundle format file. -See man ld(1) for more information. - -@item -bundle_loader @var{executable} -@opindex bundle_loader -This option specifies the @var{executable} that will load the build -output file being linked. See man ld(1) for more information. - -@item -dynamiclib -@opindex dynamiclib -When passed this option, GCC produces a dynamic library instead of -an executable when linking, using the Darwin @file{libtool} command. - -@item -force_cpusubtype_ALL -@opindex force_cpusubtype_ALL -This causes GCC's output file to have the @samp{ALL} subtype, instead of -one controlled by the @option{-mcpu} or @option{-march} option. - -@item -allowable_client @var{client_name} -@itemx -client_name -@itemx -compatibility_version -@itemx -current_version -@itemx -dead_strip -@itemx -dependency-file -@itemx -dylib_file -@itemx -dylinker_install_name -@itemx -dynamic -@itemx -exported_symbols_list -@itemx -filelist -@need 800 -@itemx -flat_namespace -@itemx -force_flat_namespace -@itemx -headerpad_max_install_names -@itemx -image_base -@itemx -init -@itemx -install_name -@itemx -keep_private_externs -@itemx -multi_module -@itemx -multiply_defined -@itemx -multiply_defined_unused -@need 800 -@itemx -noall_load -@itemx -no_dead_strip_inits_and_terms -@itemx -nofixprebinding -@itemx -nomultidefs -@itemx -noprebind -@itemx -noseglinkedit -@itemx -pagezero_size -@itemx -prebind -@itemx -prebind_all_twolevel_modules -@itemx -private_bundle -@need 800 -@itemx -read_only_relocs -@itemx -sectalign -@itemx -sectobjectsymbols -@itemx -whyload -@itemx -seg1addr -@itemx -sectcreate -@itemx -sectobjectsymbols -@itemx -sectorder -@itemx -segaddr -@itemx -segs_read_only_addr -@need 800 -@itemx -segs_read_write_addr -@itemx -seg_addr_table -@itemx -seg_addr_table_filename -@itemx -seglinkedit -@itemx -segprot -@itemx -segs_read_only_addr -@itemx -segs_read_write_addr -@itemx -single_module -@itemx -static -@itemx -sub_library -@need 800 -@itemx -sub_umbrella -@itemx -twolevel_namespace -@itemx -umbrella -@itemx -undefined -@itemx -unexported_symbols_list -@itemx -weak_reference_mismatches -@itemx -whatsloaded -@opindex allowable_client -@opindex client_name -@opindex compatibility_version -@opindex current_version -@opindex dead_strip -@opindex dependency-file -@opindex dylib_file -@opindex dylinker_install_name -@opindex dynamic -@opindex exported_symbols_list -@opindex filelist -@opindex flat_namespace -@opindex force_flat_namespace -@opindex headerpad_max_install_names -@opindex image_base -@opindex init -@opindex install_name -@opindex keep_private_externs -@opindex multi_module -@opindex multiply_defined -@opindex multiply_defined_unused -@opindex noall_load -@opindex no_dead_strip_inits_and_terms -@opindex nofixprebinding -@opindex nomultidefs -@opindex noprebind -@opindex noseglinkedit -@opindex pagezero_size -@opindex prebind -@opindex prebind_all_twolevel_modules -@opindex private_bundle -@opindex read_only_relocs -@opindex sectalign -@opindex sectobjectsymbols -@opindex whyload -@opindex seg1addr -@opindex sectcreate -@opindex sectobjectsymbols -@opindex sectorder -@opindex segaddr -@opindex segs_read_only_addr -@opindex segs_read_write_addr -@opindex seg_addr_table -@opindex seg_addr_table_filename -@opindex seglinkedit -@opindex segprot -@opindex segs_read_only_addr -@opindex segs_read_write_addr -@opindex single_module -@opindex static -@opindex sub_library -@opindex sub_umbrella -@opindex twolevel_namespace -@opindex umbrella -@opindex undefined -@opindex unexported_symbols_list -@opindex weak_reference_mismatches -@opindex whatsloaded -These options are passed to the Darwin linker. The Darwin linker man page -describes them in detail. -@end table - -@node DEC Alpha Options -@subsection DEC Alpha Options - -These @samp{-m} options are defined for the DEC Alpha implementations: - -@table @gcctabopt -@item -mno-soft-float -@itemx -msoft-float -@opindex mno-soft-float -@opindex msoft-float -Use (do not use) the hardware floating-point instructions for -floating-point operations. When @option{-msoft-float} is specified, -functions in @file{libgcc.a} are used to perform floating-point -operations. Unless they are replaced by routines that emulate the -floating-point operations, or compiled in such a way as to call such -emulations routines, these routines issue floating-point -operations. If you are compiling for an Alpha without floating-point -operations, you must ensure that the library is built so as not to call -them. - -Note that Alpha implementations without floating-point operations are -required to have floating-point registers. - -@item -mfp-reg -@itemx -mno-fp-regs -@opindex mfp-reg -@opindex mno-fp-regs -Generate code that uses (does not use) the floating-point register set. -@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point -register set is not used, floating-point operands are passed in integer -registers as if they were integers and floating-point results are passed -in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, -so any function with a floating-point argument or return value called by code -compiled with @option{-mno-fp-regs} must also be compiled with that -option. - -A typical use of this option is building a kernel that does not use, -and hence need not save and restore, any floating-point registers. - -@item -mieee -@opindex mieee -The Alpha architecture implements floating-point hardware optimized for -maximum performance. It is mostly compliant with the IEEE floating-point -standard. However, for full compliance, software assistance is -required. This option generates code fully IEEE-compliant code -@emph{except} that the @var{inexact-flag} is not maintained (see below). -If this option is turned on, the preprocessor macro @code{_IEEE_FP} is -defined during compilation. The resulting code is less efficient but is -able to correctly support denormalized numbers and exceptional IEEE -values such as not-a-number and plus/minus infinity. Other Alpha -compilers call this option @option{-ieee_with_no_inexact}. - -@item -mieee-with-inexact -@opindex mieee-with-inexact -This is like @option{-mieee} except the generated code also maintains -the IEEE @var{inexact-flag}. Turning on this option causes the -generated code to implement fully-compliant IEEE math. In addition to -@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor -macro. On some Alpha implementations the resulting code may execute -significantly slower than the code generated by default. Since there is -very little code that depends on the @var{inexact-flag}, you should -normally not specify this option. Other Alpha compilers call this -option @option{-ieee_with_inexact}. - -@item -mfp-trap-mode=@var{trap-mode} -@opindex mfp-trap-mode -This option controls what floating-point related traps are enabled. -Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. -The trap mode can be set to one of four values: - -@table @samp -@item n -This is the default (normal) setting. The only traps that are enabled -are the ones that cannot be disabled in software (e.g., division by zero -trap). - -@item u -In addition to the traps enabled by @samp{n}, underflow traps are enabled -as well. - -@item su -Like @samp{u}, but the instructions are marked to be safe for software -completion (see Alpha architecture manual for details). - -@item sui -Like @samp{su}, but inexact traps are enabled as well. -@end table - -@item -mfp-rounding-mode=@var{rounding-mode} -@opindex mfp-rounding-mode -Selects the IEEE rounding mode. Other Alpha compilers call this option -@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one -of: - -@table @samp -@item n -Normal IEEE rounding mode. Floating-point numbers are rounded towards -the nearest machine number or towards the even machine number in case -of a tie. - -@item m -Round towards minus infinity. - -@item c -Chopped rounding mode. Floating-point numbers are rounded towards zero. - -@item d -Dynamic rounding mode. A field in the floating-point control register -(@var{fpcr}, see Alpha architecture reference manual) controls the -rounding mode in effect. The C library initializes this register for -rounding towards plus infinity. Thus, unless your program modifies the -@var{fpcr}, @samp{d} corresponds to round towards plus infinity. -@end table - -@item -mtrap-precision=@var{trap-precision} -@opindex mtrap-precision -In the Alpha architecture, floating-point traps are imprecise. This -means without software assistance it is impossible to recover from a -floating trap and program execution normally needs to be terminated. -GCC can generate code that can assist operating system trap handlers -in determining the exact location that caused a floating-point trap. -Depending on the requirements of an application, different levels of -precisions can be selected: - -@table @samp -@item p -Program precision. This option is the default and means a trap handler -can only identify which program caused a floating-point exception. - -@item f -Function precision. The trap handler can determine the function that -caused a floating-point exception. - -@item i -Instruction precision. The trap handler can determine the exact -instruction that caused a floating-point exception. -@end table - -Other Alpha compilers provide the equivalent options called -@option{-scope_safe} and @option{-resumption_safe}. - -@item -mieee-conformant -@opindex mieee-conformant -This option marks the generated code as IEEE conformant. You must not -use this option unless you also specify @option{-mtrap-precision=i} and either -@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect -is to emit the line @samp{.eflag 48} in the function prologue of the -generated assembly file. - -@item -mbuild-constants -@opindex mbuild-constants -Normally GCC examines a 32- or 64-bit integer constant to -see if it can construct it from smaller constants in two or three -instructions. If it cannot, it outputs the constant as a literal and -generates code to load it from the data segment at run time. - -Use this option to require GCC to construct @emph{all} integer constants -using code, even if it takes more instructions (the maximum is six). - -You typically use this option to build a shared library dynamic -loader. Itself a shared library, it must relocate itself in memory -before it can find the variables and constants in its own data segment. - -@item -mbwx -@itemx -mno-bwx -@itemx -mcix -@itemx -mno-cix -@itemx -mfix -@itemx -mno-fix -@itemx -mmax -@itemx -mno-max -@opindex mbwx -@opindex mno-bwx -@opindex mcix -@opindex mno-cix -@opindex mfix -@opindex mno-fix -@opindex mmax -@opindex mno-max -Indicate whether GCC should generate code to use the optional BWX, -CIX, FIX and MAX instruction sets. The default is to use the instruction -sets supported by the CPU type specified via @option{-mcpu=} option or that -of the CPU on which GCC was built if none is specified. - -@item -mfloat-vax -@itemx -mfloat-ieee -@opindex mfloat-vax -@opindex mfloat-ieee -Generate code that uses (does not use) VAX F and G floating-point -arithmetic instead of IEEE single and double precision. - -@item -mexplicit-relocs -@itemx -mno-explicit-relocs -@opindex mexplicit-relocs -@opindex mno-explicit-relocs -Older Alpha assemblers provided no way to generate symbol relocations -except via assembler macros. Use of these macros does not allow -optimal instruction scheduling. GNU binutils as of version 2.12 -supports a new syntax that allows the compiler to explicitly mark -which relocations should apply to which instructions. This option -is mostly useful for debugging, as GCC detects the capabilities of -the assembler when it is built and sets the default accordingly. - -@item -msmall-data -@itemx -mlarge-data -@opindex msmall-data -@opindex mlarge-data -When @option{-mexplicit-relocs} is in effect, static data is -accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} -is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} -(the @code{.sdata} and @code{.sbss} sections) and are accessed via -16-bit relocations off of the @code{$gp} register. This limits the -size of the small data area to 64KB, but allows the variables to be -directly accessed via a single instruction. - -The default is @option{-mlarge-data}. With this option the data area -is limited to just below 2GB@. Programs that require more than 2GB of -data must use @code{malloc} or @code{mmap} to allocate the data in the -heap instead of in the program's data segment. - -When generating code for shared libraries, @option{-fpic} implies -@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. - -@item -msmall-text -@itemx -mlarge-text -@opindex msmall-text -@opindex mlarge-text -When @option{-msmall-text} is used, the compiler assumes that the -code of the entire program (or shared library) fits in 4MB, and is -thus reachable with a branch instruction. When @option{-msmall-data} -is used, the compiler can assume that all local symbols share the -same @code{$gp} value, and thus reduce the number of instructions -required for a function call from 4 to 1. - -The default is @option{-mlarge-text}. - -@item -mcpu=@var{cpu_type} -@opindex mcpu -Set the instruction set and instruction scheduling parameters for -machine type @var{cpu_type}. You can specify either the @samp{EV} -style name or the corresponding chip number. GCC supports scheduling -parameters for the EV4, EV5 and EV6 family of processors and -chooses the default values for the instruction set from the processor -you specify. If you do not specify a processor type, GCC defaults -to the processor on which the compiler was built. - -Supported values for @var{cpu_type} are - -@table @samp -@item ev4 -@itemx ev45 -@itemx 21064 -Schedules as an EV4 and has no instruction set extensions. - -@item ev5 -@itemx 21164 -Schedules as an EV5 and has no instruction set extensions. - -@item ev56 -@itemx 21164a -Schedules as an EV5 and supports the BWX extension. - -@item pca56 -@itemx 21164pc -@itemx 21164PC -Schedules as an EV5 and supports the BWX and MAX extensions. - -@item ev6 -@itemx 21264 -Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. - -@item ev67 -@itemx 21264a -Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. -@end table - -Native toolchains also support the value @samp{native}, -which selects the best architecture option for the host processor. -@option{-mcpu=native} has no effect if GCC does not recognize -the processor. - -@item -mtune=@var{cpu_type} -@opindex mtune -Set only the instruction scheduling parameters for machine type -@var{cpu_type}. The instruction set is not changed. - -Native toolchains also support the value @samp{native}, -which selects the best architecture option for the host processor. -@option{-mtune=native} has no effect if GCC does not recognize -the processor. - -@item -mmemory-latency=@var{time} -@opindex mmemory-latency -Sets the latency the scheduler should assume for typical memory -references as seen by the application. This number is highly -dependent on the memory access patterns used by the application -and the size of the external cache on the machine. - -Valid options for @var{time} are - -@table @samp -@item @var{number} -A decimal number representing clock cycles. - -@item L1 -@itemx L2 -@itemx L3 -@itemx main -The compiler contains estimates of the number of clock cycles for -``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches -(also called Dcache, Scache, and Bcache), as well as to main memory. -Note that L3 is only valid for EV5. - -@end table -@end table - -@node FR30 Options -@subsection FR30 Options -@cindex FR30 Options - -These options are defined specifically for the FR30 port. - -@table @gcctabopt - -@item -msmall-model -@opindex msmall-model -Use the small address space model. This can produce smaller code, but -it does assume that all symbolic values and addresses fit into a -20-bit range. - -@item -mno-lsim -@opindex mno-lsim -Assume that runtime support has been provided and so there is no need -to include the simulator library (@file{libsim.a}) on the linker -command line. - -@end table - -@node FRV Options -@subsection FRV Options -@cindex FRV Options - -@table @gcctabopt -@item -mgpr-32 -@opindex mgpr-32 - -Only use the first 32 general-purpose registers. - -@item -mgpr-64 -@opindex mgpr-64 - -Use all 64 general-purpose registers. - -@item -mfpr-32 -@opindex mfpr-32 - -Use only the first 32 floating-point registers. - -@item -mfpr-64 -@opindex mfpr-64 - -Use all 64 floating-point registers. - -@item -mhard-float -@opindex mhard-float - -Use hardware instructions for floating-point operations. - -@item -msoft-float -@opindex msoft-float - -Use library routines for floating-point operations. - -@item -malloc-cc -@opindex malloc-cc - -Dynamically allocate condition code registers. - -@item -mfixed-cc -@opindex mfixed-cc - -Do not try to dynamically allocate condition code registers, only -use @code{icc0} and @code{fcc0}. - -@item -mdword -@opindex mdword - -Change ABI to use double word insns. - -@item -mno-dword -@opindex mno-dword - -Do not use double word instructions. - -@item -mdouble -@opindex mdouble - -Use floating-point double instructions. - -@item -mno-double -@opindex mno-double - -Do not use floating-point double instructions. - -@item -mmedia -@opindex mmedia - -Use media instructions. - -@item -mno-media -@opindex mno-media - -Do not use media instructions. - -@item -mmuladd -@opindex mmuladd - -Use multiply and add/subtract instructions. - -@item -mno-muladd -@opindex mno-muladd - -Do not use multiply and add/subtract instructions. - -@item -mfdpic -@opindex mfdpic - -Select the FDPIC ABI, which uses function descriptors to represent -pointers to functions. Without any PIC/PIE-related options, it -implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it -assumes GOT entries and small data are within a 12-bit range from the -GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets -are computed with 32 bits. -With a @samp{bfin-elf} target, this option implies @option{-msim}. - -@item -minline-plt -@opindex minline-plt - -Enable inlining of PLT entries in function calls to functions that are -not known to bind locally. It has no effect without @option{-mfdpic}. -It's enabled by default if optimizing for speed and compiling for -shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an -optimization option such as @option{-O3} or above is present in the -command line. - -@item -mTLS -@opindex mTLS - -Assume a large TLS segment when generating thread-local code. - -@item -mtls -@opindex mtls - -Do not assume a large TLS segment when generating thread-local code. - -@item -mgprel-ro -@opindex mgprel-ro - -Enable the use of @code{GPREL} relocations in the FDPIC ABI for data -that is known to be in read-only sections. It's enabled by default, -except for @option{-fpic} or @option{-fpie}: even though it may help -make the global offset table smaller, it trades 1 instruction for 4. -With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, -one of which may be shared by multiple symbols, and it avoids the need -for a GOT entry for the referenced symbol, so it's more likely to be a -win. If it is not, @option{-mno-gprel-ro} can be used to disable it. - -@item -multilib-library-pic -@opindex multilib-library-pic - -Link with the (library, not FD) pic libraries. It's implied by -@option{-mlibrary-pic}, as well as by @option{-fPIC} and -@option{-fpic} without @option{-mfdpic}. You should never have to use -it explicitly. - -@item -mlinked-fp -@opindex mlinked-fp - -Follow the EABI requirement of always creating a frame pointer whenever -a stack frame is allocated. This option is enabled by default and can -be disabled with @option{-mno-linked-fp}. - -@item -mlong-calls -@opindex mlong-calls - -Use indirect addressing to call functions outside the current -compilation unit. This allows the functions to be placed anywhere -within the 32-bit address space. - -@item -malign-labels -@opindex malign-labels - -Try to align labels to an 8-byte boundary by inserting NOPs into the -previous packet. This option only has an effect when VLIW packing -is enabled. It doesn't create new packets; it merely adds NOPs to -existing ones. - -@item -mlibrary-pic -@opindex mlibrary-pic - -Generate position-independent EABI code. - -@item -macc-4 -@opindex macc-4 - -Use only the first four media accumulator registers. - -@item -macc-8 -@opindex macc-8 - -Use all eight media accumulator registers. - -@item -mpack -@opindex mpack - -Pack VLIW instructions. - -@item -mno-pack -@opindex mno-pack - -Do not pack VLIW instructions. - -@item -mno-eflags -@opindex mno-eflags - -Do not mark ABI switches in e_flags. - -@item -mcond-move -@opindex mcond-move - -Enable the use of conditional-move instructions (default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-cond-move -@opindex mno-cond-move - -Disable the use of conditional-move instructions. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mscc -@opindex mscc - -Enable the use of conditional set instructions (default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-scc -@opindex mno-scc - -Disable the use of conditional set instructions. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mcond-exec -@opindex mcond-exec - -Enable the use of conditional execution (default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-cond-exec -@opindex mno-cond-exec - -Disable the use of conditional execution. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mvliw-branch -@opindex mvliw-branch - -Run a pass to pack branches into VLIW instructions (default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-vliw-branch -@opindex mno-vliw-branch - -Do not run a pass to pack branches into VLIW instructions. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mmulti-cond-exec -@opindex mmulti-cond-exec - -Enable optimization of @code{&&} and @code{||} in conditional execution -(default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-multi-cond-exec -@opindex mno-multi-cond-exec - -Disable optimization of @code{&&} and @code{||} in conditional execution. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mnested-cond-exec -@opindex mnested-cond-exec - -Enable nested conditional execution optimizations (default). - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -mno-nested-cond-exec -@opindex mno-nested-cond-exec - -Disable nested conditional execution optimizations. - -This switch is mainly for debugging the compiler and will likely be removed -in a future version. - -@item -moptimize-membar -@opindex moptimize-membar - -This switch removes redundant @code{membar} instructions from the -compiler-generated code. It is enabled by default. - -@item -mno-optimize-membar -@opindex mno-optimize-membar - -This switch disables the automatic removal of redundant @code{membar} -instructions from the generated code. - -@item -mtomcat-stats -@opindex mtomcat-stats - -Cause gas to print out tomcat statistics. - -@item -mcpu=@var{cpu} -@opindex mcpu - -Select the processor type for which to generate code. Possible values are -@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, -@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. - -@end table - -@node GNU/Linux Options -@subsection GNU/Linux Options - -These @samp{-m} options are defined for GNU/Linux targets: - -@table @gcctabopt -@item -mglibc -@opindex mglibc -Use the GNU C library. This is the default except -on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. - -@item -muclibc -@opindex muclibc -Use uClibc C library. This is the default on -@samp{*-*-linux-*uclibc*} targets. - -@item -mbionic -@opindex mbionic -Use Bionic C library. This is the default on -@samp{*-*-linux-*android*} targets. - -@item -mandroid -@opindex mandroid -Compile code compatible with Android platform. This is the default on -@samp{*-*-linux-*android*} targets. - -When compiling, this option enables @option{-mbionic}, @option{-fPIC}, -@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, -this option makes the GCC driver pass Android-specific options to the linker. -Finally, this option causes the preprocessor macro @code{__ANDROID__} -to be defined. - -@item -tno-android-cc -@opindex tno-android-cc -Disable compilation effects of @option{-mandroid}, i.e., do not enable -@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and -@option{-fno-rtti} by default. - -@item -tno-android-ld -@opindex tno-android-ld -Disable linking effects of @option{-mandroid}, i.e., pass standard Linux -linking options to the linker. - -@end table - -@node H8/300 Options -@subsection H8/300 Options - -These @samp{-m} options are defined for the H8/300 implementations: - -@table @gcctabopt -@item -mrelax -@opindex mrelax -Shorten some address references at link time, when possible; uses the -linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, -ld, Using ld}, for a fuller description. - -@item -mh -@opindex mh -Generate code for the H8/300H@. - -@item -ms -@opindex ms -Generate code for the H8S@. - -@item -mn -@opindex mn -Generate code for the H8S and H8/300H in the normal mode. This switch -must be used either with @option{-mh} or @option{-ms}. - -@item -ms2600 -@opindex ms2600 -Generate code for the H8S/2600. This switch must be used with @option{-ms}. - -@item -mexr -@opindex mexr -Extended registers are stored on stack before execution of function -with monitor attribute. Default option is @option{-mexr}. -This option is valid only for H8S targets. - -@item -mno-exr -@opindex mno-exr -Extended registers are not stored on stack before execution of function -with monitor attribute. Default option is @option{-mno-exr}. -This option is valid only for H8S targets. - -@item -mint32 -@opindex mint32 -Make @code{int} data 32 bits by default. - -@item -malign-300 -@opindex malign-300 -On the H8/300H and H8S, use the same alignment rules as for the H8/300. -The default for the H8/300H and H8S is to align longs and floats on -4-byte boundaries. -@option{-malign-300} causes them to be aligned on 2-byte boundaries. -This option has no effect on the H8/300. -@end table - -@node HPPA Options -@subsection HPPA Options -@cindex HPPA Options - -These @samp{-m} options are defined for the HPPA family of computers: - -@table @gcctabopt -@item -march=@var{architecture-type} -@opindex march -Generate code for the specified architecture. The choices for -@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA -1.1, and @samp{2.0} for PA 2.0 processors. Refer to -@file{/usr/lib/sched.models} on an HP-UX system to determine the proper -architecture option for your machine. Code compiled for lower numbered -architectures runs on higher numbered architectures, but not the -other way around. - -@item -mpa-risc-1-0 -@itemx -mpa-risc-1-1 -@itemx -mpa-risc-2-0 -@opindex mpa-risc-1-0 -@opindex mpa-risc-1-1 -@opindex mpa-risc-2-0 -Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. - -@item -mjump-in-delay -@opindex mjump-in-delay -This option is ignored and provided for compatibility purposes only. - -@item -mdisable-fpregs -@opindex mdisable-fpregs -Prevent floating-point registers from being used in any manner. This is -necessary for compiling kernels that perform lazy context switching of -floating-point registers. If you use this option and attempt to perform -floating-point operations, the compiler aborts. - -@item -mdisable-indexing -@opindex mdisable-indexing -Prevent the compiler from using indexing address modes. This avoids some -rather obscure problems when compiling MIG generated code under MACH@. - -@item -mno-space-regs -@opindex mno-space-regs -Generate code that assumes the target has no space registers. This allows -GCC to generate faster indirect calls and use unscaled index address modes. - -Such code is suitable for level 0 PA systems and kernels. - -@item -mfast-indirect-calls -@opindex mfast-indirect-calls -Generate code that assumes calls never cross space boundaries. This -allows GCC to emit code that performs faster indirect calls. - -This option does not work in the presence of shared libraries or nested -functions. - -@item -mfixed-range=@var{register-range} -@opindex mfixed-range -Generate code treating the given register range as fixed registers. -A fixed register is one that the register allocator cannot use. This is -useful when compiling kernel code. A register range is specified as -two registers separated by a dash. Multiple register ranges can be -specified separated by a comma. - -@item -mlong-load-store -@opindex mlong-load-store -Generate 3-instruction load and store sequences as sometimes required by -the HP-UX 10 linker. This is equivalent to the @samp{+k} option to -the HP compilers. - -@item -mportable-runtime -@opindex mportable-runtime -Use the portable calling conventions proposed by HP for ELF systems. - -@item -mgas -@opindex mgas -Enable the use of assembler directives only GAS understands. - -@item -mschedule=@var{cpu-type} -@opindex mschedule -Schedule code according to the constraints for the machine type -@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} -@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer -to @file{/usr/lib/sched.models} on an HP-UX system to determine the -proper scheduling option for your machine. The default scheduling is -@samp{8000}. - -@item -mlinker-opt -@opindex mlinker-opt -Enable the optimization pass in the HP-UX linker. Note this makes symbolic -debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 -linkers in which they give bogus error messages when linking some programs. - -@item -msoft-float -@opindex msoft-float -Generate output containing library calls for floating point. -@strong{Warning:} the requisite libraries are not available for all HPPA -targets. Normally the facilities of the machine's usual C compiler are -used, but this cannot be done directly in cross-compilation. You must make -your own arrangements to provide suitable library functions for -cross-compilation. - -@option{-msoft-float} changes the calling convention in the output file; -therefore, it is only useful if you compile @emph{all} of a program with -this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GCC, with @option{-msoft-float} in order for -this to work. - -@item -msio -@opindex msio -Generate the predefine, @code{_SIO}, for server IO@. The default is -@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, -@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These -options are available under HP-UX and HI-UX@. - -@item -mgnu-ld -@opindex mgnu-ld -Use options specific to GNU @command{ld}. -This passes @option{-shared} to @command{ld} when -building a shared library. It is the default when GCC is configured, -explicitly or implicitly, with the GNU linker. This option does not -affect which @command{ld} is called; it only changes what parameters -are passed to that @command{ld}. -The @command{ld} that is called is determined by the -@option{--with-ld} configure option, GCC's program search path, and -finally by the user's @env{PATH}. The linker used by GCC can be printed -using @samp{which `gcc -print-prog-name=ld`}. This option is only available -on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. - -@item -mhp-ld -@opindex mhp-ld -Use options specific to HP @command{ld}. -This passes @option{-b} to @command{ld} when building -a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all -links. It is the default when GCC is configured, explicitly or -implicitly, with the HP linker. This option does not affect -which @command{ld} is called; it only changes what parameters are passed to that -@command{ld}. -The @command{ld} that is called is determined by the @option{--with-ld} -configure option, GCC's program search path, and finally by the user's -@env{PATH}. The linker used by GCC can be printed using @samp{which -`gcc -print-prog-name=ld`}. This option is only available on the 64-bit -HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. - -@item -mlong-calls -@opindex mno-long-calls -Generate code that uses long call sequences. This ensures that a call -is always able to reach linker generated stubs. The default is to generate -long calls only when the distance from the call site to the beginning -of the function or translation unit, as the case may be, exceeds a -predefined limit set by the branch type being used. The limits for -normal calls are 7,600,000 and 240,000 bytes, respectively for the -PA 2.0 and PA 1.X architectures. Sibcalls are always limited at -240,000 bytes. - -Distances are measured from the beginning of functions when using the -@option{-ffunction-sections} option, or when using the @option{-mgas} -and @option{-mno-portable-runtime} options together under HP-UX with -the SOM linker. - -It is normally not desirable to use this option as it degrades -performance. However, it may be useful in large applications, -particularly when partial linking is used to build the application. - -The types of long calls used depends on the capabilities of the -assembler and linker, and the type of code being generated. The -impact on systems that support long absolute calls, and long pic -symbol-difference or pc-relative calls should be relatively small. -However, an indirect call is used on 32-bit ELF systems in pic code -and it is quite long. - -@item -munix=@var{unix-std} -@opindex march -Generate compiler predefines and select a startfile for the specified -UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} -and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} -is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX -11.11 and later. The default values are @samp{93} for HP-UX 10.00, -@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 -and later. - -@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. -@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} -and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. -@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, -@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and -@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. - -It is @emph{important} to note that this option changes the interfaces -for various library routines. It also affects the operational behavior -of the C library. Thus, @emph{extreme} care is needed in using this -option. - -Library code that is intended to operate with more than one UNIX -standard must test, set and restore the variable @code{__xpg4_extended_mask} -as appropriate. Most GNU software doesn't provide this capability. - -@item -nolibdld -@opindex nolibdld -Suppress the generation of link options to search libdld.sl when the -@option{-static} option is specified on HP-UX 10 and later. - -@item -static -@opindex static -The HP-UX implementation of setlocale in libc has a dependency on -libdld.sl. There isn't an archive version of libdld.sl. Thus, -when the @option{-static} option is specified, special link options -are needed to resolve this dependency. - -On HP-UX 10 and later, the GCC driver adds the necessary options to -link with libdld.sl when the @option{-static} option is specified. -This causes the resulting binary to be dynamic. On the 64-bit port, -the linkers generate dynamic binaries by default in any case. The -@option{-nolibdld} option can be used to prevent the GCC driver from -adding these link options. - -@item -threads -@opindex threads -Add support for multithreading with the @dfn{dce thread} library -under HP-UX@. This option sets flags for both the preprocessor and -linker. -@end table - -@node IA-64 Options -@subsection IA-64 Options -@cindex IA-64 Options - -These are the @samp{-m} options defined for the Intel IA-64 architecture. - -@table @gcctabopt -@item -mbig-endian -@opindex mbig-endian -Generate code for a big-endian target. This is the default for HP-UX@. - -@item -mlittle-endian -@opindex mlittle-endian -Generate code for a little-endian target. This is the default for AIX5 -and GNU/Linux. - -@item -mgnu-as -@itemx -mno-gnu-as -@opindex mgnu-as -@opindex mno-gnu-as -Generate (or don't) code for the GNU assembler. This is the default. -@c Also, this is the default if the configure option @option{--with-gnu-as} -@c is used. - -@item -mgnu-ld -@itemx -mno-gnu-ld -@opindex mgnu-ld -@opindex mno-gnu-ld -Generate (or don't) code for the GNU linker. This is the default. -@c Also, this is the default if the configure option @option{--with-gnu-ld} -@c is used. - -@item -mno-pic -@opindex mno-pic -Generate code that does not use a global pointer register. The result -is not position independent code, and violates the IA-64 ABI@. - -@item -mvolatile-asm-stop -@itemx -mno-volatile-asm-stop -@opindex mvolatile-asm-stop -@opindex mno-volatile-asm-stop -Generate (or don't) a stop bit immediately before and after volatile asm -statements. - -@item -mregister-names -@itemx -mno-register-names -@opindex mregister-names -@opindex mno-register-names -Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for -the stacked registers. This may make assembler output more readable. - -@item -mno-sdata -@itemx -msdata -@opindex mno-sdata -@opindex msdata -Disable (or enable) optimizations that use the small data section. This may -be useful for working around optimizer bugs. - -@item -mconstant-gp -@opindex mconstant-gp -Generate code that uses a single constant global pointer value. This is -useful when compiling kernel code. - -@item -mauto-pic -@opindex mauto-pic -Generate code that is self-relocatable. This implies @option{-mconstant-gp}. -This is useful when compiling firmware code. - -@item -minline-float-divide-min-latency -@opindex minline-float-divide-min-latency -Generate code for inline divides of floating-point values -using the minimum latency algorithm. - -@item -minline-float-divide-max-throughput -@opindex minline-float-divide-max-throughput -Generate code for inline divides of floating-point values -using the maximum throughput algorithm. - -@item -mno-inline-float-divide -@opindex mno-inline-float-divide -Do not generate inline code for divides of floating-point values. - -@item -minline-int-divide-min-latency -@opindex minline-int-divide-min-latency -Generate code for inline divides of integer values -using the minimum latency algorithm. - -@item -minline-int-divide-max-throughput -@opindex minline-int-divide-max-throughput -Generate code for inline divides of integer values -using the maximum throughput algorithm. - -@item -mno-inline-int-divide -@opindex mno-inline-int-divide -Do not generate inline code for divides of integer values. - -@item -minline-sqrt-min-latency -@opindex minline-sqrt-min-latency -Generate code for inline square roots -using the minimum latency algorithm. - -@item -minline-sqrt-max-throughput -@opindex minline-sqrt-max-throughput -Generate code for inline square roots -using the maximum throughput algorithm. - -@item -mno-inline-sqrt -@opindex mno-inline-sqrt -Do not generate inline code for @code{sqrt}. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Do (don't) generate code that uses the fused multiply/add or multiply/subtract -instructions. The default is to use these instructions. - -@item -mno-dwarf2-asm -@itemx -mdwarf2-asm -@opindex mno-dwarf2-asm -@opindex mdwarf2-asm -Don't (or do) generate assembler code for the DWARF 2 line number debugging -info. This may be useful when not using the GNU assembler. - -@item -mearly-stop-bits -@itemx -mno-early-stop-bits -@opindex mearly-stop-bits -@opindex mno-early-stop-bits -Allow stop bits to be placed earlier than immediately preceding the -instruction that triggered the stop bit. This can improve instruction -scheduling, but does not always do so. - -@item -mfixed-range=@var{register-range} -@opindex mfixed-range -Generate code treating the given register range as fixed registers. -A fixed register is one that the register allocator cannot use. This is -useful when compiling kernel code. A register range is specified as -two registers separated by a dash. Multiple register ranges can be -specified separated by a comma. - -@item -mtls-size=@var{tls-size} -@opindex mtls-size -Specify bit size of immediate TLS offsets. Valid values are 14, 22, and -64. - -@item -mtune=@var{cpu-type} -@opindex mtune -Tune the instruction scheduling for a particular CPU, Valid values are -@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, -and @samp{mckinley}. - -@item -milp32 -@itemx -mlp64 -@opindex milp32 -@opindex mlp64 -Generate code for a 32-bit or 64-bit environment. -The 32-bit environment sets int, long and pointer to 32 bits. -The 64-bit environment sets int to 32 bits and long and pointer -to 64 bits. These are HP-UX specific flags. - -@item -mno-sched-br-data-spec -@itemx -msched-br-data-spec -@opindex mno-sched-br-data-spec -@opindex msched-br-data-spec -(Dis/En)able data speculative scheduling before reload. -This results in generation of @code{ld.a} instructions and -the corresponding check instructions (@code{ld.c} / @code{chk.a}). -The default is 'disable'. - -@item -msched-ar-data-spec -@itemx -mno-sched-ar-data-spec -@opindex msched-ar-data-spec -@opindex mno-sched-ar-data-spec -(En/Dis)able data speculative scheduling after reload. -This results in generation of @code{ld.a} instructions and -the corresponding check instructions (@code{ld.c} / @code{chk.a}). -The default is 'enable'. - -@item -mno-sched-control-spec -@itemx -msched-control-spec -@opindex mno-sched-control-spec -@opindex msched-control-spec -(Dis/En)able control speculative scheduling. This feature is -available only during region scheduling (i.e.@: before reload). -This results in generation of the @code{ld.s} instructions and -the corresponding check instructions @code{chk.s}. -The default is 'disable'. - -@item -msched-br-in-data-spec -@itemx -mno-sched-br-in-data-spec -@opindex msched-br-in-data-spec -@opindex mno-sched-br-in-data-spec -(En/Dis)able speculative scheduling of the instructions that -are dependent on the data speculative loads before reload. -This is effective only with @option{-msched-br-data-spec} enabled. -The default is 'enable'. - -@item -msched-ar-in-data-spec -@itemx -mno-sched-ar-in-data-spec -@opindex msched-ar-in-data-spec -@opindex mno-sched-ar-in-data-spec -(En/Dis)able speculative scheduling of the instructions that -are dependent on the data speculative loads after reload. -This is effective only with @option{-msched-ar-data-spec} enabled. -The default is 'enable'. - -@item -msched-in-control-spec -@itemx -mno-sched-in-control-spec -@opindex msched-in-control-spec -@opindex mno-sched-in-control-spec -(En/Dis)able speculative scheduling of the instructions that -are dependent on the control speculative loads. -This is effective only with @option{-msched-control-spec} enabled. -The default is 'enable'. - -@item -mno-sched-prefer-non-data-spec-insns -@itemx -msched-prefer-non-data-spec-insns -@opindex mno-sched-prefer-non-data-spec-insns -@opindex msched-prefer-non-data-spec-insns -If enabled, data-speculative instructions are chosen for schedule -only if there are no other choices at the moment. This makes -the use of the data speculation much more conservative. -The default is 'disable'. - -@item -mno-sched-prefer-non-control-spec-insns -@itemx -msched-prefer-non-control-spec-insns -@opindex mno-sched-prefer-non-control-spec-insns -@opindex msched-prefer-non-control-spec-insns -If enabled, control-speculative instructions are chosen for schedule -only if there are no other choices at the moment. This makes -the use of the control speculation much more conservative. -The default is 'disable'. - -@item -mno-sched-count-spec-in-critical-path -@itemx -msched-count-spec-in-critical-path -@opindex mno-sched-count-spec-in-critical-path -@opindex msched-count-spec-in-critical-path -If enabled, speculative dependencies are considered during -computation of the instructions priorities. This makes the use of the -speculation a bit more conservative. -The default is 'disable'. - -@item -msched-spec-ldc -@opindex msched-spec-ldc -Use a simple data speculation check. This option is on by default. - -@item -msched-control-spec-ldc -@opindex msched-spec-ldc -Use a simple check for control speculation. This option is on by default. - -@item -msched-stop-bits-after-every-cycle -@opindex msched-stop-bits-after-every-cycle -Place a stop bit after every cycle when scheduling. This option is on -by default. - -@item -msched-fp-mem-deps-zero-cost -@opindex msched-fp-mem-deps-zero-cost -Assume that floating-point stores and loads are not likely to cause a conflict -when placed into the same instruction group. This option is disabled by -default. - -@item -msel-sched-dont-check-control-spec -@opindex msel-sched-dont-check-control-spec -Generate checks for control speculation in selective scheduling. -This flag is disabled by default. - -@item -msched-max-memory-insns=@var{max-insns} -@opindex msched-max-memory-insns -Limit on the number of memory insns per instruction group, giving lower -priority to subsequent memory insns attempting to schedule in the same -instruction group. Frequently useful to prevent cache bank conflicts. -The default value is 1. - -@item -msched-max-memory-insns-hard-limit -@opindex msched-max-memory-insns-hard-limit -Makes the limit specified by @option{msched-max-memory-insns} a hard limit, -disallowing more than that number in an instruction group. -Otherwise, the limit is ``soft'', meaning that non-memory operations -are preferred when the limit is reached, but memory operations may still -be scheduled. - -@end table - -@node LM32 Options -@subsection LM32 Options -@cindex LM32 options - -These @option{-m} options are defined for the LatticeMico32 architecture: - -@table @gcctabopt -@item -mbarrel-shift-enabled -@opindex mbarrel-shift-enabled -Enable barrel-shift instructions. - -@item -mdivide-enabled -@opindex mdivide-enabled -Enable divide and modulus instructions. - -@item -mmultiply-enabled -@opindex multiply-enabled -Enable multiply instructions. - -@item -msign-extend-enabled -@opindex msign-extend-enabled -Enable sign extend instructions. - -@item -muser-enabled -@opindex muser-enabled -Enable user-defined instructions. - -@end table - -@node M32C Options -@subsection M32C Options -@cindex M32C options - -@table @gcctabopt -@item -mcpu=@var{name} -@opindex mcpu= -Select the CPU for which code is generated. @var{name} may be one of -@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to -/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for -the M32C/80 series. - -@item -msim -@opindex msim -Specifies that the program will be run on the simulator. This causes -an alternate runtime library to be linked in which supports, for -example, file I/O@. You must not use this option when generating -programs that will run on real hardware; you must provide your own -runtime library for whatever I/O functions are needed. - -@item -memregs=@var{number} -@opindex memregs= -Specifies the number of memory-based pseudo-registers GCC uses -during code generation. These pseudo-registers are used like real -registers, so there is a tradeoff between GCC's ability to fit the -code into available registers, and the performance penalty of using -memory instead of registers. Note that all modules in a program must -be compiled with the same value for this option. Because of that, you -must not use this option with GCC's default runtime libraries. - -@end table - -@node M32R/D Options -@subsection M32R/D Options -@cindex M32R/D options - -These @option{-m} options are defined for Renesas M32R/D architectures: - -@table @gcctabopt -@item -m32r2 -@opindex m32r2 -Generate code for the M32R/2@. - -@item -m32rx -@opindex m32rx -Generate code for the M32R/X@. - -@item -m32r -@opindex m32r -Generate code for the M32R@. This is the default. - -@item -mmodel=small -@opindex mmodel=small -Assume all objects live in the lower 16MB of memory (so that their addresses -can be loaded with the @code{ld24} instruction), and assume all subroutines -are reachable with the @code{bl} instruction. -This is the default. - -The addressability of a particular object can be set with the -@code{model} attribute. - -@item -mmodel=medium -@opindex mmodel=medium -Assume objects may be anywhere in the 32-bit address space (the compiler -generates @code{seth/add3} instructions to load their addresses), and -assume all subroutines are reachable with the @code{bl} instruction. - -@item -mmodel=large -@opindex mmodel=large -Assume objects may be anywhere in the 32-bit address space (the compiler -generates @code{seth/add3} instructions to load their addresses), and -assume subroutines may not be reachable with the @code{bl} instruction -(the compiler generates the much slower @code{seth/add3/jl} -instruction sequence). - -@item -msdata=none -@opindex msdata=none -Disable use of the small data area. Variables are put into -one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the -@code{section} attribute has been specified). -This is the default. - -The small data area consists of sections @code{.sdata} and @code{.sbss}. -Objects may be explicitly put in the small data area with the -@code{section} attribute using one of these sections. - -@item -msdata=sdata -@opindex msdata=sdata -Put small global and static data in the small data area, but do not -generate special code to reference them. - -@item -msdata=use -@opindex msdata=use -Put small global and static data in the small data area, and generate -special instructions to reference them. - -@item -G @var{num} -@opindex G -@cindex smaller data references -Put global and static objects less than or equal to @var{num} bytes -into the small data or BSS sections instead of the normal data or BSS -sections. The default value of @var{num} is 8. -The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} -for this option to have any effect. - -All modules should be compiled with the same @option{-G @var{num}} value. -Compiling with different values of @var{num} may or may not work; if it -doesn't the linker gives an error message---incorrect code is not -generated. - -@item -mdebug -@opindex mdebug -Makes the M32R-specific code in the compiler display some statistics -that might help in debugging programs. - -@item -malign-loops -@opindex malign-loops -Align all loops to a 32-byte boundary. - -@item -mno-align-loops -@opindex mno-align-loops -Do not enforce a 32-byte alignment for loops. This is the default. - -@item -missue-rate=@var{number} -@opindex missue-rate=@var{number} -Issue @var{number} instructions per cycle. @var{number} can only be 1 -or 2. - -@item -mbranch-cost=@var{number} -@opindex mbranch-cost=@var{number} -@var{number} can only be 1 or 2. If it is 1 then branches are -preferred over conditional code, if it is 2, then the opposite applies. - -@item -mflush-trap=@var{number} -@opindex mflush-trap=@var{number} -Specifies the trap number to use to flush the cache. The default is -12. Valid numbers are between 0 and 15 inclusive. - -@item -mno-flush-trap -@opindex mno-flush-trap -Specifies that the cache cannot be flushed by using a trap. - -@item -mflush-func=@var{name} -@opindex mflush-func=@var{name} -Specifies the name of the operating system function to call to flush -the cache. The default is @samp{_flush_cache}, but a function call -is only used if a trap is not available. - -@item -mno-flush-func -@opindex mno-flush-func -Indicates that there is no OS function for flushing the cache. - -@end table - -@node M680x0 Options -@subsection M680x0 Options -@cindex M680x0 options - -These are the @samp{-m} options defined for M680x0 and ColdFire processors. -The default settings depend on which architecture was selected when -the compiler was configured; the defaults for the most common choices -are given below. - -@table @gcctabopt -@item -march=@var{arch} -@opindex march -Generate code for a specific M680x0 or ColdFire instruction set -architecture. Permissible values of @var{arch} for M680x0 -architectures are: @samp{68000}, @samp{68010}, @samp{68020}, -@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire -architectures are selected according to Freescale's ISA classification -and the permissible values are: @samp{isaa}, @samp{isaaplus}, -@samp{isab} and @samp{isac}. - -GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating -code for a ColdFire target. The @var{arch} in this macro is one of the -@option{-march} arguments given above. - -When used together, @option{-march} and @option{-mtune} select code -that runs on a family of similar processors but that is optimized -for a particular microarchitecture. - -@item -mcpu=@var{cpu} -@opindex mcpu -Generate code for a specific M680x0 or ColdFire processor. -The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, -@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} -and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table -below, which also classifies the CPUs into families: - -@multitable @columnfractions 0.20 0.80 -@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} -@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm} -@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} -@item @samp{5206e} @tab @samp{5206e} -@item @samp{5208} @tab @samp{5207} @samp{5208} -@item @samp{5211a} @tab @samp{5210a} @samp{5211a} -@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} -@item @samp{5216} @tab @samp{5214} @samp{5216} -@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} -@item @samp{5225} @tab @samp{5224} @samp{5225} -@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} -@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} -@item @samp{5249} @tab @samp{5249} -@item @samp{5250} @tab @samp{5250} -@item @samp{5271} @tab @samp{5270} @samp{5271} -@item @samp{5272} @tab @samp{5272} -@item @samp{5275} @tab @samp{5274} @samp{5275} -@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} -@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} -@item @samp{5307} @tab @samp{5307} -@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} -@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} -@item @samp{5407} @tab @samp{5407} -@item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485} -@end multitable - -@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if -@var{arch} is compatible with @var{cpu}. Other combinations of -@option{-mcpu} and @option{-march} are rejected. - -GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target -@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, -where the value of @var{family} is given by the table above. - -@item -mtune=@var{tune} -@opindex mtune -Tune the code for a particular microarchitecture within the -constraints set by @option{-march} and @option{-mcpu}. -The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, -@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} -and @samp{cpu32}. The ColdFire microarchitectures -are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. - -You can also use @option{-mtune=68020-40} for code that needs -to run relatively well on 68020, 68030 and 68040 targets. -@option{-mtune=68020-60} is similar but includes 68060 targets -as well. These two options select the same tuning decisions as -@option{-m68020-40} and @option{-m68020-60} respectively. - -GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} -when tuning for 680x0 architecture @var{arch}. It also defines -@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} -option is used. If GCC is tuning for a range of architectures, -as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, -it defines the macros for every architecture in the range. - -GCC also defines the macro @code{__m@var{uarch}__} when tuning for -ColdFire microarchitecture @var{uarch}, where @var{uarch} is one -of the arguments given above. - -@item -m68000 -@itemx -mc68000 -@opindex m68000 -@opindex mc68000 -Generate output for a 68000. This is the default -when the compiler is configured for 68000-based systems. -It is equivalent to @option{-march=68000}. - -Use this option for microcontrollers with a 68000 or EC000 core, -including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. - -@item -m68010 -@opindex m68010 -Generate output for a 68010. This is the default -when the compiler is configured for 68010-based systems. -It is equivalent to @option{-march=68010}. - -@item -m68020 -@itemx -mc68020 -@opindex m68020 -@opindex mc68020 -Generate output for a 68020. This is the default -when the compiler is configured for 68020-based systems. -It is equivalent to @option{-march=68020}. - -@item -m68030 -@opindex m68030 -Generate output for a 68030. This is the default when the compiler is -configured for 68030-based systems. It is equivalent to -@option{-march=68030}. - -@item -m68040 -@opindex m68040 -Generate output for a 68040. This is the default when the compiler is -configured for 68040-based systems. It is equivalent to -@option{-march=68040}. - -This option inhibits the use of 68881/68882 instructions that have to be -emulated by software on the 68040. Use this option if your 68040 does not -have code to emulate those instructions. - -@item -m68060 -@opindex m68060 -Generate output for a 68060. This is the default when the compiler is -configured for 68060-based systems. It is equivalent to -@option{-march=68060}. - -This option inhibits the use of 68020 and 68881/68882 instructions that -have to be emulated by software on the 68060. Use this option if your 68060 -does not have code to emulate those instructions. - -@item -mcpu32 -@opindex mcpu32 -Generate output for a CPU32. This is the default -when the compiler is configured for CPU32-based systems. -It is equivalent to @option{-march=cpu32}. - -Use this option for microcontrollers with a -CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, -68336, 68340, 68341, 68349 and 68360. - -@item -m5200 -@opindex m5200 -Generate output for a 520X ColdFire CPU@. This is the default -when the compiler is configured for 520X-based systems. -It is equivalent to @option{-mcpu=5206}, and is now deprecated -in favor of that option. - -Use this option for microcontroller with a 5200 core, including -the MCF5202, MCF5203, MCF5204 and MCF5206. - -@item -m5206e -@opindex m5206e -Generate output for a 5206e ColdFire CPU@. The option is now -deprecated in favor of the equivalent @option{-mcpu=5206e}. - -@item -m528x -@opindex m528x -Generate output for a member of the ColdFire 528X family. -The option is now deprecated in favor of the equivalent -@option{-mcpu=528x}. - -@item -m5307 -@opindex m5307 -Generate output for a ColdFire 5307 CPU@. The option is now deprecated -in favor of the equivalent @option{-mcpu=5307}. - -@item -m5407 -@opindex m5407 -Generate output for a ColdFire 5407 CPU@. The option is now deprecated -in favor of the equivalent @option{-mcpu=5407}. - -@item -mcfv4e -@opindex mcfv4e -Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). -This includes use of hardware floating-point instructions. -The option is equivalent to @option{-mcpu=547x}, and is now -deprecated in favor of that option. - -@item -m68020-40 -@opindex m68020-40 -Generate output for a 68040, without using any of the new instructions. -This results in code that can run relatively efficiently on either a -68020/68881 or a 68030 or a 68040. The generated code does use the -68881 instructions that are emulated on the 68040. - -The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. - -@item -m68020-60 -@opindex m68020-60 -Generate output for a 68060, without using any of the new instructions. -This results in code that can run relatively efficiently on either a -68020/68881 or a 68030 or a 68040. The generated code does use the -68881 instructions that are emulated on the 68060. - -The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. - -@item -mhard-float -@itemx -m68881 -@opindex mhard-float -@opindex m68881 -Generate floating-point instructions. This is the default for 68020 -and above, and for ColdFire devices that have an FPU@. It defines the -macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} -on ColdFire targets. - -@item -msoft-float -@opindex msoft-float -Do not generate floating-point instructions; use library calls instead. -This is the default for 68000, 68010, and 68832 targets. It is also -the default for ColdFire devices that have no FPU. - -@item -mdiv -@itemx -mno-div -@opindex mdiv -@opindex mno-div -Generate (do not generate) ColdFire hardware divide and remainder -instructions. If @option{-march} is used without @option{-mcpu}, -the default is ``on'' for ColdFire architectures and ``off'' for M680x0 -architectures. Otherwise, the default is taken from the target CPU -(either the default CPU, or the one specified by @option{-mcpu}). For -example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for -@option{-mcpu=5206e}. - -GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. - -@item -mshort -@opindex mshort -Consider type @code{int} to be 16 bits wide, like @code{short int}. -Additionally, parameters passed on the stack are also aligned to a -16-bit boundary even on targets whose API mandates promotion to 32-bit. - -@item -mno-short -@opindex mno-short -Do not consider type @code{int} to be 16 bits wide. This is the default. - -@item -mnobitfield -@itemx -mno-bitfield -@opindex mnobitfield -@opindex mno-bitfield -Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} -and @option{-m5200} options imply @w{@option{-mnobitfield}}. - -@item -mbitfield -@opindex mbitfield -Do use the bit-field instructions. The @option{-m68020} option implies -@option{-mbitfield}. This is the default if you use a configuration -designed for a 68020. - -@item -mrtd -@opindex mrtd -Use a different function-calling convention, in which functions -that take a fixed number of arguments return with the @code{rtd} -instruction, which pops their arguments while returning. This -saves one instruction in the caller since there is no need to pop -the arguments there. - -This calling convention is incompatible with the one normally -used on Unix, so you cannot use it if you need to call libraries -compiled with the Unix compiler. - -Also, you must provide function prototypes for all functions that -take variable numbers of arguments (including @code{printf}); -otherwise incorrect code is generated for calls to those -functions. - -In addition, seriously incorrect code results if you call a -function with too many arguments. (Normally, extra arguments are -harmlessly ignored.) - -The @code{rtd} instruction is supported by the 68010, 68020, 68030, -68040, 68060 and CPU32 processors, but not by the 68000 or 5200. - -@item -mno-rtd -@opindex mno-rtd -Do not use the calling conventions selected by @option{-mrtd}. -This is the default. - -@item -malign-int -@itemx -mno-align-int -@opindex malign-int -@opindex mno-align-int -Control whether GCC aligns @code{int}, @code{long}, @code{long long}, -@code{float}, @code{double}, and @code{long double} variables on a 32-bit -boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). -Aligning variables on 32-bit boundaries produces code that runs somewhat -faster on processors with 32-bit busses at the expense of more memory. - -@strong{Warning:} if you use the @option{-malign-int} switch, GCC -aligns structures containing the above types differently than -most published application binary interface specifications for the m68k. - -@item -mpcrel -@opindex mpcrel -Use the pc-relative addressing mode of the 68000 directly, instead of -using a global offset table. At present, this option implies @option{-fpic}, -allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is -not presently supported with @option{-mpcrel}, though this could be supported for -68020 and higher processors. - -@item -mno-strict-align -@itemx -mstrict-align -@opindex mno-strict-align -@opindex mstrict-align -Do not (do) assume that unaligned memory references are handled by -the system. - -@item -msep-data -Generate code that allows the data segment to be located in a different -area of memory from the text segment. This allows for execute-in-place in -an environment without virtual memory management. This option implies -@option{-fPIC}. - -@item -mno-sep-data -Generate code that assumes that the data segment follows the text segment. -This is the default. - -@item -mid-shared-library -Generate code that supports shared libraries via the library ID method. -This allows for execute-in-place and shared libraries in an environment -without virtual memory management. This option implies @option{-fPIC}. - -@item -mno-id-shared-library -Generate code that doesn't assume ID-based shared libraries are being used. -This is the default. - -@item -mshared-library-id=n -Specifies the identification number of the ID-based shared library being -compiled. Specifying a value of 0 generates more compact code; specifying -other values forces the allocation of that number to the current -library, but is no more space- or time-efficient than omitting this option. - -@item -mxgot -@itemx -mno-xgot -@opindex mxgot -@opindex mno-xgot -When generating position-independent code for ColdFire, generate code -that works if the GOT has more than 8192 entries. This code is -larger and slower than code generated without this option. On M680x0 -processors, this option is not needed; @option{-fPIC} suffices. - -GCC normally uses a single instruction to load values from the GOT@. -While this is relatively efficient, it only works if the GOT -is smaller than about 64k. Anything larger causes the linker -to report an error such as: - -@cindex relocation truncated to fit (ColdFire) -@smallexample -relocation truncated to fit: R_68K_GOT16O foobar -@end smallexample - -If this happens, you should recompile your code with @option{-mxgot}. -It should then work with very large GOTs. However, code generated with -@option{-mxgot} is less efficient, since it takes 4 instructions to fetch -the value of a global symbol. - -Note that some linkers, including newer versions of the GNU linker, -can create multiple GOTs and sort GOT entries. If you have such a linker, -you should only need to use @option{-mxgot} when compiling a single -object file that accesses more than 8192 GOT entries. Very few do. - -These options have no effect unless GCC is generating -position-independent code. - -@end table - -@node MCore Options -@subsection MCore Options -@cindex MCore options - -These are the @samp{-m} options defined for the Motorola M*Core -processors. - -@table @gcctabopt - -@item -mhardlit -@itemx -mno-hardlit -@opindex mhardlit -@opindex mno-hardlit -Inline constants into the code stream if it can be done in two -instructions or less. - -@item -mdiv -@itemx -mno-div -@opindex mdiv -@opindex mno-div -Use the divide instruction. (Enabled by default). - -@item -mrelax-immediate -@itemx -mno-relax-immediate -@opindex mrelax-immediate -@opindex mno-relax-immediate -Allow arbitrary-sized immediates in bit operations. - -@item -mwide-bitfields -@itemx -mno-wide-bitfields -@opindex mwide-bitfields -@opindex mno-wide-bitfields -Always treat bit-fields as @code{int}-sized. - -@item -m4byte-functions -@itemx -mno-4byte-functions -@opindex m4byte-functions -@opindex mno-4byte-functions -Force all functions to be aligned to a 4-byte boundary. - -@item -mcallgraph-data -@itemx -mno-callgraph-data -@opindex mcallgraph-data -@opindex mno-callgraph-data -Emit callgraph information. - -@item -mslow-bytes -@itemx -mno-slow-bytes -@opindex mslow-bytes -@opindex mno-slow-bytes -Prefer word access when reading byte quantities. - -@item -mlittle-endian -@itemx -mbig-endian -@opindex mlittle-endian -@opindex mbig-endian -Generate code for a little-endian target. - -@item -m210 -@itemx -m340 -@opindex m210 -@opindex m340 -Generate code for the 210 processor. - -@item -mno-lsim -@opindex mno-lsim -Assume that runtime support has been provided and so omit the -simulator library (@file{libsim.a)} from the linker command line. - -@item -mstack-increment=@var{size} -@opindex mstack-increment -Set the maximum amount for a single stack increment operation. Large -values can increase the speed of programs that contain functions -that need a large amount of stack space, but they can also trigger a -segmentation fault if the stack is extended too much. The default -value is 0x1000. - -@end table - -@node MeP Options -@subsection MeP Options -@cindex MeP options - -@table @gcctabopt - -@item -mabsdiff -@opindex mabsdiff -Enables the @code{abs} instruction, which is the absolute difference -between two registers. - -@item -mall-opts -@opindex mall-opts -Enables all the optional instructions---average, multiply, divide, bit -operations, leading zero, absolute difference, min/max, clip, and -saturation. - - -@item -maverage -@opindex maverage -Enables the @code{ave} instruction, which computes the average of two -registers. - -@item -mbased=@var{n} -@opindex mbased= -Variables of size @var{n} bytes or smaller are placed in the -@code{.based} section by default. Based variables use the @code{$tp} -register as a base register, and there is a 128-byte limit to the -@code{.based} section. - -@item -mbitops -@opindex mbitops -Enables the bit operation instructions---bit test (@code{btstm}), set -(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and -test-and-set (@code{tas}). - -@item -mc=@var{name} -@opindex mc= -Selects which section constant data is placed in. @var{name} may -be @samp{tiny}, @samp{near}, or @samp{far}. - -@item -mclip -@opindex mclip -Enables the @code{clip} instruction. Note that @option{-mclip} is not -useful unless you also provide @option{-mminmax}. - -@item -mconfig=@var{name} -@opindex mconfig= -Selects one of the built-in core configurations. Each MeP chip has -one or more modules in it; each module has a core CPU and a variety of -coprocessors, optional instructions, and peripherals. The -@code{MeP-Integrator} tool, not part of GCC, provides these -configurations through this option; using this option is the same as -using all the corresponding command-line options. The default -configuration is @samp{default}. - -@item -mcop -@opindex mcop -Enables the coprocessor instructions. By default, this is a 32-bit -coprocessor. Note that the coprocessor is normally enabled via the -@option{-mconfig=} option. - -@item -mcop32 -@opindex mcop32 -Enables the 32-bit coprocessor's instructions. - -@item -mcop64 -@opindex mcop64 -Enables the 64-bit coprocessor's instructions. - -@item -mivc2 -@opindex mivc2 -Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. - -@item -mdc -@opindex mdc -Causes constant variables to be placed in the @code{.near} section. - -@item -mdiv -@opindex mdiv -Enables the @code{div} and @code{divu} instructions. - -@item -meb -@opindex meb -Generate big-endian code. - -@item -mel -@opindex mel -Generate little-endian code. - -@item -mio-volatile -@opindex mio-volatile -Tells the compiler that any variable marked with the @code{io} -attribute is to be considered volatile. - -@item -ml -@opindex ml -Causes variables to be assigned to the @code{.far} section by default. - -@item -mleadz -@opindex mleadz -Enables the @code{leadz} (leading zero) instruction. - -@item -mm -@opindex mm -Causes variables to be assigned to the @code{.near} section by default. - -@item -mminmax -@opindex mminmax -Enables the @code{min} and @code{max} instructions. - -@item -mmult -@opindex mmult -Enables the multiplication and multiply-accumulate instructions. - -@item -mno-opts -@opindex mno-opts -Disables all the optional instructions enabled by @option{-mall-opts}. - -@item -mrepeat -@opindex mrepeat -Enables the @code{repeat} and @code{erepeat} instructions, used for -low-overhead looping. - -@item -ms -@opindex ms -Causes all variables to default to the @code{.tiny} section. Note -that there is a 65536-byte limit to this section. Accesses to these -variables use the @code{%gp} base register. - -@item -msatur -@opindex msatur -Enables the saturation instructions. Note that the compiler does not -currently generate these itself, but this option is included for -compatibility with other tools, like @code{as}. - -@item -msdram -@opindex msdram -Link the SDRAM-based runtime instead of the default ROM-based runtime. - -@item -msim -@opindex msim -Link the simulator run-time libraries. - -@item -msimnovec -@opindex msimnovec -Link the simulator runtime libraries, excluding built-in support -for reset and exception vectors and tables. - -@item -mtf -@opindex mtf -Causes all functions to default to the @code{.far} section. Without -this option, functions default to the @code{.near} section. - -@item -mtiny=@var{n} -@opindex mtiny= -Variables that are @var{n} bytes or smaller are allocated to the -@code{.tiny} section. These variables use the @code{$gp} base -register. The default for this option is 4, but note that there's a -65536-byte limit to the @code{.tiny} section. - -@end table - -@node MicroBlaze Options -@subsection MicroBlaze Options -@cindex MicroBlaze Options - -@table @gcctabopt - -@item -msoft-float -@opindex msoft-float -Use software emulation for floating point (default). - -@item -mhard-float -@opindex mhard-float -Use hardware floating-point instructions. - -@item -mmemcpy -@opindex mmemcpy -Do not optimize block moves, use @code{memcpy}. - -@item -mno-clearbss -@opindex mno-clearbss -This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. - -@item -mcpu=@var{cpu-type} -@opindex mcpu= -Use features of, and schedule code for, the given CPU. -Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, -where @var{X} is a major version, @var{YY} is the minor version, and -@var{Z} is compatibility code. Example values are @samp{v3.00.a}, -@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}. - -@item -mxl-soft-mul -@opindex mxl-soft-mul -Use software multiply emulation (default). - -@item -mxl-soft-div -@opindex mxl-soft-div -Use software emulation for divides (default). - -@item -mxl-barrel-shift -@opindex mxl-barrel-shift -Use the hardware barrel shifter. - -@item -mxl-pattern-compare -@opindex mxl-pattern-compare -Use pattern compare instructions. - -@item -msmall-divides -@opindex msmall-divides -Use table lookup optimization for small signed integer divisions. - -@item -mxl-stack-check -@opindex mxl-stack-check -This option is deprecated. Use @option{-fstack-check} instead. - -@item -mxl-gp-opt -@opindex mxl-gp-opt -Use GP-relative @code{.sdata}/@code{.sbss} sections. - -@item -mxl-multiply-high -@opindex mxl-multiply-high -Use multiply high instructions for high part of 32x32 multiply. - -@item -mxl-float-convert -@opindex mxl-float-convert -Use hardware floating-point conversion instructions. - -@item -mxl-float-sqrt -@opindex mxl-float-sqrt -Use hardware floating-point square root instruction. - -@item -mbig-endian -@opindex mbig-endian -Generate code for a big-endian target. - -@item -mlittle-endian -@opindex mlittle-endian -Generate code for a little-endian target. - -@item -mxl-reorder -@opindex mxl-reorder -Use reorder instructions (swap and byte reversed load/store). - -@item -mxl-mode-@var{app-model} -Select application model @var{app-model}. Valid models are -@table @samp -@item executable -normal executable (default), uses startup code @file{crt0.o}. - -@item xmdstub -for use with Xilinx Microprocessor Debugger (XMD) based -software intrusive debug agent called xmdstub. This uses startup file -@file{crt1.o} and sets the start address of the program to 0x800. - -@item bootstrap -for applications that are loaded using a bootloader. -This model uses startup file @file{crt2.o} which does not contain a processor -reset vector handler. This is suitable for transferring control on a -processor reset to the bootloader rather than the application. - -@item novectors -for applications that do not require any of the -MicroBlaze vectors. This option may be useful for applications running -within a monitoring application. This model uses @file{crt3.o} as a startup file. -@end table - -Option @option{-xl-mode-@var{app-model}} is a deprecated alias for -@option{-mxl-mode-@var{app-model}}. - -@end table - -@node MIPS Options -@subsection MIPS Options -@cindex MIPS options - -@table @gcctabopt - -@item -EB -@opindex EB -Generate big-endian code. - -@item -EL -@opindex EL -Generate little-endian code. This is the default for @samp{mips*el-*-*} -configurations. - -@item -march=@var{arch} -@opindex march -Generate code that runs on @var{arch}, which can be the name of a -generic MIPS ISA, or the name of a particular processor. -The ISA names are: -@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, -@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, -@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, -@samp{mips64r5} and @samp{mips64r6}. -The processor names are: -@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, -@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, -@samp{5kc}, @samp{5kf}, -@samp{20kc}, -@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, -@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, -@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, -@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, -@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, -@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, -@samp{m4k}, -@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, -@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, -@samp{orion}, -@samp{p5600}, -@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, -@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000}, -@samp{rm7000}, @samp{rm9000}, -@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, -@samp{sb1}, -@samp{sr71000}, -@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, -@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, -@samp{xlr} and @samp{xlp}. -The special value @samp{from-abi} selects the -most compatible architecture for the selected ABI (that is, -@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. - -The native Linux/GNU toolchain also supports the value @samp{native}, -which selects the best architecture option for the host processor. -@option{-march=native} has no effect if GCC does not recognize -the processor. - -In processor names, a final @samp{000} can be abbreviated as @samp{k} -(for example, @option{-march=r2k}). Prefixes are optional, and -@samp{vr} may be written @samp{r}. - -Names of the form @samp{@var{n}f2_1} refer to processors with -FPUs clocked at half the rate of the core, names of the form -@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same -rate as the core, and names of the form @samp{@var{n}f3_2} refer to -processors with FPUs clocked a ratio of 3:2 with respect to the core. -For compatibility reasons, @samp{@var{n}f} is accepted as a synonym -for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are -accepted as synonyms for @samp{@var{n}f1_1}. - -GCC defines two macros based on the value of this option. The first -is @code{_MIPS_ARCH}, which gives the name of target architecture, as -a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, -where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. -For example, @option{-march=r2000} sets @code{_MIPS_ARCH} -to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. - -Note that the @code{_MIPS_ARCH} macro uses the processor names given -above. In other words, it has the full prefix and does not -abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, -the macro names the resolved architecture (either @code{"mips1"} or -@code{"mips3"}). It names the default architecture when no -@option{-march} option is given. - -@item -mtune=@var{arch} -@opindex mtune -Optimize for @var{arch}. Among other things, this option controls -the way instructions are scheduled, and the perceived cost of arithmetic -operations. The list of @var{arch} values is the same as for -@option{-march}. - -When this option is not used, GCC optimizes for the processor -specified by @option{-march}. By using @option{-march} and -@option{-mtune} together, it is possible to generate code that -runs on a family of processors, but optimize the code for one -particular member of that family. - -@option{-mtune} defines the macros @code{_MIPS_TUNE} and -@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the -@option{-march} ones described above. - -@item -mips1 -@opindex mips1 -Equivalent to @option{-march=mips1}. - -@item -mips2 -@opindex mips2 -Equivalent to @option{-march=mips2}. - -@item -mips3 -@opindex mips3 -Equivalent to @option{-march=mips3}. - -@item -mips4 -@opindex mips4 -Equivalent to @option{-march=mips4}. - -@item -mips32 -@opindex mips32 -Equivalent to @option{-march=mips32}. - -@item -mips32r3 -@opindex mips32r3 -Equivalent to @option{-march=mips32r3}. - -@item -mips32r5 -@opindex mips32r5 -Equivalent to @option{-march=mips32r5}. - -@item -mips32r6 -@opindex mips32r6 -Equivalent to @option{-march=mips32r6}. - -@item -mips64 -@opindex mips64 -Equivalent to @option{-march=mips64}. - -@item -mips64r2 -@opindex mips64r2 -Equivalent to @option{-march=mips64r2}. - -@item -mips64r3 -@opindex mips64r3 -Equivalent to @option{-march=mips64r3}. - -@item -mips64r5 -@opindex mips64r5 -Equivalent to @option{-march=mips64r5}. - -@item -mips64r6 -@opindex mips64r6 -Equivalent to @option{-march=mips64r6}. - -@item -mips16 -@itemx -mno-mips16 -@opindex mips16 -@opindex mno-mips16 -Generate (do not generate) MIPS16 code. If GCC is targeting a -MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. - -MIPS16 code generation can also be controlled on a per-function basis -by means of @code{mips16} and @code{nomips16} attributes. -@xref{Function Attributes}, for more information. - -@item -mflip-mips16 -@opindex mflip-mips16 -Generate MIPS16 code on alternating functions. This option is provided -for regression testing of mixed MIPS16/non-MIPS16 code generation, and is -not intended for ordinary use in compiling user code. - -@item -minterlink-compressed -@item -mno-interlink-compressed -@opindex minterlink-compressed -@opindex mno-interlink-compressed -Require (do not require) that code using the standard (uncompressed) MIPS ISA -be link-compatible with MIPS16 and microMIPS code, and vice versa. - -For example, code using the standard ISA encoding cannot jump directly -to MIPS16 or microMIPS code; it must either use a call or an indirect jump. -@option{-minterlink-compressed} therefore disables direct jumps unless GCC -knows that the target of the jump is not compressed. - -@item -minterlink-mips16 -@itemx -mno-interlink-mips16 -@opindex minterlink-mips16 -@opindex mno-interlink-mips16 -Aliases of @option{-minterlink-compressed} and -@option{-mno-interlink-compressed}. These options predate the microMIPS ASE -and are retained for backwards compatibility. - -@item -mabi=32 -@itemx -mabi=o64 -@itemx -mabi=n32 -@itemx -mabi=64 -@itemx -mabi=eabi -@opindex mabi=32 -@opindex mabi=o64 -@opindex mabi=n32 -@opindex mabi=64 -@opindex mabi=eabi -Generate code for the given ABI@. - -Note that the EABI has a 32-bit and a 64-bit variant. GCC normally -generates 64-bit code when you select a 64-bit architecture, but you -can use @option{-mgp32} to get 32-bit code instead. - -For information about the O64 ABI, see -@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. - -GCC supports a variant of the o32 ABI in which floating-point registers -are 64 rather than 32 bits wide. You can select this combination with -@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} -and @code{mfhc1} instructions and is therefore only supported for -MIPS32R2, MIPS32R3 and MIPS32R5 processors. - -The register assignments for arguments and return values remain the -same, but each scalar value is passed in a single 64-bit register -rather than a pair of 32-bit registers. For example, scalar -floating-point values are returned in @samp{$f0} only, not a -@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also -remains the same in that the even-numbered double-precision registers -are saved. - -Two additional variants of the o32 ABI are supported to enable -a transition from 32-bit to 64-bit registers. These are FPXX -(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). -The FPXX extension mandates that all code must execute correctly -when run using 32-bit or 64-bit registers. The code can be interlinked -with either FP32 or FP64, but not both. -The FP64A extension is similar to the FP64 extension but forbids the -use of odd-numbered single-precision registers. This can be used -in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 -processors and allows both FP32 and FP64A code to interlink and -run in the same process without changing FPU modes. - -@item -mabicalls -@itemx -mno-abicalls -@opindex mabicalls -@opindex mno-abicalls -Generate (do not generate) code that is suitable for SVR4-style -dynamic objects. @option{-mabicalls} is the default for SVR4-based -systems. - -@item -mshared -@itemx -mno-shared -Generate (do not generate) code that is fully position-independent, -and that can therefore be linked into shared libraries. This option -only affects @option{-mabicalls}. - -All @option{-mabicalls} code has traditionally been position-independent, -regardless of options like @option{-fPIC} and @option{-fpic}. However, -as an extension, the GNU toolchain allows executables to use absolute -accesses for locally-binding symbols. It can also use shorter GP -initialization sequences and generate direct calls to locally-defined -functions. This mode is selected by @option{-mno-shared}. - -@option{-mno-shared} depends on binutils 2.16 or higher and generates -objects that can only be linked by the GNU linker. However, the option -does not affect the ABI of the final executable; it only affects the ABI -of relocatable objects. Using @option{-mno-shared} generally makes -executables both smaller and quicker. - -@option{-mshared} is the default. - -@item -mplt -@itemx -mno-plt -@opindex mplt -@opindex mno-plt -Assume (do not assume) that the static and dynamic linkers -support PLTs and copy relocations. This option only affects -@option{-mno-shared -mabicalls}. For the n64 ABI, this option -has no effect without @option{-msym32}. - -You can make @option{-mplt} the default by configuring -GCC with @option{--with-mips-plt}. The default is -@option{-mno-plt} otherwise. - -@item -mxgot -@itemx -mno-xgot -@opindex mxgot -@opindex mno-xgot -Lift (do not lift) the usual restrictions on the size of the global -offset table. - -GCC normally uses a single instruction to load values from the GOT@. -While this is relatively efficient, it only works if the GOT -is smaller than about 64k. Anything larger causes the linker -to report an error such as: - -@cindex relocation truncated to fit (MIPS) -@smallexample -relocation truncated to fit: R_MIPS_GOT16 foobar -@end smallexample - -If this happens, you should recompile your code with @option{-mxgot}. -This works with very large GOTs, although the code is also -less efficient, since it takes three instructions to fetch the -value of a global symbol. - -Note that some linkers can create multiple GOTs. If you have such a -linker, you should only need to use @option{-mxgot} when a single object -file accesses more than 64k's worth of GOT entries. Very few do. - -These options have no effect unless GCC is generating position -independent code. - -@item -mgp32 -@opindex mgp32 -Assume that general-purpose registers are 32 bits wide. - -@item -mgp64 -@opindex mgp64 -Assume that general-purpose registers are 64 bits wide. - -@item -mfp32 -@opindex mfp32 -Assume that floating-point registers are 32 bits wide. - -@item -mfp64 -@opindex mfp64 -Assume that floating-point registers are 64 bits wide. - -@item -mfpxx -@opindex mfpxx -Do not assume the width of floating-point registers. - -@item -mhard-float -@opindex mhard-float -Use floating-point coprocessor instructions. - -@item -msoft-float -@opindex msoft-float -Do not use floating-point coprocessor instructions. Implement -floating-point calculations using library calls instead. - -@item -mno-float -@opindex mno-float -Equivalent to @option{-msoft-float}, but additionally asserts that the -program being compiled does not perform any floating-point operations. -This option is presently supported only by some bare-metal MIPS -configurations, where it may select a special set of libraries -that lack all floating-point support (including, for example, the -floating-point @code{printf} formats). -If code compiled with @option{-mno-float} accidentally contains -floating-point operations, it is likely to suffer a link-time -or run-time failure. - -@item -msingle-float -@opindex msingle-float -Assume that the floating-point coprocessor only supports single-precision -operations. - -@item -mdouble-float -@opindex mdouble-float -Assume that the floating-point coprocessor supports double-precision -operations. This is the default. - -@item -modd-spreg -@itemx -mno-odd-spreg -@opindex modd-spreg -@opindex mno-odd-spreg -Enable the use of odd-numbered single-precision floating-point registers -for the o32 ABI. This is the default for processors that are known to -support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} -is set by default. - -@item -mabs=2008 -@itemx -mabs=legacy -@opindex mabs=2008 -@opindex mabs=legacy -These options control the treatment of the special not-a-number (NaN) -IEEE 754 floating-point data with the @code{abs.@i{fmt}} and -@code{neg.@i{fmt}} machine instructions. - -By default or when @option{-mabs=legacy} is used the legacy -treatment is selected. In this case these instructions are considered -arithmetic and avoided where correct operation is required and the -input operand might be a NaN. A longer sequence of instructions that -manipulate the sign bit of floating-point datum manually is used -instead unless the @option{-ffinite-math-only} option has also been -specified. - -The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In -this case these instructions are considered non-arithmetic and therefore -operating correctly in all cases, including in particular where the -input operand is a NaN. These instructions are therefore always used -for the respective operations. - -@item -mnan=2008 -@itemx -mnan=legacy -@opindex mnan=2008 -@opindex mnan=legacy -These options control the encoding of the special not-a-number (NaN) -IEEE 754 floating-point data. - -The @option{-mnan=legacy} option selects the legacy encoding. In this -case quiet NaNs (qNaNs) are denoted by the first bit of their trailing -significand field being 0, whereas signalling NaNs (sNaNs) are denoted -by the first bit of their trailing significand field being 1. - -The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In -this case qNaNs are denoted by the first bit of their trailing -significand field being 1, whereas sNaNs are denoted by the first bit of -their trailing significand field being 0. - -The default is @option{-mnan=legacy} unless GCC has been configured with -@option{--with-nan=2008}. - -@item -mllsc -@itemx -mno-llsc -@opindex mllsc -@opindex mno-llsc -Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to -implement atomic memory built-in functions. When neither option is -specified, GCC uses the instructions if the target architecture -supports them. - -@option{-mllsc} is useful if the runtime environment can emulate the -instructions and @option{-mno-llsc} can be useful when compiling for -nonstandard ISAs. You can make either option the default by -configuring GCC with @option{--with-llsc} and @option{--without-llsc} -respectively. @option{--with-llsc} is the default for some -configurations; see the installation documentation for details. - -@item -mdsp -@itemx -mno-dsp -@opindex mdsp -@opindex mno-dsp -Use (do not use) revision 1 of the MIPS DSP ASE@. -@xref{MIPS DSP Built-in Functions}. This option defines the -preprocessor macro @code{__mips_dsp}. It also defines -@code{__mips_dsp_rev} to 1. - -@item -mdspr2 -@itemx -mno-dspr2 -@opindex mdspr2 -@opindex mno-dspr2 -Use (do not use) revision 2 of the MIPS DSP ASE@. -@xref{MIPS DSP Built-in Functions}. This option defines the -preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. -It also defines @code{__mips_dsp_rev} to 2. - -@item -msmartmips -@itemx -mno-smartmips -@opindex msmartmips -@opindex mno-smartmips -Use (do not use) the MIPS SmartMIPS ASE. - -@item -mpaired-single -@itemx -mno-paired-single -@opindex mpaired-single -@opindex mno-paired-single -Use (do not use) paired-single floating-point instructions. -@xref{MIPS Paired-Single Support}. This option requires -hardware floating-point support to be enabled. - -@item -mdmx -@itemx -mno-mdmx -@opindex mdmx -@opindex mno-mdmx -Use (do not use) MIPS Digital Media Extension instructions. -This option can only be used when generating 64-bit code and requires -hardware floating-point support to be enabled. - -@item -mips3d -@itemx -mno-mips3d -@opindex mips3d -@opindex mno-mips3d -Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. -The option @option{-mips3d} implies @option{-mpaired-single}. - -@item -mmicromips -@itemx -mno-micromips -@opindex mmicromips -@opindex mno-mmicromips -Generate (do not generate) microMIPS code. - -MicroMIPS code generation can also be controlled on a per-function basis -by means of @code{micromips} and @code{nomicromips} attributes. -@xref{Function Attributes}, for more information. - -@item -mmt -@itemx -mno-mt -@opindex mmt -@opindex mno-mt -Use (do not use) MT Multithreading instructions. - -@item -mmcu -@itemx -mno-mcu -@opindex mmcu -@opindex mno-mcu -Use (do not use) the MIPS MCU ASE instructions. - -@item -meva -@itemx -mno-eva -@opindex meva -@opindex mno-eva -Use (do not use) the MIPS Enhanced Virtual Addressing instructions. - -@item -mvirt -@itemx -mno-virt -@opindex mvirt -@opindex mno-virt -Use (do not use) the MIPS Virtualization Application Specific instructions. - -@item -mxpa -@itemx -mno-xpa -@opindex mxpa -@opindex mno-xpa -Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. - -@item -mlong64 -@opindex mlong64 -Force @code{long} types to be 64 bits wide. See @option{-mlong32} for -an explanation of the default and the way that the pointer size is -determined. - -@item -mlong32 -@opindex mlong32 -Force @code{long}, @code{int}, and pointer types to be 32 bits wide. - -The default size of @code{int}s, @code{long}s and pointers depends on -the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI -uses 64-bit @code{long}s, as does the 64-bit EABI; the others use -32-bit @code{long}s. Pointers are the same size as @code{long}s, -or the same size as integer registers, whichever is smaller. - -@item -msym32 -@itemx -mno-sym32 -@opindex msym32 -@opindex mno-sym32 -Assume (do not assume) that all symbols have 32-bit values, regardless -of the selected ABI@. This option is useful in combination with -@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC -to generate shorter and faster references to symbolic addresses. - -@item -G @var{num} -@opindex G -Put definitions of externally-visible data in a small data section -if that data is no bigger than @var{num} bytes. GCC can then generate -more efficient accesses to the data; see @option{-mgpopt} for details. - -The default @option{-G} option depends on the configuration. - -@item -mlocal-sdata -@itemx -mno-local-sdata -@opindex mlocal-sdata -@opindex mno-local-sdata -Extend (do not extend) the @option{-G} behavior to local data too, -such as to static variables in C@. @option{-mlocal-sdata} is the -default for all configurations. - -If the linker complains that an application is using too much small data, -you might want to try rebuilding the less performance-critical parts with -@option{-mno-local-sdata}. You might also want to build large -libraries with @option{-mno-local-sdata}, so that the libraries leave -more room for the main program. - -@item -mextern-sdata -@itemx -mno-extern-sdata -@opindex mextern-sdata -@opindex mno-extern-sdata -Assume (do not assume) that externally-defined data is in -a small data section if the size of that data is within the @option{-G} limit. -@option{-mextern-sdata} is the default for all configurations. - -If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G -@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} -that is no bigger than @var{num} bytes, you must make sure that @var{Var} -is placed in a small data section. If @var{Var} is defined by another -module, you must either compile that module with a high-enough -@option{-G} setting or attach a @code{section} attribute to @var{Var}'s -definition. If @var{Var} is common, you must link the application -with a high-enough @option{-G} setting. - -The easiest way of satisfying these restrictions is to compile -and link every module with the same @option{-G} option. However, -you may wish to build a library that supports several different -small data limits. You can do this by compiling the library with -the highest supported @option{-G} setting and additionally using -@option{-mno-extern-sdata} to stop the library from making assumptions -about externally-defined data. - -@item -mgpopt -@itemx -mno-gpopt -@opindex mgpopt -@opindex mno-gpopt -Use (do not use) GP-relative accesses for symbols that are known to be -in a small data section; see @option{-G}, @option{-mlocal-sdata} and -@option{-mextern-sdata}. @option{-mgpopt} is the default for all -configurations. - -@option{-mno-gpopt} is useful for cases where the @code{$gp} register -might not hold the value of @code{_gp}. For example, if the code is -part of a library that might be used in a boot monitor, programs that -call boot monitor routines pass an unknown value in @code{$gp}. -(In such situations, the boot monitor itself is usually compiled -with @option{-G0}.) - -@option{-mno-gpopt} implies @option{-mno-local-sdata} and -@option{-mno-extern-sdata}. - -@item -membedded-data -@itemx -mno-embedded-data -@opindex membedded-data -@opindex mno-embedded-data -Allocate variables to the read-only data section first if possible, then -next in the small data section if possible, otherwise in data. This gives -slightly slower code than the default, but reduces the amount of RAM required -when executing, and thus may be preferred for some embedded systems. - -@item -muninit-const-in-rodata -@itemx -mno-uninit-const-in-rodata -@opindex muninit-const-in-rodata -@opindex mno-uninit-const-in-rodata -Put uninitialized @code{const} variables in the read-only data section. -This option is only meaningful in conjunction with @option{-membedded-data}. - -@item -mcode-readable=@var{setting} -@opindex mcode-readable -Specify whether GCC may generate code that reads from executable sections. -There are three possible settings: - -@table @gcctabopt -@item -mcode-readable=yes -Instructions may freely access executable sections. This is the -default setting. - -@item -mcode-readable=pcrel -MIPS16 PC-relative load instructions can access executable sections, -but other instructions must not do so. This option is useful on 4KSc -and 4KSd processors when the code TLBs have the Read Inhibit bit set. -It is also useful on processors that can be configured to have a dual -instruction/data SRAM interface and that, like the M4K, automatically -redirect PC-relative loads to the instruction RAM. - -@item -mcode-readable=no -Instructions must not access executable sections. This option can be -useful on targets that are configured to have a dual instruction/data -SRAM interface but that (unlike the M4K) do not automatically redirect -PC-relative loads to the instruction RAM. -@end table - -@item -msplit-addresses -@itemx -mno-split-addresses -@opindex msplit-addresses -@opindex mno-split-addresses -Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler -relocation operators. This option has been superseded by -@option{-mexplicit-relocs} but is retained for backwards compatibility. - -@item -mexplicit-relocs -@itemx -mno-explicit-relocs -@opindex mexplicit-relocs -@opindex mno-explicit-relocs -Use (do not use) assembler relocation operators when dealing with symbolic -addresses. The alternative, selected by @option{-mno-explicit-relocs}, -is to use assembler macros instead. - -@option{-mexplicit-relocs} is the default if GCC was configured -to use an assembler that supports relocation operators. - -@item -mcheck-zero-division -@itemx -mno-check-zero-division -@opindex mcheck-zero-division -@opindex mno-check-zero-division -Trap (do not trap) on integer division by zero. - -The default is @option{-mcheck-zero-division}. - -@item -mdivide-traps -@itemx -mdivide-breaks -@opindex mdivide-traps -@opindex mdivide-breaks -MIPS systems check for division by zero by generating either a -conditional trap or a break instruction. Using traps results in -smaller code, but is only supported on MIPS II and later. Also, some -versions of the Linux kernel have a bug that prevents trap from -generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to -allow conditional traps on architectures that support them and -@option{-mdivide-breaks} to force the use of breaks. - -The default is usually @option{-mdivide-traps}, but this can be -overridden at configure time using @option{--with-divide=breaks}. -Divide-by-zero checks can be completely disabled using -@option{-mno-check-zero-division}. - -@item -mmemcpy -@itemx -mno-memcpy -@opindex mmemcpy -@opindex mno-memcpy -Force (do not force) the use of @code{memcpy} for non-trivial block -moves. The default is @option{-mno-memcpy}, which allows GCC to inline -most constant-sized copies. - -@item -mlong-calls -@itemx -mno-long-calls -@opindex mlong-calls -@opindex mno-long-calls -Disable (do not disable) use of the @code{jal} instruction. Calling -functions using @code{jal} is more efficient but requires the caller -and callee to be in the same 256 megabyte segment. - -This option has no effect on abicalls code. The default is -@option{-mno-long-calls}. - -@item -mmad -@itemx -mno-mad -@opindex mmad -@opindex mno-mad -Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} -instructions, as provided by the R4650 ISA@. - -@item -mimadd -@itemx -mno-imadd -@opindex mimadd -@opindex mno-imadd -Enable (disable) use of the @code{madd} and @code{msub} integer -instructions. The default is @option{-mimadd} on architectures -that support @code{madd} and @code{msub} except for the 74k -architecture where it was found to generate slower code. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Enable (disable) use of the floating-point multiply-accumulate -instructions, when they are available. The default is -@option{-mfused-madd}. - -On the R8000 CPU when multiply-accumulate instructions are used, -the intermediate product is calculated to infinite precision -and is not subject to the FCSR Flush to Zero bit. This may be -undesirable in some circumstances. On other processors the result -is numerically identical to the equivalent computation using -separate multiply, add, subtract and negate instructions. - -@item -nocpp -@opindex nocpp -Tell the MIPS assembler to not run its preprocessor over user -assembler files (with a @samp{.s} suffix) when assembling them. - -@item -mfix-24k -@item -mno-fix-24k -@opindex mfix-24k -@opindex mno-fix-24k -Work around the 24K E48 (lost data on stores during refill) errata. -The workarounds are implemented by the assembler rather than by GCC@. - -@item -mfix-r4000 -@itemx -mno-fix-r4000 -@opindex mfix-r4000 -@opindex mno-fix-r4000 -Work around certain R4000 CPU errata: -@itemize @minus -@item -A double-word or a variable shift may give an incorrect result if executed -immediately after starting an integer division. -@item -A double-word or a variable shift may give an incorrect result if executed -while an integer multiplication is in progress. -@item -An integer division may give an incorrect result if started in a delay slot -of a taken branch or a jump. -@end itemize - -@item -mfix-r4400 -@itemx -mno-fix-r4400 -@opindex mfix-r4400 -@opindex mno-fix-r4400 -Work around certain R4400 CPU errata: -@itemize @minus -@item -A double-word or a variable shift may give an incorrect result if executed -immediately after starting an integer division. -@end itemize - -@item -mfix-r10000 -@itemx -mno-fix-r10000 -@opindex mfix-r10000 -@opindex mno-fix-r10000 -Work around certain R10000 errata: -@itemize @minus -@item -@code{ll}/@code{sc} sequences may not behave atomically on revisions -prior to 3.0. They may deadlock on revisions 2.6 and earlier. -@end itemize - -This option can only be used if the target architecture supports -branch-likely instructions. @option{-mfix-r10000} is the default when -@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default -otherwise. - -@item -mfix-rm7000 -@itemx -mno-fix-rm7000 -@opindex mfix-rm7000 -Work around the RM7000 @code{dmult}/@code{dmultu} errata. The -workarounds are implemented by the assembler rather than by GCC@. - -@item -mfix-vr4120 -@itemx -mno-fix-vr4120 -@opindex mfix-vr4120 -Work around certain VR4120 errata: -@itemize @minus -@item -@code{dmultu} does not always produce the correct result. -@item -@code{div} and @code{ddiv} do not always produce the correct result if one -of the operands is negative. -@end itemize -The workarounds for the division errata rely on special functions in -@file{libgcc.a}. At present, these functions are only provided by -the @code{mips64vr*-elf} configurations. - -Other VR4120 errata require a NOP to be inserted between certain pairs of -instructions. These errata are handled by the assembler, not by GCC itself. - -@item -mfix-vr4130 -@opindex mfix-vr4130 -Work around the VR4130 @code{mflo}/@code{mfhi} errata. The -workarounds are implemented by the assembler rather than by GCC, -although GCC avoids using @code{mflo} and @code{mfhi} if the -VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} -instructions are available instead. - -@item -mfix-sb1 -@itemx -mno-fix-sb1 -@opindex mfix-sb1 -Work around certain SB-1 CPU core errata. -(This flag currently works around the SB-1 revision 2 -``F1'' and ``F2'' floating-point errata.) - -@item -mr10k-cache-barrier=@var{setting} -@opindex mr10k-cache-barrier -Specify whether GCC should insert cache barriers to avoid the -side-effects of speculation on R10K processors. - -In common with many processors, the R10K tries to predict the outcome -of a conditional branch and speculatively executes instructions from -the ``taken'' branch. It later aborts these instructions if the -predicted outcome is wrong. However, on the R10K, even aborted -instructions can have side effects. - -This problem only affects kernel stores and, depending on the system, -kernel loads. As an example, a speculatively-executed store may load -the target memory into cache and mark the cache line as dirty, even if -the store itself is later aborted. If a DMA operation writes to the -same area of memory before the ``dirty'' line is flushed, the cached -data overwrites the DMA-ed data. See the R10K processor manual -for a full description, including other potential problems. - -One workaround is to insert cache barrier instructions before every memory -access that might be speculatively executed and that might have side -effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} -controls GCC's implementation of this workaround. It assumes that -aborted accesses to any byte in the following regions does not have -side effects: - -@enumerate -@item -the memory occupied by the current function's stack frame; - -@item -the memory occupied by an incoming stack argument; - -@item -the memory occupied by an object with a link-time-constant address. -@end enumerate - -It is the kernel's responsibility to ensure that speculative -accesses to these regions are indeed safe. - -If the input program contains a function declaration such as: - -@smallexample -void foo (void); -@end smallexample - -then the implementation of @code{foo} must allow @code{j foo} and -@code{jal foo} to be executed speculatively. GCC honors this -restriction for functions it compiles itself. It expects non-GCC -functions (such as hand-written assembly code) to do the same. - -The option has three forms: - -@table @gcctabopt -@item -mr10k-cache-barrier=load-store -Insert a cache barrier before a load or store that might be -speculatively executed and that might have side effects even -if aborted. - -@item -mr10k-cache-barrier=store -Insert a cache barrier before a store that might be speculatively -executed and that might have side effects even if aborted. - -@item -mr10k-cache-barrier=none -Disable the insertion of cache barriers. This is the default setting. -@end table - -@item -mflush-func=@var{func} -@itemx -mno-flush-func -@opindex mflush-func -Specifies the function to call to flush the I and D caches, or to not -call any such function. If called, the function must take the same -arguments as the common @code{_flush_func}, that is, the address of the -memory range for which the cache is being flushed, the size of the -memory range, and the number 3 (to flush both caches). The default -depends on the target GCC was configured for, but commonly is either -@code{_flush_func} or @code{__cpu_flush}. - -@item mbranch-cost=@var{num} -@opindex mbranch-cost -Set the cost of branches to roughly @var{num} ``simple'' instructions. -This cost is only a heuristic and is not guaranteed to produce -consistent results across releases. A zero cost redundantly selects -the default, which is based on the @option{-mtune} setting. - -@item -mbranch-likely -@itemx -mno-branch-likely -@opindex mbranch-likely -@opindex mno-branch-likely -Enable or disable use of Branch Likely instructions, regardless of the -default for the selected architecture. By default, Branch Likely -instructions may be generated if they are supported by the selected -architecture. An exception is for the MIPS32 and MIPS64 architectures -and processors that implement those architectures; for those, Branch -Likely instructions are not be generated by default because the MIPS32 -and MIPS64 architectures specifically deprecate their use. - -@item -mfp-exceptions -@itemx -mno-fp-exceptions -@opindex mfp-exceptions -Specifies whether FP exceptions are enabled. This affects how -FP instructions are scheduled for some processors. -The default is that FP exceptions are -enabled. - -For instance, on the SB-1, if FP exceptions are disabled, and we are emitting -64-bit code, then we can use both FP pipes. Otherwise, we can only use one -FP pipe. - -@item -mvr4130-align -@itemx -mno-vr4130-align -@opindex mvr4130-align -The VR4130 pipeline is two-way superscalar, but can only issue two -instructions together if the first one is 8-byte aligned. When this -option is enabled, GCC aligns pairs of instructions that it -thinks should execute in parallel. - -This option only has an effect when optimizing for the VR4130. -It normally makes code faster, but at the expense of making it bigger. -It is enabled by default at optimization level @option{-O3}. - -@item -msynci -@itemx -mno-synci -@opindex msynci -Enable (disable) generation of @code{synci} instructions on -architectures that support it. The @code{synci} instructions (if -enabled) are generated when @code{__builtin___clear_cache} is -compiled. - -This option defaults to @option{-mno-synci}, but the default can be -overridden by configuring GCC with @option{--with-synci}. - -When compiling code for single processor systems, it is generally safe -to use @code{synci}. However, on many multi-core (SMP) systems, it -does not invalidate the instruction caches on all cores and may lead -to undefined behavior. - -@item -mrelax-pic-calls -@itemx -mno-relax-pic-calls -@opindex mrelax-pic-calls -Try to turn PIC calls that are normally dispatched via register -@code{$25} into direct calls. This is only possible if the linker can -resolve the destination at link-time and if the destination is within -range for a direct call. - -@option{-mrelax-pic-calls} is the default if GCC was configured to use -an assembler and a linker that support the @code{.reloc} assembly -directive and @option{-mexplicit-relocs} is in effect. With -@option{-mno-explicit-relocs}, this optimization can be performed by the -assembler and the linker alone without help from the compiler. - -@item -mmcount-ra-address -@itemx -mno-mcount-ra-address -@opindex mmcount-ra-address -@opindex mno-mcount-ra-address -Emit (do not emit) code that allows @code{_mcount} to modify the -calling function's return address. When enabled, this option extends -the usual @code{_mcount} interface with a new @var{ra-address} -parameter, which has type @code{intptr_t *} and is passed in register -@code{$12}. @code{_mcount} can then modify the return address by -doing both of the following: -@itemize -@item -Returning the new address in register @code{$31}. -@item -Storing the new address in @code{*@var{ra-address}}, -if @var{ra-address} is nonnull. -@end itemize - -The default is @option{-mno-mcount-ra-address}. - -@end table - -@node MMIX Options -@subsection MMIX Options -@cindex MMIX Options - -These options are defined for the MMIX: - -@table @gcctabopt -@item -mlibfuncs -@itemx -mno-libfuncs -@opindex mlibfuncs -@opindex mno-libfuncs -Specify that intrinsic library functions are being compiled, passing all -values in registers, no matter the size. - -@item -mepsilon -@itemx -mno-epsilon -@opindex mepsilon -@opindex mno-epsilon -Generate floating-point comparison instructions that compare with respect -to the @code{rE} epsilon register. - -@item -mabi=mmixware -@itemx -mabi=gnu -@opindex mabi=mmixware -@opindex mabi=gnu -Generate code that passes function parameters and return values that (in -the called function) are seen as registers @code{$0} and up, as opposed to -the GNU ABI which uses global registers @code{$231} and up. - -@item -mzero-extend -@itemx -mno-zero-extend -@opindex mzero-extend -@opindex mno-zero-extend -When reading data from memory in sizes shorter than 64 bits, use (do not -use) zero-extending load instructions by default, rather than -sign-extending ones. - -@item -mknuthdiv -@itemx -mno-knuthdiv -@opindex mknuthdiv -@opindex mno-knuthdiv -Make the result of a division yielding a remainder have the same sign as -the divisor. With the default, @option{-mno-knuthdiv}, the sign of the -remainder follows the sign of the dividend. Both methods are -arithmetically valid, the latter being almost exclusively used. - -@item -mtoplevel-symbols -@itemx -mno-toplevel-symbols -@opindex mtoplevel-symbols -@opindex mno-toplevel-symbols -Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly -code can be used with the @code{PREFIX} assembly directive. - -@item -melf -@opindex melf -Generate an executable in the ELF format, rather than the default -@samp{mmo} format used by the @command{mmix} simulator. - -@item -mbranch-predict -@itemx -mno-branch-predict -@opindex mbranch-predict -@opindex mno-branch-predict -Use (do not use) the probable-branch instructions, when static branch -prediction indicates a probable branch. - -@item -mbase-addresses -@itemx -mno-base-addresses -@opindex mbase-addresses -@opindex mno-base-addresses -Generate (do not generate) code that uses @emph{base addresses}. Using a -base address automatically generates a request (handled by the assembler -and the linker) for a constant to be set up in a global register. The -register is used for one or more base address requests within the range 0 -to 255 from the value held in the register. The generally leads to short -and fast code, but the number of different data items that can be -addressed is limited. This means that a program that uses lots of static -data may require @option{-mno-base-addresses}. - -@item -msingle-exit -@itemx -mno-single-exit -@opindex msingle-exit -@opindex mno-single-exit -Force (do not force) generated code to have a single exit point in each -function. -@end table - -@node MN10300 Options -@subsection MN10300 Options -@cindex MN10300 options - -These @option{-m} options are defined for Matsushita MN10300 architectures: - -@table @gcctabopt -@item -mmult-bug -@opindex mmult-bug -Generate code to avoid bugs in the multiply instructions for the MN10300 -processors. This is the default. - -@item -mno-mult-bug -@opindex mno-mult-bug -Do not generate code to avoid bugs in the multiply instructions for the -MN10300 processors. - -@item -mam33 -@opindex mam33 -Generate code using features specific to the AM33 processor. - -@item -mno-am33 -@opindex mno-am33 -Do not generate code using features specific to the AM33 processor. This -is the default. - -@item -mam33-2 -@opindex mam33-2 -Generate code using features specific to the AM33/2.0 processor. - -@item -mam34 -@opindex mam34 -Generate code using features specific to the AM34 processor. - -@item -mtune=@var{cpu-type} -@opindex mtune -Use the timing characteristics of the indicated CPU type when -scheduling instructions. This does not change the targeted processor -type. The CPU type must be one of @samp{mn10300}, @samp{am33}, -@samp{am33-2} or @samp{am34}. - -@item -mreturn-pointer-on-d0 -@opindex mreturn-pointer-on-d0 -When generating a function that returns a pointer, return the pointer -in both @code{a0} and @code{d0}. Otherwise, the pointer is returned -only in @code{a0}, and attempts to call such functions without a prototype -result in errors. Note that this option is on by default; use -@option{-mno-return-pointer-on-d0} to disable it. - -@item -mno-crt0 -@opindex mno-crt0 -Do not link in the C run-time initialization object file. - -@item -mrelax -@opindex mrelax -Indicate to the linker that it should perform a relaxation optimization pass -to shorten branches, calls and absolute memory addresses. This option only -has an effect when used on the command line for the final link step. - -This option makes symbolic debugging impossible. - -@item -mliw -@opindex mliw -Allow the compiler to generate @emph{Long Instruction Word} -instructions if the target is the @samp{AM33} or later. This is the -default. This option defines the preprocessor macro @code{__LIW__}. - -@item -mnoliw -@opindex mnoliw -Do not allow the compiler to generate @emph{Long Instruction Word} -instructions. This option defines the preprocessor macro -@code{__NO_LIW__}. - -@item -msetlb -@opindex msetlb -Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} -instructions if the target is the @samp{AM33} or later. This is the -default. This option defines the preprocessor macro @code{__SETLB__}. - -@item -mnosetlb -@opindex mnosetlb -Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} -instructions. This option defines the preprocessor macro -@code{__NO_SETLB__}. - -@end table - -@node Moxie Options -@subsection Moxie Options -@cindex Moxie Options - -@table @gcctabopt - -@item -meb -@opindex meb -Generate big-endian code. This is the default for @samp{moxie-*-*} -configurations. - -@item -mel -@opindex mel -Generate little-endian code. - -@item -mmul.x -@opindex mmul.x -Generate mul.x and umul.x instructions. This is the default for -@samp{moxiebox-*-*} configurations. - -@item -mno-crt0 -@opindex mno-crt0 -Do not link in the C run-time initialization object file. - -@end table - -@node MSP430 Options -@subsection MSP430 Options -@cindex MSP430 Options - -These options are defined for the MSP430: - -@table @gcctabopt - -@item -masm-hex -@opindex masm-hex -Force assembly output to always use hex constants. Normally such -constants are signed decimals, but this option is available for -testsuite and/or aesthetic purposes. - -@item -mmcu= -@opindex mmcu= -Select the MCU to target. This is used to create a C preprocessor -symbol based upon the MCU name, converted to upper case and pre- and -post-fixed with @samp{__}. This in turn is used by the -@file{msp430.h} header file to select an MCU-specific supplementary -header file. - -The option also sets the ISA to use. If the MCU name is one that is -known to only support the 430 ISA then that is selected, otherwise the -430X ISA is selected. A generic MCU name of @samp{msp430} can also be -used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU -name selects the 430X ISA. - -In addition an MCU-specific linker script is added to the linker -command line. The script's name is the name of the MCU with -@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} -command line defines the C preprocessor symbol @code{__XXX__} and -cause the linker to search for a script called @file{xxx.ld}. - -This option is also passed on to the assembler. - -@item -mcpu= -@opindex mcpu= -Specifies the ISA to use. Accepted values are @samp{msp430}, -@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The -@option{-mmcu=} option should be used to select the ISA. - -@item -msim -@opindex msim -Link to the simulator runtime libraries and linker script. Overrides -any scripts that would be selected by the @option{-mmcu=} option. - -@item -mlarge -@opindex mlarge -Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). - -@item -msmall -@opindex msmall -Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). - -@item -mrelax -@opindex mrelax -This option is passed to the assembler and linker, and allows the -linker to perform certain optimizations that cannot be done until -the final link. - -@item mhwmult= -@opindex mhwmult= -Describes the type of hardware multiply supported by the target. -Accepted values are @samp{none} for no hardware multiply, @samp{16bit} -for the original 16-bit-only multiply supported by early MCUs. -@samp{32bit} for the 16/32-bit multiply supported by later MCUs and -@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. -A value of @samp{auto} can also be given. This tells GCC to deduce -the hardware multiply support based upon the MCU name provided by the -@option{-mmcu} option. If no @option{-mmcu} option is specified then -@samp{32bit} hardware multiply support is assumed. @samp{auto} is the -default setting. - -Hardware multiplies are normally performed by calling a library -routine. This saves space in the generated code. When compiling at -@option{-O3} or higher however the hardware multiplier is invoked -inline. This makes for bigger, but faster code. - -The hardware multiply routines disable interrupts whilst running and -restore the previous interrupt state when they finish. This makes -them safe to use inside interrupt handlers as well as in normal code. - -@item -minrt -@opindex minrt -Enable the use of a minimum runtime environment - no static -initializers or constructors. This is intended for memory-constrained -devices. The compiler includes special symbols in some objects -that tell the linker and runtime which code fragments are required. - -@end table - -@node NDS32 Options -@subsection NDS32 Options -@cindex NDS32 Options - -These options are defined for NDS32 implementations: - -@table @gcctabopt - -@item -mbig-endian -@opindex mbig-endian -Generate code in big-endian mode. - -@item -mlittle-endian -@opindex mlittle-endian -Generate code in little-endian mode. - -@item -mreduced-regs -@opindex mreduced-regs -Use reduced-set registers for register allocation. - -@item -mfull-regs -@opindex mfull-regs -Use full-set registers for register allocation. - -@item -mcmov -@opindex mcmov -Generate conditional move instructions. - -@item -mno-cmov -@opindex mno-cmov -Do not generate conditional move instructions. - -@item -mperf-ext -@opindex mperf-ext -Generate performance extension instructions. - -@item -mno-perf-ext -@opindex mno-perf-ext -Do not generate performance extension instructions. - -@item -mv3push -@opindex mv3push -Generate v3 push25/pop25 instructions. - -@item -mno-v3push -@opindex mno-v3push -Do not generate v3 push25/pop25 instructions. - -@item -m16-bit -@opindex m16-bit -Generate 16-bit instructions. - -@item -mno-16-bit -@opindex mno-16-bit -Do not generate 16-bit instructions. - -@item -misr-vector-size=@var{num} -@opindex misr-vector-size -Specify the size of each interrupt vector, which must be 4 or 16. - -@item -mcache-block-size=@var{num} -@opindex mcache-block-size -Specify the size of each cache block, -which must be a power of 2 between 4 and 512. - -@item -march=@var{arch} -@opindex march -Specify the name of the target architecture. - -@item -mcmodel=@var{code-model} -@opindex mcmodel -Set the code model to one of -@table @asis -@item @samp{small} -All the data and read-only data segments must be within 512KB addressing space. -The text segment must be within 16MB addressing space. -@item @samp{medium} -The data segment must be within 512KB while the read-only data segment can be -within 4GB addressing space. The text segment should be still within 16MB -addressing space. -@item @samp{large} -All the text and data segments can be within 4GB addressing space. -@end table - -@item -mctor-dtor -@opindex mctor-dtor -Enable constructor/destructor feature. - -@item -mrelax -@opindex mrelax -Guide linker to relax instructions. - -@end table - -@node Nios II Options -@subsection Nios II Options -@cindex Nios II options -@cindex Altera Nios II options - -These are the options defined for the Altera Nios II processor. - -@table @gcctabopt - -@item -G @var{num} -@opindex G -@cindex smaller data references -Put global and static objects less than or equal to @var{num} bytes -into the small data or BSS sections instead of the normal data or BSS -sections. The default value of @var{num} is 8. - -@item -mgpopt=@var{option} -@item -mgpopt -@itemx -mno-gpopt -@opindex mgpopt -@opindex mno-gpopt -Generate (do not generate) GP-relative accesses. The following -@var{option} names are recognized: - -@table @samp - -@item none -Do not generate GP-relative accesses. - -@item local -Generate GP-relative accesses for small data objects that are not -external or weak. Also use GP-relative addressing for objects that -have been explicitly placed in a small data section via a @code{section} -attribute. - -@item global -As for @samp{local}, but also generate GP-relative accesses for -small data objects that are external or weak. If you use this option, -you must ensure that all parts of your program (including libraries) are -compiled with the same @option{-G} setting. - -@item data -Generate GP-relative accesses for all data objects in the program. If you -use this option, the entire data and BSS segments -of your program must fit in 64K of memory and you must use an appropriate -linker script to allocate them within the addressible range of the -global pointer. - -@item all -Generate GP-relative addresses for function pointers as well as data -pointers. If you use this option, the entire text, data, and BSS segments -of your program must fit in 64K of memory and you must use an appropriate -linker script to allocate them within the addressible range of the -global pointer. - -@end table - -@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and -@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. - -The default is @option{-mgpopt} except when @option{-fpic} or -@option{-fPIC} is specified to generate position-independent code. -Note that the Nios II ABI does not permit GP-relative accesses from -shared libraries. - -You may need to specify @option{-mno-gpopt} explicitly when building -programs that include large amounts of small data, including large -GOT data sections. In this case, the 16-bit offset for GP-relative -addressing may not be large enough to allow access to the entire -small data section. - -@item -mel -@itemx -meb -@opindex mel -@opindex meb -Generate little-endian (default) or big-endian (experimental) code, -respectively. - -@item -mbypass-cache -@itemx -mno-bypass-cache -@opindex mno-bypass-cache -@opindex mbypass-cache -Force all load and store instructions to always bypass cache by -using I/O variants of the instructions. The default is not to -bypass the cache. - -@item -mno-cache-volatile -@itemx -mcache-volatile -@opindex mcache-volatile -@opindex mno-cache-volatile -Volatile memory access bypass the cache using the I/O variants of -the load and store instructions. The default is not to bypass the cache. - -@item -mno-fast-sw-div -@itemx -mfast-sw-div -@opindex mno-fast-sw-div -@opindex mfast-sw-div -Do not use table-based fast divide for small numbers. The default -is to use the fast divide at @option{-O3} and above. - -@item -mno-hw-mul -@itemx -mhw-mul -@itemx -mno-hw-mulx -@itemx -mhw-mulx -@itemx -mno-hw-div -@itemx -mhw-div -@opindex mno-hw-mul -@opindex mhw-mul -@opindex mno-hw-mulx -@opindex mhw-mulx -@opindex mno-hw-div -@opindex mhw-div -Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of -instructions by the compiler. The default is to emit @code{mul} -and not emit @code{div} and @code{mulx}. - -@item -mcustom-@var{insn}=@var{N} -@itemx -mno-custom-@var{insn} -@opindex mcustom-@var{insn} -@opindex mno-custom-@var{insn} -Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a -custom instruction with encoding @var{N} when generating code that uses -@var{insn}. For example, @option{-mcustom-fadds=253} generates custom -instruction 253 for single-precision floating-point add operations instead -of the default behavior of using a library call. - -The following values of @var{insn} are supported. Except as otherwise -noted, floating-point operations are expected to be implemented with -normal IEEE 754 semantics and correspond directly to the C operators or the -equivalent GCC built-in functions (@pxref{Other Builtins}). - -Single-precision floating point: -@table @asis - -@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} -Binary arithmetic operations. - -@item @samp{fnegs} -Unary negation. - -@item @samp{fabss} -Unary absolute value. - -@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} -Comparison operations. - -@item @samp{fmins}, @samp{fmaxs} -Floating-point minimum and maximum. These instructions are only -generated if @option{-ffinite-math-only} is specified. - -@item @samp{fsqrts} -Unary square root operation. - -@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} -Floating-point trigonometric and exponential functions. These instructions -are only generated if @option{-funsafe-math-optimizations} is also specified. - -@end table - -Double-precision floating point: -@table @asis - -@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} -Binary arithmetic operations. - -@item @samp{fnegd} -Unary negation. - -@item @samp{fabsd} -Unary absolute value. - -@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} -Comparison operations. - -@item @samp{fmind}, @samp{fmaxd} -Double-precision minimum and maximum. These instructions are only -generated if @option{-ffinite-math-only} is specified. - -@item @samp{fsqrtd} -Unary square root operation. - -@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} -Double-precision trigonometric and exponential functions. These instructions -are only generated if @option{-funsafe-math-optimizations} is also specified. - -@end table - -Conversions: -@table @asis -@item @samp{fextsd} -Conversion from single precision to double precision. - -@item @samp{ftruncds} -Conversion from double precision to single precision. - -@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} -Conversion from floating point to signed or unsigned integer types, with -truncation towards zero. - -@item @samp{round} -Conversion from single-precision floating point to signed integer, -rounding to the nearest integer and ties away from zero. -This corresponds to the @code{__builtin_lroundf} function when -@option{-fno-math-errno} is used. - -@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} -Conversion from signed or unsigned integer types to floating-point types. - -@end table - -In addition, all of the following transfer instructions for internal -registers X and Y must be provided to use any of the double-precision -floating-point instructions. Custom instructions taking two -double-precision source operands expect the first operand in the -64-bit register X. The other operand (or only operand of a unary -operation) is given to the custom arithmetic instruction with the -least significant half in source register @var{src1} and the most -significant half in @var{src2}. A custom instruction that returns a -double-precision result returns the most significant 32 bits in the -destination register and the other half in 32-bit register Y. -GCC automatically generates the necessary code sequences to write -register X and/or read register Y when double-precision floating-point -instructions are used. - -@table @asis - -@item @samp{fwrx} -Write @var{src1} into the least significant half of X and @var{src2} into -the most significant half of X. - -@item @samp{fwry} -Write @var{src1} into Y. - -@item @samp{frdxhi}, @samp{frdxlo} -Read the most or least (respectively) significant half of X and store it in -@var{dest}. - -@item @samp{frdy} -Read the value of Y and store it into @var{dest}. -@end table - -Note that you can gain more local control over generation of Nios II custom -instructions by using the @code{target("custom-@var{insn}=@var{N}")} -and @code{target("no-custom-@var{insn}")} function attributes -(@pxref{Function Attributes}) -or pragmas (@pxref{Function Specific Option Pragmas}). - -@item -mcustom-fpu-cfg=@var{name} -@opindex mcustom-fpu-cfg - -This option enables a predefined, named set of custom instruction encodings -(see @option{-mcustom-@var{insn}} above). -Currently, the following sets are defined: - -@option{-mcustom-fpu-cfg=60-1} is equivalent to: -@gccoptlist{-mcustom-fmuls=252 @gol --mcustom-fadds=253 @gol --mcustom-fsubs=254 @gol --fsingle-precision-constant} - -@option{-mcustom-fpu-cfg=60-2} is equivalent to: -@gccoptlist{-mcustom-fmuls=252 @gol --mcustom-fadds=253 @gol --mcustom-fsubs=254 @gol --mcustom-fdivs=255 @gol --fsingle-precision-constant} - -@option{-mcustom-fpu-cfg=72-3} is equivalent to: -@gccoptlist{-mcustom-floatus=243 @gol --mcustom-fixsi=244 @gol --mcustom-floatis=245 @gol --mcustom-fcmpgts=246 @gol --mcustom-fcmples=249 @gol --mcustom-fcmpeqs=250 @gol --mcustom-fcmpnes=251 @gol --mcustom-fmuls=252 @gol --mcustom-fadds=253 @gol --mcustom-fsubs=254 @gol --mcustom-fdivs=255 @gol --fsingle-precision-constant} - -Custom instruction assignments given by individual -@option{-mcustom-@var{insn}=} options override those given by -@option{-mcustom-fpu-cfg=}, regardless of the -order of the options on the command line. - -Note that you can gain more local control over selection of a FPU -configuration by using the @code{target("custom-fpu-cfg=@var{name}")} -function attribute (@pxref{Function Attributes}) -or pragma (@pxref{Function Specific Option Pragmas}). - -@end table - -These additional @samp{-m} options are available for the Altera Nios II -ELF (bare-metal) target: - -@table @gcctabopt - -@item -mhal -@opindex mhal -Link with HAL BSP. This suppresses linking with the GCC-provided C runtime -startup and termination code, and is typically used in conjunction with -@option{-msys-crt0=} to specify the location of the alternate startup code -provided by the HAL BSP. - -@item -msmallc -@opindex msmallc -Link with a limited version of the C library, @option{-lsmallc}, rather than -Newlib. - -@item -msys-crt0=@var{startfile} -@opindex msys-crt0 -@var{startfile} is the file name of the startfile (crt0) to use -when linking. This option is only useful in conjunction with @option{-mhal}. - -@item -msys-lib=@var{systemlib} -@opindex msys-lib -@var{systemlib} is the library name of the library that provides -low-level system calls required by the C library, -e.g. @code{read} and @code{write}. -This option is typically used to link with a library provided by a HAL BSP. - -@end table - -@node Nvidia PTX Options -@subsection Nvidia PTX Options -@cindex Nvidia PTX options -@cindex nvptx options - -These options are defined for Nvidia PTX: - -@table @gcctabopt - -@item -m32 -@itemx -m64 -@opindex m32 -@opindex m64 -Generate code for 32-bit or 64-bit ABI. - -@item -mmainkernel -@opindex mmainkernel -Link in code for a __main kernel. This is for stand-alone instead of -offloading execution. - -@end table - -@node PDP-11 Options -@subsection PDP-11 Options -@cindex PDP-11 Options - -These options are defined for the PDP-11: - -@table @gcctabopt -@item -mfpu -@opindex mfpu -Use hardware FPP floating point. This is the default. (FIS floating -point on the PDP-11/40 is not supported.) - -@item -msoft-float -@opindex msoft-float -Do not use hardware floating point. - -@item -mac0 -@opindex mac0 -Return floating-point results in ac0 (fr0 in Unix assembler syntax). - -@item -mno-ac0 -@opindex mno-ac0 -Return floating-point results in memory. This is the default. - -@item -m40 -@opindex m40 -Generate code for a PDP-11/40. - -@item -m45 -@opindex m45 -Generate code for a PDP-11/45. This is the default. - -@item -m10 -@opindex m10 -Generate code for a PDP-11/10. - -@item -mbcopy-builtin -@opindex mbcopy-builtin -Use inline @code{movmemhi} patterns for copying memory. This is the -default. - -@item -mbcopy -@opindex mbcopy -Do not use inline @code{movmemhi} patterns for copying memory. - -@item -mint16 -@itemx -mno-int32 -@opindex mint16 -@opindex mno-int32 -Use 16-bit @code{int}. This is the default. - -@item -mint32 -@itemx -mno-int16 -@opindex mint32 -@opindex mno-int16 -Use 32-bit @code{int}. - -@item -mfloat64 -@itemx -mno-float32 -@opindex mfloat64 -@opindex mno-float32 -Use 64-bit @code{float}. This is the default. - -@item -mfloat32 -@itemx -mno-float64 -@opindex mfloat32 -@opindex mno-float64 -Use 32-bit @code{float}. - -@item -mabshi -@opindex mabshi -Use @code{abshi2} pattern. This is the default. - -@item -mno-abshi -@opindex mno-abshi -Do not use @code{abshi2} pattern. - -@item -mbranch-expensive -@opindex mbranch-expensive -Pretend that branches are expensive. This is for experimenting with -code generation only. - -@item -mbranch-cheap -@opindex mbranch-cheap -Do not pretend that branches are expensive. This is the default. - -@item -munix-asm -@opindex munix-asm -Use Unix assembler syntax. This is the default when configured for -@samp{pdp11-*-bsd}. - -@item -mdec-asm -@opindex mdec-asm -Use DEC assembler syntax. This is the default when configured for any -PDP-11 target other than @samp{pdp11-*-bsd}. -@end table - -@node picoChip Options -@subsection picoChip Options -@cindex picoChip options - -These @samp{-m} options are defined for picoChip implementations: - -@table @gcctabopt - -@item -mae=@var{ae_type} -@opindex mcpu -Set the instruction set, register set, and instruction scheduling -parameters for array element type @var{ae_type}. Supported values -for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. - -@option{-mae=ANY} selects a completely generic AE type. Code -generated with this option runs on any of the other AE types. The -code is not as efficient as it would be if compiled for a specific -AE type, and some types of operation (e.g., multiplication) do not -work properly on all types of AE. - -@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type -for compiled code, and is the default. - -@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this -option may suffer from poor performance of byte (char) manipulation, -since the DSP AE does not provide hardware support for byte load/stores. - -@item -msymbol-as-address -Enable the compiler to directly use a symbol name as an address in a -load/store instruction, without first loading it into a -register. Typically, the use of this option generates larger -programs, which run faster than when the option isn't used. However, the -results vary from program to program, so it is left as a user option, -rather than being permanently enabled. - -@item -mno-inefficient-warnings -Disables warnings about the generation of inefficient code. These -warnings can be generated, for example, when compiling code that -performs byte-level memory operations on the MAC AE type. The MAC AE has -no hardware support for byte-level memory operations, so all byte -load/stores must be synthesized from word load/store operations. This is -inefficient and a warning is generated to indicate -that you should rewrite the code to avoid byte operations, or to target -an AE type that has the necessary hardware support. This option disables -these warnings. - -@end table - -@node PowerPC Options -@subsection PowerPC Options -@cindex PowerPC options - -These are listed under @xref{RS/6000 and PowerPC Options}. - -@node RL78 Options -@subsection RL78 Options -@cindex RL78 Options - -@table @gcctabopt - -@item -msim -@opindex msim -Links in additional target libraries to support operation within a -simulator. - -@item -mmul=none -@itemx -mmul=g13 -@itemx -mmul=rl78 -@opindex mmul -Specifies the type of hardware multiplication support to be used. The -default is @samp{none}, which uses software multiplication functions. -The @samp{g13} option is for the hardware multiply/divide peripheral -only on the RL78/G13 targets. The @samp{rl78} option is for the -standard hardware multiplication defined in the RL78 software manual. - -@item -m64bit-doubles -@itemx -m32bit-doubles -@opindex m64bit-doubles -@opindex m32bit-doubles -Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) -or 32 bits (@option{-m32bit-doubles}) in size. The default is -@option{-m32bit-doubles}. - -@end table - -@node RS/6000 and PowerPC Options -@subsection IBM RS/6000 and PowerPC Options -@cindex RS/6000 and PowerPC Options -@cindex IBM RS/6000 and PowerPC Options - -These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: -@table @gcctabopt -@item -mpowerpc-gpopt -@itemx -mno-powerpc-gpopt -@itemx -mpowerpc-gfxopt -@itemx -mno-powerpc-gfxopt -@need 800 -@itemx -mpowerpc64 -@itemx -mno-powerpc64 -@itemx -mmfcrf -@itemx -mno-mfcrf -@itemx -mpopcntb -@itemx -mno-popcntb -@itemx -mpopcntd -@itemx -mno-popcntd -@itemx -mfprnd -@itemx -mno-fprnd -@need 800 -@itemx -mcmpb -@itemx -mno-cmpb -@itemx -mmfpgpr -@itemx -mno-mfpgpr -@itemx -mhard-dfp -@itemx -mno-hard-dfp -@opindex mpowerpc-gpopt -@opindex mno-powerpc-gpopt -@opindex mpowerpc-gfxopt -@opindex mno-powerpc-gfxopt -@opindex mpowerpc64 -@opindex mno-powerpc64 -@opindex mmfcrf -@opindex mno-mfcrf -@opindex mpopcntb -@opindex mno-popcntb -@opindex mpopcntd -@opindex mno-popcntd -@opindex mfprnd -@opindex mno-fprnd -@opindex mcmpb -@opindex mno-cmpb -@opindex mmfpgpr -@opindex mno-mfpgpr -@opindex mhard-dfp -@opindex mno-hard-dfp -You use these options to specify which instructions are available on the -processor you are using. The default value of these options is -determined when configuring GCC@. Specifying the -@option{-mcpu=@var{cpu_type}} overrides the specification of these -options. We recommend you use the @option{-mcpu=@var{cpu_type}} option -rather than the options listed above. - -Specifying @option{-mpowerpc-gpopt} allows -GCC to use the optional PowerPC architecture instructions in the -General Purpose group, including floating-point square root. Specifying -@option{-mpowerpc-gfxopt} allows GCC to -use the optional PowerPC architecture instructions in the Graphics -group, including floating-point select. - -The @option{-mmfcrf} option allows GCC to generate the move from -condition register field instruction implemented on the POWER4 -processor and other processors that support the PowerPC V2.01 -architecture. -The @option{-mpopcntb} option allows GCC to generate the popcount and -double-precision FP reciprocal estimate instruction implemented on the -POWER5 processor and other processors that support the PowerPC V2.02 -architecture. -The @option{-mpopcntd} option allows GCC to generate the popcount -instruction implemented on the POWER7 processor and other processors -that support the PowerPC V2.06 architecture. -The @option{-mfprnd} option allows GCC to generate the FP round to -integer instructions implemented on the POWER5+ processor and other -processors that support the PowerPC V2.03 architecture. -The @option{-mcmpb} option allows GCC to generate the compare bytes -instruction implemented on the POWER6 processor and other processors -that support the PowerPC V2.05 architecture. -The @option{-mmfpgpr} option allows GCC to generate the FP move to/from -general-purpose register instructions implemented on the POWER6X -processor and other processors that support the extended PowerPC V2.05 -architecture. -The @option{-mhard-dfp} option allows GCC to generate the decimal -floating-point instructions implemented on some POWER processors. - -The @option{-mpowerpc64} option allows GCC to generate the additional -64-bit instructions that are found in the full PowerPC64 architecture -and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to -@option{-mno-powerpc64}. - -@item -mcpu=@var{cpu_type} -@opindex mcpu -Set architecture type, register usage, and -instruction scheduling parameters for machine type @var{cpu_type}. -Supported values for @var{cpu_type} are @samp{401}, @samp{403}, -@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, -@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, -@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, -@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, -@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, -@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, -@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, -@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, -@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc}, -@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}. - -@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and -@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either -endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC -architecture machine types, with an appropriate, generic processor -model assumed for scheduling purposes. - -The other options specify a specific processor. Code generated under -those options runs best on that processor, and may not run at all on -others. - -The @option{-mcpu} options automatically enable or disable the -following options: - -@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol --mpopcntb -mpopcntd -mpowerpc64 @gol --mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol --msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol --mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol --mquad-memory -mquad-memory-atomic} - -The particular options set for any particular CPU varies between -compiler versions, depending on what setting seems to produce optimal -code for that CPU; it doesn't necessarily reflect the actual hardware's -capabilities. If you wish to set an individual option to a particular -value, you may specify it after the @option{-mcpu} option, like -@option{-mcpu=970 -mno-altivec}. - -On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are -not enabled or disabled by the @option{-mcpu} option at present because -AIX does not have full support for these options. You may still -enable or disable them individually if you're sure it'll work in your -environment. - -@item -mtune=@var{cpu_type} -@opindex mtune -Set the instruction scheduling parameters for machine type -@var{cpu_type}, but do not set the architecture type or register usage, -as @option{-mcpu=@var{cpu_type}} does. The same -values for @var{cpu_type} are used for @option{-mtune} as for -@option{-mcpu}. If both are specified, the code generated uses the -architecture and registers set by @option{-mcpu}, but the -scheduling parameters set by @option{-mtune}. - -@item -mcmodel=small -@opindex mcmodel=small -Generate PowerPC64 code for the small model: The TOC is limited to -64k. - -@item -mcmodel=medium -@opindex mcmodel=medium -Generate PowerPC64 code for the medium model: The TOC and other static -data may be up to a total of 4G in size. - -@item -mcmodel=large -@opindex mcmodel=large -Generate PowerPC64 code for the large model: The TOC may be up to 4G -in size. Other data and code is only limited by the 64-bit address -space. - -@item -maltivec -@itemx -mno-altivec -@opindex maltivec -@opindex mno-altivec -Generate code that uses (does not use) AltiVec instructions, and also -enable the use of built-in functions that allow more direct access to -the AltiVec instruction set. You may also need to set -@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI -enhancements. - -When @option{-maltivec} is used, rather than @option{-maltivec=le} or -@option{-maltivec=be}, the element order for Altivec intrinsics such -as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} -match array element order corresponding to the endianness of the -target. That is, element zero identifies the leftmost element in a -vector register when targeting a big-endian platform, and identifies -the rightmost element in a vector register when targeting a -little-endian platform. - -@item -maltivec=be -@opindex maltivec=be -Generate Altivec instructions using big-endian element order, -regardless of whether the target is big- or little-endian. This is -the default when targeting a big-endian platform. - -The element order is used to interpret element numbers in Altivec -intrinsics such as @code{vec_splat}, @code{vec_extract}, and -@code{vec_insert}. By default, these match array element order -corresponding to the endianness for the target. - -@item -maltivec=le -@opindex maltivec=le -Generate Altivec instructions using little-endian element order, -regardless of whether the target is big- or little-endian. This is -the default when targeting a little-endian platform. This option is -currently ignored when targeting a big-endian platform. - -The element order is used to interpret element numbers in Altivec -intrinsics such as @code{vec_splat}, @code{vec_extract}, and -@code{vec_insert}. By default, these match array element order -corresponding to the endianness for the target. - -@item -mvrsave -@itemx -mno-vrsave -@opindex mvrsave -@opindex mno-vrsave -Generate VRSAVE instructions when generating AltiVec code. - -@item -mgen-cell-microcode -@opindex mgen-cell-microcode -Generate Cell microcode instructions. - -@item -mwarn-cell-microcode -@opindex mwarn-cell-microcode -Warn when a Cell microcode instruction is emitted. An example -of a Cell microcode instruction is a variable shift. - -@item -msecure-plt -@opindex msecure-plt -Generate code that allows @command{ld} and @command{ld.so} -to build executables and shared -libraries with non-executable @code{.plt} and @code{.got} sections. -This is a PowerPC -32-bit SYSV ABI option. - -@item -mbss-plt -@opindex mbss-plt -Generate code that uses a BSS @code{.plt} section that @command{ld.so} -fills in, and -requires @code{.plt} and @code{.got} -sections that are both writable and executable. -This is a PowerPC 32-bit SYSV ABI option. - -@item -misel -@itemx -mno-isel -@opindex misel -@opindex mno-isel -This switch enables or disables the generation of ISEL instructions. - -@item -misel=@var{yes/no} -This switch has been deprecated. Use @option{-misel} and -@option{-mno-isel} instead. - -@item -mspe -@itemx -mno-spe -@opindex mspe -@opindex mno-spe -This switch enables or disables the generation of SPE simd -instructions. - -@item -mpaired -@itemx -mno-paired -@opindex mpaired -@opindex mno-paired -This switch enables or disables the generation of PAIRED simd -instructions. - -@item -mspe=@var{yes/no} -This option has been deprecated. Use @option{-mspe} and -@option{-mno-spe} instead. - -@item -mvsx -@itemx -mno-vsx -@opindex mvsx -@opindex mno-vsx -Generate code that uses (does not use) vector/scalar (VSX) -instructions, and also enable the use of built-in functions that allow -more direct access to the VSX instruction set. - -@item -mcrypto -@itemx -mno-crypto -@opindex mcrypto -@opindex mno-crypto -Enable the use (disable) of the built-in functions that allow direct -access to the cryptographic instructions that were added in version -2.07 of the PowerPC ISA. - -@item -mdirect-move -@itemx -mno-direct-move -@opindex mdirect-move -@opindex mno-direct-move -Generate code that uses (does not use) the instructions to move data -between the general purpose registers and the vector/scalar (VSX) -registers that were added in version 2.07 of the PowerPC ISA. - -@item -mpower8-fusion -@itemx -mno-power8-fusion -@opindex mpower8-fusion -@opindex mno-power8-fusion -Generate code that keeps (does not keeps) some integer operations -adjacent so that the instructions can be fused together on power8 and -later processors. - -@item -mpower8-vector -@itemx -mno-power8-vector -@opindex mpower8-vector -@opindex mno-power8-vector -Generate code that uses (does not use) the vector and scalar -instructions that were added in version 2.07 of the PowerPC ISA. Also -enable the use of built-in functions that allow more direct access to -the vector instructions. - -@item -mquad-memory -@itemx -mno-quad-memory -@opindex mquad-memory -@opindex mno-quad-memory -Generate code that uses (does not use) the non-atomic quad word memory -instructions. The @option{-mquad-memory} option requires use of -64-bit mode. - -@item -mquad-memory-atomic -@itemx -mno-quad-memory-atomic -@opindex mquad-memory-atomic -@opindex mno-quad-memory-atomic -Generate code that uses (does not use) the atomic quad word memory -instructions. The @option{-mquad-memory-atomic} option requires use of -64-bit mode. - -@item -mupper-regs-df -@itemx -mno-upper-regs-df -@opindex mupper-regs-df -@opindex mno-upper-regs-df -Generate code that uses (does not use) the scalar double precision -instructions that target all 64 registers in the vector/scalar -floating point register set that were added in version 2.06 of the -PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you -use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or -@option{-mvsx} options. - -@item -mupper-regs-sf -@itemx -mno-upper-regs-sf -@opindex mupper-regs-sf -@opindex mno-upper-regs-sf -Generate code that uses (does not use) the scalar single precision -instructions that target all 64 registers in the vector/scalar -floating point register set that were added in version 2.07 of the -PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you -use either of the @option{-mcpu=power8} or @option{-mpower8-vector} -options. - -@item -mupper-regs -@itemx -mno-upper-regs -@opindex mupper-regs -@opindex mno-upper-regs -Generate code that uses (does not use) the scalar -instructions that target all 64 registers in the vector/scalar -floating point register set, depending on the model of the machine. - -If the @option{-mno-upper-regs} option is used, it turns off both -@option{-mupper-regs-sf} and @option{-mupper-regs-df} options. - -@item -mfloat-gprs=@var{yes/single/double/no} -@itemx -mfloat-gprs -@opindex mfloat-gprs -This switch enables or disables the generation of floating-point -operations on the general-purpose registers for architectures that -support it. - -The argument @samp{yes} or @samp{single} enables the use of -single-precision floating-point operations. - -The argument @samp{double} enables the use of single and -double-precision floating-point operations. - -The argument @samp{no} disables floating-point operations on the -general-purpose registers. - -This option is currently only available on the MPC854x. - -@item -m32 -@itemx -m64 -@opindex m32 -@opindex m64 -Generate code for 32-bit or 64-bit environments of Darwin and SVR4 -targets (including GNU/Linux). The 32-bit environment sets int, long -and pointer to 32 bits and generates code that runs on any PowerPC -variant. The 64-bit environment sets int to 32 bits and long and -pointer to 64 bits, and generates code for PowerPC64, as for -@option{-mpowerpc64}. - -@item -mfull-toc -@itemx -mno-fp-in-toc -@itemx -mno-sum-in-toc -@itemx -mminimal-toc -@opindex mfull-toc -@opindex mno-fp-in-toc -@opindex mno-sum-in-toc -@opindex mminimal-toc -Modify generation of the TOC (Table Of Contents), which is created for -every executable file. The @option{-mfull-toc} option is selected by -default. In that case, GCC allocates at least one TOC entry for -each unique non-automatic variable reference in your program. GCC -also places floating-point constants in the TOC@. However, only -16,384 entries are available in the TOC@. - -If you receive a linker error message that saying you have overflowed -the available TOC space, you can reduce the amount of TOC space used -with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. -@option{-mno-fp-in-toc} prevents GCC from putting floating-point -constants in the TOC and @option{-mno-sum-in-toc} forces GCC to -generate code to calculate the sum of an address and a constant at -run time instead of putting that sum into the TOC@. You may specify one -or both of these options. Each causes GCC to produce very slightly -slower and larger code at the expense of conserving TOC space. - -If you still run out of space in the TOC even when you specify both of -these options, specify @option{-mminimal-toc} instead. This option causes -GCC to make only one TOC entry for every file. When you specify this -option, GCC produces code that is slower and larger but which -uses extremely little TOC space. You may wish to use this option -only on files that contain less frequently-executed code. - -@item -maix64 -@itemx -maix32 -@opindex maix64 -@opindex maix32 -Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit -@code{long} type, and the infrastructure needed to support them. -Specifying @option{-maix64} implies @option{-mpowerpc64}, -while @option{-maix32} disables the 64-bit ABI and -implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. - -@item -mxl-compat -@itemx -mno-xl-compat -@opindex mxl-compat -@opindex mno-xl-compat -Produce code that conforms more closely to IBM XL compiler semantics -when using AIX-compatible ABI@. Pass floating-point arguments to -prototyped functions beyond the register save area (RSA) on the stack -in addition to argument FPRs. Do not assume that most significant -double in 128-bit long double value is properly rounded when comparing -values and converting to double. Use XL symbol names for long double -support routines. - -The AIX calling convention was extended but not initially documented to -handle an obscure K&R C case of calling a function that takes the -address of its arguments with fewer arguments than declared. IBM XL -compilers access floating-point arguments that do not fit in the -RSA from the stack when a subroutine is compiled without -optimization. Because always storing floating-point arguments on the -stack is inefficient and rarely needed, this option is not enabled by -default and only is necessary when calling subroutines compiled by IBM -XL compilers without optimization. - -@item -mpe -@opindex mpe -Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an -application written to use message passing with special startup code to -enable the application to run. The system must have PE installed in the -standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file -must be overridden with the @option{-specs=} option to specify the -appropriate directory location. The Parallel Environment does not -support threads, so the @option{-mpe} option and the @option{-pthread} -option are incompatible. - -@item -malign-natural -@itemx -malign-power -@opindex malign-natural -@opindex malign-power -On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option -@option{-malign-natural} overrides the ABI-defined alignment of larger -types, such as floating-point doubles, on their natural size-based boundary. -The option @option{-malign-power} instructs GCC to follow the ABI-specified -alignment rules. GCC defaults to the standard alignment defined in the ABI@. - -On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} -is not supported. - -@item -msoft-float -@itemx -mhard-float -@opindex msoft-float -@opindex mhard-float -Generate code that does not use (uses) the floating-point register set. -Software floating-point emulation is provided if you use the -@option{-msoft-float} option, and pass the option to GCC when linking. - -@item -msingle-float -@itemx -mdouble-float -@opindex msingle-float -@opindex mdouble-float -Generate code for single- or double-precision floating-point operations. -@option{-mdouble-float} implies @option{-msingle-float}. - -@item -msimple-fpu -@opindex msimple-fpu -Do not generate @code{sqrt} and @code{div} instructions for hardware -floating-point unit. - -@item -mfpu=@var{name} -@opindex mfpu -Specify type of floating-point unit. Valid values for @var{name} are -@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}), -@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}), -@samp{sp_full} (equivalent to @option{-msingle-float}), -and @samp{dp_full} (equivalent to @option{-mdouble-float}). - -@item -mxilinx-fpu -@opindex mxilinx-fpu -Perform optimizations for the floating-point unit on Xilinx PPC 405/440. - -@item -mmultiple -@itemx -mno-multiple -@opindex mmultiple -@opindex mno-multiple -Generate code that uses (does not use) the load multiple word -instructions and the store multiple word instructions. These -instructions are generated by default on POWER systems, and not -generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian -PowerPC systems, since those instructions do not work when the -processor is in little-endian mode. The exceptions are PPC740 and -PPC750 which permit these instructions in little-endian mode. - -@item -mstring -@itemx -mno-string -@opindex mstring -@opindex mno-string -Generate code that uses (does not use) the load string instructions -and the store string word instructions to save multiple registers and -do small block moves. These instructions are generated by default on -POWER systems, and not generated on PowerPC systems. Do not use -@option{-mstring} on little-endian PowerPC systems, since those -instructions do not work when the processor is in little-endian mode. -The exceptions are PPC740 and PPC750 which permit these instructions -in little-endian mode. - -@item -mupdate -@itemx -mno-update -@opindex mupdate -@opindex mno-update -Generate code that uses (does not use) the load or store instructions -that update the base register to the address of the calculated memory -location. These instructions are generated by default. If you use -@option{-mno-update}, there is a small window between the time that the -stack pointer is updated and the address of the previous frame is -stored, which means code that walks the stack frame across interrupts or -signals may get corrupted data. - -@item -mavoid-indexed-addresses -@itemx -mno-avoid-indexed-addresses -@opindex mavoid-indexed-addresses -@opindex mno-avoid-indexed-addresses -Generate code that tries to avoid (not avoid) the use of indexed load -or store instructions. These instructions can incur a performance -penalty on Power6 processors in certain situations, such as when -stepping through large arrays that cross a 16M boundary. This option -is enabled by default when targeting Power6 and disabled otherwise. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Generate code that uses (does not use) the floating-point multiply and -accumulate instructions. These instructions are generated by default -if hardware floating point is used. The machine-dependent -@option{-mfused-madd} option is now mapped to the machine-independent -@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is -mapped to @option{-ffp-contract=off}. - -@item -mmulhw -@itemx -mno-mulhw -@opindex mmulhw -@opindex mno-mulhw -Generate code that uses (does not use) the half-word multiply and -multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. -These instructions are generated by default when targeting those -processors. - -@item -mdlmzb -@itemx -mno-dlmzb -@opindex mdlmzb -@opindex mno-dlmzb -Generate code that uses (does not use) the string-search @samp{dlmzb} -instruction on the IBM 405, 440, 464 and 476 processors. This instruction is -generated by default when targeting those processors. - -@item -mno-bit-align -@itemx -mbit-align -@opindex mno-bit-align -@opindex mbit-align -On System V.4 and embedded PowerPC systems do not (do) force structures -and unions that contain bit-fields to be aligned to the base type of the -bit-field. - -For example, by default a structure containing nothing but 8 -@code{unsigned} bit-fields of length 1 is aligned to a 4-byte -boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, -the structure is aligned to a 1-byte boundary and is 1 byte in -size. - -@item -mno-strict-align -@itemx -mstrict-align -@opindex mno-strict-align -@opindex mstrict-align -On System V.4 and embedded PowerPC systems do not (do) assume that -unaligned memory references are handled by the system. - -@item -mrelocatable -@itemx -mno-relocatable -@opindex mrelocatable -@opindex mno-relocatable -Generate code that allows (does not allow) a static executable to be -relocated to a different address at run time. A simple embedded -PowerPC system loader should relocate the entire contents of -@code{.got2} and 4-byte locations listed in the @code{.fixup} section, -a table of 32-bit addresses generated by this option. For this to -work, all objects linked together must be compiled with -@option{-mrelocatable} or @option{-mrelocatable-lib}. -@option{-mrelocatable} code aligns the stack to an 8-byte boundary. - -@item -mrelocatable-lib -@itemx -mno-relocatable-lib -@opindex mrelocatable-lib -@opindex mno-relocatable-lib -Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a -@code{.fixup} section to allow static executables to be relocated at -run time, but @option{-mrelocatable-lib} does not use the smaller stack -alignment of @option{-mrelocatable}. Objects compiled with -@option{-mrelocatable-lib} may be linked with objects compiled with -any combination of the @option{-mrelocatable} options. - -@item -mno-toc -@itemx -mtoc -@opindex mno-toc -@opindex mtoc -On System V.4 and embedded PowerPC systems do not (do) assume that -register 2 contains a pointer to a global area pointing to the addresses -used in the program. - -@item -mlittle -@itemx -mlittle-endian -@opindex mlittle -@opindex mlittle-endian -On System V.4 and embedded PowerPC systems compile code for the -processor in little-endian mode. The @option{-mlittle-endian} option is -the same as @option{-mlittle}. - -@item -mbig -@itemx -mbig-endian -@opindex mbig -@opindex mbig-endian -On System V.4 and embedded PowerPC systems compile code for the -processor in big-endian mode. The @option{-mbig-endian} option is -the same as @option{-mbig}. - -@item -mdynamic-no-pic -@opindex mdynamic-no-pic -On Darwin and Mac OS X systems, compile code so that it is not -relocatable, but that its external references are relocatable. The -resulting code is suitable for applications, but not shared -libraries. - -@item -msingle-pic-base -@opindex msingle-pic-base -Treat the register used for PIC addressing as read-only, rather than -loading it in the prologue for each function. The runtime system is -responsible for initializing this register with an appropriate value -before execution begins. - -@item -mprioritize-restricted-insns=@var{priority} -@opindex mprioritize-restricted-insns -This option controls the priority that is assigned to -dispatch-slot restricted instructions during the second scheduling -pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, -or @samp{2} to assign no, highest, or second-highest (respectively) -priority to dispatch-slot restricted -instructions. - -@item -msched-costly-dep=@var{dependence_type} -@opindex msched-costly-dep -This option controls which dependences are considered costly -by the target during instruction scheduling. The argument -@var{dependence_type} takes one of the following values: - -@table @asis -@item @samp{no} -No dependence is costly. - -@item @samp{all} -All dependences are costly. - -@item @samp{true_store_to_load} -A true dependence from store to load is costly. - -@item @samp{store_to_load} -Any dependence from store to load is costly. - -@item @var{number} -Any dependence for which the latency is greater than or equal to -@var{number} is costly. -@end table - -@item -minsert-sched-nops=@var{scheme} -@opindex minsert-sched-nops -This option controls which NOP insertion scheme is used during -the second scheduling pass. The argument @var{scheme} takes one of the -following values: - -@table @asis -@item @samp{no} -Don't insert NOPs. - -@item @samp{pad} -Pad with NOPs any dispatch group that has vacant issue slots, -according to the scheduler's grouping. - -@item @samp{regroup_exact} -Insert NOPs to force costly dependent insns into -separate groups. Insert exactly as many NOPs as needed to force an insn -to a new group, according to the estimated processor grouping. - -@item @var{number} -Insert NOPs to force costly dependent insns into -separate groups. Insert @var{number} NOPs to force an insn to a new group. -@end table - -@item -mcall-sysv -@opindex mcall-sysv -On System V.4 and embedded PowerPC systems compile code using calling -conventions that adhere to the March 1995 draft of the System V -Application Binary Interface, PowerPC processor supplement. This is the -default unless you configured GCC using @samp{powerpc-*-eabiaix}. - -@item -mcall-sysv-eabi -@itemx -mcall-eabi -@opindex mcall-sysv-eabi -@opindex mcall-eabi -Specify both @option{-mcall-sysv} and @option{-meabi} options. - -@item -mcall-sysv-noeabi -@opindex mcall-sysv-noeabi -Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. - -@item -mcall-aixdesc -@opindex m -On System V.4 and embedded PowerPC systems compile code for the AIX -operating system. - -@item -mcall-linux -@opindex mcall-linux -On System V.4 and embedded PowerPC systems compile code for the -Linux-based GNU system. - -@item -mcall-freebsd -@opindex mcall-freebsd -On System V.4 and embedded PowerPC systems compile code for the -FreeBSD operating system. - -@item -mcall-netbsd -@opindex mcall-netbsd -On System V.4 and embedded PowerPC systems compile code for the -NetBSD operating system. - -@item -mcall-openbsd -@opindex mcall-netbsd -On System V.4 and embedded PowerPC systems compile code for the -OpenBSD operating system. - -@item -maix-struct-return -@opindex maix-struct-return -Return all structures in memory (as specified by the AIX ABI)@. - -@item -msvr4-struct-return -@opindex msvr4-struct-return -Return structures smaller than 8 bytes in registers (as specified by the -SVR4 ABI)@. - -@item -mabi=@var{abi-type} -@opindex mabi -Extend the current ABI with a particular extension, or remove such extension. -Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe}, -@samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, -@samp{elfv1}, @samp{elfv2}@. - -@item -mabi=spe -@opindex mabi=spe -Extend the current ABI with SPE ABI extensions. This does not change -the default ABI, instead it adds the SPE ABI extensions to the current -ABI@. - -@item -mabi=no-spe -@opindex mabi=no-spe -Disable Book-E SPE ABI extensions for the current ABI@. - -@item -mabi=ibmlongdouble -@opindex mabi=ibmlongdouble -Change the current ABI to use IBM extended-precision long double. -This is a PowerPC 32-bit SYSV ABI option. - -@item -mabi=ieeelongdouble -@opindex mabi=ieeelongdouble -Change the current ABI to use IEEE extended-precision long double. -This is a PowerPC 32-bit Linux ABI option. - -@item -mabi=elfv1 -@opindex mabi=elfv1 -Change the current ABI to use the ELFv1 ABI. -This is the default ABI for big-endian PowerPC 64-bit Linux. -Overriding the default ABI requires special system support and is -likely to fail in spectacular ways. - -@item -mabi=elfv2 -@opindex mabi=elfv2 -Change the current ABI to use the ELFv2 ABI. -This is the default ABI for little-endian PowerPC 64-bit Linux. -Overriding the default ABI requires special system support and is -likely to fail in spectacular ways. - -@item -mprototype -@itemx -mno-prototype -@opindex mprototype -@opindex mno-prototype -On System V.4 and embedded PowerPC systems assume that all calls to -variable argument functions are properly prototyped. Otherwise, the -compiler must insert an instruction before every non-prototyped call to -set or clear bit 6 of the condition code register (@code{CR}) to -indicate whether floating-point values are passed in the floating-point -registers in case the function takes variable arguments. With -@option{-mprototype}, only calls to prototyped variable argument functions -set or clear the bit. - -@item -msim -@opindex msim -On embedded PowerPC systems, assume that the startup module is called -@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and -@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} -configurations. - -@item -mmvme -@opindex mmvme -On embedded PowerPC systems, assume that the startup module is called -@file{crt0.o} and the standard C libraries are @file{libmvme.a} and -@file{libc.a}. - -@item -mads -@opindex mads -On embedded PowerPC systems, assume that the startup module is called -@file{crt0.o} and the standard C libraries are @file{libads.a} and -@file{libc.a}. - -@item -myellowknife -@opindex myellowknife -On embedded PowerPC systems, assume that the startup module is called -@file{crt0.o} and the standard C libraries are @file{libyk.a} and -@file{libc.a}. - -@item -mvxworks -@opindex mvxworks -On System V.4 and embedded PowerPC systems, specify that you are -compiling for a VxWorks system. - -@item -memb -@opindex memb -On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags -header to indicate that @samp{eabi} extended relocations are used. - -@item -meabi -@itemx -mno-eabi -@opindex meabi -@opindex mno-eabi -On System V.4 and embedded PowerPC systems do (do not) adhere to the -Embedded Applications Binary Interface (EABI), which is a set of -modifications to the System V.4 specifications. Selecting @option{-meabi} -means that the stack is aligned to an 8-byte boundary, a function -@code{__eabi} is called from @code{main} to set up the EABI -environment, and the @option{-msdata} option can use both @code{r2} and -@code{r13} to point to two separate small data areas. Selecting -@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, -no EABI initialization function is called from @code{main}, and the -@option{-msdata} option only uses @code{r13} to point to a single -small data area. The @option{-meabi} option is on by default if you -configured GCC using one of the @samp{powerpc*-*-eabi*} options. - -@item -msdata=eabi -@opindex msdata=eabi -On System V.4 and embedded PowerPC systems, put small initialized -@code{const} global and static data in the @code{.sdata2} section, which -is pointed to by register @code{r2}. Put small initialized -non-@code{const} global and static data in the @code{.sdata} section, -which is pointed to by register @code{r13}. Put small uninitialized -global and static data in the @code{.sbss} section, which is adjacent to -the @code{.sdata} section. The @option{-msdata=eabi} option is -incompatible with the @option{-mrelocatable} option. The -@option{-msdata=eabi} option also sets the @option{-memb} option. - -@item -msdata=sysv -@opindex msdata=sysv -On System V.4 and embedded PowerPC systems, put small global and static -data in the @code{.sdata} section, which is pointed to by register -@code{r13}. Put small uninitialized global and static data in the -@code{.sbss} section, which is adjacent to the @code{.sdata} section. -The @option{-msdata=sysv} option is incompatible with the -@option{-mrelocatable} option. - -@item -msdata=default -@itemx -msdata -@opindex msdata=default -@opindex msdata -On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, -compile code the same as @option{-msdata=eabi}, otherwise compile code the -same as @option{-msdata=sysv}. - -@item -msdata=data -@opindex msdata=data -On System V.4 and embedded PowerPC systems, put small global -data in the @code{.sdata} section. Put small uninitialized global -data in the @code{.sbss} section. Do not use register @code{r13} -to address small data however. This is the default behavior unless -other @option{-msdata} options are used. - -@item -msdata=none -@itemx -mno-sdata -@opindex msdata=none -@opindex mno-sdata -On embedded PowerPC systems, put all initialized global and static data -in the @code{.data} section, and all uninitialized data in the -@code{.bss} section. - -@item -mblock-move-inline-limit=@var{num} -@opindex mblock-move-inline-limit -Inline all block moves (such as calls to @code{memcpy} or structure -copies) less than or equal to @var{num} bytes. The minimum value for -@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit -targets. The default value is target-specific. - -@item -G @var{num} -@opindex G -@cindex smaller data references (PowerPC) -@cindex .sdata/.sdata2 references (PowerPC) -On embedded PowerPC systems, put global and static items less than or -equal to @var{num} bytes into the small data or BSS sections instead of -the normal data or BSS section. By default, @var{num} is 8. The -@option{-G @var{num}} switch is also passed to the linker. -All modules should be compiled with the same @option{-G @var{num}} value. - -@item -mregnames -@itemx -mno-regnames -@opindex mregnames -@opindex mno-regnames -On System V.4 and embedded PowerPC systems do (do not) emit register -names in the assembly language output using symbolic forms. - -@item -mlongcall -@itemx -mno-longcall -@opindex mlongcall -@opindex mno-longcall -By default assume that all calls are far away so that a longer and more -expensive calling sequence is required. This is required for calls -farther than 32 megabytes (33,554,432 bytes) from the current location. -A short call is generated if the compiler knows -the call cannot be that far away. This setting can be overridden by -the @code{shortcall} function attribute, or by @code{#pragma -longcall(0)}. - -Some linkers are capable of detecting out-of-range calls and generating -glue code on the fly. On these systems, long calls are unnecessary and -generate slower code. As of this writing, the AIX linker can do this, -as can the GNU linker for PowerPC/64. It is planned to add this feature -to the GNU linker for 32-bit PowerPC systems as well. - -On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr -callee, L42}, plus a @dfn{branch island} (glue code). The two target -addresses represent the callee and the branch island. The -Darwin/PPC linker prefers the first address and generates a @code{bl -callee} if the PPC @code{bl} instruction reaches the callee directly; -otherwise, the linker generates @code{bl L42} to call the branch -island. The branch island is appended to the body of the -calling function; it computes the full 32-bit address of the callee -and jumps to it. - -On Mach-O (Darwin) systems, this option directs the compiler emit to -the glue for every direct call, and the Darwin linker decides whether -to use or discard it. - -In the future, GCC may ignore all longcall specifications -when the linker is known to generate glue. - -@item -mtls-markers -@itemx -mno-tls-markers -@opindex mtls-markers -@opindex mno-tls-markers -Mark (do not mark) calls to @code{__tls_get_addr} with a relocation -specifying the function argument. The relocation allows the linker to -reliably associate function call with argument setup instructions for -TLS optimization, which in turn allows GCC to better schedule the -sequence. - -@item -pthread -@opindex pthread -Adds support for multithreading with the @dfn{pthreads} library. -This option sets flags for both the preprocessor and linker. - -@item -mrecip -@itemx -mno-recip -@opindex mrecip -This option enables use of the reciprocal estimate and -reciprocal square root estimate instructions with additional -Newton-Raphson steps to increase precision instead of doing a divide or -square root and divide for floating-point arguments. You should use -the @option{-ffast-math} option when using @option{-mrecip} (or at -least @option{-funsafe-math-optimizations}, -@option{-finite-math-only}, @option{-freciprocal-math} and -@option{-fno-trapping-math}). Note that while the throughput of the -sequence is generally higher than the throughput of the non-reciprocal -instruction, the precision of the sequence can be decreased by up to 2 -ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square -roots. - -@item -mrecip=@var{opt} -@opindex mrecip=opt -This option controls which reciprocal estimate instructions -may be used. @var{opt} is a comma-separated list of options, which may -be preceded by a @code{!} to invert the option: - -@table @samp - -@item all -Enable all estimate instructions. - -@item default -Enable the default instructions, equivalent to @option{-mrecip}. - -@item none -Disable all estimate instructions, equivalent to @option{-mno-recip}. - -@item div -Enable the reciprocal approximation instructions for both -single and double precision. - -@item divf -Enable the single-precision reciprocal approximation instructions. - -@item divd -Enable the double-precision reciprocal approximation instructions. - -@item rsqrt -Enable the reciprocal square root approximation instructions for both -single and double precision. - -@item rsqrtf -Enable the single-precision reciprocal square root approximation instructions. - -@item rsqrtd -Enable the double-precision reciprocal square root approximation instructions. - -@end table - -So, for example, @option{-mrecip=all,!rsqrtd} enables -all of the reciprocal estimate instructions, except for the -@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions -which handle the double-precision reciprocal square root calculations. - -@item -mrecip-precision -@itemx -mno-recip-precision -@opindex mrecip-precision -Assume (do not assume) that the reciprocal estimate instructions -provide higher-precision estimates than is mandated by the PowerPC -ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or -@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. -The double-precision square root estimate instructions are not generated by -default on low-precision machines, since they do not provide an -estimate that converges after three steps. - -@item -mveclibabi=@var{type} -@opindex mveclibabi -Specifies the ABI type to use for vectorizing intrinsics using an -external library. The only type supported at present is @samp{mass}, -which specifies to use IBM's Mathematical Acceleration Subsystem -(MASS) libraries for vectorizing intrinsics using external libraries. -GCC currently emits calls to @code{acosd2}, @code{acosf4}, -@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, -@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, -@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, -@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, -@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, -@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, -@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, -@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, -@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, -@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, -@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, -@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, -@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code -for power7. Both @option{-ftree-vectorize} and -@option{-funsafe-math-optimizations} must also be enabled. The MASS -libraries must be specified at link time. - -@item -mfriz -@itemx -mno-friz -@opindex mfriz -Generate (do not generate) the @code{friz} instruction when the -@option{-funsafe-math-optimizations} option is used to optimize -rounding of floating-point values to 64-bit integer and back to floating -point. The @code{friz} instruction does not return the same value if -the floating-point number is too large to fit in an integer. - -@item -mpointers-to-nested-functions -@itemx -mno-pointers-to-nested-functions -@opindex mpointers-to-nested-functions -Generate (do not generate) code to load up the static chain register -(@code{r11}) when calling through a pointer on AIX and 64-bit Linux -systems where a function pointer points to a 3-word descriptor giving -the function address, TOC value to be loaded in register @code{r2}, and -static chain value to be loaded in register @code{r11}. The -@option{-mpointers-to-nested-functions} is on by default. You cannot -call through pointers to nested functions or pointers -to functions compiled in other languages that use the static chain if -you use @option{-mno-pointers-to-nested-functions}. - -@item -msave-toc-indirect -@itemx -mno-save-toc-indirect -@opindex msave-toc-indirect -Generate (do not generate) code to save the TOC value in the reserved -stack location in the function prologue if the function calls through -a pointer on AIX and 64-bit Linux systems. If the TOC value is not -saved in the prologue, it is saved just before the call through the -pointer. The @option{-mno-save-toc-indirect} option is the default. - -@item -mcompat-align-parm -@itemx -mno-compat-align-parm -@opindex mcompat-align-parm -Generate (do not generate) code to pass structure parameters with a -maximum alignment of 64 bits, for compatibility with older versions -of GCC. - -Older versions of GCC (prior to 4.9.0) incorrectly did not align a -structure parameter on a 128-bit boundary when that structure contained -a member requiring 128-bit alignment. This is corrected in more -recent versions of GCC. This option may be used to generate code -that is compatible with functions compiled with older versions of -GCC. - -The @option{-mno-compat-align-parm} option is the default. -@end table - -@node RX Options -@subsection RX Options -@cindex RX Options - -These command-line options are defined for RX targets: - -@table @gcctabopt -@item -m64bit-doubles -@itemx -m32bit-doubles -@opindex m64bit-doubles -@opindex m32bit-doubles -Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) -or 32 bits (@option{-m32bit-doubles}) in size. The default is -@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only -works on 32-bit values, which is why the default is -@option{-m32bit-doubles}. - -@item -fpu -@itemx -nofpu -@opindex fpu -@opindex nofpu -Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX -floating-point hardware. The default is enabled for the RX600 -series and disabled for the RX200 series. - -Floating-point instructions are only generated for 32-bit floating-point -values, however, so the FPU hardware is not used for doubles if the -@option{-m64bit-doubles} option is used. - -@emph{Note} If the @option{-fpu} option is enabled then -@option{-funsafe-math-optimizations} is also enabled automatically. -This is because the RX FPU instructions are themselves unsafe. - -@item -mcpu=@var{name} -@opindex mcpu -Selects the type of RX CPU to be targeted. Currently three types are -supported, the generic @samp{RX600} and @samp{RX200} series hardware and -the specific @samp{RX610} CPU. The default is @samp{RX600}. - -The only difference between @samp{RX600} and @samp{RX610} is that the -@samp{RX610} does not support the @code{MVTIPL} instruction. - -The @samp{RX200} series does not have a hardware floating-point unit -and so @option{-nofpu} is enabled by default when this type is -selected. - -@item -mbig-endian-data -@itemx -mlittle-endian-data -@opindex mbig-endian-data -@opindex mlittle-endian-data -Store data (but not code) in the big-endian format. The default is -@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian -format. - -@item -msmall-data-limit=@var{N} -@opindex msmall-data-limit -Specifies the maximum size in bytes of global and static variables -which can be placed into the small data area. Using the small data -area can lead to smaller and faster code, but the size of area is -limited and it is up to the programmer to ensure that the area does -not overflow. Also when the small data area is used one of the RX's -registers (usually @code{r13}) is reserved for use pointing to this -area, so it is no longer available for use by the compiler. This -could result in slower and/or larger code if variables are pushed onto -the stack instead of being held in this register. - -Note, common variables (variables that have not been initialized) and -constants are not placed into the small data area as they are assigned -to other sections in the output executable. - -The default value is zero, which disables this feature. Note, this -feature is not enabled by default with higher optimization levels -(@option{-O2} etc) because of the potentially detrimental effects of -reserving a register. It is up to the programmer to experiment and -discover whether this feature is of benefit to their program. See the -description of the @option{-mpid} option for a description of how the -actual register to hold the small data area pointer is chosen. - -@item -msim -@itemx -mno-sim -@opindex msim -@opindex mno-sim -Use the simulator runtime. The default is to use the libgloss -board-specific runtime. - -@item -mas100-syntax -@itemx -mno-as100-syntax -@opindex mas100-syntax -@opindex mno-as100-syntax -When generating assembler output use a syntax that is compatible with -Renesas's AS100 assembler. This syntax can also be handled by the GAS -assembler, but it has some restrictions so it is not generated by default. - -@item -mmax-constant-size=@var{N} -@opindex mmax-constant-size -Specifies the maximum size, in bytes, of a constant that can be used as -an operand in a RX instruction. Although the RX instruction set does -allow constants of up to 4 bytes in length to be used in instructions, -a longer value equates to a longer instruction. Thus in some -circumstances it can be beneficial to restrict the size of constants -that are used in instructions. Constants that are too big are instead -placed into a constant pool and referenced via register indirection. - -The value @var{N} can be between 0 and 4. A value of 0 (the default) -or 4 means that constants of any size are allowed. - -@item -mrelax -@opindex mrelax -Enable linker relaxation. Linker relaxation is a process whereby the -linker attempts to reduce the size of a program by finding shorter -versions of various instructions. Disabled by default. - -@item -mint-register=@var{N} -@opindex mint-register -Specify the number of registers to reserve for fast interrupt handler -functions. The value @var{N} can be between 0 and 4. A value of 1 -means that register @code{r13} is reserved for the exclusive use -of fast interrupt handlers. A value of 2 reserves @code{r13} and -@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and -@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. -A value of 0, the default, does not reserve any registers. - -@item -msave-acc-in-interrupts -@opindex msave-acc-in-interrupts -Specifies that interrupt handler functions should preserve the -accumulator register. This is only necessary if normal code might use -the accumulator register, for example because it performs 64-bit -multiplications. The default is to ignore the accumulator as this -makes the interrupt handlers faster. - -@item -mpid -@itemx -mno-pid -@opindex mpid -@opindex mno-pid -Enables the generation of position independent data. When enabled any -access to constant data is done via an offset from a base address -held in a register. This allows the location of constant data to be -determined at run time without requiring the executable to be -relocated, which is a benefit to embedded applications with tight -memory constraints. Data that can be modified is not affected by this -option. - -Note, using this feature reserves a register, usually @code{r13}, for -the constant data base address. This can result in slower and/or -larger code, especially in complicated functions. - -The actual register chosen to hold the constant data base address -depends upon whether the @option{-msmall-data-limit} and/or the -@option{-mint-register} command-line options are enabled. Starting -with register @code{r13} and proceeding downwards, registers are -allocated first to satisfy the requirements of @option{-mint-register}, -then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it -is possible for the small data area register to be @code{r8} if both -@option{-mint-register=4} and @option{-mpid} are specified on the -command line. - -By default this feature is not enabled. The default can be restored -via the @option{-mno-pid} command-line option. - -@item -mno-warn-multiple-fast-interrupts -@itemx -mwarn-multiple-fast-interrupts -@opindex mno-warn-multiple-fast-interrupts -@opindex mwarn-multiple-fast-interrupts -Prevents GCC from issuing a warning message if it finds more than one -fast interrupt handler when it is compiling a file. The default is to -issue a warning for each extra fast interrupt handler found, as the RX -only supports one such interrupt. - -@end table - -@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} -has special significance to the RX port when used with the -@code{interrupt} function attribute. This attribute indicates a -function intended to process fast interrupts. GCC ensures -that it only uses the registers @code{r10}, @code{r11}, @code{r12} -and/or @code{r13} and only provided that the normal use of the -corresponding registers have been restricted via the -@option{-ffixed-@var{reg}} or @option{-mint-register} command-line -options. - -@node S/390 and zSeries Options -@subsection S/390 and zSeries Options -@cindex S/390 and zSeries Options - -These are the @samp{-m} options defined for the S/390 and zSeries architecture. - -@table @gcctabopt -@item -mhard-float -@itemx -msoft-float -@opindex mhard-float -@opindex msoft-float -Use (do not use) the hardware floating-point instructions and registers -for floating-point operations. When @option{-msoft-float} is specified, -functions in @file{libgcc.a} are used to perform floating-point -operations. When @option{-mhard-float} is specified, the compiler -generates IEEE floating-point instructions. This is the default. - -@item -mhard-dfp -@itemx -mno-hard-dfp -@opindex mhard-dfp -@opindex mno-hard-dfp -Use (do not use) the hardware decimal-floating-point instructions for -decimal-floating-point operations. When @option{-mno-hard-dfp} is -specified, functions in @file{libgcc.a} are used to perform -decimal-floating-point operations. When @option{-mhard-dfp} is -specified, the compiler generates decimal-floating-point hardware -instructions. This is the default for @option{-march=z9-ec} or higher. - -@item -mlong-double-64 -@itemx -mlong-double-128 -@opindex mlong-double-64 -@opindex mlong-double-128 -These switches control the size of @code{long double} type. A size -of 64 bits makes the @code{long double} type equivalent to the @code{double} -type. This is the default. - -@item -mbackchain -@itemx -mno-backchain -@opindex mbackchain -@opindex mno-backchain -Store (do not store) the address of the caller's frame as backchain pointer -into the callee's stack frame. -A backchain may be needed to allow debugging using tools that do not understand -DWARF 2 call frame information. -When @option{-mno-packed-stack} is in effect, the backchain pointer is stored -at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, -the backchain is placed into the topmost word of the 96/160 byte register -save area. - -In general, code compiled with @option{-mbackchain} is call-compatible with -code compiled with @option{-mmo-backchain}; however, use of the backchain -for debugging purposes usually requires that the whole binary is built with -@option{-mbackchain}. Note that the combination of @option{-mbackchain}, -@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order -to build a linux kernel use @option{-msoft-float}. - -The default is to not maintain the backchain. - -@item -mpacked-stack -@itemx -mno-packed-stack -@opindex mpacked-stack -@opindex mno-packed-stack -Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is -specified, the compiler uses the all fields of the 96/160 byte register save -area only for their default purpose; unused fields still take up stack space. -When @option{-mpacked-stack} is specified, register save slots are densely -packed at the top of the register save area; unused space is reused for other -purposes, allowing for more efficient use of the available stack space. -However, when @option{-mbackchain} is also in effect, the topmost word of -the save area is always used to store the backchain, and the return address -register is always saved two words below the backchain. - -As long as the stack frame backchain is not used, code generated with -@option{-mpacked-stack} is call-compatible with code generated with -@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for -S/390 or zSeries generated code that uses the stack frame backchain at run -time, not just for debugging purposes. Such code is not call-compatible -with code compiled with @option{-mpacked-stack}. Also, note that the -combination of @option{-mbackchain}, -@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order -to build a linux kernel use @option{-msoft-float}. - -The default is to not use the packed stack layout. - -@item -msmall-exec -@itemx -mno-small-exec -@opindex msmall-exec -@opindex mno-small-exec -Generate (or do not generate) code using the @code{bras} instruction -to do subroutine calls. -This only works reliably if the total executable size does not -exceed 64k. The default is to use the @code{basr} instruction instead, -which does not have this limitation. - -@item -m64 -@itemx -m31 -@opindex m64 -@opindex m31 -When @option{-m31} is specified, generate code compliant to the -GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate -code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in -particular to generate 64-bit instructions. For the @samp{s390} -targets, the default is @option{-m31}, while the @samp{s390x} -targets default to @option{-m64}. - -@item -mzarch -@itemx -mesa -@opindex mzarch -@opindex mesa -When @option{-mzarch} is specified, generate code using the -instructions available on z/Architecture. -When @option{-mesa} is specified, generate code using the -instructions available on ESA/390. Note that @option{-mesa} is -not possible with @option{-m64}. -When generating code compliant to the GNU/Linux for S/390 ABI, -the default is @option{-mesa}. When generating code compliant -to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. - -@item -mmvcle -@itemx -mno-mvcle -@opindex mmvcle -@opindex mno-mvcle -Generate (or do not generate) code using the @code{mvcle} instruction -to perform block moves. When @option{-mno-mvcle} is specified, -use a @code{mvc} loop instead. This is the default unless optimizing for -size. - -@item -mdebug -@itemx -mno-debug -@opindex mdebug -@opindex mno-debug -Print (or do not print) additional debug information when compiling. -The default is to not print debug information. - -@item -march=@var{cpu-type} -@opindex march -Generate code that runs on @var{cpu-type}, which is the name of a system -representing a certain processor type. Possible values for -@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990}, -@samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, and @samp{zEC12}. -When generating code using the instructions available on z/Architecture, -the default is @option{-march=z900}. Otherwise, the default is -@option{-march=g5}. - -@item -mtune=@var{cpu-type} -@opindex mtune -Tune to @var{cpu-type} everything applicable about the generated code, -except for the ABI and the set of available instructions. -The list of @var{cpu-type} values is the same as for @option{-march}. -The default is the value used for @option{-march}. - -@item -mtpf-trace -@itemx -mno-tpf-trace -@opindex mtpf-trace -@opindex mno-tpf-trace -Generate code that adds (does not add) in TPF OS specific branches to trace -routines in the operating system. This option is off by default, even -when compiling for the TPF OS@. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Generate code that uses (does not use) the floating-point multiply and -accumulate instructions. These instructions are generated by default if -hardware floating point is used. - -@item -mwarn-framesize=@var{framesize} -@opindex mwarn-framesize -Emit a warning if the current function exceeds the given frame size. Because -this is a compile-time check it doesn't need to be a real problem when the program -runs. It is intended to identify functions that most probably cause -a stack overflow. It is useful to be used in an environment with limited stack -size e.g.@: the linux kernel. - -@item -mwarn-dynamicstack -@opindex mwarn-dynamicstack -Emit a warning if the function calls @code{alloca} or uses dynamically-sized -arrays. This is generally a bad idea with a limited stack size. - -@item -mstack-guard=@var{stack-guard} -@itemx -mstack-size=@var{stack-size} -@opindex mstack-guard -@opindex mstack-size -If these options are provided the S/390 back end emits additional instructions in -the function prologue that trigger a trap if the stack size is @var{stack-guard} -bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). -If the @var{stack-guard} option is omitted the smallest power of 2 larger than -the frame size of the compiled function is chosen. -These options are intended to be used to help debugging stack overflow problems. -The additionally emitted code causes only little overhead and hence can also be -used in production-like systems without greater performance degradation. The given -values have to be exact powers of 2 and @var{stack-size} has to be greater than -@var{stack-guard} without exceeding 64k. -In order to be efficient the extra code makes the assumption that the stack starts -at an address aligned to the value given by @var{stack-size}. -The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. - -@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} -@opindex mhotpatch -If the hotpatch option is enabled, a ``hot-patching'' function -prologue is generated for all functions in the compilation unit. -The funtion label is prepended with the given number of two-byte -NOP instructions (@var{pre-halfwords}, maximum 1000000). After -the label, 2 * @var{post-halfwords} bytes are appended, using the -largest NOP like instructions the architecture allows (maximum -1000000). - -If both arguments are zero, hotpatching is disabled. - -This option can be overridden for individual functions with the -@code{hotpatch} attribute. -@end table - -@node Score Options -@subsection Score Options -@cindex Score Options - -These options are defined for Score implementations: - -@table @gcctabopt -@item -meb -@opindex meb -Compile code for big-endian mode. This is the default. - -@item -mel -@opindex mel -Compile code for little-endian mode. - -@item -mnhwloop -@opindex mnhwloop -Disable generation of @code{bcnz} instructions. - -@item -muls -@opindex muls -Enable generation of unaligned load and store instructions. - -@item -mmac -@opindex mmac -Enable the use of multiply-accumulate instructions. Disabled by default. - -@item -mscore5 -@opindex mscore5 -Specify the SCORE5 as the target architecture. - -@item -mscore5u -@opindex mscore5u -Specify the SCORE5U of the target architecture. - -@item -mscore7 -@opindex mscore7 -Specify the SCORE7 as the target architecture. This is the default. - -@item -mscore7d -@opindex mscore7d -Specify the SCORE7D as the target architecture. -@end table - -@node SH Options -@subsection SH Options - -These @samp{-m} options are defined for the SH implementations: - -@table @gcctabopt -@item -m1 -@opindex m1 -Generate code for the SH1. - -@item -m2 -@opindex m2 -Generate code for the SH2. - -@item -m2e -Generate code for the SH2e. - -@item -m2a-nofpu -@opindex m2a-nofpu -Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way -that the floating-point unit is not used. - -@item -m2a-single-only -@opindex m2a-single-only -Generate code for the SH2a-FPU, in such a way that no double-precision -floating-point operations are used. - -@item -m2a-single -@opindex m2a-single -Generate code for the SH2a-FPU assuming the floating-point unit is in -single-precision mode by default. - -@item -m2a -@opindex m2a -Generate code for the SH2a-FPU assuming the floating-point unit is in -double-precision mode by default. - -@item -m3 -@opindex m3 -Generate code for the SH3. - -@item -m3e -@opindex m3e -Generate code for the SH3e. - -@item -m4-nofpu -@opindex m4-nofpu -Generate code for the SH4 without a floating-point unit. - -@item -m4-single-only -@opindex m4-single-only -Generate code for the SH4 with a floating-point unit that only -supports single-precision arithmetic. - -@item -m4-single -@opindex m4-single -Generate code for the SH4 assuming the floating-point unit is in -single-precision mode by default. - -@item -m4 -@opindex m4 -Generate code for the SH4. - -@item -m4-100 -@opindex m4-100 -Generate code for SH4-100. - -@item -m4-100-nofpu -@opindex m4-100-nofpu -Generate code for SH4-100 in such a way that the -floating-point unit is not used. - -@item -m4-100-single -@opindex m4-100-single -Generate code for SH4-100 assuming the floating-point unit is in -single-precision mode by default. - -@item -m4-100-single-only -@opindex m4-100-single-only -Generate code for SH4-100 in such a way that no double-precision -floating-point operations are used. - -@item -m4-200 -@opindex m4-200 -Generate code for SH4-200. - -@item -m4-200-nofpu -@opindex m4-200-nofpu -Generate code for SH4-200 without in such a way that the -floating-point unit is not used. - -@item -m4-200-single -@opindex m4-200-single -Generate code for SH4-200 assuming the floating-point unit is in -single-precision mode by default. - -@item -m4-200-single-only -@opindex m4-200-single-only -Generate code for SH4-200 in such a way that no double-precision -floating-point operations are used. - -@item -m4-300 -@opindex m4-300 -Generate code for SH4-300. - -@item -m4-300-nofpu -@opindex m4-300-nofpu -Generate code for SH4-300 without in such a way that the -floating-point unit is not used. - -@item -m4-300-single -@opindex m4-300-single -Generate code for SH4-300 in such a way that no double-precision -floating-point operations are used. - -@item -m4-300-single-only -@opindex m4-300-single-only -Generate code for SH4-300 in such a way that no double-precision -floating-point operations are used. - -@item -m4-340 -@opindex m4-340 -Generate code for SH4-340 (no MMU, no FPU). - -@item -m4-500 -@opindex m4-500 -Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the -assembler. - -@item -m4a-nofpu -@opindex m4a-nofpu -Generate code for the SH4al-dsp, or for a SH4a in such a way that the -floating-point unit is not used. - -@item -m4a-single-only -@opindex m4a-single-only -Generate code for the SH4a, in such a way that no double-precision -floating-point operations are used. - -@item -m4a-single -@opindex m4a-single -Generate code for the SH4a assuming the floating-point unit is in -single-precision mode by default. - -@item -m4a -@opindex m4a -Generate code for the SH4a. - -@item -m4al -@opindex m4al -Same as @option{-m4a-nofpu}, except that it implicitly passes -@option{-dsp} to the assembler. GCC doesn't generate any DSP -instructions at the moment. - -@item -m5-32media -@opindex m5-32media -Generate 32-bit code for SHmedia. - -@item -m5-32media-nofpu -@opindex m5-32media-nofpu -Generate 32-bit code for SHmedia in such a way that the -floating-point unit is not used. - -@item -m5-64media -@opindex m5-64media -Generate 64-bit code for SHmedia. - -@item -m5-64media-nofpu -@opindex m5-64media-nofpu -Generate 64-bit code for SHmedia in such a way that the -floating-point unit is not used. - -@item -m5-compact -@opindex m5-compact -Generate code for SHcompact. - -@item -m5-compact-nofpu -@opindex m5-compact-nofpu -Generate code for SHcompact in such a way that the -floating-point unit is not used. - -@item -mb -@opindex mb -Compile code for the processor in big-endian mode. - -@item -ml -@opindex ml -Compile code for the processor in little-endian mode. - -@item -mdalign -@opindex mdalign -Align doubles at 64-bit boundaries. Note that this changes the calling -conventions, and thus some functions from the standard C library do -not work unless you recompile it first with @option{-mdalign}. - -@item -mrelax -@opindex mrelax -Shorten some address references at link time, when possible; uses the -linker option @option{-relax}. - -@item -mbigtable -@opindex mbigtable -Use 32-bit offsets in @code{switch} tables. The default is to use -16-bit offsets. - -@item -mbitops -@opindex mbitops -Enable the use of bit manipulation instructions on SH2A. - -@item -mfmovd -@opindex mfmovd -Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for -alignment constraints. - -@item -mrenesas -@opindex mrenesas -Comply with the calling conventions defined by Renesas. - -@item -mno-renesas -@opindex mno-renesas -Comply with the calling conventions defined for GCC before the Renesas -conventions were available. This option is the default for all -targets of the SH toolchain. - -@item -mnomacsave -@opindex mnomacsave -Mark the @code{MAC} register as call-clobbered, even if -@option{-mrenesas} is given. - -@item -mieee -@itemx -mno-ieee -@opindex mieee -@opindex mno-ieee -Control the IEEE compliance of floating-point comparisons, which affects the -handling of cases where the result of a comparison is unordered. By default -@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is -enabled @option{-mno-ieee} is implicitly set, which results in faster -floating-point greater-equal and less-equal comparisons. The implcit settings -can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. - -@item -minline-ic_invalidate -@opindex minline-ic_invalidate -Inline code to invalidate instruction cache entries after setting up -nested function trampolines. -This option has no effect if @option{-musermode} is in effect and the selected -code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi} -instruction. -If the selected code generation option does not allow the use of the @code{icbi} -instruction, and @option{-musermode} is not in effect, the inlined code -manipulates the instruction cache address array directly with an associative -write. This not only requires privileged mode at run time, but it also -fails if the cache line had been mapped via the TLB and has become unmapped. - -@item -misize -@opindex misize -Dump instruction size and location in the assembly code. - -@item -mpadstruct -@opindex mpadstruct -This option is deprecated. It pads structures to multiple of 4 bytes, -which is incompatible with the SH ABI@. - -@item -matomic-model=@var{model} -@opindex matomic-model=@var{model} -Sets the model of atomic operations and additional parameters as a comma -separated list. For details on the atomic built-in functions see -@ref{__atomic Builtins}. The following models and parameters are supported: - -@table @samp - -@item none -Disable compiler generated atomic sequences and emit library calls for atomic -operations. This is the default if the target is not @code{sh*-*-linux*}. - -@item soft-gusa -Generate GNU/Linux compatible gUSA software atomic sequences for the atomic -built-in functions. The generated atomic sequences require additional support -from the interrupt/exception handling code of the system and are only suitable -for SH3* and SH4* single-core systems. This option is enabled by default when -the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, -this option also partially utilizes the hardware atomic instructions -@code{movli.l} and @code{movco.l} to create more efficient code, unless -@samp{strict} is specified. - -@item soft-tcb -Generate software atomic sequences that use a variable in the thread control -block. This is a variation of the gUSA sequences which can also be used on -SH1* and SH2* targets. The generated atomic sequences require additional -support from the interrupt/exception handling code of the system and are only -suitable for single-core systems. When using this model, the @samp{gbr-offset=} -parameter has to be specified as well. - -@item soft-imask -Generate software atomic sequences that temporarily disable interrupts by -setting @code{SR.IMASK = 1111}. This model works only when the program runs -in privileged mode and is only suitable for single-core systems. Additional -support from the interrupt/exception handling code of the system is not -required. This model is enabled by default when the target is -@code{sh*-*-linux*} and SH1* or SH2*. - -@item hard-llcs -Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} -instructions only. This is only available on SH4A and is suitable for -multi-core systems. Since the hardware instructions support only 32 bit atomic -variables access to 8 or 16 bit variables is emulated with 32 bit accesses. -Code compiled with this option is also compatible with other software -atomic model interrupt/exception handling systems if executed on an SH4A -system. Additional support from the interrupt/exception handling code of the -system is not required for this model. - -@item gbr-offset= -This parameter specifies the offset in bytes of the variable in the thread -control block structure that should be used by the generated atomic sequences -when the @samp{soft-tcb} model has been selected. For other models this -parameter is ignored. The specified value must be an integer multiple of four -and in the range 0-1020. - -@item strict -This parameter prevents mixed usage of multiple atomic models, even if they -are compatible, and makes the compiler generate atomic sequences of the -specified model only. - -@end table - -@item -mtas -@opindex mtas -Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. -Notice that depending on the particular hardware and software configuration -this can degrade overall performance due to the operand cache line flushes -that are implied by the @code{tas.b} instruction. On multi-core SH4A -processors the @code{tas.b} instruction must be used with caution since it -can result in data corruption for certain cache configurations. - -@item -mprefergot -@opindex mprefergot -When generating position-independent code, emit function calls using -the Global Offset Table instead of the Procedure Linkage Table. - -@item -musermode -@itemx -mno-usermode -@opindex musermode -@opindex mno-usermode -Don't allow (allow) the compiler generating privileged mode code. Specifying -@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the -inlined code would not work in user mode. @option{-musermode} is the default -when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* -@option{-musermode} has no effect, since there is no user mode. - -@item -multcost=@var{number} -@opindex multcost=@var{number} -Set the cost to assume for a multiply insn. - -@item -mdiv=@var{strategy} -@opindex mdiv=@var{strategy} -Set the division strategy to be used for integer division operations. -For SHmedia @var{strategy} can be one of: - -@table @samp - -@item fp -Performs the operation in floating point. This has a very high latency, -but needs only a few instructions, so it might be a good choice if -your code has enough easily-exploitable ILP to allow the compiler to -schedule the floating-point instructions together with other instructions. -Division by zero causes a floating-point exception. - -@item inv -Uses integer operations to calculate the inverse of the divisor, -and then multiplies the dividend with the inverse. This strategy allows -CSE and hoisting of the inverse calculation. Division by zero calculates -an unspecified result, but does not trap. - -@item inv:minlat -A variant of @samp{inv} where, if no CSE or hoisting opportunities -have been found, or if the entire operation has been hoisted to the same -place, the last stages of the inverse calculation are intertwined with the -final multiply to reduce the overall latency, at the expense of using a few -more instructions, and thus offering fewer scheduling opportunities with -other code. - -@item call -Calls a library function that usually implements the @samp{inv:minlat} -strategy. -This gives high code density for @code{m5-*media-nofpu} compilations. - -@item call2 -Uses a different entry point of the same library function, where it -assumes that a pointer to a lookup table has already been set up, which -exposes the pointer load to CSE and code hoisting optimizations. - -@item inv:call -@itemx inv:call2 -@itemx inv:fp -Use the @samp{inv} algorithm for initial -code generation, but if the code stays unoptimized, revert to the @samp{call}, -@samp{call2}, or @samp{fp} strategies, respectively. Note that the -potentially-trapping side effect of division by zero is carried by a -separate instruction, so it is possible that all the integer instructions -are hoisted out, but the marker for the side effect stays where it is. -A recombination to floating-point operations or a call is not possible -in that case. - -@item inv20u -@itemx inv20l -Variants of the @samp{inv:minlat} strategy. In the case -that the inverse calculation is not separated from the multiply, they speed -up division where the dividend fits into 20 bits (plus sign where applicable) -by inserting a test to skip a number of operations in this case; this test -slows down the case of larger dividends. @samp{inv20u} assumes the case of a such -a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely. - -@end table - -For targets other than SHmedia @var{strategy} can be one of: - -@table @samp - -@item call-div1 -Calls a library function that uses the single-step division instruction -@code{div1} to perform the operation. Division by zero calculates an -unspecified result and does not trap. This is the default except for SH4, -SH2A and SHcompact. - -@item call-fp -Calls a library function that performs the operation in double precision -floating point. Division by zero causes a floating-point exception. This is -the default for SHcompact with FPU. Specifying this for targets that do not -have a double precision FPU defaults to @code{call-div1}. - -@item call-table -Calls a library function that uses a lookup table for small divisors and -the @code{div1} instruction with case distinction for larger divisors. Division -by zero calculates an unspecified result and does not trap. This is the default -for SH4. Specifying this for targets that do not have dynamic shift -instructions defaults to @code{call-div1}. - -@end table - -When a division strategy has not been specified the default strategy is -selected based on the current target. For SH2A the default strategy is to -use the @code{divs} and @code{divu} instructions instead of library function -calls. - -@item -maccumulate-outgoing-args -@opindex maccumulate-outgoing-args -Reserve space once for outgoing arguments in the function prologue rather -than around each call. Generally beneficial for performance and size. Also -needed for unwinding to avoid changing the stack frame around conditional code. - -@item -mdivsi3_libfunc=@var{name} -@opindex mdivsi3_libfunc=@var{name} -Set the name of the library function used for 32-bit signed division to -@var{name}. -This only affects the name used in the @samp{call} and @samp{inv:call} -division strategies, and the compiler still expects the same -sets of input/output/clobbered registers as if this option were not present. - -@item -mfixed-range=@var{register-range} -@opindex mfixed-range -Generate code treating the given register range as fixed registers. -A fixed register is one that the register allocator can not use. This is -useful when compiling kernel code. A register range is specified as -two registers separated by a dash. Multiple register ranges can be -specified separated by a comma. - -@item -mindexed-addressing -@opindex mindexed-addressing -Enable the use of the indexed addressing mode for SHmedia32/SHcompact. -This is only safe if the hardware and/or OS implement 32-bit wrap-around -semantics for the indexed addressing mode. The architecture allows the -implementation of processors with 64-bit MMU, which the OS could use to -get 32-bit addressing, but since no current hardware implementation supports -this or any other way to make the indexed addressing mode safe to use in -the 32-bit ABI, the default is @option{-mno-indexed-addressing}. - -@item -mgettrcost=@var{number} -@opindex mgettrcost=@var{number} -Set the cost assumed for the @code{gettr} instruction to @var{number}. -The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. - -@item -mpt-fixed -@opindex mpt-fixed -Assume @code{pt*} instructions won't trap. This generally generates -better-scheduled code, but is unsafe on current hardware. -The current architecture -definition says that @code{ptabs} and @code{ptrel} trap when the target -anded with 3 is 3. -This has the unintentional effect of making it unsafe to schedule these -instructions before a branch, or hoist them out of a loop. For example, -@code{__do_global_ctors}, a part of @file{libgcc} -that runs constructors at program -startup, calls functions in a list which is delimited by @minus{}1. With the -@option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1. -That means that all the constructors run a bit more quickly, but when -the loop comes to the end of the list, the program crashes because @code{ptabs} -loads @minus{}1 into a target register. - -Since this option is unsafe for any -hardware implementing the current architecture specification, the default -is @option{-mno-pt-fixed}. Unless specified explicitly with -@option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100}; -this deters register allocation from using target registers for storing -ordinary integers. - -@item -minvalid-symbols -@opindex minvalid-symbols -Assume symbols might be invalid. Ordinary function symbols generated by -the compiler are always valid to load with -@code{movi}/@code{shori}/@code{ptabs} or -@code{movi}/@code{shori}/@code{ptrel}, -but with assembler and/or linker tricks it is possible -to generate symbols that cause @code{ptabs} or @code{ptrel} to trap. -This option is only meaningful when @option{-mno-pt-fixed} is in effect. -It prevents cross-basic-block CSE, hoisting and most scheduling -of symbol loads. The default is @option{-mno-invalid-symbols}. - -@item -mbranch-cost=@var{num} -@opindex mbranch-cost=@var{num} -Assume @var{num} to be the cost for a branch instruction. Higher numbers -make the compiler try to generate more branch-free code if possible. -If not specified the value is selected depending on the processor type that -is being compiled for. - -@item -mzdcbranch -@itemx -mno-zdcbranch -@opindex mzdcbranch -@opindex mno-zdcbranch -Assume (do not assume) that zero displacement conditional branch instructions -@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the -compiler prefers zero displacement branch code sequences. This is -enabled by default when generating code for SH4 and SH4A. It can be explicitly -disabled by specifying @option{-mno-zdcbranch}. - -@item -mcbranch-force-delay-slot -@opindex mcbranch-force-delay-slot -Force the usage of delay slots for conditional branches, which stuffs the delay -slot with a @code{nop} if a suitable instruction can't be found. By default -this option is disabled. It can be enabled to work around hardware bugs as -found in the original SH7055. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Generate code that uses (does not use) the floating-point multiply and -accumulate instructions. These instructions are generated by default -if hardware floating point is used. The machine-dependent -@option{-mfused-madd} option is now mapped to the machine-independent -@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is -mapped to @option{-ffp-contract=off}. - -@item -mfsca -@itemx -mno-fsca -@opindex mfsca -@opindex mno-fsca -Allow or disallow the compiler to emit the @code{fsca} instruction for sine -and cosine approximations. The option @option{-mfsca} must be used in -combination with @option{-funsafe-math-optimizations}. It is enabled by default -when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine -approximations even if @option{-funsafe-math-optimizations} is in effect. - -@item -mfsrra -@itemx -mno-fsrra -@opindex mfsrra -@opindex mno-fsrra -Allow or disallow the compiler to emit the @code{fsrra} instruction for -reciprocal square root approximations. The option @option{-mfsrra} must be used -in combination with @option{-funsafe-math-optimizations} and -@option{-ffinite-math-only}. It is enabled by default when generating code for -SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations -even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are -in effect. - -@item -mpretend-cmove -@opindex mpretend-cmove -Prefer zero-displacement conditional branches for conditional move instruction -patterns. This can result in faster code on the SH4 processor. - -@end table - -@node Solaris 2 Options -@subsection Solaris 2 Options -@cindex Solaris 2 options - -These @samp{-m} options are supported on Solaris 2: - -@table @gcctabopt -@item -mclear-hwcap -@opindex mclear-hwcap -@option{-mclear-hwcap} tells the compiler to remove the hardware -capabilities generated by the Solaris assembler. This is only necessary -when object files use ISA extensions not supported by the current -machine, but check at runtime whether or not to use them. - -@item -mimpure-text -@opindex mimpure-text -@option{-mimpure-text}, used in addition to @option{-shared}, tells -the compiler to not pass @option{-z text} to the linker when linking a -shared object. Using this option, you can link position-dependent -code into a shared object. - -@option{-mimpure-text} suppresses the ``relocations remain against -allocatable but non-writable sections'' linker error message. -However, the necessary relocations trigger copy-on-write, and the -shared object is not actually shared across processes. Instead of -using @option{-mimpure-text}, you should compile all source code with -@option{-fpic} or @option{-fPIC}. - -@end table - -These switches are supported in addition to the above on Solaris 2: - -@table @gcctabopt -@item -pthreads -@opindex pthreads -Add support for multithreading using the POSIX threads library. This -option sets flags for both the preprocessor and linker. This option does -not affect the thread safety of object code produced by the compiler or -that of libraries supplied with it. - -@item -pthread -@opindex pthread -This is a synonym for @option{-pthreads}. -@end table - -@node SPARC Options -@subsection SPARC Options -@cindex SPARC options - -These @samp{-m} options are supported on the SPARC: - -@table @gcctabopt -@item -mno-app-regs -@itemx -mapp-regs -@opindex mno-app-regs -@opindex mapp-regs -Specify @option{-mapp-regs} to generate output using the global registers -2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the -global register 1, each global register 2 through 4 is then treated as an -allocable register that is clobbered by function calls. This is the default. - -To be fully SVR4 ABI-compliant at the cost of some performance loss, -specify @option{-mno-app-regs}. You should compile libraries and system -software with this option. - -@item -mflat -@itemx -mno-flat -@opindex mflat -@opindex mno-flat -With @option{-mflat}, the compiler does not generate save/restore instructions -and uses a ``flat'' or single register window model. This model is compatible -with the regular register window model. The local registers and the input -registers (0--5) are still treated as ``call-saved'' registers and are -saved on the stack as needed. - -With @option{-mno-flat} (the default), the compiler generates save/restore -instructions (except for leaf functions). This is the normal operating mode. - -@item -mfpu -@itemx -mhard-float -@opindex mfpu -@opindex mhard-float -Generate output containing floating-point instructions. This is the -default. - -@item -mno-fpu -@itemx -msoft-float -@opindex mno-fpu -@opindex msoft-float -Generate output containing library calls for floating point. -@strong{Warning:} the requisite libraries are not available for all SPARC -targets. Normally the facilities of the machine's usual C compiler are -used, but this cannot be done directly in cross-compilation. You must make -your own arrangements to provide suitable library functions for -cross-compilation. The embedded targets @samp{sparc-*-aout} and -@samp{sparclite-*-*} do provide software floating-point support. - -@option{-msoft-float} changes the calling convention in the output file; -therefore, it is only useful if you compile @emph{all} of a program with -this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GCC, with @option{-msoft-float} in order for -this to work. - -@item -mhard-quad-float -@opindex mhard-quad-float -Generate output containing quad-word (long double) floating-point -instructions. - -@item -msoft-quad-float -@opindex msoft-quad-float -Generate output containing library calls for quad-word (long double) -floating-point instructions. The functions called are those specified -in the SPARC ABI@. This is the default. - -As of this writing, there are no SPARC implementations that have hardware -support for the quad-word floating-point instructions. They all invoke -a trap handler for one of these instructions, and then the trap handler -emulates the effect of the instruction. Because of the trap handler overhead, -this is much slower than calling the ABI library routines. Thus the -@option{-msoft-quad-float} option is the default. - -@item -mno-unaligned-doubles -@itemx -munaligned-doubles -@opindex mno-unaligned-doubles -@opindex munaligned-doubles -Assume that doubles have 8-byte alignment. This is the default. - -With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte -alignment only if they are contained in another type, or if they have an -absolute address. Otherwise, it assumes they have 4-byte alignment. -Specifying this option avoids some rare compatibility problems with code -generated by other compilers. It is not the default because it results -in a performance loss, especially for floating-point code. - -@item -muser-mode -@itemx -mno-user-mode -@opindex muser-mode -@opindex mno-user-mode -Do not generate code that can only run in supervisor mode. This is relevant -only for the @code{casa} instruction emitted for the LEON3 processor. The -default is @option{-mno-user-mode}. - -@item -mno-faster-structs -@itemx -mfaster-structs -@opindex mno-faster-structs -@opindex mfaster-structs -With @option{-mfaster-structs}, the compiler assumes that structures -should have 8-byte alignment. This enables the use of pairs of -@code{ldd} and @code{std} instructions for copies in structure -assignment, in place of twice as many @code{ld} and @code{st} pairs. -However, the use of this changed alignment directly violates the SPARC -ABI@. Thus, it's intended only for use on targets where the developer -acknowledges that their resulting code is not directly in line with -the rules of the ABI@. - -@item -mcpu=@var{cpu_type} -@opindex mcpu -Set the instruction set, register set, and instruction scheduling parameters -for machine type @var{cpu_type}. Supported values for @var{cpu_type} are -@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, -@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, -@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, -@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, -@samp{niagara3} and @samp{niagara4}. - -Native Solaris and GNU/Linux toolchains also support the value @samp{native}, -which selects the best architecture option for the host processor. -@option{-mcpu=native} has no effect if GCC does not recognize -the processor. - -Default instruction scheduling parameters are used for values that select -an architecture and not an implementation. These are @samp{v7}, @samp{v8}, -@samp{sparclite}, @samp{sparclet}, @samp{v9}. - -Here is a list of each supported architecture and their supported -implementations. - -@table @asis -@item v7 -cypress, leon3v7 - -@item v8 -supersparc, hypersparc, leon, leon3 - -@item sparclite -f930, f934, sparclite86x - -@item sparclet -tsc701 - -@item v9 -ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4 -@end table - -By default (unless configured otherwise), GCC generates code for the V7 -variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler -additionally optimizes it for the Cypress CY7C602 chip, as used in the -SPARCStation/SPARCServer 3xx series. This is also appropriate for the older -SPARCStation 1, 2, IPX etc. - -With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC -architecture. The only difference from V7 code is that the compiler emits -the integer multiply and integer divide instructions which exist in SPARC-V8 -but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally -optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and -2000 series. - -With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of -the SPARC architecture. This adds the integer multiply, integer divide step -and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. -With @option{-mcpu=f930}, the compiler additionally optimizes it for the -Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With -@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu -MB86934 chip, which is the more recent SPARClite with FPU@. - -With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of -the SPARC architecture. This adds the integer multiply, multiply/accumulate, -integer divide step and scan (@code{ffs}) instructions which exist in SPARClet -but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally -optimizes it for the TEMIC SPARClet chip. - -With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC -architecture. This adds 64-bit integer and floating-point move instructions, -3 additional floating-point condition code registers and conditional move -instructions. With @option{-mcpu=ultrasparc}, the compiler additionally -optimizes it for the Sun UltraSPARC I/II/IIi chips. With -@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the -Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With -@option{-mcpu=niagara}, the compiler additionally optimizes it for -Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler -additionally optimizes it for Sun UltraSPARC T2 chips. With -@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun -UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler -additionally optimizes it for Sun UltraSPARC T4 chips. - -@item -mtune=@var{cpu_type} -@opindex mtune -Set the instruction scheduling parameters for machine type -@var{cpu_type}, but do not set the instruction set or register set that the -option @option{-mcpu=@var{cpu_type}} does. - -The same values for @option{-mcpu=@var{cpu_type}} can be used for -@option{-mtune=@var{cpu_type}}, but the only useful values are those -that select a particular CPU implementation. Those are @samp{cypress}, -@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, -@samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701}, -@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, -@samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux -toolchains, @samp{native} can also be used. - -@item -mv8plus -@itemx -mno-v8plus -@opindex mv8plus -@opindex mno-v8plus -With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The -difference from the V8 ABI is that the global and out registers are -considered 64 bits wide. This is enabled by default on Solaris in 32-bit -mode for all SPARC-V9 processors. - -@item -mvis -@itemx -mno-vis -@opindex mvis -@opindex mno-vis -With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC -Visual Instruction Set extensions. The default is @option{-mno-vis}. - -@item -mvis2 -@itemx -mno-vis2 -@opindex mvis2 -@opindex mno-vis2 -With @option{-mvis2}, GCC generates code that takes advantage of -version 2.0 of the UltraSPARC Visual Instruction Set extensions. The -default is @option{-mvis2} when targeting a cpu that supports such -instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} -also sets @option{-mvis}. - -@item -mvis3 -@itemx -mno-vis3 -@opindex mvis3 -@opindex mno-vis3 -With @option{-mvis3}, GCC generates code that takes advantage of -version 3.0 of the UltraSPARC Visual Instruction Set extensions. The -default is @option{-mvis3} when targeting a cpu that supports such -instructions, such as niagara-3 and later. Setting @option{-mvis3} -also sets @option{-mvis2} and @option{-mvis}. - -@item -mcbcond -@itemx -mno-cbcond -@opindex mcbcond -@opindex mno-cbcond -With @option{-mcbcond}, GCC generates code that takes advantage of -compare-and-branch instructions, as defined in the Sparc Architecture 2011. -The default is @option{-mcbcond} when targeting a cpu that supports such -instructions, such as niagara-4 and later. - -@item -mpopc -@itemx -mno-popc -@opindex mpopc -@opindex mno-popc -With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC -population count instruction. The default is @option{-mpopc} -when targeting a cpu that supports such instructions, such as Niagara-2 and -later. - -@item -mfmaf -@itemx -mno-fmaf -@opindex mfmaf -@opindex mno-fmaf -With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC -Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf} -when targeting a cpu that supports such instructions, such as Niagara-3 and -later. - -@item -mfix-at697f -@opindex mfix-at697f -Enable the documented workaround for the single erratum of the Atmel AT697F -processor (which corresponds to erratum #13 of the AT697E processor). - -@item -mfix-ut699 -@opindex mfix-ut699 -Enable the documented workarounds for the floating-point errata and the data -cache nullify errata of the UT699 processor. -@end table - -These @samp{-m} options are supported in addition to the above -on SPARC-V9 processors in 64-bit environments: - -@table @gcctabopt -@item -m32 -@itemx -m64 -@opindex m32 -@opindex m64 -Generate code for a 32-bit or 64-bit environment. -The 32-bit environment sets int, long and pointer to 32 bits. -The 64-bit environment sets int to 32 bits and long and pointer -to 64 bits. - -@item -mcmodel=@var{which} -@opindex mcmodel -Set the code model to one of - -@table @samp -@item medlow -The Medium/Low code model: 64-bit addresses, programs -must be linked in the low 32 bits of memory. Programs can be statically -or dynamically linked. - -@item medmid -The Medium/Middle code model: 64-bit addresses, programs -must be linked in the low 44 bits of memory, the text and data segments must -be less than 2GB in size and the data segment must be located within 2GB of -the text segment. - -@item medany -The Medium/Anywhere code model: 64-bit addresses, programs -may be linked anywhere in memory, the text and data segments must be less -than 2GB in size and the data segment must be located within 2GB of the -text segment. - -@item embmedany -The Medium/Anywhere code model for embedded systems: -64-bit addresses, the text and data segments must be less than 2GB in -size, both starting anywhere in memory (determined at link time). The -global register %g4 points to the base of the data segment. Programs -are statically linked and PIC is not supported. -@end table - -@item -mmemory-model=@var{mem-model} -@opindex mmemory-model -Set the memory model in force on the processor to one of - -@table @samp -@item default -The default memory model for the processor and operating system. - -@item rmo -Relaxed Memory Order - -@item pso -Partial Store Order - -@item tso -Total Store Order - -@item sc -Sequential Consistency -@end table - -These memory models are formally defined in Appendix D of the Sparc V9 -architecture manual, as set in the processor's @code{PSTATE.MM} field. - -@item -mstack-bias -@itemx -mno-stack-bias -@opindex mstack-bias -@opindex mno-stack-bias -With @option{-mstack-bias}, GCC assumes that the stack pointer, and -frame pointer if present, are offset by @minus{}2047 which must be added back -when making stack frame references. This is the default in 64-bit mode. -Otherwise, assume no such offset is present. -@end table - -@node SPU Options -@subsection SPU Options -@cindex SPU options - -These @samp{-m} options are supported on the SPU: - -@table @gcctabopt -@item -mwarn-reloc -@itemx -merror-reloc -@opindex mwarn-reloc -@opindex merror-reloc - -The loader for SPU does not handle dynamic relocations. By default, GCC -gives an error when it generates code that requires a dynamic -relocation. @option{-mno-error-reloc} disables the error, -@option{-mwarn-reloc} generates a warning instead. - -@item -msafe-dma -@itemx -munsafe-dma -@opindex msafe-dma -@opindex munsafe-dma - -Instructions that initiate or test completion of DMA must not be -reordered with respect to loads and stores of the memory that is being -accessed. -With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect -memory accesses, but that can lead to inefficient code in places where the -memory is known to not change. Rather than mark the memory as volatile, -you can use @option{-msafe-dma} to tell the compiler to treat -the DMA instructions as potentially affecting all memory. - -@item -mbranch-hints -@opindex mbranch-hints - -By default, GCC generates a branch hint instruction to avoid -pipeline stalls for always-taken or probably-taken branches. A hint -is not generated closer than 8 instructions away from its branch. -There is little reason to disable them, except for debugging purposes, -or to make an object a little bit smaller. - -@item -msmall-mem -@itemx -mlarge-mem -@opindex msmall-mem -@opindex mlarge-mem - -By default, GCC generates code assuming that addresses are never larger -than 18 bits. With @option{-mlarge-mem} code is generated that assumes -a full 32-bit address. - -@item -mstdmain -@opindex mstdmain - -By default, GCC links against startup code that assumes the SPU-style -main function interface (which has an unconventional parameter list). -With @option{-mstdmain}, GCC links your program against startup -code that assumes a C99-style interface to @code{main}, including a -local copy of @code{argv} strings. - -@item -mfixed-range=@var{register-range} -@opindex mfixed-range -Generate code treating the given register range as fixed registers. -A fixed register is one that the register allocator cannot use. This is -useful when compiling kernel code. A register range is specified as -two registers separated by a dash. Multiple register ranges can be -specified separated by a comma. - -@item -mea32 -@itemx -mea64 -@opindex mea32 -@opindex mea64 -Compile code assuming that pointers to the PPU address space accessed -via the @code{__ea} named address space qualifier are either 32 or 64 -bits wide. The default is 32 bits. As this is an ABI-changing option, -all object code in an executable must be compiled with the same setting. - -@item -maddress-space-conversion -@itemx -mno-address-space-conversion -@opindex maddress-space-conversion -@opindex mno-address-space-conversion -Allow/disallow treating the @code{__ea} address space as superset -of the generic address space. This enables explicit type casts -between @code{__ea} and generic pointer as well as implicit -conversions of generic pointers to @code{__ea} pointers. The -default is to allow address space pointer conversions. - -@item -mcache-size=@var{cache-size} -@opindex mcache-size -This option controls the version of libgcc that the compiler links to an -executable and selects a software-managed cache for accessing variables -in the @code{__ea} address space with a particular cache size. Possible -options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} -and @samp{128}. The default cache size is 64KB. - -@item -matomic-updates -@itemx -mno-atomic-updates -@opindex matomic-updates -@opindex mno-atomic-updates -This option controls the version of libgcc that the compiler links to an -executable and selects whether atomic updates to the software-managed -cache of PPU-side variables are used. If you use atomic updates, changes -to a PPU variable from SPU code using the @code{__ea} named address space -qualifier do not interfere with changes to other PPU variables residing -in the same cache line from PPU code. If you do not use atomic updates, -such interference may occur; however, writing back cache lines is -more efficient. The default behavior is to use atomic updates. - -@item -mdual-nops -@itemx -mdual-nops=@var{n} -@opindex mdual-nops -By default, GCC inserts nops to increase dual issue when it expects -it to increase performance. @var{n} can be a value from 0 to 10. A -smaller @var{n} inserts fewer nops. 10 is the default, 0 is the -same as @option{-mno-dual-nops}. Disabled with @option{-Os}. - -@item -mhint-max-nops=@var{n} -@opindex mhint-max-nops -Maximum number of nops to insert for a branch hint. A branch hint must -be at least 8 instructions away from the branch it is affecting. GCC -inserts up to @var{n} nops to enforce this, otherwise it does not -generate the branch hint. - -@item -mhint-max-distance=@var{n} -@opindex mhint-max-distance -The encoding of the branch hint instruction limits the hint to be within -256 instructions of the branch it is affecting. By default, GCC makes -sure it is within 125. - -@item -msafe-hints -@opindex msafe-hints -Work around a hardware bug that causes the SPU to stall indefinitely. -By default, GCC inserts the @code{hbrp} instruction to make sure -this stall won't happen. - -@end table - -@node System V Options -@subsection Options for System V - -These additional options are available on System V Release 4 for -compatibility with other compilers on those systems: - -@table @gcctabopt -@item -G -@opindex G -Create a shared object. -It is recommended that @option{-symbolic} or @option{-shared} be used instead. - -@item -Qy -@opindex Qy -Identify the versions of each tool used by the compiler, in a -@code{.ident} assembler directive in the output. - -@item -Qn -@opindex Qn -Refrain from adding @code{.ident} directives to the output file (this is -the default). - -@item -YP,@var{dirs} -@opindex YP -Search the directories @var{dirs}, and no others, for libraries -specified with @option{-l}. - -@item -Ym,@var{dir} -@opindex Ym -Look in the directory @var{dir} to find the M4 preprocessor. -The assembler uses this option. -@c This is supposed to go with a -Yd for predefined M4 macro files, but -@c the generic assembler that comes with Solaris takes just -Ym. -@end table - -@node TILE-Gx Options -@subsection TILE-Gx Options -@cindex TILE-Gx options - -These @samp{-m} options are supported on the TILE-Gx: - -@table @gcctabopt -@item -mcmodel=small -@opindex mcmodel=small -Generate code for the small model. The distance for direct calls is -limited to 500M in either direction. PC-relative addresses are 32 -bits. Absolute addresses support the full address range. - -@item -mcmodel=large -@opindex mcmodel=large -Generate code for the large model. There is no limitation on call -distance, pc-relative addresses, or absolute addresses. - -@item -mcpu=@var{name} -@opindex mcpu -Selects the type of CPU to be targeted. Currently the only supported -type is @samp{tilegx}. - -@item -m32 -@itemx -m64 -@opindex m32 -@opindex m64 -Generate code for a 32-bit or 64-bit environment. The 32-bit -environment sets int, long, and pointer to 32 bits. The 64-bit -environment sets int to 32 bits and long and pointer to 64 bits. - -@item -mbig-endian -@itemx -mlittle-endian -@opindex mbig-endian -@opindex mlittle-endian -Generate code in big/little endian mode, respectively. -@end table - -@node TILEPro Options -@subsection TILEPro Options -@cindex TILEPro options - -These @samp{-m} options are supported on the TILEPro: - -@table @gcctabopt -@item -mcpu=@var{name} -@opindex mcpu -Selects the type of CPU to be targeted. Currently the only supported -type is @samp{tilepro}. - -@item -m32 -@opindex m32 -Generate code for a 32-bit environment, which sets int, long, and -pointer to 32 bits. This is the only supported behavior so the flag -is essentially ignored. -@end table - -@node V850 Options -@subsection V850 Options -@cindex V850 Options - -These @samp{-m} options are defined for V850 implementations: - -@table @gcctabopt -@item -mlong-calls -@itemx -mno-long-calls -@opindex mlong-calls -@opindex mno-long-calls -Treat all calls as being far away (near). If calls are assumed to be -far away, the compiler always loads the function's address into a -register, and calls indirect through the pointer. - -@item -mno-ep -@itemx -mep -@opindex mno-ep -@opindex mep -Do not optimize (do optimize) basic blocks that use the same index -pointer 4 or more times to copy pointer into the @code{ep} register, and -use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} -option is on by default if you optimize. - -@item -mno-prolog-function -@itemx -mprolog-function -@opindex mno-prolog-function -@opindex mprolog-function -Do not use (do use) external functions to save and restore registers -at the prologue and epilogue of a function. The external functions -are slower, but use less code space if more than one function saves -the same number of registers. The @option{-mprolog-function} option -is on by default if you optimize. - -@item -mspace -@opindex mspace -Try to make the code as small as possible. At present, this just turns -on the @option{-mep} and @option{-mprolog-function} options. - -@item -mtda=@var{n} -@opindex mtda -Put static or global variables whose size is @var{n} bytes or less into -the tiny data area that register @code{ep} points to. The tiny data -area can hold up to 256 bytes in total (128 bytes for byte references). - -@item -msda=@var{n} -@opindex msda -Put static or global variables whose size is @var{n} bytes or less into -the small data area that register @code{gp} points to. The small data -area can hold up to 64 kilobytes. - -@item -mzda=@var{n} -@opindex mzda -Put static or global variables whose size is @var{n} bytes or less into -the first 32 kilobytes of memory. - -@item -mv850 -@opindex mv850 -Specify that the target processor is the V850. - -@item -mv850e3v5 -@opindex mv850e3v5 -Specify that the target processor is the V850E3V5. The preprocessor -constant @code{__v850e3v5__} is defined if this option is used. - -@item -mv850e2v4 -@opindex mv850e2v4 -Specify that the target processor is the V850E3V5. This is an alias for -the @option{-mv850e3v5} option. - -@item -mv850e2v3 -@opindex mv850e2v3 -Specify that the target processor is the V850E2V3. The preprocessor -constant @code{__v850e2v3__} is defined if this option is used. - -@item -mv850e2 -@opindex mv850e2 -Specify that the target processor is the V850E2. The preprocessor -constant @code{__v850e2__} is defined if this option is used. - -@item -mv850e1 -@opindex mv850e1 -Specify that the target processor is the V850E1. The preprocessor -constants @code{__v850e1__} and @code{__v850e__} are defined if -this option is used. - -@item -mv850es -@opindex mv850es -Specify that the target processor is the V850ES. This is an alias for -the @option{-mv850e1} option. - -@item -mv850e -@opindex mv850e -Specify that the target processor is the V850E@. The preprocessor -constant @code{__v850e__} is defined if this option is used. - -If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} -nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} -are defined then a default target processor is chosen and the -relevant @samp{__v850*__} preprocessor constant is defined. - -The preprocessor constants @code{__v850} and @code{__v851__} are always -defined, regardless of which processor variant is the target. - -@item -mdisable-callt -@itemx -mno-disable-callt -@opindex mdisable-callt -@opindex mno-disable-callt -This option suppresses generation of the @code{CALLT} instruction for the -v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 -architecture. - -This option is enabled by default when the RH850 ABI is -in use (see @option{-mrh850-abi}), and disabled by default when the -GCC ABI is in use. If @code{CALLT} instructions are being generated -then the C preprocessor symbol @code{__V850_CALLT__} is defined. - -@item -mrelax -@itemx -mno-relax -@opindex mrelax -@opindex mno-relax -Pass on (or do not pass on) the @option{-mrelax} command-line option -to the assembler. - -@item -mlong-jumps -@itemx -mno-long-jumps -@opindex mlong-jumps -@opindex mno-long-jumps -Disable (or re-enable) the generation of PC-relative jump instructions. - -@item -msoft-float -@itemx -mhard-float -@opindex msoft-float -@opindex mhard-float -Disable (or re-enable) the generation of hardware floating point -instructions. This option is only significant when the target -architecture is @samp{V850E2V3} or higher. If hardware floating point -instructions are being generated then the C preprocessor symbol -@code{__FPU_OK__} is defined, otherwise the symbol -@code{__NO_FPU__} is defined. - -@item -mloop -@opindex mloop -Enables the use of the e3v5 LOOP instruction. The use of this -instruction is not enabled by default when the e3v5 architecture is -selected because its use is still experimental. - -@item -mrh850-abi -@itemx -mghs -@opindex mrh850-abi -@opindex mghs -Enables support for the RH850 version of the V850 ABI. This is the -default. With this version of the ABI the following rules apply: - -@itemize -@item -Integer sized structures and unions are returned via a memory pointer -rather than a register. - -@item -Large structures and unions (more than 8 bytes in size) are passed by -value. - -@item -Functions are aligned to 16-bit boundaries. - -@item -The @option{-m8byte-align} command-line option is supported. - -@item -The @option{-mdisable-callt} command-line option is enabled by -default. The @option{-mno-disable-callt} command-line option is not -supported. -@end itemize - -When this version of the ABI is enabled the C preprocessor symbol -@code{__V850_RH850_ABI__} is defined. - -@item -mgcc-abi -@opindex mgcc-abi -Enables support for the old GCC version of the V850 ABI. With this -version of the ABI the following rules apply: - -@itemize -@item -Integer sized structures and unions are returned in register @code{r10}. - -@item -Large structures and unions (more than 8 bytes in size) are passed by -reference. - -@item -Functions are aligned to 32-bit boundaries, unless optimizing for -size. - -@item -The @option{-m8byte-align} command-line option is not supported. - -@item -The @option{-mdisable-callt} command-line option is supported but not -enabled by default. -@end itemize - -When this version of the ABI is enabled the C preprocessor symbol -@code{__V850_GCC_ABI__} is defined. - -@item -m8byte-align -@itemx -mno-8byte-align -@opindex m8byte-align -@opindex mno-8byte-align -Enables support for @code{double} and @code{long long} types to be -aligned on 8-byte boundaries. The default is to restrict the -alignment of all objects to at most 4-bytes. When -@option{-m8byte-align} is in effect the C preprocessor symbol -@code{__V850_8BYTE_ALIGN__} is defined. - -@item -mbig-switch -@opindex mbig-switch -Generate code suitable for big switch tables. Use this option only if -the assembler/linker complain about out of range branches within a switch -table. - -@item -mapp-regs -@opindex mapp-regs -This option causes r2 and r5 to be used in the code generated by -the compiler. This setting is the default. - -@item -mno-app-regs -@opindex mno-app-regs -This option causes r2 and r5 to be treated as fixed registers. - -@end table - -@node VAX Options -@subsection VAX Options -@cindex VAX options - -These @samp{-m} options are defined for the VAX: - -@table @gcctabopt -@item -munix -@opindex munix -Do not output certain jump instructions (@code{aobleq} and so on) -that the Unix assembler for the VAX cannot handle across long -ranges. - -@item -mgnu -@opindex mgnu -Do output those jump instructions, on the assumption that the -GNU assembler is being used. - -@item -mg -@opindex mg -Output code for G-format floating-point numbers instead of D-format. -@end table - -@node Visium Options -@subsection Visium Options -@cindex Visium options - -@table @gcctabopt - -@item -mdebug -@opindex mdebug -A program which performs file I/O and is destined to run on an MCM target -should be linked with this option. It causes the libraries libc.a and -libdebug.a to be linked. The program should be run on the target under -the control of the GDB remote debugging stub. - -@item -msim -@opindex msim -A program which performs file I/O and is destined to run on the simulator -should be linked with option. This causes libraries libc.a and libsim.a to -be linked. - -@item -mfpu -@itemx -mhard-float -@opindex mfpu -@opindex mhard-float -Generate code containing floating-point instructions. This is the -default. - -@item -mno-fpu -@itemx -msoft-float -@opindex mno-fpu -@opindex msoft-float -Generate code containing library calls for floating-point. - -@option{-msoft-float} changes the calling convention in the output file; -therefore, it is only useful if you compile @emph{all} of a program with -this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GCC, with @option{-msoft-float} in order for -this to work. - -@item -mcpu=@var{cpu_type} -@opindex mcpu -Set the instruction set, register set, and instruction scheduling parameters -for machine type @var{cpu_type}. Supported values for @var{cpu_type} are -@samp{mcm}, @samp{gr5} and @samp{gr6}. - -@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. - -By default (unless configured otherwise), GCC generates code for the GR5 -variant of the Visium architecture. - -With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium -architecture. The only difference from GR5 code is that the compiler will -generate block move instructions. - -@item -mtune=@var{cpu_type} -@opindex mtune -Set the instruction scheduling parameters for machine type @var{cpu_type}, -but do not set the instruction set or register set that the option -@option{-mcpu=@var{cpu_type}} would. - -@item -msv-mode -@opindex msv-mode -Generate code for the supervisor mode, where there are no restrictions on -the access to general registers. This is the default. - -@item -muser-mode -@opindex muser-mode -Generate code for the user mode, where the access to some general registers -is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this -mode; on the GR6, only registers r29 to r31 are affected. -@end table - -@node VMS Options -@subsection VMS Options - -These @samp{-m} options are defined for the VMS implementations: - -@table @gcctabopt -@item -mvms-return-codes -@opindex mvms-return-codes -Return VMS condition codes from @code{main}. The default is to return POSIX-style -condition (e.g.@ error) codes. - -@item -mdebug-main=@var{prefix} -@opindex mdebug-main=@var{prefix} -Flag the first routine whose name starts with @var{prefix} as the main -routine for the debugger. - -@item -mmalloc64 -@opindex mmalloc64 -Default to 64-bit memory allocation routines. - -@item -mpointer-size=@var{size} -@opindex mpointer-size=@var{size} -Set the default size of pointers. Possible options for @var{size} are -@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} -for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. -The later option disables @code{pragma pointer_size}. -@end table - -@node VxWorks Options -@subsection VxWorks Options -@cindex VxWorks Options - -The options in this section are defined for all VxWorks targets. -Options specific to the target hardware are listed with the other -options for that target. - -@table @gcctabopt -@item -mrtp -@opindex mrtp -GCC can generate code for both VxWorks kernels and real time processes -(RTPs). This option switches from the former to the latter. It also -defines the preprocessor macro @code{__RTP__}. - -@item -non-static -@opindex non-static -Link an RTP executable against shared libraries rather than static -libraries. The options @option{-static} and @option{-shared} can -also be used for RTPs (@pxref{Link Options}); @option{-static} -is the default. - -@item -Bstatic -@itemx -Bdynamic -@opindex Bstatic -@opindex Bdynamic -These options are passed down to the linker. They are defined for -compatibility with Diab. - -@item -Xbind-lazy -@opindex Xbind-lazy -Enable lazy binding of function calls. This option is equivalent to -@option{-Wl,-z,now} and is defined for compatibility with Diab. - -@item -Xbind-now -@opindex Xbind-now -Disable lazy binding of function calls. This option is the default and -is defined for compatibility with Diab. -@end table - -@node x86 Options -@subsection x86 Options -@cindex x86 Options - -These @samp{-m} options are defined for the x86 family of computers. - -@table @gcctabopt - -@item -march=@var{cpu-type} -@opindex march -Generate instructions for the machine type @var{cpu-type}. In contrast to -@option{-mtune=@var{cpu-type}}, which merely tunes the generated code -for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC -to generate code that may not run at all on processors other than the one -indicated. Specifying @option{-march=@var{cpu-type}} implies -@option{-mtune=@var{cpu-type}}. - -The choices for @var{cpu-type} are: - -@table @samp -@item native -This selects the CPU to generate code for at compilation time by determining -the processor type of the compiling machine. Using @option{-march=native} -enables all instruction subsets supported by the local machine (hence -the result might not run on different machines). Using @option{-mtune=native} -produces code optimized for the local machine under the constraints -of the selected instruction set. - -@item i386 -Original Intel i386 CPU@. - -@item i486 -Intel i486 CPU@. (No scheduling is implemented for this chip.) - -@item i586 -@itemx pentium -Intel Pentium CPU with no MMX support. - -@item pentium-mmx -Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. - -@item pentiumpro -Intel Pentium Pro CPU@. - -@item i686 -When used with @option{-march}, the Pentium Pro -instruction set is used, so the code runs on all i686 family chips. -When used with @option{-mtune}, it has the same meaning as @samp{generic}. - -@item pentium2 -Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set -support. - -@item pentium3 -@itemx pentium3m -Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction -set support. - -@item pentium-m -Intel Pentium M; low-power version of Intel Pentium III CPU -with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. - -@item pentium4 -@itemx pentium4m -Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. - -@item prescott -Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction -set support. - -@item nocona -Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, -SSE2 and SSE3 instruction set support. - -@item core2 -Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 -instruction set support. - -@item nehalem -Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2 and POPCNT instruction set support. - -@item westmere -Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. - -@item sandybridge -Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. - -@item ivybridge -Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C -instruction set support. - -@item haswell -Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, -BMI, BMI2 and F16C instruction set support. - -@item broadwell -Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, -BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support. - -@item bonnell -Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 -instruction set support. - -@item silvermont -Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, -SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support. - -@item knl -Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, -SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, -BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and -AVX512CD instruction set support. - -@item k6 -AMD K6 CPU with MMX instruction set support. - -@item k6-2 -@itemx k6-3 -Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. - -@item athlon -@itemx athlon-tbird -AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions -support. - -@item athlon-4 -@itemx athlon-xp -@itemx athlon-mp -Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE -instruction set support. - -@item k8 -@itemx opteron -@itemx athlon64 -@itemx athlon-fx -Processors based on the AMD K8 core with x86-64 instruction set support, -including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. -(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit -instruction set extensions.) - -@item k8-sse3 -@itemx opteron-sse3 -@itemx athlon64-sse3 -Improved versions of AMD K8 cores with SSE3 instruction set support. - -@item amdfam10 -@itemx barcelona -CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This -supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit -instruction set extensions.) - -@item bdver1 -CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This -supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, -SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) -@item bdver2 -AMD Family 15h core based CPUs with x86-64 instruction set support. (This -supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, -SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set -extensions.) -@item bdver3 -AMD Family 15h core based CPUs with x86-64 instruction set support. (This -supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, -PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and -64-bit instruction set extensions. -@item bdver4 -AMD Family 15h core based CPUs with x86-64 instruction set support. (This -supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, -AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, -SSE4.2, ABM and 64-bit instruction set extensions. - -@item btver1 -CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This -supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit -instruction set extensions.) - -@item btver2 -CPUs based on AMD Family 16h cores with x86-64 instruction set support. This -includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, -SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. - -@item winchip-c6 -IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction -set support. - -@item winchip2 -IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: -instruction set support. - -@item c3 -VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is -implemented for this chip.) - -@item c3-2 -VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. -(No scheduling is -implemented for this chip.) - -@item geode -AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. -@end table - -@item -mtune=@var{cpu-type} -@opindex mtune -Tune to @var{cpu-type} everything applicable about the generated code, except -for the ABI and the set of available instructions. -While picking a specific @var{cpu-type} schedules things appropriately -for that particular chip, the compiler does not generate any code that -cannot run on the default machine type unless you use a -@option{-march=@var{cpu-type}} option. -For example, if GCC is configured for i686-pc-linux-gnu -then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 -but still runs on i686 machines. - -The choices for @var{cpu-type} are the same as for @option{-march}. -In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: - -@table @samp -@item generic -Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. -If you know the CPU on which your code will run, then you should use -the corresponding @option{-mtune} or @option{-march} option instead of -@option{-mtune=generic}. But, if you do not know exactly what CPU users -of your application will have, then you should use this option. - -As new processors are deployed in the marketplace, the behavior of this -option will change. Therefore, if you upgrade to a newer version of -GCC, code generation controlled by this option will change to reflect -the processors -that are most common at the time that version of GCC is released. - -There is no @option{-march=generic} option because @option{-march} -indicates the instruction set the compiler can use, and there is no -generic instruction set applicable to all processors. In contrast, -@option{-mtune} indicates the processor (or, in this case, collection of -processors) for which the code is optimized. - -@item intel -Produce code optimized for the most current Intel processors, which are -Haswell and Silvermont for this version of GCC. If you know the CPU -on which your code will run, then you should use the corresponding -@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. -But, if you want your application performs better on both Haswell and -Silvermont, then you should use this option. - -As new Intel processors are deployed in the marketplace, the behavior of -this option will change. Therefore, if you upgrade to a newer version of -GCC, code generation controlled by this option will change to reflect -the most current Intel processors at the time that version of GCC is -released. - -There is no @option{-march=intel} option because @option{-march} indicates -the instruction set the compiler can use, and there is no common -instruction set applicable to all processors. In contrast, -@option{-mtune} indicates the processor (or, in this case, collection of -processors) for which the code is optimized. -@end table - -@item -mcpu=@var{cpu-type} -@opindex mcpu -A deprecated synonym for @option{-mtune}. - -@item -mfpmath=@var{unit} -@opindex mfpmath -Generate floating-point arithmetic for selected unit @var{unit}. The choices -for @var{unit} are: - -@table @samp -@item 387 -Use the standard 387 floating-point coprocessor present on the majority of chips and -emulated otherwise. Code compiled with this option runs almost everywhere. -The temporary results are computed in 80-bit precision instead of the precision -specified by the type, resulting in slightly different results compared to most -of other chips. See @option{-ffloat-store} for more detailed description. - -This is the default choice for x86-32 targets. - -@item sse -Use scalar floating-point instructions present in the SSE instruction set. -This instruction set is supported by Pentium III and newer chips, -and in the AMD line -by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE -instruction set supports only single-precision arithmetic, thus the double and -extended-precision arithmetic are still done using 387. A later version, present -only in Pentium 4 and AMD x86-64 chips, supports double-precision -arithmetic too. - -For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} -or @option{-msse2} switches to enable SSE extensions and make this option -effective. For the x86-64 compiler, these extensions are enabled by default. - -The resulting code should be considerably faster in the majority of cases and avoid -the numerical instability problems of 387 code, but may break some existing -code that expects temporaries to be 80 bits. - -This is the default choice for the x86-64 compiler. - -@item sse,387 -@itemx sse+387 -@itemx both -Attempt to utilize both instruction sets at once. This effectively doubles the -amount of available registers, and on chips with separate execution units for -387 and SSE the execution resources too. Use this option with care, as it is -still experimental, because the GCC register allocator does not model separate -functional units well, resulting in unstable performance. -@end table - -@item -masm=@var{dialect} -@opindex masm=@var{dialect} -Output assembly instructions using selected @var{dialect}. Also affects -which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and -extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect -order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does -not support @samp{intel}. - -@item -mieee-fp -@itemx -mno-ieee-fp -@opindex mieee-fp -@opindex mno-ieee-fp -Control whether or not the compiler uses IEEE floating-point -comparisons. These correctly handle the case where the result of a -comparison is unordered. - -@item -msoft-float -@opindex msoft-float -Generate output containing library calls for floating point. - -@strong{Warning:} the requisite libraries are not part of GCC@. -Normally the facilities of the machine's usual C compiler are used, but -this can't be done directly in cross-compilation. You must make your -own arrangements to provide suitable library functions for -cross-compilation. - -On machines where a function returns floating-point results in the 80387 -register stack, some floating-point opcodes may be emitted even if -@option{-msoft-float} is used. - -@item -mno-fp-ret-in-387 -@opindex mno-fp-ret-in-387 -Do not use the FPU registers for return values of functions. - -The usual calling convention has functions return values of types -@code{float} and @code{double} in an FPU register, even if there -is no FPU@. The idea is that the operating system should emulate -an FPU@. - -The option @option{-mno-fp-ret-in-387} causes such values to be returned -in ordinary CPU registers instead. - -@item -mno-fancy-math-387 -@opindex mno-fancy-math-387 -Some 387 emulators do not support the @code{sin}, @code{cos} and -@code{sqrt} instructions for the 387. Specify this option to avoid -generating those instructions. This option is the default on FreeBSD, -OpenBSD and NetBSD@. This option is overridden when @option{-march} -indicates that the target CPU always has an FPU and so the -instruction does not need emulation. These -instructions are not generated unless you also use the -@option{-funsafe-math-optimizations} switch. - -@item -malign-double -@itemx -mno-align-double -@opindex malign-double -@opindex mno-align-double -Control whether GCC aligns @code{double}, @code{long double}, and -@code{long long} variables on a two-word boundary or a one-word -boundary. Aligning @code{double} variables on a two-word boundary -produces code that runs somewhat faster on a Pentium at the -expense of more memory. - -On x86-64, @option{-malign-double} is enabled by default. - -@strong{Warning:} if you use the @option{-malign-double} switch, -structures containing the above types are aligned differently than -the published application binary interface specifications for the x86-32 -and are not binary compatible with structures in code compiled -without that switch. - -@item -m96bit-long-double -@itemx -m128bit-long-double -@opindex m96bit-long-double -@opindex m128bit-long-double -These switches control the size of @code{long double} type. The x86-32 -application binary interface specifies the size to be 96 bits, -so @option{-m96bit-long-double} is the default in 32-bit mode. - -Modern architectures (Pentium and newer) prefer @code{long double} -to be aligned to an 8- or 16-byte boundary. In arrays or structures -conforming to the ABI, this is not possible. So specifying -@option{-m128bit-long-double} aligns @code{long double} -to a 16-byte boundary by padding the @code{long double} with an additional -32-bit zero. - -In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as -its ABI specifies that @code{long double} is aligned on 16-byte boundary. - -Notice that neither of these options enable any extra precision over the x87 -standard of 80 bits for a @code{long double}. - -@strong{Warning:} if you override the default value for your target ABI, this -changes the size of -structures and arrays containing @code{long double} variables, -as well as modifying the function calling convention for functions taking -@code{long double}. Hence they are not binary-compatible -with code compiled without that switch. - -@item -mlong-double-64 -@itemx -mlong-double-80 -@itemx -mlong-double-128 -@opindex mlong-double-64 -@opindex mlong-double-80 -@opindex mlong-double-128 -These switches control the size of @code{long double} type. A size -of 64 bits makes the @code{long double} type equivalent to the @code{double} -type. This is the default for 32-bit Bionic C library. A size -of 128 bits makes the @code{long double} type equivalent to the -@code{__float128} type. This is the default for 64-bit Bionic C library. - -@strong{Warning:} if you override the default value for your target ABI, this -changes the size of -structures and arrays containing @code{long double} variables, -as well as modifying the function calling convention for functions taking -@code{long double}. Hence they are not binary-compatible -with code compiled without that switch. - -@item -malign-data=@var{type} -@opindex malign-data -Control how GCC aligns variables. Supported values for @var{type} are -@samp{compat} uses increased alignment value compatible uses GCC 4.8 -and earlier, @samp{abi} uses alignment value as specified by the -psABI, and @samp{cacheline} uses increased alignment value to match -the cache line size. @samp{compat} is the default. - -@item -mlarge-data-threshold=@var{threshold} -@opindex mlarge-data-threshold -When @option{-mcmodel=medium} is specified, data objects larger than -@var{threshold} are placed in the large data section. This value must be the -same across all objects linked into the binary, and defaults to 65535. - -@item -mrtd -@opindex mrtd -Use a different function-calling convention, in which functions that -take a fixed number of arguments return with the @code{ret @var{num}} -instruction, which pops their arguments while returning. This saves one -instruction in the caller since there is no need to pop the arguments -there. - -You can specify that an individual function is called with this calling -sequence with the function attribute @code{stdcall}. You can also -override the @option{-mrtd} option by using the function attribute -@code{cdecl}. @xref{Function Attributes}. - -@strong{Warning:} this calling convention is incompatible with the one -normally used on Unix, so you cannot use it if you need to call -libraries compiled with the Unix compiler. - -Also, you must provide function prototypes for all functions that -take variable numbers of arguments (including @code{printf}); -otherwise incorrect code is generated for calls to those -functions. - -In addition, seriously incorrect code results if you call a -function with too many arguments. (Normally, extra arguments are -harmlessly ignored.) - -@item -mregparm=@var{num} -@opindex mregparm -Control how many registers are used to pass integer arguments. By -default, no registers are used to pass arguments, and at most 3 -registers can be used. You can control this behavior for a specific -function by using the function attribute @code{regparm}. -@xref{Function Attributes}. - -@strong{Warning:} if you use this switch, and -@var{num} is nonzero, then you must build all modules with the same -value, including any libraries. This includes the system libraries and -startup modules. - -@item -msseregparm -@opindex msseregparm -Use SSE register passing conventions for float and double arguments -and return values. You can control this behavior for a specific -function by using the function attribute @code{sseregparm}. -@xref{Function Attributes}. - -@strong{Warning:} if you use this switch then you must build all -modules with the same value, including any libraries. This includes -the system libraries and startup modules. - -@item -mvect8-ret-in-mem -@opindex mvect8-ret-in-mem -Return 8-byte vectors in memory instead of MMX registers. This is the -default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun -Studio compilers until version 12. Later compiler versions (starting -with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which -is the default on Solaris@tie{}10 and later. @emph{Only} use this option if -you need to remain compatible with existing code produced by those -previous compiler versions or older versions of GCC@. - -@item -mpc32 -@itemx -mpc64 -@itemx -mpc80 -@opindex mpc32 -@opindex mpc64 -@opindex mpc80 - -Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} -is specified, the significands of results of floating-point operations are -rounded to 24 bits (single precision); @option{-mpc64} rounds the -significands of results of floating-point operations to 53 bits (double -precision) and @option{-mpc80} rounds the significands of results of -floating-point operations to 64 bits (extended double precision), which is -the default. When this option is used, floating-point operations in higher -precisions are not available to the programmer without setting the FPU -control word explicitly. - -Setting the rounding of floating-point operations to less than the default -80 bits can speed some programs by 2% or more. Note that some mathematical -libraries assume that extended-precision (80-bit) floating-point operations -are enabled by default; routines in such libraries could suffer significant -loss of accuracy, typically through so-called ``catastrophic cancellation'', -when this option is used to set the precision to less than extended precision. - -@item -mstackrealign -@opindex mstackrealign -Realign the stack at entry. On the x86, the @option{-mstackrealign} -option generates an alternate prologue and epilogue that realigns the -run-time stack if necessary. This supports mixing legacy codes that keep -4-byte stack alignment with modern codes that keep 16-byte stack alignment for -SSE compatibility. See also the attribute @code{force_align_arg_pointer}, -applicable to individual functions. - -@item -mpreferred-stack-boundary=@var{num} -@opindex mpreferred-stack-boundary -Attempt to keep the stack boundary aligned to a 2 raised to @var{num} -byte boundary. If @option{-mpreferred-stack-boundary} is not specified, -the default is 4 (16 bytes or 128 bits). - -@strong{Warning:} When generating code for the x86-64 architecture with -SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be -used to keep the stack boundary aligned to 8 byte boundary. Since -x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and -intended to be used in controlled environment where stack space is -important limitation. This option leads to wrong code when functions -compiled with 16 byte stack alignment (such as functions from a standard -library) are called with misaligned stack. In this case, SSE -instructions may lead to misaligned memory access traps. In addition, -variable arguments are handled incorrectly for 16 byte aligned -objects (including x87 long double and __int128), leading to wrong -results. You must build all modules with -@option{-mpreferred-stack-boundary=3}, including any libraries. This -includes the system libraries and startup modules. - -@item -mincoming-stack-boundary=@var{num} -@opindex mincoming-stack-boundary -Assume the incoming stack is aligned to a 2 raised to @var{num} byte -boundary. If @option{-mincoming-stack-boundary} is not specified, -the one specified by @option{-mpreferred-stack-boundary} is used. - -On Pentium and Pentium Pro, @code{double} and @code{long double} values -should be aligned to an 8-byte boundary (see @option{-malign-double}) or -suffer significant run time performance penalties. On Pentium III, the -Streaming SIMD Extension (SSE) data type @code{__m128} may not work -properly if it is not 16-byte aligned. - -To ensure proper alignment of this values on the stack, the stack boundary -must be as aligned as that required by any value stored on the stack. -Further, every function must be generated such that it keeps the stack -aligned. Thus calling a function compiled with a higher preferred -stack boundary from a function compiled with a lower preferred stack -boundary most likely misaligns the stack. It is recommended that -libraries that use callbacks always use the default setting. - -This extra alignment does consume extra stack space, and generally -increases code size. Code that is sensitive to stack space usage, such -as embedded systems and operating system kernels, may want to reduce the -preferred alignment to @option{-mpreferred-stack-boundary=2}. - -@need 200 -@item -mmmx -@opindex mmmx -@need 200 -@itemx -msse -@opindex msse -@need 200 -@itemx -msse2 -@need 200 -@itemx -msse3 -@need 200 -@itemx -mssse3 -@need 200 -@itemx -msse4 -@need 200 -@itemx -msse4a -@need 200 -@itemx -msse4.1 -@need 200 -@itemx -msse4.2 -@need 200 -@itemx -mavx -@opindex mavx -@need 200 -@itemx -mavx2 -@need 200 -@itemx -mavx512f -@need 200 -@itemx -mavx512pf -@need 200 -@itemx -mavx512er -@need 200 -@itemx -mavx512cd -@need 200 -@itemx -msha -@opindex msha -@need 200 -@itemx -maes -@opindex maes -@need 200 -@itemx -mpclmul -@opindex mpclmul -@need 200 -@itemx -mclfushopt -@opindex mclfushopt -@need 200 -@itemx -mfsgsbase -@opindex mfsgsbase -@need 200 -@itemx -mrdrnd -@opindex mrdrnd -@need 200 -@itemx -mf16c -@opindex mf16c -@need 200 -@itemx -mfma -@opindex mfma -@need 200 -@itemx -mfma4 -@need 200 -@itemx -mno-fma4 -@need 200 -@itemx -mprefetchwt1 -@opindex mprefetchwt1 -@need 200 -@itemx -mxop -@opindex mxop -@need 200 -@itemx -mlwp -@opindex mlwp -@need 200 -@itemx -m3dnow -@opindex m3dnow -@need 200 -@itemx -mpopcnt -@opindex mpopcnt -@need 200 -@itemx -mabm -@opindex mabm -@need 200 -@itemx -mbmi -@opindex mbmi -@need 200 -@itemx -mbmi2 -@need 200 -@itemx -mlzcnt -@opindex mlzcnt -@need 200 -@itemx -mfxsr -@opindex mfxsr -@need 200 -@itemx -mxsave -@opindex mxsave -@need 200 -@itemx -mxsaveopt -@opindex mxsaveopt -@need 200 -@itemx -mxsavec -@opindex mxsavec -@need 200 -@itemx -mxsaves -@opindex mxsaves -@need 200 -@itemx -mrtm -@opindex mrtm -@need 200 -@itemx -mtbm -@opindex mtbm -@need 200 -@itemx -mmpx -@opindex mmpx -These switches enable the use of instructions in the MMX, SSE, -SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, -SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, -BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX or 3DNow!@: -extended instruction sets. Each has a corresponding @option{-mno-} option -to disable use of these instructions. - -These extensions are also available as built-in functions: see -@ref{x86 Built-in Functions}, for details of the functions enabled and -disabled by these switches. - -To generate SSE/SSE2 instructions automatically from floating-point -code (as opposed to 387 instructions), see @option{-mfpmath=sse}. - -GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it -generates new AVX instructions or AVX equivalence for all SSEx instructions -when needed. - -These options enable GCC to use these extended instructions in -generated code, even without @option{-mfpmath=sse}. Applications that -perform run-time CPU detection must compile separate files for each -supported architecture, using the appropriate flags. In particular, -the file containing the CPU detection code should be compiled without -these options. - -@item -mdump-tune-features -@opindex mdump-tune-features -This option instructs GCC to dump the names of the x86 performance -tuning features and default settings. The names can be used in -@option{-mtune-ctrl=@var{feature-list}}. - -@item -mtune-ctrl=@var{feature-list} -@opindex mtune-ctrl=@var{feature-list} -This option is used to do fine grain control of x86 code generation features. -@var{feature-list} is a comma separated list of @var{feature} names. See also -@option{-mdump-tune-features}. When specified, the @var{feature} is turned -on if it is not preceded with @samp{^}, otherwise, it is turned off. -@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC -developers. Using it may lead to code paths not covered by testing and can -potentially result in compiler ICEs or runtime errors. - -@item -mno-default -@opindex mno-default -This option instructs GCC to turn off all tunable features. See also -@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. - -@item -mcld -@opindex mcld -This option instructs GCC to emit a @code{cld} instruction in the prologue -of functions that use string instructions. String instructions depend on -the DF flag to select between autoincrement or autodecrement mode. While the -ABI specifies the DF flag to be cleared on function entry, some operating -systems violate this specification by not clearing the DF flag in their -exception dispatchers. The exception handler can be invoked with the DF flag -set, which leads to wrong direction mode when string instructions are used. -This option can be enabled by default on 32-bit x86 targets by configuring -GCC with the @option{--enable-cld} configure option. Generation of @code{cld} -instructions can be suppressed with the @option{-mno-cld} compiler option -in this case. - -@item -mvzeroupper -@opindex mvzeroupper -This option instructs GCC to emit a @code{vzeroupper} instruction -before a transfer of control flow out of the function to minimize -the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} -intrinsics. - -@item -mprefer-avx128 -@opindex mprefer-avx128 -This option instructs GCC to use 128-bit AVX instructions instead of -256-bit AVX instructions in the auto-vectorizer. - -@item -mcx16 -@opindex mcx16 -This option enables GCC to generate @code{CMPXCHG16B} instructions. -@code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword -(or oword) data types. -This is useful for high-resolution counters that can be updated -by multiple processors (or cores). This instruction is generated as part of -atomic built-in functions: see @ref{__sync Builtins} or -@ref{__atomic Builtins} for details. - -@item -msahf -@opindex msahf -This option enables generation of @code{SAHF} instructions in 64-bit code. -Early Intel Pentium 4 CPUs with Intel 64 support, -prior to the introduction of Pentium 4 G1 step in December 2005, -lacked the @code{LAHF} and @code{SAHF} instructions -which are supported by AMD64. -These are load and store instructions, respectively, for certain status flags. -In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, -@code{drem}, and @code{remainder} built-in functions; -see @ref{Other Builtins} for details. - -@item -mmovbe -@opindex mmovbe -This option enables use of the @code{movbe} instruction to implement -@code{__builtin_bswap32} and @code{__builtin_bswap64}. - -@item -mcrc32 -@opindex mcrc32 -This option enables built-in functions @code{__builtin_ia32_crc32qi}, -@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and -@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. - -@item -mrecip -@opindex mrecip -This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions -(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) -with an additional Newton-Raphson step -to increase precision instead of @code{DIVSS} and @code{SQRTSS} -(and their vectorized -variants) for single-precision floating-point arguments. These instructions -are generated only when @option{-funsafe-math-optimizations} is enabled -together with @option{-finite-math-only} and @option{-fno-trapping-math}. -Note that while the throughput of the sequence is higher than the throughput -of the non-reciprocal instruction, the precision of the sequence can be -decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). - -Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} -(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option -combination), and doesn't need @option{-mrecip}. - -Also note that GCC emits the above sequence with additional Newton-Raphson step -for vectorized single-float division and vectorized @code{sqrtf(@var{x})} -already with @option{-ffast-math} (or the above option combination), and -doesn't need @option{-mrecip}. - -@item -mrecip=@var{opt} -@opindex mrecip=opt -This option controls which reciprocal estimate instructions -may be used. @var{opt} is a comma-separated list of options, which may -be preceded by a @samp{!} to invert the option: - -@table @samp -@item all -Enable all estimate instructions. - -@item default -Enable the default instructions, equivalent to @option{-mrecip}. - -@item none -Disable all estimate instructions, equivalent to @option{-mno-recip}. - -@item div -Enable the approximation for scalar division. - -@item vec-div -Enable the approximation for vectorized division. - -@item sqrt -Enable the approximation for scalar square root. - -@item vec-sqrt -Enable the approximation for vectorized square root. -@end table - -So, for example, @option{-mrecip=all,!sqrt} enables -all of the reciprocal approximations, except for square root. - -@item -mveclibabi=@var{type} -@opindex mveclibabi -Specifies the ABI type to use for vectorizing intrinsics using an -external library. Supported values for @var{type} are @samp{svml} -for the Intel short -vector math library and @samp{acml} for the AMD math core library. -To use this option, both @option{-ftree-vectorize} and -@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML -ABI-compatible library must be specified at link time. - -GCC currently emits calls to @code{vmldExp2}, -@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2}, -@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, -@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, -@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, -@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104}, -@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, -@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, -@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, -@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding -function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, -@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, -@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, -@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, -@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type -when @option{-mveclibabi=acml} is used. - -@item -mabi=@var{name} -@opindex mabi -Generate code for the specified calling convention. Permissible values -are @samp{sysv} for the ABI used on GNU/Linux and other systems, and -@samp{ms} for the Microsoft ABI. The default is to use the Microsoft -ABI when targeting Microsoft Windows and the SysV ABI on all other systems. -You can control this behavior for specific functions by -using the function attributes @code{ms_abi} and @code{sysv_abi}. -@xref{Function Attributes}. - -@item -mtls-dialect=@var{type} -@opindex mtls-dialect -Generate code to access thread-local storage using the @samp{gnu} or -@samp{gnu2} conventions. @samp{gnu} is the conservative default; -@samp{gnu2} is more efficient, but it may add compile- and run-time -requirements that cannot be satisfied on all systems. - -@item -mpush-args -@itemx -mno-push-args -@opindex mpush-args -@opindex mno-push-args -Use PUSH operations to store outgoing parameters. This method is shorter -and usually equally fast as method using SUB/MOV operations and is enabled -by default. In some cases disabling it may improve performance because of -improved scheduling and reduced dependencies. - -@item -maccumulate-outgoing-args -@opindex maccumulate-outgoing-args -If enabled, the maximum amount of space required for outgoing arguments is -computed in the function prologue. This is faster on most modern CPUs -because of reduced dependencies, improved scheduling and reduced stack usage -when the preferred stack boundary is not equal to 2. The drawback is a notable -increase in code size. This switch implies @option{-mno-push-args}. - -@item -mthreads -@opindex mthreads -Support thread-safe exception handling on MinGW. Programs that rely -on thread-safe exception handling must compile and link all code with the -@option{-mthreads} option. When compiling, @option{-mthreads} defines -@option{-D_MT}; when linking, it links in a special thread helper library -@option{-lmingwthrd} which cleans up per-thread exception-handling data. - -@item -mno-align-stringops -@opindex mno-align-stringops -Do not align the destination of inlined string operations. This switch reduces -code size and improves performance in case the destination is already aligned, -but GCC doesn't know about it. - -@item -minline-all-stringops -@opindex minline-all-stringops -By default GCC inlines string operations only when the destination is -known to be aligned to least a 4-byte boundary. -This enables more inlining and increases code -size, but may improve performance of code that depends on fast -@code{memcpy}, @code{strlen}, -and @code{memset} for short lengths. - -@item -minline-stringops-dynamically -@opindex minline-stringops-dynamically -For string operations of unknown size, use run-time checks with -inline code for small blocks and a library call for large blocks. - -@item -mstringop-strategy=@var{alg} -@opindex mstringop-strategy=@var{alg} -Override the internal decision heuristic for the particular algorithm to use -for inlining string operations. The allowed values for @var{alg} are: - -@table @samp -@item rep_byte -@itemx rep_4byte -@itemx rep_8byte -Expand using i386 @code{rep} prefix of the specified size. - -@item byte_loop -@itemx loop -@itemx unrolled_loop -Expand into an inline loop. - -@item libcall -Always use a library call. -@end table - -@item -mmemcpy-strategy=@var{strategy} -@opindex mmemcpy-strategy=@var{strategy} -Override the internal decision heuristic to decide if @code{__builtin_memcpy} -should be inlined and what inline algorithm to use when the expected size -of the copy operation is known. @var{strategy} -is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. -@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies -the max byte size with which inline algorithm @var{alg} is allowed. For the last -triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets -in the list must be specified in increasing order. The minimal byte size for -@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the -preceding range. - -@item -mmemset-strategy=@var{strategy} -@opindex mmemset-strategy=@var{strategy} -The option is similar to @option{-mmemcpy-strategy=} except that it is to control -@code{__builtin_memset} expansion. - -@item -momit-leaf-frame-pointer -@opindex momit-leaf-frame-pointer -Don't keep the frame pointer in a register for leaf functions. This -avoids the instructions to save, set up, and restore frame pointers and -makes an extra register available in leaf functions. The option -@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, -which might make debugging harder. - -@item -mtls-direct-seg-refs -@itemx -mno-tls-direct-seg-refs -@opindex mtls-direct-seg-refs -Controls whether TLS variables may be accessed with offsets from the -TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), -or whether the thread base pointer must be added. Whether or not this -is valid depends on the operating system, and whether it maps the -segment to cover the entire TLS area. - -For systems that use the GNU C Library, the default is on. - -@item -msse2avx -@itemx -mno-sse2avx -@opindex msse2avx -Specify that the assembler should encode SSE instructions with VEX -prefix. The option @option{-mavx} turns this on by default. - -@item -mfentry -@itemx -mno-fentry -@opindex mfentry -If profiling is active (@option{-pg}), put the profiling -counter call before the prologue. -Note: On x86 architectures the attribute @code{ms_hook_prologue} -isn't possible at the moment for @option{-mfentry} and @option{-pg}. - -@item -mrecord-mcount -@itemx -mno-record-mcount -@opindex mrecord-mcount -If profiling is active (@option{-pg}), generate a __mcount_loc section -that contains pointers to each profiling call. This is useful for -automatically patching and out calls. - -@item -mnop-mcount -@itemx -mno-nop-mcount -@opindex mnop-mcount -If profiling is active (@option{-pg}), generate the calls to -the profiling functions as nops. This is useful when they -should be patched in later dynamically. This is likely only -useful together with @option{-mrecord-mcount}. - -@item -mskip-rax-setup -@itemx -mno-skip-rax-setup -@opindex mskip-rax-setup -When generating code for the x86-64 architecture with SSE extensions -disabled, @option{-skip-rax-setup} can be used to skip setting up RAX -register when there are no variable arguments passed in vector registers. - -@strong{Warning:} Since RAX register is used to avoid unnecessarily -saving vector registers on stack when passing variable arguments, the -impacts of this option are callees may waste some stack space, -misbehave or jump to a random location. GCC 4.4 or newer don't have -those issues, regardless the RAX register value. - -@item -m8bit-idiv -@itemx -mno-8bit-idiv -@opindex m8bit-idiv -On some processors, like Intel Atom, 8-bit unsigned integer divide is -much faster than 32-bit/64-bit integer divide. This option generates a -run-time check. If both dividend and divisor are within range of 0 -to 255, 8-bit unsigned integer divide is used instead of -32-bit/64-bit integer divide. - -@item -mavx256-split-unaligned-load -@itemx -mavx256-split-unaligned-store -@opindex mavx256-split-unaligned-load -@opindex mavx256-split-unaligned-store -Split 32-byte AVX unaligned load and store. - -@item -mstack-protector-guard=@var{guard} -@opindex mstack-protector-guard=@var{guard} -Generate stack protection code using canary at @var{guard}. Supported -locations are @samp{global} for global canary or @samp{tls} for per-thread -canary in the TLS block (the default). This option has effect only when -@option{-fstack-protector} or @option{-fstack-protector-all} is specified. - -@end table - -These @samp{-m} switches are supported in addition to the above -on x86-64 processors in 64-bit environments. - -@table @gcctabopt -@item -m32 -@itemx -m64 -@itemx -mx32 -@itemx -m16 -@opindex m32 -@opindex m64 -@opindex mx32 -@opindex m16 -Generate code for a 16-bit, 32-bit or 64-bit environment. -The @option{-m32} option sets @code{int}, @code{long}, and pointer types -to 32 bits, and -generates code that runs on any i386 system. - -The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer -types to 64 bits, and generates code for the x86-64 architecture. -For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} -and @option{-mdynamic-no-pic} options. - -The @option{-mx32} option sets @code{int}, @code{long}, and pointer types -to 32 bits, and -generates code for the x86-64 architecture. - -The @option{-m16} option is the same as @option{-m32}, except for that -it outputs the @code{.code16gcc} assembly directive at the beginning of -the assembly output so that the binary can run in 16-bit mode. - -@item -mno-red-zone -@opindex mno-red-zone -Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated -by the x86-64 ABI; it is a 128-byte area beyond the location of the -stack pointer that is not modified by signal or interrupt handlers -and therefore can be used for temporary data without adjusting the stack -pointer. The flag @option{-mno-red-zone} disables this red zone. - -@item -mcmodel=small -@opindex mcmodel=small -Generate code for the small code model: the program and its symbols must -be linked in the lower 2 GB of the address space. Pointers are 64 bits. -Programs can be statically or dynamically linked. This is the default -code model. - -@item -mcmodel=kernel -@opindex mcmodel=kernel -Generate code for the kernel code model. The kernel runs in the -negative 2 GB of the address space. -This model has to be used for Linux kernel code. - -@item -mcmodel=medium -@opindex mcmodel=medium -Generate code for the medium model: the program is linked in the lower 2 -GB of the address space. Small symbols are also placed there. Symbols -with sizes larger than @option{-mlarge-data-threshold} are put into -large data or BSS sections and can be located above 2GB. Programs can -be statically or dynamically linked. - -@item -mcmodel=large -@opindex mcmodel=large -Generate code for the large model. This model makes no assumptions -about addresses and sizes of sections. - -@item -maddress-mode=long -@opindex maddress-mode=long -Generate code for long address mode. This is only supported for 64-bit -and x32 environments. It is the default address mode for 64-bit -environments. - -@item -maddress-mode=short -@opindex maddress-mode=short -Generate code for short address mode. This is only supported for 32-bit -and x32 environments. It is the default address mode for 32-bit and -x32 environments. -@end table - -@node x86 Windows Options -@subsection x86 Windows Options -@cindex x86 Windows Options -@cindex Windows Options for x86 - -These additional options are available for Microsoft Windows targets: - -@table @gcctabopt -@item -mconsole -@opindex mconsole -This option -specifies that a console application is to be generated, by -instructing the linker to set the PE header subsystem type -required for console applications. -This option is available for Cygwin and MinGW targets and is -enabled by default on those targets. - -@item -mdll -@opindex mdll -This option is available for Cygwin and MinGW targets. It -specifies that a DLL---a dynamic link library---is to be -generated, enabling the selection of the required runtime -startup object and entry point. - -@item -mnop-fun-dllimport -@opindex mnop-fun-dllimport -This option is available for Cygwin and MinGW targets. It -specifies that the @code{dllimport} attribute should be ignored. - -@item -mthread -@opindex mthread -This option is available for MinGW targets. It specifies -that MinGW-specific thread support is to be used. - -@item -municode -@opindex municode -This option is available for MinGW-w64 targets. It causes -the @code{UNICODE} preprocessor macro to be predefined, and -chooses Unicode-capable runtime startup code. - -@item -mwin32 -@opindex mwin32 -This option is available for Cygwin and MinGW targets. It -specifies that the typical Microsoft Windows predefined macros are to -be set in the pre-processor, but does not influence the choice -of runtime library/startup code. - -@item -mwindows -@opindex mwindows -This option is available for Cygwin and MinGW targets. It -specifies that a GUI application is to be generated by -instructing the linker to set the PE header subsystem type -appropriately. - -@item -fno-set-stack-executable -@opindex fno-set-stack-executable -This option is available for MinGW targets. It specifies that -the executable flag for the stack used by nested functions isn't -set. This is necessary for binaries running in kernel mode of -Microsoft Windows, as there the User32 API, which is used to set executable -privileges, isn't available. - -@item -fwritable-relocated-rdata -@opindex fno-writable-relocated-rdata -This option is available for MinGW and Cygwin targets. It specifies -that relocated-data in read-only section is put into .data -section. This is a necessary for older runtimes not supporting -modification of .rdata sections for pseudo-relocation. - -@item -mpe-aligned-commons -@opindex mpe-aligned-commons -This option is available for Cygwin and MinGW targets. It -specifies that the GNU extension to the PE file format that -permits the correct alignment of COMMON variables should be -used when generating code. It is enabled by default if -GCC detects that the target assembler found during configuration -supports the feature. -@end table - -See also under @ref{x86 Options} for standard options. - -@node Xstormy16 Options -@subsection Xstormy16 Options -@cindex Xstormy16 Options - -These options are defined for Xstormy16: - -@table @gcctabopt -@item -msim -@opindex msim -Choose startup files and linker script suitable for the simulator. -@end table - -@node Xtensa Options -@subsection Xtensa Options -@cindex Xtensa Options - -These options are supported for Xtensa targets: - -@table @gcctabopt -@item -mconst16 -@itemx -mno-const16 -@opindex mconst16 -@opindex mno-const16 -Enable or disable use of @code{CONST16} instructions for loading -constant values. The @code{CONST16} instruction is currently not a -standard option from Tensilica. When enabled, @code{CONST16} -instructions are always used in place of the standard @code{L32R} -instructions. The use of @code{CONST16} is enabled by default only if -the @code{L32R} instruction is not available. - -@item -mfused-madd -@itemx -mno-fused-madd -@opindex mfused-madd -@opindex mno-fused-madd -Enable or disable use of fused multiply/add and multiply/subtract -instructions in the floating-point option. This has no effect if the -floating-point option is not also enabled. Disabling fused multiply/add -and multiply/subtract instructions forces the compiler to use separate -instructions for the multiply and add/subtract operations. This may be -desirable in some cases where strict IEEE 754-compliant results are -required: the fused multiply add/subtract instructions do not round the -intermediate result, thereby producing results with @emph{more} bits of -precision than specified by the IEEE standard. Disabling fused multiply -add/subtract instructions also ensures that the program output is not -sensitive to the compiler's ability to combine multiply and add/subtract -operations. - -@item -mserialize-volatile -@itemx -mno-serialize-volatile -@opindex mserialize-volatile -@opindex mno-serialize-volatile -When this option is enabled, GCC inserts @code{MEMW} instructions before -@code{volatile} memory references to guarantee sequential consistency. -The default is @option{-mserialize-volatile}. Use -@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. - -@item -mforce-no-pic -@opindex mforce-no-pic -For targets, like GNU/Linux, where all user-mode Xtensa code must be -position-independent code (PIC), this option disables PIC for compiling -kernel code. - -@item -mtext-section-literals -@itemx -mno-text-section-literals -@opindex mtext-section-literals -@opindex mno-text-section-literals -These options control the treatment of literal pools. The default is -@option{-mno-text-section-literals}, which places literals in a separate -section in the output file. This allows the literal pool to be placed -in a data RAM/ROM, and it also allows the linker to combine literal -pools from separate object files to remove redundant literals and -improve code size. With @option{-mtext-section-literals}, the literals -are interspersed in the text section in order to keep them as close as -possible to their references. This may be necessary for large assembly -files. - -@item -mtarget-align -@itemx -mno-target-align -@opindex mtarget-align -@opindex mno-target-align -When this option is enabled, GCC instructs the assembler to -automatically align instructions to reduce branch penalties at the -expense of some code density. The assembler attempts to widen density -instructions to align branch targets and the instructions following call -instructions. If there are not enough preceding safe density -instructions to align a target, no widening is performed. The -default is @option{-mtarget-align}. These options do not affect the -treatment of auto-aligned instructions like @code{LOOP}, which the -assembler always aligns, either by widening density instructions or -by inserting NOP instructions. - -@item -mlongcalls -@itemx -mno-longcalls -@opindex mlongcalls -@opindex mno-longcalls -When this option is enabled, GCC instructs the assembler to translate -direct calls to indirect calls unless it can determine that the target -of a direct call is in the range allowed by the call instruction. This -translation typically occurs for calls to functions in other source -files. Specifically, the assembler translates a direct @code{CALL} -instruction into an @code{L32R} followed by a @code{CALLX} instruction. -The default is @option{-mno-longcalls}. This option should be used in -programs where the call target can potentially be out of range. This -option is implemented in the assembler, not the compiler, so the -assembly code generated by GCC still shows direct call -instructions---look at the disassembled object code to see the actual -instructions. Note that the assembler uses an indirect call for -every cross-file call, not just those that really are out of range. -@end table - -@node zSeries Options -@subsection zSeries Options -@cindex zSeries options - -These are listed under @xref{S/390 and zSeries Options}. - -@node Code Gen Options -@section Options for Code Generation Conventions -@cindex code generation conventions -@cindex options, code generation -@cindex run-time options - -These machine-independent options control the interface conventions -used in code generation. - -Most of them have both positive and negative forms; the negative form -of @option{-ffoo} is @option{-fno-foo}. In the table below, only -one of the forms is listed---the one that is not the default. You -can figure out the other form by either removing @samp{no-} or adding -it. - -@table @gcctabopt -@item -fbounds-check -@opindex fbounds-check -For front ends that support it, generate additional code to check that -indices used to access arrays are within the declared range. This is -currently only supported by the Java and Fortran front ends, where -this option defaults to true and false respectively. - -@item -fstack-reuse=@var{reuse-level} -@opindex fstack_reuse -This option controls stack space reuse for user declared local/auto variables -and compiler generated temporaries. @var{reuse_level} can be @samp{all}, -@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all -local variables and temporaries, @samp{named_vars} enables the reuse only for -user defined local variables with names, and @samp{none} disables stack reuse -completely. The default value is @samp{all}. The option is needed when the -program extends the lifetime of a scoped local variable or a compiler generated -temporary beyond the end point defined by the language. When a lifetime of -a variable ends, and if the variable lives in memory, the optimizing compiler -has the freedom to reuse its stack space with other temporaries or scoped -local variables whose live range does not overlap with it. Legacy code extending -local lifetime is likely to break with the stack reuse optimization. - -For example, - -@smallexample - int *p; - @{ - int local1; - - p = &local1; - local1 = 10; - .... - @} - @{ - int local2; - local2 = 20; - ... - @} - - if (*p == 10) // out of scope use of local1 - @{ - - @} -@end smallexample - -Another example: -@smallexample - - struct A - @{ - A(int k) : i(k), j(k) @{ @} - int i; - int j; - @}; - - A *ap; - - void foo(const A& ar) - @{ - ap = &ar; - @} - - void bar() - @{ - foo(A(10)); // temp object's lifetime ends when foo returns - - @{ - A a(20); - .... - @} - ap->i+= 10; // ap references out of scope temp whose space - // is reused with a. What is the value of ap->i? - @} - -@end smallexample - -The lifetime of a compiler generated temporary is well defined by the C++ -standard. When a lifetime of a temporary ends, and if the temporary lives -in memory, the optimizing compiler has the freedom to reuse its stack -space with other temporaries or scoped local variables whose live range -does not overlap with it. However some of the legacy code relies on -the behavior of older compilers in which temporaries' stack space is -not reused, the aggressive stack reuse can lead to runtime errors. This -option is used to control the temporary stack reuse optimization. - -@item -ftrapv -@opindex ftrapv -This option generates traps for signed overflow on addition, subtraction, -multiplication operations. - -@item -fwrapv -@opindex fwrapv -This option instructs the compiler to assume that signed arithmetic -overflow of addition, subtraction and multiplication wraps around -using twos-complement representation. This flag enables some optimizations -and disables others. This option is enabled by default for the Java -front end, as required by the Java language specification. - -@item -fexceptions -@opindex fexceptions -Enable exception handling. Generates extra code needed to propagate -exceptions. For some targets, this implies GCC generates frame -unwind information for all functions, which can produce significant data -size overhead, although it does not affect execution. If you do not -specify this option, GCC enables it by default for languages like -C++ that normally require exception handling, and disables it for -languages like C that do not normally require it. However, you may need -to enable this option when compiling C code that needs to interoperate -properly with exception handlers written in C++. You may also wish to -disable this option if you are compiling older C++ programs that don't -use exception handling. - -@item -fnon-call-exceptions -@opindex fnon-call-exceptions -Generate code that allows trapping instructions to throw exceptions. -Note that this requires platform-specific runtime support that does -not exist everywhere. Moreover, it only allows @emph{trapping} -instructions to throw exceptions, i.e.@: memory references or floating-point -instructions. It does not allow exceptions to be thrown from -arbitrary signal handlers such as @code{SIGALRM}. - -@item -fdelete-dead-exceptions -@opindex fdelete-dead-exceptions -Consider that instructions that may throw exceptions but don't otherwise -contribute to the execution of the program can be optimized away. -This option is enabled by default for the Ada front end, as permitted by -the Ada language specification. -Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. - -@item -funwind-tables -@opindex funwind-tables -Similar to @option{-fexceptions}, except that it just generates any needed -static data, but does not affect the generated code in any other way. -You normally do not need to enable this option; instead, a language processor -that needs this handling enables it on your behalf. - -@item -fasynchronous-unwind-tables -@opindex fasynchronous-unwind-tables -Generate unwind table in DWARF 2 format, if supported by target machine. The -table is exact at each instruction boundary, so it can be used for stack -unwinding from asynchronous events (such as debugger or garbage collector). - -@item -fno-gnu-unique -@opindex fno-gnu-unique -On systems with recent GNU assembler and C library, the C++ compiler -uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions -of template static data members and static local variables in inline -functions are unique even in the presence of @code{RTLD_LOCAL}; this -is necessary to avoid problems with a library used by two different -@code{RTLD_LOCAL} plugins depending on a definition in one of them and -therefore disagreeing with the other one about the binding of the -symbol. But this causes @code{dlclose} to be ignored for affected -DSOs; if your program relies on reinitialization of a DSO via -@code{dlclose} and @code{dlopen}, you can use -@option{-fno-gnu-unique}. - -@item -fpcc-struct-return -@opindex fpcc-struct-return -Return ``short'' @code{struct} and @code{union} values in memory like -longer ones, rather than in registers. This convention is less -efficient, but it has the advantage of allowing intercallability between -GCC-compiled files and files compiled with other compilers, particularly -the Portable C Compiler (pcc). - -The precise convention for returning structures in memory depends -on the target configuration macros. - -Short structures and unions are those whose size and alignment match -that of some integer type. - -@strong{Warning:} code compiled with the @option{-fpcc-struct-return} -switch is not binary compatible with code compiled with the -@option{-freg-struct-return} switch. -Use it to conform to a non-default application binary interface. - -@item -freg-struct-return -@opindex freg-struct-return -Return @code{struct} and @code{union} values in registers when possible. -This is more efficient for small structures than -@option{-fpcc-struct-return}. - -If you specify neither @option{-fpcc-struct-return} nor -@option{-freg-struct-return}, GCC defaults to whichever convention is -standard for the target. If there is no standard convention, GCC -defaults to @option{-fpcc-struct-return}, except on targets where GCC is -the principal compiler. In those cases, we can choose the standard, and -we chose the more efficient register return alternative. - -@strong{Warning:} code compiled with the @option{-freg-struct-return} -switch is not binary compatible with code compiled with the -@option{-fpcc-struct-return} switch. -Use it to conform to a non-default application binary interface. - -@item -fshort-enums -@opindex fshort-enums -Allocate to an @code{enum} type only as many bytes as it needs for the -declared range of possible values. Specifically, the @code{enum} type -is equivalent to the smallest integer type that has enough room. - -@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate -code that is not binary compatible with code generated without that switch. -Use it to conform to a non-default application binary interface. - -@item -fshort-double -@opindex fshort-double -Use the same size for @code{double} as for @code{float}. - -@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate -code that is not binary compatible with code generated without that switch. -Use it to conform to a non-default application binary interface. - -@item -fshort-wchar -@opindex fshort-wchar -Override the underlying type for @code{wchar_t} to be @code{short -unsigned int} instead of the default for the target. This option is -useful for building programs to run under WINE@. - -@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate -code that is not binary compatible with code generated without that switch. -Use it to conform to a non-default application binary interface. - -@item -fno-common -@opindex fno-common -In C code, controls the placement of uninitialized global variables. -Unix C compilers have traditionally permitted multiple definitions of -such variables in different compilation units by placing the variables -in a common block. -This is the behavior specified by @option{-fcommon}, and is the default -for GCC on most targets. -On the other hand, this behavior is not required by ISO C, and on some -targets may carry a speed or code size penalty on variable references. -The @option{-fno-common} option specifies that the compiler should place -uninitialized global variables in the data section of the object file, -rather than generating them as common blocks. -This has the effect that if the same variable is declared -(without @code{extern}) in two different compilations, -you get a multiple-definition error when you link them. -In this case, you must compile with @option{-fcommon} instead. -Compiling with @option{-fno-common} is useful on targets for which -it provides better performance, or if you wish to verify that the -program will work on other systems that always treat uninitialized -variable declarations this way. - -@item -fno-ident -@opindex fno-ident -Ignore the @code{#ident} directive. - -@item -finhibit-size-directive -@opindex finhibit-size-directive -Don't output a @code{.size} assembler directive, or anything else that -would cause trouble if the function is split in the middle, and the -two halves are placed at locations far apart in memory. This option is -used when compiling @file{crtstuff.c}; you should not need to use it -for anything else. - -@item -fverbose-asm -@opindex fverbose-asm -Put extra commentary information in the generated assembly code to -make it more readable. This option is generally only of use to those -who actually need to read the generated assembly code (perhaps while -debugging the compiler itself). - -@option{-fno-verbose-asm}, the default, causes the -extra information to be omitted and is useful when comparing two assembler -files. - -@item -frecord-gcc-switches -@opindex frecord-gcc-switches -This switch causes the command line used to invoke the -compiler to be recorded into the object file that is being created. -This switch is only implemented on some targets and the exact format -of the recording is target and binary file format dependent, but it -usually takes the form of a section containing ASCII text. This -switch is related to the @option{-fverbose-asm} switch, but that -switch only records information in the assembler output file as -comments, so it never reaches the object file. -See also @option{-grecord-gcc-switches} for another -way of storing compiler options into the object file. - -@item -fpic -@opindex fpic -@cindex global offset table -@cindex PIC -Generate position-independent code (PIC) suitable for use in a shared -library, if supported for the target machine. Such code accesses all -constant addresses through a global offset table (GOT)@. The dynamic -loader resolves the GOT entries when the program starts (the dynamic -loader is not part of GCC; it is part of the operating system). If -the GOT size for the linked executable exceeds a machine-specific -maximum size, you get an error message from the linker indicating that -@option{-fpic} does not work; in that case, recompile with @option{-fPIC} -instead. (These maximums are 8k on the SPARC and 32k -on the m68k and RS/6000. The x86 has no such limit.) - -Position-independent code requires special support, and therefore works -only on certain machines. For the x86, GCC supports PIC for System V -but not for the Sun 386i. Code generated for the IBM RS/6000 is always -position-independent. - -When this flag is set, the macros @code{__pic__} and @code{__PIC__} -are defined to 1. - -@item -fPIC -@opindex fPIC -If supported for the target machine, emit position-independent code, -suitable for dynamic linking and avoiding any limit on the size of the -global offset table. This option makes a difference on the m68k, -PowerPC and SPARC@. - -Position-independent code requires special support, and therefore works -only on certain machines. - -When this flag is set, the macros @code{__pic__} and @code{__PIC__} -are defined to 2. - -@item -fpie -@itemx -fPIE -@opindex fpie -@opindex fPIE -These options are similar to @option{-fpic} and @option{-fPIC}, but -generated position independent code can be only linked into executables. -Usually these options are used when @option{-pie} GCC option is -used during linking. - -@option{-fpie} and @option{-fPIE} both define the macros -@code{__pie__} and @code{__PIE__}. The macros have the value 1 -for @option{-fpie} and 2 for @option{-fPIE}. - -@item -fno-jump-tables -@opindex fno-jump-tables -Do not use jump tables for switch statements even where it would be -more efficient than other code generation strategies. This option is -of use in conjunction with @option{-fpic} or @option{-fPIC} for -building code that forms part of a dynamic linker and cannot -reference the address of a jump table. On some targets, jump tables -do not require a GOT and this option is not needed. - -@item -ffixed-@var{reg} -@opindex ffixed -Treat the register named @var{reg} as a fixed register; generated code -should never refer to it (except perhaps as a stack pointer, frame -pointer or in some other fixed role). - -@var{reg} must be the name of a register. The register names accepted -are machine-specific and are defined in the @code{REGISTER_NAMES} -macro in the machine description macro file. - -This flag does not have a negative form, because it specifies a -three-way choice. - -@item -fcall-used-@var{reg} -@opindex fcall-used -Treat the register named @var{reg} as an allocable register that is -clobbered by function calls. It may be allocated for temporaries or -variables that do not live across a call. Functions compiled this way -do not save and restore the register @var{reg}. - -It is an error to use this flag with the frame pointer or stack pointer. -Use of this flag for other registers that have fixed pervasive roles in -the machine's execution model produces disastrous results. - -This flag does not have a negative form, because it specifies a -three-way choice. - -@item -fcall-saved-@var{reg} -@opindex fcall-saved -Treat the register named @var{reg} as an allocable register saved by -functions. It may be allocated even for temporaries or variables that -live across a call. Functions compiled this way save and restore -the register @var{reg} if they use it. - -It is an error to use this flag with the frame pointer or stack pointer. -Use of this flag for other registers that have fixed pervasive roles in -the machine's execution model produces disastrous results. - -A different sort of disaster results from the use of this flag for -a register in which function values may be returned. - -This flag does not have a negative form, because it specifies a -three-way choice. - -@item -fpack-struct[=@var{n}] -@opindex fpack-struct -Without a value specified, pack all structure members together without -holes. When a value is specified (which must be a small power of two), pack -structure members according to this value, representing the maximum -alignment (that is, objects with default alignment requirements larger than -this are output potentially unaligned at the next fitting location. - -@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate -code that is not binary compatible with code generated without that switch. -Additionally, it makes the code suboptimal. -Use it to conform to a non-default application binary interface. - -@item -finstrument-functions -@opindex finstrument-functions -Generate instrumentation calls for entry and exit to functions. Just -after function entry and just before function exit, the following -profiling functions are called with the address of the current -function and its call site. (On some platforms, -@code{__builtin_return_address} does not work beyond the current -function, so the call site information may not be available to the -profiling functions otherwise.) - -@smallexample -void __cyg_profile_func_enter (void *this_fn, - void *call_site); -void __cyg_profile_func_exit (void *this_fn, - void *call_site); -@end smallexample - -The first argument is the address of the start of the current function, -which may be looked up exactly in the symbol table. - -This instrumentation is also done for functions expanded inline in other -functions. The profiling calls indicate where, conceptually, the -inline function is entered and exited. This means that addressable -versions of such functions must be available. If all your uses of a -function are expanded inline, this may mean an additional expansion of -code size. If you use @code{extern inline} in your C code, an -addressable version of such functions must be provided. (This is -normally the case anyway, but if you get lucky and the optimizer always -expands the functions inline, you might have gotten away without -providing static copies.) - -A function may be given the attribute @code{no_instrument_function}, in -which case this instrumentation is not done. This can be used, for -example, for the profiling functions listed above, high-priority -interrupt routines, and any functions from which the profiling functions -cannot safely be called (perhaps signal handlers, if the profiling -routines generate output or allocate memory). - -@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} -@opindex finstrument-functions-exclude-file-list - -Set the list of functions that are excluded from instrumentation (see -the description of @option{-finstrument-functions}). If the file that -contains a function definition matches with one of @var{file}, then -that function is not instrumented. The match is done on substrings: -if the @var{file} parameter is a substring of the file name, it is -considered to be a match. - -For example: - -@smallexample --finstrument-functions-exclude-file-list=/bits/stl,include/sys -@end smallexample - -@noindent -excludes any inline function defined in files whose pathnames -contain @file{/bits/stl} or @file{include/sys}. - -If, for some reason, you want to include letter @samp{,} in one of -@var{sym}, write @samp{\,}. For example, -@option{-finstrument-functions-exclude-file-list='\,\,tmp'} -(note the single quote surrounding the option). - -@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} -@opindex finstrument-functions-exclude-function-list - -This is similar to @option{-finstrument-functions-exclude-file-list}, -but this option sets the list of function names to be excluded from -instrumentation. The function name to be matched is its user-visible -name, such as @code{vector blah(const vector &)}, not the -internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The -match is done on substrings: if the @var{sym} parameter is a substring -of the function name, it is considered to be a match. For C99 and C++ -extended identifiers, the function name must be given in UTF-8, not -using universal character names. - -@item -fstack-check -@opindex fstack-check -Generate code to verify that you do not go beyond the boundary of the -stack. You should specify this flag if you are running in an -environment with multiple threads, but you only rarely need to specify it in -a single-threaded environment since stack overflow is automatically -detected on nearly all systems if there is only one stack. - -Note that this switch does not actually cause checking to be done; the -operating system or the language runtime must do that. The switch causes -generation of code to ensure that they see the stack being extended. - -You can additionally specify a string parameter: @samp{no} means no -checking, @samp{generic} means force the use of old-style checking, -@samp{specific} means use the best checking method and is equivalent -to bare @option{-fstack-check}. - -Old-style checking is a generic mechanism that requires no specific -target support in the compiler but comes with the following drawbacks: - -@enumerate -@item -Modified allocation strategy for large objects: they are always -allocated dynamically if their size exceeds a fixed threshold. - -@item -Fixed limit on the size of the static frame of functions: when it is -topped by a particular function, stack checking is not reliable and -a warning is issued by the compiler. - -@item -Inefficiency: because of both the modified allocation strategy and the -generic implementation, code performance is hampered. -@end enumerate - -Note that old-style stack checking is also the fallback method for -@samp{specific} if no target support has been added in the compiler. - -@item -fstack-limit-register=@var{reg} -@itemx -fstack-limit-symbol=@var{sym} -@itemx -fno-stack-limit -@opindex fstack-limit-register -@opindex fstack-limit-symbol -@opindex fno-stack-limit -Generate code to ensure that the stack does not grow beyond a certain value, -either the value of a register or the address of a symbol. If a larger -stack is required, a signal is raised at run time. For most targets, -the signal is raised before the stack overruns the boundary, so -it is possible to catch the signal without taking special precautions. - -For instance, if the stack starts at absolute address @samp{0x80000000} -and grows downwards, you can use the flags -@option{-fstack-limit-symbol=__stack_limit} and -@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit -of 128KB@. Note that this may only work with the GNU linker. - -@item -fsplit-stack -@opindex fsplit-stack -Generate code to automatically split the stack before it overflows. -The resulting program has a discontiguous stack which can only -overflow if the program is unable to allocate any more memory. This -is most useful when running threaded programs, as it is no longer -necessary to calculate a good stack size to use for each thread. This -is currently only implemented for the x86 targets running -GNU/Linux. - -When code compiled with @option{-fsplit-stack} calls code compiled -without @option{-fsplit-stack}, there may not be much stack space -available for the latter code to run. If compiling all code, -including library code, with @option{-fsplit-stack} is not an option, -then the linker can fix up these calls so that the code compiled -without @option{-fsplit-stack} always has a large stack. Support for -this is implemented in the gold linker in GNU binutils release 2.21 -and later. - -@item -fleading-underscore -@opindex fleading-underscore -This option and its counterpart, @option{-fno-leading-underscore}, forcibly -change the way C symbols are represented in the object file. One use -is to help link with legacy assembly code. - -@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to -generate code that is not binary compatible with code generated without that -switch. Use it to conform to a non-default application binary interface. -Not all targets provide complete support for this switch. - -@item -ftls-model=@var{model} -@opindex ftls-model -Alter the thread-local storage model to be used (@pxref{Thread-Local}). -The @var{model} argument should be one of @samp{global-dynamic}, -@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. -Note that the choice is subject to optimization: the compiler may use -a more efficient model for symbols not visible outside of the translation -unit, or if @option{-fpic} is not given on the command line. - -The default without @option{-fpic} is @samp{initial-exec}; with -@option{-fpic} the default is @samp{global-dynamic}. - -@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} -@opindex fvisibility -Set the default ELF image symbol visibility to the specified option---all -symbols are marked with this unless overridden within the code. -Using this feature can very substantially improve linking and -load times of shared object libraries, produce more optimized -code, provide near-perfect API export and prevent symbol clashes. -It is @strong{strongly} recommended that you use this in any shared objects -you distribute. - -Despite the nomenclature, @samp{default} always means public; i.e., -available to be linked against from outside the shared object. -@samp{protected} and @samp{internal} are pretty useless in real-world -usage so the only other commonly used option is @samp{hidden}. -The default if @option{-fvisibility} isn't specified is -@samp{default}, i.e., make every symbol public. - -A good explanation of the benefits offered by ensuring ELF -symbols have the correct visibility is given by ``How To Write -Shared Libraries'' by Ulrich Drepper (which can be found at -@w{@uref{http://www.akkadia.org/drepper/}})---however a superior -solution made possible by this option to marking things hidden when -the default is public is to make the default hidden and mark things -public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} -and @code{__attribute__ ((visibility("default")))} instead of -@code{__declspec(dllexport)} you get almost identical semantics with -identical syntax. This is a great boon to those working with -cross-platform projects. - -For those adding visibility support to existing code, you may find -@code{#pragma GCC visibility} of use. This works by you enclosing -the declarations you wish to set visibility for with (for example) -@code{#pragma GCC visibility push(hidden)} and -@code{#pragma GCC visibility pop}. -Bear in mind that symbol visibility should be viewed @strong{as -part of the API interface contract} and thus all new code should -always specify visibility when it is not the default; i.e., declarations -only for use within the local DSO should @strong{always} be marked explicitly -as hidden as so to avoid PLT indirection overheads---making this -abundantly clear also aids readability and self-documentation of the code. -Note that due to ISO C++ specification requirements, @code{operator new} and -@code{operator delete} must always be of default visibility. - -Be aware that headers from outside your project, in particular system -headers and headers from any other library you use, may not be -expecting to be compiled with visibility other than the default. You -may need to explicitly say @code{#pragma GCC visibility push(default)} -before including any such headers. - -@code{extern} declarations are not affected by @option{-fvisibility}, so -a lot of code can be recompiled with @option{-fvisibility=hidden} with -no modifications. However, this means that calls to @code{extern} -functions with no explicit visibility use the PLT, so it is more -effective to use @code{__attribute ((visibility))} and/or -@code{#pragma GCC visibility} to tell the compiler which @code{extern} -declarations should be treated as hidden. - -Note that @option{-fvisibility} does affect C++ vague linkage -entities. This means that, for instance, an exception class that is -be thrown between DSOs must be explicitly marked with default -visibility so that the @samp{type_info} nodes are unified between -the DSOs. - -An overview of these techniques, their benefits and how to use them -is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. - -@item -fstrict-volatile-bitfields -@opindex fstrict-volatile-bitfields -This option should be used if accesses to volatile bit-fields (or other -structure fields, although the compiler usually honors those types -anyway) should use a single access of the width of the -field's type, aligned to a natural alignment if possible. For -example, targets with memory-mapped peripheral registers might require -all such accesses to be 16 bits wide; with this flag you can -declare all peripheral bit-fields as @code{unsigned short} (assuming short -is 16 bits on these targets) to force GCC to use 16-bit accesses -instead of, perhaps, a more efficient 32-bit access. - -If this option is disabled, the compiler uses the most efficient -instruction. In the previous example, that might be a 32-bit load -instruction, even though that accesses bytes that do not contain -any portion of the bit-field, or memory-mapped registers unrelated to -the one being updated. - -In some cases, such as when the @code{packed} attribute is applied to a -structure field, it may not be possible to access the field with a single -read or write that is correctly aligned for the target machine. In this -case GCC falls back to generating multiple accesses rather than code that -will fault or truncate the result at run time. - -Note: Due to restrictions of the C/C++11 memory model, write accesses are -not allowed to touch non bit-field members. It is therefore recommended -to define all bits of the field's type as bit-field members. - -The default value of this option is determined by the application binary -interface for the target processor. - -@item -fsync-libcalls -@opindex fsync-libcalls -This option controls whether any out-of-line instance of the @code{__sync} -family of functions may be used to implement the C++11 @code{__atomic} -family of functions. - -The default value of this option is enabled, thus the only useful form -of the option is @option{-fno-sync-libcalls}. This option is used in -the implementation of the @file{libatomic} runtime library. - -@end table - -@c man end - -@node Environment Variables -@section Environment Variables Affecting GCC -@cindex environment variables - -@c man begin ENVIRONMENT -This section describes several environment variables that affect how GCC -operates. Some of them work by specifying directories or prefixes to use -when searching for various kinds of files. Some are used to specify other -aspects of the compilation environment. - -Note that you can also specify places to search using options such as -@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These -take precedence over places specified using environment variables, which -in turn take precedence over those specified by the configuration of GCC@. -@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, -GNU Compiler Collection (GCC) Internals}. - -@table @env -@item LANG -@itemx LC_CTYPE -@c @itemx LC_COLLATE -@itemx LC_MESSAGES -@c @itemx LC_MONETARY -@c @itemx LC_NUMERIC -@c @itemx LC_TIME -@itemx LC_ALL -@findex LANG -@findex LC_CTYPE -@c @findex LC_COLLATE -@findex LC_MESSAGES -@c @findex LC_MONETARY -@c @findex LC_NUMERIC -@c @findex LC_TIME -@findex LC_ALL -@cindex locale -These environment variables control the way that GCC uses -localization information which allows GCC to work with different -national conventions. GCC inspects the locale categories -@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do -so. These locale categories can be set to any value supported by your -installation. A typical value is @samp{en_GB.UTF-8} for English in the United -Kingdom encoded in UTF-8. - -The @env{LC_CTYPE} environment variable specifies character -classification. GCC uses it to determine the character boundaries in -a string; this is needed for some multibyte encodings that contain quote -and escape characters that are otherwise interpreted as a string -end or escape. - -The @env{LC_MESSAGES} environment variable specifies the language to -use in diagnostic messages. - -If the @env{LC_ALL} environment variable is set, it overrides the value -of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} -and @env{LC_MESSAGES} default to the value of the @env{LANG} -environment variable. If none of these variables are set, GCC -defaults to traditional C English behavior. - -@item TMPDIR -@findex TMPDIR -If @env{TMPDIR} is set, it specifies the directory to use for temporary -files. GCC uses temporary files to hold the output of one stage of -compilation which is to be used as input to the next stage: for example, -the output of the preprocessor, which is the input to the compiler -proper. - -@item GCC_COMPARE_DEBUG -@findex GCC_COMPARE_DEBUG -Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing -@option{-fcompare-debug} to the compiler driver. See the documentation -of this option for more details. - -@item GCC_EXEC_PREFIX -@findex GCC_EXEC_PREFIX -If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the -names of the subprograms executed by the compiler. No slash is added -when this prefix is combined with the name of a subprogram, but you can -specify a prefix that ends with a slash if you wish. - -If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out -an appropriate prefix to use based on the pathname it is invoked with. - -If GCC cannot find the subprogram using the specified prefix, it -tries looking in the usual places for the subprogram. - -The default value of @env{GCC_EXEC_PREFIX} is -@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to -the installed compiler. In many cases @var{prefix} is the value -of @code{prefix} when you ran the @file{configure} script. - -Other prefixes specified with @option{-B} take precedence over this prefix. - -This prefix is also used for finding files such as @file{crt0.o} that are -used for linking. - -In addition, the prefix is used in an unusual way in finding the -directories to search for header files. For each of the standard -directories whose name normally begins with @samp{/usr/local/lib/gcc} -(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries -replacing that beginning with the specified prefix to produce an -alternate directory name. Thus, with @option{-Bfoo/}, GCC searches -@file{foo/bar} just before it searches the standard directory -@file{/usr/local/lib/bar}. -If a standard directory begins with the configured -@var{prefix} then the value of @var{prefix} is replaced by -@env{GCC_EXEC_PREFIX} when looking for header files. - -@item COMPILER_PATH -@findex COMPILER_PATH -The value of @env{COMPILER_PATH} is a colon-separated list of -directories, much like @env{PATH}. GCC tries the directories thus -specified when searching for subprograms, if it can't find the -subprograms using @env{GCC_EXEC_PREFIX}. - -@item LIBRARY_PATH -@findex LIBRARY_PATH -The value of @env{LIBRARY_PATH} is a colon-separated list of -directories, much like @env{PATH}. When configured as a native compiler, -GCC tries the directories thus specified when searching for special -linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking -using GCC also uses these directories when searching for ordinary -libraries for the @option{-l} option (but directories specified with -@option{-L} come first). - -@item LANG -@findex LANG -@cindex locale definition -This variable is used to pass locale information to the compiler. One way in -which this information is used is to determine the character set to be used -when character literals, string literals and comments are parsed in C and C++. -When the compiler is configured to allow multibyte characters, -the following values for @env{LANG} are recognized: - -@table @samp -@item C-JIS -Recognize JIS characters. -@item C-SJIS -Recognize SJIS characters. -@item C-EUCJP -Recognize EUCJP characters. -@end table - -If @env{LANG} is not defined, or if it has some other value, then the -compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to -recognize and translate multibyte characters. -@end table - -@noindent -Some additional environment variables affect the behavior of the -preprocessor. - -@include cppenv.texi - -@c man end - -@node Precompiled Headers -@section Using Precompiled Headers -@cindex precompiled headers -@cindex speed of compilation - -Often large projects have many header files that are included in every -source file. The time the compiler takes to process these header files -over and over again can account for nearly all of the time required to -build the project. To make builds faster, GCC allows you to -@dfn{precompile} a header file. - -To create a precompiled header file, simply compile it as you would any -other file, if necessary using the @option{-x} option to make the driver -treat it as a C or C++ header file. You may want to use a -tool like @command{make} to keep the precompiled header up-to-date when -the headers it contains change. - -A precompiled header file is searched for when @code{#include} is -seen in the compilation. As it searches for the included file -(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the -compiler looks for a precompiled header in each directory just before it -looks for the include file in that directory. The name searched for is -the name specified in the @code{#include} with @samp{.gch} appended. If -the precompiled header file can't be used, it is ignored. - -For instance, if you have @code{#include "all.h"}, and you have -@file{all.h.gch} in the same directory as @file{all.h}, then the -precompiled header file is used if possible, and the original -header is used otherwise. - -Alternatively, you might decide to put the precompiled header file in a -directory and use @option{-I} to ensure that directory is searched -before (or instead of) the directory containing the original header. -Then, if you want to check that the precompiled header file is always -used, you can put a file of the same name as the original header in this -directory containing an @code{#error} command. - -This also works with @option{-include}. So yet another way to use -precompiled headers, good for projects not designed with precompiled -header files in mind, is to simply take most of the header files used by -a project, include them from another header file, precompile that header -file, and @option{-include} the precompiled header. If the header files -have guards against multiple inclusion, they are skipped because -they've already been included (in the precompiled header). - -If you need to precompile the same header file for different -languages, targets, or compiler options, you can instead make a -@emph{directory} named like @file{all.h.gch}, and put each precompiled -header in the directory, perhaps using @option{-o}. It doesn't matter -what you call the files in the directory; every precompiled header in -the directory is considered. The first precompiled header -encountered in the directory that is valid for this compilation is -used; they're searched in no particular order. - -There are many other possibilities, limited only by your imagination, -good sense, and the constraints of your build system. - -A precompiled header file can be used only when these conditions apply: - -@itemize -@item -Only one precompiled header can be used in a particular compilation. - -@item -A precompiled header can't be used once the first C token is seen. You -can have preprocessor directives before a precompiled header; you cannot -include a precompiled header from inside another header. - -@item -The precompiled header file must be produced for the same language as -the current compilation. You can't use a C precompiled header for a C++ -compilation. - -@item -The precompiled header file must have been produced by the same compiler -binary as the current compilation is using. - -@item -Any macros defined before the precompiled header is included must -either be defined in the same way as when the precompiled header was -generated, or must not affect the precompiled header, which usually -means that they don't appear in the precompiled header at all. - -The @option{-D} option is one way to define a macro before a -precompiled header is included; using a @code{#define} can also do it. -There are also some options that define macros implicitly, like -@option{-O} and @option{-Wdeprecated}; the same rule applies to macros -defined this way. - -@item If debugging information is output when using the precompiled -header, using @option{-g} or similar, the same kind of debugging information -must have been output when building the precompiled header. However, -a precompiled header built using @option{-g} can be used in a compilation -when no debugging information is being output. - -@item The same @option{-m} options must generally be used when building -and using the precompiled header. @xref{Submodel Options}, -for any cases where this rule is relaxed. - -@item Each of the following options must be the same when building and using -the precompiled header: - -@gccoptlist{-fexceptions} - -@item -Some other command-line options starting with @option{-f}, -@option{-p}, or @option{-O} must be defined in the same way as when -the precompiled header was generated. At present, it's not clear -which options are safe to change and which are not; the safest choice -is to use exactly the same options when generating and using the -precompiled header. The following are known to be safe: - -@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol --fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol --fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol --pedantic-errors} - -@end itemize - -For all of these except the last, the compiler automatically -ignores the precompiled header if the conditions aren't met. If you -find an option combination that doesn't work and doesn't cause the -precompiled header to be ignored, please consider filing a bug report, -see @ref{Bugs}. - -If you do use differing options when generating and using the -precompiled header, the actual behavior is a mixture of the -behavior for the options. For instance, if you use @option{-g} to -generate the precompiled header but not when using it, you may or may -not get debugging information for routines in the precompiled header. diff --git a/contrib/gcc-5.0/gcc/doc/languages.texi b/contrib/gcc-5.0/gcc/doc/languages.texi deleted file mode 100644 index 6b6ba22a14..0000000000 --- a/contrib/gcc-5.0/gcc/doc/languages.texi +++ /dev/null @@ -1,36 +0,0 @@ -@c Copyright (C) 2002-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Languages -@chapter Language Front Ends in GCC - -The interface to front ends for languages in GCC, and in particular -the @code{tree} structure (@pxref{GENERIC}), was initially designed for -C, and many aspects of it are still somewhat biased towards C and -C-like languages. It is, however, reasonably well suited to other -procedural languages, and front ends for many such languages have been -written for GCC@. - -Writing a compiler as a front end for GCC, rather than compiling -directly to assembler or generating C code which is then compiled by -GCC, has several advantages: - -@itemize @bullet -@item GCC front ends benefit from the support for many different -target machines already present in GCC@. -@item GCC front ends benefit from all the optimizations in GCC@. Some -of these, such as alias analysis, may work better when GCC is -compiling directly from source code then when it is compiling from -generated C code. -@item Better debugging information is generated when compiling -directly from source code than when going via intermediate generated C -code. -@end itemize - -Because of the advantages of writing a compiler as a GCC front end, -GCC front ends have also been created for languages very different -from those for which GCC was designed, such as the declarative -logic/functional language Mercury. For these reasons, it may also be -useful to implement compilers created for specialized purposes (for -example, as part of a research project) as GCC front ends. diff --git a/contrib/gcc-5.0/gcc/doc/libgcc.texi b/contrib/gcc-5.0/gcc/doc/libgcc.texi deleted file mode 100644 index 6841565cf4..0000000000 --- a/contrib/gcc-5.0/gcc/doc/libgcc.texi +++ /dev/null @@ -1,2304 +0,0 @@ -@c Copyright (C) 2003-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. -@c Contributed by Aldy Hernandez - -@node Libgcc -@chapter The GCC low-level runtime library - -GCC provides a low-level runtime library, @file{libgcc.a} or -@file{libgcc_s.so.1} on some platforms. GCC generates calls to -routines in this library automatically, whenever it needs to perform -some operation that is too complicated to emit inline code for. - -Most of the routines in @code{libgcc} handle arithmetic operations -that the target processor cannot perform directly. This includes -integer multiply and divide on some machines, and all floating-point -and fixed-point operations on other machines. @code{libgcc} also includes -routines for exception handling, and a handful of miscellaneous operations. - -Some of these routines can be defined in mostly machine-independent C@. -Others must be hand-written in assembly language for each processor -that needs them. - -GCC will also generate calls to C library routines, such as -@code{memcpy} and @code{memset}, in some cases. The set of routines -that GCC may possibly use is documented in @ref{Other -Builtins,,,gcc, Using the GNU Compiler Collection (GCC)}. - -These routines take arguments and return values of a specific machine -mode, not a specific C type. @xref{Machine Modes}, for an explanation -of this concept. For illustrative purposes, in this chapter the -floating point type @code{float} is assumed to correspond to @code{SFmode}; -@code{double} to @code{DFmode}; and @code{@w{long double}} to both -@code{TFmode} and @code{XFmode}. Similarly, the integer types @code{int} -and @code{@w{unsigned int}} correspond to @code{SImode}; @code{long} and -@code{@w{unsigned long}} to @code{DImode}; and @code{@w{long long}} and -@code{@w{unsigned long long}} to @code{TImode}. - -@menu -* Integer library routines:: -* Soft float library routines:: -* Decimal float library routines:: -* Fixed-point fractional library routines:: -* Exception handling routines:: -* Miscellaneous routines:: -@end menu - -@node Integer library routines -@section Routines for integer arithmetic - -The integer arithmetic routines are used on platforms that don't provide -hardware support for arithmetic operations on some modes. - -@subsection Arithmetic functions - -@deftypefn {Runtime Function} int __ashlsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __ashldi3 (long @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long} __ashlti3 (long long @var{a}, int @var{b}) -These functions return the result of shifting @var{a} left by @var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} int __ashrsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __ashrdi3 (long @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long} __ashrti3 (long long @var{a}, int @var{b}) -These functions return the result of arithmetically shifting @var{a} right -by @var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} int __divsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __divdi3 (long @var{a}, long @var{b}) -@deftypefnx {Runtime Function} {long long} __divti3 (long long @var{a}, long long @var{b}) -These functions return the quotient of the signed division of @var{a} and -@var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __lshrsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __lshrdi3 (long @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long} __lshrti3 (long long @var{a}, int @var{b}) -These functions return the result of logically shifting @var{a} right by -@var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} int __modsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __moddi3 (long @var{a}, long @var{b}) -@deftypefnx {Runtime Function} {long long} __modti3 (long long @var{a}, long long @var{b}) -These functions return the remainder of the signed division of @var{a} -and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __mulsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __muldi3 (long @var{a}, long @var{b}) -@deftypefnx {Runtime Function} {long long} __multi3 (long long @var{a}, long long @var{b}) -These functions return the product of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} long __negdi2 (long @var{a}) -@deftypefnx {Runtime Function} {long long} __negti2 (long long @var{a}) -These functions return the negation of @var{a}. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned int} __udivsi3 (unsigned int @var{a}, unsigned int @var{b}) -@deftypefnx {Runtime Function} {unsigned long} __udivdi3 (unsigned long @var{a}, unsigned long @var{b}) -@deftypefnx {Runtime Function} {unsigned long long} __udivti3 (unsigned long long @var{a}, unsigned long long @var{b}) -These functions return the quotient of the unsigned division of @var{a} -and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned long} __udivmoddi4 (unsigned long @var{a}, unsigned long @var{b}, unsigned long *@var{c}) -@deftypefnx {Runtime Function} {unsigned long long} __udivmodti4 (unsigned long long @var{a}, unsigned long long @var{b}, unsigned long long *@var{c}) -These functions calculate both the quotient and remainder of the unsigned -division of @var{a} and @var{b}. The return value is the quotient, and -the remainder is placed in variable pointed to by @var{c}. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned int} __umodsi3 (unsigned int @var{a}, unsigned int @var{b}) -@deftypefnx {Runtime Function} {unsigned long} __umoddi3 (unsigned long @var{a}, unsigned long @var{b}) -@deftypefnx {Runtime Function} {unsigned long long} __umodti3 (unsigned long long @var{a}, unsigned long long @var{b}) -These functions return the remainder of the unsigned division of @var{a} -and @var{b}. -@end deftypefn - -@subsection Comparison functions - -The following functions implement integral comparisons. These functions -implement a low-level compare, upon which the higher level comparison -operators (such as less than and greater than or equal to) can be -constructed. The returned values lie in the range zero to two, to allow -the high-level operators to be implemented by testing the returned -result using either signed or unsigned comparison. - -@deftypefn {Runtime Function} int __cmpdi2 (long @var{a}, long @var{b}) -@deftypefnx {Runtime Function} int __cmpti2 (long long @var{a}, long long @var{b}) -These functions perform a signed comparison of @var{a} and @var{b}. If -@var{a} is less than @var{b}, they return 0; if @var{a} is greater than -@var{b}, they return 2; and if @var{a} and @var{b} are equal they return 1. -@end deftypefn - -@deftypefn {Runtime Function} int __ucmpdi2 (unsigned long @var{a}, unsigned long @var{b}) -@deftypefnx {Runtime Function} int __ucmpti2 (unsigned long long @var{a}, unsigned long long @var{b}) -These functions perform an unsigned comparison of @var{a} and @var{b}. -If @var{a} is less than @var{b}, they return 0; if @var{a} is greater than -@var{b}, they return 2; and if @var{a} and @var{b} are equal they return 1. -@end deftypefn - -@subsection Trapping arithmetic functions - -The following functions implement trapping arithmetic. These functions -call the libc function @code{abort} upon signed arithmetic overflow. - -@deftypefn {Runtime Function} int __absvsi2 (int @var{a}) -@deftypefnx {Runtime Function} long __absvdi2 (long @var{a}) -These functions return the absolute value of @var{a}. -@end deftypefn - -@deftypefn {Runtime Function} int __addvsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __addvdi3 (long @var{a}, long @var{b}) -These functions return the sum of @var{a} and @var{b}; that is -@code{@var{a} + @var{b}}. -@end deftypefn - -@deftypefn {Runtime Function} int __mulvsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __mulvdi3 (long @var{a}, long @var{b}) -The functions return the product of @var{a} and @var{b}; that is -@code{@var{a} * @var{b}}. -@end deftypefn - -@deftypefn {Runtime Function} int __negvsi2 (int @var{a}) -@deftypefnx {Runtime Function} long __negvdi2 (long @var{a}) -These functions return the negation of @var{a}; that is @code{-@var{a}}. -@end deftypefn - -@deftypefn {Runtime Function} int __subvsi3 (int @var{a}, int @var{b}) -@deftypefnx {Runtime Function} long __subvdi3 (long @var{a}, long @var{b}) -These functions return the difference between @var{b} and @var{a}; -that is @code{@var{a} - @var{b}}. -@end deftypefn - -@subsection Bit operations - -@deftypefn {Runtime Function} int __clzsi2 (unsigned int @var{a}) -@deftypefnx {Runtime Function} int __clzdi2 (unsigned long @var{a}) -@deftypefnx {Runtime Function} int __clzti2 (unsigned long long @var{a}) -These functions return the number of leading 0-bits in @var{a}, starting -at the most significant bit position. If @var{a} is zero, the result is -undefined. -@end deftypefn - -@deftypefn {Runtime Function} int __ctzsi2 (unsigned int @var{a}) -@deftypefnx {Runtime Function} int __ctzdi2 (unsigned long @var{a}) -@deftypefnx {Runtime Function} int __ctzti2 (unsigned long long @var{a}) -These functions return the number of trailing 0-bits in @var{a}, starting -at the least significant bit position. If @var{a} is zero, the result is -undefined. -@end deftypefn - -@deftypefn {Runtime Function} int __ffsdi2 (unsigned long @var{a}) -@deftypefnx {Runtime Function} int __ffsti2 (unsigned long long @var{a}) -These functions return the index of the least significant 1-bit in @var{a}, -or the value zero if @var{a} is zero. The least significant bit is index -one. -@end deftypefn - -@deftypefn {Runtime Function} int __paritysi2 (unsigned int @var{a}) -@deftypefnx {Runtime Function} int __paritydi2 (unsigned long @var{a}) -@deftypefnx {Runtime Function} int __parityti2 (unsigned long long @var{a}) -These functions return the value zero if the number of bits set in -@var{a} is even, and the value one otherwise. -@end deftypefn - -@deftypefn {Runtime Function} int __popcountsi2 (unsigned int @var{a}) -@deftypefnx {Runtime Function} int __popcountdi2 (unsigned long @var{a}) -@deftypefnx {Runtime Function} int __popcountti2 (unsigned long long @var{a}) -These functions return the number of bits set in @var{a}. -@end deftypefn - -@deftypefn {Runtime Function} int32_t __bswapsi2 (int32_t @var{a}) -@deftypefnx {Runtime Function} int64_t __bswapdi2 (int64_t @var{a}) -These functions return the @var{a} byteswapped. -@end deftypefn - -@node Soft float library routines -@section Routines for floating point emulation -@cindex soft float library -@cindex arithmetic library -@cindex math library -@opindex msoft-float - -The software floating point library is used on machines which do not -have hardware support for floating point. It is also used whenever -@option{-msoft-float} is used to disable generation of floating point -instructions. (Not all targets support this switch.) - -For compatibility with other compilers, the floating point emulation -routines can be renamed with the @code{DECLARE_LIBRARY_RENAMES} macro -(@pxref{Library Calls}). In this section, the default names are used. - -Presently the library does not support @code{XFmode}, which is used -for @code{long double} on some architectures. - -@subsection Arithmetic functions - -@deftypefn {Runtime Function} float __addsf3 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} double __adddf3 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} {long double} __addtf3 (long double @var{a}, long double @var{b}) -@deftypefnx {Runtime Function} {long double} __addxf3 (long double @var{a}, long double @var{b}) -These functions return the sum of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} float __subsf3 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} double __subdf3 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} {long double} __subtf3 (long double @var{a}, long double @var{b}) -@deftypefnx {Runtime Function} {long double} __subxf3 (long double @var{a}, long double @var{b}) -These functions return the difference between @var{b} and @var{a}; -that is, @w{@math{@var{a} - @var{b}}}. -@end deftypefn - -@deftypefn {Runtime Function} float __mulsf3 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} double __muldf3 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} {long double} __multf3 (long double @var{a}, long double @var{b}) -@deftypefnx {Runtime Function} {long double} __mulxf3 (long double @var{a}, long double @var{b}) -These functions return the product of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} float __divsf3 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} double __divdf3 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} {long double} __divtf3 (long double @var{a}, long double @var{b}) -@deftypefnx {Runtime Function} {long double} __divxf3 (long double @var{a}, long double @var{b}) -These functions return the quotient of @var{a} and @var{b}; that is, -@w{@math{@var{a} / @var{b}}}. -@end deftypefn - -@deftypefn {Runtime Function} float __negsf2 (float @var{a}) -@deftypefnx {Runtime Function} double __negdf2 (double @var{a}) -@deftypefnx {Runtime Function} {long double} __negtf2 (long double @var{a}) -@deftypefnx {Runtime Function} {long double} __negxf2 (long double @var{a}) -These functions return the negation of @var{a}. They simply flip the -sign bit, so they can produce negative zero and negative NaN@. -@end deftypefn - -@subsection Conversion functions - -@deftypefn {Runtime Function} double __extendsfdf2 (float @var{a}) -@deftypefnx {Runtime Function} {long double} __extendsftf2 (float @var{a}) -@deftypefnx {Runtime Function} {long double} __extendsfxf2 (float @var{a}) -@deftypefnx {Runtime Function} {long double} __extenddftf2 (double @var{a}) -@deftypefnx {Runtime Function} {long double} __extenddfxf2 (double @var{a}) -These functions extend @var{a} to the wider mode of their return -type. -@end deftypefn - -@deftypefn {Runtime Function} double __truncxfdf2 (long double @var{a}) -@deftypefnx {Runtime Function} double __trunctfdf2 (long double @var{a}) -@deftypefnx {Runtime Function} float __truncxfsf2 (long double @var{a}) -@deftypefnx {Runtime Function} float __trunctfsf2 (long double @var{a}) -@deftypefnx {Runtime Function} float __truncdfsf2 (double @var{a}) -These functions truncate @var{a} to the narrower mode of their return -type, rounding toward zero. -@end deftypefn - -@deftypefn {Runtime Function} int __fixsfsi (float @var{a}) -@deftypefnx {Runtime Function} int __fixdfsi (double @var{a}) -@deftypefnx {Runtime Function} int __fixtfsi (long double @var{a}) -@deftypefnx {Runtime Function} int __fixxfsi (long double @var{a}) -These functions convert @var{a} to a signed integer, rounding toward zero. -@end deftypefn - -@deftypefn {Runtime Function} long __fixsfdi (float @var{a}) -@deftypefnx {Runtime Function} long __fixdfdi (double @var{a}) -@deftypefnx {Runtime Function} long __fixtfdi (long double @var{a}) -@deftypefnx {Runtime Function} long __fixxfdi (long double @var{a}) -These functions convert @var{a} to a signed long, rounding toward zero. -@end deftypefn - -@deftypefn {Runtime Function} {long long} __fixsfti (float @var{a}) -@deftypefnx {Runtime Function} {long long} __fixdfti (double @var{a}) -@deftypefnx {Runtime Function} {long long} __fixtfti (long double @var{a}) -@deftypefnx {Runtime Function} {long long} __fixxfti (long double @var{a}) -These functions convert @var{a} to a signed long long, rounding toward zero. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned int} __fixunssfsi (float @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fixunsdfsi (double @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fixunstfsi (long double @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fixunsxfsi (long double @var{a}) -These functions convert @var{a} to an unsigned integer, rounding -toward zero. Negative values all become zero. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned long} __fixunssfdi (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fixunsdfdi (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fixunstfdi (long double @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fixunsxfdi (long double @var{a}) -These functions convert @var{a} to an unsigned long, rounding -toward zero. Negative values all become zero. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned long long} __fixunssfti (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fixunsdfti (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fixunstfti (long double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fixunsxfti (long double @var{a}) -These functions convert @var{a} to an unsigned long long, rounding -toward zero. Negative values all become zero. -@end deftypefn - -@deftypefn {Runtime Function} float __floatsisf (int @var{i}) -@deftypefnx {Runtime Function} double __floatsidf (int @var{i}) -@deftypefnx {Runtime Function} {long double} __floatsitf (int @var{i}) -@deftypefnx {Runtime Function} {long double} __floatsixf (int @var{i}) -These functions convert @var{i}, a signed integer, to floating point. -@end deftypefn - -@deftypefn {Runtime Function} float __floatdisf (long @var{i}) -@deftypefnx {Runtime Function} double __floatdidf (long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatditf (long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatdixf (long @var{i}) -These functions convert @var{i}, a signed long, to floating point. -@end deftypefn - -@deftypefn {Runtime Function} float __floattisf (long long @var{i}) -@deftypefnx {Runtime Function} double __floattidf (long long @var{i}) -@deftypefnx {Runtime Function} {long double} __floattitf (long long @var{i}) -@deftypefnx {Runtime Function} {long double} __floattixf (long long @var{i}) -These functions convert @var{i}, a signed long long, to floating point. -@end deftypefn - -@deftypefn {Runtime Function} float __floatunsisf (unsigned int @var{i}) -@deftypefnx {Runtime Function} double __floatunsidf (unsigned int @var{i}) -@deftypefnx {Runtime Function} {long double} __floatunsitf (unsigned int @var{i}) -@deftypefnx {Runtime Function} {long double} __floatunsixf (unsigned int @var{i}) -These functions convert @var{i}, an unsigned integer, to floating point. -@end deftypefn - -@deftypefn {Runtime Function} float __floatundisf (unsigned long @var{i}) -@deftypefnx {Runtime Function} double __floatundidf (unsigned long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatunditf (unsigned long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatundixf (unsigned long @var{i}) -These functions convert @var{i}, an unsigned long, to floating point. -@end deftypefn - -@deftypefn {Runtime Function} float __floatuntisf (unsigned long long @var{i}) -@deftypefnx {Runtime Function} double __floatuntidf (unsigned long long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatuntitf (unsigned long long @var{i}) -@deftypefnx {Runtime Function} {long double} __floatuntixf (unsigned long long @var{i}) -These functions convert @var{i}, an unsigned long long, to floating point. -@end deftypefn - -@subsection Comparison functions - -There are two sets of basic comparison functions. - -@deftypefn {Runtime Function} int __cmpsf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __cmpdf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __cmptf2 (long double @var{a}, long double @var{b}) -These functions calculate @math{a <=> b}. That is, if @var{a} is less -than @var{b}, they return @minus{}1; if @var{a} is greater than @var{b}, they -return 1; and if @var{a} and @var{b} are equal they return 0. If -either argument is NaN they return 1, but you should not rely on this; -if NaN is a possibility, use one of the higher-level comparison -functions. -@end deftypefn - -@deftypefn {Runtime Function} int __unordsf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __unorddf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __unordtf2 (long double @var{a}, long double @var{b}) -These functions return a nonzero value if either argument is NaN, otherwise 0. -@end deftypefn - -There is also a complete group of higher level functions which -correspond directly to comparison operators. They implement the ISO C -semantics for floating-point comparisons, taking NaN into account. -Pay careful attention to the return values defined for each set. -Under the hood, all of these routines are implemented as - -@smallexample - if (__unord@var{X}f2 (a, b)) - return @var{E}; - return __cmp@var{X}f2 (a, b); -@end smallexample - -@noindent -where @var{E} is a constant chosen to give the proper behavior for -NaN@. Thus, the meaning of the return value is different for each set. -Do not rely on this implementation; only the semantics documented -below are guaranteed. - -@deftypefn {Runtime Function} int __eqsf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __eqdf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __eqtf2 (long double @var{a}, long double @var{b}) -These functions return zero if neither argument is NaN, and @var{a} and -@var{b} are equal. -@end deftypefn - -@deftypefn {Runtime Function} int __nesf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __nedf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __netf2 (long double @var{a}, long double @var{b}) -These functions return a nonzero value if either argument is NaN, or -if @var{a} and @var{b} are unequal. -@end deftypefn - -@deftypefn {Runtime Function} int __gesf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __gedf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __getf2 (long double @var{a}, long double @var{b}) -These functions return a value greater than or equal to zero if -neither argument is NaN, and @var{a} is greater than or equal to -@var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __ltsf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __ltdf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __lttf2 (long double @var{a}, long double @var{b}) -These functions return a value less than zero if neither argument is -NaN, and @var{a} is strictly less than @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __lesf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __ledf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __letf2 (long double @var{a}, long double @var{b}) -These functions return a value less than or equal to zero if neither -argument is NaN, and @var{a} is less than or equal to @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __gtsf2 (float @var{a}, float @var{b}) -@deftypefnx {Runtime Function} int __gtdf2 (double @var{a}, double @var{b}) -@deftypefnx {Runtime Function} int __gttf2 (long double @var{a}, long double @var{b}) -These functions return a value greater than zero if neither argument -is NaN, and @var{a} is strictly greater than @var{b}. -@end deftypefn - -@subsection Other floating-point functions - -@deftypefn {Runtime Function} float __powisf2 (float @var{a}, int @var{b}) -@deftypefnx {Runtime Function} double __powidf2 (double @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long double} __powitf2 (long double @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long double} __powixf2 (long double @var{a}, int @var{b}) -These functions convert raise @var{a} to the power @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {complex float} __mulsc3 (float @var{a}, float @var{b}, float @var{c}, float @var{d}) -@deftypefnx {Runtime Function} {complex double} __muldc3 (double @var{a}, double @var{b}, double @var{c}, double @var{d}) -@deftypefnx {Runtime Function} {complex long double} __multc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d}) -@deftypefnx {Runtime Function} {complex long double} __mulxc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d}) -These functions return the product of @math{@var{a} + i@var{b}} and -@math{@var{c} + i@var{d}}, following the rules of C99 Annex G@. -@end deftypefn - -@deftypefn {Runtime Function} {complex float} __divsc3 (float @var{a}, float @var{b}, float @var{c}, float @var{d}) -@deftypefnx {Runtime Function} {complex double} __divdc3 (double @var{a}, double @var{b}, double @var{c}, double @var{d}) -@deftypefnx {Runtime Function} {complex long double} __divtc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d}) -@deftypefnx {Runtime Function} {complex long double} __divxc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d}) -These functions return the quotient of @math{@var{a} + i@var{b}} and -@math{@var{c} + i@var{d}} (i.e., @math{(@var{a} + i@var{b}) / (@var{c} -+ i@var{d})}), following the rules of C99 Annex G@. -@end deftypefn - -@node Decimal float library routines -@section Routines for decimal floating point emulation -@cindex decimal float library -@cindex IEEE 754-2008 - -The software decimal floating point library implements IEEE 754-2008 -decimal floating point arithmetic and is only activated on selected -targets. - -The software decimal floating point library supports either DPD -(Densely Packed Decimal) or BID (Binary Integer Decimal) encoding -as selected at configure time. - - -@subsection Arithmetic functions - -@deftypefn {Runtime Function} _Decimal32 __dpd_addsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal32 __bid_addsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_adddd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __bid_adddd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_addtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __bid_addtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return the sum of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_subsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal32 __bid_subsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_subdd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __bid_subdd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_subtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __bid_subtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return the difference between @var{b} and @var{a}; -that is, @w{@math{@var{a} - @var{b}}}. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_mulsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal32 __bid_mulsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_muldd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __bid_muldd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_multd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __bid_multd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return the product of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_divsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal32 __bid_divsd3 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_divdd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal64 __bid_divdd3 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_divtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} _Decimal128 __bid_divtd3 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return the quotient of @var{a} and @var{b}; that is, -@w{@math{@var{a} / @var{b}}}. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_negsd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_negsd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_negdd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_negdd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_negtd2 (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_negtd2 (_Decimal128 @var{a}) -These functions return the negation of @var{a}. They simply flip the -sign bit, so they can produce negative zero and negative NaN@. -@end deftypefn - -@subsection Conversion functions - -@deftypefn {Runtime Function} _Decimal64 __dpd_extendsddd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_extendsddd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extendsdtd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extendsdtd2 (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extendddtd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extendddtd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __dpd_truncddsd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_truncddsd2 (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __dpd_trunctdsd2 (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_trunctdsd2 (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_trunctddd2 (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_trunctddd2 (_Decimal128 @var{a}) -These functions convert the value @var{a} from one decimal floating type -to another. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal64 __dpd_extendsfdd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_extendsfdd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extendsftd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extendsftd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extenddftd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extenddftd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extendxftd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extendxftd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __dpd_truncdfsd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_truncdfsd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __dpd_truncxfsd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_truncxfsd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __dpd_trunctfsd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_trunctfsd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_truncxfdd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_truncxfdd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_trunctfdd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_trunctfdd ({long double} @var{a}) -These functions convert the value of @var{a} from a binary floating type -to a decimal floating type of a different size. -@end deftypefn - -@deftypefn {Runtime Function} float __dpd_truncddsf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} float __bid_truncddsf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} float __dpd_trunctdsf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} float __bid_trunctdsf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} double __dpd_extendsddf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} double __bid_extendsddf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} double __dpd_trunctddf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} double __bid_trunctddf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_extendsdxf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_extendsdxf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_extendddxf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_extendddxf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_trunctdxf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_trunctdxf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_extendsdtf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_extendsdtf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_extendddtf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_extendddtf (_Decimal64 @var{a}) -These functions convert the value of @var{a} from a decimal floating type -to a binary floating type of a different size. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_extendsfsd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal32 __bid_extendsfsd (float @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_extenddfdd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal64 __bid_extenddfdd (double @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_extendtftd ({long double} @var{a}) -@deftypefnx {Runtime Function} _Decimal128 __bid_extendtftd ({long double} @var{a}) -@deftypefnx {Runtime Function} float __dpd_truncsdsf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} float __bid_truncsdsf (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} double __dpd_truncdddf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} double __bid_truncdddf (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {long double} __dpd_trunctdtf (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {long double} __bid_trunctdtf (_Decimal128 @var{a}) -These functions convert the value of @var{a} between decimal and -binary floating types of the same size. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_fixsdsi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} int __bid_fixsdsi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} int __dpd_fixddsi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} int __bid_fixddsi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} int __dpd_fixtdsi (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} int __bid_fixtdsi (_Decimal128 @var{a}) -These functions convert @var{a} to a signed integer. -@end deftypefn - -@deftypefn {Runtime Function} long __dpd_fixsddi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} long __bid_fixsddi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} long __dpd_fixdddi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} long __bid_fixdddi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} long __dpd_fixtddi (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} long __bid_fixtddi (_Decimal128 @var{a}) -These functions convert @var{a} to a signed long. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned int} __dpd_fixunssdsi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __bid_fixunssdsi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __dpd_fixunsddsi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __bid_fixunsddsi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __dpd_fixunstdsi (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __bid_fixunstdsi (_Decimal128 @var{a}) -These functions convert @var{a} to an unsigned integer. Negative values all become zero. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned long} __dpd_fixunssddi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __bid_fixunssddi (_Decimal32 @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __dpd_fixunsdddi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __bid_fixunsdddi (_Decimal64 @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __dpd_fixunstddi (_Decimal128 @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __bid_fixunstddi (_Decimal128 @var{a}) -These functions convert @var{a} to an unsigned long. Negative values -all become zero. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_floatsisd (int @var{i}) -@deftypefnx {Runtime Function} _Decimal32 __bid_floatsisd (int @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_floatsidd (int @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __bid_floatsidd (int @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_floatsitd (int @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __bid_floatsitd (int @var{i}) -These functions convert @var{i}, a signed integer, to decimal floating point. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_floatdisd (long @var{i}) -@deftypefnx {Runtime Function} _Decimal32 __bid_floatdisd (long @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_floatdidd (long @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __bid_floatdidd (long @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_floatditd (long @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __bid_floatditd (long @var{i}) -These functions convert @var{i}, a signed long, to decimal floating point. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_floatunssisd (unsigned int @var{i}) -@deftypefnx {Runtime Function} _Decimal32 __bid_floatunssisd (unsigned int @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_floatunssidd (unsigned int @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __bid_floatunssidd (unsigned int @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_floatunssitd (unsigned int @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __bid_floatunssitd (unsigned int @var{i}) -These functions convert @var{i}, an unsigned integer, to decimal floating point. -@end deftypefn - -@deftypefn {Runtime Function} _Decimal32 __dpd_floatunsdisd (unsigned long @var{i}) -@deftypefnx {Runtime Function} _Decimal32 __bid_floatunsdisd (unsigned long @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __dpd_floatunsdidd (unsigned long @var{i}) -@deftypefnx {Runtime Function} _Decimal64 __bid_floatunsdidd (unsigned long @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __dpd_floatunsditd (unsigned long @var{i}) -@deftypefnx {Runtime Function} _Decimal128 __bid_floatunsditd (unsigned long @var{i}) -These functions convert @var{i}, an unsigned long, to decimal floating point. -@end deftypefn - -@subsection Comparison functions - -@deftypefn {Runtime Function} int __dpd_unordsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_unordsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_unorddd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_unorddd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_unordtd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_unordtd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a nonzero value if either argument is NaN, otherwise 0. -@end deftypefn - -There is also a complete group of higher level functions which -correspond directly to comparison operators. They implement the ISO C -semantics for floating-point comparisons, taking NaN into account. -Pay careful attention to the return values defined for each set. -Under the hood, all of these routines are implemented as - -@smallexample - if (__bid_unord@var{X}d2 (a, b)) - return @var{E}; - return __bid_cmp@var{X}d2 (a, b); -@end smallexample - -@noindent -where @var{E} is a constant chosen to give the proper behavior for -NaN@. Thus, the meaning of the return value is different for each set. -Do not rely on this implementation; only the semantics documented -below are guaranteed. - -@deftypefn {Runtime Function} int __dpd_eqsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_eqsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_eqdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_eqdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_eqtd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_eqtd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return zero if neither argument is NaN, and @var{a} and -@var{b} are equal. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_nesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_nesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_nedd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_nedd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_netd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_netd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a nonzero value if either argument is NaN, or -if @var{a} and @var{b} are unequal. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_gesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_gesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_gedd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_gedd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_getd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_getd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a value greater than or equal to zero if -neither argument is NaN, and @var{a} is greater than or equal to -@var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_ltsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_ltsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_ltdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_ltdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_lttd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_lttd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a value less than zero if neither argument is -NaN, and @var{a} is strictly less than @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_lesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_lesd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_ledd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_ledd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_letd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_letd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a value less than or equal to zero if neither -argument is NaN, and @var{a} is less than or equal to @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} int __dpd_gtsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __bid_gtsd2 (_Decimal32 @var{a}, _Decimal32 @var{b}) -@deftypefnx {Runtime Function} int __dpd_gtdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __bid_gtdd2 (_Decimal64 @var{a}, _Decimal64 @var{b}) -@deftypefnx {Runtime Function} int __dpd_gttd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -@deftypefnx {Runtime Function} int __bid_gttd2 (_Decimal128 @var{a}, _Decimal128 @var{b}) -These functions return a value greater than zero if neither argument -is NaN, and @var{a} is strictly greater than @var{b}. -@end deftypefn - -@node Fixed-point fractional library routines -@section Routines for fixed-point fractional emulation -@cindex fixed-point fractional library -@cindex fractional types -@cindex Embedded C - -The software fixed-point library implements fixed-point fractional -arithmetic, and is only activated on selected targets. - -For ease of comprehension @code{fract} is an alias for the -@code{_Fract} type, @code{accum} an alias for @code{_Accum}, and -@code{sat} an alias for @code{_Sat}. - -For illustrative purposes, in this section the fixed-point fractional type -@code{@w{short fract}} is assumed to correspond to machine mode @code{QQmode}; -@code{@w{unsigned short fract}} to @code{UQQmode}; -@code{fract} to @code{HQmode}; -@code{@w{unsigned fract}} to @code{UHQmode}; -@code{@w{long fract}} to @code{SQmode}; -@code{@w{unsigned long fract}} to @code{USQmode}; -@code{@w{long long fract}} to @code{DQmode}; -and @code{@w{unsigned long long fract}} to @code{UDQmode}. -Similarly the fixed-point accumulator type -@code{@w{short accum}} corresponds to @code{HAmode}; -@code{@w{unsigned short accum}} to @code{UHAmode}; -@code{accum} to @code{SAmode}; -@code{@w{unsigned accum}} to @code{USAmode}; -@code{@w{long accum}} to @code{DAmode}; -@code{@w{unsigned long accum}} to @code{UDAmode}; -@code{@w{long long accum}} to @code{TAmode}; -and @code{@w{unsigned long long accum}} to @code{UTAmode}. - -@subsection Arithmetic functions - -@deftypefn {Runtime Function} {short fract} __addqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __addhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __addsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __adddq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short fract} __adduqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __adduhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __addusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __addudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __addha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __addsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __addda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __addta3 (long long accum @var{a}, long long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __adduha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __addusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __adduda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __adduta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the sum of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ssaddqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __ssaddhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __ssaddsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ssadddq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __ssaddha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __ssaddsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __ssaddda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ssaddta3 (long long accum @var{a}, long long accum @var{b}) -These functions return the sum of @var{a} and @var{b} with signed saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __usadduqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __usadduhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __usaddusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __usaddudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __usadduha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __usaddusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __usadduda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __usadduta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the sum of @var{a} and @var{b} with unsigned saturation. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __subqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __subhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __subsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __subdq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short fract} __subuqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __subuhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __subusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __subudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __subha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __subsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __subda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __subta3 (long long accum @var{a}, long long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __subuha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __subusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __subuda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __subuta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the difference of @var{a} and @var{b}; -that is, @code{@var{a} - @var{b}}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __sssubqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __sssubhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __sssubsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __sssubdq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __sssubha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __sssubsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __sssubda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __sssubta3 (long long accum @var{a}, long long accum @var{b}) -These functions return the difference of @var{a} and @var{b} with signed -saturation; that is, @code{@var{a} - @var{b}}. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __ussubuqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __ussubuhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __ussubusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __ussubudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __ussubuha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __ussubusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __ussubuda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __ussubuta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the difference of @var{a} and @var{b} with unsigned -saturation; that is, @code{@var{a} - @var{b}}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __mulqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __mulhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __mulsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __muldq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short fract} __muluqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __muluhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __mulusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __muludq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __mulha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __mulsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __mulda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __multa3 (long long accum @var{a}, long long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __muluha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __mulusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __muluda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __muluta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the product of @var{a} and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ssmulqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __ssmulhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __ssmulsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ssmuldq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __ssmulha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __ssmulsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __ssmulda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ssmulta3 (long long accum @var{a}, long long accum @var{b}) -These functions return the product of @var{a} and @var{b} with signed -saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __usmuluqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __usmuluhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __usmulusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __usmuludq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __usmuluha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __usmulusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __usmuluda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __usmuluta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the product of @var{a} and @var{b} with unsigned -saturation. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __divqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __divhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __divsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __divdq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __divha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __divsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __divda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __divta3 (long long accum @var{a}, long long accum @var{b}) -These functions return the quotient of the signed division of @var{a} -and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __udivuqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __udivuhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __udivusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __udivudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __udivuha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __udivusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __udivuda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __udivuta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the quotient of the unsigned division of @var{a} -and @var{b}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ssdivqq3 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {fract} __ssdivhq3 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {long fract} __ssdivsq3 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ssdivdq3 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {short accum} __ssdivha3 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {accum} __ssdivsa3 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {long accum} __ssdivda3 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ssdivta3 (long long accum @var{a}, long long accum @var{b}) -These functions return the quotient of the signed division of @var{a} -and @var{b} with signed saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __usdivuqq3 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __usdivuhq3 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __usdivusq3 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __usdivudq3 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __usdivuha3 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __usdivusa3 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __usdivuda3 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __usdivuta3 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions return the quotient of the unsigned division of @var{a} -and @var{b} with unsigned saturation. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __negqq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {fract} __neghq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __negsq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __negdq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __neguqq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __neguhq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __negusq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __negudq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __negha2 (short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __negsa2 (accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __negda2 (long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __negta2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __neguha2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __negusa2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __neguda2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __neguta2 (unsigned long long accum @var{a}) -These functions return the negation of @var{a}. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ssnegqq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {fract} __ssneghq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __ssnegsq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __ssnegdq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __ssnegha2 (short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __ssnegsa2 (accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __ssnegda2 (long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __ssnegta2 (long long accum @var{a}) -These functions return the negation of @var{a} with signed saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __usneguqq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __usneguhq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __usnegusq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __usnegudq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __usneguha2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __usnegusa2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __usneguda2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __usneguta2 (unsigned long long accum @var{a}) -These functions return the negation of @var{a} with unsigned saturation. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ashlqq3 (short fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {fract} __ashlhq3 (fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long fract} __ashlsq3 (long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ashldq3 (long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned short fract} __ashluqq3 (unsigned short fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __ashluhq3 (unsigned fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __ashlusq3 (unsigned long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __ashludq3 (unsigned long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {short accum} __ashlha3 (short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {accum} __ashlsa3 (accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long accum} __ashlda3 (long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ashlta3 (long long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __ashluha3 (unsigned short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __ashlusa3 (unsigned accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __ashluda3 (unsigned long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __ashluta3 (unsigned long long accum @var{a}, int @var{b}) -These functions return the result of shifting @var{a} left by @var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __ashrqq3 (short fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {fract} __ashrhq3 (fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long fract} __ashrsq3 (long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ashrdq3 (long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {short accum} __ashrha3 (short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {accum} __ashrsa3 (accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long accum} __ashrda3 (long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ashrta3 (long long accum @var{a}, int @var{b}) -These functions return the result of arithmetically shifting @var{a} right -by @var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __lshruqq3 (unsigned short fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __lshruhq3 (unsigned fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __lshrusq3 (unsigned long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __lshrudq3 (unsigned long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __lshruha3 (unsigned short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __lshrusa3 (unsigned accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __lshruda3 (unsigned long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __lshruta3 (unsigned long long accum @var{a}, int @var{b}) -These functions return the result of logically shifting @var{a} right -by @var{b} bits. -@end deftypefn - -@deftypefn {Runtime Function} {fract} __ssashlhq3 (fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long fract} __ssashlsq3 (long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long fract} __ssashldq3 (long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {short accum} __ssashlha3 (short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {accum} __ssashlsa3 (accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long accum} __ssashlda3 (long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {long long accum} __ssashlta3 (long long accum @var{a}, int @var{b}) -These functions return the result of shifting @var{a} left by @var{b} bits -with signed saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned short fract} __usashluqq3 (unsigned short fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned fract} __usashluhq3 (unsigned fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long fract} __usashlusq3 (unsigned long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long fract} __usashludq3 (unsigned long long fract @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned short accum} __usashluha3 (unsigned short accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned accum} __usashlusa3 (unsigned accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long accum} __usashluda3 (unsigned long accum @var{a}, int @var{b}) -@deftypefnx {Runtime Function} {unsigned long long accum} __usashluta3 (unsigned long long accum @var{a}, int @var{b}) -These functions return the result of shifting @var{a} left by @var{b} bits -with unsigned saturation. -@end deftypefn - -@subsection Comparison functions - -The following functions implement fixed-point comparisons. These functions -implement a low-level compare, upon which the higher level comparison -operators (such as less than and greater than or equal to) can be -constructed. The returned values lie in the range zero to two, to allow -the high-level operators to be implemented by testing the returned -result using either signed or unsigned comparison. - -@deftypefn {Runtime Function} {int} __cmpqq2 (short fract @var{a}, short fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmphq2 (fract @var{a}, fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpsq2 (long fract @var{a}, long fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpdq2 (long long fract @var{a}, long long fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpuqq2 (unsigned short fract @var{a}, unsigned short fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpuhq2 (unsigned fract @var{a}, unsigned fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpusq2 (unsigned long fract @var{a}, unsigned long fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpudq2 (unsigned long long fract @var{a}, unsigned long long fract @var{b}) -@deftypefnx {Runtime Function} {int} __cmpha2 (short accum @var{a}, short accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpsa2 (accum @var{a}, accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpda2 (long accum @var{a}, long accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpta2 (long long accum @var{a}, long long accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpuha2 (unsigned short accum @var{a}, unsigned short accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpusa2 (unsigned accum @var{a}, unsigned accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmpuda2 (unsigned long accum @var{a}, unsigned long accum @var{b}) -@deftypefnx {Runtime Function} {int} __cmputa2 (unsigned long long accum @var{a}, unsigned long long accum @var{b}) -These functions perform a signed or unsigned comparison of @var{a} and -@var{b} (depending on the selected machine mode). If @var{a} is less -than @var{b}, they return 0; if @var{a} is greater than @var{b}, they -return 2; and if @var{a} and @var{b} are equal they return 1. -@end deftypefn - -@subsection Conversion functions - -@deftypefn {Runtime Function} {fract} __fractqqhq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractqqsq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractqqdq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractqqha (short fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractqqsa (short fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractqqda (short fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractqqta (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractqquqq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractqquhq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractqqusq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractqqudq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractqquha (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractqqusa (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractqquda (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractqquta (short fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractqqqi (short fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractqqhi (short fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractqqsi (short fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractqqdi (short fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractqqti (short fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractqqsf (short fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractqqdf (short fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fracthqqq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fracthqsq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fracthqdq2 (fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fracthqha (fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fracthqsa (fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fracthqda (fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fracthqta (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fracthquqq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fracthquhq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fracthqusq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fracthqudq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fracthquha (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fracthqusa (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fracthquda (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fracthquta (fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fracthqqi (fract @var{a}) -@deftypefnx {Runtime Function} {short} __fracthqhi (fract @var{a}) -@deftypefnx {Runtime Function} {int} __fracthqsi (fract @var{a}) -@deftypefnx {Runtime Function} {long} __fracthqdi (fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fracthqti (fract @var{a}) -@deftypefnx {Runtime Function} {float} __fracthqsf (fract @var{a}) -@deftypefnx {Runtime Function} {double} __fracthqdf (fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractsqqq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractsqhq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractsqdq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractsqha (long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractsqsa (long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractsqda (long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractsqta (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractsquqq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractsquhq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractsqusq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractsqudq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractsquha (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractsqusa (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractsquda (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractsquta (long fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractsqqi (long fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractsqhi (long fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractsqsi (long fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractsqdi (long fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractsqti (long fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractsqsf (long fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractsqdf (long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractdqqq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractdqhq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractdqsq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractdqha (long long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractdqsa (long long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractdqda (long long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractdqta (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractdquqq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractdquhq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractdqusq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractdqudq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractdquha (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractdqusa (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractdquda (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractdquta (long long fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractdqqi (long long fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractdqhi (long long fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractdqsi (long long fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractdqdi (long long fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractdqti (long long fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractdqsf (long long fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractdqdf (long long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fracthaqq (short accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fracthahq (short accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fracthasq (short accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fracthadq (short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fracthasa2 (short accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fracthada2 (short accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fracthata2 (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fracthauqq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fracthauhq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fracthausq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fracthaudq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fracthauha (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fracthausa (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fracthauda (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fracthauta (short accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fracthaqi (short accum @var{a}) -@deftypefnx {Runtime Function} {short} __fracthahi (short accum @var{a}) -@deftypefnx {Runtime Function} {int} __fracthasi (short accum @var{a}) -@deftypefnx {Runtime Function} {long} __fracthadi (short accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fracthati (short accum @var{a}) -@deftypefnx {Runtime Function} {float} __fracthasf (short accum @var{a}) -@deftypefnx {Runtime Function} {double} __fracthadf (short accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractsaqq (accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractsahq (accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractsasq (accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractsadq (accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractsaha2 (accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractsada2 (accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractsata2 (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractsauqq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractsauhq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractsausq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractsaudq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractsauha (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractsausa (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractsauda (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractsauta (accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractsaqi (accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractsahi (accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractsasi (accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractsadi (accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractsati (accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractsasf (accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractsadf (accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractdaqq (long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractdahq (long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractdasq (long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractdadq (long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractdaha2 (long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fractdasa2 (long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractdata2 (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractdauqq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractdauhq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractdausq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractdaudq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractdauha (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractdausa (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractdauda (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractdauta (long accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractdaqi (long accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractdahi (long accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractdasi (long accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractdadi (long accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractdati (long accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractdasf (long accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractdadf (long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fracttaqq (long long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fracttahq (long long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fracttasq (long long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fracttadq (long long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fracttaha2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fracttasa2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fracttada2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fracttauqq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fracttauhq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fracttausq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fracttaudq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fracttauha (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fracttausa (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fracttauda (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fracttauta (long long accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fracttaqi (long long accum @var{a}) -@deftypefnx {Runtime Function} {short} __fracttahi (long long accum @var{a}) -@deftypefnx {Runtime Function} {int} __fracttasi (long long accum @var{a}) -@deftypefnx {Runtime Function} {long} __fracttadi (long long accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fracttati (long long accum @var{a}) -@deftypefnx {Runtime Function} {float} __fracttasf (long long accum @var{a}) -@deftypefnx {Runtime Function} {double} __fracttadf (long long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractuqqqq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractuqqhq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractuqqsq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractuqqdq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractuqqha (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractuqqsa (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractuqqda (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractuqqta (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractuqquhq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractuqqusq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractuqqudq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractuqquha (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractuqqusa (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractuqquda (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractuqquta (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractuqqqi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractuqqhi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractuqqsi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractuqqdi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractuqqti (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractuqqsf (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractuqqdf (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractuhqqq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractuhqhq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractuhqsq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractuhqdq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractuhqha (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractuhqsa (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractuhqda (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractuhqta (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractuhquqq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractuhqusq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractuhqudq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractuhquha (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractuhqusa (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractuhquda (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractuhquta (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractuhqqi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractuhqhi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractuhqsi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractuhqdi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractuhqti (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractuhqsf (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractuhqdf (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractusqqq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractusqhq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractusqsq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractusqdq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractusqha (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractusqsa (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractusqda (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractusqta (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractusquqq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractusquhq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractusqudq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractusquha (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractusqusa (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractusquda (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractusquta (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractusqqi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractusqhi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractusqsi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractusqdi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractusqti (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractusqsf (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractusqdf (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractudqqq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __fractudqhq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractudqsq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractudqdq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractudqha (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __fractudqsa (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractudqda (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractudqta (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractudquqq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractudquhq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractudqusq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractudquha (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractudqusa (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractudquda (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractudquta (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractudqqi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short} __fractudqhi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {int} __fractudqsi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long} __fractudqdi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long long} __fractudqti (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {float} __fractudqsf (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {double} __fractudqdf (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractuhaqq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractuhahq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractuhasq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractuhadq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractuhaha (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fractuhasa (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractuhada (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractuhata (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractuhauqq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractuhauhq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractuhausq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractuhaudq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractuhausa2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractuhauda2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractuhauta2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractuhaqi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractuhahi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractuhasi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractuhadi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractuhati (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractuhasf (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractuhadf (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractusaqq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractusahq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractusasq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractusadq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractusaha (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fractusasa (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractusada (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractusata (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractusauqq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractusauhq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractusausq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractusaudq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractusauha2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractusauda2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractusauta2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractusaqi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractusahi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractusasi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractusadi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractusati (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractusasf (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractusadf (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractudaqq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractudahq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractudasq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractudadq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractudaha (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fractudasa (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractudada (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractudata (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractudauqq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractudauhq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractudausq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractudaudq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractudauha2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractudausa2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractudauta2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractudaqi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractudahi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractudasi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractudadi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractudati (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractudasf (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractudadf (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractutaqq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __fractutahq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractutasq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractutadq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractutaha (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __fractutasa (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractutada (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractutata (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractutauqq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractutauhq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractutausq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractutaudq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractutauha2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractutausa2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractutauda2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {signed char} __fractutaqi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short} __fractutahi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {int} __fractutasi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long} __fractutadi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long long} __fractutati (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {float} __fractutasf (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {double} __fractutadf (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractqiqq (signed char @var{a}) -@deftypefnx {Runtime Function} {fract} __fractqihq (signed char @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractqisq (signed char @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractqidq (signed char @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractqiha (signed char @var{a}) -@deftypefnx {Runtime Function} {accum} __fractqisa (signed char @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractqida (signed char @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractqita (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractqiuqq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractqiuhq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractqiusq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractqiudq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractqiuha (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractqiusa (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractqiuda (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractqiuta (signed char @var{a}) -@deftypefnx {Runtime Function} {short fract} __fracthiqq (short @var{a}) -@deftypefnx {Runtime Function} {fract} __fracthihq (short @var{a}) -@deftypefnx {Runtime Function} {long fract} __fracthisq (short @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fracthidq (short @var{a}) -@deftypefnx {Runtime Function} {short accum} __fracthiha (short @var{a}) -@deftypefnx {Runtime Function} {accum} __fracthisa (short @var{a}) -@deftypefnx {Runtime Function} {long accum} __fracthida (short @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fracthita (short @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fracthiuqq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fracthiuhq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fracthiusq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fracthiudq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fracthiuha (short @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fracthiusa (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fracthiuda (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fracthiuta (short @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractsiqq (int @var{a}) -@deftypefnx {Runtime Function} {fract} __fractsihq (int @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractsisq (int @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractsidq (int @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractsiha (int @var{a}) -@deftypefnx {Runtime Function} {accum} __fractsisa (int @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractsida (int @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractsita (int @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractsiuqq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractsiuhq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractsiusq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractsiudq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractsiuha (int @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractsiusa (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractsiuda (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractsiuta (int @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractdiqq (long @var{a}) -@deftypefnx {Runtime Function} {fract} __fractdihq (long @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractdisq (long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractdidq (long @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractdiha (long @var{a}) -@deftypefnx {Runtime Function} {accum} __fractdisa (long @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractdida (long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractdita (long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractdiuqq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractdiuhq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractdiusq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractdiudq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractdiuha (long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractdiusa (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractdiuda (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractdiuta (long @var{a}) -@deftypefnx {Runtime Function} {short fract} __fracttiqq (long long @var{a}) -@deftypefnx {Runtime Function} {fract} __fracttihq (long long @var{a}) -@deftypefnx {Runtime Function} {long fract} __fracttisq (long long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fracttidq (long long @var{a}) -@deftypefnx {Runtime Function} {short accum} __fracttiha (long long @var{a}) -@deftypefnx {Runtime Function} {accum} __fracttisa (long long @var{a}) -@deftypefnx {Runtime Function} {long accum} __fracttida (long long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fracttita (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fracttiuqq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fracttiuhq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fracttiusq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fracttiudq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fracttiuha (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fracttiusa (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fracttiuda (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fracttiuta (long long @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractsfqq (float @var{a}) -@deftypefnx {Runtime Function} {fract} __fractsfhq (float @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractsfsq (float @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractsfdq (float @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractsfha (float @var{a}) -@deftypefnx {Runtime Function} {accum} __fractsfsa (float @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractsfda (float @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractsfta (float @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractsfuqq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractsfuhq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractsfusq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractsfudq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractsfuha (float @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractsfusa (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractsfuda (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractsfuta (float @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractdfqq (double @var{a}) -@deftypefnx {Runtime Function} {fract} __fractdfhq (double @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractdfsq (double @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractdfdq (double @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractdfha (double @var{a}) -@deftypefnx {Runtime Function} {accum} __fractdfsa (double @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractdfda (double @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractdfta (double @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractdfuqq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractdfuhq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractdfusq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractdfudq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractdfuha (double @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractdfusa (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractdfuda (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractdfuta (double @var{a}) -These functions convert from fractional and signed non-fractionals to -fractionals and signed non-fractionals, without saturation. -@end deftypefn - -@deftypefn {Runtime Function} {fract} __satfractqqhq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractqqsq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractqqdq2 (short fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractqqha (short fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractqqsa (short fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractqqda (short fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractqqta (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractqquqq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractqquhq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractqqusq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractqqudq (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractqquha (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractqqusa (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractqquda (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractqquta (short fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfracthqqq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfracthqsq2 (fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfracthqdq2 (fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfracthqha (fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfracthqsa (fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfracthqda (fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfracthqta (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfracthquqq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfracthquhq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfracthqusq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfracthqudq (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfracthquha (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfracthqusa (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfracthquda (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfracthquta (fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractsqqq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractsqhq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractsqdq2 (long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractsqha (long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractsqsa (long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractsqda (long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractsqta (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractsquqq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractsquhq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractsqusq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractsqudq (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractsquha (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractsqusa (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractsquda (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractsquta (long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractdqqq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractdqhq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractdqsq2 (long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractdqha (long long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractdqsa (long long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractdqda (long long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractdqta (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractdquqq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractdquhq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractdqusq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractdqudq (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractdquha (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractdqusa (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractdquda (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractdquta (long long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfracthaqq (short accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfracthahq (short accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfracthasq (short accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfracthadq (short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfracthasa2 (short accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfracthada2 (short accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfracthata2 (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfracthauqq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfracthauhq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfracthausq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfracthaudq (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfracthauha (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfracthausa (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfracthauda (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfracthauta (short accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractsaqq (accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractsahq (accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractsasq (accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractsadq (accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractsaha2 (accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractsada2 (accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractsata2 (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractsauqq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractsauhq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractsausq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractsaudq (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractsauha (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractsausa (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractsauda (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractsauta (accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractdaqq (long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractdahq (long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractdasq (long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractdadq (long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractdaha2 (long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractdasa2 (long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractdata2 (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractdauqq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractdauhq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractdausq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractdaudq (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractdauha (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractdausa (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractdauda (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractdauta (long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfracttaqq (long long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfracttahq (long long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfracttasq (long long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfracttadq (long long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfracttaha2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfracttasa2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfracttada2 (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfracttauqq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfracttauhq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfracttausq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfracttaudq (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfracttauha (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfracttausa (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfracttauda (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfracttauta (long long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractuqqqq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractuqqhq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractuqqsq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractuqqdq (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractuqqha (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractuqqsa (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractuqqda (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractuqqta (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractuqquhq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractuqqusq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractuqqudq2 (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractuqquha (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractuqqusa (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractuqquda (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractuqquta (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractuhqqq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractuhqhq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractuhqsq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractuhqdq (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractuhqha (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractuhqsa (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractuhqda (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractuhqta (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractuhquqq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractuhqusq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractuhqudq2 (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractuhquha (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractuhqusa (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractuhquda (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractuhquta (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractusqqq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractusqhq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractusqsq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractusqdq (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractusqha (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractusqsa (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractusqda (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractusqta (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractusquqq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractusquhq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractusqudq2 (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractusquha (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractusqusa (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractusquda (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractusquta (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractudqqq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractudqhq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractudqsq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractudqdq (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractudqha (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractudqsa (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractudqda (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractudqta (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractudquqq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractudquhq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractudqusq2 (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractudquha (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractudqusa (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractudquda (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractudquta (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractuhaqq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractuhahq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractuhasq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractuhadq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractuhaha (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractuhasa (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractuhada (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractuhata (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractuhauqq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractuhauhq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractuhausq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractuhaudq (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractuhausa2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractuhauda2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractuhauta2 (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractusaqq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractusahq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractusasq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractusadq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractusaha (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractusasa (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractusada (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractusata (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractusauqq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractusauhq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractusausq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractusaudq (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractusauha2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractusauda2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractusauta2 (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractudaqq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractudahq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractudasq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractudadq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractudaha (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractudasa (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractudada (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractudata (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractudauqq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractudauhq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractudausq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractudaudq (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractudauha2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractudausa2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractudauta2 (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractutaqq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractutahq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractutasq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractutadq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractutaha (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractutasa (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractutada (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractutata (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractutauqq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractutauhq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractutausq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractutaudq (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractutauha2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractutausa2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractutauda2 (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractqiqq (signed char @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractqihq (signed char @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractqisq (signed char @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractqidq (signed char @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractqiha (signed char @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractqisa (signed char @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractqida (signed char @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractqita (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractqiuqq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractqiuhq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractqiusq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractqiudq (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractqiuha (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractqiusa (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractqiuda (signed char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractqiuta (signed char @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfracthiqq (short @var{a}) -@deftypefnx {Runtime Function} {fract} __satfracthihq (short @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfracthisq (short @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfracthidq (short @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfracthiha (short @var{a}) -@deftypefnx {Runtime Function} {accum} __satfracthisa (short @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfracthida (short @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfracthita (short @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfracthiuqq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfracthiuhq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfracthiusq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfracthiudq (short @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfracthiuha (short @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfracthiusa (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfracthiuda (short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfracthiuta (short @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractsiqq (int @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractsihq (int @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractsisq (int @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractsidq (int @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractsiha (int @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractsisa (int @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractsida (int @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractsita (int @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractsiuqq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractsiuhq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractsiusq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractsiudq (int @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractsiuha (int @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractsiusa (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractsiuda (int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractsiuta (int @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractdiqq (long @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractdihq (long @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractdisq (long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractdidq (long @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractdiha (long @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractdisa (long @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractdida (long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractdita (long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractdiuqq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractdiuhq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractdiusq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractdiudq (long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractdiuha (long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractdiusa (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractdiuda (long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractdiuta (long @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfracttiqq (long long @var{a}) -@deftypefnx {Runtime Function} {fract} __satfracttihq (long long @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfracttisq (long long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfracttidq (long long @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfracttiha (long long @var{a}) -@deftypefnx {Runtime Function} {accum} __satfracttisa (long long @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfracttida (long long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfracttita (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfracttiuqq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfracttiuhq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfracttiusq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfracttiudq (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfracttiuha (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfracttiusa (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfracttiuda (long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfracttiuta (long long @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractsfqq (float @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractsfhq (float @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractsfsq (float @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractsfdq (float @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractsfha (float @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractsfsa (float @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractsfda (float @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractsfta (float @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractsfuqq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractsfuhq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractsfusq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractsfudq (float @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractsfuha (float @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractsfusa (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractsfuda (float @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractsfuta (float @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractdfqq (double @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractdfhq (double @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractdfsq (double @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractdfdq (double @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractdfha (double @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractdfsa (double @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractdfda (double @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractdfta (double @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractdfuqq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractdfuhq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractdfusq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractdfudq (double @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractdfuha (double @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractdfusa (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractdfuda (double @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractdfuta (double @var{a}) -The functions convert from fractional and signed non-fractionals to -fractionals, with saturation. -@end deftypefn - -@deftypefn {Runtime Function} {unsigned char} __fractunsqqqi (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsqqhi (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsqqsi (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsqqdi (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsqqti (short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunshqqi (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunshqhi (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunshqsi (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunshqdi (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunshqti (fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunssqqi (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunssqhi (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunssqsi (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunssqdi (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunssqti (long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsdqqi (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsdqhi (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsdqsi (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsdqdi (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsdqti (long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunshaqi (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunshahi (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunshasi (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunshadi (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunshati (short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunssaqi (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunssahi (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunssasi (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunssadi (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunssati (accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsdaqi (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsdahi (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsdasi (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsdadi (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsdati (long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunstaqi (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunstahi (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunstasi (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunstadi (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunstati (long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsuqqqi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsuqqhi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsuqqsi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsuqqdi (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsuqqti (unsigned short fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsuhqqi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsuhqhi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsuhqsi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsuhqdi (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsuhqti (unsigned fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsusqqi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsusqhi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsusqsi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsusqdi (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsusqti (unsigned long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsudqqi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsudqhi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsudqsi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsudqdi (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsudqti (unsigned long long fract @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsuhaqi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsuhahi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsuhasi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsuhadi (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsuhati (unsigned short accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsusaqi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsusahi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsusasi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsusadi (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsusati (unsigned accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsudaqi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsudahi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsudasi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsudadi (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsudati (unsigned long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned char} __fractunsutaqi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned short} __fractunsutahi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned int} __fractunsutasi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long} __fractunsutadi (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {unsigned long long} __fractunsutati (unsigned long long accum @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractunsqiqq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {fract} __fractunsqihq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractunsqisq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractunsqidq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractunsqiha (unsigned char @var{a}) -@deftypefnx {Runtime Function} {accum} __fractunsqisa (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractunsqida (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractunsqita (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractunsqiuqq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractunsqiuhq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractunsqiusq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractunsqiudq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractunsqiuha (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractunsqiusa (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractunsqiuda (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractunsqiuta (unsigned char @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractunshiqq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {fract} __fractunshihq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractunshisq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractunshidq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractunshiha (unsigned short @var{a}) -@deftypefnx {Runtime Function} {accum} __fractunshisa (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractunshida (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractunshita (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractunshiuqq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractunshiuhq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractunshiusq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractunshiudq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractunshiuha (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractunshiusa (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractunshiuda (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractunshiuta (unsigned short @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractunssiqq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {fract} __fractunssihq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractunssisq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractunssidq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractunssiha (unsigned int @var{a}) -@deftypefnx {Runtime Function} {accum} __fractunssisa (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractunssida (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractunssita (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractunssiuqq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractunssiuhq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractunssiusq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractunssiudq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractunssiuha (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractunssiusa (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractunssiuda (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractunssiuta (unsigned int @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractunsdiqq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {fract} __fractunsdihq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractunsdisq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractunsdidq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractunsdiha (unsigned long @var{a}) -@deftypefnx {Runtime Function} {accum} __fractunsdisa (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractunsdida (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractunsdita (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractunsdiuqq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractunsdiuhq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractunsdiusq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractunsdiudq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractunsdiuha (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractunsdiusa (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractunsdiuda (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractunsdiuta (unsigned long @var{a}) -@deftypefnx {Runtime Function} {short fract} __fractunstiqq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {fract} __fractunstihq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long fract} __fractunstisq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __fractunstidq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {short accum} __fractunstiha (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {accum} __fractunstisa (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long accum} __fractunstida (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __fractunstita (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __fractunstiuqq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __fractunstiuhq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __fractunstiusq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __fractunstiudq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __fractunstiuha (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __fractunstiusa (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __fractunstiuda (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __fractunstiuta (unsigned long long @var{a}) -These functions convert from fractionals to unsigned non-fractionals; -and from unsigned non-fractionals to fractionals, without saturation. -@end deftypefn - -@deftypefn {Runtime Function} {short fract} __satfractunsqiqq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractunsqihq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractunsqisq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractunsqidq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractunsqiha (unsigned char @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractunsqisa (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractunsqida (unsigned char @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractunsqita (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractunsqiuqq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractunsqiuhq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractunsqiusq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractunsqiudq (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractunsqiuha (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractunsqiusa (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractunsqiuda (unsigned char @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractunsqiuta (unsigned char @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractunshiqq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractunshihq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractunshisq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractunshidq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractunshiha (unsigned short @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractunshisa (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractunshida (unsigned short @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractunshita (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractunshiuqq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractunshiuhq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractunshiusq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractunshiudq (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractunshiuha (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractunshiusa (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractunshiuda (unsigned short @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractunshiuta (unsigned short @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractunssiqq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractunssihq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractunssisq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractunssidq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractunssiha (unsigned int @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractunssisa (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractunssida (unsigned int @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractunssita (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractunssiuqq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractunssiuhq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractunssiusq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractunssiudq (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractunssiuha (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractunssiusa (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractunssiuda (unsigned int @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractunssiuta (unsigned int @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractunsdiqq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractunsdihq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractunsdisq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractunsdidq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractunsdiha (unsigned long @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractunsdisa (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractunsdida (unsigned long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractunsdita (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractunsdiuqq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractunsdiuhq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractunsdiusq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractunsdiudq (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractunsdiuha (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractunsdiusa (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractunsdiuda (unsigned long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractunsdiuta (unsigned long @var{a}) -@deftypefnx {Runtime Function} {short fract} __satfractunstiqq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {fract} __satfractunstihq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long fract} __satfractunstisq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long long fract} __satfractunstidq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {short accum} __satfractunstiha (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {accum} __satfractunstisa (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long accum} __satfractunstida (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {long long accum} __satfractunstita (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short fract} __satfractunstiuqq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned fract} __satfractunstiuhq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long fract} __satfractunstiusq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long fract} __satfractunstiudq (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned short accum} __satfractunstiuha (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned accum} __satfractunstiusa (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long accum} __satfractunstiuda (unsigned long long @var{a}) -@deftypefnx {Runtime Function} {unsigned long long accum} __satfractunstiuta (unsigned long long @var{a}) -These functions convert from unsigned non-fractionals to fractionals, -with saturation. -@end deftypefn - -@node Exception handling routines -@section Language-independent routines for exception handling - -document me! - -@smallexample - _Unwind_DeleteException - _Unwind_Find_FDE - _Unwind_ForcedUnwind - _Unwind_GetGR - _Unwind_GetIP - _Unwind_GetLanguageSpecificData - _Unwind_GetRegionStart - _Unwind_GetTextRelBase - _Unwind_GetDataRelBase - _Unwind_RaiseException - _Unwind_Resume - _Unwind_SetGR - _Unwind_SetIP - _Unwind_FindEnclosingFunction - _Unwind_SjLj_Register - _Unwind_SjLj_Unregister - _Unwind_SjLj_RaiseException - _Unwind_SjLj_ForcedUnwind - _Unwind_SjLj_Resume - __deregister_frame - __deregister_frame_info - __deregister_frame_info_bases - __register_frame - __register_frame_info - __register_frame_info_bases - __register_frame_info_table - __register_frame_info_table_bases - __register_frame_table -@end smallexample - -@node Miscellaneous routines -@section Miscellaneous runtime library routines - -@subsection Cache control functions -@deftypefn {Runtime Function} void __clear_cache (char *@var{beg}, char *@var{end}) -This function clears the instruction cache between @var{beg} and @var{end}. -@end deftypefn - -@subsection Split stack functions and variables -@deftypefn {Runtime Function} {void *} __splitstack_find (void *@var{segment_arg}, @ -void *@var{sp}, size_t @var{len}, void **@var{next_segment}, @ -void **@var{next_sp}, void **@var{initial_sp}) -When using @option{-fsplit-stack}, this call may be used to iterate -over the stack segments. It may be called like this: -@smallexample - void *next_segment = NULL; - void *next_sp = NULL; - void *initial_sp = NULL; - void *stack; - size_t stack_size; - while ((stack = __splitstack_find (next_segment, next_sp, - &stack_size, &next_segment, - &next_sp, &initial_sp)) - != NULL) - @{ - /* Stack segment starts at stack and is - stack_size bytes long. */ - @} -@end smallexample - -There is no way to iterate over the stack segments of a different -thread. However, what is permitted is for one thread to call this -with the @var{segment_arg} and @var{sp} arguments NULL, to pass -@var{next_segment}, @var{next_sp}, and @var{initial_sp} to a different -thread, and then to suspend one way or another. A different thread -may run the subsequent @code{__splitstack_find} iterations. Of -course, this will only work if the first thread is suspended while the -second thread is calling @code{__splitstack_find}. If not, the second -thread could be looking at the stack while it is changing, and -anything could happen. -@end deftypefn - -@defvar __morestack_segments -@defvarx __morestack_current_segment -@defvarx __morestack_initial_sp -Internal variables used by the @option{-fsplit-stack} implementation. -@end defvar diff --git a/contrib/gcc-5.0/gcc/doc/loop.texi b/contrib/gcc-5.0/gcc/doc/loop.texi deleted file mode 100644 index 74f6f8dc8d..0000000000 --- a/contrib/gcc-5.0/gcc/doc/loop.texi +++ /dev/null @@ -1,634 +0,0 @@ -@c Copyright (C) 2006-2015 Free Software Foundation, Inc. -@c Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@c --------------------------------------------------------------------- -@c Loop Representation -@c --------------------------------------------------------------------- - -@node Loop Analysis and Representation -@chapter Analysis and Representation of Loops - -GCC provides extensive infrastructure for work with natural loops, i.e., -strongly connected components of CFG with only one entry block. This -chapter describes representation of loops in GCC, both on GIMPLE and in -RTL, as well as the interfaces to loop-related analyses (induction -variable analysis and number of iterations analysis). - -@menu -* Loop representation:: Representation and analysis of loops. -* Loop querying:: Getting information about loops. -* Loop manipulation:: Loop manipulation functions. -* LCSSA:: Loop-closed SSA form. -* Scalar evolutions:: Induction variables on GIMPLE. -* loop-iv:: Induction variables on RTL. -* Number of iterations:: Number of iterations analysis. -* Dependency analysis:: Data dependency analysis. -* Omega:: A solver for linear programming problems. -@end menu - -@node Loop representation -@section Loop representation -@cindex Loop representation -@cindex Loop analysis - -This chapter describes the representation of loops in GCC, and functions -that can be used to build, modify and analyze this representation. Most -of the interfaces and data structures are declared in @file{cfgloop.h}. -Loop structures are analyzed and this information disposed or updated -at the discretion of individual passes. Still most of the generic -CFG manipulation routines are aware of loop structures and try to -keep them up-to-date. By this means an increasing part of the -compilation pipeline is setup to maintain loop structure across -passes to allow attaching meta information to individual loops -for consumption by later passes. - -In general, a natural loop has one entry block (header) and possibly -several back edges (latches) leading to the header from the inside of -the loop. Loops with several latches may appear if several loops share -a single header, or if there is a branching in the middle of the loop. -The representation of loops in GCC however allows only loops with a -single latch. During loop analysis, headers of such loops are split and -forwarder blocks are created in order to disambiguate their structures. -Heuristic based on profile information and structure of the induction -variables in the loops is used to determine whether the latches -correspond to sub-loops or to control flow in a single loop. This means -that the analysis sometimes changes the CFG, and if you run it in the -middle of an optimization pass, you must be able to deal with the new -blocks. You may avoid CFG changes by passing -@code{LOOPS_MAY_HAVE_MULTIPLE_LATCHES} flag to the loop discovery, -note however that most other loop manipulation functions will not work -correctly for loops with multiple latch edges (the functions that only -query membership of blocks to loops and subloop relationships, or -enumerate and test loop exits, can be expected to work). - -Body of the loop is the set of blocks that are dominated by its header, -and reachable from its latch against the direction of edges in CFG@. The -loops are organized in a containment hierarchy (tree) such that all the -loops immediately contained inside loop L are the children of L in the -tree. This tree is represented by the @code{struct loops} structure. -The root of this tree is a fake loop that contains all blocks in the -function. Each of the loops is represented in a @code{struct loop} -structure. Each loop is assigned an index (@code{num} field of the -@code{struct loop} structure), and the pointer to the loop is stored in -the corresponding field of the @code{larray} vector in the loops -structure. The indices do not have to be continuous, there may be -empty (@code{NULL}) entries in the @code{larray} created by deleting -loops. Also, there is no guarantee on the relative order of a loop -and its subloops in the numbering. The index of a loop never changes. - -The entries of the @code{larray} field should not be accessed directly. -The function @code{get_loop} returns the loop description for a loop with -the given index. @code{number_of_loops} function returns number of -loops in the function. To traverse all loops, use @code{FOR_EACH_LOOP} -macro. The @code{flags} argument of the macro is used to determine -the direction of traversal and the set of loops visited. Each loop is -guaranteed to be visited exactly once, regardless of the changes to the -loop tree, and the loops may be removed during the traversal. The newly -created loops are never traversed, if they need to be visited, this -must be done separately after their creation. The @code{FOR_EACH_LOOP} -macro allocates temporary variables. If the @code{FOR_EACH_LOOP} loop -were ended using break or goto, they would not be released; -@code{FOR_EACH_LOOP_BREAK} macro must be used instead. - -Each basic block contains the reference to the innermost loop it belongs -to (@code{loop_father}). For this reason, it is only possible to have -one @code{struct loops} structure initialized at the same time for each -CFG@. The global variable @code{current_loops} contains the -@code{struct loops} structure. Many of the loop manipulation functions -assume that dominance information is up-to-date. - -The loops are analyzed through @code{loop_optimizer_init} function. The -argument of this function is a set of flags represented in an integer -bitmask. These flags specify what other properties of the loop -structures should be calculated/enforced and preserved later: - -@itemize -@item @code{LOOPS_MAY_HAVE_MULTIPLE_LATCHES}: If this flag is set, no -changes to CFG will be performed in the loop analysis, in particular, -loops with multiple latch edges will not be disambiguated. If a loop -has multiple latches, its latch block is set to NULL@. Most of -the loop manipulation functions will not work for loops in this shape. -No other flags that require CFG changes can be passed to -loop_optimizer_init. -@item @code{LOOPS_HAVE_PREHEADERS}: Forwarder blocks are created in such -a way that each loop has only one entry edge, and additionally, the -source block of this entry edge has only one successor. This creates a -natural place where the code can be moved out of the loop, and ensures -that the entry edge of the loop leads from its immediate super-loop. -@item @code{LOOPS_HAVE_SIMPLE_LATCHES}: Forwarder blocks are created to -force the latch block of each loop to have only one successor. This -ensures that the latch of the loop does not belong to any of its -sub-loops, and makes manipulation with the loops significantly easier. -Most of the loop manipulation functions assume that the loops are in -this shape. Note that with this flag, the ``normal'' loop without any -control flow inside and with one exit consists of two basic blocks. -@item @code{LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS}: Basic blocks and -edges in the strongly connected components that are not natural loops -(have more than one entry block) are marked with -@code{BB_IRREDUCIBLE_LOOP} and @code{EDGE_IRREDUCIBLE_LOOP} flags. The -flag is not set for blocks and edges that belong to natural loops that -are in such an irreducible region (but it is set for the entry and exit -edges of such a loop, if they lead to/from this region). -@item @code{LOOPS_HAVE_RECORDED_EXITS}: The lists of exits are recorded -and updated for each loop. This makes some functions (e.g., -@code{get_loop_exit_edges}) more efficient. Some functions (e.g., -@code{single_exit}) can be used only if the lists of exits are -recorded. -@end itemize - -These properties may also be computed/enforced later, using functions -@code{create_preheaders}, @code{force_single_succ_latches}, -@code{mark_irreducible_loops} and @code{record_loop_exits}. -The properties can be queried using @code{loops_state_satisfies_p}. - -The memory occupied by the loops structures should be freed with -@code{loop_optimizer_finalize} function. When loop structures are -setup to be preserved across passes this function reduces the -information to be kept up-to-date to a minimum (only -@code{LOOPS_MAY_HAVE_MULTIPLE_LATCHES} set). - -The CFG manipulation functions in general do not update loop structures. -Specialized versions that additionally do so are provided for the most -common tasks. On GIMPLE, @code{cleanup_tree_cfg_loop} function can be -used to cleanup CFG while updating the loops structures if -@code{current_loops} is set. - -At the moment loop structure is preserved from the start of GIMPLE -loop optimizations until the end of RTL loop optimizations. During -this time a loop can be tracked by its @code{struct loop} and number. - -@node Loop querying -@section Loop querying -@cindex Loop querying - -The functions to query the information about loops are declared in -@file{cfgloop.h}. Some of the information can be taken directly from -the structures. @code{loop_father} field of each basic block contains -the innermost loop to that the block belongs. The most useful fields of -loop structure (that are kept up-to-date at all times) are: - -@itemize -@item @code{header}, @code{latch}: Header and latch basic blocks of the -loop. -@item @code{num_nodes}: Number of basic blocks in the loop (including -the basic blocks of the sub-loops). -@item @code{depth}: The depth of the loop in the loops tree, i.e., the -number of super-loops of the loop. -@item @code{outer}, @code{inner}, @code{next}: The super-loop, the first -sub-loop, and the sibling of the loop in the loops tree. -@end itemize - -There are other fields in the loop structures, many of them used only by -some of the passes, or not updated during CFG changes; in general, they -should not be accessed directly. - -The most important functions to query loop structures are: - -@itemize -@item @code{flow_loops_dump}: Dumps the information about loops to a -file. -@item @code{verify_loop_structure}: Checks consistency of the loop -structures. -@item @code{loop_latch_edge}: Returns the latch edge of a loop. -@item @code{loop_preheader_edge}: If loops have preheaders, returns -the preheader edge of a loop. -@item @code{flow_loop_nested_p}: Tests whether loop is a sub-loop of -another loop. -@item @code{flow_bb_inside_loop_p}: Tests whether a basic block belongs -to a loop (including its sub-loops). -@item @code{find_common_loop}: Finds the common super-loop of two loops. -@item @code{superloop_at_depth}: Returns the super-loop of a loop with -the given depth. -@item @code{tree_num_loop_insns}, @code{num_loop_insns}: Estimates the -number of insns in the loop, on GIMPLE and on RTL. -@item @code{loop_exit_edge_p}: Tests whether edge is an exit from a -loop. -@item @code{mark_loop_exit_edges}: Marks all exit edges of all loops -with @code{EDGE_LOOP_EXIT} flag. -@item @code{get_loop_body}, @code{get_loop_body_in_dom_order}, -@code{get_loop_body_in_bfs_order}: Enumerates the basic blocks in the -loop in depth-first search order in reversed CFG, ordered by dominance -relation, and breath-first search order, respectively. -@item @code{single_exit}: Returns the single exit edge of the loop, or -@code{NULL} if the loop has more than one exit. You can only use this -function if LOOPS_HAVE_MARKED_SINGLE_EXITS property is used. -@item @code{get_loop_exit_edges}: Enumerates the exit edges of a loop. -@item @code{just_once_each_iteration_p}: Returns true if the basic block -is executed exactly once during each iteration of a loop (that is, it -does not belong to a sub-loop, and it dominates the latch of the loop). -@end itemize - -@node Loop manipulation -@section Loop manipulation -@cindex Loop manipulation - -The loops tree can be manipulated using the following functions: - -@itemize -@item @code{flow_loop_tree_node_add}: Adds a node to the tree. -@item @code{flow_loop_tree_node_remove}: Removes a node from the tree. -@item @code{add_bb_to_loop}: Adds a basic block to a loop. -@item @code{remove_bb_from_loops}: Removes a basic block from loops. -@end itemize - -Most low-level CFG functions update loops automatically. The following -functions handle some more complicated cases of CFG manipulations: - -@itemize -@item @code{remove_path}: Removes an edge and all blocks it dominates. -@item @code{split_loop_exit_edge}: Splits exit edge of the loop, -ensuring that PHI node arguments remain in the loop (this ensures that -loop-closed SSA form is preserved). Only useful on GIMPLE. -@end itemize - -Finally, there are some higher-level loop transformations implemented. -While some of them are written so that they should work on non-innermost -loops, they are mostly untested in that case, and at the moment, they -are only reliable for the innermost loops: - -@itemize -@item @code{create_iv}: Creates a new induction variable. Only works on -GIMPLE@. @code{standard_iv_increment_position} can be used to find a -suitable place for the iv increment. -@item @code{duplicate_loop_to_header_edge}, -@code{tree_duplicate_loop_to_header_edge}: These functions (on RTL and -on GIMPLE) duplicate the body of the loop prescribed number of times on -one of the edges entering loop header, thus performing either loop -unrolling or loop peeling. @code{can_duplicate_loop_p} -(@code{can_unroll_loop_p} on GIMPLE) must be true for the duplicated -loop. -@item @code{loop_version}, @code{tree_ssa_loop_version}: These function -create a copy of a loop, and a branch before them that selects one of -them depending on the prescribed condition. This is useful for -optimizations that need to verify some assumptions in runtime (one of -the copies of the loop is usually left unchanged, while the other one is -transformed in some way). -@item @code{tree_unroll_loop}: Unrolls the loop, including peeling the -extra iterations to make the number of iterations divisible by unroll -factor, updating the exit condition, and removing the exits that now -cannot be taken. Works only on GIMPLE. -@end itemize - -@node LCSSA -@section Loop-closed SSA form -@cindex LCSSA -@cindex Loop-closed SSA form - -Throughout the loop optimizations on tree level, one extra condition is -enforced on the SSA form: No SSA name is used outside of the loop in -that it is defined. The SSA form satisfying this condition is called -``loop-closed SSA form'' -- LCSSA@. To enforce LCSSA, PHI nodes must be -created at the exits of the loops for the SSA names that are used -outside of them. Only the real operands (not virtual SSA names) are -held in LCSSA, in order to save memory. - -There are various benefits of LCSSA: - -@itemize -@item Many optimizations (value range analysis, final value -replacement) are interested in the values that are defined in the loop -and used outside of it, i.e., exactly those for that we create new PHI -nodes. -@item In induction variable analysis, it is not necessary to specify the -loop in that the analysis should be performed -- the scalar evolution -analysis always returns the results with respect to the loop in that the -SSA name is defined. -@item It makes updating of SSA form during loop transformations simpler. -Without LCSSA, operations like loop unrolling may force creation of PHI -nodes arbitrarily far from the loop, while in LCSSA, the SSA form can be -updated locally. However, since we only keep real operands in LCSSA, we -cannot use this advantage (we could have local updating of real -operands, but it is not much more efficient than to use generic SSA form -updating for it as well; the amount of changes to SSA is the same). -@end itemize - -However, it also means LCSSA must be updated. This is usually -straightforward, unless you create a new value in loop and use it -outside, or unless you manipulate loop exit edges (functions are -provided to make these manipulations simple). -@code{rewrite_into_loop_closed_ssa} is used to rewrite SSA form to -LCSSA, and @code{verify_loop_closed_ssa} to check that the invariant of -LCSSA is preserved. - -@node Scalar evolutions -@section Scalar evolutions -@cindex Scalar evolutions -@cindex IV analysis on GIMPLE - -Scalar evolutions (SCEV) are used to represent results of induction -variable analysis on GIMPLE@. They enable us to represent variables with -complicated behavior in a simple and consistent way (we only use it to -express values of polynomial induction variables, but it is possible to -extend it). The interfaces to SCEV analysis are declared in -@file{tree-scalar-evolution.h}. To use scalar evolutions analysis, -@code{scev_initialize} must be used. To stop using SCEV, -@code{scev_finalize} should be used. SCEV analysis caches results in -order to save time and memory. This cache however is made invalid by -most of the loop transformations, including removal of code. If such a -transformation is performed, @code{scev_reset} must be called to clean -the caches. - -Given an SSA name, its behavior in loops can be analyzed using the -@code{analyze_scalar_evolution} function. The returned SCEV however -does not have to be fully analyzed and it may contain references to -other SSA names defined in the loop. To resolve these (potentially -recursive) references, @code{instantiate_parameters} or -@code{resolve_mixers} functions must be used. -@code{instantiate_parameters} is useful when you use the results of SCEV -only for some analysis, and when you work with whole nest of loops at -once. It will try replacing all SSA names by their SCEV in all loops, -including the super-loops of the current loop, thus providing a complete -information about the behavior of the variable in the loop nest. -@code{resolve_mixers} is useful if you work with only one loop at a -time, and if you possibly need to create code based on the value of the -induction variable. It will only resolve the SSA names defined in the -current loop, leaving the SSA names defined outside unchanged, even if -their evolution in the outer loops is known. - -The SCEV is a normal tree expression, except for the fact that it may -contain several special tree nodes. One of them is -@code{SCEV_NOT_KNOWN}, used for SSA names whose value cannot be -expressed. The other one is @code{POLYNOMIAL_CHREC}. Polynomial chrec -has three arguments -- base, step and loop (both base and step may -contain further polynomial chrecs). Type of the expression and of base -and step must be the same. A variable has evolution -@code{POLYNOMIAL_CHREC(base, step, loop)} if it is (in the specified -loop) equivalent to @code{x_1} in the following example - -@smallexample -while (@dots{}) - @{ - x_1 = phi (base, x_2); - x_2 = x_1 + step; - @} -@end smallexample - -Note that this includes the language restrictions on the operations. -For example, if we compile C code and @code{x} has signed type, then the -overflow in addition would cause undefined behavior, and we may assume -that this does not happen. Hence, the value with this SCEV cannot -overflow (which restricts the number of iterations of such a loop). - -In many cases, one wants to restrict the attention just to affine -induction variables. In this case, the extra expressive power of SCEV -is not useful, and may complicate the optimizations. In this case, -@code{simple_iv} function may be used to analyze a value -- the result -is a loop-invariant base and step. - -@node loop-iv -@section IV analysis on RTL -@cindex IV analysis on RTL - -The induction variable on RTL is simple and only allows analysis of -affine induction variables, and only in one loop at once. The interface -is declared in @file{cfgloop.h}. Before analyzing induction variables -in a loop L, @code{iv_analysis_loop_init} function must be called on L. -After the analysis (possibly calling @code{iv_analysis_loop_init} for -several loops) is finished, @code{iv_analysis_done} should be called. -The following functions can be used to access the results of the -analysis: - -@itemize -@item @code{iv_analyze}: Analyzes a single register used in the given -insn. If no use of the register in this insn is found, the following -insns are scanned, so that this function can be called on the insn -returned by get_condition. -@item @code{iv_analyze_result}: Analyzes result of the assignment in the -given insn. -@item @code{iv_analyze_expr}: Analyzes a more complicated expression. -All its operands are analyzed by @code{iv_analyze}, and hence they must -be used in the specified insn or one of the following insns. -@end itemize - -The description of the induction variable is provided in @code{struct -rtx_iv}. In order to handle subregs, the representation is a bit -complicated; if the value of the @code{extend} field is not -@code{UNKNOWN}, the value of the induction variable in the i-th -iteration is - -@smallexample -delta + mult * extend_@{extend_mode@} (subreg_@{mode@} (base + i * step)), -@end smallexample - -with the following exception: if @code{first_special} is true, then the -value in the first iteration (when @code{i} is zero) is @code{delta + -mult * base}. However, if @code{extend} is equal to @code{UNKNOWN}, -then @code{first_special} must be false, @code{delta} 0, @code{mult} 1 -and the value in the i-th iteration is - -@smallexample -subreg_@{mode@} (base + i * step) -@end smallexample - -The function @code{get_iv_value} can be used to perform these -calculations. - -@node Number of iterations -@section Number of iterations analysis -@cindex Number of iterations analysis - -Both on GIMPLE and on RTL, there are functions available to determine -the number of iterations of a loop, with a similar interface. The -number of iterations of a loop in GCC is defined as the number of -executions of the loop latch. In many cases, it is not possible to -determine the number of iterations unconditionally -- the determined -number is correct only if some assumptions are satisfied. The analysis -tries to verify these conditions using the information contained in the -program; if it fails, the conditions are returned together with the -result. The following information and conditions are provided by the -analysis: - -@itemize -@item @code{assumptions}: If this condition is false, the rest of -the information is invalid. -@item @code{noloop_assumptions} on RTL, @code{may_be_zero} on GIMPLE: If -this condition is true, the loop exits in the first iteration. -@item @code{infinite}: If this condition is true, the loop is infinite. -This condition is only available on RTL@. On GIMPLE, conditions for -finiteness of the loop are included in @code{assumptions}. -@item @code{niter_expr} on RTL, @code{niter} on GIMPLE: The expression -that gives number of iterations. The number of iterations is defined as -the number of executions of the loop latch. -@end itemize - -Both on GIMPLE and on RTL, it necessary for the induction variable -analysis framework to be initialized (SCEV on GIMPLE, loop-iv on RTL). -On GIMPLE, the results are stored to @code{struct tree_niter_desc} -structure. Number of iterations before the loop is exited through a -given exit can be determined using @code{number_of_iterations_exit} -function. On RTL, the results are returned in @code{struct niter_desc} -structure. The corresponding function is named -@code{check_simple_exit}. There are also functions that pass through -all the exits of a loop and try to find one with easy to determine -number of iterations -- @code{find_loop_niter} on GIMPLE and -@code{find_simple_exit} on RTL@. Finally, there are functions that -provide the same information, but additionally cache it, so that -repeated calls to number of iterations are not so costly -- -@code{number_of_latch_executions} on GIMPLE and @code{get_simple_loop_desc} -on RTL. - -Note that some of these functions may behave slightly differently than -others -- some of them return only the expression for the number of -iterations, and fail if there are some assumptions. The function -@code{number_of_latch_executions} works only for single-exit loops. -The function @code{number_of_cond_exit_executions} can be used to -determine number of executions of the exit condition of a single-exit -loop (i.e., the @code{number_of_latch_executions} increased by one). - -@node Dependency analysis -@section Data Dependency Analysis -@cindex Data Dependency Analysis - -The code for the data dependence analysis can be found in -@file{tree-data-ref.c} and its interface and data structures are -described in @file{tree-data-ref.h}. The function that computes the -data dependences for all the array and pointer references for a given -loop is @code{compute_data_dependences_for_loop}. This function is -currently used by the linear loop transform and the vectorization -passes. Before calling this function, one has to allocate two vectors: -a first vector will contain the set of data references that are -contained in the analyzed loop body, and the second vector will contain -the dependence relations between the data references. Thus if the -vector of data references is of size @code{n}, the vector containing the -dependence relations will contain @code{n*n} elements. However if the -analyzed loop contains side effects, such as calls that potentially can -interfere with the data references in the current analyzed loop, the -analysis stops while scanning the loop body for data references, and -inserts a single @code{chrec_dont_know} in the dependence relation -array. - -The data references are discovered in a particular order during the -scanning of the loop body: the loop body is analyzed in execution order, -and the data references of each statement are pushed at the end of the -data reference array. Two data references syntactically occur in the -program in the same order as in the array of data references. This -syntactic order is important in some classical data dependence tests, -and mapping this order to the elements of this array avoids costly -queries to the loop body representation. - -Three types of data references are currently handled: ARRAY_REF, -INDIRECT_REF and COMPONENT_REF@. The data structure for the data reference -is @code{data_reference}, where @code{data_reference_p} is a name of a -pointer to the data reference structure. The structure contains the -following elements: - -@itemize -@item @code{base_object_info}: Provides information about the base object -of the data reference and its access functions. These access functions -represent the evolution of the data reference in the loop relative to -its base, in keeping with the classical meaning of the data reference -access function for the support of arrays. For example, for a reference -@code{a.b[i][j]}, the base object is @code{a.b} and the access functions, -one for each array subscript, are: -@code{@{i_init, + i_step@}_1, @{j_init, +, j_step@}_2}. - -@item @code{first_location_in_loop}: Provides information about the first -location accessed by the data reference in the loop and about the access -function used to represent evolution relative to this location. This data -is used to support pointers, and is not used for arrays (for which we -have base objects). Pointer accesses are represented as a one-dimensional -access that starts from the first location accessed in the loop. For -example: - -@smallexample - for1 i - for2 j - *((int *)p + i + j) = a[i][j]; -@end smallexample - -The access function of the pointer access is @code{@{0, + 4B@}_for2} -relative to @code{p + i}. The access functions of the array are -@code{@{i_init, + i_step@}_for1} and @code{@{j_init, +, j_step@}_for2} -relative to @code{a}. - -Usually, the object the pointer refers to is either unknown, or we can't -prove that the access is confined to the boundaries of a certain object. - -Two data references can be compared only if at least one of these two -representations has all its fields filled for both data references. - -The current strategy for data dependence tests is as follows: -If both @code{a} and @code{b} are represented as arrays, compare -@code{a.base_object} and @code{b.base_object}; -if they are equal, apply dependence tests (use access functions based on -base_objects). -Else if both @code{a} and @code{b} are represented as pointers, compare -@code{a.first_location} and @code{b.first_location}; -if they are equal, apply dependence tests (use access functions based on -first location). -However, if @code{a} and @code{b} are represented differently, only try -to prove that the bases are definitely different. - -@item Aliasing information. -@item Alignment information. -@end itemize - -The structure describing the relation between two data references is -@code{data_dependence_relation} and the shorter name for a pointer to -such a structure is @code{ddr_p}. This structure contains: - -@itemize -@item a pointer to each data reference, -@item a tree node @code{are_dependent} that is set to @code{chrec_known} -if the analysis has proved that there is no dependence between these two -data references, @code{chrec_dont_know} if the analysis was not able to -determine any useful result and potentially there could exist a -dependence between these data references, and @code{are_dependent} is -set to @code{NULL_TREE} if there exist a dependence relation between the -data references, and the description of this dependence relation is -given in the @code{subscripts}, @code{dir_vects}, and @code{dist_vects} -arrays, -@item a boolean that determines whether the dependence relation can be -represented by a classical distance vector, -@item an array @code{subscripts} that contains a description of each -subscript of the data references. Given two array accesses a -subscript is the tuple composed of the access functions for a given -dimension. For example, given @code{A[f1][f2][f3]} and -@code{B[g1][g2][g3]}, there are three subscripts: @code{(f1, g1), (f2, -g2), (f3, g3)}. -@item two arrays @code{dir_vects} and @code{dist_vects} that contain -classical representations of the data dependences under the form of -direction and distance dependence vectors, -@item an array of loops @code{loop_nest} that contains the loops to -which the distance and direction vectors refer to. -@end itemize - -Several functions for pretty printing the information extracted by the -data dependence analysis are available: @code{dump_ddrs} prints with a -maximum verbosity the details of a data dependence relations array, -@code{dump_dist_dir_vectors} prints only the classical distance and -direction vectors for a data dependence relations array, and -@code{dump_data_references} prints the details of the data references -contained in a data reference array. - - -@node Omega -@section Omega a solver for linear programming problems -@cindex Omega a solver for linear programming problems - -The data dependence analysis contains several solvers triggered -sequentially from the less complex ones to the more sophisticated. -For ensuring the consistency of the results of these solvers, a data -dependence check pass has been implemented based on two different -solvers. The second method that has been integrated to GCC is based -on the Omega dependence solver, written in the 1990's by William Pugh -and David Wonnacott. Data dependence tests can be formulated using a -subset of the Presburger arithmetics that can be translated to linear -constraint systems. These linear constraint systems can then be -solved using the Omega solver. - -The Omega solver is using Fourier-Motzkin's algorithm for variable -elimination: a linear constraint system containing @code{n} variables -is reduced to a linear constraint system with @code{n-1} variables. -The Omega solver can also be used for solving other problems that can -be expressed under the form of a system of linear equalities and -inequalities. The Omega solver is known to have an exponential worst -case, also known under the name of ``omega nightmare'' in the -literature, but in practice, the omega test is known to be efficient -for the common data dependence tests. - -The interface used by the Omega solver for describing the linear -programming problems is described in @file{omega.h}, and the solver is -@code{omega_solve_problem}. diff --git a/contrib/gcc-5.0/gcc/doc/lto.texi b/contrib/gcc-5.0/gcc/doc/lto.texi deleted file mode 100644 index 41fd97223a..0000000000 --- a/contrib/gcc-5.0/gcc/doc/lto.texi +++ /dev/null @@ -1,595 +0,0 @@ -@c Copyright (C) 2010-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. -@c Contributed by Jan Hubicka and -@c Diego Novillo - -@node LTO -@chapter Link Time Optimization -@cindex lto -@cindex whopr -@cindex wpa -@cindex ltrans - -Link Time Optimization (LTO) gives GCC the capability of -dumping its internal representation (GIMPLE) to disk, -so that all the different compilation units that make up -a single executable can be optimized as a single module. -This expands the scope of inter-procedural optimizations -to encompass the whole program (or, rather, everything -that is visible at link time). - -@menu -* LTO Overview:: Overview of LTO. -* LTO object file layout:: LTO file sections in ELF. -* IPA:: Using summary information in IPA passes. -* WHOPR:: Whole program assumptions, - linker plugin and symbol visibilities. -* Internal flags:: Internal flags controlling @code{lto1}. -@end menu - -@node LTO Overview -@section Design Overview - -Link time optimization is implemented as a GCC front end for a -bytecode representation of GIMPLE that is emitted in special sections -of @code{.o} files. Currently, LTO support is enabled in most -ELF-based systems, as well as darwin, cygwin and mingw systems. - -Since GIMPLE bytecode is saved alongside final object code, object -files generated with LTO support are larger than regular object files. -This ``fat'' object format makes it easy to integrate LTO into -existing build systems, as one can, for instance, produce archives of -the files. Additionally, one might be able to ship one set of fat -objects which could be used both for development and the production of -optimized builds. A, perhaps surprising, side effect of this feature -is that any mistake in the toolchain that leads to LTO information not -being used (e.g.@: an older @code{libtool} calling @code{ld} directly). -This is both an advantage, as the system is more robust, and a -disadvantage, as the user is not informed that the optimization has -been disabled. - -The current implementation only produces ``fat'' objects, effectively -doubling compilation time and increasing file sizes up to 5x the -original size. This hides the problem that some tools, such as -@code{ar} and @code{nm}, need to understand symbol tables of LTO -sections. These tools were extended to use the plugin infrastructure, -and with these problems solved, GCC will also support ``slim'' objects -consisting of the intermediate code alone. - -At the highest level, LTO splits the compiler in two. The first half -(the ``writer'') produces a streaming representation of all the -internal data structures needed to optimize and generate code. This -includes declarations, types, the callgraph and the GIMPLE representation -of function bodies. - -When @option{-flto} is given during compilation of a source file, the -pass manager executes all the passes in @code{all_lto_gen_passes}. -Currently, this phase is composed of two IPA passes: - -@itemize @bullet -@item @code{pass_ipa_lto_gimple_out} -This pass executes the function @code{lto_output} in -@file{lto-streamer-out.c}, which traverses the call graph encoding -every reachable declaration, type and function. This generates a -memory representation of all the file sections described below. - -@item @code{pass_ipa_lto_finish_out} -This pass executes the function @code{produce_asm_for_decls} in -@file{lto-streamer-out.c}, which takes the memory image built in the -previous pass and encodes it in the corresponding ELF file sections. -@end itemize - -The second half of LTO support is the ``reader''. This is implemented -as the GCC front end @file{lto1} in @file{lto/lto.c}. When -@file{collect2} detects a link set of @code{.o}/@code{.a} files with -LTO information and the @option{-flto} is enabled, it invokes -@file{lto1} which reads the set of files and aggregates them into a -single translation unit for optimization. The main entry point for -the reader is @file{lto/lto.c}:@code{lto_main}. - -@subsection LTO modes of operation - -One of the main goals of the GCC link-time infrastructure was to allow -effective compilation of large programs. For this reason GCC implements two -link-time compilation modes. - -@enumerate -@item @emph{LTO mode}, in which the whole program is read into the -compiler at link-time and optimized in a similar way as if it -were a single source-level compilation unit. - -@item @emph{WHOPR or partitioned mode}, designed to utilize multiple -CPUs and/or a distributed compilation environment to quickly link -large applications. WHOPR stands for WHOle Program optimizeR (not to -be confused with the semantics of @option{-fwhole-program}). It -partitions the aggregated callgraph from many different @code{.o} -files and distributes the compilation of the sub-graphs to different -CPUs. - -Note that distributed compilation is not implemented yet, but since -the parallelism is facilitated via generating a @code{Makefile}, it -would be easy to implement. -@end enumerate - -WHOPR splits LTO into three main stages: -@enumerate -@item Local generation (LGEN) -This stage executes in parallel. Every file in the program is compiled -into the intermediate language and packaged together with the local -call-graph and summary information. This stage is the same for both -the LTO and WHOPR compilation mode. - -@item Whole Program Analysis (WPA) -WPA is performed sequentially. The global call-graph is generated, and -a global analysis procedure makes transformation decisions. The global -call-graph is partitioned to facilitate parallel optimization during -phase 3. The results of the WPA stage are stored into new object files -which contain the partitions of program expressed in the intermediate -language and the optimization decisions. - -@item Local transformations (LTRANS) -This stage executes in parallel. All the decisions made during phase 2 -are implemented locally in each partitioned object file, and the final -object code is generated. Optimizations which cannot be decided -efficiently during the phase 2 may be performed on the local -call-graph partitions. -@end enumerate - -WHOPR can be seen as an extension of the usual LTO mode of -compilation. In LTO, WPA and LTRANS are executed within a single -execution of the compiler, after the whole program has been read into -memory. - -When compiling in WHOPR mode, the callgraph is partitioned during -the WPA stage. The whole program is split into a given number of -partitions of roughly the same size. The compiler tries to -minimize the number of references which cross partition boundaries. -The main advantage of WHOPR is to allow the parallel execution of -LTRANS stages, which are the most time-consuming part of the -compilation process. Additionally, it avoids the need to load the -whole program into memory. - - -@node LTO object file layout -@section LTO file sections - -LTO information is stored in several ELF sections inside object files. -Data structures and enum codes for sections are defined in -@file{lto-streamer.h}. - -These sections are emitted from @file{lto-streamer-out.c} and mapped -in all at once from @file{lto/lto.c}:@code{lto_file_read}. The -individual functions dealing with the reading/writing of each section -are described below. - -@itemize @bullet -@item Command line options (@code{.gnu.lto_.opts}) - -This section contains the command line options used to generate the -object files. This is used at link time to determine the optimization -level and other settings when they are not explicitly specified at the -linker command line. - -Currently, GCC does not support combining LTO object files compiled -with different set of the command line options into a single binary. -At link time, the options given on the command line and the options -saved on all the files in a link-time set are applied globally. No -attempt is made at validating the combination of flags (other than the -usual validation done by option processing). This is implemented in -@file{lto/lto.c}:@code{lto_read_all_file_options}. - - -@item Symbol table (@code{.gnu.lto_.symtab}) - -This table replaces the ELF symbol table for functions and variables -represented in the LTO IL. Symbols used and exported by the optimized -assembly code of ``fat'' objects might not match the ones used and -exported by the intermediate code. This table is necessary because -the intermediate code is less optimized and thus requires a separate -symbol table. - -Additionally, the binary code in the ``fat'' object will lack a call -to a function, since the call was optimized out at compilation time -after the intermediate language was streamed out. In some special -cases, the same optimization may not happen during link-time -optimization. This would lead to an undefined symbol if only one -symbol table was used. - -The symbol table is emitted in -@file{lto-streamer-out.c}:@code{produce_symtab}. - - -@item Global declarations and types (@code{.gnu.lto_.decls}) - -This section contains an intermediate language dump of all -declarations and types required to represent the callgraph, static -variables and top-level debug info. - -The contents of this section are emitted in -@file{lto-streamer-out.c}:@code{produce_asm_for_decls}. Types and -symbols are emitted in a topological order that preserves the sharing -of pointers when the file is read back in -(@file{lto.c}:@code{read_cgraph_and_symbols}). - - -@item The callgraph (@code{.gnu.lto_.cgraph}) - -This section contains the basic data structure used by the GCC -inter-procedural optimization infrastructure. This section stores an -annotated multi-graph which represents the functions and call sites as -well as the variables, aliases and top-level @code{asm} statements. - -This section is emitted in -@file{lto-streamer-out.c}:@code{output_cgraph} and read in -@file{lto-cgraph.c}:@code{input_cgraph}. - - -@item IPA references (@code{.gnu.lto_.refs}) - -This section contains references between function and static -variables. It is emitted by @file{lto-cgraph.c}:@code{output_refs} -and read by @file{lto-cgraph.c}:@code{input_refs}. - - -@item Function bodies (@code{.gnu.lto_.function_body.}) - -This section contains function bodies in the intermediate language -representation. Every function body is in a separate section to allow -copying of the section independently to different object files or -reading the function on demand. - -Functions are emitted in -@file{lto-streamer-out.c}:@code{output_function} and read in -@file{lto-streamer-in.c}:@code{input_function}. - - -@item Static variable initializers (@code{.gnu.lto_.vars}) - -This section contains all the symbols in the global variable pool. It -is emitted by @file{lto-cgraph.c}:@code{output_varpool} and read in -@file{lto-cgraph.c}:@code{input_cgraph}. - -@item Summaries and optimization summaries used by IPA passes -(@code{.gnu.lto_.}, where @code{} is one of @code{jmpfuncs}, -@code{pureconst} or @code{reference}) - -These sections are used by IPA passes that need to emit summary -information during LTO generation to be read and aggregated at -link time. Each pass is responsible for implementing two pass manager -hooks: one for writing the summary and another for reading it in. The -format of these sections is entirely up to each individual pass. The -only requirement is that the writer and reader hooks agree on the -format. -@end itemize - - -@node IPA -@section Using summary information in IPA passes - -Programs are represented internally as a @emph{callgraph} (a -multi-graph where nodes are functions and edges are call sites) -and a @emph{varpool} (a list of static and external variables in -the program). - -The inter-procedural optimization is organized as a sequence of -individual passes, which operate on the callgraph and the -varpool. To make the implementation of WHOPR possible, every -inter-procedural optimization pass is split into several stages -that are executed at different times during WHOPR compilation: - -@itemize @bullet -@item LGEN time -@enumerate -@item @emph{Generate summary} (@code{generate_summary} in -@code{struct ipa_opt_pass_d}). This stage analyzes every function -body and variable initializer is examined and stores relevant -information into a pass-specific data structure. - -@item @emph{Write summary} (@code{write_summary} in -@code{struct ipa_opt_pass_d}). This stage writes all the -pass-specific information generated by @code{generate_summary}. -Summaries go into their own @code{LTO_section_*} sections that -have to be declared in @file{lto-streamer.h}:@code{enum -lto_section_type}. A new section is created by calling -@code{create_output_block} and data can be written using the -@code{lto_output_*} routines. -@end enumerate - -@item WPA time -@enumerate -@item @emph{Read summary} (@code{read_summary} in -@code{struct ipa_opt_pass_d}). This stage reads all the -pass-specific information in exactly the same order that it was -written by @code{write_summary}. - -@item @emph{Execute} (@code{execute} in @code{struct -opt_pass}). This performs inter-procedural propagation. This -must be done without actual access to the individual function -bodies or variable initializers. Typically, this results in a -transitive closure operation over the summary information of all -the nodes in the callgraph. - -@item @emph{Write optimization summary} -(@code{write_optimization_summary} in @code{struct -ipa_opt_pass_d}). This writes the result of the inter-procedural -propagation into the object file. This can use the same data -structures and helper routines used in @code{write_summary}. -@end enumerate - -@item LTRANS time -@enumerate -@item @emph{Read optimization summary} -(@code{read_optimization_summary} in @code{struct -ipa_opt_pass_d}). The counterpart to -@code{write_optimization_summary}. This reads the interprocedural -optimization decisions in exactly the same format emitted by -@code{write_optimization_summary}. - -@item @emph{Transform} (@code{function_transform} and -@code{variable_transform} in @code{struct ipa_opt_pass_d}). -The actual function bodies and variable initializers are updated -based on the information passed down from the @emph{Execute} stage. -@end enumerate -@end itemize - -The implementation of the inter-procedural passes are shared -between LTO, WHOPR and classic non-LTO compilation. - -@itemize -@item During the traditional file-by-file mode every pass executes its -own @emph{Generate summary}, @emph{Execute}, and @emph{Transform} -stages within the single execution context of the compiler. - -@item In LTO compilation mode, every pass uses @emph{Generate -summary} and @emph{Write summary} stages at compilation time, -while the @emph{Read summary}, @emph{Execute}, and -@emph{Transform} stages are executed at link time. - -@item In WHOPR mode all stages are used. -@end itemize - -To simplify development, the GCC pass manager differentiates -between normal inter-procedural passes and small inter-procedural -passes. A @emph{small inter-procedural pass} -(@code{SIMPLE_IPA_PASS}) is a pass that does -everything at once and thus it can not be executed during WPA in -WHOPR mode. It defines only the @emph{Execute} stage and during -this stage it accesses and modifies the function bodies. Such -passes are useful for optimization at LGEN or LTRANS time and are -used, for example, to implement early optimization before writing -object files. The simple inter-procedural passes can also be used -for easier prototyping and development of a new inter-procedural -pass. - - -@subsection Virtual clones - -One of the main challenges of introducing the WHOPR compilation -mode was addressing the interactions between optimization passes. -In LTO compilation mode, the passes are executed in a sequence, -each of which consists of analysis (or @emph{Generate summary}), -propagation (or @emph{Execute}) and @emph{Transform} stages. -Once the work of one pass is finished, the next pass sees the -updated program representation and can execute. This makes the -individual passes dependent on each other. - -In WHOPR mode all passes first execute their @emph{Generate -summary} stage. Then summary writing marks the end of the LGEN -stage. At WPA time, -the summaries are read back into memory and all passes run the -@emph{Execute} stage. Optimization summaries are streamed and -sent to LTRANS, where all the passes execute the @emph{Transform} -stage. - -Most optimization passes split naturally into analysis, -propagation and transformation stages. But some do not. The -main problem arises when one pass performs changes and the -following pass gets confused by seeing different callgraphs -between the @emph{Transform} stage and the @emph{Generate summary} -or @emph{Execute} stage. This means that the passes are required -to communicate their decisions with each other. - -To facilitate this communication, the GCC callgraph -infrastructure implements @emph{virtual clones}, a method of -representing the changes performed by the optimization passes in -the callgraph without needing to update function bodies. - -A @emph{virtual clone} in the callgraph is a function that has no -associated body, just a description of how to create its body based -on a different function (which itself may be a virtual clone). - -The description of function modifications includes adjustments to -the function's signature (which allows, for example, removing or -adding function arguments), substitutions to perform on the -function body, and, for inlined functions, a pointer to the -function that it will be inlined into. - -It is also possible to redirect any edge of the callgraph from a -function to its virtual clone. This implies updating of the call -site to adjust for the new function signature. - -Most of the transformations performed by inter-procedural -optimizations can be represented via virtual clones. For -instance, a constant propagation pass can produce a virtual clone -of the function which replaces one of its arguments by a -constant. The inliner can represent its decisions by producing a -clone of a function whose body will be later integrated into -a given function. - -Using @emph{virtual clones}, the program can be easily updated -during the @emph{Execute} stage, solving most of pass interactions -problems that would otherwise occur during @emph{Transform}. - -Virtual clones are later materialized in the LTRANS stage and -turned into real functions. Passes executed after the virtual -clone were introduced also perform their @emph{Transform} stage -on new functions, so for a pass there is no significant -difference between operating on a real function or a virtual -clone introduced before its @emph{Execute} stage. - -Optimization passes then work on virtual clones introduced before -their @emph{Execute} stage as if they were real functions. The -only difference is that clones are not visible during the -@emph{Generate Summary} stage. - -To keep function summaries updated, the callgraph interface -allows an optimizer to register a callback that is called every -time a new clone is introduced as well as when the actual -function or variable is generated or when a function or variable -is removed. These hooks are registered in the @emph{Generate -summary} stage and allow the pass to keep its information intact -until the @emph{Execute} stage. The same hooks can also be -registered during the @emph{Execute} stage to keep the -optimization summaries updated for the @emph{Transform} stage. - -@subsection IPA references - -GCC represents IPA references in the callgraph. For a function -or variable @code{A}, the @emph{IPA reference} is a list of all -locations where the address of @code{A} is taken and, when -@code{A} is a variable, a list of all direct stores and reads -to/from @code{A}. References represent an oriented multi-graph on -the union of nodes of the callgraph and the varpool. See -@file{ipa-reference.c}:@code{ipa_reference_write_optimization_summary} -and -@file{ipa-reference.c}:@code{ipa_reference_read_optimization_summary} -for details. - -@subsection Jump functions -Suppose that an optimization pass sees a function @code{A} and it -knows the values of (some of) its arguments. The @emph{jump -function} describes the value of a parameter of a given function -call in function @code{A} based on this knowledge. - -Jump functions are used by several optimizations, such as the -inter-procedural constant propagation pass and the -devirtualization pass. The inliner also uses jump functions to -perform inlining of callbacks. - -@node WHOPR -@section Whole program assumptions, linker plugin and symbol visibilities - -Link-time optimization gives relatively minor benefits when used -alone. The problem is that propagation of inter-procedural -information does not work well across functions and variables -that are called or referenced by other compilation units (such as -from a dynamically linked library). We say that such functions -and variables are @emph{externally visible}. - -To make the situation even more difficult, many applications -organize themselves as a set of shared libraries, and the default -ELF visibility rules allow one to overwrite any externally -visible symbol with a different symbol at runtime. This -basically disables any optimizations across such functions and -variables, because the compiler cannot be sure that the function -body it is seeing is the same function body that will be used at -runtime. Any function or variable not declared @code{static} in -the sources degrades the quality of inter-procedural -optimization. - -To avoid this problem the compiler must assume that it sees the -whole program when doing link-time optimization. Strictly -speaking, the whole program is rarely visible even at link-time. -Standard system libraries are usually linked dynamically or not -provided with the link-time information. In GCC, the whole -program option (@option{-fwhole-program}) asserts that every -function and variable defined in the current compilation -unit is static, except for function @code{main} (note: at -link time, the current unit is the union of all objects compiled -with LTO). Since some functions and variables need to -be referenced externally, for example by another DSO or from an -assembler file, GCC also provides the function and variable -attribute @code{externally_visible} which can be used to disable -the effect of @option{-fwhole-program} on a specific symbol. - -The whole program mode assumptions are slightly more complex in -C++, where inline functions in headers are put into @emph{COMDAT} -sections. COMDAT function and variables can be defined by -multiple object files and their bodies are unified at link-time -and dynamic link-time. COMDAT functions are changed to local only -when their address is not taken and thus un-sharing them with a -library is not harmful. COMDAT variables always remain externally -visible, however for readonly variables it is assumed that their -initializers cannot be overwritten by a different value. - -GCC provides the function and variable attribute -@code{visibility} that can be used to specify the visibility of -externally visible symbols (or alternatively an -@option{-fdefault-visibility} command line option). ELF defines -the @code{default}, @code{protected}, @code{hidden} and -@code{internal} visibilities. - -The most commonly used is visibility is @code{hidden}. It -specifies that the symbol cannot be referenced from outside of -the current shared library. Unfortunately, this information -cannot be used directly by the link-time optimization in the -compiler since the whole shared library also might contain -non-LTO objects and those are not visible to the compiler. - -GCC solves this problem using linker plugins. A @emph{linker -plugin} is an interface to the linker that allows an external -program to claim the ownership of a given object file. The linker -then performs the linking procedure by querying the plugin about -the symbol table of the claimed objects and once the linking -decisions are complete, the plugin is allowed to provide the -final object file before the actual linking is made. The linker -plugin obtains the symbol resolution information which specifies -which symbols provided by the claimed objects are bound from the -rest of a binary being linked. - -Currently, the linker plugin works only in combination -with the Gold linker, but a GNU ld implementation is under -development. - -GCC is designed to be independent of the rest of the toolchain -and aims to support linkers without plugin support. For this -reason it does not use the linker plugin by default. Instead, -the object files are examined by @command{collect2} before being -passed to the linker and objects found to have LTO sections are -passed to @command{lto1} first. This mode does not work for -library archives. The decision on what object files from the -archive are needed depends on the actual linking and thus GCC -would have to implement the linker itself. The resolution -information is missing too and thus GCC needs to make an educated -guess based on @option{-fwhole-program}. Without the linker -plugin GCC also assumes that symbols are declared @code{hidden} -and not referred by non-LTO code by default. - -@node Internal flags -@section Internal flags controlling @code{lto1} - -The following flags are passed into @command{lto1} and are not -meant to be used directly from the command line. - -@itemize -@item -fwpa -@opindex fwpa -This option runs the serial part of the link-time optimizer -performing the inter-procedural propagation (WPA mode). The -compiler reads in summary information from all inputs and -performs an analysis based on summary information only. It -generates object files for subsequent runs of the link-time -optimizer where individual object files are optimized using both -summary information from the WPA mode and the actual function -bodies. It then drives the LTRANS phase. - -@item -fltrans -@opindex fltrans -This option runs the link-time optimizer in the -local-transformation (LTRANS) mode, which reads in output from a -previous run of the LTO in WPA mode. In the LTRANS mode, LTO -optimizes an object and produces the final assembly. - -@item -fltrans-output-list=@var{file} -@opindex fltrans-output-list -This option specifies a file to which the names of LTRANS output -files are written. This option is only meaningful in conjunction -with @option{-fwpa}. - -@item -fresolution=@var{file} -@opindex fresolution -This option specifies the linker resolution file. This option is -only meaningful in conjunction with @option{-fwpa} and as option -to pass through to the LTO linker plugin. -@end itemize diff --git a/contrib/gcc-5.0/gcc/doc/makefile.texi b/contrib/gcc-5.0/gcc/doc/makefile.texi deleted file mode 100644 index 2a4aedbc95..0000000000 --- a/contrib/gcc-5.0/gcc/doc/makefile.texi +++ /dev/null @@ -1,192 +0,0 @@ -@c Copyright (C) 2001-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Makefile -@subsection Makefile Targets -@cindex makefile targets -@cindex targets, makefile - -These targets are available from the @samp{gcc} directory: - -@table @code -@item all -This is the default target. Depending on what your build/host/target -configuration is, it coordinates all the things that need to be built. - -@item doc -Produce info-formatted documentation and man pages. Essentially it -calls @samp{make man} and @samp{make info}. - -@item dvi -Produce DVI-formatted documentation. - -@item pdf -Produce PDF-formatted documentation. - -@item html -Produce HTML-formatted documentation. - -@item man -Generate man pages. - -@item info -Generate info-formatted pages. - -@item mostlyclean -Delete the files made while building the compiler. - -@item clean -That, and all the other files built by @samp{make all}. - -@item distclean -That, and all the files created by @command{configure}. - -@item maintainer-clean -Distclean plus any file that can be generated from other files. Note -that additional tools may be required beyond what is normally needed to -build GCC. - -@item srcextra -Generates files in the source directory that are not version-controlled but -should go into a release tarball. - -@item srcinfo -@itemx srcman -Copies the info-formatted and manpage documentation into the source -directory usually for the purpose of generating a release tarball. - -@item install -Installs GCC. - -@item uninstall -Deletes installed files, though this is not supported. - -@item check -Run the testsuite. This creates a @file{testsuite} subdirectory that -has various @file{.sum} and @file{.log} files containing the results of -the testing. You can run subsets with, for example, @samp{make check-gcc}. -You can specify specific tests by setting @env{RUNTESTFLAGS} to be the name -of the @file{.exp} file, optionally followed by (for some tests) an equals -and a file wildcard, like: - -@smallexample -make check-gcc RUNTESTFLAGS="execute.exp=19980413-*" -@end smallexample - -Note that running the testsuite may require additional tools be -installed, such as Tcl or DejaGnu. -@end table - -The toplevel tree from which you start GCC compilation is not -the GCC directory, but rather a complex Makefile that coordinates -the various steps of the build, including bootstrapping the compiler -and using the new compiler to build target libraries. - -When GCC is configured for a native configuration, the default action -for @command{make} is to do a full three-stage bootstrap. This means -that GCC is built three times---once with the native compiler, once with -the native-built compiler it just built, and once with the compiler it -built the second time. In theory, the last two should produce the same -results, which @samp{make compare} can check. Each stage is configured -separately and compiled into a separate directory, to minimize problems -due to ABI incompatibilities between the native compiler and GCC. - -If you do a change, rebuilding will also start from the first stage -and ``bubble'' up the change through the three stages. Each stage -is taken from its build directory (if it had been built previously), -rebuilt, and copied to its subdirectory. This will allow you to, for -example, continue a bootstrap after fixing a bug which causes the -stage2 build to crash. It does not provide as good coverage of the -compiler as bootstrapping from scratch, but it ensures that the new -code is syntactically correct (e.g., that you did not use GCC extensions -by mistake), and avoids spurious bootstrap comparison -failures@footnote{Except if the compiler was buggy and miscompiled -some of the files that were not modified. In this case, it's best -to use @command{make restrap}.}. - -Other targets available from the top level include: - -@table @code -@item bootstrap-lean -Like @code{bootstrap}, except that the various stages are removed once -they're no longer needed. This saves disk space. - -@item bootstrap2 -@itemx bootstrap2-lean -Performs only the first two stages of bootstrap. Unlike a three-stage -bootstrap, this does not perform a comparison to test that the compiler -is running properly. Note that the disk space required by a ``lean'' -bootstrap is approximately independent of the number of stages. - -@item stage@var{N}-bubble (@var{N} = 1@dots{}4, profile, feedback) -Rebuild all the stages up to @var{N}, with the appropriate flags, -``bubbling'' the changes as described above. - -@item all-stage@var{N} (@var{N} = 1@dots{}4, profile, feedback) -Assuming that stage @var{N} has already been built, rebuild it with the -appropriate flags. This is rarely needed. - -@item cleanstrap -Remove everything (@samp{make clean}) and rebuilds (@samp{make bootstrap}). - -@item compare -Compares the results of stages 2 and 3. This ensures that the compiler -is running properly, since it should produce the same object files -regardless of how it itself was compiled. - -@item profiledbootstrap -Builds a compiler with profiling feedback information. In this case, -the second and third stages are named @samp{profile} and @samp{feedback}, -respectively. For more information, see -@ref{Building,,Building with profile feedback,gccinstall,Installing GCC}. - -@item restrap -Restart a bootstrap, so that everything that was not built with -the system compiler is rebuilt. - -@item stage@var{N}-start (@var{N} = 1@dots{}4, profile, feedback) -For each package that is bootstrapped, rename directories so that, -for example, @file{gcc} points to the stage@var{N} GCC, compiled -with the stage@var{N-1} GCC@footnote{Customarily, the system compiler -is also termed the @file{stage0} GCC.}. - -You will invoke this target if you need to test or debug the -stage@var{N} GCC@. If you only need to execute GCC (but you need -not run @samp{make} either to rebuild it or to run test suites), -you should be able to work directly in the @file{stage@var{N}-gcc} -directory. This makes it easier to debug multiple stages in -parallel. - -@item stage -For each package that is bootstrapped, relocate its build directory -to indicate its stage. For example, if the @file{gcc} directory -points to the stage2 GCC, after invoking this target it will be -renamed to @file{stage2-gcc}. - -@end table - -If you wish to use non-default GCC flags when compiling the stage2 and -stage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing -@samp{make}. - -Usually, the first stage only builds the languages that the compiler -is written in: typically, C and maybe Ada. If you are debugging a -miscompilation of a different stage2 front-end (for example, of the -Fortran front-end), you may want to have front-ends for other languages -in the first stage as well. To do so, set @code{STAGE1_LANGUAGES} -on the command line when doing @samp{make}. - -For example, in the aforementioned scenario of debugging a Fortran -front-end miscompilation caused by the stage1 compiler, you may need a -command like - -@example -make stage2-bubble STAGE1_LANGUAGES=c,fortran -@end example - -Alternatively, you can use per-language targets to build and test -languages that are not enabled by default in stage1. For example, -@command{make f951} will build a Fortran compiler even in the stage1 -build directory. - diff --git a/contrib/gcc-5.0/gcc/doc/match-and-simplify.texi b/contrib/gcc-5.0/gcc/doc/match-and-simplify.texi deleted file mode 100644 index 469f6a7fc6..0000000000 --- a/contrib/gcc-5.0/gcc/doc/match-and-simplify.texi +++ /dev/null @@ -1,354 +0,0 @@ -@c Copyright (C) 2014-2015 Free Software Foundation, Inc. -@c Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Match and Simplify -@chapter Match and Simplify -@cindex Match and Simplify - -The GIMPLE and GENERIC pattern matching project match-and-simplify -tries to address several issues. - -@enumerate -@item unify expression simplifications currently spread and duplicated - over separate files like fold-const.c, gimple-fold.c and builtins.c -@item allow for a cheap way to implement building and simplifying - non-trivial GIMPLE expressions, avoiding the need to go through - building and simplifying GENERIC via fold_buildN and then - gimplifying via force_gimple_operand -@end enumerate - -To address these the project introduces a simple domain specific language -to write expression simplifications from which code targeting GIMPLE -and GENERIC is auto-generated. The GENERIC variant follows the -fold_buildN API while for the GIMPLE variant and to address 2) new -APIs are introduced. - -@menu -* GIMPLE API:: -* The Language:: -@end menu - -@node GIMPLE API -@section GIMPLE API -@cindex GIMPLE API - -@deftypefn {GIMPLE function} tree gimple_simplify (enum tree_code, tree, tree, gimple_seq *, tree (*)(tree)) -@deftypefnx {GIMPLE function} tree gimple_simplify (enum tree_code, tree, tree, tree, gimple_seq *, tree (*)(tree)) -@deftypefnx {GIMPLE function} tree gimple_simplify (enum tree_code, tree, tree, tree, tree, gimple_seq *, tree (*)(tree)) -@deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, gimple_seq *, tree (*)(tree)) -@deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree)) -@deftypefnx {GIMPLE function} tree gimple_simplify (enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree)) -The main GIMPLE API entry to the expression simplifications mimicing -that of the GENERIC fold_@{unary,binary,ternary@} functions. -@end deftypefn - -thus providing n-ary overloads for operation or function. The -additional arguments are a gimple_seq where built statements are -inserted on (if @code{NULL} then simplifications requiring new statements -are not performed) and a valueization hook that can be used to -tie simplifications to a SSA lattice. - -In addition to those APIs @code{fold_stmt} is overloaded with -a valueization hook: - -@deftypefn bool fold_stmt (gimple_stmt_iterator *, tree (*)(tree)); -@end deftypefn - - -Ontop of these a @code{fold_buildN}-like API for GIMPLE is introduced: - -@deftypefn {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree (*valueize) (tree) = NULL); -@deftypefnx {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree (*valueize) (tree) = NULL); -@deftypefnx {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree, tree (*valueize) (tree) = NULL); -@deftypefnx {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum built_in_function, tree, tree, tree (*valueize) (tree) = NULL); -@deftypefnx {GIMPLE function} tree gimple_build (gimple_seq *, location_t, enum built_in_function, tree, tree, tree, tree (*valueize) (tree) = NULL); -@deftypefnx {GIMPLE function} tree gimple_convert (gimple_seq *, location_t, tree, tree); -@end deftypefn - -which is supposed to replace @code{force_gimple_operand (fold_buildN (...), ...)} -and calls to @code{fold_convert}. Overloads without the @code{location_t} -argument exist. Built statements are inserted on the provided sequence -and simplification is performed using the optional valueization hook. - - -@node The Language -@section The Language -@cindex The Language - -The language to write expression simplifications in resembles other -domain-specific languages GCC uses. Thus it is lispy. Lets start -with an example from the match.pd file: - -@smallexample -(simplify - (bit_and @@0 integer_all_onesp) - @@0) -@end smallexample - -This example contains all required parts of an expression simplification. -A simplification is wrapped inside a @code{(simplify ...)} expression. -That contains at least two operands - an expression that is matched -with the GIMPLE or GENERIC IL and a replacement expression that is -returned if the match was successful. - -Expressions have an operator ID, @code{bit_and} in this case. Expressions can -be lower-case tree codes with @code{_expr} stripped off or builtin -function code names in all-caps, like @code{BUILT_IN_SQRT}. - -@code{@@n} denotes a so-called capture. It captures the operand and lets -you refer to it in other places of the match-and-simplify. In the -above example it is refered to in the replacement expression. Captures -are @code{@@} followed by a number or an identifier. - -@smallexample -(simplify - (bit_xor @@0 @@0) - @{ build_zero_cst (type); @}) -@end smallexample - -In this example @code{@@0} is mentioned twice which constrains the matched -expression to have two equal operands. This example also introduces -operands written in C code. These can be used in the expression -replacements and are supposed to evaluate to a tree node which has to -be a valid GIMPLE operand (so you cannot generate expressions in C code). - -@smallexample -(simplify - (trunc_mod integer_zerop@@0 @@1) - (if (!integer_zerop (@@1))) - @@0) -@end smallexample - -Here @code{@@0} captures the first operand of the trunc_mod expression -which is also predicated with @code{integer_zerop}. Expression operands -may be either expressions, predicates or captures. Captures -can be unconstrained or capture expresions or predicates. - -This example introduces an optional operand of simplify, -the if-expression. This condition is evaluated after the -expression matched in the IL and is required to evaluate to true -to enable the replacement expression. The expression operand -of the @code{if} is a standard C expression which may contain references -to captures. - -A @code{if} expression can be used to specify a common condition -for multiple simplify patterns, avoiding the need -to repeat that multiple times: - -@smallexample -(if (!TYPE_SATURATING (type) - && !FLOAT_TYPE_P (type) && !FIXED_POINT_TYPE_P (type)) - (simplify - (minus (plus @@0 @@1) @@0) - @@1) - (simplify - (minus (minus @@0 @@1) @@0) - (negate @@1))) -@end smallexample - -Ifs can be nested. - -Captures can also be used for capturing results of sub-expressions. - -@smallexample -#if GIMPLE -(simplify - (pointer_plus (addr@@2 @@0) INTEGER_CST_P@@1) - (if (is_gimple_min_invariant (@@2))) - @{ - HOST_WIDE_INT off; - tree base = get_addr_base_and_unit_offset (@@0, &off); - off += tree_to_uhwi (@@1); - /* Now with that we should be able to simply write - (addr (mem_ref (addr @@base) (plus @@off @@1))) */ - build1 (ADDR_EXPR, type, - build2 (MEM_REF, TREE_TYPE (TREE_TYPE (@@2)), - build_fold_addr_expr (base), - build_int_cst (ptr_type_node, off))); - @}) -#endif -@end smallexample - -In the above example, @code{@@2} captures the result of the expression -@code{(addr @@0)}. For outermost expression only its type can be captured, -and the keyword @code{type} is reserved for this purpose. The above -example also gives a way to conditionalize patterns to only apply -to @code{GIMPLE} or @code{GENERIC} by means of using the pre-defined -preprocessor macros @code{GIMPLE} and @code{GENERIC} and using -preprocessor directives. - -@smallexample -(simplify - (bit_and:c integral_op_p@@0 (bit_ior:c (bit_not @@0) @@1)) - (bit_and @@1 @@0)) -@end smallexample - -Here we introduce flags on match expressions. There is currently -a single flag, @code{c}, which denotes that the expression should -be also matched commutated. Thus the above match expression -is really the following four match expressions: - - (bit_and integral_op_p@@0 (bit_ior (bit_not @@0) @@1)) - (bit_and (bit_ior (bit_not @@0) @@1) integral_op_p@@0) - (bit_and integral_op_p@@0 (bit_ior @@1 (bit_not @@0))) - (bit_and (bit_ior @@1 (bit_not @@0)) integral_op_p@@0) - -Usual canonicalizations you know from GENERIC expressions are -applied before matching, so for example constant operands always -come second in commutative expressions. - -More features exist to avoid too much repetition. - -@smallexample -(for op (plus pointer_plus minus bit_ior bit_xor) - (simplify - (op @@0 integer_zerop) - @@0)) -@end smallexample - -A @code{for} expression can be used to repeat a pattern for each -operator specified, substituting @code{op}. @code{for} can be -nested and a @code{for} can have multiple operators to iterate. - -@smallexample -(for opa (plus minus) - opb (minus plus) - (for opc (plus minus) - (simplify... -@end smallexample - -In this example the pattern will be repeated four times with -@code{opa, opb, opc} being @code{plus, minus, plus}, -@code{plus, minus, minus}, @code{minus, plus, plus}, -@code{minus, plus, minus}. - -To avoid repeating operator lists in @code{for} you can name -them via - -@smallexample -(define_operator_list pmm plus minus mult) -@end smallexample - -and use them in @code{for} operator lists where they get expanded. - -@smallexample -(for opa (pmm trunc_div) - (simplify... -@end smallexample - -So this example iterates over @code{plus}, @code{minus}, @code{mult} -and @code{trunc_div}. - -Using operator lists can also remove the need to explicitely write -a @code{for}. All operator list uses that appear in a @code{simplify} -or @code{match} pattern in operator positions will implicitely -be added to a new @code{for}. For example - -@smallexample -(define_operator_list SQRT BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL) -(define_operator_list POW BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL) -(simplify - (SQRT (POW @@0 @@1)) - (POW (abs @@0) (mult @@1 @{ built_real (TREE_TYPE (@@1), dconsthalf); @}))) -@end smallexample - -is the same as - -@smallexample -(for SQRT (BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL) - POW (BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL) - (simplify - (SQRT (POW @@0 @@1)) - (POW (abs @@0) (mult @@1 @{ built_real (TREE_TYPE (@@1), dconsthalf); @})))) -@end smallexample - -Another building block are @code{with} expressions in the -result expression which nest the generated code in a new C block -followed by its argument: - -@smallexample -(simplify - (convert (mult @@0 @@1)) - (with @{ tree utype = unsigned_type_for (type); @} - (convert (mult (convert:utype @@0) (convert:utype @@1))))) -@end smallexample - -This allows code nested in the @code{with} to refer to the declared -variables. In the above case we use the feature to specify the -type of a generated expression with the @code{:type} syntax where -@code{type} needs to be an identifier that refers to the desired type. -Usually the types of the generated result expressions are -determined from the context, but sometimes like in the above case -it is required that you specify them explicitely. - -As intermediate conversions are often optional there is a way to -avoid the need to repeat patterns both with and without such -conversions. Namely you can mark a conversion as being optional -with a @code{?}: - -@smallexample -(simplify - (eq (convert@@0 @@1) (convert? @@2)) - (eq @@1 (convert @@2))) -@end smallexample - -which will match both @code{(eq (convert @@1) (convert @@2))} and -@code{(eq (convert @@1) @@2)}. The optional converts are supposed -to be all either present or not, thus -@code{(eq (convert? @@1) (convert? @@2))} will result in two -patterns only. If you want to match all four combinations you -have access to two additional conditional converts as in -@code{(eq (convert1? @@1) (convert2? @@2))}. - -Predicates available from the GCC middle-end need to be made -available explicitely via @code{define_predicates}: - -@smallexample -(define_predicates - integer_onep integer_zerop integer_all_onesp) -@end smallexample - -You can also define predicates using the pattern matching language -and the @code{match} form: - -@smallexample -(match negate_expr_p - INTEGER_CST - (if (TYPE_OVERFLOW_WRAPS (type) - || may_negate_without_overflow_p (t)))) -(match negate_expr_p - (negate @@0)) -@end smallexample - -This shows that for @code{match} expressions there is @code{t} -available which captures the outermost expression (something -not possible in the @code{simplify} context). As you can see -@code{match} has an identifier as first operand which is how -you refer to the predicate in patterns. Multiple @code{match} -for the same identifier add additional cases where the predicate -matches. - -Predicates can also match an expression in which case you need -to provide a template specifying the identifier and where to -get its operands from: - -@smallexample -(match (logical_inverted_value @@0) - (eq @@0 integer_zerop)) -(match (logical_inverted_value @@0) - (bit_not truth_valued_p@@0)) -@end smallexample - -You can use the above predicate like - -@smallexample -(simplify - (bit_and @@0 (logical_inverted_value @@0)) - @{ build_zero_cst (type); @}) -@end smallexample - -Which will match a bitwise and of an operand with its logical -inverted value. - diff --git a/contrib/gcc-5.0/gcc/doc/md.texi b/contrib/gcc-5.0/gcc/doc/md.texi deleted file mode 100644 index bc1ec9d4f0..0000000000 --- a/contrib/gcc-5.0/gcc/doc/md.texi +++ /dev/null @@ -1,10035 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@ifset INTERNALS -@node Machine Desc -@chapter Machine Descriptions -@cindex machine descriptions - -A machine description has two parts: a file of instruction patterns -(@file{.md} file) and a C header file of macro definitions. - -The @file{.md} file for a target machine contains a pattern for each -instruction that the target machine supports (or at least each instruction -that is worth telling the compiler about). It may also contain comments. -A semicolon causes the rest of the line to be a comment, unless the semicolon -is inside a quoted string. - -See the next chapter for information on the C header file. - -@menu -* Overview:: How the machine description is used. -* Patterns:: How to write instruction patterns. -* Example:: An explained example of a @code{define_insn} pattern. -* RTL Template:: The RTL template defines what insns match a pattern. -* Output Template:: The output template says how to make assembler code - from such an insn. -* Output Statement:: For more generality, write C code to output - the assembler code. -* Predicates:: Controlling what kinds of operands can be used - for an insn. -* Constraints:: Fine-tuning operand selection. -* Standard Names:: Names mark patterns to use for code generation. -* Pattern Ordering:: When the order of patterns makes a difference. -* Dependent Patterns:: Having one pattern may make you need another. -* Jump Patterns:: Special considerations for patterns for jump insns. -* Looping Patterns:: How to define patterns for special looping insns. -* Insn Canonicalizations::Canonicalization of Instructions -* Expander Definitions::Generating a sequence of several RTL insns - for a standard operation. -* Insn Splitting:: Splitting Instructions into Multiple Instructions. -* Including Patterns:: Including Patterns in Machine Descriptions. -* Peephole Definitions::Defining machine-specific peephole optimizations. -* Insn Attributes:: Specifying the value of attributes for generated insns. -* Conditional Execution::Generating @code{define_insn} patterns for - predication. -* Define Subst:: Generating @code{define_insn} and @code{define_expand} - patterns from other patterns. -* Constant Definitions::Defining symbolic constants that can be used in the - md file. -* Iterators:: Using iterators to generate patterns from a template. -@end menu - -@node Overview -@section Overview of How the Machine Description is Used - -There are three main conversions that happen in the compiler: - -@enumerate - -@item -The front end reads the source code and builds a parse tree. - -@item -The parse tree is used to generate an RTL insn list based on named -instruction patterns. - -@item -The insn list is matched against the RTL templates to produce assembler -code. - -@end enumerate - -For the generate pass, only the names of the insns matter, from either a -named @code{define_insn} or a @code{define_expand}. The compiler will -choose the pattern with the right name and apply the operands according -to the documentation later in this chapter, without regard for the RTL -template or operand constraints. Note that the names the compiler looks -for are hard-coded in the compiler---it will ignore unnamed patterns and -patterns with names it doesn't know about, but if you don't provide a -named pattern it needs, it will abort. - -If a @code{define_insn} is used, the template given is inserted into the -insn list. If a @code{define_expand} is used, one of three things -happens, based on the condition logic. The condition logic may manually -create new insns for the insn list, say via @code{emit_insn()}, and -invoke @code{DONE}. For certain named patterns, it may invoke @code{FAIL} to tell the -compiler to use an alternate way of performing that task. If it invokes -neither @code{DONE} nor @code{FAIL}, the template given in the pattern -is inserted, as if the @code{define_expand} were a @code{define_insn}. - -Once the insn list is generated, various optimization passes convert, -replace, and rearrange the insns in the insn list. This is where the -@code{define_split} and @code{define_peephole} patterns get used, for -example. - -Finally, the insn list's RTL is matched up with the RTL templates in the -@code{define_insn} patterns, and those patterns are used to emit the -final assembly code. For this purpose, each named @code{define_insn} -acts like it's unnamed, since the names are ignored. - -@node Patterns -@section Everything about Instruction Patterns -@cindex patterns -@cindex instruction patterns - -@findex define_insn -A @code{define_insn} expression is used to define instruction patterns -to which insns may be matched. A @code{define_insn} expression contains -an incomplete RTL expression, with pieces to be filled in later, operand -constraints that restrict how the pieces can be filled in, and an output -template or C code to generate the assembler output. - -A @code{define_insn} is an RTL expression containing four or five operands: - -@enumerate -@item -An optional name. The presence of a name indicate that this instruction -pattern can perform a certain standard job for the RTL-generation -pass of the compiler. This pass knows certain names and will use -the instruction patterns with those names, if the names are defined -in the machine description. - -The absence of a name is indicated by writing an empty string -where the name should go. Nameless instruction patterns are never -used for generating RTL code, but they may permit several simpler insns -to be combined later on. - -Names that are not thus known and used in RTL-generation have no -effect; they are equivalent to no name at all. - -For the purpose of debugging the compiler, you may also specify a -name beginning with the @samp{*} character. Such a name is used only -for identifying the instruction in RTL dumps; it is equivalent to having -a nameless pattern for all other purposes. Names beginning with the -@samp{*} character are not required to be unique. - -@item -The @dfn{RTL template}: This is a vector of incomplete RTL expressions -which describe the semantics of the instruction (@pxref{RTL Template}). -It is incomplete because it may contain @code{match_operand}, -@code{match_operator}, and @code{match_dup} expressions that stand for -operands of the instruction. - -If the vector has multiple elements, the RTL template is treated as a -@code{parallel} expression. - -@item -@cindex pattern conditions -@cindex conditions, in patterns -The condition: This is a string which contains a C expression. When the -compiler attempts to match RTL against a pattern, the condition is -evaluated. If the condition evaluates to @code{true}, the match is -permitted. The condition may be an empty string, which is treated -as always @code{true}. - -@cindex named patterns and conditions -For a named pattern, the condition may not depend on the data in the -insn being matched, but only the target-machine-type flags. The compiler -needs to test these conditions during initialization in order to learn -exactly which named instructions are available in a particular run. - -@findex operands -For nameless patterns, the condition is applied only when matching an -individual insn, and only after the insn has matched the pattern's -recognition template. The insn's operands may be found in the vector -@code{operands}. - -For an insn where the condition has once matched, it -cannot later be used to control register allocation by excluding -certain register or value combinations. - -@item -The @dfn{output template} or @dfn{output statement}: This is either -a string, or a fragment of C code which returns a string. - -When simple substitution isn't general enough, you can specify a piece -of C code to compute the output. @xref{Output Statement}. - -@item -The @dfn{insn attributes}: This is an optional vector containing the values of -attributes for insns matching this pattern (@pxref{Insn Attributes}). -@end enumerate - -@node Example -@section Example of @code{define_insn} -@cindex @code{define_insn} example - -Here is an example of an instruction pattern, taken from the machine -description for the 68000/68020. - -@smallexample -(define_insn "tstsi" - [(set (cc0) - (match_operand:SI 0 "general_operand" "rm"))] - "" - "* -@{ - if (TARGET_68020 || ! ADDRESS_REG_P (operands[0])) - return \"tstl %0\"; - return \"cmpl #0,%0\"; -@}") -@end smallexample - -@noindent -This can also be written using braced strings: - -@smallexample -(define_insn "tstsi" - [(set (cc0) - (match_operand:SI 0 "general_operand" "rm"))] - "" -@{ - if (TARGET_68020 || ! ADDRESS_REG_P (operands[0])) - return "tstl %0"; - return "cmpl #0,%0"; -@}) -@end smallexample - -This describes an instruction which sets the condition codes based on the -value of a general operand. It has no condition, so any insn with an RTL -description of the form shown may be matched to this pattern. The name -@samp{tstsi} means ``test a @code{SImode} value'' and tells the RTL -generation pass that, when it is necessary to test such a value, an insn -to do so can be constructed using this pattern. - -The output control string is a piece of C code which chooses which -output template to return based on the kind of operand and the specific -type of CPU for which code is being generated. - -@samp{"rm"} is an operand constraint. Its meaning is explained below. - -@node RTL Template -@section RTL Template -@cindex RTL insn template -@cindex generating insns -@cindex insns, generating -@cindex recognizing insns -@cindex insns, recognizing - -The RTL template is used to define which insns match the particular pattern -and how to find their operands. For named patterns, the RTL template also -says how to construct an insn from specified operands. - -Construction involves substituting specified operands into a copy of the -template. Matching involves determining the values that serve as the -operands in the insn being matched. Both of these activities are -controlled by special expression types that direct matching and -substitution of the operands. - -@table @code -@findex match_operand -@item (match_operand:@var{m} @var{n} @var{predicate} @var{constraint}) -This expression is a placeholder for operand number @var{n} of -the insn. When constructing an insn, operand number @var{n} -will be substituted at this point. When matching an insn, whatever -appears at this position in the insn will be taken as operand -number @var{n}; but it must satisfy @var{predicate} or this instruction -pattern will not match at all. - -Operand numbers must be chosen consecutively counting from zero in -each instruction pattern. There may be only one @code{match_operand} -expression in the pattern for each operand number. Usually operands -are numbered in the order of appearance in @code{match_operand} -expressions. In the case of a @code{define_expand}, any operand numbers -used only in @code{match_dup} expressions have higher values than all -other operand numbers. - -@var{predicate} is a string that is the name of a function that -accepts two arguments, an expression and a machine mode. -@xref{Predicates}. During matching, the function will be called with -the putative operand as the expression and @var{m} as the mode -argument (if @var{m} is not specified, @code{VOIDmode} will be used, -which normally causes @var{predicate} to accept any mode). If it -returns zero, this instruction pattern fails to match. -@var{predicate} may be an empty string; then it means no test is to be -done on the operand, so anything which occurs in this position is -valid. - -Most of the time, @var{predicate} will reject modes other than @var{m}---but -not always. For example, the predicate @code{address_operand} uses -@var{m} as the mode of memory ref that the address should be valid for. -Many predicates accept @code{const_int} nodes even though their mode is -@code{VOIDmode}. - -@var{constraint} controls reloading and the choice of the best register -class to use for a value, as explained later (@pxref{Constraints}). -If the constraint would be an empty string, it can be omitted. - -People are often unclear on the difference between the constraint and the -predicate. The predicate helps decide whether a given insn matches the -pattern. The constraint plays no role in this decision; instead, it -controls various decisions in the case of an insn which does match. - -@findex match_scratch -@item (match_scratch:@var{m} @var{n} @var{constraint}) -This expression is also a placeholder for operand number @var{n} -and indicates that operand must be a @code{scratch} or @code{reg} -expression. - -When matching patterns, this is equivalent to - -@smallexample -(match_operand:@var{m} @var{n} "scratch_operand" @var{constraint}) -@end smallexample - -but, when generating RTL, it produces a (@code{scratch}:@var{m}) -expression. - -If the last few expressions in a @code{parallel} are @code{clobber} -expressions whose operands are either a hard register or -@code{match_scratch}, the combiner can add or delete them when -necessary. @xref{Side Effects}. - -@findex match_dup -@item (match_dup @var{n}) -This expression is also a placeholder for operand number @var{n}. -It is used when the operand needs to appear more than once in the -insn. - -In construction, @code{match_dup} acts just like @code{match_operand}: -the operand is substituted into the insn being constructed. But in -matching, @code{match_dup} behaves differently. It assumes that operand -number @var{n} has already been determined by a @code{match_operand} -appearing earlier in the recognition template, and it matches only an -identical-looking expression. - -Note that @code{match_dup} should not be used to tell the compiler that -a particular register is being used for two operands (example: -@code{add} that adds one register to another; the second register is -both an input operand and the output operand). Use a matching -constraint (@pxref{Simple Constraints}) for those. @code{match_dup} is for the cases where one -operand is used in two places in the template, such as an instruction -that computes both a quotient and a remainder, where the opcode takes -two input operands but the RTL template has to refer to each of those -twice; once for the quotient pattern and once for the remainder pattern. - -@findex match_operator -@item (match_operator:@var{m} @var{n} @var{predicate} [@var{operands}@dots{}]) -This pattern is a kind of placeholder for a variable RTL expression -code. - -When constructing an insn, it stands for an RTL expression whose -expression code is taken from that of operand @var{n}, and whose -operands are constructed from the patterns @var{operands}. - -When matching an expression, it matches an expression if the function -@var{predicate} returns nonzero on that expression @emph{and} the -patterns @var{operands} match the operands of the expression. - -Suppose that the function @code{commutative_operator} is defined as -follows, to match any expression whose operator is one of the -commutative arithmetic operators of RTL and whose mode is @var{mode}: - -@smallexample -int -commutative_integer_operator (x, mode) - rtx x; - machine_mode mode; -@{ - enum rtx_code code = GET_CODE (x); - if (GET_MODE (x) != mode) - return 0; - return (GET_RTX_CLASS (code) == RTX_COMM_ARITH - || code == EQ || code == NE); -@} -@end smallexample - -Then the following pattern will match any RTL expression consisting -of a commutative operator applied to two general operands: - -@smallexample -(match_operator:SI 3 "commutative_operator" - [(match_operand:SI 1 "general_operand" "g") - (match_operand:SI 2 "general_operand" "g")]) -@end smallexample - -Here the vector @code{[@var{operands}@dots{}]} contains two patterns -because the expressions to be matched all contain two operands. - -When this pattern does match, the two operands of the commutative -operator are recorded as operands 1 and 2 of the insn. (This is done -by the two instances of @code{match_operand}.) Operand 3 of the insn -will be the entire commutative expression: use @code{GET_CODE -(operands[3])} to see which commutative operator was used. - -The machine mode @var{m} of @code{match_operator} works like that of -@code{match_operand}: it is passed as the second argument to the -predicate function, and that function is solely responsible for -deciding whether the expression to be matched ``has'' that mode. - -When constructing an insn, argument 3 of the gen-function will specify -the operation (i.e.@: the expression code) for the expression to be -made. It should be an RTL expression, whose expression code is copied -into a new expression whose operands are arguments 1 and 2 of the -gen-function. The subexpressions of argument 3 are not used; -only its expression code matters. - -When @code{match_operator} is used in a pattern for matching an insn, -it usually best if the operand number of the @code{match_operator} -is higher than that of the actual operands of the insn. This improves -register allocation because the register allocator often looks at -operands 1 and 2 of insns to see if it can do register tying. - -There is no way to specify constraints in @code{match_operator}. The -operand of the insn which corresponds to the @code{match_operator} -never has any constraints because it is never reloaded as a whole. -However, if parts of its @var{operands} are matched by -@code{match_operand} patterns, those parts may have constraints of -their own. - -@findex match_op_dup -@item (match_op_dup:@var{m} @var{n}[@var{operands}@dots{}]) -Like @code{match_dup}, except that it applies to operators instead of -operands. When constructing an insn, operand number @var{n} will be -substituted at this point. But in matching, @code{match_op_dup} behaves -differently. It assumes that operand number @var{n} has already been -determined by a @code{match_operator} appearing earlier in the -recognition template, and it matches only an identical-looking -expression. - -@findex match_parallel -@item (match_parallel @var{n} @var{predicate} [@var{subpat}@dots{}]) -This pattern is a placeholder for an insn that consists of a -@code{parallel} expression with a variable number of elements. This -expression should only appear at the top level of an insn pattern. - -When constructing an insn, operand number @var{n} will be substituted at -this point. When matching an insn, it matches if the body of the insn -is a @code{parallel} expression with at least as many elements as the -vector of @var{subpat} expressions in the @code{match_parallel}, if each -@var{subpat} matches the corresponding element of the @code{parallel}, -@emph{and} the function @var{predicate} returns nonzero on the -@code{parallel} that is the body of the insn. It is the responsibility -of the predicate to validate elements of the @code{parallel} beyond -those listed in the @code{match_parallel}. - -A typical use of @code{match_parallel} is to match load and store -multiple expressions, which can contain a variable number of elements -in a @code{parallel}. For example, - -@smallexample -(define_insn "" - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 1 "gpc_reg_operand" "=r") - (match_operand:SI 2 "memory_operand" "m")) - (use (reg:SI 179)) - (clobber (reg:SI 179))])] - "" - "loadm 0,0,%1,%2") -@end smallexample - -This example comes from @file{a29k.md}. The function -@code{load_multiple_operation} is defined in @file{a29k.c} and checks -that subsequent elements in the @code{parallel} are the same as the -@code{set} in the pattern, except that they are referencing subsequent -registers and memory locations. - -An insn that matches this pattern might look like: - -@smallexample -(parallel - [(set (reg:SI 20) (mem:SI (reg:SI 100))) - (use (reg:SI 179)) - (clobber (reg:SI 179)) - (set (reg:SI 21) - (mem:SI (plus:SI (reg:SI 100) - (const_int 4)))) - (set (reg:SI 22) - (mem:SI (plus:SI (reg:SI 100) - (const_int 8))))]) -@end smallexample - -@findex match_par_dup -@item (match_par_dup @var{n} [@var{subpat}@dots{}]) -Like @code{match_op_dup}, but for @code{match_parallel} instead of -@code{match_operator}. - -@end table - -@node Output Template -@section Output Templates and Operand Substitution -@cindex output templates -@cindex operand substitution - -@cindex @samp{%} in template -@cindex percent sign -The @dfn{output template} is a string which specifies how to output the -assembler code for an instruction pattern. Most of the template is a -fixed string which is output literally. The character @samp{%} is used -to specify where to substitute an operand; it can also be used to -identify places where different variants of the assembler require -different syntax. - -In the simplest case, a @samp{%} followed by a digit @var{n} says to output -operand @var{n} at that point in the string. - -@samp{%} followed by a letter and a digit says to output an operand in an -alternate fashion. Four letters have standard, built-in meanings described -below. The machine description macro @code{PRINT_OPERAND} can define -additional letters with nonstandard meanings. - -@samp{%c@var{digit}} can be used to substitute an operand that is a -constant value without the syntax that normally indicates an immediate -operand. - -@samp{%n@var{digit}} is like @samp{%c@var{digit}} except that the value of -the constant is negated before printing. - -@samp{%a@var{digit}} can be used to substitute an operand as if it were a -memory reference, with the actual operand treated as the address. This may -be useful when outputting a ``load address'' instruction, because often the -assembler syntax for such an instruction requires you to write the operand -as if it were a memory reference. - -@samp{%l@var{digit}} is used to substitute a @code{label_ref} into a jump -instruction. - -@samp{%=} outputs a number which is unique to each instruction in the -entire compilation. This is useful for making local labels to be -referred to more than once in a single template that generates multiple -assembler instructions. - -@samp{%} followed by a punctuation character specifies a substitution that -does not use an operand. Only one case is standard: @samp{%%} outputs a -@samp{%} into the assembler code. Other nonstandard cases can be -defined in the @code{PRINT_OPERAND} macro. You must also define -which punctuation characters are valid with the -@code{PRINT_OPERAND_PUNCT_VALID_P} macro. - -@cindex \ -@cindex backslash -The template may generate multiple assembler instructions. Write the text -for the instructions, with @samp{\;} between them. - -@cindex matching operands -When the RTL contains two operands which are required by constraint to match -each other, the output template must refer only to the lower-numbered operand. -Matching operands are not always identical, and the rest of the compiler -arranges to put the proper RTL expression for printing into the lower-numbered -operand. - -One use of nonstandard letters or punctuation following @samp{%} is to -distinguish between different assembler languages for the same machine; for -example, Motorola syntax versus MIT syntax for the 68000. Motorola syntax -requires periods in most opcode names, while MIT syntax does not. For -example, the opcode @samp{movel} in MIT syntax is @samp{move.l} in Motorola -syntax. The same file of patterns is used for both kinds of output syntax, -but the character sequence @samp{%.} is used in each place where Motorola -syntax wants a period. The @code{PRINT_OPERAND} macro for Motorola syntax -defines the sequence to output a period; the macro for MIT syntax defines -it to do nothing. - -@cindex @code{#} in template -As a special case, a template consisting of the single character @code{#} -instructs the compiler to first split the insn, and then output the -resulting instructions separately. This helps eliminate redundancy in the -output templates. If you have a @code{define_insn} that needs to emit -multiple assembler instructions, and there is a matching @code{define_split} -already defined, then you can simply use @code{#} as the output template -instead of writing an output template that emits the multiple assembler -instructions. - -If the macro @code{ASSEMBLER_DIALECT} is defined, you can use construct -of the form @samp{@{option0|option1|option2@}} in the templates. These -describe multiple variants of assembler language syntax. -@xref{Instruction Output}. - -@node Output Statement -@section C Statements for Assembler Output -@cindex output statements -@cindex C statements for assembler output -@cindex generating assembler output - -Often a single fixed template string cannot produce correct and efficient -assembler code for all the cases that are recognized by a single -instruction pattern. For example, the opcodes may depend on the kinds of -operands; or some unfortunate combinations of operands may require extra -machine instructions. - -If the output control string starts with a @samp{@@}, then it is actually -a series of templates, each on a separate line. (Blank lines and -leading spaces and tabs are ignored.) The templates correspond to the -pattern's constraint alternatives (@pxref{Multi-Alternative}). For example, -if a target machine has a two-address add instruction @samp{addr} to add -into a register and another @samp{addm} to add a register to memory, you -might write this pattern: - -@smallexample -(define_insn "addsi3" - [(set (match_operand:SI 0 "general_operand" "=r,m") - (plus:SI (match_operand:SI 1 "general_operand" "0,0") - (match_operand:SI 2 "general_operand" "g,r")))] - "" - "@@ - addr %2,%0 - addm %2,%0") -@end smallexample - -@cindex @code{*} in template -@cindex asterisk in template -If the output control string starts with a @samp{*}, then it is not an -output template but rather a piece of C program that should compute a -template. It should execute a @code{return} statement to return the -template-string you want. Most such templates use C string literals, which -require doublequote characters to delimit them. To include these -doublequote characters in the string, prefix each one with @samp{\}. - -If the output control string is written as a brace block instead of a -double-quoted string, it is automatically assumed to be C code. In that -case, it is not necessary to put in a leading asterisk, or to escape the -doublequotes surrounding C string literals. - -The operands may be found in the array @code{operands}, whose C data type -is @code{rtx []}. - -It is very common to select different ways of generating assembler code -based on whether an immediate operand is within a certain range. Be -careful when doing this, because the result of @code{INTVAL} is an -integer on the host machine. If the host machine has more bits in an -@code{int} than the target machine has in the mode in which the constant -will be used, then some of the bits you get from @code{INTVAL} will be -superfluous. For proper results, you must carefully disregard the -values of those bits. - -@findex output_asm_insn -It is possible to output an assembler instruction and then go on to output -or compute more of them, using the subroutine @code{output_asm_insn}. This -receives two arguments: a template-string and a vector of operands. The -vector may be @code{operands}, or it may be another array of @code{rtx} -that you declare locally and initialize yourself. - -@findex which_alternative -When an insn pattern has multiple alternatives in its constraints, often -the appearance of the assembler code is determined mostly by which alternative -was matched. When this is so, the C code can test the variable -@code{which_alternative}, which is the ordinal number of the alternative -that was actually satisfied (0 for the first, 1 for the second alternative, -etc.). - -For example, suppose there are two opcodes for storing zero, @samp{clrreg} -for registers and @samp{clrmem} for memory locations. Here is how -a pattern could use @code{which_alternative} to choose between them: - -@smallexample -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r,m") - (const_int 0))] - "" - @{ - return (which_alternative == 0 - ? "clrreg %0" : "clrmem %0"); - @}) -@end smallexample - -The example above, where the assembler code to generate was -@emph{solely} determined by the alternative, could also have been specified -as follows, having the output control string start with a @samp{@@}: - -@smallexample -@group -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r,m") - (const_int 0))] - "" - "@@ - clrreg %0 - clrmem %0") -@end group -@end smallexample - -If you just need a little bit of C code in one (or a few) alternatives, -you can use @samp{*} inside of a @samp{@@} multi-alternative template: - -@smallexample -@group -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r,<,m") - (const_int 0))] - "" - "@@ - clrreg %0 - * return stack_mem_p (operands[0]) ? \"push 0\" : \"clrmem %0\"; - clrmem %0") -@end group -@end smallexample - -@node Predicates -@section Predicates -@cindex predicates -@cindex operand predicates -@cindex operator predicates - -A predicate determines whether a @code{match_operand} or -@code{match_operator} expression matches, and therefore whether the -surrounding instruction pattern will be used for that combination of -operands. GCC has a number of machine-independent predicates, and you -can define machine-specific predicates as needed. By convention, -predicates used with @code{match_operand} have names that end in -@samp{_operand}, and those used with @code{match_operator} have names -that end in @samp{_operator}. - -All predicates are Boolean functions (in the mathematical sense) of -two arguments: the RTL expression that is being considered at that -position in the instruction pattern, and the machine mode that the -@code{match_operand} or @code{match_operator} specifies. In this -section, the first argument is called @var{op} and the second argument -@var{mode}. Predicates can be called from C as ordinary two-argument -functions; this can be useful in output templates or other -machine-specific code. - -Operand predicates can allow operands that are not actually acceptable -to the hardware, as long as the constraints give reload the ability to -fix them up (@pxref{Constraints}). However, GCC will usually generate -better code if the predicates specify the requirements of the machine -instructions as closely as possible. Reload cannot fix up operands -that must be constants (``immediate operands''); you must use a -predicate that allows only constants, or else enforce the requirement -in the extra condition. - -@cindex predicates and machine modes -@cindex normal predicates -@cindex special predicates -Most predicates handle their @var{mode} argument in a uniform manner. -If @var{mode} is @code{VOIDmode} (unspecified), then @var{op} can have -any mode. If @var{mode} is anything else, then @var{op} must have the -same mode, unless @var{op} is a @code{CONST_INT} or integer -@code{CONST_DOUBLE}. These RTL expressions always have -@code{VOIDmode}, so it would be counterproductive to check that their -mode matches. Instead, predicates that accept @code{CONST_INT} and/or -integer @code{CONST_DOUBLE} check that the value stored in the -constant will fit in the requested mode. - -Predicates with this behavior are called @dfn{normal}. -@command{genrecog} can optimize the instruction recognizer based on -knowledge of how normal predicates treat modes. It can also diagnose -certain kinds of common errors in the use of normal predicates; for -instance, it is almost always an error to use a normal predicate -without specifying a mode. - -Predicates that do something different with their @var{mode} argument -are called @dfn{special}. The generic predicates -@code{address_operand} and @code{pmode_register_operand} are special -predicates. @command{genrecog} does not do any optimizations or -diagnosis when special predicates are used. - -@menu -* Machine-Independent Predicates:: Predicates available to all back ends. -* Defining Predicates:: How to write machine-specific predicate - functions. -@end menu - -@node Machine-Independent Predicates -@subsection Machine-Independent Predicates -@cindex machine-independent predicates -@cindex generic predicates - -These are the generic predicates available to all back ends. They are -defined in @file{recog.c}. The first category of predicates allow -only constant, or @dfn{immediate}, operands. - -@defun immediate_operand -This predicate allows any sort of constant that fits in @var{mode}. -It is an appropriate choice for instructions that take operands that -must be constant. -@end defun - -@defun const_int_operand -This predicate allows any @code{CONST_INT} expression that fits in -@var{mode}. It is an appropriate choice for an immediate operand that -does not allow a symbol or label. -@end defun - -@defun const_double_operand -This predicate accepts any @code{CONST_DOUBLE} expression that has -exactly @var{mode}. If @var{mode} is @code{VOIDmode}, it will also -accept @code{CONST_INT}. It is intended for immediate floating point -constants. -@end defun - -@noindent -The second category of predicates allow only some kind of machine -register. - -@defun register_operand -This predicate allows any @code{REG} or @code{SUBREG} expression that -is valid for @var{mode}. It is often suitable for arithmetic -instruction operands on a RISC machine. -@end defun - -@defun pmode_register_operand -This is a slight variant on @code{register_operand} which works around -a limitation in the machine-description reader. - -@smallexample -(match_operand @var{n} "pmode_register_operand" @var{constraint}) -@end smallexample - -@noindent -means exactly what - -@smallexample -(match_operand:P @var{n} "register_operand" @var{constraint}) -@end smallexample - -@noindent -would mean, if the machine-description reader accepted @samp{:P} -mode suffixes. Unfortunately, it cannot, because @code{Pmode} is an -alias for some other mode, and might vary with machine-specific -options. @xref{Misc}. -@end defun - -@defun scratch_operand -This predicate allows hard registers and @code{SCRATCH} expressions, -but not pseudo-registers. It is used internally by @code{match_scratch}; -it should not be used directly. -@end defun - -@noindent -The third category of predicates allow only some kind of memory reference. - -@defun memory_operand -This predicate allows any valid reference to a quantity of mode -@var{mode} in memory, as determined by the weak form of -@code{GO_IF_LEGITIMATE_ADDRESS} (@pxref{Addressing Modes}). -@end defun - -@defun address_operand -This predicate is a little unusual; it allows any operand that is a -valid expression for the @emph{address} of a quantity of mode -@var{mode}, again determined by the weak form of -@code{GO_IF_LEGITIMATE_ADDRESS}. To first order, if -@samp{@w{(mem:@var{mode} (@var{exp}))}} is acceptable to -@code{memory_operand}, then @var{exp} is acceptable to -@code{address_operand}. Note that @var{exp} does not necessarily have -the mode @var{mode}. -@end defun - -@defun indirect_operand -This is a stricter form of @code{memory_operand} which allows only -memory references with a @code{general_operand} as the address -expression. New uses of this predicate are discouraged, because -@code{general_operand} is very permissive, so it's hard to tell what -an @code{indirect_operand} does or does not allow. If a target has -different requirements for memory operands for different instructions, -it is better to define target-specific predicates which enforce the -hardware's requirements explicitly. -@end defun - -@defun push_operand -This predicate allows a memory reference suitable for pushing a value -onto the stack. This will be a @code{MEM} which refers to -@code{stack_pointer_rtx}, with a side-effect in its address expression -(@pxref{Incdec}); which one is determined by the -@code{STACK_PUSH_CODE} macro (@pxref{Frame Layout}). -@end defun - -@defun pop_operand -This predicate allows a memory reference suitable for popping a value -off the stack. Again, this will be a @code{MEM} referring to -@code{stack_pointer_rtx}, with a side-effect in its address -expression. However, this time @code{STACK_POP_CODE} is expected. -@end defun - -@noindent -The fourth category of predicates allow some combination of the above -operands. - -@defun nonmemory_operand -This predicate allows any immediate or register operand valid for @var{mode}. -@end defun - -@defun nonimmediate_operand -This predicate allows any register or memory operand valid for @var{mode}. -@end defun - -@defun general_operand -This predicate allows any immediate, register, or memory operand -valid for @var{mode}. -@end defun - -@noindent -Finally, there are two generic operator predicates. - -@defun comparison_operator -This predicate matches any expression which performs an arithmetic -comparison in @var{mode}; that is, @code{COMPARISON_P} is true for the -expression code. -@end defun - -@defun ordered_comparison_operator -This predicate matches any expression which performs an arithmetic -comparison in @var{mode} and whose expression code is valid for integer -modes; that is, the expression code will be one of @code{eq}, @code{ne}, -@code{lt}, @code{ltu}, @code{le}, @code{leu}, @code{gt}, @code{gtu}, -@code{ge}, @code{geu}. -@end defun - -@node Defining Predicates -@subsection Defining Machine-Specific Predicates -@cindex defining predicates -@findex define_predicate -@findex define_special_predicate - -Many machines have requirements for their operands that cannot be -expressed precisely using the generic predicates. You can define -additional predicates using @code{define_predicate} and -@code{define_special_predicate} expressions. These expressions have -three operands: - -@itemize @bullet -@item -The name of the predicate, as it will be referred to in -@code{match_operand} or @code{match_operator} expressions. - -@item -An RTL expression which evaluates to true if the predicate allows the -operand @var{op}, false if it does not. This expression can only use -the following RTL codes: - -@table @code -@item MATCH_OPERAND -When written inside a predicate expression, a @code{MATCH_OPERAND} -expression evaluates to true if the predicate it names would allow -@var{op}. The operand number and constraint are ignored. Due to -limitations in @command{genrecog}, you can only refer to generic -predicates and predicates that have already been defined. - -@item MATCH_CODE -This expression evaluates to true if @var{op} or a specified -subexpression of @var{op} has one of a given list of RTX codes. - -The first operand of this expression is a string constant containing a -comma-separated list of RTX code names (in lower case). These are the -codes for which the @code{MATCH_CODE} will be true. - -The second operand is a string constant which indicates what -subexpression of @var{op} to examine. If it is absent or the empty -string, @var{op} itself is examined. Otherwise, the string constant -must be a sequence of digits and/or lowercase letters. Each character -indicates a subexpression to extract from the current expression; for -the first character this is @var{op}, for the second and subsequent -characters it is the result of the previous character. A digit -@var{n} extracts @samp{@w{XEXP (@var{e}, @var{n})}}; a letter @var{l} -extracts @samp{@w{XVECEXP (@var{e}, 0, @var{n})}} where @var{n} is the -alphabetic ordinal of @var{l} (0 for `a', 1 for 'b', and so on). The -@code{MATCH_CODE} then examines the RTX code of the subexpression -extracted by the complete string. It is not possible to extract -components of an @code{rtvec} that is not at position 0 within its RTX -object. - -@item MATCH_TEST -This expression has one operand, a string constant containing a C -expression. The predicate's arguments, @var{op} and @var{mode}, are -available with those names in the C expression. The @code{MATCH_TEST} -evaluates to true if the C expression evaluates to a nonzero value. -@code{MATCH_TEST} expressions must not have side effects. - -@item AND -@itemx IOR -@itemx NOT -@itemx IF_THEN_ELSE -The basic @samp{MATCH_} expressions can be combined using these -logical operators, which have the semantics of the C operators -@samp{&&}, @samp{||}, @samp{!}, and @samp{@w{? :}} respectively. As -in Common Lisp, you may give an @code{AND} or @code{IOR} expression an -arbitrary number of arguments; this has exactly the same effect as -writing a chain of two-argument @code{AND} or @code{IOR} expressions. -@end table - -@item -An optional block of C code, which should execute -@samp{@w{return true}} if the predicate is found to match and -@samp{@w{return false}} if it does not. It must not have any side -effects. The predicate arguments, @var{op} and @var{mode}, are -available with those names. - -If a code block is present in a predicate definition, then the RTL -expression must evaluate to true @emph{and} the code block must -execute @samp{@w{return true}} for the predicate to allow the operand. -The RTL expression is evaluated first; do not re-check anything in the -code block that was checked in the RTL expression. -@end itemize - -The program @command{genrecog} scans @code{define_predicate} and -@code{define_special_predicate} expressions to determine which RTX -codes are possibly allowed. You should always make this explicit in -the RTL predicate expression, using @code{MATCH_OPERAND} and -@code{MATCH_CODE}. - -Here is an example of a simple predicate definition, from the IA64 -machine description: - -@smallexample -@group -;; @r{True if @var{op} is a @code{SYMBOL_REF} which refers to the sdata section.} -(define_predicate "small_addr_symbolic_operand" - (and (match_code "symbol_ref") - (match_test "SYMBOL_REF_SMALL_ADDR_P (op)"))) -@end group -@end smallexample - -@noindent -And here is another, showing the use of the C block. - -@smallexample -@group -;; @r{True if @var{op} is a register operand that is (or could be) a GR reg.} -(define_predicate "gr_register_operand" - (match_operand 0 "register_operand") -@{ - unsigned int regno; - if (GET_CODE (op) == SUBREG) - op = SUBREG_REG (op); - - regno = REGNO (op); - return (regno >= FIRST_PSEUDO_REGISTER || GENERAL_REGNO_P (regno)); -@}) -@end group -@end smallexample - -Predicates written with @code{define_predicate} automatically include -a test that @var{mode} is @code{VOIDmode}, or @var{op} has the same -mode as @var{mode}, or @var{op} is a @code{CONST_INT} or -@code{CONST_DOUBLE}. They do @emph{not} check specifically for -integer @code{CONST_DOUBLE}, nor do they test that the value of either -kind of constant fits in the requested mode. This is because -target-specific predicates that take constants usually have to do more -stringent value checks anyway. If you need the exact same treatment -of @code{CONST_INT} or @code{CONST_DOUBLE} that the generic predicates -provide, use a @code{MATCH_OPERAND} subexpression to call -@code{const_int_operand}, @code{const_double_operand}, or -@code{immediate_operand}. - -Predicates written with @code{define_special_predicate} do not get any -automatic mode checks, and are treated as having special mode handling -by @command{genrecog}. - -The program @command{genpreds} is responsible for generating code to -test predicates. It also writes a header file containing function -declarations for all machine-specific predicates. It is not necessary -to declare these predicates in @file{@var{cpu}-protos.h}. -@end ifset - -@c Most of this node appears by itself (in a different place) even -@c when the INTERNALS flag is clear. Passages that require the internals -@c manual's context are conditionalized to appear only in the internals manual. -@ifset INTERNALS -@node Constraints -@section Operand Constraints -@cindex operand constraints -@cindex constraints - -Each @code{match_operand} in an instruction pattern can specify -constraints for the operands allowed. The constraints allow you to -fine-tune matching within the set of operands allowed by the -predicate. - -@end ifset -@ifclear INTERNALS -@node Constraints -@section Constraints for @code{asm} Operands -@cindex operand constraints, @code{asm} -@cindex constraints, @code{asm} -@cindex @code{asm} constraints - -Here are specific details on what constraint letters you can use with -@code{asm} operands. -@end ifclear -Constraints can say whether -an operand may be in a register, and which kinds of register; whether the -operand can be a memory reference, and which kinds of address; whether the -operand may be an immediate constant, and which possible values it may -have. Constraints can also require two operands to match. -Side-effects aren't allowed in operands of inline @code{asm}, unless -@samp{<} or @samp{>} constraints are used, because there is no guarantee -that the side-effects will happen exactly once in an instruction that can update -the addressing register. - -@ifset INTERNALS -@menu -* Simple Constraints:: Basic use of constraints. -* Multi-Alternative:: When an insn has two alternative constraint-patterns. -* Class Preferences:: Constraints guide which hard register to put things in. -* Modifiers:: More precise control over effects of constraints. -* Machine Constraints:: Existing constraints for some particular machines. -* Disable Insn Alternatives:: Disable insn alternatives using attributes. -* Define Constraints:: How to define machine-specific constraints. -* C Constraint Interface:: How to test constraints from C code. -@end menu -@end ifset - -@ifclear INTERNALS -@menu -* Simple Constraints:: Basic use of constraints. -* Multi-Alternative:: When an insn has two alternative constraint-patterns. -* Modifiers:: More precise control over effects of constraints. -* Machine Constraints:: Special constraints for some particular machines. -@end menu -@end ifclear - -@node Simple Constraints -@subsection Simple Constraints -@cindex simple constraints - -The simplest kind of constraint is a string full of letters, each of -which describes one kind of operand that is permitted. Here are -the letters that are allowed: - -@table @asis -@item whitespace -Whitespace characters are ignored and can be inserted at any position -except the first. This enables each alternative for different operands to -be visually aligned in the machine description even if they have different -number of constraints and modifiers. - -@cindex @samp{m} in constraint -@cindex memory references in constraints -@item @samp{m} -A memory operand is allowed, with any kind of address that the machine -supports in general. -Note that the letter used for the general memory constraint can be -re-defined by a back end using the @code{TARGET_MEM_CONSTRAINT} macro. - -@cindex offsettable address -@cindex @samp{o} in constraint -@item @samp{o} -A memory operand is allowed, but only if the address is -@dfn{offsettable}. This means that adding a small integer (actually, -the width in bytes of the operand, as determined by its machine mode) -may be added to the address and the result is also a valid memory -address. - -@cindex autoincrement/decrement addressing -For example, an address which is constant is offsettable; so is an -address that is the sum of a register and a constant (as long as a -slightly larger constant is also within the range of address-offsets -supported by the machine); but an autoincrement or autodecrement -address is not offsettable. More complicated indirect/indexed -addresses may or may not be offsettable depending on the other -addressing modes that the machine supports. - -Note that in an output operand which can be matched by another -operand, the constraint letter @samp{o} is valid only when accompanied -by both @samp{<} (if the target machine has predecrement addressing) -and @samp{>} (if the target machine has preincrement addressing). - -@cindex @samp{V} in constraint -@item @samp{V} -A memory operand that is not offsettable. In other words, anything that -would fit the @samp{m} constraint but not the @samp{o} constraint. - -@cindex @samp{<} in constraint -@item @samp{<} -A memory operand with autodecrement addressing (either predecrement or -postdecrement) is allowed. In inline @code{asm} this constraint is only -allowed if the operand is used exactly once in an instruction that can -handle the side-effects. Not using an operand with @samp{<} in constraint -string in the inline @code{asm} pattern at all or using it in multiple -instructions isn't valid, because the side-effects wouldn't be performed -or would be performed more than once. Furthermore, on some targets -the operand with @samp{<} in constraint string must be accompanied by -special instruction suffixes like @code{%U0} instruction suffix on PowerPC -or @code{%P0} on IA-64. - -@cindex @samp{>} in constraint -@item @samp{>} -A memory operand with autoincrement addressing (either preincrement or -postincrement) is allowed. In inline @code{asm} the same restrictions -as for @samp{<} apply. - -@cindex @samp{r} in constraint -@cindex registers in constraints -@item @samp{r} -A register operand is allowed provided that it is in a general -register. - -@cindex constants in constraints -@cindex @samp{i} in constraint -@item @samp{i} -An immediate integer operand (one with constant value) is allowed. -This includes symbolic constants whose values will be known only at -assembly time or later. - -@cindex @samp{n} in constraint -@item @samp{n} -An immediate integer operand with a known numeric value is allowed. -Many systems cannot support assembly-time constants for operands less -than a word wide. Constraints for these operands should use @samp{n} -rather than @samp{i}. - -@cindex @samp{I} in constraint -@item @samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P} -Other letters in the range @samp{I} through @samp{P} may be defined in -a machine-dependent fashion to permit immediate integer operands with -explicit integer values in specified ranges. For example, on the -68000, @samp{I} is defined to stand for the range of values 1 to 8. -This is the range permitted as a shift count in the shift -instructions. - -@cindex @samp{E} in constraint -@item @samp{E} -An immediate floating operand (expression code @code{const_double}) is -allowed, but only if the target floating point format is the same as -that of the host machine (on which the compiler is running). - -@cindex @samp{F} in constraint -@item @samp{F} -An immediate floating operand (expression code @code{const_double} or -@code{const_vector}) is allowed. - -@cindex @samp{G} in constraint -@cindex @samp{H} in constraint -@item @samp{G}, @samp{H} -@samp{G} and @samp{H} may be defined in a machine-dependent fashion to -permit immediate floating operands in particular ranges of values. - -@cindex @samp{s} in constraint -@item @samp{s} -An immediate integer operand whose value is not an explicit integer is -allowed. - -This might appear strange; if an insn allows a constant operand with a -value not known at compile time, it certainly must allow any known -value. So why use @samp{s} instead of @samp{i}? Sometimes it allows -better code to be generated. - -For example, on the 68000 in a fullword instruction it is possible to -use an immediate operand; but if the immediate value is between @minus{}128 -and 127, better code results from loading the value into a register and -using the register. This is because the load into the register can be -done with a @samp{moveq} instruction. We arrange for this to happen -by defining the letter @samp{K} to mean ``any integer outside the -range @minus{}128 to 127'', and then specifying @samp{Ks} in the operand -constraints. - -@cindex @samp{g} in constraint -@item @samp{g} -Any register, memory or immediate integer operand is allowed, except for -registers that are not general registers. - -@cindex @samp{X} in constraint -@item @samp{X} -@ifset INTERNALS -Any operand whatsoever is allowed, even if it does not satisfy -@code{general_operand}. This is normally used in the constraint of -a @code{match_scratch} when certain alternatives will not actually -require a scratch register. -@end ifset -@ifclear INTERNALS -Any operand whatsoever is allowed. -@end ifclear - -@cindex @samp{0} in constraint -@cindex digits in constraint -@item @samp{0}, @samp{1}, @samp{2}, @dots{} @samp{9} -An operand that matches the specified operand number is allowed. If a -digit is used together with letters within the same alternative, the -digit should come last. - -This number is allowed to be more than a single digit. If multiple -digits are encountered consecutively, they are interpreted as a single -decimal integer. There is scant chance for ambiguity, since to-date -it has never been desirable that @samp{10} be interpreted as matching -either operand 1 @emph{or} operand 0. Should this be desired, one -can use multiple alternatives instead. - -@cindex matching constraint -@cindex constraint, matching -This is called a @dfn{matching constraint} and what it really means is -that the assembler has only a single operand that fills two roles -@ifset INTERNALS -considered separate in the RTL insn. For example, an add insn has two -input operands and one output operand in the RTL, but on most CISC -@end ifset -@ifclear INTERNALS -which @code{asm} distinguishes. For example, an add instruction uses -two input operands and an output operand, but on most CISC -@end ifclear -machines an add instruction really has only two operands, one of them an -input-output operand: - -@smallexample -addl #35,r12 -@end smallexample - -Matching constraints are used in these circumstances. -More precisely, the two operands that match must include one input-only -operand and one output-only operand. Moreover, the digit must be a -smaller number than the number of the operand that uses it in the -constraint. - -@ifset INTERNALS -For operands to match in a particular case usually means that they -are identical-looking RTL expressions. But in a few special cases -specific kinds of dissimilarity are allowed. For example, @code{*x} -as an input operand will match @code{*x++} as an output operand. -For proper results in such cases, the output template should always -use the output-operand's number when printing the operand. -@end ifset - -@cindex load address instruction -@cindex push address instruction -@cindex address constraints -@cindex @samp{p} in constraint -@item @samp{p} -An operand that is a valid memory address is allowed. This is -for ``load address'' and ``push address'' instructions. - -@findex address_operand -@samp{p} in the constraint must be accompanied by @code{address_operand} -as the predicate in the @code{match_operand}. This predicate interprets -the mode specified in the @code{match_operand} as the mode of the memory -reference for which the address would be valid. - -@cindex other register constraints -@cindex extensible constraints -@item @var{other-letters} -Other letters can be defined in machine-dependent fashion to stand for -particular classes of registers or other arbitrary operand types. -@samp{d}, @samp{a} and @samp{f} are defined on the 68000/68020 to stand -for data, address and floating point registers. -@end table - -@ifset INTERNALS -In order to have valid assembler code, each operand must satisfy -its constraint. But a failure to do so does not prevent the pattern -from applying to an insn. Instead, it directs the compiler to modify -the code so that the constraint will be satisfied. Usually this is -done by copying an operand into a register. - -Contrast, therefore, the two instruction patterns that follow: - -@smallexample -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r") - (plus:SI (match_dup 0) - (match_operand:SI 1 "general_operand" "r")))] - "" - "@dots{}") -@end smallexample - -@noindent -which has two operands, one of which must appear in two places, and - -@smallexample -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r") - (plus:SI (match_operand:SI 1 "general_operand" "0") - (match_operand:SI 2 "general_operand" "r")))] - "" - "@dots{}") -@end smallexample - -@noindent -which has three operands, two of which are required by a constraint to be -identical. If we are considering an insn of the form - -@smallexample -(insn @var{n} @var{prev} @var{next} - (set (reg:SI 3) - (plus:SI (reg:SI 6) (reg:SI 109))) - @dots{}) -@end smallexample - -@noindent -the first pattern would not apply at all, because this insn does not -contain two identical subexpressions in the right place. The pattern would -say, ``That does not look like an add instruction; try other patterns''. -The second pattern would say, ``Yes, that's an add instruction, but there -is something wrong with it''. It would direct the reload pass of the -compiler to generate additional insns to make the constraint true. The -results might look like this: - -@smallexample -(insn @var{n2} @var{prev} @var{n} - (set (reg:SI 3) (reg:SI 6)) - @dots{}) - -(insn @var{n} @var{n2} @var{next} - (set (reg:SI 3) - (plus:SI (reg:SI 3) (reg:SI 109))) - @dots{}) -@end smallexample - -It is up to you to make sure that each operand, in each pattern, has -constraints that can handle any RTL expression that could be present for -that operand. (When multiple alternatives are in use, each pattern must, -for each possible combination of operand expressions, have at least one -alternative which can handle that combination of operands.) The -constraints don't need to @emph{allow} any possible operand---when this is -the case, they do not constrain---but they must at least point the way to -reloading any possible operand so that it will fit. - -@itemize @bullet -@item -If the constraint accepts whatever operands the predicate permits, -there is no problem: reloading is never necessary for this operand. - -For example, an operand whose constraints permit everything except -registers is safe provided its predicate rejects registers. - -An operand whose predicate accepts only constant values is safe -provided its constraints include the letter @samp{i}. If any possible -constant value is accepted, then nothing less than @samp{i} will do; -if the predicate is more selective, then the constraints may also be -more selective. - -@item -Any operand expression can be reloaded by copying it into a register. -So if an operand's constraints allow some kind of register, it is -certain to be safe. It need not permit all classes of registers; the -compiler knows how to copy a register into another register of the -proper class in order to make an instruction valid. - -@cindex nonoffsettable memory reference -@cindex memory reference, nonoffsettable -@item -A nonoffsettable memory reference can be reloaded by copying the -address into a register. So if the constraint uses the letter -@samp{o}, all memory references are taken care of. - -@item -A constant operand can be reloaded by allocating space in memory to -hold it as preinitialized data. Then the memory reference can be used -in place of the constant. So if the constraint uses the letters -@samp{o} or @samp{m}, constant operands are not a problem. - -@item -If the constraint permits a constant and a pseudo register used in an insn -was not allocated to a hard register and is equivalent to a constant, -the register will be replaced with the constant. If the predicate does -not permit a constant and the insn is re-recognized for some reason, the -compiler will crash. Thus the predicate must always recognize any -objects allowed by the constraint. -@end itemize - -If the operand's predicate can recognize registers, but the constraint does -not permit them, it can make the compiler crash. When this operand happens -to be a register, the reload pass will be stymied, because it does not know -how to copy a register temporarily into memory. - -If the predicate accepts a unary operator, the constraint applies to the -operand. For example, the MIPS processor at ISA level 3 supports an -instruction which adds two registers in @code{SImode} to produce a -@code{DImode} result, but only if the registers are correctly sign -extended. This predicate for the input operands accepts a -@code{sign_extend} of an @code{SImode} register. Write the constraint -to indicate the type of register that is required for the operand of the -@code{sign_extend}. -@end ifset - -@node Multi-Alternative -@subsection Multiple Alternative Constraints -@cindex multiple alternative constraints - -Sometimes a single instruction has multiple alternative sets of possible -operands. For example, on the 68000, a logical-or instruction can combine -register or an immediate value into memory, or it can combine any kind of -operand into a register; but it cannot combine one memory location into -another. - -These constraints are represented as multiple alternatives. An alternative -can be described by a series of letters for each operand. The overall -constraint for an operand is made from the letters for this operand -from the first alternative, a comma, the letters for this operand from -the second alternative, a comma, and so on until the last alternative. -@ifset INTERNALS -Here is how it is done for fullword logical-or on the 68000: - -@smallexample -(define_insn "iorsi3" - [(set (match_operand:SI 0 "general_operand" "=m,d") - (ior:SI (match_operand:SI 1 "general_operand" "%0,0") - (match_operand:SI 2 "general_operand" "dKs,dmKs")))] - @dots{}) -@end smallexample - -The first alternative has @samp{m} (memory) for operand 0, @samp{0} for -operand 1 (meaning it must match operand 0), and @samp{dKs} for operand -2. The second alternative has @samp{d} (data register) for operand 0, -@samp{0} for operand 1, and @samp{dmKs} for operand 2. The @samp{=} and -@samp{%} in the constraints apply to all the alternatives; their -meaning is explained in the next section (@pxref{Class Preferences}). -@end ifset - -@c FIXME Is this ? and ! stuff of use in asm()? If not, hide unless INTERNAL -If all the operands fit any one alternative, the instruction is valid. -Otherwise, for each alternative, the compiler counts how many instructions -must be added to copy the operands so that that alternative applies. -The alternative requiring the least copying is chosen. If two alternatives -need the same amount of copying, the one that comes first is chosen. -These choices can be altered with the @samp{?} and @samp{!} characters: - -@table @code -@cindex @samp{?} in constraint -@cindex question mark -@item ? -Disparage slightly the alternative that the @samp{?} appears in, -as a choice when no alternative applies exactly. The compiler regards -this alternative as one unit more costly for each @samp{?} that appears -in it. - -@cindex @samp{!} in constraint -@cindex exclamation point -@item ! -Disparage severely the alternative that the @samp{!} appears in. -This alternative can still be used if it fits without reloading, -but if reloading is needed, some other alternative will be used. - -@cindex @samp{^} in constraint -@cindex caret -@item ^ -This constraint is analogous to @samp{?} but it disparages slightly -the alternative only if the operand with the @samp{^} needs a reload. - -@cindex @samp{$} in constraint -@cindex dollar sign -@item $ -This constraint is analogous to @samp{!} but it disparages severely -the alternative only if the operand with the @samp{$} needs a reload. -@end table - -@ifset INTERNALS -When an insn pattern has multiple alternatives in its constraints, often -the appearance of the assembler code is determined mostly by which -alternative was matched. When this is so, the C code for writing the -assembler code can use the variable @code{which_alternative}, which is -the ordinal number of the alternative that was actually satisfied (0 for -the first, 1 for the second alternative, etc.). @xref{Output Statement}. -@end ifset - -@ifset INTERNALS -@node Class Preferences -@subsection Register Class Preferences -@cindex class preference constraints -@cindex register class preference constraints - -@cindex voting between constraint alternatives -The operand constraints have another function: they enable the compiler -to decide which kind of hardware register a pseudo register is best -allocated to. The compiler examines the constraints that apply to the -insns that use the pseudo register, looking for the machine-dependent -letters such as @samp{d} and @samp{a} that specify classes of registers. -The pseudo register is put in whichever class gets the most ``votes''. -The constraint letters @samp{g} and @samp{r} also vote: they vote in -favor of a general register. The machine description says which registers -are considered general. - -Of course, on some machines all registers are equivalent, and no register -classes are defined. Then none of this complexity is relevant. -@end ifset - -@node Modifiers -@subsection Constraint Modifier Characters -@cindex modifiers in constraints -@cindex constraint modifier characters - -@c prevent bad page break with this line -Here are constraint modifier characters. - -@table @samp -@cindex @samp{=} in constraint -@item = -Means that this operand is written to by this instruction: -the previous value is discarded and replaced by new data. - -@cindex @samp{+} in constraint -@item + -Means that this operand is both read and written by the instruction. - -When the compiler fixes up the operands to satisfy the constraints, -it needs to know which operands are read by the instruction and -which are written by it. @samp{=} identifies an operand which is only -written; @samp{+} identifies an operand that is both read and written; all -other operands are assumed to only be read. - -If you specify @samp{=} or @samp{+} in a constraint, you put it in the -first character of the constraint string. - -@cindex @samp{&} in constraint -@cindex earlyclobber operand -@item & -Means (in a particular alternative) that this operand is an -@dfn{earlyclobber} operand, which is written before the instruction is -finished using the input operands. Therefore, this operand may not lie -in a register that is read by the instruction or as part of any memory -address. - -@samp{&} applies only to the alternative in which it is written. In -constraints with multiple alternatives, sometimes one alternative -requires @samp{&} while others do not. See, for example, the -@samp{movdf} insn of the 68000. - -A operand which is read by the instruction can be tied to an earlyclobber -operand if its only use as an input occurs before the early result is -written. Adding alternatives of this form often allows GCC to produce -better code when only some of the read operands can be affected by the -earlyclobber. See, for example, the @samp{mulsi3} insn of the ARM@. - -Furthermore, if the @dfn{earlyclobber} operand is also a read/write -operand, then that operand is written only after it's used. - -@samp{&} does not obviate the need to write @samp{=} or @samp{+}. As -@dfn{earlyclobber} operands are always written, a read-only -@dfn{earlyclobber} operand is ill-formed and will be rejected by the -compiler. - -@cindex @samp{%} in constraint -@item % -Declares the instruction to be commutative for this operand and the -following operand. This means that the compiler may interchange the -two operands if that is the cheapest way to make all operands fit the -constraints. @samp{%} applies to all alternatives and must appear as -the first character in the constraint. Only read-only operands can use -@samp{%}. - -@ifset INTERNALS -This is often used in patterns for addition instructions -that really have only two operands: the result must go in one of the -arguments. Here for example, is how the 68000 halfword-add -instruction is defined: - -@smallexample -(define_insn "addhi3" - [(set (match_operand:HI 0 "general_operand" "=m,r") - (plus:HI (match_operand:HI 1 "general_operand" "%0,0") - (match_operand:HI 2 "general_operand" "di,g")))] - @dots{}) -@end smallexample -@end ifset -GCC can only handle one commutative pair in an asm; if you use more, -the compiler may fail. Note that you need not use the modifier if -the two alternatives are strictly identical; this would only waste -time in the reload pass. The modifier is not operational after -register allocation, so the result of @code{define_peephole2} -and @code{define_split}s performed after reload cannot rely on -@samp{%} to make the intended insn match. - -@cindex @samp{#} in constraint -@item # -Says that all following characters, up to the next comma, are to be -ignored as a constraint. They are significant only for choosing -register preferences. - -@cindex @samp{*} in constraint -@item * -Says that the following character should be ignored when choosing -register preferences. @samp{*} has no effect on the meaning of the -constraint as a constraint, and no effect on reloading. For LRA -@samp{*} additionally disparages slightly the alternative if the -following character matches the operand. - -@ifset INTERNALS -Here is an example: the 68000 has an instruction to sign-extend a -halfword in a data register, and can also sign-extend a value by -copying it into an address register. While either kind of register is -acceptable, the constraints on an address-register destination are -less strict, so it is best if register allocation makes an address -register its goal. Therefore, @samp{*} is used so that the @samp{d} -constraint letter (for data register) is ignored when computing -register preferences. - -@smallexample -(define_insn "extendhisi2" - [(set (match_operand:SI 0 "general_operand" "=*d,a") - (sign_extend:SI - (match_operand:HI 1 "general_operand" "0,g")))] - @dots{}) -@end smallexample -@end ifset -@end table - -@node Machine Constraints -@subsection Constraints for Particular Machines -@cindex machine specific constraints -@cindex constraints, machine specific - -Whenever possible, you should use the general-purpose constraint letters -in @code{asm} arguments, since they will convey meaning more readily to -people reading your code. Failing that, use the constraint letters -that usually have very similar meanings across architectures. The most -commonly used constraints are @samp{m} and @samp{r} (for memory and -general-purpose registers respectively; @pxref{Simple Constraints}), and -@samp{I}, usually the letter indicating the most common -immediate-constant format. - -Each architecture defines additional constraints. These constraints -are used by the compiler itself for instruction generation, as well as -for @code{asm} statements; therefore, some of the constraints are not -particularly useful for @code{asm}. Here is a summary of some of the -machine-dependent constraints available on some particular machines; -it includes both constraints that are useful for @code{asm} and -constraints that aren't. The compiler source file mentioned in the -table heading for each architecture is the definitive reference for -the meanings of that architecture's constraints. - -@c Please keep this table alphabetized by target! -@table @emph -@item AArch64 family---@file{config/aarch64/constraints.md} -@table @code -@item k -The stack pointer register (@code{SP}) - -@item w -Floating point or SIMD vector register - -@item I -Integer constant that is valid as an immediate operand in an @code{ADD} -instruction - -@item J -Integer constant that is valid as an immediate operand in a @code{SUB} -instruction (once negated) - -@item K -Integer constant that can be used with a 32-bit logical instruction - -@item L -Integer constant that can be used with a 64-bit logical instruction - -@item M -Integer constant that is valid as an immediate operand in a 32-bit @code{MOV} -pseudo instruction. The @code{MOV} may be assembled to one of several different -machine instructions depending on the value - -@item N -Integer constant that is valid as an immediate operand in a 64-bit @code{MOV} -pseudo instruction - -@item S -An absolute symbolic address or a label reference - -@item Y -Floating point constant zero - -@item Z -Integer constant zero - -@item Ush -The high part (bits 12 and upwards) of the pc-relative address of a symbol -within 4GB of the instruction - -@item Q -A memory address which uses a single base register with no offset - -@item Ump -A memory address suitable for a load/store pair instruction in SI, DI, SF and -DF modes - -@end table - - -@item ARC ---@file{config/arc/constraints.md} -@table @code -@item q -Registers usable in ARCompact 16-bit instructions: @code{r0}-@code{r3}, -@code{r12}-@code{r15}. This constraint can only match when the @option{-mq} -option is in effect. - -@item e -Registers usable as base-regs of memory addresses in ARCompact 16-bit memory -instructions: @code{r0}-@code{r3}, @code{r12}-@code{r15}, @code{sp}. -This constraint can only match when the @option{-mq} -option is in effect. -@item D -ARC FPX (dpfp) 64-bit registers. @code{D0}, @code{D1}. - -@item I -A signed 12-bit integer constant. - -@item Cal -constant for arithmetic/logical operations. This might be any constant -that can be put into a long immediate by the assmbler or linker without -involving a PIC relocation. - -@item K -A 3-bit unsigned integer constant. - -@item L -A 6-bit unsigned integer constant. - -@item CnL -One's complement of a 6-bit unsigned integer constant. - -@item CmL -Two's complement of a 6-bit unsigned integer constant. - -@item M -A 5-bit unsigned integer constant. - -@item O -A 7-bit unsigned integer constant. - -@item P -A 8-bit unsigned integer constant. - -@item H -Any const_double value. -@end table - -@item ARM family---@file{config/arm/constraints.md} -@table @code - -@item h -In Thumb state, the core registers @code{r8}-@code{r15}. - -@item k -The stack pointer register. - -@item l -In Thumb State the core registers @code{r0}-@code{r7}. In ARM state this -is an alias for the @code{r} constraint. - -@item t -VFP floating-point registers @code{s0}-@code{s31}. Used for 32 bit values. - -@item w -VFP floating-point registers @code{d0}-@code{d31} and the appropriate -subset @code{d0}-@code{d15} based on command line options. -Used for 64 bit values only. Not valid for Thumb1. - -@item y -The iWMMX co-processor registers. - -@item z -The iWMMX GR registers. - -@item G -The floating-point constant 0.0 - -@item I -Integer that is valid as an immediate operand in a data processing -instruction. That is, an integer in the range 0 to 255 rotated by a -multiple of 2 - -@item J -Integer in the range @minus{}4095 to 4095 - -@item K -Integer that satisfies constraint @samp{I} when inverted (ones complement) - -@item L -Integer that satisfies constraint @samp{I} when negated (twos complement) - -@item M -Integer in the range 0 to 32 - -@item Q -A memory reference where the exact address is in a single register -(`@samp{m}' is preferable for @code{asm} statements) - -@item R -An item in the constant pool - -@item S -A symbol in the text segment of the current file - -@item Uv -A memory reference suitable for VFP load/store insns (reg+constant offset) - -@item Uy -A memory reference suitable for iWMMXt load/store instructions. - -@item Uq -A memory reference suitable for the ARMv4 ldrsb instruction. -@end table - -@item AVR family---@file{config/avr/constraints.md} -@table @code -@item l -Registers from r0 to r15 - -@item a -Registers from r16 to r23 - -@item d -Registers from r16 to r31 - -@item w -Registers from r24 to r31. These registers can be used in @samp{adiw} command - -@item e -Pointer register (r26--r31) - -@item b -Base pointer register (r28--r31) - -@item q -Stack pointer register (SPH:SPL) - -@item t -Temporary register r0 - -@item x -Register pair X (r27:r26) - -@item y -Register pair Y (r29:r28) - -@item z -Register pair Z (r31:r30) - -@item I -Constant greater than @minus{}1, less than 64 - -@item J -Constant greater than @minus{}64, less than 1 - -@item K -Constant integer 2 - -@item L -Constant integer 0 - -@item M -Constant that fits in 8 bits - -@item N -Constant integer @minus{}1 - -@item O -Constant integer 8, 16, or 24 - -@item P -Constant integer 1 - -@item G -A floating point constant 0.0 - -@item Q -A memory address based on Y or Z pointer with displacement. -@end table - -@item Blackfin family---@file{config/bfin/constraints.md} -@table @code -@item a -P register - -@item d -D register - -@item z -A call clobbered P register. - -@item q@var{n} -A single register. If @var{n} is in the range 0 to 7, the corresponding D -register. If it is @code{A}, then the register P0. - -@item D -Even-numbered D register - -@item W -Odd-numbered D register - -@item e -Accumulator register. - -@item A -Even-numbered accumulator register. - -@item B -Odd-numbered accumulator register. - -@item b -I register - -@item v -B register - -@item f -M register - -@item c -Registers used for circular buffering, i.e. I, B, or L registers. - -@item C -The CC register. - -@item t -LT0 or LT1. - -@item k -LC0 or LC1. - -@item u -LB0 or LB1. - -@item x -Any D, P, B, M, I or L register. - -@item y -Additional registers typically used only in prologues and epilogues: RETS, -RETN, RETI, RETX, RETE, ASTAT, SEQSTAT and USP. - -@item w -Any register except accumulators or CC. - -@item Ksh -Signed 16 bit integer (in the range @minus{}32768 to 32767) - -@item Kuh -Unsigned 16 bit integer (in the range 0 to 65535) - -@item Ks7 -Signed 7 bit integer (in the range @minus{}64 to 63) - -@item Ku7 -Unsigned 7 bit integer (in the range 0 to 127) - -@item Ku5 -Unsigned 5 bit integer (in the range 0 to 31) - -@item Ks4 -Signed 4 bit integer (in the range @minus{}8 to 7) - -@item Ks3 -Signed 3 bit integer (in the range @minus{}3 to 4) - -@item Ku3 -Unsigned 3 bit integer (in the range 0 to 7) - -@item P@var{n} -Constant @var{n}, where @var{n} is a single-digit constant in the range 0 to 4. - -@item PA -An integer equal to one of the MACFLAG_XXX constants that is suitable for -use with either accumulator. - -@item PB -An integer equal to one of the MACFLAG_XXX constants that is suitable for -use only with accumulator A1. - -@item M1 -Constant 255. - -@item M2 -Constant 65535. - -@item J -An integer constant with exactly a single bit set. - -@item L -An integer constant with all bits set except exactly one. - -@item H - -@item Q -Any SYMBOL_REF. -@end table - -@item CR16 Architecture---@file{config/cr16/cr16.h} -@table @code - -@item b -Registers from r0 to r14 (registers without stack pointer) - -@item t -Register from r0 to r11 (all 16-bit registers) - -@item p -Register from r12 to r15 (all 32-bit registers) - -@item I -Signed constant that fits in 4 bits - -@item J -Signed constant that fits in 5 bits - -@item K -Signed constant that fits in 6 bits - -@item L -Unsigned constant that fits in 4 bits - -@item M -Signed constant that fits in 32 bits - -@item N -Check for 64 bits wide constants for add/sub instructions - -@item G -Floating point constant that is legal for store immediate -@end table - -@item Epiphany---@file{config/epiphany/constraints.md} -@table @code -@item U16 -An unsigned 16-bit constant. - -@item K -An unsigned 5-bit constant. - -@item L -A signed 11-bit constant. - -@item Cm1 -A signed 11-bit constant added to @minus{}1. -Can only match when the @option{-m1reg-@var{reg}} option is active. - -@item Cl1 -Left-shift of @minus{}1, i.e., a bit mask with a block of leading ones, the rest -being a block of trailing zeroes. -Can only match when the @option{-m1reg-@var{reg}} option is active. - -@item Cr1 -Right-shift of @minus{}1, i.e., a bit mask with a trailing block of ones, the -rest being zeroes. Or to put it another way, one less than a power of two. -Can only match when the @option{-m1reg-@var{reg}} option is active. - -@item Cal -Constant for arithmetic/logical operations. -This is like @code{i}, except that for position independent code, -no symbols / expressions needing relocations are allowed. - -@item Csy -Symbolic constant for call/jump instruction. - -@item Rcs -The register class usable in short insns. This is a register class -constraint, and can thus drive register allocation. -This constraint won't match unless @option{-mprefer-short-insn-regs} is -in effect. - -@item Rsc -The the register class of registers that can be used to hold a -sibcall call address. I.e., a caller-saved register. - -@item Rct -Core control register class. - -@item Rgs -The register group usable in short insns. -This constraint does not use a register class, so that it only -passively matches suitable registers, and doesn't drive register allocation. - -@ifset INTERNALS -@item Car -Constant suitable for the addsi3_r pattern. This is a valid offset -For byte, halfword, or word addressing. -@end ifset - -@item Rra -Matches the return address if it can be replaced with the link register. - -@item Rcc -Matches the integer condition code register. - -@item Sra -Matches the return address if it is in a stack slot. - -@item Cfm -Matches control register values to switch fp mode, which are encapsulated in -@code{UNSPEC_FP_MODE}. -@end table - -@item FRV---@file{config/frv/frv.h} -@table @code -@item a -Register in the class @code{ACC_REGS} (@code{acc0} to @code{acc7}). - -@item b -Register in the class @code{EVEN_ACC_REGS} (@code{acc0} to @code{acc7}). - -@item c -Register in the class @code{CC_REGS} (@code{fcc0} to @code{fcc3} and -@code{icc0} to @code{icc3}). - -@item d -Register in the class @code{GPR_REGS} (@code{gr0} to @code{gr63}). - -@item e -Register in the class @code{EVEN_REGS} (@code{gr0} to @code{gr63}). -Odd registers are excluded not in the class but through the use of a machine -mode larger than 4 bytes. - -@item f -Register in the class @code{FPR_REGS} (@code{fr0} to @code{fr63}). - -@item h -Register in the class @code{FEVEN_REGS} (@code{fr0} to @code{fr63}). -Odd registers are excluded not in the class but through the use of a machine -mode larger than 4 bytes. - -@item l -Register in the class @code{LR_REG} (the @code{lr} register). - -@item q -Register in the class @code{QUAD_REGS} (@code{gr2} to @code{gr63}). -Register numbers not divisible by 4 are excluded not in the class but through -the use of a machine mode larger than 8 bytes. - -@item t -Register in the class @code{ICC_REGS} (@code{icc0} to @code{icc3}). - -@item u -Register in the class @code{FCC_REGS} (@code{fcc0} to @code{fcc3}). - -@item v -Register in the class @code{ICR_REGS} (@code{cc4} to @code{cc7}). - -@item w -Register in the class @code{FCR_REGS} (@code{cc0} to @code{cc3}). - -@item x -Register in the class @code{QUAD_FPR_REGS} (@code{fr0} to @code{fr63}). -Register numbers not divisible by 4 are excluded not in the class but through -the use of a machine mode larger than 8 bytes. - -@item z -Register in the class @code{SPR_REGS} (@code{lcr} and @code{lr}). - -@item A -Register in the class @code{QUAD_ACC_REGS} (@code{acc0} to @code{acc7}). - -@item B -Register in the class @code{ACCG_REGS} (@code{accg0} to @code{accg7}). - -@item C -Register in the class @code{CR_REGS} (@code{cc0} to @code{cc7}). - -@item G -Floating point constant zero - -@item I -6-bit signed integer constant - -@item J -10-bit signed integer constant - -@item L -16-bit signed integer constant - -@item M -16-bit unsigned integer constant - -@item N -12-bit signed integer constant that is negative---i.e.@: in the -range of @minus{}2048 to @minus{}1 - -@item O -Constant zero - -@item P -12-bit signed integer constant that is greater than zero---i.e.@: in the -range of 1 to 2047. - -@end table - -@item Hewlett-Packard PA-RISC---@file{config/pa/pa.h} -@table @code -@item a -General register 1 - -@item f -Floating point register - -@item q -Shift amount register - -@item x -Floating point register (deprecated) - -@item y -Upper floating point register (32-bit), floating point register (64-bit) - -@item Z -Any register - -@item I -Signed 11-bit integer constant - -@item J -Signed 14-bit integer constant - -@item K -Integer constant that can be deposited with a @code{zdepi} instruction - -@item L -Signed 5-bit integer constant - -@item M -Integer constant 0 - -@item N -Integer constant that can be loaded with a @code{ldil} instruction - -@item O -Integer constant whose value plus one is a power of 2 - -@item P -Integer constant that can be used for @code{and} operations in @code{depi} -and @code{extru} instructions - -@item S -Integer constant 31 - -@item U -Integer constant 63 - -@item G -Floating-point constant 0.0 - -@item A -A @code{lo_sum} data-linkage-table memory operand - -@item Q -A memory operand that can be used as the destination operand of an -integer store instruction - -@item R -A scaled or unscaled indexed memory operand - -@item T -A memory operand for floating-point loads and stores - -@item W -A register indirect memory operand -@end table - -@item Intel IA-64---@file{config/ia64/ia64.h} -@table @code -@item a -General register @code{r0} to @code{r3} for @code{addl} instruction - -@item b -Branch register - -@item c -Predicate register (@samp{c} as in ``conditional'') - -@item d -Application register residing in M-unit - -@item e -Application register residing in I-unit - -@item f -Floating-point register - -@item m -Memory operand. If used together with @samp{<} or @samp{>}, -the operand can have postincrement and postdecrement which -require printing with @samp{%Pn} on IA-64. - -@item G -Floating-point constant 0.0 or 1.0 - -@item I -14-bit signed integer constant - -@item J -22-bit signed integer constant - -@item K -8-bit signed integer constant for logical instructions - -@item L -8-bit adjusted signed integer constant for compare pseudo-ops - -@item M -6-bit unsigned integer constant for shift counts - -@item N -9-bit signed integer constant for load and store postincrements - -@item O -The constant zero - -@item P -0 or @minus{}1 for @code{dep} instruction - -@item Q -Non-volatile memory for floating-point loads and stores - -@item R -Integer constant in the range 1 to 4 for @code{shladd} instruction - -@item S -Memory operand except postincrement and postdecrement. This is -now roughly the same as @samp{m} when not used together with @samp{<} -or @samp{>}. -@end table - -@item M32C---@file{config/m32c/m32c.c} -@table @code -@item Rsp -@itemx Rfb -@itemx Rsb -@samp{$sp}, @samp{$fb}, @samp{$sb}. - -@item Rcr -Any control register, when they're 16 bits wide (nothing if control -registers are 24 bits wide) - -@item Rcl -Any control register, when they're 24 bits wide. - -@item R0w -@itemx R1w -@itemx R2w -@itemx R3w -$r0, $r1, $r2, $r3. - -@item R02 -$r0 or $r2, or $r2r0 for 32 bit values. - -@item R13 -$r1 or $r3, or $r3r1 for 32 bit values. - -@item Rdi -A register that can hold a 64 bit value. - -@item Rhl -$r0 or $r1 (registers with addressable high/low bytes) - -@item R23 -$r2 or $r3 - -@item Raa -Address registers - -@item Raw -Address registers when they're 16 bits wide. - -@item Ral -Address registers when they're 24 bits wide. - -@item Rqi -Registers that can hold QI values. - -@item Rad -Registers that can be used with displacements ($a0, $a1, $sb). - -@item Rsi -Registers that can hold 32 bit values. - -@item Rhi -Registers that can hold 16 bit values. - -@item Rhc -Registers chat can hold 16 bit values, including all control -registers. - -@item Rra -$r0 through R1, plus $a0 and $a1. - -@item Rfl -The flags register. - -@item Rmm -The memory-based pseudo-registers $mem0 through $mem15. - -@item Rpi -Registers that can hold pointers (16 bit registers for r8c, m16c; 24 -bit registers for m32cm, m32c). - -@item Rpa -Matches multiple registers in a PARALLEL to form a larger register. -Used to match function return values. - -@item Is3 -@minus{}8 @dots{} 7 - -@item IS1 -@minus{}128 @dots{} 127 - -@item IS2 -@minus{}32768 @dots{} 32767 - -@item IU2 -0 @dots{} 65535 - -@item In4 -@minus{}8 @dots{} @minus{}1 or 1 @dots{} 8 - -@item In5 -@minus{}16 @dots{} @minus{}1 or 1 @dots{} 16 - -@item In6 -@minus{}32 @dots{} @minus{}1 or 1 @dots{} 32 - -@item IM2 -@minus{}65536 @dots{} @minus{}1 - -@item Ilb -An 8 bit value with exactly one bit set. - -@item Ilw -A 16 bit value with exactly one bit set. - -@item Sd -The common src/dest memory addressing modes. - -@item Sa -Memory addressed using $a0 or $a1. - -@item Si -Memory addressed with immediate addresses. - -@item Ss -Memory addressed using the stack pointer ($sp). - -@item Sf -Memory addressed using the frame base register ($fb). - -@item Ss -Memory addressed using the small base register ($sb). - -@item S1 -$r1h -@end table - -@item MeP---@file{config/mep/constraints.md} -@table @code - -@item a -The $sp register. - -@item b -The $tp register. - -@item c -Any control register. - -@item d -Either the $hi or the $lo register. - -@item em -Coprocessor registers that can be directly loaded ($c0-$c15). - -@item ex -Coprocessor registers that can be moved to each other. - -@item er -Coprocessor registers that can be moved to core registers. - -@item h -The $hi register. - -@item j -The $rpc register. - -@item l -The $lo register. - -@item t -Registers which can be used in $tp-relative addressing. - -@item v -The $gp register. - -@item x -The coprocessor registers. - -@item y -The coprocessor control registers. - -@item z -The $0 register. - -@item A -User-defined register set A. - -@item B -User-defined register set B. - -@item C -User-defined register set C. - -@item D -User-defined register set D. - -@item I -Offsets for $gp-rel addressing. - -@item J -Constants that can be used directly with boolean insns. - -@item K -Constants that can be moved directly to registers. - -@item L -Small constants that can be added to registers. - -@item M -Long shift counts. - -@item N -Small constants that can be compared to registers. - -@item O -Constants that can be loaded into the top half of registers. - -@item S -Signed 8-bit immediates. - -@item T -Symbols encoded for $tp-rel or $gp-rel addressing. - -@item U -Non-constant addresses for loading/saving coprocessor registers. - -@item W -The top half of a symbol's value. - -@item Y -A register indirect address without offset. - -@item Z -Symbolic references to the control bus. - -@end table - -@item MicroBlaze---@file{config/microblaze/constraints.md} -@table @code -@item d -A general register (@code{r0} to @code{r31}). - -@item z -A status register (@code{rmsr}, @code{$fcc1} to @code{$fcc7}). - -@end table - -@item MIPS---@file{config/mips/constraints.md} -@table @code -@item d -An address register. This is equivalent to @code{r} unless -generating MIPS16 code. - -@item f -A floating-point register (if available). - -@item h -Formerly the @code{hi} register. This constraint is no longer supported. - -@item l -The @code{lo} register. Use this register to store values that are -no bigger than a word. - -@item x -The concatenated @code{hi} and @code{lo} registers. Use this register -to store doubleword values. - -@item c -A register suitable for use in an indirect jump. This will always be -@code{$25} for @option{-mabicalls}. - -@item v -Register @code{$3}. Do not use this constraint in new code; -it is retained only for compatibility with glibc. - -@item y -Equivalent to @code{r}; retained for backwards compatibility. - -@item z -A floating-point condition code register. - -@item I -A signed 16-bit constant (for arithmetic instructions). - -@item J -Integer zero. - -@item K -An unsigned 16-bit constant (for logic instructions). - -@item L -A signed 32-bit constant in which the lower 16 bits are zero. -Such constants can be loaded using @code{lui}. - -@item M -A constant that cannot be loaded using @code{lui}, @code{addiu} -or @code{ori}. - -@item N -A constant in the range @minus{}65535 to @minus{}1 (inclusive). - -@item O -A signed 15-bit constant. - -@item P -A constant in the range 1 to 65535 (inclusive). - -@item G -Floating-point zero. - -@item R -An address that can be used in a non-macro load or store. - -@item ZC -A memory operand whose address is formed by a base register and offset -that is suitable for use in instructions with the same addressing mode -as @code{ll} and @code{sc}. - -@item ZD -An address suitable for a @code{prefetch} instruction, or for any other -instruction with the same addressing mode as @code{prefetch}. -@end table - -@item Motorola 680x0---@file{config/m68k/constraints.md} -@table @code -@item a -Address register - -@item d -Data register - -@item f -68881 floating-point register, if available - -@item I -Integer in the range 1 to 8 - -@item J -16-bit signed number - -@item K -Signed number whose magnitude is greater than 0x80 - -@item L -Integer in the range @minus{}8 to @minus{}1 - -@item M -Signed number whose magnitude is greater than 0x100 - -@item N -Range 24 to 31, rotatert:SI 8 to 1 expressed as rotate - -@item O -16 (for rotate using swap) - -@item P -Range 8 to 15, rotatert:HI 8 to 1 expressed as rotate - -@item R -Numbers that mov3q can handle - -@item G -Floating point constant that is not a 68881 constant - -@item S -Operands that satisfy 'm' when -mpcrel is in effect - -@item T -Operands that satisfy 's' when -mpcrel is not in effect - -@item Q -Address register indirect addressing mode - -@item U -Register offset addressing - -@item W -const_call_operand - -@item Cs -symbol_ref or const - -@item Ci -const_int - -@item C0 -const_int 0 - -@item Cj -Range of signed numbers that don't fit in 16 bits - -@item Cmvq -Integers valid for mvq - -@item Capsw -Integers valid for a moveq followed by a swap - -@item Cmvz -Integers valid for mvz - -@item Cmvs -Integers valid for mvs - -@item Ap -push_operand - -@item Ac -Non-register operands allowed in clr - -@end table - -@item Moxie---@file{config/moxie/constraints.md} -@table @code -@item A -An absolute address - -@item B -An offset address - -@item W -A register indirect memory operand - -@item I -A constant in the range of 0 to 255. - -@item N -A constant in the range of 0 to @minus{}255. - -@end table - -@item MSP430--@file{config/msp430/constraints.md} -@table @code - -@item R12 -Register R12. - -@item R13 -Register R13. - -@item K -Integer constant 1. - -@item L -Integer constant -1^20..1^19. - -@item M -Integer constant 1-4. - -@item Ya -Memory references which do not require an extended MOVX instruction. - -@item Yl -Memory reference, labels only. - -@item Ys -Memory reference, stack only. - -@end table - -@item NDS32---@file{config/nds32/constraints.md} -@table @code -@item w -LOW register class $r0 to $r7 constraint for V3/V3M ISA. -@item l -LOW register class $r0 to $r7. -@item d -MIDDLE register class $r0 to $r11, $r16 to $r19. -@item h -HIGH register class $r12 to $r14, $r20 to $r31. -@item t -Temporary assist register $ta (i.e.@: $r15). -@item k -Stack register $sp. -@item Iu03 -Unsigned immediate 3-bit value. -@item In03 -Negative immediate 3-bit value in the range of @minus{}7--0. -@item Iu04 -Unsigned immediate 4-bit value. -@item Is05 -Signed immediate 5-bit value. -@item Iu05 -Unsigned immediate 5-bit value. -@item In05 -Negative immediate 5-bit value in the range of @minus{}31--0. -@item Ip05 -Unsigned immediate 5-bit value for movpi45 instruction with range 16--47. -@item Iu06 -Unsigned immediate 6-bit value constraint for addri36.sp instruction. -@item Iu08 -Unsigned immediate 8-bit value. -@item Iu09 -Unsigned immediate 9-bit value. -@item Is10 -Signed immediate 10-bit value. -@item Is11 -Signed immediate 11-bit value. -@item Is15 -Signed immediate 15-bit value. -@item Iu15 -Unsigned immediate 15-bit value. -@item Ic15 -A constant which is not in the range of imm15u but ok for bclr instruction. -@item Ie15 -A constant which is not in the range of imm15u but ok for bset instruction. -@item It15 -A constant which is not in the range of imm15u but ok for btgl instruction. -@item Ii15 -A constant whose compliment value is in the range of imm15u -and ok for bitci instruction. -@item Is16 -Signed immediate 16-bit value. -@item Is17 -Signed immediate 17-bit value. -@item Is19 -Signed immediate 19-bit value. -@item Is20 -Signed immediate 20-bit value. -@item Ihig -The immediate value that can be simply set high 20-bit. -@item Izeb -The immediate value 0xff. -@item Izeh -The immediate value 0xffff. -@item Ixls -The immediate value 0x01. -@item Ix11 -The immediate value 0x7ff. -@item Ibms -The immediate value with power of 2. -@item Ifex -The immediate value with power of 2 minus 1. -@item U33 -Memory constraint for 333 format. -@item U45 -Memory constraint for 45 format. -@item U37 -Memory constraint for 37 format. -@end table - -@item Nios II family---@file{config/nios2/constraints.md} -@table @code - -@item I -Integer that is valid as an immediate operand in an -instruction taking a signed 16-bit number. Range -@minus{}32768 to 32767. - -@item J -Integer that is valid as an immediate operand in an -instruction taking an unsigned 16-bit number. Range -0 to 65535. - -@item K -Integer that is valid as an immediate operand in an -instruction taking only the upper 16-bits of a -32-bit number. Range 32-bit numbers with the lower -16-bits being 0. - -@item L -Integer that is valid as an immediate operand for a -shift instruction. Range 0 to 31. - -@item M -Integer that is valid as an immediate operand for -only the value 0. Can be used in conjunction with -the format modifier @code{z} to use @code{r0} -instead of @code{0} in the assembly output. - -@item N -Integer that is valid as an immediate operand for -a custom instruction opcode. Range 0 to 255. - -@item S -Matches immediates which are addresses in the small -data section and therefore can be added to @code{gp} -as a 16-bit immediate to re-create their 32-bit value. - -@ifset INTERNALS -@item T -A @code{const} wrapped @code{UNSPEC} expression, -representing a supported PIC or TLS relocation. -@end ifset - -@end table - -@item PDP-11---@file{config/pdp11/constraints.md} -@table @code -@item a -Floating point registers AC0 through AC3. These can be loaded from/to -memory with a single instruction. - -@item d -Odd numbered general registers (R1, R3, R5). These are used for -16-bit multiply operations. - -@item f -Any of the floating point registers (AC0 through AC5). - -@item G -Floating point constant 0. - -@item I -An integer constant that fits in 16 bits. - -@item J -An integer constant whose low order 16 bits are zero. - -@item K -An integer constant that does not meet the constraints for codes -@samp{I} or @samp{J}. - -@item L -The integer constant 1. - -@item M -The integer constant @minus{}1. - -@item N -The integer constant 0. - -@item O -Integer constants @minus{}4 through @minus{}1 and 1 through 4; shifts by these -amounts are handled as multiple single-bit shifts rather than a single -variable-length shift. - -@item Q -A memory reference which requires an additional word (address or -offset) after the opcode. - -@item R -A memory reference that is encoded within the opcode. - -@end table - -@item PowerPC and IBM RS6000---@file{config/rs6000/constraints.md} -@table @code -@item b -Address base register - -@item d -Floating point register (containing 64-bit value) - -@item f -Floating point register (containing 32-bit value) - -@item v -Altivec vector register - -@item wa -Any VSX register if the -mvsx option was used or NO_REGS. - -@item wd -VSX vector register to hold vector double data or NO_REGS. - -@item wf -VSX vector register to hold vector float data or NO_REGS. - -@item wg -If @option{-mmfpgpr} was used, a floating point register or NO_REGS. - -@item wh -Floating point register if direct moves are available, or NO_REGS. - -@item wi -FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS. - -@item wj -FP or VSX register to hold 64-bit integers for direct moves or NO_REGS. - -@item wk -FP or VSX register to hold 64-bit doubles for direct moves or NO_REGS. - -@item wl -Floating point register if the LFIWAX instruction is enabled or NO_REGS. - -@item wm -VSX register if direct move instructions are enabled, or NO_REGS. - -@item wn -No register (NO_REGS). - -@item wr -General purpose register if 64-bit instructions are enabled or NO_REGS. - -@item ws -VSX vector register to hold scalar double values or NO_REGS. - -@item wt -VSX vector register to hold 128 bit integer or NO_REGS. - -@item wu -Altivec register to use for float/32-bit int loads/stores or NO_REGS. - -@item wv -Altivec register to use for double loads/stores or NO_REGS. - -@item ww -FP or VSX register to perform float operations under @option{-mvsx} or NO_REGS. - -@item wx -Floating point register if the STFIWX instruction is enabled or NO_REGS. - -@item wy -FP or VSX register to perform ISA 2.07 float ops or NO_REGS. - -@item wz -Floating point register if the LFIWZX instruction is enabled or NO_REGS. - -@item wD -Int constant that is the element number of the 64-bit scalar in a vector. - -@item wQ -A memory address that will work with the @code{lq} and @code{stq} -instructions. - -@item h -@samp{MQ}, @samp{CTR}, or @samp{LINK} register - -@item q -@samp{MQ} register - -@item c -@samp{CTR} register - -@item l -@samp{LINK} register - -@item x -@samp{CR} register (condition register) number 0 - -@item y -@samp{CR} register (condition register) - -@item z -@samp{XER[CA]} carry bit (part of the XER register) - -@item I -Signed 16-bit constant - -@item J -Unsigned 16-bit constant shifted left 16 bits (use @samp{L} instead for -@code{SImode} constants) - -@item K -Unsigned 16-bit constant - -@item L -Signed 16-bit constant shifted left 16 bits - -@item M -Constant larger than 31 - -@item N -Exact power of 2 - -@item O -Zero - -@item P -Constant whose negation is a signed 16-bit constant - -@item G -Floating point constant that can be loaded into a register with one -instruction per word - -@item H -Integer/Floating point constant that can be loaded into a register using -three instructions - -@item m -Memory operand. -Normally, @code{m} does not allow addresses that update the base register. -If @samp{<} or @samp{>} constraint is also used, they are allowed and -therefore on PowerPC targets in that case it is only safe -to use @samp{m<>} in an @code{asm} statement if that @code{asm} statement -accesses the operand exactly once. The @code{asm} statement must also -use @samp{%U@var{}} as a placeholder for the ``update'' flag in the -corresponding load or store instruction. For example: - -@smallexample -asm ("st%U0 %1,%0" : "=m<>" (mem) : "r" (val)); -@end smallexample - -is correct but: - -@smallexample -asm ("st %1,%0" : "=m<>" (mem) : "r" (val)); -@end smallexample - -is not. - -@item es -A ``stable'' memory operand; that is, one which does not include any -automodification of the base register. This used to be useful when -@samp{m} allowed automodification of the base register, but as those are now only -allowed when @samp{<} or @samp{>} is used, @samp{es} is basically the same -as @samp{m} without @samp{<} and @samp{>}. - -@item Q -Memory operand that is an offset from a register (it is usually better -to use @samp{m} or @samp{es} in @code{asm} statements) - -@item Z -Memory operand that is an indexed or indirect from a register (it is -usually better to use @samp{m} or @samp{es} in @code{asm} statements) - -@item R -AIX TOC entry - -@item a -Address operand that is an indexed or indirect from a register (@samp{p} is -preferable for @code{asm} statements) - -@item S -Constant suitable as a 64-bit mask operand - -@item T -Constant suitable as a 32-bit mask operand - -@item U -System V Release 4 small data area reference - -@item t -AND masks that can be performed by two rldic@{l, r@} instructions - -@item W -Vector constant that does not require memory - -@item j -Vector constant that is all zeros. - -@end table - -@item RL78---@file{config/rl78/constraints.md} -@table @code - -@item Int3 -An integer constant in the range 1 @dots{} 7. -@item Int8 -An integer constant in the range 0 @dots{} 255. -@item J -An integer constant in the range @minus{}255 @dots{} 0 -@item K -The integer constant 1. -@item L -The integer constant -1. -@item M -The integer constant 0. -@item N -The integer constant 2. -@item O -The integer constant -2. -@item P -An integer constant in the range 1 @dots{} 15. -@item Qbi -The built-in compare types--eq, ne, gtu, ltu, geu, and leu. -@item Qsc -The synthetic compare types--gt, lt, ge, and le. -@item Wab -A memory reference with an absolute address. -@item Wbc -A memory reference using @code{BC} as a base register, with an optional offset. -@item Wca -A memory reference using @code{AX}, @code{BC}, @code{DE}, or @code{HL} for the address, for calls. -@item Wcv -A memory reference using any 16-bit register pair for the address, for calls. -@item Wd2 -A memory reference using @code{DE} as a base register, with an optional offset. -@item Wde -A memory reference using @code{DE} as a base register, without any offset. -@item Wfr -Any memory reference to an address in the far address space. -@item Wh1 -A memory reference using @code{HL} as a base register, with an optional one-byte offset. -@item Whb -A memory reference using @code{HL} as a base register, with @code{B} or @code{C} as the index register. -@item Whl -A memory reference using @code{HL} as a base register, without any offset. -@item Ws1 -A memory reference using @code{SP} as a base register, with an optional one-byte offset. -@item Y -Any memory reference to an address in the near address space. -@item A -The @code{AX} register. -@item B -The @code{BC} register. -@item D -The @code{DE} register. -@item R -@code{A} through @code{L} registers. -@item S -The @code{SP} register. -@item T -The @code{HL} register. -@item Z08W -The 16-bit @code{R8} register. -@item Z10W -The 16-bit @code{R10} register. -@item Zint -The registers reserved for interrupts (@code{R24} to @code{R31}). -@item a -The @code{A} register. -@item b -The @code{B} register. -@item c -The @code{C} register. -@item d -The @code{D} register. -@item e -The @code{E} register. -@item h -The @code{H} register. -@item l -The @code{L} register. -@item v -The virtual registers. -@item w -The @code{PSW} register. -@item x -The @code{X} register. - -@end table - -@item RX---@file{config/rx/constraints.md} -@table @code -@item Q -An address which does not involve register indirect addressing or -pre/post increment/decrement addressing. - -@item Symbol -A symbol reference. - -@item Int08 -A constant in the range @minus{}256 to 255, inclusive. - -@item Sint08 -A constant in the range @minus{}128 to 127, inclusive. - -@item Sint16 -A constant in the range @minus{}32768 to 32767, inclusive. - -@item Sint24 -A constant in the range @minus{}8388608 to 8388607, inclusive. - -@item Uint04 -A constant in the range 0 to 15, inclusive. - -@end table - -@item S/390 and zSeries---@file{config/s390/s390.h} -@table @code -@item a -Address register (general purpose register except r0) - -@item c -Condition code register - -@item d -Data register (arbitrary general purpose register) - -@item f -Floating-point register - -@item I -Unsigned 8-bit constant (0--255) - -@item J -Unsigned 12-bit constant (0--4095) - -@item K -Signed 16-bit constant (@minus{}32768--32767) - -@item L -Value appropriate as displacement. -@table @code -@item (0..4095) -for short displacement -@item (@minus{}524288..524287) -for long displacement -@end table - -@item M -Constant integer with a value of 0x7fffffff. - -@item N -Multiple letter constraint followed by 4 parameter letters. -@table @code -@item 0..9: -number of the part counting from most to least significant -@item H,Q: -mode of the part -@item D,S,H: -mode of the containing operand -@item 0,F: -value of the other parts (F---all bits set) -@end table -The constraint matches if the specified part of a constant -has a value different from its other parts. - -@item Q -Memory reference without index register and with short displacement. - -@item R -Memory reference with index register and short displacement. - -@item S -Memory reference without index register but with long displacement. - -@item T -Memory reference with index register and long displacement. - -@item U -Pointer with short displacement. - -@item W -Pointer with long displacement. - -@item Y -Shift count operand. - -@end table - -@need 1000 -@item SPARC---@file{config/sparc/sparc.h} -@table @code -@item f -Floating-point register on the SPARC-V8 architecture and -lower floating-point register on the SPARC-V9 architecture. - -@item e -Floating-point register. It is equivalent to @samp{f} on the -SPARC-V8 architecture and contains both lower and upper -floating-point registers on the SPARC-V9 architecture. - -@item c -Floating-point condition code register. - -@item d -Lower floating-point register. It is only valid on the SPARC-V9 -architecture when the Visual Instruction Set is available. - -@item b -Floating-point register. It is only valid on the SPARC-V9 architecture -when the Visual Instruction Set is available. - -@item h -64-bit global or out register for the SPARC-V8+ architecture. - -@item C -The constant all-ones, for floating-point. - -@item A -Signed 5-bit constant - -@item D -A vector constant - -@item I -Signed 13-bit constant - -@item J -Zero - -@item K -32-bit constant with the low 12 bits clear (a constant that can be -loaded with the @code{sethi} instruction) - -@item L -A constant in the range supported by @code{movcc} instructions (11-bit -signed immediate) - -@item M -A constant in the range supported by @code{movrcc} instructions (10-bit -signed immediate) - -@item N -Same as @samp{K}, except that it verifies that bits that are not in the -lower 32-bit range are all zero. Must be used instead of @samp{K} for -modes wider than @code{SImode} - -@item O -The constant 4096 - -@item G -Floating-point zero - -@item H -Signed 13-bit constant, sign-extended to 32 or 64 bits - -@item P -The constant -1 - -@item Q -Floating-point constant whose integral representation can -be moved into an integer register using a single sethi -instruction - -@item R -Floating-point constant whose integral representation can -be moved into an integer register using a single mov -instruction - -@item S -Floating-point constant whose integral representation can -be moved into an integer register using a high/lo_sum -instruction sequence - -@item T -Memory address aligned to an 8-byte boundary - -@item U -Even register - -@item W -Memory address for @samp{e} constraint registers - -@item w -Memory address with only a base register - -@item Y -Vector zero - -@end table - -@item SPU---@file{config/spu/spu.h} -@table @code -@item a -An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 64 bit value. - -@item c -An immediate for and/xor/or instructions. const_int is treated as a 64 bit value. - -@item d -An immediate for the @code{iohl} instruction. const_int is treated as a 64 bit value. - -@item f -An immediate which can be loaded with @code{fsmbi}. - -@item A -An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 32 bit value. - -@item B -An immediate for most arithmetic instructions. const_int is treated as a 32 bit value. - -@item C -An immediate for and/xor/or instructions. const_int is treated as a 32 bit value. - -@item D -An immediate for the @code{iohl} instruction. const_int is treated as a 32 bit value. - -@item I -A constant in the range [@minus{}64, 63] for shift/rotate instructions. - -@item J -An unsigned 7-bit constant for conversion/nop/channel instructions. - -@item K -A signed 10-bit constant for most arithmetic instructions. - -@item M -A signed 16 bit immediate for @code{stop}. - -@item N -An unsigned 16-bit constant for @code{iohl} and @code{fsmbi}. - -@item O -An unsigned 7-bit constant whose 3 least significant bits are 0. - -@item P -An unsigned 3-bit constant for 16-byte rotates and shifts - -@item R -Call operand, reg, for indirect calls - -@item S -Call operand, symbol, for relative calls. - -@item T -Call operand, const_int, for absolute calls. - -@item U -An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is sign extended to 128 bit. - -@item W -An immediate for shift and rotate instructions. const_int is treated as a 32 bit value. - -@item Y -An immediate for and/xor/or instructions. const_int is sign extended as a 128 bit. - -@item Z -An immediate for the @code{iohl} instruction. const_int is sign extended to 128 bit. - -@end table - -@item TI C6X family---@file{config/c6x/constraints.md} -@table @code -@item a -Register file A (A0--A31). - -@item b -Register file B (B0--B31). - -@item A -Predicate registers in register file A (A0--A2 on C64X and -higher, A1 and A2 otherwise). - -@item B -Predicate registers in register file B (B0--B2). - -@item C -A call-used register in register file B (B0--B9, B16--B31). - -@item Da -Register file A, excluding predicate registers (A3--A31, -plus A0 if not C64X or higher). - -@item Db -Register file B, excluding predicate registers (B3--B31). - -@item Iu4 -Integer constant in the range 0 @dots{} 15. - -@item Iu5 -Integer constant in the range 0 @dots{} 31. - -@item In5 -Integer constant in the range @minus{}31 @dots{} 0. - -@item Is5 -Integer constant in the range @minus{}16 @dots{} 15. - -@item I5x -Integer constant that can be the operand of an ADDA or a SUBA insn. - -@item IuB -Integer constant in the range 0 @dots{} 65535. - -@item IsB -Integer constant in the range @minus{}32768 @dots{} 32767. - -@item IsC -Integer constant in the range @math{-2^{20}} @dots{} @math{2^{20} - 1}. - -@item Jc -Integer constant that is a valid mask for the clr instruction. - -@item Js -Integer constant that is a valid mask for the set instruction. - -@item Q -Memory location with A base register. - -@item R -Memory location with B base register. - -@ifset INTERNALS -@item S0 -On C64x+ targets, a GP-relative small data reference. - -@item S1 -Any kind of @code{SYMBOL_REF}, for use in a call address. - -@item Si -Any kind of immediate operand, unless it matches the S0 constraint. - -@item T -Memory location with B base register, but not using a long offset. - -@item W -A memory operand with an address that can't be used in an unaligned access. - -@end ifset -@item Z -Register B14 (aka DP). - -@end table - -@item TILE-Gx---@file{config/tilegx/constraints.md} -@table @code -@item R00 -@itemx R01 -@itemx R02 -@itemx R03 -@itemx R04 -@itemx R05 -@itemx R06 -@itemx R07 -@itemx R08 -@itemx R09 -@itemx R10 -Each of these represents a register constraint for an individual -register, from r0 to r10. - -@item I -Signed 8-bit integer constant. - -@item J -Signed 16-bit integer constant. - -@item K -Unsigned 16-bit integer constant. - -@item L -Integer constant that fits in one signed byte when incremented by one -(@minus{}129 @dots{} 126). - -@item m -Memory operand. If used together with @samp{<} or @samp{>}, the -operand can have postincrement which requires printing with @samp{%In} -and @samp{%in} on TILE-Gx. For example: - -@smallexample -asm ("st_add %I0,%1,%i0" : "=m<>" (*mem) : "r" (val)); -@end smallexample - -@item M -A bit mask suitable for the BFINS instruction. - -@item N -Integer constant that is a byte tiled out eight times. - -@item O -The integer zero constant. - -@item P -Integer constant that is a sign-extended byte tiled out as four shorts. - -@item Q -Integer constant that fits in one signed byte when incremented -(@minus{}129 @dots{} 126), but excluding -1. - -@item S -Integer constant that has all 1 bits consecutive and starting at bit 0. - -@item T -A 16-bit fragment of a got, tls, or pc-relative reference. - -@item U -Memory operand except postincrement. This is roughly the same as -@samp{m} when not used together with @samp{<} or @samp{>}. - -@item W -An 8-element vector constant with identical elements. - -@item Y -A 4-element vector constant with identical elements. - -@item Z0 -The integer constant 0xffffffff. - -@item Z1 -The integer constant 0xffffffff00000000. - -@end table - -@item TILEPro---@file{config/tilepro/constraints.md} -@table @code -@item R00 -@itemx R01 -@itemx R02 -@itemx R03 -@itemx R04 -@itemx R05 -@itemx R06 -@itemx R07 -@itemx R08 -@itemx R09 -@itemx R10 -Each of these represents a register constraint for an individual -register, from r0 to r10. - -@item I -Signed 8-bit integer constant. - -@item J -Signed 16-bit integer constant. - -@item K -Nonzero integer constant with low 16 bits zero. - -@item L -Integer constant that fits in one signed byte when incremented by one -(@minus{}129 @dots{} 126). - -@item m -Memory operand. If used together with @samp{<} or @samp{>}, the -operand can have postincrement which requires printing with @samp{%In} -and @samp{%in} on TILEPro. For example: - -@smallexample -asm ("swadd %I0,%1,%i0" : "=m<>" (mem) : "r" (val)); -@end smallexample - -@item M -A bit mask suitable for the MM instruction. - -@item N -Integer constant that is a byte tiled out four times. - -@item O -The integer zero constant. - -@item P -Integer constant that is a sign-extended byte tiled out as two shorts. - -@item Q -Integer constant that fits in one signed byte when incremented -(@minus{}129 @dots{} 126), but excluding -1. - -@item T -A symbolic operand, or a 16-bit fragment of a got, tls, or pc-relative -reference. - -@item U -Memory operand except postincrement. This is roughly the same as -@samp{m} when not used together with @samp{<} or @samp{>}. - -@item W -A 4-element vector constant with identical elements. - -@item Y -A 2-element vector constant with identical elements. - -@end table - -@item Visium---@file{config/visium/constraints.md} -@table @code -@item b -EAM register @code{mdb} - -@item c -EAM register @code{mdc} - -@item f -Floating point register - -@ifset INTERNALS -@item k -Register for sibcall optimization -@end ifset - -@item l -General register, but not @code{r29}, @code{r30} and @code{r31} - -@item t -Register @code{r1} - -@item u -Register @code{r2} - -@item v -Register @code{r3} - -@item G -Floating-point constant 0.0 - -@item J -Integer constant in the range 0 .. 65535 (16-bit immediate) - -@item K -Integer constant in the range 1 .. 31 (5-bit immediate) - -@item L -Integer constant in the range @minus{}65535 .. @minus{}1 (16-bit negative immediate) - -@item M -Integer constant @minus{}1 - -@item O -Integer constant 0 - -@item P -Integer constant 32 -@end table - -@item x86 family---@file{config/i386/constraints.md} -@table @code -@item R -Legacy register---the eight integer registers available on all -i386 processors (@code{a}, @code{b}, @code{c}, @code{d}, -@code{si}, @code{di}, @code{bp}, @code{sp}). - -@item q -Any register accessible as @code{@var{r}l}. In 32-bit mode, @code{a}, -@code{b}, @code{c}, and @code{d}; in 64-bit mode, any integer register. - -@item Q -Any register accessible as @code{@var{r}h}: @code{a}, @code{b}, -@code{c}, and @code{d}. - -@ifset INTERNALS -@item l -Any register that can be used as the index in a base+index memory -access: that is, any general register except the stack pointer. -@end ifset - -@item a -The @code{a} register. - -@item b -The @code{b} register. - -@item c -The @code{c} register. - -@item d -The @code{d} register. - -@item S -The @code{si} register. - -@item D -The @code{di} register. - -@item A -The @code{a} and @code{d} registers. This class is used for instructions -that return double word results in the @code{ax:dx} register pair. Single -word values will be allocated either in @code{ax} or @code{dx}. -For example on i386 the following implements @code{rdtsc}: - -@smallexample -unsigned long long rdtsc (void) -@{ - unsigned long long tick; - __asm__ __volatile__("rdtsc":"=A"(tick)); - return tick; -@} -@end smallexample - -This is not correct on x86-64 as it would allocate tick in either @code{ax} -or @code{dx}. You have to use the following variant instead: - -@smallexample -unsigned long long rdtsc (void) -@{ - unsigned int tickl, tickh; - __asm__ __volatile__("rdtsc":"=a"(tickl),"=d"(tickh)); - return ((unsigned long long)tickh << 32)|tickl; -@} -@end smallexample - - -@item f -Any 80387 floating-point (stack) register. - -@item t -Top of 80387 floating-point stack (@code{%st(0)}). - -@item u -Second from top of 80387 floating-point stack (@code{%st(1)}). - -@item y -Any MMX register. - -@item x -Any SSE register. - -@item Yz -First SSE register (@code{%xmm0}). - -@ifset INTERNALS -@item Y2 -Any SSE register, when SSE2 is enabled. - -@item Yi -Any SSE register, when SSE2 and inter-unit moves are enabled. - -@item Ym -Any MMX register, when inter-unit moves are enabled. -@end ifset - -@item I -Integer constant in the range 0 @dots{} 31, for 32-bit shifts. - -@item J -Integer constant in the range 0 @dots{} 63, for 64-bit shifts. - -@item K -Signed 8-bit integer constant. - -@item L -@code{0xFF} or @code{0xFFFF}, for andsi as a zero-extending move. - -@item M -0, 1, 2, or 3 (shifts for the @code{lea} instruction). - -@item N -Unsigned 8-bit integer constant (for @code{in} and @code{out} -instructions). - -@ifset INTERNALS -@item O -Integer constant in the range 0 @dots{} 127, for 128-bit shifts. -@end ifset - -@item G -Standard 80387 floating point constant. - -@item C -Standard SSE floating point constant. - -@item e -32-bit signed integer constant, or a symbolic reference known -to fit that range (for immediate operands in sign-extending x86-64 -instructions). - -@item Z -32-bit unsigned integer constant, or a symbolic reference known -to fit that range (for immediate operands in zero-extending x86-64 -instructions). - -@end table - -@item Xstormy16---@file{config/stormy16/stormy16.h} -@table @code -@item a -Register r0. - -@item b -Register r1. - -@item c -Register r2. - -@item d -Register r8. - -@item e -Registers r0 through r7. - -@item t -Registers r0 and r1. - -@item y -The carry register. - -@item z -Registers r8 and r9. - -@item I -A constant between 0 and 3 inclusive. - -@item J -A constant that has exactly one bit set. - -@item K -A constant that has exactly one bit clear. - -@item L -A constant between 0 and 255 inclusive. - -@item M -A constant between @minus{}255 and 0 inclusive. - -@item N -A constant between @minus{}3 and 0 inclusive. - -@item O -A constant between 1 and 4 inclusive. - -@item P -A constant between @minus{}4 and @minus{}1 inclusive. - -@item Q -A memory reference that is a stack push. - -@item R -A memory reference that is a stack pop. - -@item S -A memory reference that refers to a constant address of known value. - -@item T -The register indicated by Rx (not implemented yet). - -@item U -A constant that is not between 2 and 15 inclusive. - -@item Z -The constant 0. - -@end table - -@item Xtensa---@file{config/xtensa/constraints.md} -@table @code -@item a -General-purpose 32-bit register - -@item b -One-bit boolean register - -@item A -MAC16 40-bit accumulator register - -@item I -Signed 12-bit integer constant, for use in MOVI instructions - -@item J -Signed 8-bit integer constant, for use in ADDI instructions - -@item K -Integer constant valid for BccI instructions - -@item L -Unsigned constant valid for BccUI instructions - -@end table - -@end table - -@ifset INTERNALS -@node Disable Insn Alternatives -@subsection Disable insn alternatives using the @code{enabled} attribute -@cindex enabled - -There are three insn attributes that may be used to selectively disable -instruction alternatives: - -@table @code -@item enabled -Says whether an alternative is available on the current subtarget. - -@item preferred_for_size -Says whether an enabled alternative should be used in code that is -optimized for size. - -@item preferred_for_speed -Says whether an enabled alternative should be used in code that is -optimized for speed. -@end table - -All these attributes should use @code{(const_int 1)} to allow an alternative -or @code{(const_int 0)} to disallow it. The attributes must be a static -property of the subtarget; they cannot for example depend on the -current operands, on the current optimization level, on the location -of the insn within the body of a loop, on whether register allocation -has finished, or on the current compiler pass. - -The @code{enabled} attribute is a correctness property. It tells GCC to act -as though the disabled alternatives were never defined in the first place. -This is useful when adding new instructions to an existing pattern in -cases where the new instructions are only available for certain cpu -architecture levels (typically mapped to the @code{-march=} command-line -option). - -In contrast, the @code{preferred_for_size} and @code{preferred_for_speed} -attributes are strong optimization hints rather than correctness properties. -@code{preferred_for_size} tells GCC which alternatives to consider when -adding or modifying an instruction that GCC wants to optimize for size. -@code{preferred_for_speed} does the same thing for speed. Note that things -like code motion can lead to cases where code optimized for size uses -alternatives that are not preferred for size, and similarly for speed. - -Although @code{define_insn}s can in principle specify the @code{enabled} -attribute directly, it is often clearer to have subsiduary attributes -for each architectural feature of interest. The @code{define_insn}s -can then use these subsiduary attributes to say which alternatives -require which features. The example below does this for @code{cpu_facility}. - -E.g. the following two patterns could easily be merged using the @code{enabled} -attribute: - -@smallexample - -(define_insn "*movdi_old" - [(set (match_operand:DI 0 "register_operand" "=d") - (match_operand:DI 1 "register_operand" " d"))] - "!TARGET_NEW" - "lgr %0,%1") - -(define_insn "*movdi_new" - [(set (match_operand:DI 0 "register_operand" "=d,f,d") - (match_operand:DI 1 "register_operand" " d,d,f"))] - "TARGET_NEW" - "@@ - lgr %0,%1 - ldgr %0,%1 - lgdr %0,%1") - -@end smallexample - -to: - -@smallexample - -(define_insn "*movdi_combined" - [(set (match_operand:DI 0 "register_operand" "=d,f,d") - (match_operand:DI 1 "register_operand" " d,d,f"))] - "" - "@@ - lgr %0,%1 - ldgr %0,%1 - lgdr %0,%1" - [(set_attr "cpu_facility" "*,new,new")]) - -@end smallexample - -with the @code{enabled} attribute defined like this: - -@smallexample - -(define_attr "cpu_facility" "standard,new" (const_string "standard")) - -(define_attr "enabled" "" - (cond [(eq_attr "cpu_facility" "standard") (const_int 1) - (and (eq_attr "cpu_facility" "new") - (ne (symbol_ref "TARGET_NEW") (const_int 0))) - (const_int 1)] - (const_int 0))) - -@end smallexample - -@end ifset - -@ifset INTERNALS -@node Define Constraints -@subsection Defining Machine-Specific Constraints -@cindex defining constraints -@cindex constraints, defining - -Machine-specific constraints fall into two categories: register and -non-register constraints. Within the latter category, constraints -which allow subsets of all possible memory or address operands should -be specially marked, to give @code{reload} more information. - -Machine-specific constraints can be given names of arbitrary length, -but they must be entirely composed of letters, digits, underscores -(@samp{_}), and angle brackets (@samp{< >}). Like C identifiers, they -must begin with a letter or underscore. - -In order to avoid ambiguity in operand constraint strings, no -constraint can have a name that begins with any other constraint's -name. For example, if @code{x} is defined as a constraint name, -@code{xy} may not be, and vice versa. As a consequence of this rule, -no constraint may begin with one of the generic constraint letters: -@samp{E F V X g i m n o p r s}. - -Register constraints correspond directly to register classes. -@xref{Register Classes}. There is thus not much flexibility in their -definitions. - -@deffn {MD Expression} define_register_constraint name regclass docstring -All three arguments are string constants. -@var{name} is the name of the constraint, as it will appear in -@code{match_operand} expressions. If @var{name} is a multi-letter -constraint its length shall be the same for all constraints starting -with the same letter. @var{regclass} can be either the -name of the corresponding register class (@pxref{Register Classes}), -or a C expression which evaluates to the appropriate register class. -If it is an expression, it must have no side effects, and it cannot -look at the operand. The usual use of expressions is to map some -register constraints to @code{NO_REGS} when the register class -is not available on a given subarchitecture. - -@var{docstring} is a sentence documenting the meaning of the -constraint. Docstrings are explained further below. -@end deffn - -Non-register constraints are more like predicates: the constraint -definition gives a Boolean expression which indicates whether the -constraint matches. - -@deffn {MD Expression} define_constraint name docstring exp -The @var{name} and @var{docstring} arguments are the same as for -@code{define_register_constraint}, but note that the docstring comes -immediately after the name for these expressions. @var{exp} is an RTL -expression, obeying the same rules as the RTL expressions in predicate -definitions. @xref{Defining Predicates}, for details. If it -evaluates true, the constraint matches; if it evaluates false, it -doesn't. Constraint expressions should indicate which RTL codes they -might match, just like predicate expressions. - -@code{match_test} C expressions have access to the -following variables: - -@table @var -@item op -The RTL object defining the operand. -@item mode -The machine mode of @var{op}. -@item ival -@samp{INTVAL (@var{op})}, if @var{op} is a @code{const_int}. -@item hval -@samp{CONST_DOUBLE_HIGH (@var{op})}, if @var{op} is an integer -@code{const_double}. -@item lval -@samp{CONST_DOUBLE_LOW (@var{op})}, if @var{op} is an integer -@code{const_double}. -@item rval -@samp{CONST_DOUBLE_REAL_VALUE (@var{op})}, if @var{op} is a floating-point -@code{const_double}. -@end table - -The @var{*val} variables should only be used once another piece of the -expression has verified that @var{op} is the appropriate kind of RTL -object. -@end deffn - -Most non-register constraints should be defined with -@code{define_constraint}. The remaining two definition expressions -are only appropriate for constraints that should be handled specially -by @code{reload} if they fail to match. - -@deffn {MD Expression} define_memory_constraint name docstring exp -Use this expression for constraints that match a subset of all memory -operands: that is, @code{reload} can make them match by converting the -operand to the form @samp{@w{(mem (reg @var{X}))}}, where @var{X} is a -base register (from the register class specified by -@code{BASE_REG_CLASS}, @pxref{Register Classes}). - -For example, on the S/390, some instructions do not accept arbitrary -memory references, but only those that do not make use of an index -register. The constraint letter @samp{Q} is defined to represent a -memory address of this type. If @samp{Q} is defined with -@code{define_memory_constraint}, a @samp{Q} constraint can handle any -memory operand, because @code{reload} knows it can simply copy the -memory address into a base register if required. This is analogous to -the way an @samp{o} constraint can handle any memory operand. - -The syntax and semantics are otherwise identical to -@code{define_constraint}. -@end deffn - -@deffn {MD Expression} define_address_constraint name docstring exp -Use this expression for constraints that match a subset of all address -operands: that is, @code{reload} can make the constraint match by -converting the operand to the form @samp{@w{(reg @var{X})}}, again -with @var{X} a base register. - -Constraints defined with @code{define_address_constraint} can only be -used with the @code{address_operand} predicate, or machine-specific -predicates that work the same way. They are treated analogously to -the generic @samp{p} constraint. - -The syntax and semantics are otherwise identical to -@code{define_constraint}. -@end deffn - -For historical reasons, names beginning with the letters @samp{G H} -are reserved for constraints that match only @code{const_double}s, and -names beginning with the letters @samp{I J K L M N O P} are reserved -for constraints that match only @code{const_int}s. This may change in -the future. For the time being, constraints with these names must be -written in a stylized form, so that @code{genpreds} can tell you did -it correctly: - -@smallexample -@group -(define_constraint "[@var{GHIJKLMNOP}]@dots{}" - "@var{doc}@dots{}" - (and (match_code "const_int") ; @r{@code{const_double} for G/H} - @var{condition}@dots{})) ; @r{usually a @code{match_test}} -@end group -@end smallexample -@c the semicolons line up in the formatted manual - -It is fine to use names beginning with other letters for constraints -that match @code{const_double}s or @code{const_int}s. - -Each docstring in a constraint definition should be one or more complete -sentences, marked up in Texinfo format. @emph{They are currently unused.} -In the future they will be copied into the GCC manual, in @ref{Machine -Constraints}, replacing the hand-maintained tables currently found in -that section. Also, in the future the compiler may use this to give -more helpful diagnostics when poor choice of @code{asm} constraints -causes a reload failure. - -If you put the pseudo-Texinfo directive @samp{@@internal} at the -beginning of a docstring, then (in the future) it will appear only in -the internals manual's version of the machine-specific constraint tables. -Use this for constraints that should not appear in @code{asm} statements. - -@node C Constraint Interface -@subsection Testing constraints from C -@cindex testing constraints -@cindex constraints, testing - -It is occasionally useful to test a constraint from C code rather than -implicitly via the constraint string in a @code{match_operand}. The -generated file @file{tm_p.h} declares a few interfaces for working -with constraints. At present these are defined for all constraints -except @code{g} (which is equivalent to @code{general_operand}). - -Some valid constraint names are not valid C identifiers, so there is a -mangling scheme for referring to them from C@. Constraint names that -do not contain angle brackets or underscores are left unchanged. -Underscores are doubled, each @samp{<} is replaced with @samp{_l}, and -each @samp{>} with @samp{_g}. Here are some examples: - -@c the @c's prevent double blank lines in the printed manual. -@example -@multitable {Original} {Mangled} -@item @strong{Original} @tab @strong{Mangled} @c -@item @code{x} @tab @code{x} @c -@item @code{P42x} @tab @code{P42x} @c -@item @code{P4_x} @tab @code{P4__x} @c -@item @code{P4>x} @tab @code{P4_gx} @c -@item @code{P4>>} @tab @code{P4_g_g} @c -@item @code{P4_g>} @tab @code{P4__g_g} @c -@end multitable -@end example - -Throughout this section, the variable @var{c} is either a constraint -in the abstract sense, or a constant from @code{enum constraint_num}; -the variable @var{m} is a mangled constraint name (usually as part of -a larger identifier). - -@deftp Enum constraint_num -For each constraint except @code{g}, there is a corresponding -enumeration constant: @samp{CONSTRAINT_} plus the mangled name of the -constraint. Functions that take an @code{enum constraint_num} as an -argument expect one of these constants. -@end deftp - -@deftypefun {inline bool} satisfies_constraint_@var{m} (rtx @var{exp}) -For each non-register constraint @var{m} except @code{g}, there is -one of these functions; it returns @code{true} if @var{exp} satisfies the -constraint. These functions are only visible if @file{rtl.h} was included -before @file{tm_p.h}. -@end deftypefun - -@deftypefun bool constraint_satisfied_p (rtx @var{exp}, enum constraint_num @var{c}) -Like the @code{satisfies_constraint_@var{m}} functions, but the -constraint to test is given as an argument, @var{c}. If @var{c} -specifies a register constraint, this function will always return -@code{false}. -@end deftypefun - -@deftypefun {enum reg_class} reg_class_for_constraint (enum constraint_num @var{c}) -Returns the register class associated with @var{c}. If @var{c} is not -a register constraint, or those registers are not available for the -currently selected subtarget, returns @code{NO_REGS}. -@end deftypefun - -Here is an example use of @code{satisfies_constraint_@var{m}}. In -peephole optimizations (@pxref{Peephole Definitions}), operand -constraint strings are ignored, so if there are relevant constraints, -they must be tested in the C condition. In the example, the -optimization is applied if operand 2 does @emph{not} satisfy the -@samp{K} constraint. (This is a simplified version of a peephole -definition from the i386 machine description.) - -@smallexample -(define_peephole2 - [(match_scratch:SI 3 "r") - (set (match_operand:SI 0 "register_operand" "") - (mult:SI (match_operand:SI 1 "memory_operand" "") - (match_operand:SI 2 "immediate_operand" "")))] - - "!satisfies_constraint_K (operands[2])" - - [(set (match_dup 3) (match_dup 1)) - (set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2)))] - - "") -@end smallexample - -@node Standard Names -@section Standard Pattern Names For Generation -@cindex standard pattern names -@cindex pattern names -@cindex names, pattern - -Here is a table of the instruction names that are meaningful in the RTL -generation pass of the compiler. Giving one of these names to an -instruction pattern tells the RTL generation pass that it can use the -pattern to accomplish a certain task. - -@table @asis -@cindex @code{mov@var{m}} instruction pattern -@item @samp{mov@var{m}} -Here @var{m} stands for a two-letter machine mode name, in lowercase. -This instruction pattern moves data with that machine mode from operand -1 to operand 0. For example, @samp{movsi} moves full-word data. - -If operand 0 is a @code{subreg} with mode @var{m} of a register whose -own mode is wider than @var{m}, the effect of this instruction is -to store the specified value in the part of the register that corresponds -to mode @var{m}. Bits outside of @var{m}, but which are within the -same target word as the @code{subreg} are undefined. Bits which are -outside the target word are left unchanged. - -This class of patterns is special in several ways. First of all, each -of these names up to and including full word size @emph{must} be defined, -because there is no other way to copy a datum from one place to another. -If there are patterns accepting operands in larger modes, -@samp{mov@var{m}} must be defined for integer modes of those sizes. - -Second, these patterns are not used solely in the RTL generation pass. -Even the reload pass can generate move insns to copy values from stack -slots into temporary registers. When it does so, one of the operands is -a hard register and the other is an operand that can need to be reloaded -into a register. - -@findex force_reg -Therefore, when given such a pair of operands, the pattern must generate -RTL which needs no reloading and needs no temporary registers---no -registers other than the operands. For example, if you support the -pattern with a @code{define_expand}, then in such a case the -@code{define_expand} mustn't call @code{force_reg} or any other such -function which might generate new pseudo registers. - -This requirement exists even for subword modes on a RISC machine where -fetching those modes from memory normally requires several insns and -some temporary registers. - -@findex change_address -During reload a memory reference with an invalid address may be passed -as an operand. Such an address will be replaced with a valid address -later in the reload pass. In this case, nothing may be done with the -address except to use it as it stands. If it is copied, it will not be -replaced with a valid address. No attempt should be made to make such -an address into a valid address and no routine (such as -@code{change_address}) that will do so may be called. Note that -@code{general_operand} will fail when applied to such an address. - -@findex reload_in_progress -The global variable @code{reload_in_progress} (which must be explicitly -declared if required) can be used to determine whether such special -handling is required. - -The variety of operands that have reloads depends on the rest of the -machine description, but typically on a RISC machine these can only be -pseudo registers that did not get hard registers, while on other -machines explicit memory references will get optional reloads. - -If a scratch register is required to move an object to or from memory, -it can be allocated using @code{gen_reg_rtx} prior to life analysis. - -If there are cases which need scratch registers during or after reload, -you must provide an appropriate secondary_reload target hook. - -@findex can_create_pseudo_p -The macro @code{can_create_pseudo_p} can be used to determine if it -is unsafe to create new pseudo registers. If this variable is nonzero, then -it is unsafe to call @code{gen_reg_rtx} to allocate a new pseudo. - -The constraints on a @samp{mov@var{m}} must permit moving any hard -register to any other hard register provided that -@code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and -@code{TARGET_REGISTER_MOVE_COST} applied to their classes returns a value -of 2. - -It is obligatory to support floating point @samp{mov@var{m}} -instructions into and out of any registers that can hold fixed point -values, because unions and structures (which have modes @code{SImode} or -@code{DImode}) can be in those registers and they may have floating -point members. - -There may also be a need to support fixed point @samp{mov@var{m}} -instructions in and out of floating point registers. Unfortunately, I -have forgotten why this was so, and I don't know whether it is still -true. If @code{HARD_REGNO_MODE_OK} rejects fixed point values in -floating point registers, then the constraints of the fixed point -@samp{mov@var{m}} instructions must be designed to avoid ever trying to -reload into a floating point register. - -@cindex @code{reload_in} instruction pattern -@cindex @code{reload_out} instruction pattern -@item @samp{reload_in@var{m}} -@itemx @samp{reload_out@var{m}} -These named patterns have been obsoleted by the target hook -@code{secondary_reload}. - -Like @samp{mov@var{m}}, but used when a scratch register is required to -move between operand 0 and operand 1. Operand 2 describes the scratch -register. See the discussion of the @code{SECONDARY_RELOAD_CLASS} -macro in @pxref{Register Classes}. - -There are special restrictions on the form of the @code{match_operand}s -used in these patterns. First, only the predicate for the reload -operand is examined, i.e., @code{reload_in} examines operand 1, but not -the predicates for operand 0 or 2. Second, there may be only one -alternative in the constraints. Third, only a single register class -letter may be used for the constraint; subsequent constraint letters -are ignored. As a special exception, an empty constraint string -matches the @code{ALL_REGS} register class. This may relieve ports -of the burden of defining an @code{ALL_REGS} constraint letter just -for these patterns. - -@cindex @code{movstrict@var{m}} instruction pattern -@item @samp{movstrict@var{m}} -Like @samp{mov@var{m}} except that if operand 0 is a @code{subreg} -with mode @var{m} of a register whose natural mode is wider, -the @samp{movstrict@var{m}} instruction is guaranteed not to alter -any of the register except the part which belongs to mode @var{m}. - -@cindex @code{movmisalign@var{m}} instruction pattern -@item @samp{movmisalign@var{m}} -This variant of a move pattern is designed to load or store a value -from a memory address that is not naturally aligned for its mode. -For a store, the memory will be in operand 0; for a load, the memory -will be in operand 1. The other operand is guaranteed not to be a -memory, so that it's easy to tell whether this is a load or store. - -This pattern is used by the autovectorizer, and when expanding a -@code{MISALIGNED_INDIRECT_REF} expression. - -@cindex @code{load_multiple} instruction pattern -@item @samp{load_multiple} -Load several consecutive memory locations into consecutive registers. -Operand 0 is the first of the consecutive registers, operand 1 -is the first memory location, and operand 2 is a constant: the -number of consecutive registers. - -Define this only if the target machine really has such an instruction; -do not define this if the most efficient way of loading consecutive -registers from memory is to do them one at a time. - -On some machines, there are restrictions as to which consecutive -registers can be stored into memory, such as particular starting or -ending register numbers or only a range of valid counts. For those -machines, use a @code{define_expand} (@pxref{Expander Definitions}) -and make the pattern fail if the restrictions are not met. - -Write the generated insn as a @code{parallel} with elements being a -@code{set} of one register from the appropriate memory location (you may -also need @code{use} or @code{clobber} elements). Use a -@code{match_parallel} (@pxref{RTL Template}) to recognize the insn. See -@file{rs6000.md} for examples of the use of this insn pattern. - -@cindex @samp{store_multiple} instruction pattern -@item @samp{store_multiple} -Similar to @samp{load_multiple}, but store several consecutive registers -into consecutive memory locations. Operand 0 is the first of the -consecutive memory locations, operand 1 is the first register, and -operand 2 is a constant: the number of consecutive registers. - -@cindex @code{vec_load_lanes@var{m}@var{n}} instruction pattern -@item @samp{vec_load_lanes@var{m}@var{n}} -Perform an interleaved load of several vectors from memory operand 1 -into register operand 0. Both operands have mode @var{m}. The register -operand is viewed as holding consecutive vectors of mode @var{n}, -while the memory operand is a flat array that contains the same number -of elements. The operation is equivalent to: - -@smallexample -int c = GET_MODE_SIZE (@var{m}) / GET_MODE_SIZE (@var{n}); -for (j = 0; j < GET_MODE_NUNITS (@var{n}); j++) - for (i = 0; i < c; i++) - operand0[i][j] = operand1[j * c + i]; -@end smallexample - -For example, @samp{vec_load_lanestiv4hi} loads 8 16-bit values -from memory into a register of mode @samp{TI}@. The register -contains two consecutive vectors of mode @samp{V4HI}@. - -This pattern can only be used if: -@smallexample -TARGET_ARRAY_MODE_SUPPORTED_P (@var{n}, @var{c}) -@end smallexample -is true. GCC assumes that, if a target supports this kind of -instruction for some mode @var{n}, it also supports unaligned -loads for vectors of mode @var{n}. - -@cindex @code{vec_store_lanes@var{m}@var{n}} instruction pattern -@item @samp{vec_store_lanes@var{m}@var{n}} -Equivalent to @samp{vec_load_lanes@var{m}@var{n}}, with the memory -and register operands reversed. That is, the instruction is -equivalent to: - -@smallexample -int c = GET_MODE_SIZE (@var{m}) / GET_MODE_SIZE (@var{n}); -for (j = 0; j < GET_MODE_NUNITS (@var{n}); j++) - for (i = 0; i < c; i++) - operand0[j * c + i] = operand1[i][j]; -@end smallexample - -for a memory operand 0 and register operand 1. - -@cindex @code{vec_set@var{m}} instruction pattern -@item @samp{vec_set@var{m}} -Set given field in the vector value. Operand 0 is the vector to modify, -operand 1 is new value of field and operand 2 specify the field index. - -@cindex @code{vec_extract@var{m}} instruction pattern -@item @samp{vec_extract@var{m}} -Extract given field from the vector value. Operand 1 is the vector, operand 2 -specify field index and operand 0 place to store value into. - -@cindex @code{vec_init@var{m}} instruction pattern -@item @samp{vec_init@var{m}} -Initialize the vector to given values. Operand 0 is the vector to initialize -and operand 1 is parallel containing values for individual fields. - -@cindex @code{vcond@var{m}@var{n}} instruction pattern -@item @samp{vcond@var{m}@var{n}} -Output a conditional vector move. Operand 0 is the destination to -receive a combination of operand 1 and operand 2, which are of mode @var{m}, -dependent on the outcome of the predicate in operand 3 which is a -vector comparison with operands of mode @var{n} in operands 4 and 5. The -modes @var{m} and @var{n} should have the same size. Operand 0 -will be set to the value @var{op1} & @var{msk} | @var{op2} & ~@var{msk} -where @var{msk} is computed by element-wise evaluation of the vector -comparison with a truth value of all-ones and a false value of all-zeros. - -@cindex @code{vec_perm@var{m}} instruction pattern -@item @samp{vec_perm@var{m}} -Output a (variable) vector permutation. Operand 0 is the destination -to receive elements from operand 1 and operand 2, which are of mode -@var{m}. Operand 3 is the @dfn{selector}. It is an integral mode -vector of the same width and number of elements as mode @var{m}. - -The input elements are numbered from 0 in operand 1 through -@math{2*@var{N}-1} in operand 2. The elements of the selector must -be computed modulo @math{2*@var{N}}. Note that if -@code{rtx_equal_p(operand1, operand2)}, this can be implemented -with just operand 1 and selector elements modulo @var{N}. - -In order to make things easy for a number of targets, if there is no -@samp{vec_perm} pattern for mode @var{m}, but there is for mode @var{q} -where @var{q} is a vector of @code{QImode} of the same width as @var{m}, -the middle-end will lower the mode @var{m} @code{VEC_PERM_EXPR} to -mode @var{q}. - -@cindex @code{vec_perm_const@var{m}} instruction pattern -@item @samp{vec_perm_const@var{m}} -Like @samp{vec_perm} except that the permutation is a compile-time -constant. That is, operand 3, the @dfn{selector}, is a @code{CONST_VECTOR}. - -Some targets cannot perform a permutation with a variable selector, -but can efficiently perform a constant permutation. Further, the -target hook @code{vec_perm_ok} is queried to determine if the -specific constant permutation is available efficiently; the named -pattern is never expanded without @code{vec_perm_ok} returning true. - -There is no need for a target to supply both @samp{vec_perm@var{m}} -and @samp{vec_perm_const@var{m}} if the former can trivially implement -the operation with, say, the vector constant loaded into a register. - -@cindex @code{push@var{m}1} instruction pattern -@item @samp{push@var{m}1} -Output a push instruction. Operand 0 is value to push. Used only when -@code{PUSH_ROUNDING} is defined. For historical reason, this pattern may be -missing and in such case an @code{mov} expander is used instead, with a -@code{MEM} expression forming the push operation. The @code{mov} expander -method is deprecated. - -@cindex @code{add@var{m}3} instruction pattern -@item @samp{add@var{m}3} -Add operand 2 and operand 1, storing the result in operand 0. All operands -must have mode @var{m}. This can be used even on two-address machines, by -means of constraints requiring operands 1 and 0 to be the same location. - -@cindex @code{addptr@var{m}3} instruction pattern -@item @samp{addptr@var{m}3} -Like @code{add@var{m}3} but is guaranteed to only be used for address -calculations. The expanded code is not allowed to clobber the -condition code. It only needs to be defined if @code{add@var{m}3} -sets the condition code. If adds used for address calculations and -normal adds are not compatible it is required to expand a distinct -pattern (e.g. using an unspec). The pattern is used by LRA to emit -address calculations. @code{add@var{m}3} is used if -@code{addptr@var{m}3} is not defined. - -@cindex @code{ssadd@var{m}3} instruction pattern -@cindex @code{usadd@var{m}3} instruction pattern -@cindex @code{sub@var{m}3} instruction pattern -@cindex @code{sssub@var{m}3} instruction pattern -@cindex @code{ussub@var{m}3} instruction pattern -@cindex @code{mul@var{m}3} instruction pattern -@cindex @code{ssmul@var{m}3} instruction pattern -@cindex @code{usmul@var{m}3} instruction pattern -@cindex @code{div@var{m}3} instruction pattern -@cindex @code{ssdiv@var{m}3} instruction pattern -@cindex @code{udiv@var{m}3} instruction pattern -@cindex @code{usdiv@var{m}3} instruction pattern -@cindex @code{mod@var{m}3} instruction pattern -@cindex @code{umod@var{m}3} instruction pattern -@cindex @code{umin@var{m}3} instruction pattern -@cindex @code{umax@var{m}3} instruction pattern -@cindex @code{and@var{m}3} instruction pattern -@cindex @code{ior@var{m}3} instruction pattern -@cindex @code{xor@var{m}3} instruction pattern -@item @samp{ssadd@var{m}3}, @samp{usadd@var{m}3} -@itemx @samp{sub@var{m}3}, @samp{sssub@var{m}3}, @samp{ussub@var{m}3} -@itemx @samp{mul@var{m}3}, @samp{ssmul@var{m}3}, @samp{usmul@var{m}3} -@itemx @samp{div@var{m}3}, @samp{ssdiv@var{m}3} -@itemx @samp{udiv@var{m}3}, @samp{usdiv@var{m}3} -@itemx @samp{mod@var{m}3}, @samp{umod@var{m}3} -@itemx @samp{umin@var{m}3}, @samp{umax@var{m}3} -@itemx @samp{and@var{m}3}, @samp{ior@var{m}3}, @samp{xor@var{m}3} -Similar, for other arithmetic operations. - -@cindex @code{fma@var{m}4} instruction pattern -@item @samp{fma@var{m}4} -Multiply operand 2 and operand 1, then add operand 3, storing the -result in operand 0 without doing an intermediate rounding step. All -operands must have mode @var{m}. This pattern is used to implement -the @code{fma}, @code{fmaf}, and @code{fmal} builtin functions from -the ISO C99 standard. - -@cindex @code{fms@var{m}4} instruction pattern -@item @samp{fms@var{m}4} -Like @code{fma@var{m}4}, except operand 3 subtracted from the -product instead of added to the product. This is represented -in the rtl as - -@smallexample -(fma:@var{m} @var{op1} @var{op2} (neg:@var{m} @var{op3})) -@end smallexample - -@cindex @code{fnma@var{m}4} instruction pattern -@item @samp{fnma@var{m}4} -Like @code{fma@var{m}4} except that the intermediate product -is negated before being added to operand 3. This is represented -in the rtl as - -@smallexample -(fma:@var{m} (neg:@var{m} @var{op1}) @var{op2} @var{op3}) -@end smallexample - -@cindex @code{fnms@var{m}4} instruction pattern -@item @samp{fnms@var{m}4} -Like @code{fms@var{m}4} except that the intermediate product -is negated before subtracting operand 3. This is represented -in the rtl as - -@smallexample -(fma:@var{m} (neg:@var{m} @var{op1}) @var{op2} (neg:@var{m} @var{op3})) -@end smallexample - -@cindex @code{min@var{m}3} instruction pattern -@cindex @code{max@var{m}3} instruction pattern -@item @samp{smin@var{m}3}, @samp{smax@var{m}3} -Signed minimum and maximum operations. When used with floating point, -if both operands are zeros, or if either operand is @code{NaN}, then -it is unspecified which of the two operands is returned as the result. - -@cindex @code{reduc_smin_@var{m}} instruction pattern -@cindex @code{reduc_smax_@var{m}} instruction pattern -@item @samp{reduc_smin_@var{m}}, @samp{reduc_smax_@var{m}} -Find the signed minimum/maximum of the elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of -operand 0 (also a vector). The output and input vector should have the same -modes. These are legacy optabs, and platforms should prefer to implement -@samp{reduc_smin_scal_@var{m}} and @samp{reduc_smax_scal_@var{m}}. - -@cindex @code{reduc_umin_@var{m}} instruction pattern -@cindex @code{reduc_umax_@var{m}} instruction pattern -@item @samp{reduc_umin_@var{m}}, @samp{reduc_umax_@var{m}} -Find the unsigned minimum/maximum of the elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of -operand 0 (also a vector). The output and input vector should have the same -modes. These are legacy optabs, and platforms should prefer to implement -@samp{reduc_umin_scal_@var{m}} and @samp{reduc_umax_scal_@var{m}}. - -@cindex @code{reduc_splus_@var{m}} instruction pattern -@cindex @code{reduc_uplus_@var{m}} instruction pattern -@item @samp{reduc_splus_@var{m}}, @samp{reduc_uplus_@var{m}} -Compute the sum of the signed/unsigned elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of operand 0 -(also a vector). The output and input vector should have the same modes. -These are legacy optabs, and platforms should prefer to implement -@samp{reduc_plus_scal_@var{m}}. - -@cindex @code{reduc_smin_scal_@var{m}} instruction pattern -@cindex @code{reduc_smax_scal_@var{m}} instruction pattern -@item @samp{reduc_smin_scal_@var{m}}, @samp{reduc_smax_scal_@var{m}} -Find the signed minimum/maximum of the elements of a vector. The vector is -operand 1, and operand 0 is the scalar result, with mode equal to the mode of -the elements of the input vector. - -@cindex @code{reduc_umin_scal_@var{m}} instruction pattern -@cindex @code{reduc_umax_scal_@var{m}} instruction pattern -@item @samp{reduc_umin_scal_@var{m}}, @samp{reduc_umax_scal_@var{m}} -Find the unsigned minimum/maximum of the elements of a vector. The vector is -operand 1, and operand 0 is the scalar result, with mode equal to the mode of -the elements of the input vector. - -@cindex @code{reduc_plus_scal_@var{m}} instruction pattern -@item @samp{reduc_plus_scal_@var{m}} -Compute the sum of the elements of a vector. The vector is operand 1, and -operand 0 is the scalar result, with mode equal to the mode of the elements of -the input vector. - -@cindex @code{sdot_prod@var{m}} instruction pattern -@item @samp{sdot_prod@var{m}} -@cindex @code{udot_prod@var{m}} instruction pattern -@itemx @samp{udot_prod@var{m}} -Compute the sum of the products of two signed/unsigned elements. -Operand 1 and operand 2 are of the same mode. Their product, which is of a -wider mode, is computed and added to operand 3. Operand 3 is of a mode equal or -wider than the mode of the product. The result is placed in operand 0, which -is of the same mode as operand 3. - -@cindex @code{ssad@var{m}} instruction pattern -@item @samp{ssad@var{m}} -@cindex @code{usad@var{m}} instruction pattern -@item @samp{usad@var{m}} -Compute the sum of absolute differences of two signed/unsigned elements. -Operand 1 and operand 2 are of the same mode. Their absolute difference, which -is of a wider mode, is computed and added to operand 3. Operand 3 is of a mode -equal or wider than the mode of the absolute difference. The result is placed -in operand 0, which is of the same mode as operand 3. - -@cindex @code{ssum_widen@var{m3}} instruction pattern -@item @samp{ssum_widen@var{m3}} -@cindex @code{usum_widen@var{m3}} instruction pattern -@itemx @samp{usum_widen@var{m3}} -Operands 0 and 2 are of the same mode, which is wider than the mode of -operand 1. Add operand 1 to operand 2 and place the widened result in -operand 0. (This is used express accumulation of elements into an accumulator -of a wider mode.) - -@cindex @code{vec_shr_@var{m}} instruction pattern -@item @samp{vec_shr_@var{m}} -Whole vector right shift in bits, i.e. towards element 0. -Operand 1 is a vector to be shifted. -Operand 2 is an integer shift amount in bits. -Operand 0 is where the resulting shifted vector is stored. -The output and input vectors should have the same modes. - -@cindex @code{vec_pack_trunc_@var{m}} instruction pattern -@item @samp{vec_pack_trunc_@var{m}} -Narrow (demote) and merge the elements of two vectors. Operands 1 and 2 -are vectors of the same mode having N integral or floating point elements -of size S@. Operand 0 is the resulting vector in which 2*N elements of -size N/2 are concatenated after narrowing them down using truncation. - -@cindex @code{vec_pack_ssat_@var{m}} instruction pattern -@cindex @code{vec_pack_usat_@var{m}} instruction pattern -@item @samp{vec_pack_ssat_@var{m}}, @samp{vec_pack_usat_@var{m}} -Narrow (demote) and merge the elements of two vectors. Operands 1 and 2 -are vectors of the same mode having N integral elements of size S. -Operand 0 is the resulting vector in which the elements of the two input -vectors are concatenated after narrowing them down using signed/unsigned -saturating arithmetic. - -@cindex @code{vec_pack_sfix_trunc_@var{m}} instruction pattern -@cindex @code{vec_pack_ufix_trunc_@var{m}} instruction pattern -@item @samp{vec_pack_sfix_trunc_@var{m}}, @samp{vec_pack_ufix_trunc_@var{m}} -Narrow, convert to signed/unsigned integral type and merge the elements -of two vectors. Operands 1 and 2 are vectors of the same mode having N -floating point elements of size S@. Operand 0 is the resulting vector -in which 2*N elements of size N/2 are concatenated. - -@cindex @code{vec_unpacks_hi_@var{m}} instruction pattern -@cindex @code{vec_unpacks_lo_@var{m}} instruction pattern -@item @samp{vec_unpacks_hi_@var{m}}, @samp{vec_unpacks_lo_@var{m}} -Extract and widen (promote) the high/low part of a vector of signed -integral or floating point elements. The input vector (operand 1) has N -elements of size S@. Widen (promote) the high/low elements of the vector -using signed or floating point extension and place the resulting N/2 -values of size 2*S in the output vector (operand 0). - -@cindex @code{vec_unpacku_hi_@var{m}} instruction pattern -@cindex @code{vec_unpacku_lo_@var{m}} instruction pattern -@item @samp{vec_unpacku_hi_@var{m}}, @samp{vec_unpacku_lo_@var{m}} -Extract and widen (promote) the high/low part of a vector of unsigned -integral elements. The input vector (operand 1) has N elements of size S. -Widen (promote) the high/low elements of the vector using zero extension and -place the resulting N/2 values of size 2*S in the output vector (operand 0). - -@cindex @code{vec_unpacks_float_hi_@var{m}} instruction pattern -@cindex @code{vec_unpacks_float_lo_@var{m}} instruction pattern -@cindex @code{vec_unpacku_float_hi_@var{m}} instruction pattern -@cindex @code{vec_unpacku_float_lo_@var{m}} instruction pattern -@item @samp{vec_unpacks_float_hi_@var{m}}, @samp{vec_unpacks_float_lo_@var{m}} -@itemx @samp{vec_unpacku_float_hi_@var{m}}, @samp{vec_unpacku_float_lo_@var{m}} -Extract, convert to floating point type and widen the high/low part of a -vector of signed/unsigned integral elements. The input vector (operand 1) -has N elements of size S@. Convert the high/low elements of the vector using -floating point conversion and place the resulting N/2 values of size 2*S in -the output vector (operand 0). - -@cindex @code{vec_widen_umult_hi_@var{m}} instruction pattern -@cindex @code{vec_widen_umult_lo_@var{m}} instruction pattern -@cindex @code{vec_widen_smult_hi_@var{m}} instruction pattern -@cindex @code{vec_widen_smult_lo_@var{m}} instruction pattern -@cindex @code{vec_widen_umult_even_@var{m}} instruction pattern -@cindex @code{vec_widen_umult_odd_@var{m}} instruction pattern -@cindex @code{vec_widen_smult_even_@var{m}} instruction pattern -@cindex @code{vec_widen_smult_odd_@var{m}} instruction pattern -@item @samp{vec_widen_umult_hi_@var{m}}, @samp{vec_widen_umult_lo_@var{m}} -@itemx @samp{vec_widen_smult_hi_@var{m}}, @samp{vec_widen_smult_lo_@var{m}} -@itemx @samp{vec_widen_umult_even_@var{m}}, @samp{vec_widen_umult_odd_@var{m}} -@itemx @samp{vec_widen_smult_even_@var{m}}, @samp{vec_widen_smult_odd_@var{m}} -Signed/Unsigned widening multiplication. The two inputs (operands 1 and 2) -are vectors with N signed/unsigned elements of size S@. Multiply the high/low -or even/odd elements of the two vectors, and put the N/2 products of size 2*S -in the output vector (operand 0). A target shouldn't implement even/odd pattern -pair if it is less efficient than lo/hi one. - -@cindex @code{vec_widen_ushiftl_hi_@var{m}} instruction pattern -@cindex @code{vec_widen_ushiftl_lo_@var{m}} instruction pattern -@cindex @code{vec_widen_sshiftl_hi_@var{m}} instruction pattern -@cindex @code{vec_widen_sshiftl_lo_@var{m}} instruction pattern -@item @samp{vec_widen_ushiftl_hi_@var{m}}, @samp{vec_widen_ushiftl_lo_@var{m}} -@itemx @samp{vec_widen_sshiftl_hi_@var{m}}, @samp{vec_widen_sshiftl_lo_@var{m}} -Signed/Unsigned widening shift left. The first input (operand 1) is a vector -with N signed/unsigned elements of size S@. Operand 2 is a constant. Shift -the high/low elements of operand 1, and put the N/2 results of size 2*S in the -output vector (operand 0). - -@cindex @code{mulhisi3} instruction pattern -@item @samp{mulhisi3} -Multiply operands 1 and 2, which have mode @code{HImode}, and store -a @code{SImode} product in operand 0. - -@cindex @code{mulqihi3} instruction pattern -@cindex @code{mulsidi3} instruction pattern -@item @samp{mulqihi3}, @samp{mulsidi3} -Similar widening-multiplication instructions of other widths. - -@cindex @code{umulqihi3} instruction pattern -@cindex @code{umulhisi3} instruction pattern -@cindex @code{umulsidi3} instruction pattern -@item @samp{umulqihi3}, @samp{umulhisi3}, @samp{umulsidi3} -Similar widening-multiplication instructions that do unsigned -multiplication. - -@cindex @code{usmulqihi3} instruction pattern -@cindex @code{usmulhisi3} instruction pattern -@cindex @code{usmulsidi3} instruction pattern -@item @samp{usmulqihi3}, @samp{usmulhisi3}, @samp{usmulsidi3} -Similar widening-multiplication instructions that interpret the first -operand as unsigned and the second operand as signed, then do a signed -multiplication. - -@cindex @code{smul@var{m}3_highpart} instruction pattern -@item @samp{smul@var{m}3_highpart} -Perform a signed multiplication of operands 1 and 2, which have mode -@var{m}, and store the most significant half of the product in operand 0. -The least significant half of the product is discarded. - -@cindex @code{umul@var{m}3_highpart} instruction pattern -@item @samp{umul@var{m}3_highpart} -Similar, but the multiplication is unsigned. - -@cindex @code{madd@var{m}@var{n}4} instruction pattern -@item @samp{madd@var{m}@var{n}4} -Multiply operands 1 and 2, sign-extend them to mode @var{n}, add -operand 3, and store the result in operand 0. Operands 1 and 2 -have mode @var{m} and operands 0 and 3 have mode @var{n}. -Both modes must be integer or fixed-point modes and @var{n} must be twice -the size of @var{m}. - -In other words, @code{madd@var{m}@var{n}4} is like -@code{mul@var{m}@var{n}3} except that it also adds operand 3. - -These instructions are not allowed to @code{FAIL}. - -@cindex @code{umadd@var{m}@var{n}4} instruction pattern -@item @samp{umadd@var{m}@var{n}4} -Like @code{madd@var{m}@var{n}4}, but zero-extend the multiplication -operands instead of sign-extending them. - -@cindex @code{ssmadd@var{m}@var{n}4} instruction pattern -@item @samp{ssmadd@var{m}@var{n}4} -Like @code{madd@var{m}@var{n}4}, but all involved operations must be -signed-saturating. - -@cindex @code{usmadd@var{m}@var{n}4} instruction pattern -@item @samp{usmadd@var{m}@var{n}4} -Like @code{umadd@var{m}@var{n}4}, but all involved operations must be -unsigned-saturating. - -@cindex @code{msub@var{m}@var{n}4} instruction pattern -@item @samp{msub@var{m}@var{n}4} -Multiply operands 1 and 2, sign-extend them to mode @var{n}, subtract the -result from operand 3, and store the result in operand 0. Operands 1 and 2 -have mode @var{m} and operands 0 and 3 have mode @var{n}. -Both modes must be integer or fixed-point modes and @var{n} must be twice -the size of @var{m}. - -In other words, @code{msub@var{m}@var{n}4} is like -@code{mul@var{m}@var{n}3} except that it also subtracts the result -from operand 3. - -These instructions are not allowed to @code{FAIL}. - -@cindex @code{umsub@var{m}@var{n}4} instruction pattern -@item @samp{umsub@var{m}@var{n}4} -Like @code{msub@var{m}@var{n}4}, but zero-extend the multiplication -operands instead of sign-extending them. - -@cindex @code{ssmsub@var{m}@var{n}4} instruction pattern -@item @samp{ssmsub@var{m}@var{n}4} -Like @code{msub@var{m}@var{n}4}, but all involved operations must be -signed-saturating. - -@cindex @code{usmsub@var{m}@var{n}4} instruction pattern -@item @samp{usmsub@var{m}@var{n}4} -Like @code{umsub@var{m}@var{n}4}, but all involved operations must be -unsigned-saturating. - -@cindex @code{divmod@var{m}4} instruction pattern -@item @samp{divmod@var{m}4} -Signed division that produces both a quotient and a remainder. -Operand 1 is divided by operand 2 to produce a quotient stored -in operand 0 and a remainder stored in operand 3. - -For machines with an instruction that produces both a quotient and a -remainder, provide a pattern for @samp{divmod@var{m}4} but do not -provide patterns for @samp{div@var{m}3} and @samp{mod@var{m}3}. This -allows optimization in the relatively common case when both the quotient -and remainder are computed. - -If an instruction that just produces a quotient or just a remainder -exists and is more efficient than the instruction that produces both, -write the output routine of @samp{divmod@var{m}4} to call -@code{find_reg_note} and look for a @code{REG_UNUSED} note on the -quotient or remainder and generate the appropriate instruction. - -@cindex @code{udivmod@var{m}4} instruction pattern -@item @samp{udivmod@var{m}4} -Similar, but does unsigned division. - -@anchor{shift patterns} -@cindex @code{ashl@var{m}3} instruction pattern -@cindex @code{ssashl@var{m}3} instruction pattern -@cindex @code{usashl@var{m}3} instruction pattern -@item @samp{ashl@var{m}3}, @samp{ssashl@var{m}3}, @samp{usashl@var{m}3} -Arithmetic-shift operand 1 left by a number of bits specified by operand -2, and store the result in operand 0. Here @var{m} is the mode of -operand 0 and operand 1; operand 2's mode is specified by the -instruction pattern, and the compiler will convert the operand to that -mode before generating the instruction. The meaning of out-of-range shift -counts can optionally be specified by @code{TARGET_SHIFT_TRUNCATION_MASK}. -@xref{TARGET_SHIFT_TRUNCATION_MASK}. Operand 2 is always a scalar type. - -@cindex @code{ashr@var{m}3} instruction pattern -@cindex @code{lshr@var{m}3} instruction pattern -@cindex @code{rotl@var{m}3} instruction pattern -@cindex @code{rotr@var{m}3} instruction pattern -@item @samp{ashr@var{m}3}, @samp{lshr@var{m}3}, @samp{rotl@var{m}3}, @samp{rotr@var{m}3} -Other shift and rotate instructions, analogous to the -@code{ashl@var{m}3} instructions. Operand 2 is always a scalar type. - -@cindex @code{vashl@var{m}3} instruction pattern -@cindex @code{vashr@var{m}3} instruction pattern -@cindex @code{vlshr@var{m}3} instruction pattern -@cindex @code{vrotl@var{m}3} instruction pattern -@cindex @code{vrotr@var{m}3} instruction pattern -@item @samp{vashl@var{m}3}, @samp{vashr@var{m}3}, @samp{vlshr@var{m}3}, @samp{vrotl@var{m}3}, @samp{vrotr@var{m}3} -Vector shift and rotate instructions that take vectors as operand 2 -instead of a scalar type. - -@cindex @code{bswap@var{m}2} instruction pattern -@item @samp{bswap@var{m}2} -Reverse the order of bytes of operand 1 and store the result in operand 0. - -@cindex @code{neg@var{m}2} instruction pattern -@cindex @code{ssneg@var{m}2} instruction pattern -@cindex @code{usneg@var{m}2} instruction pattern -@item @samp{neg@var{m}2}, @samp{ssneg@var{m}2}, @samp{usneg@var{m}2} -Negate operand 1 and store the result in operand 0. - -@cindex @code{abs@var{m}2} instruction pattern -@item @samp{abs@var{m}2} -Store the absolute value of operand 1 into operand 0. - -@cindex @code{sqrt@var{m}2} instruction pattern -@item @samp{sqrt@var{m}2} -Store the square root of operand 1 into operand 0. - -The @code{sqrt} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{sqrtf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{fmod@var{m}3} instruction pattern -@item @samp{fmod@var{m}3} -Store the remainder of dividing operand 1 by operand 2 into -operand 0, rounded towards zero to an integer. - -The @code{fmod} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{fmodf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{remainder@var{m}3} instruction pattern -@item @samp{remainder@var{m}3} -Store the remainder of dividing operand 1 by operand 2 into -operand 0, rounded to the nearest integer. - -The @code{remainder} built-in function of C always uses the mode -which corresponds to the C data type @code{double} and the -@code{remainderf} built-in function uses the mode which corresponds -to the C data type @code{float}. - -@cindex @code{cos@var{m}2} instruction pattern -@item @samp{cos@var{m}2} -Store the cosine of operand 1 into operand 0. - -The @code{cos} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{cosf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{sin@var{m}2} instruction pattern -@item @samp{sin@var{m}2} -Store the sine of operand 1 into operand 0. - -The @code{sin} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{sinf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{sincos@var{m}3} instruction pattern -@item @samp{sincos@var{m}3} -Store the cosine of operand 2 into operand 0 and the sine of -operand 2 into operand 1. - -The @code{sin} and @code{cos} built-in functions of C always use the -mode which corresponds to the C data type @code{double} and the -@code{sinf} and @code{cosf} built-in function use the mode which -corresponds to the C data type @code{float}. -Targets that can calculate the sine and cosine simultaneously can -implement this pattern as opposed to implementing individual -@code{sin@var{m}2} and @code{cos@var{m}2} patterns. The @code{sin} -and @code{cos} built-in functions will then be expanded to the -@code{sincos@var{m}3} pattern, with one of the output values -left unused. - -@cindex @code{exp@var{m}2} instruction pattern -@item @samp{exp@var{m}2} -Store the exponential of operand 1 into operand 0. - -The @code{exp} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{expf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{log@var{m}2} instruction pattern -@item @samp{log@var{m}2} -Store the natural logarithm of operand 1 into operand 0. - -The @code{log} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{logf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{pow@var{m}3} instruction pattern -@item @samp{pow@var{m}3} -Store the value of operand 1 raised to the exponent operand 2 -into operand 0. - -The @code{pow} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{powf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{atan2@var{m}3} instruction pattern -@item @samp{atan2@var{m}3} -Store the arc tangent (inverse tangent) of operand 1 divided by -operand 2 into operand 0, using the signs of both arguments to -determine the quadrant of the result. - -The @code{atan2} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{atan2f} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{floor@var{m}2} instruction pattern -@item @samp{floor@var{m}2} -Store the largest integral value not greater than argument. - -The @code{floor} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{floorf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{btrunc@var{m}2} instruction pattern -@item @samp{btrunc@var{m}2} -Store the argument rounded to integer towards zero. - -The @code{trunc} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{truncf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{round@var{m}2} instruction pattern -@item @samp{round@var{m}2} -Store the argument rounded to integer away from zero. - -The @code{round} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{roundf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{ceil@var{m}2} instruction pattern -@item @samp{ceil@var{m}2} -Store the argument rounded to integer away from zero. - -The @code{ceil} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{ceilf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{nearbyint@var{m}2} instruction pattern -@item @samp{nearbyint@var{m}2} -Store the argument rounded according to the default rounding mode - -The @code{nearbyint} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{nearbyintf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{rint@var{m}2} instruction pattern -@item @samp{rint@var{m}2} -Store the argument rounded according to the default rounding mode and -raise the inexact exception when the result differs in value from -the argument - -The @code{rint} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{rintf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{lrint@var{m}@var{n}2} -@item @samp{lrint@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as a signed number according to the current -rounding mode and store in operand 0 (which has mode @var{n}). - -@cindex @code{lround@var{m}@var{n}2} -@item @samp{lround@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as a signed number rounding to nearest and away -from zero and store in operand 0 (which has mode @var{n}). - -@cindex @code{lfloor@var{m}@var{n}2} -@item @samp{lfloor@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as a signed number rounding down and store in -operand 0 (which has mode @var{n}). - -@cindex @code{lceil@var{m}@var{n}2} -@item @samp{lceil@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as a signed number rounding up and store in -operand 0 (which has mode @var{n}). - -@cindex @code{copysign@var{m}3} instruction pattern -@item @samp{copysign@var{m}3} -Store a value with the magnitude of operand 1 and the sign of operand -2 into operand 0. - -The @code{copysign} built-in function of C always uses the mode which -corresponds to the C data type @code{double} and the @code{copysignf} -built-in function uses the mode which corresponds to the C data -type @code{float}. - -@cindex @code{ffs@var{m}2} instruction pattern -@item @samp{ffs@var{m}2} -Store into operand 0 one plus the index of the least significant 1-bit -of operand 1. If operand 1 is zero, store zero. @var{m} is the mode -of operand 0; operand 1's mode is specified by the instruction -pattern, and the compiler will convert the operand to that mode before -generating the instruction. - -The @code{ffs} built-in function of C always uses the mode which -corresponds to the C data type @code{int}. - -@cindex @code{clrsb@var{m}2} instruction pattern -@item @samp{clrsb@var{m}2} -Count leading redundant sign bits. -Store into operand 0 the number of redundant sign bits in operand 1, starting -at the most significant bit position. -A redundant sign bit is defined as any sign bit after the first. As such, -this count will be one less than the count of leading sign bits. - -@cindex @code{clz@var{m}2} instruction pattern -@item @samp{clz@var{m}2} -Store into operand 0 the number of leading 0-bits in operand 1, starting -at the most significant bit position. If operand 1 is 0, the -@code{CLZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}) macro defines if -the result is undefined or has a useful value. -@var{m} is the mode of operand 0; operand 1's mode is -specified by the instruction pattern, and the compiler will convert the -operand to that mode before generating the instruction. - -@cindex @code{ctz@var{m}2} instruction pattern -@item @samp{ctz@var{m}2} -Store into operand 0 the number of trailing 0-bits in operand 1, starting -at the least significant bit position. If operand 1 is 0, the -@code{CTZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}) macro defines if -the result is undefined or has a useful value. -@var{m} is the mode of operand 0; operand 1's mode is -specified by the instruction pattern, and the compiler will convert the -operand to that mode before generating the instruction. - -@cindex @code{popcount@var{m}2} instruction pattern -@item @samp{popcount@var{m}2} -Store into operand 0 the number of 1-bits in operand 1. @var{m} is the -mode of operand 0; operand 1's mode is specified by the instruction -pattern, and the compiler will convert the operand to that mode before -generating the instruction. - -@cindex @code{parity@var{m}2} instruction pattern -@item @samp{parity@var{m}2} -Store into operand 0 the parity of operand 1, i.e.@: the number of 1-bits -in operand 1 modulo 2. @var{m} is the mode of operand 0; operand 1's mode -is specified by the instruction pattern, and the compiler will convert -the operand to that mode before generating the instruction. - -@cindex @code{one_cmpl@var{m}2} instruction pattern -@item @samp{one_cmpl@var{m}2} -Store the bitwise-complement of operand 1 into operand 0. - -@cindex @code{movmem@var{m}} instruction pattern -@item @samp{movmem@var{m}} -Block move instruction. The destination and source blocks of memory -are the first two operands, and both are @code{mem:BLK}s with an -address in mode @code{Pmode}. - -The number of bytes to move is the third operand, in mode @var{m}. -Usually, you specify @code{Pmode} for @var{m}. However, if you can -generate better code knowing the range of valid lengths is smaller than -those representable in a full Pmode pointer, you should provide -a pattern with a -mode corresponding to the range of values you can handle efficiently -(e.g., @code{QImode} for values in the range 0--127; note we avoid numbers -that appear negative) and also a pattern with @code{Pmode}. - -The fourth operand is the known shared alignment of the source and -destination, in the form of a @code{const_int} rtx. Thus, if the -compiler knows that both source and destination are word-aligned, -it may provide the value 4 for this operand. - -Optional operands 5 and 6 specify expected alignment and size of block -respectively. The expected alignment differs from alignment in operand 4 -in a way that the blocks are not required to be aligned according to it in -all cases. This expected alignment is also in bytes, just like operand 4. -Expected size, when unknown, is set to @code{(const_int -1)}. - -Descriptions of multiple @code{movmem@var{m}} patterns can only be -beneficial if the patterns for smaller modes have fewer restrictions -on their first, second and fourth operands. Note that the mode @var{m} -in @code{movmem@var{m}} does not impose any restriction on the mode of -individually moved data units in the block. - -These patterns need not give special consideration to the possibility -that the source and destination strings might overlap. - -@cindex @code{movstr} instruction pattern -@item @samp{movstr} -String copy instruction, with @code{stpcpy} semantics. Operand 0 is -an output operand in mode @code{Pmode}. The addresses of the -destination and source strings are operands 1 and 2, and both are -@code{mem:BLK}s with addresses in mode @code{Pmode}. The execution of -the expansion of this pattern should store in operand 0 the address in -which the @code{NUL} terminator was stored in the destination string. - -This patern has also several optional operands that are same as in -@code{setmem}. - -@cindex @code{setmem@var{m}} instruction pattern -@item @samp{setmem@var{m}} -Block set instruction. The destination string is the first operand, -given as a @code{mem:BLK} whose address is in mode @code{Pmode}. The -number of bytes to set is the second operand, in mode @var{m}. The value to -initialize the memory with is the third operand. Targets that only support the -clearing of memory should reject any value that is not the constant 0. See -@samp{movmem@var{m}} for a discussion of the choice of mode. - -The fourth operand is the known alignment of the destination, in the form -of a @code{const_int} rtx. Thus, if the compiler knows that the -destination is word-aligned, it may provide the value 4 for this -operand. - -Optional operands 5 and 6 specify expected alignment and size of block -respectively. The expected alignment differs from alignment in operand 4 -in a way that the blocks are not required to be aligned according to it in -all cases. This expected alignment is also in bytes, just like operand 4. -Expected size, when unknown, is set to @code{(const_int -1)}. -Operand 7 is the minimal size of the block and operand 8 is the -maximal size of the block (NULL if it can not be represented as CONST_INT). -Operand 9 is the probable maximal size (i.e. we can not rely on it for correctness, -but it can be used for choosing proper code sequence for a given size). - -The use for multiple @code{setmem@var{m}} is as for @code{movmem@var{m}}. - -@cindex @code{cmpstrn@var{m}} instruction pattern -@item @samp{cmpstrn@var{m}} -String compare instruction, with five operands. Operand 0 is the output; -it has mode @var{m}. The remaining four operands are like the operands -of @samp{movmem@var{m}}. The two memory blocks specified are compared -byte by byte in lexicographic order starting at the beginning of each -string. The instruction is not allowed to prefetch more than one byte -at a time since either string may end in the first byte and reading past -that may access an invalid page or segment and cause a fault. The -comparison terminates early if the fetched bytes are different or if -they are equal to zero. The effect of the instruction is to store a -value in operand 0 whose sign indicates the result of the comparison. - -@cindex @code{cmpstr@var{m}} instruction pattern -@item @samp{cmpstr@var{m}} -String compare instruction, without known maximum length. Operand 0 is the -output; it has mode @var{m}. The second and third operand are the blocks of -memory to be compared; both are @code{mem:BLK} with an address in mode -@code{Pmode}. - -The fourth operand is the known shared alignment of the source and -destination, in the form of a @code{const_int} rtx. Thus, if the -compiler knows that both source and destination are word-aligned, -it may provide the value 4 for this operand. - -The two memory blocks specified are compared byte by byte in lexicographic -order starting at the beginning of each string. The instruction is not allowed -to prefetch more than one byte at a time since either string may end in the -first byte and reading past that may access an invalid page or segment and -cause a fault. The comparison will terminate when the fetched bytes -are different or if they are equal to zero. The effect of the -instruction is to store a value in operand 0 whose sign indicates the -result of the comparison. - -@cindex @code{cmpmem@var{m}} instruction pattern -@item @samp{cmpmem@var{m}} -Block compare instruction, with five operands like the operands -of @samp{cmpstr@var{m}}. The two memory blocks specified are compared -byte by byte in lexicographic order starting at the beginning of each -block. Unlike @samp{cmpstr@var{m}} the instruction can prefetch -any bytes in the two memory blocks. Also unlike @samp{cmpstr@var{m}} -the comparison will not stop if both bytes are zero. The effect of -the instruction is to store a value in operand 0 whose sign indicates -the result of the comparison. - -@cindex @code{strlen@var{m}} instruction pattern -@item @samp{strlen@var{m}} -Compute the length of a string, with three operands. -Operand 0 is the result (of mode @var{m}), operand 1 is -a @code{mem} referring to the first character of the string, -operand 2 is the character to search for (normally zero), -and operand 3 is a constant describing the known alignment -of the beginning of the string. - -@cindex @code{float@var{m}@var{n}2} instruction pattern -@item @samp{float@var{m}@var{n}2} -Convert signed integer operand 1 (valid for fixed point mode @var{m}) to -floating point mode @var{n} and store in operand 0 (which has mode -@var{n}). - -@cindex @code{floatuns@var{m}@var{n}2} instruction pattern -@item @samp{floatuns@var{m}@var{n}2} -Convert unsigned integer operand 1 (valid for fixed point mode @var{m}) -to floating point mode @var{n} and store in operand 0 (which has mode -@var{n}). - -@cindex @code{fix@var{m}@var{n}2} instruction pattern -@item @samp{fix@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as a signed number and store in operand 0 (which -has mode @var{n}). This instruction's result is defined only when -the value of operand 1 is an integer. - -If the machine description defines this pattern, it also needs to -define the @code{ftrunc} pattern. - -@cindex @code{fixuns@var{m}@var{n}2} instruction pattern -@item @samp{fixuns@var{m}@var{n}2} -Convert operand 1 (valid for floating point mode @var{m}) to fixed -point mode @var{n} as an unsigned number and store in operand 0 (which -has mode @var{n}). This instruction's result is defined only when the -value of operand 1 is an integer. - -@cindex @code{ftrunc@var{m}2} instruction pattern -@item @samp{ftrunc@var{m}2} -Convert operand 1 (valid for floating point mode @var{m}) to an -integer value, still represented in floating point mode @var{m}, and -store it in operand 0 (valid for floating point mode @var{m}). - -@cindex @code{fix_trunc@var{m}@var{n}2} instruction pattern -@item @samp{fix_trunc@var{m}@var{n}2} -Like @samp{fix@var{m}@var{n}2} but works for any floating point value -of mode @var{m} by converting the value to an integer. - -@cindex @code{fixuns_trunc@var{m}@var{n}2} instruction pattern -@item @samp{fixuns_trunc@var{m}@var{n}2} -Like @samp{fixuns@var{m}@var{n}2} but works for any floating point -value of mode @var{m} by converting the value to an integer. - -@cindex @code{trunc@var{m}@var{n}2} instruction pattern -@item @samp{trunc@var{m}@var{n}2} -Truncate operand 1 (valid for mode @var{m}) to mode @var{n} and -store in operand 0 (which has mode @var{n}). Both modes must be fixed -point or both floating point. - -@cindex @code{extend@var{m}@var{n}2} instruction pattern -@item @samp{extend@var{m}@var{n}2} -Sign-extend operand 1 (valid for mode @var{m}) to mode @var{n} and -store in operand 0 (which has mode @var{n}). Both modes must be fixed -point or both floating point. - -@cindex @code{zero_extend@var{m}@var{n}2} instruction pattern -@item @samp{zero_extend@var{m}@var{n}2} -Zero-extend operand 1 (valid for mode @var{m}) to mode @var{n} and -store in operand 0 (which has mode @var{n}). Both modes must be fixed -point. - -@cindex @code{fract@var{m}@var{n}2} instruction pattern -@item @samp{fract@var{m}@var{n}2} -Convert operand 1 of mode @var{m} to mode @var{n} and store in -operand 0 (which has mode @var{n}). Mode @var{m} and mode @var{n} -could be fixed-point to fixed-point, signed integer to fixed-point, -fixed-point to signed integer, floating-point to fixed-point, -or fixed-point to floating-point. -When overflows or underflows happen, the results are undefined. - -@cindex @code{satfract@var{m}@var{n}2} instruction pattern -@item @samp{satfract@var{m}@var{n}2} -Convert operand 1 of mode @var{m} to mode @var{n} and store in -operand 0 (which has mode @var{n}). Mode @var{m} and mode @var{n} -could be fixed-point to fixed-point, signed integer to fixed-point, -or floating-point to fixed-point. -When overflows or underflows happen, the instruction saturates the -results to the maximum or the minimum. - -@cindex @code{fractuns@var{m}@var{n}2} instruction pattern -@item @samp{fractuns@var{m}@var{n}2} -Convert operand 1 of mode @var{m} to mode @var{n} and store in -operand 0 (which has mode @var{n}). Mode @var{m} and mode @var{n} -could be unsigned integer to fixed-point, or -fixed-point to unsigned integer. -When overflows or underflows happen, the results are undefined. - -@cindex @code{satfractuns@var{m}@var{n}2} instruction pattern -@item @samp{satfractuns@var{m}@var{n}2} -Convert unsigned integer operand 1 of mode @var{m} to fixed-point mode -@var{n} and store in operand 0 (which has mode @var{n}). -When overflows or underflows happen, the instruction saturates the -results to the maximum or the minimum. - -@cindex @code{extv@var{m}} instruction pattern -@item @samp{extv@var{m}} -Extract a bit-field from register operand 1, sign-extend it, and store -it in operand 0. Operand 2 specifies the width of the field in bits -and operand 3 the starting bit, which counts from the most significant -bit if @samp{BITS_BIG_ENDIAN} is true and from the least significant bit -otherwise. - -Operands 0 and 1 both have mode @var{m}. Operands 2 and 3 have a -target-specific mode. - -@cindex @code{extvmisalign@var{m}} instruction pattern -@item @samp{extvmisalign@var{m}} -Extract a bit-field from memory operand 1, sign extend it, and store -it in operand 0. Operand 2 specifies the width in bits and operand 3 -the starting bit. The starting bit is always somewhere in the first byte of -operand 1; it counts from the most significant bit if @samp{BITS_BIG_ENDIAN} -is true and from the least significant bit otherwise. - -Operand 0 has mode @var{m} while operand 1 has @code{BLK} mode. -Operands 2 and 3 have a target-specific mode. - -The instruction must not read beyond the last byte of the bit-field. - -@cindex @code{extzv@var{m}} instruction pattern -@item @samp{extzv@var{m}} -Like @samp{extv@var{m}} except that the bit-field value is zero-extended. - -@cindex @code{extzvmisalign@var{m}} instruction pattern -@item @samp{extzvmisalign@var{m}} -Like @samp{extvmisalign@var{m}} except that the bit-field value is -zero-extended. - -@cindex @code{insv@var{m}} instruction pattern -@item @samp{insv@var{m}} -Insert operand 3 into a bit-field of register operand 0. Operand 1 -specifies the width of the field in bits and operand 2 the starting bit, -which counts from the most significant bit if @samp{BITS_BIG_ENDIAN} -is true and from the least significant bit otherwise. - -Operands 0 and 3 both have mode @var{m}. Operands 1 and 2 have a -target-specific mode. - -@cindex @code{insvmisalign@var{m}} instruction pattern -@item @samp{insvmisalign@var{m}} -Insert operand 3 into a bit-field of memory operand 0. Operand 1 -specifies the width of the field in bits and operand 2 the starting bit. -The starting bit is always somewhere in the first byte of operand 0; -it counts from the most significant bit if @samp{BITS_BIG_ENDIAN} -is true and from the least significant bit otherwise. - -Operand 3 has mode @var{m} while operand 0 has @code{BLK} mode. -Operands 1 and 2 have a target-specific mode. - -The instruction must not read or write beyond the last byte of the bit-field. - -@cindex @code{extv} instruction pattern -@item @samp{extv} -Extract a bit-field from operand 1 (a register or memory operand), where -operand 2 specifies the width in bits and operand 3 the starting bit, -and store it in operand 0. Operand 0 must have mode @code{word_mode}. -Operand 1 may have mode @code{byte_mode} or @code{word_mode}; often -@code{word_mode} is allowed only for registers. Operands 2 and 3 must -be valid for @code{word_mode}. - -The RTL generation pass generates this instruction only with constants -for operands 2 and 3 and the constant is never zero for operand 2. - -The bit-field value is sign-extended to a full word integer -before it is stored in operand 0. - -This pattern is deprecated; please use @samp{extv@var{m}} and -@code{extvmisalign@var{m}} instead. - -@cindex @code{extzv} instruction pattern -@item @samp{extzv} -Like @samp{extv} except that the bit-field value is zero-extended. - -This pattern is deprecated; please use @samp{extzv@var{m}} and -@code{extzvmisalign@var{m}} instead. - -@cindex @code{insv} instruction pattern -@item @samp{insv} -Store operand 3 (which must be valid for @code{word_mode}) into a -bit-field in operand 0, where operand 1 specifies the width in bits and -operand 2 the starting bit. Operand 0 may have mode @code{byte_mode} or -@code{word_mode}; often @code{word_mode} is allowed only for registers. -Operands 1 and 2 must be valid for @code{word_mode}. - -The RTL generation pass generates this instruction only with constants -for operands 1 and 2 and the constant is never zero for operand 1. - -This pattern is deprecated; please use @samp{insv@var{m}} and -@code{insvmisalign@var{m}} instead. - -@cindex @code{mov@var{mode}cc} instruction pattern -@item @samp{mov@var{mode}cc} -Conditionally move operand 2 or operand 3 into operand 0 according to the -comparison in operand 1. If the comparison is true, operand 2 is moved -into operand 0, otherwise operand 3 is moved. - -The mode of the operands being compared need not be the same as the operands -being moved. Some machines, sparc64 for example, have instructions that -conditionally move an integer value based on the floating point condition -codes and vice versa. - -If the machine does not have conditional move instructions, do not -define these patterns. - -@cindex @code{add@var{mode}cc} instruction pattern -@item @samp{add@var{mode}cc} -Similar to @samp{mov@var{mode}cc} but for conditional addition. Conditionally -move operand 2 or (operands 2 + operand 3) into operand 0 according to the -comparison in operand 1. If the comparison is false, operand 2 is moved into -operand 0, otherwise (operand 2 + operand 3) is moved. - -@cindex @code{cstore@var{mode}4} instruction pattern -@item @samp{cstore@var{mode}4} -Store zero or nonzero in operand 0 according to whether a comparison -is true. Operand 1 is a comparison operator. Operand 2 and operand 3 -are the first and second operand of the comparison, respectively. -You specify the mode that operand 0 must have when you write the -@code{match_operand} expression. The compiler automatically sees which -mode you have used and supplies an operand of that mode. - -The value stored for a true condition must have 1 as its low bit, or -else must be negative. Otherwise the instruction is not suitable and -you should omit it from the machine description. You describe to the -compiler exactly which value is stored by defining the macro -@code{STORE_FLAG_VALUE} (@pxref{Misc}). If a description cannot be -found that can be used for all the possible comparison operators, you -should pick one and use a @code{define_expand} to map all results -onto the one you chose. - -These operations may @code{FAIL}, but should do so only in relatively -uncommon cases; if they would @code{FAIL} for common cases involving -integer comparisons, it is best to restrict the predicates to not -allow these operands. Likewise if a given comparison operator will -always fail, independent of the operands (for floating-point modes, the -@code{ordered_comparison_operator} predicate is often useful in this case). - -If this pattern is omitted, the compiler will generate a conditional -branch---for example, it may copy a constant one to the target and branching -around an assignment of zero to the target---or a libcall. If the predicate -for operand 1 only rejects some operators, it will also try reordering the -operands and/or inverting the result value (e.g.@: by an exclusive OR). -These possibilities could be cheaper or equivalent to the instructions -used for the @samp{cstore@var{mode}4} pattern followed by those required -to convert a positive result from @code{STORE_FLAG_VALUE} to 1; in this -case, you can and should make operand 1's predicate reject some operators -in the @samp{cstore@var{mode}4} pattern, or remove the pattern altogether -from the machine description. - -@cindex @code{cbranch@var{mode}4} instruction pattern -@item @samp{cbranch@var{mode}4} -Conditional branch instruction combined with a compare instruction. -Operand 0 is a comparison operator. Operand 1 and operand 2 are the -first and second operands of the comparison, respectively. Operand 3 -is a @code{label_ref} that refers to the label to jump to. - -@cindex @code{jump} instruction pattern -@item @samp{jump} -A jump inside a function; an unconditional branch. Operand 0 is the -@code{label_ref} of the label to jump to. This pattern name is mandatory -on all machines. - -@cindex @code{call} instruction pattern -@item @samp{call} -Subroutine call instruction returning no value. Operand 0 is the -function to call; operand 1 is the number of bytes of arguments pushed -as a @code{const_int}; operand 2 is the number of registers used as -operands. - -On most machines, operand 2 is not actually stored into the RTL -pattern. It is supplied for the sake of some RISC machines which need -to put this information into the assembler code; they can put it in -the RTL instead of operand 1. - -Operand 0 should be a @code{mem} RTX whose address is the address of the -function. Note, however, that this address can be a @code{symbol_ref} -expression even if it would not be a legitimate memory address on the -target machine. If it is also not a valid argument for a call -instruction, the pattern for this operation should be a -@code{define_expand} (@pxref{Expander Definitions}) that places the -address into a register and uses that register in the call instruction. - -@cindex @code{call_value} instruction pattern -@item @samp{call_value} -Subroutine call instruction returning a value. Operand 0 is the hard -register in which the value is returned. There are three more -operands, the same as the three operands of the @samp{call} -instruction (but with numbers increased by one). - -Subroutines that return @code{BLKmode} objects use the @samp{call} -insn. - -@cindex @code{call_pop} instruction pattern -@cindex @code{call_value_pop} instruction pattern -@item @samp{call_pop}, @samp{call_value_pop} -Similar to @samp{call} and @samp{call_value}, except used if defined and -if @code{RETURN_POPS_ARGS} is nonzero. They should emit a @code{parallel} -that contains both the function call and a @code{set} to indicate the -adjustment made to the frame pointer. - -For machines where @code{RETURN_POPS_ARGS} can be nonzero, the use of these -patterns increases the number of functions for which the frame pointer -can be eliminated, if desired. - -@cindex @code{untyped_call} instruction pattern -@item @samp{untyped_call} -Subroutine call instruction returning a value of any type. Operand 0 is -the function to call; operand 1 is a memory location where the result of -calling the function is to be stored; operand 2 is a @code{parallel} -expression where each element is a @code{set} expression that indicates -the saving of a function return value into the result block. - -This instruction pattern should be defined to support -@code{__builtin_apply} on machines where special instructions are needed -to call a subroutine with arbitrary arguments or to save the value -returned. This instruction pattern is required on machines that have -multiple registers that can hold a return value -(i.e.@: @code{FUNCTION_VALUE_REGNO_P} is true for more than one register). - -@cindex @code{return} instruction pattern -@item @samp{return} -Subroutine return instruction. This instruction pattern name should be -defined only if a single instruction can do all the work of returning -from a function. - -Like the @samp{mov@var{m}} patterns, this pattern is also used after the -RTL generation phase. In this case it is to support machines where -multiple instructions are usually needed to return from a function, but -some class of functions only requires one instruction to implement a -return. Normally, the applicable functions are those which do not need -to save any registers or allocate stack space. - -It is valid for this pattern to expand to an instruction using -@code{simple_return} if no epilogue is required. - -@cindex @code{simple_return} instruction pattern -@item @samp{simple_return} -Subroutine return instruction. This instruction pattern name should be -defined only if a single instruction can do all the work of returning -from a function on a path where no epilogue is required. This pattern -is very similar to the @code{return} instruction pattern, but it is emitted -only by the shrink-wrapping optimization on paths where the function -prologue has not been executed, and a function return should occur without -any of the effects of the epilogue. Additional uses may be introduced on -paths where both the prologue and the epilogue have executed. - -@findex reload_completed -@findex leaf_function_p -For such machines, the condition specified in this pattern should only -be true when @code{reload_completed} is nonzero and the function's -epilogue would only be a single instruction. For machines with register -windows, the routine @code{leaf_function_p} may be used to determine if -a register window push is required. - -Machines that have conditional return instructions should define patterns -such as - -@smallexample -(define_insn "" - [(set (pc) - (if_then_else (match_operator - 0 "comparison_operator" - [(cc0) (const_int 0)]) - (return) - (pc)))] - "@var{condition}" - "@dots{}") -@end smallexample - -where @var{condition} would normally be the same condition specified on the -named @samp{return} pattern. - -@cindex @code{untyped_return} instruction pattern -@item @samp{untyped_return} -Untyped subroutine return instruction. This instruction pattern should -be defined to support @code{__builtin_return} on machines where special -instructions are needed to return a value of any type. - -Operand 0 is a memory location where the result of calling a function -with @code{__builtin_apply} is stored; operand 1 is a @code{parallel} -expression where each element is a @code{set} expression that indicates -the restoring of a function return value from the result block. - -@cindex @code{nop} instruction pattern -@item @samp{nop} -No-op instruction. This instruction pattern name should always be defined -to output a no-op in assembler code. @code{(const_int 0)} will do as an -RTL pattern. - -@cindex @code{indirect_jump} instruction pattern -@item @samp{indirect_jump} -An instruction to jump to an address which is operand zero. -This pattern name is mandatory on all machines. - -@cindex @code{casesi} instruction pattern -@item @samp{casesi} -Instruction to jump through a dispatch table, including bounds checking. -This instruction takes five operands: - -@enumerate -@item -The index to dispatch on, which has mode @code{SImode}. - -@item -The lower bound for indices in the table, an integer constant. - -@item -The total range of indices in the table---the largest index -minus the smallest one (both inclusive). - -@item -A label that precedes the table itself. - -@item -A label to jump to if the index has a value outside the bounds. -@end enumerate - -The table is an @code{addr_vec} or @code{addr_diff_vec} inside of a -@code{jump_table_data}. The number of elements in the table is one plus the -difference between the upper bound and the lower bound. - -@cindex @code{tablejump} instruction pattern -@item @samp{tablejump} -Instruction to jump to a variable address. This is a low-level -capability which can be used to implement a dispatch table when there -is no @samp{casesi} pattern. - -This pattern requires two operands: the address or offset, and a label -which should immediately precede the jump table. If the macro -@code{CASE_VECTOR_PC_RELATIVE} evaluates to a nonzero value then the first -operand is an offset which counts from the address of the table; otherwise, -it is an absolute address to jump to. In either case, the first operand has -mode @code{Pmode}. - -The @samp{tablejump} insn is always the last insn before the jump -table it uses. Its assembler code normally has no need to use the -second operand, but you should incorporate it in the RTL pattern so -that the jump optimizer will not delete the table as unreachable code. - - -@cindex @code{decrement_and_branch_until_zero} instruction pattern -@item @samp{decrement_and_branch_until_zero} -Conditional branch instruction that decrements a register and -jumps if the register is nonzero. Operand 0 is the register to -decrement and test; operand 1 is the label to jump to if the -register is nonzero. @xref{Looping Patterns}. - -This optional instruction pattern is only used by the combiner, -typically for loops reversed by the loop optimizer when strength -reduction is enabled. - -@cindex @code{doloop_end} instruction pattern -@item @samp{doloop_end} -Conditional branch instruction that decrements a register and -jumps if the register is nonzero. Operand 0 is the register to -decrement and test; operand 1 is the label to jump to if the -register is nonzero. -@xref{Looping Patterns}. - -This optional instruction pattern should be defined for machines with -low-overhead looping instructions as the loop optimizer will try to -modify suitable loops to utilize it. The target hook -@code{TARGET_CAN_USE_DOLOOP_P} controls the conditions under which -low-overhead loops can be used. - -@cindex @code{doloop_begin} instruction pattern -@item @samp{doloop_begin} -Companion instruction to @code{doloop_end} required for machines that -need to perform some initialization, such as loading a special counter -register. Operand 1 is the associated @code{doloop_end} pattern and -operand 0 is the register that it decrements. - -If initialization insns do not always need to be emitted, use a -@code{define_expand} (@pxref{Expander Definitions}) and make it fail. - -@cindex @code{canonicalize_funcptr_for_compare} instruction pattern -@item @samp{canonicalize_funcptr_for_compare} -Canonicalize the function pointer in operand 1 and store the result -into operand 0. - -Operand 0 is always a @code{reg} and has mode @code{Pmode}; operand 1 -may be a @code{reg}, @code{mem}, @code{symbol_ref}, @code{const_int}, etc -and also has mode @code{Pmode}. - -Canonicalization of a function pointer usually involves computing -the address of the function which would be called if the function -pointer were used in an indirect call. - -Only define this pattern if function pointers on the target machine -can have different values but still call the same function when -used in an indirect call. - -@cindex @code{save_stack_block} instruction pattern -@cindex @code{save_stack_function} instruction pattern -@cindex @code{save_stack_nonlocal} instruction pattern -@cindex @code{restore_stack_block} instruction pattern -@cindex @code{restore_stack_function} instruction pattern -@cindex @code{restore_stack_nonlocal} instruction pattern -@item @samp{save_stack_block} -@itemx @samp{save_stack_function} -@itemx @samp{save_stack_nonlocal} -@itemx @samp{restore_stack_block} -@itemx @samp{restore_stack_function} -@itemx @samp{restore_stack_nonlocal} -Most machines save and restore the stack pointer by copying it to or -from an object of mode @code{Pmode}. Do not define these patterns on -such machines. - -Some machines require special handling for stack pointer saves and -restores. On those machines, define the patterns corresponding to the -non-standard cases by using a @code{define_expand} (@pxref{Expander -Definitions}) that produces the required insns. The three types of -saves and restores are: - -@enumerate -@item -@samp{save_stack_block} saves the stack pointer at the start of a block -that allocates a variable-sized object, and @samp{restore_stack_block} -restores the stack pointer when the block is exited. - -@item -@samp{save_stack_function} and @samp{restore_stack_function} do a -similar job for the outermost block of a function and are used when the -function allocates variable-sized objects or calls @code{alloca}. Only -the epilogue uses the restored stack pointer, allowing a simpler save or -restore sequence on some machines. - -@item -@samp{save_stack_nonlocal} is used in functions that contain labels -branched to by nested functions. It saves the stack pointer in such a -way that the inner function can use @samp{restore_stack_nonlocal} to -restore the stack pointer. The compiler generates code to restore the -frame and argument pointer registers, but some machines require saving -and restoring additional data such as register window information or -stack backchains. Place insns in these patterns to save and restore any -such required data. -@end enumerate - -When saving the stack pointer, operand 0 is the save area and operand 1 -is the stack pointer. The mode used to allocate the save area defaults -to @code{Pmode} but you can override that choice by defining the -@code{STACK_SAVEAREA_MODE} macro (@pxref{Storage Layout}). You must -specify an integral mode, or @code{VOIDmode} if no save area is needed -for a particular type of save (either because no save is needed or -because a machine-specific save area can be used). Operand 0 is the -stack pointer and operand 1 is the save area for restore operations. If -@samp{save_stack_block} is defined, operand 0 must not be -@code{VOIDmode} since these saves can be arbitrarily nested. - -A save area is a @code{mem} that is at a constant offset from -@code{virtual_stack_vars_rtx} when the stack pointer is saved for use by -nonlocal gotos and a @code{reg} in the other two cases. - -@cindex @code{allocate_stack} instruction pattern -@item @samp{allocate_stack} -Subtract (or add if @code{STACK_GROWS_DOWNWARD} is undefined) operand 1 from -the stack pointer to create space for dynamically allocated data. - -Store the resultant pointer to this space into operand 0. If you -are allocating space from the main stack, do this by emitting a -move insn to copy @code{virtual_stack_dynamic_rtx} to operand 0. -If you are allocating the space elsewhere, generate code to copy the -location of the space to operand 0. In the latter case, you must -ensure this space gets freed when the corresponding space on the main -stack is free. - -Do not define this pattern if all that must be done is the subtraction. -Some machines require other operations such as stack probes or -maintaining the back chain. Define this pattern to emit those -operations in addition to updating the stack pointer. - -@cindex @code{check_stack} instruction pattern -@item @samp{check_stack} -If stack checking (@pxref{Stack Checking}) cannot be done on your system by -probing the stack, define this pattern to perform the needed check and signal -an error if the stack has overflowed. The single operand is the address in -the stack farthest from the current stack pointer that you need to validate. -Normally, on platforms where this pattern is needed, you would obtain the -stack limit from a global or thread-specific variable or register. - -@cindex @code{probe_stack_address} instruction pattern -@item @samp{probe_stack_address} -If stack checking (@pxref{Stack Checking}) can be done on your system by -probing the stack but without the need to actually access it, define this -pattern and signal an error if the stack has overflowed. The single operand -is the memory address in the stack that needs to be probed. - -@cindex @code{probe_stack} instruction pattern -@item @samp{probe_stack} -If stack checking (@pxref{Stack Checking}) can be done on your system by -probing the stack but doing it with a ``store zero'' instruction is not valid -or optimal, define this pattern to do the probing differently and signal an -error if the stack has overflowed. The single operand is the memory reference -in the stack that needs to be probed. - -@cindex @code{nonlocal_goto} instruction pattern -@item @samp{nonlocal_goto} -Emit code to generate a non-local goto, e.g., a jump from one function -to a label in an outer function. This pattern has four arguments, -each representing a value to be used in the jump. The first -argument is to be loaded into the frame pointer, the second is -the address to branch to (code to dispatch to the actual label), -the third is the address of a location where the stack is saved, -and the last is the address of the label, to be placed in the -location for the incoming static chain. - -On most machines you need not define this pattern, since GCC will -already generate the correct code, which is to load the frame pointer -and static chain, restore the stack (using the -@samp{restore_stack_nonlocal} pattern, if defined), and jump indirectly -to the dispatcher. You need only define this pattern if this code will -not work on your machine. - -@cindex @code{nonlocal_goto_receiver} instruction pattern -@item @samp{nonlocal_goto_receiver} -This pattern, if defined, contains code needed at the target of a -nonlocal goto after the code already generated by GCC@. You will not -normally need to define this pattern. A typical reason why you might -need this pattern is if some value, such as a pointer to a global table, -must be restored when the frame pointer is restored. Note that a nonlocal -goto only occurs within a unit-of-translation, so a global table pointer -that is shared by all functions of a given module need not be restored. -There are no arguments. - -@cindex @code{exception_receiver} instruction pattern -@item @samp{exception_receiver} -This pattern, if defined, contains code needed at the site of an -exception handler that isn't needed at the site of a nonlocal goto. You -will not normally need to define this pattern. A typical reason why you -might need this pattern is if some value, such as a pointer to a global -table, must be restored after control flow is branched to the handler of -an exception. There are no arguments. - -@cindex @code{builtin_setjmp_setup} instruction pattern -@item @samp{builtin_setjmp_setup} -This pattern, if defined, contains additional code needed to initialize -the @code{jmp_buf}. You will not normally need to define this pattern. -A typical reason why you might need this pattern is if some value, such -as a pointer to a global table, must be restored. Though it is -preferred that the pointer value be recalculated if possible (given the -address of a label for instance). The single argument is a pointer to -the @code{jmp_buf}. Note that the buffer is five words long and that -the first three are normally used by the generic mechanism. - -@cindex @code{builtin_setjmp_receiver} instruction pattern -@item @samp{builtin_setjmp_receiver} -This pattern, if defined, contains code needed at the site of a -built-in setjmp that isn't needed at the site of a nonlocal goto. You -will not normally need to define this pattern. A typical reason why you -might need this pattern is if some value, such as a pointer to a global -table, must be restored. It takes one argument, which is the label -to which builtin_longjmp transferred control; this pattern may be emitted -at a small offset from that label. - -@cindex @code{builtin_longjmp} instruction pattern -@item @samp{builtin_longjmp} -This pattern, if defined, performs the entire action of the longjmp. -You will not normally need to define this pattern unless you also define -@code{builtin_setjmp_setup}. The single argument is a pointer to the -@code{jmp_buf}. - -@cindex @code{eh_return} instruction pattern -@item @samp{eh_return} -This pattern, if defined, affects the way @code{__builtin_eh_return}, -and thence the call frame exception handling library routines, are -built. It is intended to handle non-trivial actions needed along -the abnormal return path. - -The address of the exception handler to which the function should return -is passed as operand to this pattern. It will normally need to copied by -the pattern to some special register or memory location. -If the pattern needs to determine the location of the target call -frame in order to do so, it may use @code{EH_RETURN_STACKADJ_RTX}, -if defined; it will have already been assigned. - -If this pattern is not defined, the default action will be to simply -copy the return address to @code{EH_RETURN_HANDLER_RTX}. Either -that macro or this pattern needs to be defined if call frame exception -handling is to be used. - -@cindex @code{prologue} instruction pattern -@anchor{prologue instruction pattern} -@item @samp{prologue} -This pattern, if defined, emits RTL for entry to a function. The function -entry is responsible for setting up the stack frame, initializing the frame -pointer register, saving callee saved registers, etc. - -Using a prologue pattern is generally preferred over defining -@code{TARGET_ASM_FUNCTION_PROLOGUE} to emit assembly code for the prologue. - -The @code{prologue} pattern is particularly useful for targets which perform -instruction scheduling. - -@cindex @code{window_save} instruction pattern -@anchor{window_save instruction pattern} -@item @samp{window_save} -This pattern, if defined, emits RTL for a register window save. It should -be defined if the target machine has register windows but the window events -are decoupled from calls to subroutines. The canonical example is the SPARC -architecture. - -@cindex @code{epilogue} instruction pattern -@anchor{epilogue instruction pattern} -@item @samp{epilogue} -This pattern emits RTL for exit from a function. The function -exit is responsible for deallocating the stack frame, restoring callee saved -registers and emitting the return instruction. - -Using an epilogue pattern is generally preferred over defining -@code{TARGET_ASM_FUNCTION_EPILOGUE} to emit assembly code for the epilogue. - -The @code{epilogue} pattern is particularly useful for targets which perform -instruction scheduling or which have delay slots for their return instruction. - -@cindex @code{sibcall_epilogue} instruction pattern -@item @samp{sibcall_epilogue} -This pattern, if defined, emits RTL for exit from a function without the final -branch back to the calling function. This pattern will be emitted before any -sibling call (aka tail call) sites. - -The @code{sibcall_epilogue} pattern must not clobber any arguments used for -parameter passing or any stack slots for arguments passed to the current -function. - -@cindex @code{trap} instruction pattern -@item @samp{trap} -This pattern, if defined, signals an error, typically by causing some -kind of signal to be raised. Among other places, it is used by the Java -front end to signal `invalid array index' exceptions. - -@cindex @code{ctrap@var{MM}4} instruction pattern -@item @samp{ctrap@var{MM}4} -Conditional trap instruction. Operand 0 is a piece of RTL which -performs a comparison, and operands 1 and 2 are the arms of the -comparison. Operand 3 is the trap code, an integer. - -A typical @code{ctrap} pattern looks like - -@smallexample -(define_insn "ctrapsi4" - [(trap_if (match_operator 0 "trap_operator" - [(match_operand 1 "register_operand") - (match_operand 2 "immediate_operand")]) - (match_operand 3 "const_int_operand" "i"))] - "" - "@dots{}") -@end smallexample - -@cindex @code{prefetch} instruction pattern -@item @samp{prefetch} -This pattern, if defined, emits code for a non-faulting data prefetch -instruction. Operand 0 is the address of the memory to prefetch. Operand 1 -is a constant 1 if the prefetch is preparing for a write to the memory -address, or a constant 0 otherwise. Operand 2 is the expected degree of -temporal locality of the data and is a value between 0 and 3, inclusive; 0 -means that the data has no temporal locality, so it need not be left in the -cache after the access; 3 means that the data has a high degree of temporal -locality and should be left in all levels of cache possible; 1 and 2 mean, -respectively, a low or moderate degree of temporal locality. - -Targets that do not support write prefetches or locality hints can ignore -the values of operands 1 and 2. - -@cindex @code{blockage} instruction pattern -@item @samp{blockage} -This pattern defines a pseudo insn that prevents the instruction -scheduler and other passes from moving instructions and using register -equivalences across the boundary defined by the blockage insn. -This needs to be an UNSPEC_VOLATILE pattern or a volatile ASM. - -@cindex @code{memory_barrier} instruction pattern -@item @samp{memory_barrier} -If the target memory model is not fully synchronous, then this pattern -should be defined to an instruction that orders both loads and stores -before the instruction with respect to loads and stores after the instruction. -This pattern has no operands. - -@cindex @code{sync_compare_and_swap@var{mode}} instruction pattern -@item @samp{sync_compare_and_swap@var{mode}} -This pattern, if defined, emits code for an atomic compare-and-swap -operation. Operand 1 is the memory on which the atomic operation is -performed. Operand 2 is the ``old'' value to be compared against the -current contents of the memory location. Operand 3 is the ``new'' value -to store in the memory if the compare succeeds. Operand 0 is the result -of the operation; it should contain the contents of the memory -before the operation. If the compare succeeds, this should obviously be -a copy of operand 2. - -This pattern must show that both operand 0 and operand 1 are modified. - -This pattern must issue any memory barrier instructions such that all -memory operations before the atomic operation occur before the atomic -operation and all memory operations after the atomic operation occur -after the atomic operation. - -For targets where the success or failure of the compare-and-swap -operation is available via the status flags, it is possible to -avoid a separate compare operation and issue the subsequent -branch or store-flag operation immediately after the compare-and-swap. -To this end, GCC will look for a @code{MODE_CC} set in the -output of @code{sync_compare_and_swap@var{mode}}; if the machine -description includes such a set, the target should also define special -@code{cbranchcc4} and/or @code{cstorecc4} instructions. GCC will then -be able to take the destination of the @code{MODE_CC} set and pass it -to the @code{cbranchcc4} or @code{cstorecc4} pattern as the first -operand of the comparison (the second will be @code{(const_int 0)}). - -For targets where the operating system may provide support for this -operation via library calls, the @code{sync_compare_and_swap_optab} -may be initialized to a function with the same interface as the -@code{__sync_val_compare_and_swap_@var{n}} built-in. If the entire -set of @var{__sync} builtins are supported via library calls, the -target can initialize all of the optabs at once with -@code{init_sync_libfuncs}. -For the purposes of C++11 @code{std::atomic::is_lock_free}, it is -assumed that these library calls do @emph{not} use any kind of -interruptable locking. - -@cindex @code{sync_add@var{mode}} instruction pattern -@cindex @code{sync_sub@var{mode}} instruction pattern -@cindex @code{sync_ior@var{mode}} instruction pattern -@cindex @code{sync_and@var{mode}} instruction pattern -@cindex @code{sync_xor@var{mode}} instruction pattern -@cindex @code{sync_nand@var{mode}} instruction pattern -@item @samp{sync_add@var{mode}}, @samp{sync_sub@var{mode}} -@itemx @samp{sync_ior@var{mode}}, @samp{sync_and@var{mode}} -@itemx @samp{sync_xor@var{mode}}, @samp{sync_nand@var{mode}} -These patterns emit code for an atomic operation on memory. -Operand 0 is the memory on which the atomic operation is performed. -Operand 1 is the second operand to the binary operator. - -This pattern must issue any memory barrier instructions such that all -memory operations before the atomic operation occur before the atomic -operation and all memory operations after the atomic operation occur -after the atomic operation. - -If these patterns are not defined, the operation will be constructed -from a compare-and-swap operation, if defined. - -@cindex @code{sync_old_add@var{mode}} instruction pattern -@cindex @code{sync_old_sub@var{mode}} instruction pattern -@cindex @code{sync_old_ior@var{mode}} instruction pattern -@cindex @code{sync_old_and@var{mode}} instruction pattern -@cindex @code{sync_old_xor@var{mode}} instruction pattern -@cindex @code{sync_old_nand@var{mode}} instruction pattern -@item @samp{sync_old_add@var{mode}}, @samp{sync_old_sub@var{mode}} -@itemx @samp{sync_old_ior@var{mode}}, @samp{sync_old_and@var{mode}} -@itemx @samp{sync_old_xor@var{mode}}, @samp{sync_old_nand@var{mode}} -These patterns emit code for an atomic operation on memory, -and return the value that the memory contained before the operation. -Operand 0 is the result value, operand 1 is the memory on which the -atomic operation is performed, and operand 2 is the second operand -to the binary operator. - -This pattern must issue any memory barrier instructions such that all -memory operations before the atomic operation occur before the atomic -operation and all memory operations after the atomic operation occur -after the atomic operation. - -If these patterns are not defined, the operation will be constructed -from a compare-and-swap operation, if defined. - -@cindex @code{sync_new_add@var{mode}} instruction pattern -@cindex @code{sync_new_sub@var{mode}} instruction pattern -@cindex @code{sync_new_ior@var{mode}} instruction pattern -@cindex @code{sync_new_and@var{mode}} instruction pattern -@cindex @code{sync_new_xor@var{mode}} instruction pattern -@cindex @code{sync_new_nand@var{mode}} instruction pattern -@item @samp{sync_new_add@var{mode}}, @samp{sync_new_sub@var{mode}} -@itemx @samp{sync_new_ior@var{mode}}, @samp{sync_new_and@var{mode}} -@itemx @samp{sync_new_xor@var{mode}}, @samp{sync_new_nand@var{mode}} -These patterns are like their @code{sync_old_@var{op}} counterparts, -except that they return the value that exists in the memory location -after the operation, rather than before the operation. - -@cindex @code{sync_lock_test_and_set@var{mode}} instruction pattern -@item @samp{sync_lock_test_and_set@var{mode}} -This pattern takes two forms, based on the capabilities of the target. -In either case, operand 0 is the result of the operand, operand 1 is -the memory on which the atomic operation is performed, and operand 2 -is the value to set in the lock. - -In the ideal case, this operation is an atomic exchange operation, in -which the previous value in memory operand is copied into the result -operand, and the value operand is stored in the memory operand. - -For less capable targets, any value operand that is not the constant 1 -should be rejected with @code{FAIL}. In this case the target may use -an atomic test-and-set bit operation. The result operand should contain -1 if the bit was previously set and 0 if the bit was previously clear. -The true contents of the memory operand are implementation defined. - -This pattern must issue any memory barrier instructions such that the -pattern as a whole acts as an acquire barrier, that is all memory -operations after the pattern do not occur until the lock is acquired. - -If this pattern is not defined, the operation will be constructed from -a compare-and-swap operation, if defined. - -@cindex @code{sync_lock_release@var{mode}} instruction pattern -@item @samp{sync_lock_release@var{mode}} -This pattern, if defined, releases a lock set by -@code{sync_lock_test_and_set@var{mode}}. Operand 0 is the memory -that contains the lock; operand 1 is the value to store in the lock. - -If the target doesn't implement full semantics for -@code{sync_lock_test_and_set@var{mode}}, any value operand which is not -the constant 0 should be rejected with @code{FAIL}, and the true contents -of the memory operand are implementation defined. - -This pattern must issue any memory barrier instructions such that the -pattern as a whole acts as a release barrier, that is the lock is -released only after all previous memory operations have completed. - -If this pattern is not defined, then a @code{memory_barrier} pattern -will be emitted, followed by a store of the value to the memory operand. - -@cindex @code{atomic_compare_and_swap@var{mode}} instruction pattern -@item @samp{atomic_compare_and_swap@var{mode}} -This pattern, if defined, emits code for an atomic compare-and-swap -operation with memory model semantics. Operand 2 is the memory on which -the atomic operation is performed. Operand 0 is an output operand which -is set to true or false based on whether the operation succeeded. Operand -1 is an output operand which is set to the contents of the memory before -the operation was attempted. Operand 3 is the value that is expected to -be in memory. Operand 4 is the value to put in memory if the expected -value is found there. Operand 5 is set to 1 if this compare and swap is to -be treated as a weak operation. Operand 6 is the memory model to be used -if the operation is a success. Operand 7 is the memory model to be used -if the operation fails. - -If memory referred to in operand 2 contains the value in operand 3, then -operand 4 is stored in memory pointed to by operand 2 and fencing based on -the memory model in operand 6 is issued. - -If memory referred to in operand 2 does not contain the value in operand 3, -then fencing based on the memory model in operand 7 is issued. - -If a target does not support weak compare-and-swap operations, or the port -elects not to implement weak operations, the argument in operand 5 can be -ignored. Note a strong implementation must be provided. - -If this pattern is not provided, the @code{__atomic_compare_exchange} -built-in functions will utilize the legacy @code{sync_compare_and_swap} -pattern with an @code{__ATOMIC_SEQ_CST} memory model. - -@cindex @code{atomic_load@var{mode}} instruction pattern -@item @samp{atomic_load@var{mode}} -This pattern implements an atomic load operation with memory model -semantics. Operand 1 is the memory address being loaded from. Operand 0 -is the result of the load. Operand 2 is the memory model to be used for -the load operation. - -If not present, the @code{__atomic_load} built-in function will either -resort to a normal load with memory barriers, or a compare-and-swap -operation if a normal load would not be atomic. - -@cindex @code{atomic_store@var{mode}} instruction pattern -@item @samp{atomic_store@var{mode}} -This pattern implements an atomic store operation with memory model -semantics. Operand 0 is the memory address being stored to. Operand 1 -is the value to be written. Operand 2 is the memory model to be used for -the operation. - -If not present, the @code{__atomic_store} built-in function will attempt to -perform a normal store and surround it with any required memory fences. If -the store would not be atomic, then an @code{__atomic_exchange} is -attempted with the result being ignored. - -@cindex @code{atomic_exchange@var{mode}} instruction pattern -@item @samp{atomic_exchange@var{mode}} -This pattern implements an atomic exchange operation with memory model -semantics. Operand 1 is the memory location the operation is performed on. -Operand 0 is an output operand which is set to the original value contained -in the memory pointed to by operand 1. Operand 2 is the value to be -stored. Operand 3 is the memory model to be used. - -If this pattern is not present, the built-in function -@code{__atomic_exchange} will attempt to preform the operation with a -compare and swap loop. - -@cindex @code{atomic_add@var{mode}} instruction pattern -@cindex @code{atomic_sub@var{mode}} instruction pattern -@cindex @code{atomic_or@var{mode}} instruction pattern -@cindex @code{atomic_and@var{mode}} instruction pattern -@cindex @code{atomic_xor@var{mode}} instruction pattern -@cindex @code{atomic_nand@var{mode}} instruction pattern -@item @samp{atomic_add@var{mode}}, @samp{atomic_sub@var{mode}} -@itemx @samp{atomic_or@var{mode}}, @samp{atomic_and@var{mode}} -@itemx @samp{atomic_xor@var{mode}}, @samp{atomic_nand@var{mode}} -These patterns emit code for an atomic operation on memory with memory -model semantics. Operand 0 is the memory on which the atomic operation is -performed. Operand 1 is the second operand to the binary operator. -Operand 2 is the memory model to be used by the operation. - -If these patterns are not defined, attempts will be made to use legacy -@code{sync} patterns, or equivalent patterns which return a result. If -none of these are available a compare-and-swap loop will be used. - -@cindex @code{atomic_fetch_add@var{mode}} instruction pattern -@cindex @code{atomic_fetch_sub@var{mode}} instruction pattern -@cindex @code{atomic_fetch_or@var{mode}} instruction pattern -@cindex @code{atomic_fetch_and@var{mode}} instruction pattern -@cindex @code{atomic_fetch_xor@var{mode}} instruction pattern -@cindex @code{atomic_fetch_nand@var{mode}} instruction pattern -@item @samp{atomic_fetch_add@var{mode}}, @samp{atomic_fetch_sub@var{mode}} -@itemx @samp{atomic_fetch_or@var{mode}}, @samp{atomic_fetch_and@var{mode}} -@itemx @samp{atomic_fetch_xor@var{mode}}, @samp{atomic_fetch_nand@var{mode}} -These patterns emit code for an atomic operation on memory with memory -model semantics, and return the original value. Operand 0 is an output -operand which contains the value of the memory location before the -operation was performed. Operand 1 is the memory on which the atomic -operation is performed. Operand 2 is the second operand to the binary -operator. Operand 3 is the memory model to be used by the operation. - -If these patterns are not defined, attempts will be made to use legacy -@code{sync} patterns. If none of these are available a compare-and-swap -loop will be used. - -@cindex @code{atomic_add_fetch@var{mode}} instruction pattern -@cindex @code{atomic_sub_fetch@var{mode}} instruction pattern -@cindex @code{atomic_or_fetch@var{mode}} instruction pattern -@cindex @code{atomic_and_fetch@var{mode}} instruction pattern -@cindex @code{atomic_xor_fetch@var{mode}} instruction pattern -@cindex @code{atomic_nand_fetch@var{mode}} instruction pattern -@item @samp{atomic_add_fetch@var{mode}}, @samp{atomic_sub_fetch@var{mode}} -@itemx @samp{atomic_or_fetch@var{mode}}, @samp{atomic_and_fetch@var{mode}} -@itemx @samp{atomic_xor_fetch@var{mode}}, @samp{atomic_nand_fetch@var{mode}} -These patterns emit code for an atomic operation on memory with memory -model semantics and return the result after the operation is performed. -Operand 0 is an output operand which contains the value after the -operation. Operand 1 is the memory on which the atomic operation is -performed. Operand 2 is the second operand to the binary operator. -Operand 3 is the memory model to be used by the operation. - -If these patterns are not defined, attempts will be made to use legacy -@code{sync} patterns, or equivalent patterns which return the result before -the operation followed by the arithmetic operation required to produce the -result. If none of these are available a compare-and-swap loop will be -used. - -@cindex @code{atomic_test_and_set} instruction pattern -@item @samp{atomic_test_and_set} -This pattern emits code for @code{__builtin_atomic_test_and_set}. -Operand 0 is an output operand which is set to true if the previous -previous contents of the byte was "set", and false otherwise. Operand 1 -is the @code{QImode} memory to be modified. Operand 2 is the memory -model to be used. - -The specific value that defines "set" is implementation defined, and -is normally based on what is performed by the native atomic test and set -instruction. - -@cindex @code{mem_thread_fence@var{mode}} instruction pattern -@item @samp{mem_thread_fence@var{mode}} -This pattern emits code required to implement a thread fence with -memory model semantics. Operand 0 is the memory model to be used. - -If this pattern is not specified, all memory models except -@code{__ATOMIC_RELAXED} will result in issuing a @code{sync_synchronize} -barrier pattern. - -@cindex @code{mem_signal_fence@var{mode}} instruction pattern -@item @samp{mem_signal_fence@var{mode}} -This pattern emits code required to implement a signal fence with -memory model semantics. Operand 0 is the memory model to be used. - -This pattern should impact the compiler optimizers the same way that -mem_signal_fence does, but it does not need to issue any barrier -instructions. - -If this pattern is not specified, all memory models except -@code{__ATOMIC_RELAXED} will result in issuing a @code{sync_synchronize} -barrier pattern. - -@cindex @code{get_thread_pointer@var{mode}} instruction pattern -@cindex @code{set_thread_pointer@var{mode}} instruction pattern -@item @samp{get_thread_pointer@var{mode}} -@itemx @samp{set_thread_pointer@var{mode}} -These patterns emit code that reads/sets the TLS thread pointer. Currently, -these are only needed if the target needs to support the -@code{__builtin_thread_pointer} and @code{__builtin_set_thread_pointer} -builtins. - -The get/set patterns have a single output/input operand respectively, -with @var{mode} intended to be @code{Pmode}. - -@cindex @code{stack_protect_set} instruction pattern -@item @samp{stack_protect_set} -This pattern, if defined, moves a @code{ptr_mode} value from the memory -in operand 1 to the memory in operand 0 without leaving the value in -a register afterward. This is to avoid leaking the value some place -that an attacker might use to rewrite the stack guard slot after -having clobbered it. - -If this pattern is not defined, then a plain move pattern is generated. - -@cindex @code{stack_protect_test} instruction pattern -@item @samp{stack_protect_test} -This pattern, if defined, compares a @code{ptr_mode} value from the -memory in operand 1 with the memory in operand 0 without leaving the -value in a register afterward and branches to operand 2 if the values -were equal. - -If this pattern is not defined, then a plain compare pattern and -conditional branch pattern is used. - -@cindex @code{clear_cache} instruction pattern -@item @samp{clear_cache} -This pattern, if defined, flushes the instruction cache for a region of -memory. The region is bounded to by the Pmode pointers in operand 0 -inclusive and operand 1 exclusive. - -If this pattern is not defined, a call to the library function -@code{__clear_cache} is used. - -@end table - -@end ifset -@c Each of the following nodes are wrapped in separate -@c "@ifset INTERNALS" to work around memory limits for the default -@c configuration in older tetex distributions. Known to not work: -@c tetex-1.0.7, known to work: tetex-2.0.2. -@ifset INTERNALS -@node Pattern Ordering -@section When the Order of Patterns Matters -@cindex Pattern Ordering -@cindex Ordering of Patterns - -Sometimes an insn can match more than one instruction pattern. Then the -pattern that appears first in the machine description is the one used. -Therefore, more specific patterns (patterns that will match fewer things) -and faster instructions (those that will produce better code when they -do match) should usually go first in the description. - -In some cases the effect of ordering the patterns can be used to hide -a pattern when it is not valid. For example, the 68000 has an -instruction for converting a fullword to floating point and another -for converting a byte to floating point. An instruction converting -an integer to floating point could match either one. We put the -pattern to convert the fullword first to make sure that one will -be used rather than the other. (Otherwise a large integer might -be generated as a single-byte immediate quantity, which would not work.) -Instead of using this pattern ordering it would be possible to make the -pattern for convert-a-byte smart enough to deal properly with any -constant value. - -@end ifset -@ifset INTERNALS -@node Dependent Patterns -@section Interdependence of Patterns -@cindex Dependent Patterns -@cindex Interdependence of Patterns - -In some cases machines support instructions identical except for the -machine mode of one or more operands. For example, there may be -``sign-extend halfword'' and ``sign-extend byte'' instructions whose -patterns are - -@smallexample -(set (match_operand:SI 0 @dots{}) - (extend:SI (match_operand:HI 1 @dots{}))) - -(set (match_operand:SI 0 @dots{}) - (extend:SI (match_operand:QI 1 @dots{}))) -@end smallexample - -@noindent -Constant integers do not specify a machine mode, so an instruction to -extend a constant value could match either pattern. The pattern it -actually will match is the one that appears first in the file. For correct -results, this must be the one for the widest possible mode (@code{HImode}, -here). If the pattern matches the @code{QImode} instruction, the results -will be incorrect if the constant value does not actually fit that mode. - -Such instructions to extend constants are rarely generated because they are -optimized away, but they do occasionally happen in nonoptimized -compilations. - -If a constraint in a pattern allows a constant, the reload pass may -replace a register with a constant permitted by the constraint in some -cases. Similarly for memory references. Because of this substitution, -you should not provide separate patterns for increment and decrement -instructions. Instead, they should be generated from the same pattern -that supports register-register add insns by examining the operands and -generating the appropriate machine instruction. - -@end ifset -@ifset INTERNALS -@node Jump Patterns -@section Defining Jump Instruction Patterns -@cindex jump instruction patterns -@cindex defining jump instruction patterns - -GCC does not assume anything about how the machine realizes jumps. -The machine description should define a single pattern, usually -a @code{define_expand}, which expands to all the required insns. - -Usually, this would be a comparison insn to set the condition code -and a separate branch insn testing the condition code and branching -or not according to its value. For many machines, however, -separating compares and branches is limiting, which is why the -more flexible approach with one @code{define_expand} is used in GCC. -The machine description becomes clearer for architectures that -have compare-and-branch instructions but no condition code. It also -works better when different sets of comparison operators are supported -by different kinds of conditional branches (e.g. integer vs. floating-point), -or by conditional branches with respect to conditional stores. - -Two separate insns are always used if the machine description represents -a condition code register using the legacy RTL expression @code{(cc0)}, -and on most machines that use a separate condition code register -(@pxref{Condition Code}). For machines that use @code{(cc0)}, in -fact, the set and use of the condition code must be separate and -adjacent@footnote{@code{note} insns can separate them, though.}, thus -allowing flags in @code{cc_status} to be used (@pxref{Condition Code}) and -so that the comparison and branch insns could be located from each other -by using the functions @code{prev_cc0_setter} and @code{next_cc0_user}. - -Even in this case having a single entry point for conditional branches -is advantageous, because it handles equally well the case where a single -comparison instruction records the results of both signed and unsigned -comparison of the given operands (with the branch insns coming in distinct -signed and unsigned flavors) as in the x86 or SPARC, and the case where -there are distinct signed and unsigned compare instructions and only -one set of conditional branch instructions as in the PowerPC. - -@end ifset -@ifset INTERNALS -@node Looping Patterns -@section Defining Looping Instruction Patterns -@cindex looping instruction patterns -@cindex defining looping instruction patterns - -Some machines have special jump instructions that can be utilized to -make loops more efficient. A common example is the 68000 @samp{dbra} -instruction which performs a decrement of a register and a branch if the -result was greater than zero. Other machines, in particular digital -signal processors (DSPs), have special block repeat instructions to -provide low-overhead loop support. For example, the TI TMS320C3x/C4x -DSPs have a block repeat instruction that loads special registers to -mark the top and end of a loop and to count the number of loop -iterations. This avoids the need for fetching and executing a -@samp{dbra}-like instruction and avoids pipeline stalls associated with -the jump. - -GCC has three special named patterns to support low overhead looping. -They are @samp{decrement_and_branch_until_zero}, @samp{doloop_begin}, -and @samp{doloop_end}. The first pattern, -@samp{decrement_and_branch_until_zero}, is not emitted during RTL -generation but may be emitted during the instruction combination phase. -This requires the assistance of the loop optimizer, using information -collected during strength reduction, to reverse a loop to count down to -zero. Some targets also require the loop optimizer to add a -@code{REG_NONNEG} note to indicate that the iteration count is always -positive. This is needed if the target performs a signed loop -termination test. For example, the 68000 uses a pattern similar to the -following for its @code{dbra} instruction: - -@smallexample -@group -(define_insn "decrement_and_branch_until_zero" - [(set (pc) - (if_then_else - (ge (plus:SI (match_operand:SI 0 "general_operand" "+d*am") - (const_int -1)) - (const_int 0)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "find_reg_note (insn, REG_NONNEG, 0)" - "@dots{}") -@end group -@end smallexample - -Note that since the insn is both a jump insn and has an output, it must -deal with its own reloads, hence the `m' constraints. Also note that -since this insn is generated by the instruction combination phase -combining two sequential insns together into an implicit parallel insn, -the iteration counter needs to be biased by the same amount as the -decrement operation, in this case @minus{}1. Note that the following similar -pattern will not be matched by the combiner. - -@smallexample -@group -(define_insn "decrement_and_branch_until_zero" - [(set (pc) - (if_then_else - (ge (match_operand:SI 0 "general_operand" "+d*am") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "find_reg_note (insn, REG_NONNEG, 0)" - "@dots{}") -@end group -@end smallexample - -The other two special looping patterns, @samp{doloop_begin} and -@samp{doloop_end}, are emitted by the loop optimizer for certain -well-behaved loops with a finite number of loop iterations using -information collected during strength reduction. - -The @samp{doloop_end} pattern describes the actual looping instruction -(or the implicit looping operation) and the @samp{doloop_begin} pattern -is an optional companion pattern that can be used for initialization -needed for some low-overhead looping instructions. - -Note that some machines require the actual looping instruction to be -emitted at the top of the loop (e.g., the TMS320C3x/C4x DSPs). Emitting -the true RTL for a looping instruction at the top of the loop can cause -problems with flow analysis. So instead, a dummy @code{doloop} insn is -emitted at the end of the loop. The machine dependent reorg pass checks -for the presence of this @code{doloop} insn and then searches back to -the top of the loop, where it inserts the true looping insn (provided -there are no instructions in the loop which would cause problems). Any -additional labels can be emitted at this point. In addition, if the -desired special iteration counter register was not allocated, this -machine dependent reorg pass could emit a traditional compare and jump -instruction pair. - -The essential difference between the -@samp{decrement_and_branch_until_zero} and the @samp{doloop_end} -patterns is that the loop optimizer allocates an additional pseudo -register for the latter as an iteration counter. This pseudo register -cannot be used within the loop (i.e., general induction variables cannot -be derived from it), however, in many cases the loop induction variable -may become redundant and removed by the flow pass. - - -@end ifset -@ifset INTERNALS -@node Insn Canonicalizations -@section Canonicalization of Instructions -@cindex canonicalization of instructions -@cindex insn canonicalization - -There are often cases where multiple RTL expressions could represent an -operation performed by a single machine instruction. This situation is -most commonly encountered with logical, branch, and multiply-accumulate -instructions. In such cases, the compiler attempts to convert these -multiple RTL expressions into a single canonical form to reduce the -number of insn patterns required. - -In addition to algebraic simplifications, following canonicalizations -are performed: - -@itemize @bullet -@item -For commutative and comparison operators, a constant is always made the -second operand. If a machine only supports a constant as the second -operand, only patterns that match a constant in the second operand need -be supplied. - -@item -For associative operators, a sequence of operators will always chain -to the left; for instance, only the left operand of an integer @code{plus} -can itself be a @code{plus}. @code{and}, @code{ior}, @code{xor}, -@code{plus}, @code{mult}, @code{smin}, @code{smax}, @code{umin}, and -@code{umax} are associative when applied to integers, and sometimes to -floating-point. - -@item -@cindex @code{neg}, canonicalization of -@cindex @code{not}, canonicalization of -@cindex @code{mult}, canonicalization of -@cindex @code{plus}, canonicalization of -@cindex @code{minus}, canonicalization of -For these operators, if only one operand is a @code{neg}, @code{not}, -@code{mult}, @code{plus}, or @code{minus} expression, it will be the -first operand. - -@item -In combinations of @code{neg}, @code{mult}, @code{plus}, and -@code{minus}, the @code{neg} operations (if any) will be moved inside -the operations as far as possible. For instance, -@code{(neg (mult A B))} is canonicalized as @code{(mult (neg A) B)}, but -@code{(plus (mult (neg B) C) A)} is canonicalized as -@code{(minus A (mult B C))}. - -@cindex @code{compare}, canonicalization of -@item -For the @code{compare} operator, a constant is always the second operand -if the first argument is a condition code register or @code{(cc0)}. - -@item -An operand of @code{neg}, @code{not}, @code{mult}, @code{plus}, or -@code{minus} is made the first operand under the same conditions as -above. - -@item -@code{(ltu (plus @var{a} @var{b}) @var{b})} is converted to -@code{(ltu (plus @var{a} @var{b}) @var{a})}. Likewise with @code{geu} instead -of @code{ltu}. - -@item -@code{(minus @var{x} (const_int @var{n}))} is converted to -@code{(plus @var{x} (const_int @var{-n}))}. - -@item -Within address computations (i.e., inside @code{mem}), a left shift is -converted into the appropriate multiplication by a power of two. - -@cindex @code{ior}, canonicalization of -@cindex @code{and}, canonicalization of -@cindex De Morgan's law -@item -De Morgan's Law is used to move bitwise negation inside a bitwise -logical-and or logical-or operation. If this results in only one -operand being a @code{not} expression, it will be the first one. - -A machine that has an instruction that performs a bitwise logical-and of one -operand with the bitwise negation of the other should specify the pattern -for that instruction as - -@smallexample -(define_insn "" - [(set (match_operand:@var{m} 0 @dots{}) - (and:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{})) - (match_operand:@var{m} 2 @dots{})))] - "@dots{}" - "@dots{}") -@end smallexample - -@noindent -Similarly, a pattern for a ``NAND'' instruction should be written - -@smallexample -(define_insn "" - [(set (match_operand:@var{m} 0 @dots{}) - (ior:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{})) - (not:@var{m} (match_operand:@var{m} 2 @dots{}))))] - "@dots{}" - "@dots{}") -@end smallexample - -In both cases, it is not necessary to include patterns for the many -logically equivalent RTL expressions. - -@cindex @code{xor}, canonicalization of -@item -The only possible RTL expressions involving both bitwise exclusive-or -and bitwise negation are @code{(xor:@var{m} @var{x} @var{y})} -and @code{(not:@var{m} (xor:@var{m} @var{x} @var{y}))}. - -@item -The sum of three items, one of which is a constant, will only appear in -the form - -@smallexample -(plus:@var{m} (plus:@var{m} @var{x} @var{y}) @var{constant}) -@end smallexample - -@cindex @code{zero_extract}, canonicalization of -@cindex @code{sign_extract}, canonicalization of -@item -Equality comparisons of a group of bits (usually a single bit) with zero -will be written using @code{zero_extract} rather than the equivalent -@code{and} or @code{sign_extract} operations. - -@cindex @code{mult}, canonicalization of -@item -@code{(sign_extend:@var{m1} (mult:@var{m2} (sign_extend:@var{m2} @var{x}) -(sign_extend:@var{m2} @var{y})))} is converted to @code{(mult:@var{m1} -(sign_extend:@var{m1} @var{x}) (sign_extend:@var{m1} @var{y}))}, and likewise -for @code{zero_extend}. - -@item -@code{(sign_extend:@var{m1} (mult:@var{m2} (ashiftrt:@var{m2} -@var{x} @var{s}) (sign_extend:@var{m2} @var{y})))} is converted -to @code{(mult:@var{m1} (sign_extend:@var{m1} (ashiftrt:@var{m2} -@var{x} @var{s})) (sign_extend:@var{m1} @var{y}))}, and likewise for -patterns using @code{zero_extend} and @code{lshiftrt}. If the second -operand of @code{mult} is also a shift, then that is extended also. -This transformation is only applied when it can be proven that the -original operation had sufficient precision to prevent overflow. - -@end itemize - -Further canonicalization rules are defined in the function -@code{commutative_operand_precedence} in @file{gcc/rtlanal.c}. - -@end ifset -@ifset INTERNALS -@node Expander Definitions -@section Defining RTL Sequences for Code Generation -@cindex expander definitions -@cindex code generation RTL sequences -@cindex defining RTL sequences for code generation - -On some target machines, some standard pattern names for RTL generation -cannot be handled with single insn, but a sequence of RTL insns can -represent them. For these target machines, you can write a -@code{define_expand} to specify how to generate the sequence of RTL@. - -@findex define_expand -A @code{define_expand} is an RTL expression that looks almost like a -@code{define_insn}; but, unlike the latter, a @code{define_expand} is used -only for RTL generation and it can produce more than one RTL insn. - -A @code{define_expand} RTX has four operands: - -@itemize @bullet -@item -The name. Each @code{define_expand} must have a name, since the only -use for it is to refer to it by name. - -@item -The RTL template. This is a vector of RTL expressions representing -a sequence of separate instructions. Unlike @code{define_insn}, there -is no implicit surrounding @code{PARALLEL}. - -@item -The condition, a string containing a C expression. This expression is -used to express how the availability of this pattern depends on -subclasses of target machine, selected by command-line options when GCC -is run. This is just like the condition of a @code{define_insn} that -has a standard name. Therefore, the condition (if present) may not -depend on the data in the insn being matched, but only the -target-machine-type flags. The compiler needs to test these conditions -during initialization in order to learn exactly which named instructions -are available in a particular run. - -@item -The preparation statements, a string containing zero or more C -statements which are to be executed before RTL code is generated from -the RTL template. - -Usually these statements prepare temporary registers for use as -internal operands in the RTL template, but they can also generate RTL -insns directly by calling routines such as @code{emit_insn}, etc. -Any such insns precede the ones that come from the RTL template. - -@item -Optionally, a vector containing the values of attributes. @xref{Insn -Attributes}. -@end itemize - -Every RTL insn emitted by a @code{define_expand} must match some -@code{define_insn} in the machine description. Otherwise, the compiler -will crash when trying to generate code for the insn or trying to optimize -it. - -The RTL template, in addition to controlling generation of RTL insns, -also describes the operands that need to be specified when this pattern -is used. In particular, it gives a predicate for each operand. - -A true operand, which needs to be specified in order to generate RTL from -the pattern, should be described with a @code{match_operand} in its first -occurrence in the RTL template. This enters information on the operand's -predicate into the tables that record such things. GCC uses the -information to preload the operand into a register if that is required for -valid RTL code. If the operand is referred to more than once, subsequent -references should use @code{match_dup}. - -The RTL template may also refer to internal ``operands'' which are -temporary registers or labels used only within the sequence made by the -@code{define_expand}. Internal operands are substituted into the RTL -template with @code{match_dup}, never with @code{match_operand}. The -values of the internal operands are not passed in as arguments by the -compiler when it requests use of this pattern. Instead, they are computed -within the pattern, in the preparation statements. These statements -compute the values and store them into the appropriate elements of -@code{operands} so that @code{match_dup} can find them. - -There are two special macros defined for use in the preparation statements: -@code{DONE} and @code{FAIL}. Use them with a following semicolon, -as a statement. - -@table @code - -@findex DONE -@item DONE -Use the @code{DONE} macro to end RTL generation for the pattern. The -only RTL insns resulting from the pattern on this occasion will be -those already emitted by explicit calls to @code{emit_insn} within the -preparation statements; the RTL template will not be generated. - -@findex FAIL -@item FAIL -Make the pattern fail on this occasion. When a pattern fails, it means -that the pattern was not truly available. The calling routines in the -compiler will try other strategies for code generation using other patterns. - -Failure is currently supported only for binary (addition, multiplication, -shifting, etc.) and bit-field (@code{extv}, @code{extzv}, and @code{insv}) -operations. -@end table - -If the preparation falls through (invokes neither @code{DONE} nor -@code{FAIL}), then the @code{define_expand} acts like a -@code{define_insn} in that the RTL template is used to generate the -insn. - -The RTL template is not used for matching, only for generating the -initial insn list. If the preparation statement always invokes -@code{DONE} or @code{FAIL}, the RTL template may be reduced to a simple -list of operands, such as this example: - -@smallexample -@group -(define_expand "addsi3" - [(match_operand:SI 0 "register_operand" "") - (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "register_operand" "")] -@end group -@group - "" - " -@{ - handle_add (operands[0], operands[1], operands[2]); - DONE; -@}") -@end group -@end smallexample - -Here is an example, the definition of left-shift for the SPUR chip: - -@smallexample -@group -(define_expand "ashlsi3" - [(set (match_operand:SI 0 "register_operand" "") - (ashift:SI -@end group -@group - (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "nonmemory_operand" "")))] - "" - " -@end group -@end smallexample - -@smallexample -@group -@{ - if (GET_CODE (operands[2]) != CONST_INT - || (unsigned) INTVAL (operands[2]) > 3) - FAIL; -@}") -@end group -@end smallexample - -@noindent -This example uses @code{define_expand} so that it can generate an RTL insn -for shifting when the shift-count is in the supported range of 0 to 3 but -fail in other cases where machine insns aren't available. When it fails, -the compiler tries another strategy using different patterns (such as, a -library call). - -If the compiler were able to handle nontrivial condition-strings in -patterns with names, then it would be possible to use a -@code{define_insn} in that case. Here is another case (zero-extension -on the 68000) which makes more use of the power of @code{define_expand}: - -@smallexample -(define_expand "zero_extendhisi2" - [(set (match_operand:SI 0 "general_operand" "") - (const_int 0)) - (set (strict_low_part - (subreg:HI - (match_dup 0) - 0)) - (match_operand:HI 1 "general_operand" ""))] - "" - "operands[1] = make_safe_from (operands[1], operands[0]);") -@end smallexample - -@noindent -@findex make_safe_from -Here two RTL insns are generated, one to clear the entire output operand -and the other to copy the input operand into its low half. This sequence -is incorrect if the input operand refers to [the old value of] the output -operand, so the preparation statement makes sure this isn't so. The -function @code{make_safe_from} copies the @code{operands[1]} into a -temporary register if it refers to @code{operands[0]}. It does this -by emitting another RTL insn. - -Finally, a third example shows the use of an internal operand. -Zero-extension on the SPUR chip is done by @code{and}-ing the result -against a halfword mask. But this mask cannot be represented by a -@code{const_int} because the constant value is too large to be legitimate -on this machine. So it must be copied into a register with -@code{force_reg} and then the register used in the @code{and}. - -@smallexample -(define_expand "zero_extendhisi2" - [(set (match_operand:SI 0 "register_operand" "") - (and:SI (subreg:SI - (match_operand:HI 1 "register_operand" "") - 0) - (match_dup 2)))] - "" - "operands[2] - = force_reg (SImode, GEN_INT (65535)); ") -@end smallexample - -@emph{Note:} If the @code{define_expand} is used to serve a -standard binary or unary arithmetic operation or a bit-field operation, -then the last insn it generates must not be a @code{code_label}, -@code{barrier} or @code{note}. It must be an @code{insn}, -@code{jump_insn} or @code{call_insn}. If you don't need a real insn -at the end, emit an insn to copy the result of the operation into -itself. Such an insn will generate no code, but it can avoid problems -in the compiler. - -@end ifset -@ifset INTERNALS -@node Insn Splitting -@section Defining How to Split Instructions -@cindex insn splitting -@cindex instruction splitting -@cindex splitting instructions - -There are two cases where you should specify how to split a pattern -into multiple insns. On machines that have instructions requiring -delay slots (@pxref{Delay Slots}) or that have instructions whose -output is not available for multiple cycles (@pxref{Processor pipeline -description}), the compiler phases that optimize these cases need to -be able to move insns into one-instruction delay slots. However, some -insns may generate more than one machine instruction. These insns -cannot be placed into a delay slot. - -Often you can rewrite the single insn as a list of individual insns, -each corresponding to one machine instruction. The disadvantage of -doing so is that it will cause the compilation to be slower and require -more space. If the resulting insns are too complex, it may also -suppress some optimizations. The compiler splits the insn if there is a -reason to believe that it might improve instruction or delay slot -scheduling. - -The insn combiner phase also splits putative insns. If three insns are -merged into one insn with a complex expression that cannot be matched by -some @code{define_insn} pattern, the combiner phase attempts to split -the complex pattern into two insns that are recognized. Usually it can -break the complex pattern into two patterns by splitting out some -subexpression. However, in some other cases, such as performing an -addition of a large constant in two insns on a RISC machine, the way to -split the addition into two insns is machine-dependent. - -@findex define_split -The @code{define_split} definition tells the compiler how to split a -complex insn into several simpler insns. It looks like this: - -@smallexample -(define_split - [@var{insn-pattern}] - "@var{condition}" - [@var{new-insn-pattern-1} - @var{new-insn-pattern-2} - @dots{}] - "@var{preparation-statements}") -@end smallexample - -@var{insn-pattern} is a pattern that needs to be split and -@var{condition} is the final condition to be tested, as in a -@code{define_insn}. When an insn matching @var{insn-pattern} and -satisfying @var{condition} is found, it is replaced in the insn list -with the insns given by @var{new-insn-pattern-1}, -@var{new-insn-pattern-2}, etc. - -The @var{preparation-statements} are similar to those statements that -are specified for @code{define_expand} (@pxref{Expander Definitions}) -and are executed before the new RTL is generated to prepare for the -generated code or emit some insns whose pattern is not fixed. Unlike -those in @code{define_expand}, however, these statements must not -generate any new pseudo-registers. Once reload has completed, they also -must not allocate any space in the stack frame. - -Patterns are matched against @var{insn-pattern} in two different -circumstances. If an insn needs to be split for delay slot scheduling -or insn scheduling, the insn is already known to be valid, which means -that it must have been matched by some @code{define_insn} and, if -@code{reload_completed} is nonzero, is known to satisfy the constraints -of that @code{define_insn}. In that case, the new insn patterns must -also be insns that are matched by some @code{define_insn} and, if -@code{reload_completed} is nonzero, must also satisfy the constraints -of those definitions. - -As an example of this usage of @code{define_split}, consider the following -example from @file{a29k.md}, which splits a @code{sign_extend} from -@code{HImode} to @code{SImode} into a pair of shift insns: - -@smallexample -(define_split - [(set (match_operand:SI 0 "gen_reg_operand" "") - (sign_extend:SI (match_operand:HI 1 "gen_reg_operand" "")))] - "" - [(set (match_dup 0) - (ashift:SI (match_dup 1) - (const_int 16))) - (set (match_dup 0) - (ashiftrt:SI (match_dup 0) - (const_int 16)))] - " -@{ operands[1] = gen_lowpart (SImode, operands[1]); @}") -@end smallexample - -When the combiner phase tries to split an insn pattern, it is always the -case that the pattern is @emph{not} matched by any @code{define_insn}. -The combiner pass first tries to split a single @code{set} expression -and then the same @code{set} expression inside a @code{parallel}, but -followed by a @code{clobber} of a pseudo-reg to use as a scratch -register. In these cases, the combiner expects exactly two new insn -patterns to be generated. It will verify that these patterns match some -@code{define_insn} definitions, so you need not do this test in the -@code{define_split} (of course, there is no point in writing a -@code{define_split} that will never produce insns that match). - -Here is an example of this use of @code{define_split}, taken from -@file{rs6000.md}: - -@smallexample -(define_split - [(set (match_operand:SI 0 "gen_reg_operand" "") - (plus:SI (match_operand:SI 1 "gen_reg_operand" "") - (match_operand:SI 2 "non_add_cint_operand" "")))] - "" - [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3))) - (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))] -" -@{ - int low = INTVAL (operands[2]) & 0xffff; - int high = (unsigned) INTVAL (operands[2]) >> 16; - - if (low & 0x8000) - high++, low |= 0xffff0000; - - operands[3] = GEN_INT (high << 16); - operands[4] = GEN_INT (low); -@}") -@end smallexample - -Here the predicate @code{non_add_cint_operand} matches any -@code{const_int} that is @emph{not} a valid operand of a single add -insn. The add with the smaller displacement is written so that it -can be substituted into the address of a subsequent operation. - -An example that uses a scratch register, from the same file, generates -an equality comparison of a register and a large constant: - -@smallexample -(define_split - [(set (match_operand:CC 0 "cc_reg_operand" "") - (compare:CC (match_operand:SI 1 "gen_reg_operand" "") - (match_operand:SI 2 "non_short_cint_operand" ""))) - (clobber (match_operand:SI 3 "gen_reg_operand" ""))] - "find_single_use (operands[0], insn, 0) - && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ - || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)" - [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4))) - (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))] - " -@{ - /* @r{Get the constant we are comparing against, C, and see what it - looks like sign-extended to 16 bits. Then see what constant - could be XOR'ed with C to get the sign-extended value.} */ - - int c = INTVAL (operands[2]); - int sextc = (c << 16) >> 16; - int xorv = c ^ sextc; - - operands[4] = GEN_INT (xorv); - operands[5] = GEN_INT (sextc); -@}") -@end smallexample - -To avoid confusion, don't write a single @code{define_split} that -accepts some insns that match some @code{define_insn} as well as some -insns that don't. Instead, write two separate @code{define_split} -definitions, one for the insns that are valid and one for the insns that -are not valid. - -The splitter is allowed to split jump instructions into sequence of -jumps or create new jumps in while splitting non-jump instructions. As -the central flowgraph and branch prediction information needs to be updated, -several restriction apply. - -Splitting of jump instruction into sequence that over by another jump -instruction is always valid, as compiler expect identical behavior of new -jump. When new sequence contains multiple jump instructions or new labels, -more assistance is needed. Splitter is required to create only unconditional -jumps, or simple conditional jump instructions. Additionally it must attach a -@code{REG_BR_PROB} note to each conditional jump. A global variable -@code{split_branch_probability} holds the probability of the original branch in case -it was a simple conditional jump, @minus{}1 otherwise. To simplify -recomputing of edge frequencies, the new sequence is required to have only -forward jumps to the newly created labels. - -@findex define_insn_and_split -For the common case where the pattern of a define_split exactly matches the -pattern of a define_insn, use @code{define_insn_and_split}. It looks like -this: - -@smallexample -(define_insn_and_split - [@var{insn-pattern}] - "@var{condition}" - "@var{output-template}" - "@var{split-condition}" - [@var{new-insn-pattern-1} - @var{new-insn-pattern-2} - @dots{}] - "@var{preparation-statements}" - [@var{insn-attributes}]) - -@end smallexample - -@var{insn-pattern}, @var{condition}, @var{output-template}, and -@var{insn-attributes} are used as in @code{define_insn}. The -@var{new-insn-pattern} vector and the @var{preparation-statements} are used as -in a @code{define_split}. The @var{split-condition} is also used as in -@code{define_split}, with the additional behavior that if the condition starts -with @samp{&&}, the condition used for the split will be the constructed as a -logical ``and'' of the split condition with the insn condition. For example, -from i386.md: - -@smallexample -(define_insn_and_split "zero_extendhisi2_and" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:HI 1 "register_operand" "0"))) - (clobber (reg:CC 17))] - "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size" - "#" - "&& reload_completed" - [(parallel [(set (match_dup 0) - (and:SI (match_dup 0) (const_int 65535))) - (clobber (reg:CC 17))])] - "" - [(set_attr "type" "alu1")]) - -@end smallexample - -In this case, the actual split condition will be -@samp{TARGET_ZERO_EXTEND_WITH_AND && !optimize_size && reload_completed}. - -The @code{define_insn_and_split} construction provides exactly the same -functionality as two separate @code{define_insn} and @code{define_split} -patterns. It exists for compactness, and as a maintenance tool to prevent -having to ensure the two patterns' templates match. - -@end ifset -@ifset INTERNALS -@node Including Patterns -@section Including Patterns in Machine Descriptions. -@cindex insn includes - -@findex include -The @code{include} pattern tells the compiler tools where to -look for patterns that are in files other than in the file -@file{.md}. This is used only at build time and there is no preprocessing allowed. - -It looks like: - -@smallexample - -(include - @var{pathname}) -@end smallexample - -For example: - -@smallexample - -(include "filestuff") - -@end smallexample - -Where @var{pathname} is a string that specifies the location of the file, -specifies the include file to be in @file{gcc/config/target/filestuff}. The -directory @file{gcc/config/target} is regarded as the default directory. - - -Machine descriptions may be split up into smaller more manageable subsections -and placed into subdirectories. - -By specifying: - -@smallexample - -(include "BOGUS/filestuff") - -@end smallexample - -the include file is specified to be in @file{gcc/config/@var{target}/BOGUS/filestuff}. - -Specifying an absolute path for the include file such as; -@smallexample - -(include "/u2/BOGUS/filestuff") - -@end smallexample -is permitted but is not encouraged. - -@subsection RTL Generation Tool Options for Directory Search -@cindex directory options .md -@cindex options, directory search -@cindex search options - -The @option{-I@var{dir}} option specifies directories to search for machine descriptions. -For example: - -@smallexample - -genrecog -I/p1/abc/proc1 -I/p2/abcd/pro2 target.md - -@end smallexample - - -Add the directory @var{dir} to the head of the list of directories to be -searched for header files. This can be used to override a system machine definition -file, substituting your own version, since these directories are -searched before the default machine description file directories. If you use more than -one @option{-I} option, the directories are scanned in left-to-right -order; the standard default directory come after. - - -@end ifset -@ifset INTERNALS -@node Peephole Definitions -@section Machine-Specific Peephole Optimizers -@cindex peephole optimizer definitions -@cindex defining peephole optimizers - -In addition to instruction patterns the @file{md} file may contain -definitions of machine-specific peephole optimizations. - -The combiner does not notice certain peephole optimizations when the data -flow in the program does not suggest that it should try them. For example, -sometimes two consecutive insns related in purpose can be combined even -though the second one does not appear to use a register computed in the -first one. A machine-specific peephole optimizer can detect such -opportunities. - -There are two forms of peephole definitions that may be used. The -original @code{define_peephole} is run at assembly output time to -match insns and substitute assembly text. Use of @code{define_peephole} -is deprecated. - -A newer @code{define_peephole2} matches insns and substitutes new -insns. The @code{peephole2} pass is run after register allocation -but before scheduling, which may result in much better code for -targets that do scheduling. - -@menu -* define_peephole:: RTL to Text Peephole Optimizers -* define_peephole2:: RTL to RTL Peephole Optimizers -@end menu - -@end ifset -@ifset INTERNALS -@node define_peephole -@subsection RTL to Text Peephole Optimizers -@findex define_peephole - -@need 1000 -A definition looks like this: - -@smallexample -(define_peephole - [@var{insn-pattern-1} - @var{insn-pattern-2} - @dots{}] - "@var{condition}" - "@var{template}" - "@var{optional-insn-attributes}") -@end smallexample - -@noindent -The last string operand may be omitted if you are not using any -machine-specific information in this machine description. If present, -it must obey the same rules as in a @code{define_insn}. - -In this skeleton, @var{insn-pattern-1} and so on are patterns to match -consecutive insns. The optimization applies to a sequence of insns when -@var{insn-pattern-1} matches the first one, @var{insn-pattern-2} matches -the next, and so on. - -Each of the insns matched by a peephole must also match a -@code{define_insn}. Peepholes are checked only at the last stage just -before code generation, and only optionally. Therefore, any insn which -would match a peephole but no @code{define_insn} will cause a crash in code -generation in an unoptimized compilation, or at various optimization -stages. - -The operands of the insns are matched with @code{match_operands}, -@code{match_operator}, and @code{match_dup}, as usual. What is not -usual is that the operand numbers apply to all the insn patterns in the -definition. So, you can check for identical operands in two insns by -using @code{match_operand} in one insn and @code{match_dup} in the -other. - -The operand constraints used in @code{match_operand} patterns do not have -any direct effect on the applicability of the peephole, but they will -be validated afterward, so make sure your constraints are general enough -to apply whenever the peephole matches. If the peephole matches -but the constraints are not satisfied, the compiler will crash. - -It is safe to omit constraints in all the operands of the peephole; or -you can write constraints which serve as a double-check on the criteria -previously tested. - -Once a sequence of insns matches the patterns, the @var{condition} is -checked. This is a C expression which makes the final decision whether to -perform the optimization (we do so if the expression is nonzero). If -@var{condition} is omitted (in other words, the string is empty) then the -optimization is applied to every sequence of insns that matches the -patterns. - -The defined peephole optimizations are applied after register allocation -is complete. Therefore, the peephole definition can check which -operands have ended up in which kinds of registers, just by looking at -the operands. - -@findex prev_active_insn -The way to refer to the operands in @var{condition} is to write -@code{operands[@var{i}]} for operand number @var{i} (as matched by -@code{(match_operand @var{i} @dots{})}). Use the variable @code{insn} -to refer to the last of the insns being matched; use -@code{prev_active_insn} to find the preceding insns. - -@findex dead_or_set_p -When optimizing computations with intermediate results, you can use -@var{condition} to match only when the intermediate results are not used -elsewhere. Use the C expression @code{dead_or_set_p (@var{insn}, -@var{op})}, where @var{insn} is the insn in which you expect the value -to be used for the last time (from the value of @code{insn}, together -with use of @code{prev_nonnote_insn}), and @var{op} is the intermediate -value (from @code{operands[@var{i}]}). - -Applying the optimization means replacing the sequence of insns with one -new insn. The @var{template} controls ultimate output of assembler code -for this combined insn. It works exactly like the template of a -@code{define_insn}. Operand numbers in this template are the same ones -used in matching the original sequence of insns. - -The result of a defined peephole optimizer does not need to match any of -the insn patterns in the machine description; it does not even have an -opportunity to match them. The peephole optimizer definition itself serves -as the insn pattern to control how the insn is output. - -Defined peephole optimizers are run as assembler code is being output, -so the insns they produce are never combined or rearranged in any way. - -Here is an example, taken from the 68000 machine description: - -@smallexample -(define_peephole - [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4))) - (set (match_operand:DF 0 "register_operand" "=f") - (match_operand:DF 1 "register_operand" "ad"))] - "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])" -@{ - rtx xoperands[2]; - xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); -#ifdef MOTOROLA - output_asm_insn ("move.l %1,(sp)", xoperands); - output_asm_insn ("move.l %1,-(sp)", operands); - return "fmove.d (sp)+,%0"; -#else - output_asm_insn ("movel %1,sp@@", xoperands); - output_asm_insn ("movel %1,sp@@-", operands); - return "fmoved sp@@+,%0"; -#endif -@}) -@end smallexample - -@need 1000 -The effect of this optimization is to change - -@smallexample -@group -jbsr _foobar -addql #4,sp -movel d1,sp@@- -movel d0,sp@@- -fmoved sp@@+,fp0 -@end group -@end smallexample - -@noindent -into - -@smallexample -@group -jbsr _foobar -movel d1,sp@@ -movel d0,sp@@- -fmoved sp@@+,fp0 -@end group -@end smallexample - -@ignore -@findex CC_REVERSED -If a peephole matches a sequence including one or more jump insns, you must -take account of the flags such as @code{CC_REVERSED} which specify that the -condition codes are represented in an unusual manner. The compiler -automatically alters any ordinary conditional jumps which occur in such -situations, but the compiler cannot alter jumps which have been replaced by -peephole optimizations. So it is up to you to alter the assembler code -that the peephole produces. Supply C code to write the assembler output, -and in this C code check the condition code status flags and change the -assembler code as appropriate. -@end ignore - -@var{insn-pattern-1} and so on look @emph{almost} like the second -operand of @code{define_insn}. There is one important difference: the -second operand of @code{define_insn} consists of one or more RTX's -enclosed in square brackets. Usually, there is only one: then the same -action can be written as an element of a @code{define_peephole}. But -when there are multiple actions in a @code{define_insn}, they are -implicitly enclosed in a @code{parallel}. Then you must explicitly -write the @code{parallel}, and the square brackets within it, in the -@code{define_peephole}. Thus, if an insn pattern looks like this, - -@smallexample -(define_insn "divmodsi4" - [(set (match_operand:SI 0 "general_operand" "=d") - (div:SI (match_operand:SI 1 "general_operand" "0") - (match_operand:SI 2 "general_operand" "dmsK"))) - (set (match_operand:SI 3 "general_operand" "=d") - (mod:SI (match_dup 1) (match_dup 2)))] - "TARGET_68020" - "divsl%.l %2,%3:%0") -@end smallexample - -@noindent -then the way to mention this insn in a peephole is as follows: - -@smallexample -(define_peephole - [@dots{} - (parallel - [(set (match_operand:SI 0 "general_operand" "=d") - (div:SI (match_operand:SI 1 "general_operand" "0") - (match_operand:SI 2 "general_operand" "dmsK"))) - (set (match_operand:SI 3 "general_operand" "=d") - (mod:SI (match_dup 1) (match_dup 2)))]) - @dots{}] - @dots{}) -@end smallexample - -@end ifset -@ifset INTERNALS -@node define_peephole2 -@subsection RTL to RTL Peephole Optimizers -@findex define_peephole2 - -The @code{define_peephole2} definition tells the compiler how to -substitute one sequence of instructions for another sequence, -what additional scratch registers may be needed and what their -lifetimes must be. - -@smallexample -(define_peephole2 - [@var{insn-pattern-1} - @var{insn-pattern-2} - @dots{}] - "@var{condition}" - [@var{new-insn-pattern-1} - @var{new-insn-pattern-2} - @dots{}] - "@var{preparation-statements}") -@end smallexample - -The definition is almost identical to @code{define_split} -(@pxref{Insn Splitting}) except that the pattern to match is not a -single instruction, but a sequence of instructions. - -It is possible to request additional scratch registers for use in the -output template. If appropriate registers are not free, the pattern -will simply not match. - -@findex match_scratch -@findex match_dup -Scratch registers are requested with a @code{match_scratch} pattern at -the top level of the input pattern. The allocated register (initially) will -be dead at the point requested within the original sequence. If the scratch -is used at more than a single point, a @code{match_dup} pattern at the -top level of the input pattern marks the last position in the input sequence -at which the register must be available. - -Here is an example from the IA-32 machine description: - -@smallexample -(define_peephole2 - [(match_scratch:SI 2 "r") - (parallel [(set (match_operand:SI 0 "register_operand" "") - (match_operator:SI 3 "arith_or_logical_operator" - [(match_dup 0) - (match_operand:SI 1 "memory_operand" "")])) - (clobber (reg:CC 17))])] - "! optimize_size && ! TARGET_READ_MODIFY" - [(set (match_dup 2) (match_dup 1)) - (parallel [(set (match_dup 0) - (match_op_dup 3 [(match_dup 0) (match_dup 2)])) - (clobber (reg:CC 17))])] - "") -@end smallexample - -@noindent -This pattern tries to split a load from its use in the hopes that we'll be -able to schedule around the memory load latency. It allocates a single -@code{SImode} register of class @code{GENERAL_REGS} (@code{"r"}) that needs -to be live only at the point just before the arithmetic. - -A real example requiring extended scratch lifetimes is harder to come by, -so here's a silly made-up example: - -@smallexample -(define_peephole2 - [(match_scratch:SI 4 "r") - (set (match_operand:SI 0 "" "") (match_operand:SI 1 "" "")) - (set (match_operand:SI 2 "" "") (match_dup 1)) - (match_dup 4) - (set (match_operand:SI 3 "" "") (match_dup 1))] - "/* @r{determine 1 does not overlap 0 and 2} */" - [(set (match_dup 4) (match_dup 1)) - (set (match_dup 0) (match_dup 4)) - (set (match_dup 2) (match_dup 4)) - (set (match_dup 3) (match_dup 4))] - "") -@end smallexample - -@noindent -If we had not added the @code{(match_dup 4)} in the middle of the input -sequence, it might have been the case that the register we chose at the -beginning of the sequence is killed by the first or second @code{set}. - -@end ifset -@ifset INTERNALS -@node Insn Attributes -@section Instruction Attributes -@cindex insn attributes -@cindex instruction attributes - -In addition to describing the instruction supported by the target machine, -the @file{md} file also defines a group of @dfn{attributes} and a set of -values for each. Every generated insn is assigned a value for each attribute. -One possible attribute would be the effect that the insn has on the machine's -condition code. This attribute can then be used by @code{NOTICE_UPDATE_CC} -to track the condition codes. - -@menu -* Defining Attributes:: Specifying attributes and their values. -* Expressions:: Valid expressions for attribute values. -* Tagging Insns:: Assigning attribute values to insns. -* Attr Example:: An example of assigning attributes. -* Insn Lengths:: Computing the length of insns. -* Constant Attributes:: Defining attributes that are constant. -* Mnemonic Attribute:: Obtain the instruction mnemonic as attribute value. -* Delay Slots:: Defining delay slots required for a machine. -* Processor pipeline description:: Specifying information for insn scheduling. -@end menu - -@end ifset -@ifset INTERNALS -@node Defining Attributes -@subsection Defining Attributes and their Values -@cindex defining attributes and their values -@cindex attributes, defining - -@findex define_attr -The @code{define_attr} expression is used to define each attribute required -by the target machine. It looks like: - -@smallexample -(define_attr @var{name} @var{list-of-values} @var{default}) -@end smallexample - -@var{name} is a string specifying the name of the attribute being -defined. Some attributes are used in a special way by the rest of the -compiler. The @code{enabled} attribute can be used to conditionally -enable or disable insn alternatives (@pxref{Disable Insn -Alternatives}). The @code{predicable} attribute, together with a -suitable @code{define_cond_exec} (@pxref{Conditional Execution}), can -be used to automatically generate conditional variants of instruction -patterns. The @code{mnemonic} attribute can be used to check for the -instruction mnemonic (@pxref{Mnemonic Attribute}). The compiler -internally uses the names @code{ce_enabled} and @code{nonce_enabled}, -so they should not be used elsewhere as alternative names. - -@var{list-of-values} is either a string that specifies a comma-separated -list of values that can be assigned to the attribute, or a null string to -indicate that the attribute takes numeric values. - -@var{default} is an attribute expression that gives the value of this -attribute for insns that match patterns whose definition does not include -an explicit value for this attribute. @xref{Attr Example}, for more -information on the handling of defaults. @xref{Constant Attributes}, -for information on attributes that do not depend on any particular insn. - -@findex insn-attr.h -For each defined attribute, a number of definitions are written to the -@file{insn-attr.h} file. For cases where an explicit set of values is -specified for an attribute, the following are defined: - -@itemize @bullet -@item -A @samp{#define} is written for the symbol @samp{HAVE_ATTR_@var{name}}. - -@item -An enumerated class is defined for @samp{attr_@var{name}} with -elements of the form @samp{@var{upper-name}_@var{upper-value}} where -the attribute name and value are first converted to uppercase. - -@item -A function @samp{get_attr_@var{name}} is defined that is passed an insn and -returns the attribute value for that insn. -@end itemize - -For example, if the following is present in the @file{md} file: - -@smallexample -(define_attr "type" "branch,fp,load,store,arith" @dots{}) -@end smallexample - -@noindent -the following lines will be written to the file @file{insn-attr.h}. - -@smallexample -#define HAVE_ATTR_type 1 -enum attr_type @{TYPE_BRANCH, TYPE_FP, TYPE_LOAD, - TYPE_STORE, TYPE_ARITH@}; -extern enum attr_type get_attr_type (); -@end smallexample - -If the attribute takes numeric values, no @code{enum} type will be -defined and the function to obtain the attribute's value will return -@code{int}. - -There are attributes which are tied to a specific meaning. These -attributes are not free to use for other purposes: - -@table @code -@item length -The @code{length} attribute is used to calculate the length of emitted -code chunks. This is especially important when verifying branch -distances. @xref{Insn Lengths}. - -@item enabled -The @code{enabled} attribute can be defined to prevent certain -alternatives of an insn definition from being used during code -generation. @xref{Disable Insn Alternatives}. - -@item mnemonic -The @code{mnemonic} attribute can be defined to implement instruction -specific checks in e.g. the pipeline description. -@xref{Mnemonic Attribute}. -@end table - -For each of these special attributes, the corresponding -@samp{HAVE_ATTR_@var{name}} @samp{#define} is also written when the -attribute is not defined; in that case, it is defined as @samp{0}. - -@findex define_enum_attr -@anchor{define_enum_attr} -Another way of defining an attribute is to use: - -@smallexample -(define_enum_attr "@var{attr}" "@var{enum}" @var{default}) -@end smallexample - -This works in just the same way as @code{define_attr}, except that -the list of values is taken from a separate enumeration called -@var{enum} (@pxref{define_enum}). This form allows you to use -the same list of values for several attributes without having to -repeat the list each time. For example: - -@smallexample -(define_enum "processor" [ - model_a - model_b - @dots{} -]) -(define_enum_attr "arch" "processor" - (const (symbol_ref "target_arch"))) -(define_enum_attr "tune" "processor" - (const (symbol_ref "target_tune"))) -@end smallexample - -defines the same attributes as: - -@smallexample -(define_attr "arch" "model_a,model_b,@dots{}" - (const (symbol_ref "target_arch"))) -(define_attr "tune" "model_a,model_b,@dots{}" - (const (symbol_ref "target_tune"))) -@end smallexample - -but without duplicating the processor list. The second example defines two -separate C enums (@code{attr_arch} and @code{attr_tune}) whereas the first -defines a single C enum (@code{processor}). -@end ifset -@ifset INTERNALS -@node Expressions -@subsection Attribute Expressions -@cindex attribute expressions - -RTL expressions used to define attributes use the codes described above -plus a few specific to attribute definitions, to be discussed below. -Attribute value expressions must have one of the following forms: - -@table @code -@cindex @code{const_int} and attributes -@item (const_int @var{i}) -The integer @var{i} specifies the value of a numeric attribute. @var{i} -must be non-negative. - -The value of a numeric attribute can be specified either with a -@code{const_int}, or as an integer represented as a string in -@code{const_string}, @code{eq_attr} (see below), @code{attr}, -@code{symbol_ref}, simple arithmetic expressions, and @code{set_attr} -overrides on specific instructions (@pxref{Tagging Insns}). - -@cindex @code{const_string} and attributes -@item (const_string @var{value}) -The string @var{value} specifies a constant attribute value. -If @var{value} is specified as @samp{"*"}, it means that the default value of -the attribute is to be used for the insn containing this expression. -@samp{"*"} obviously cannot be used in the @var{default} expression -of a @code{define_attr}. - -If the attribute whose value is being specified is numeric, @var{value} -must be a string containing a non-negative integer (normally -@code{const_int} would be used in this case). Otherwise, it must -contain one of the valid values for the attribute. - -@cindex @code{if_then_else} and attributes -@item (if_then_else @var{test} @var{true-value} @var{false-value}) -@var{test} specifies an attribute test, whose format is defined below. -The value of this expression is @var{true-value} if @var{test} is true, -otherwise it is @var{false-value}. - -@cindex @code{cond} and attributes -@item (cond [@var{test1} @var{value1} @dots{}] @var{default}) -The first operand of this expression is a vector containing an even -number of expressions and consisting of pairs of @var{test} and @var{value} -expressions. The value of the @code{cond} expression is that of the -@var{value} corresponding to the first true @var{test} expression. If -none of the @var{test} expressions are true, the value of the @code{cond} -expression is that of the @var{default} expression. -@end table - -@var{test} expressions can have one of the following forms: - -@table @code -@cindex @code{const_int} and attribute tests -@item (const_int @var{i}) -This test is true if @var{i} is nonzero and false otherwise. - -@cindex @code{not} and attributes -@cindex @code{ior} and attributes -@cindex @code{and} and attributes -@item (not @var{test}) -@itemx (ior @var{test1} @var{test2}) -@itemx (and @var{test1} @var{test2}) -These tests are true if the indicated logical function is true. - -@cindex @code{match_operand} and attributes -@item (match_operand:@var{m} @var{n} @var{pred} @var{constraints}) -This test is true if operand @var{n} of the insn whose attribute value -is being determined has mode @var{m} (this part of the test is ignored -if @var{m} is @code{VOIDmode}) and the function specified by the string -@var{pred} returns a nonzero value when passed operand @var{n} and mode -@var{m} (this part of the test is ignored if @var{pred} is the null -string). - -The @var{constraints} operand is ignored and should be the null string. - -@cindex @code{match_test} and attributes -@item (match_test @var{c-expr}) -The test is true if C expression @var{c-expr} is true. In non-constant -attributes, @var{c-expr} has access to the following variables: - -@table @var -@item insn -The rtl instruction under test. -@item which_alternative -The @code{define_insn} alternative that @var{insn} matches. -@xref{Output Statement}. -@item operands -An array of @var{insn}'s rtl operands. -@end table - -@var{c-expr} behaves like the condition in a C @code{if} statement, -so there is no need to explicitly convert the expression into a boolean -0 or 1 value. For example, the following two tests are equivalent: - -@smallexample -(match_test "x & 2") -(match_test "(x & 2) != 0") -@end smallexample - -@cindex @code{le} and attributes -@cindex @code{leu} and attributes -@cindex @code{lt} and attributes -@cindex @code{gt} and attributes -@cindex @code{gtu} and attributes -@cindex @code{ge} and attributes -@cindex @code{geu} and attributes -@cindex @code{ne} and attributes -@cindex @code{eq} and attributes -@cindex @code{plus} and attributes -@cindex @code{minus} and attributes -@cindex @code{mult} and attributes -@cindex @code{div} and attributes -@cindex @code{mod} and attributes -@cindex @code{abs} and attributes -@cindex @code{neg} and attributes -@cindex @code{ashift} and attributes -@cindex @code{lshiftrt} and attributes -@cindex @code{ashiftrt} and attributes -@item (le @var{arith1} @var{arith2}) -@itemx (leu @var{arith1} @var{arith2}) -@itemx (lt @var{arith1} @var{arith2}) -@itemx (ltu @var{arith1} @var{arith2}) -@itemx (gt @var{arith1} @var{arith2}) -@itemx (gtu @var{arith1} @var{arith2}) -@itemx (ge @var{arith1} @var{arith2}) -@itemx (geu @var{arith1} @var{arith2}) -@itemx (ne @var{arith1} @var{arith2}) -@itemx (eq @var{arith1} @var{arith2}) -These tests are true if the indicated comparison of the two arithmetic -expressions is true. Arithmetic expressions are formed with -@code{plus}, @code{minus}, @code{mult}, @code{div}, @code{mod}, -@code{abs}, @code{neg}, @code{and}, @code{ior}, @code{xor}, @code{not}, -@code{ashift}, @code{lshiftrt}, and @code{ashiftrt} expressions. - -@findex get_attr -@code{const_int} and @code{symbol_ref} are always valid terms (@pxref{Insn -Lengths},for additional forms). @code{symbol_ref} is a string -denoting a C expression that yields an @code{int} when evaluated by the -@samp{get_attr_@dots{}} routine. It should normally be a global -variable. - -@findex eq_attr -@item (eq_attr @var{name} @var{value}) -@var{name} is a string specifying the name of an attribute. - -@var{value} is a string that is either a valid value for attribute -@var{name}, a comma-separated list of values, or @samp{!} followed by a -value or list. If @var{value} does not begin with a @samp{!}, this -test is true if the value of the @var{name} attribute of the current -insn is in the list specified by @var{value}. If @var{value} begins -with a @samp{!}, this test is true if the attribute's value is -@emph{not} in the specified list. - -For example, - -@smallexample -(eq_attr "type" "load,store") -@end smallexample - -@noindent -is equivalent to - -@smallexample -(ior (eq_attr "type" "load") (eq_attr "type" "store")) -@end smallexample - -If @var{name} specifies an attribute of @samp{alternative}, it refers to the -value of the compiler variable @code{which_alternative} -(@pxref{Output Statement}) and the values must be small integers. For -example, - -@smallexample -(eq_attr "alternative" "2,3") -@end smallexample - -@noindent -is equivalent to - -@smallexample -(ior (eq (symbol_ref "which_alternative") (const_int 2)) - (eq (symbol_ref "which_alternative") (const_int 3))) -@end smallexample - -Note that, for most attributes, an @code{eq_attr} test is simplified in cases -where the value of the attribute being tested is known for all insns matching -a particular pattern. This is by far the most common case. - -@findex attr_flag -@item (attr_flag @var{name}) -The value of an @code{attr_flag} expression is true if the flag -specified by @var{name} is true for the @code{insn} currently being -scheduled. - -@var{name} is a string specifying one of a fixed set of flags to test. -Test the flags @code{forward} and @code{backward} to determine the -direction of a conditional branch. - -This example describes a conditional branch delay slot which -can be nullified for forward branches that are taken (annul-true) or -for backward branches which are not taken (annul-false). - -@smallexample -(define_delay (eq_attr "type" "cbranch") - [(eq_attr "in_branch_delay" "true") - (and (eq_attr "in_branch_delay" "true") - (attr_flag "forward")) - (and (eq_attr "in_branch_delay" "true") - (attr_flag "backward"))]) -@end smallexample - -The @code{forward} and @code{backward} flags are false if the current -@code{insn} being scheduled is not a conditional branch. - -@code{attr_flag} is only used during delay slot scheduling and has no -meaning to other passes of the compiler. - -@findex attr -@item (attr @var{name}) -The value of another attribute is returned. This is most useful -for numeric attributes, as @code{eq_attr} and @code{attr_flag} -produce more efficient code for non-numeric attributes. -@end table - -@end ifset -@ifset INTERNALS -@node Tagging Insns -@subsection Assigning Attribute Values to Insns -@cindex tagging insns -@cindex assigning attribute values to insns - -The value assigned to an attribute of an insn is primarily determined by -which pattern is matched by that insn (or which @code{define_peephole} -generated it). Every @code{define_insn} and @code{define_peephole} can -have an optional last argument to specify the values of attributes for -matching insns. The value of any attribute not specified in a particular -insn is set to the default value for that attribute, as specified in its -@code{define_attr}. Extensive use of default values for attributes -permits the specification of the values for only one or two attributes -in the definition of most insn patterns, as seen in the example in the -next section. - -The optional last argument of @code{define_insn} and -@code{define_peephole} is a vector of expressions, each of which defines -the value for a single attribute. The most general way of assigning an -attribute's value is to use a @code{set} expression whose first operand is an -@code{attr} expression giving the name of the attribute being set. The -second operand of the @code{set} is an attribute expression -(@pxref{Expressions}) giving the value of the attribute. - -When the attribute value depends on the @samp{alternative} attribute -(i.e., which is the applicable alternative in the constraint of the -insn), the @code{set_attr_alternative} expression can be used. It -allows the specification of a vector of attribute expressions, one for -each alternative. - -@findex set_attr -When the generality of arbitrary attribute expressions is not required, -the simpler @code{set_attr} expression can be used, which allows -specifying a string giving either a single attribute value or a list -of attribute values, one for each alternative. - -The form of each of the above specifications is shown below. In each case, -@var{name} is a string specifying the attribute to be set. - -@table @code -@item (set_attr @var{name} @var{value-string}) -@var{value-string} is either a string giving the desired attribute value, -or a string containing a comma-separated list giving the values for -succeeding alternatives. The number of elements must match the number -of alternatives in the constraint of the insn pattern. - -Note that it may be useful to specify @samp{*} for some alternative, in -which case the attribute will assume its default value for insns matching -that alternative. - -@findex set_attr_alternative -@item (set_attr_alternative @var{name} [@var{value1} @var{value2} @dots{}]) -Depending on the alternative of the insn, the value will be one of the -specified values. This is a shorthand for using a @code{cond} with -tests on the @samp{alternative} attribute. - -@findex attr -@item (set (attr @var{name}) @var{value}) -The first operand of this @code{set} must be the special RTL expression -@code{attr}, whose sole operand is a string giving the name of the -attribute being set. @var{value} is the value of the attribute. -@end table - -The following shows three different ways of representing the same -attribute value specification: - -@smallexample -(set_attr "type" "load,store,arith") - -(set_attr_alternative "type" - [(const_string "load") (const_string "store") - (const_string "arith")]) - -(set (attr "type") - (cond [(eq_attr "alternative" "1") (const_string "load") - (eq_attr "alternative" "2") (const_string "store")] - (const_string "arith"))) -@end smallexample - -@need 1000 -@findex define_asm_attributes -The @code{define_asm_attributes} expression provides a mechanism to -specify the attributes assigned to insns produced from an @code{asm} -statement. It has the form: - -@smallexample -(define_asm_attributes [@var{attr-sets}]) -@end smallexample - -@noindent -where @var{attr-sets} is specified the same as for both the -@code{define_insn} and the @code{define_peephole} expressions. - -These values will typically be the ``worst case'' attribute values. For -example, they might indicate that the condition code will be clobbered. - -A specification for a @code{length} attribute is handled specially. The -way to compute the length of an @code{asm} insn is to multiply the -length specified in the expression @code{define_asm_attributes} by the -number of machine instructions specified in the @code{asm} statement, -determined by counting the number of semicolons and newlines in the -string. Therefore, the value of the @code{length} attribute specified -in a @code{define_asm_attributes} should be the maximum possible length -of a single machine instruction. - -@end ifset -@ifset INTERNALS -@node Attr Example -@subsection Example of Attribute Specifications -@cindex attribute specifications example -@cindex attribute specifications - -The judicious use of defaulting is important in the efficient use of -insn attributes. Typically, insns are divided into @dfn{types} and an -attribute, customarily called @code{type}, is used to represent this -value. This attribute is normally used only to define the default value -for other attributes. An example will clarify this usage. - -Assume we have a RISC machine with a condition code and in which only -full-word operations are performed in registers. Let us assume that we -can divide all insns into loads, stores, (integer) arithmetic -operations, floating point operations, and branches. - -Here we will concern ourselves with determining the effect of an insn on -the condition code and will limit ourselves to the following possible -effects: The condition code can be set unpredictably (clobbered), not -be changed, be set to agree with the results of the operation, or only -changed if the item previously set into the condition code has been -modified. - -Here is part of a sample @file{md} file for such a machine: - -@smallexample -(define_attr "type" "load,store,arith,fp,branch" (const_string "arith")) - -(define_attr "cc" "clobber,unchanged,set,change0" - (cond [(eq_attr "type" "load") - (const_string "change0") - (eq_attr "type" "store,branch") - (const_string "unchanged") - (eq_attr "type" "arith") - (if_then_else (match_operand:SI 0 "" "") - (const_string "set") - (const_string "clobber"))] - (const_string "clobber"))) - -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r,r,m") - (match_operand:SI 1 "general_operand" "r,m,r"))] - "" - "@@ - move %0,%1 - load %0,%1 - store %0,%1" - [(set_attr "type" "arith,load,store")]) -@end smallexample - -Note that we assume in the above example that arithmetic operations -performed on quantities smaller than a machine word clobber the condition -code since they will set the condition code to a value corresponding to the -full-word result. - -@end ifset -@ifset INTERNALS -@node Insn Lengths -@subsection Computing the Length of an Insn -@cindex insn lengths, computing -@cindex computing the length of an insn - -For many machines, multiple types of branch instructions are provided, each -for different length branch displacements. In most cases, the assembler -will choose the correct instruction to use. However, when the assembler -cannot do so, GCC can when a special attribute, the @code{length} -attribute, is defined. This attribute must be defined to have numeric -values by specifying a null string in its @code{define_attr}. - -In the case of the @code{length} attribute, two additional forms of -arithmetic terms are allowed in test expressions: - -@table @code -@cindex @code{match_dup} and attributes -@item (match_dup @var{n}) -This refers to the address of operand @var{n} of the current insn, which -must be a @code{label_ref}. - -@cindex @code{pc} and attributes -@item (pc) -For non-branch instructions and backward branch instructions, this refers -to the address of the current insn. But for forward branch instructions, -this refers to the address of the next insn, because the length of the -current insn is to be computed. -@end table - -@cindex @code{addr_vec}, length of -@cindex @code{addr_diff_vec}, length of -For normal insns, the length will be determined by value of the -@code{length} attribute. In the case of @code{addr_vec} and -@code{addr_diff_vec} insn patterns, the length is computed as -the number of vectors multiplied by the size of each vector. - -Lengths are measured in addressable storage units (bytes). - -Note that it is possible to call functions via the @code{symbol_ref} -mechanism to compute the length of an insn. However, if you use this -mechanism you must provide dummy clauses to express the maximum length -without using the function call. You can an example of this in the -@code{pa} machine description for the @code{call_symref} pattern. - -The following macros can be used to refine the length computation: - -@table @code -@findex ADJUST_INSN_LENGTH -@item ADJUST_INSN_LENGTH (@var{insn}, @var{length}) -If defined, modifies the length assigned to instruction @var{insn} as a -function of the context in which it is used. @var{length} is an lvalue -that contains the initially computed length of the insn and should be -updated with the correct length of the insn. - -This macro will normally not be required. A case in which it is -required is the ROMP@. On this machine, the size of an @code{addr_vec} -insn must be increased by two to compensate for the fact that alignment -may be required. -@end table - -@findex get_attr_length -The routine that returns @code{get_attr_length} (the value of the -@code{length} attribute) can be used by the output routine to -determine the form of the branch instruction to be written, as the -example below illustrates. - -As an example of the specification of variable-length branches, consider -the IBM 360. If we adopt the convention that a register will be set to -the starting address of a function, we can jump to labels within 4k of -the start using a four-byte instruction. Otherwise, we need a six-byte -sequence to load the address from memory and then branch to it. - -On such a machine, a pattern for a branch instruction might be specified -as follows: - -@smallexample -(define_insn "jump" - [(set (pc) - (label_ref (match_operand 0 "" "")))] - "" -@{ - return (get_attr_length (insn) == 4 - ? "b %l0" : "l r15,=a(%l0); br r15"); -@} - [(set (attr "length") - (if_then_else (lt (match_dup 0) (const_int 4096)) - (const_int 4) - (const_int 6)))]) -@end smallexample - -@end ifset -@ifset INTERNALS -@node Constant Attributes -@subsection Constant Attributes -@cindex constant attributes - -A special form of @code{define_attr}, where the expression for the -default value is a @code{const} expression, indicates an attribute that -is constant for a given run of the compiler. Constant attributes may be -used to specify which variety of processor is used. For example, - -@smallexample -(define_attr "cpu" "m88100,m88110,m88000" - (const - (cond [(symbol_ref "TARGET_88100") (const_string "m88100") - (symbol_ref "TARGET_88110") (const_string "m88110")] - (const_string "m88000")))) - -(define_attr "memory" "fast,slow" - (const - (if_then_else (symbol_ref "TARGET_FAST_MEM") - (const_string "fast") - (const_string "slow")))) -@end smallexample - -The routine generated for constant attributes has no parameters as it -does not depend on any particular insn. RTL expressions used to define -the value of a constant attribute may use the @code{symbol_ref} form, -but may not use either the @code{match_operand} form or @code{eq_attr} -forms involving insn attributes. - -@end ifset -@ifset INTERNALS -@node Mnemonic Attribute -@subsection Mnemonic Attribute -@cindex mnemonic attribute - -The @code{mnemonic} attribute is a string type attribute holding the -instruction mnemonic for an insn alternative. The attribute values -will automatically be generated by the machine description parser if -there is an attribute definition in the md file: - -@smallexample -(define_attr "mnemonic" "unknown" (const_string "unknown")) -@end smallexample - -The default value can be freely chosen as long as it does not collide -with any of the instruction mnemonics. This value will be used -whenever the machine description parser is not able to determine the -mnemonic string. This might be the case for output templates -containing more than a single instruction as in -@code{"mvcle\t%0,%1,0\;jo\t.-4"}. - -The @code{mnemonic} attribute set is not generated automatically if the -instruction string is generated via C code. - -An existing @code{mnemonic} attribute set in an insn definition will not -be overriden by the md file parser. That way it is possible to -manually set the instruction mnemonics for the cases where the md file -parser fails to determine it automatically. - -The @code{mnemonic} attribute is useful for dealing with instruction -specific properties in the pipeline description without defining -additional insn attributes. - -@smallexample -(define_attr "ooo_expanded" "" - (cond [(eq_attr "mnemonic" "dlr,dsgr,d,dsgf,stam,dsgfr,dlgr") - (const_int 1)] - (const_int 0))) -@end smallexample - -@end ifset -@ifset INTERNALS -@node Delay Slots -@subsection Delay Slot Scheduling -@cindex delay slots, defining - -The insn attribute mechanism can be used to specify the requirements for -delay slots, if any, on a target machine. An instruction is said to -require a @dfn{delay slot} if some instructions that are physically -after the instruction are executed as if they were located before it. -Classic examples are branch and call instructions, which often execute -the following instruction before the branch or call is performed. - -On some machines, conditional branch instructions can optionally -@dfn{annul} instructions in the delay slot. This means that the -instruction will not be executed for certain branch outcomes. Both -instructions that annul if the branch is true and instructions that -annul if the branch is false are supported. - -Delay slot scheduling differs from instruction scheduling in that -determining whether an instruction needs a delay slot is dependent only -on the type of instruction being generated, not on data flow between the -instructions. See the next section for a discussion of data-dependent -instruction scheduling. - -@findex define_delay -The requirement of an insn needing one or more delay slots is indicated -via the @code{define_delay} expression. It has the following form: - -@smallexample -(define_delay @var{test} - [@var{delay-1} @var{annul-true-1} @var{annul-false-1} - @var{delay-2} @var{annul-true-2} @var{annul-false-2} - @dots{}]) -@end smallexample - -@var{test} is an attribute test that indicates whether this -@code{define_delay} applies to a particular insn. If so, the number of -required delay slots is determined by the length of the vector specified -as the second argument. An insn placed in delay slot @var{n} must -satisfy attribute test @var{delay-n}. @var{annul-true-n} is an -attribute test that specifies which insns may be annulled if the branch -is true. Similarly, @var{annul-false-n} specifies which insns in the -delay slot may be annulled if the branch is false. If annulling is not -supported for that delay slot, @code{(nil)} should be coded. - -For example, in the common case where branch and call insns require -a single delay slot, which may contain any insn other than a branch or -call, the following would be placed in the @file{md} file: - -@smallexample -(define_delay (eq_attr "type" "branch,call") - [(eq_attr "type" "!branch,call") (nil) (nil)]) -@end smallexample - -Multiple @code{define_delay} expressions may be specified. In this -case, each such expression specifies different delay slot requirements -and there must be no insn for which tests in two @code{define_delay} -expressions are both true. - -For example, if we have a machine that requires one delay slot for branches -but two for calls, no delay slot can contain a branch or call insn, -and any valid insn in the delay slot for the branch can be annulled if the -branch is true, we might represent this as follows: - -@smallexample -(define_delay (eq_attr "type" "branch") - [(eq_attr "type" "!branch,call") - (eq_attr "type" "!branch,call") - (nil)]) - -(define_delay (eq_attr "type" "call") - [(eq_attr "type" "!branch,call") (nil) (nil) - (eq_attr "type" "!branch,call") (nil) (nil)]) -@end smallexample -@c the above is *still* too long. --mew 4feb93 - -@end ifset -@ifset INTERNALS -@node Processor pipeline description -@subsection Specifying processor pipeline description -@cindex processor pipeline description -@cindex processor functional units -@cindex instruction latency time -@cindex interlock delays -@cindex data dependence delays -@cindex reservation delays -@cindex pipeline hazard recognizer -@cindex automaton based pipeline description -@cindex regular expressions -@cindex deterministic finite state automaton -@cindex automaton based scheduler -@cindex RISC -@cindex VLIW - -To achieve better performance, most modern processors -(super-pipelined, superscalar @acronym{RISC}, and @acronym{VLIW} -processors) have many @dfn{functional units} on which several -instructions can be executed simultaneously. An instruction starts -execution if its issue conditions are satisfied. If not, the -instruction is stalled until its conditions are satisfied. Such -@dfn{interlock (pipeline) delay} causes interruption of the fetching -of successor instructions (or demands nop instructions, e.g.@: for some -MIPS processors). - -There are two major kinds of interlock delays in modern processors. -The first one is a data dependence delay determining @dfn{instruction -latency time}. The instruction execution is not started until all -source data have been evaluated by prior instructions (there are more -complex cases when the instruction execution starts even when the data -are not available but will be ready in given time after the -instruction execution start). Taking the data dependence delays into -account is simple. The data dependence (true, output, and -anti-dependence) delay between two instructions is given by a -constant. In most cases this approach is adequate. The second kind -of interlock delays is a reservation delay. The reservation delay -means that two instructions under execution will be in need of shared -processors resources, i.e.@: buses, internal registers, and/or -functional units, which are reserved for some time. Taking this kind -of delay into account is complex especially for modern @acronym{RISC} -processors. - -The task of exploiting more processor parallelism is solved by an -instruction scheduler. For a better solution to this problem, the -instruction scheduler has to have an adequate description of the -processor parallelism (or @dfn{pipeline description}). GCC -machine descriptions describe processor parallelism and functional -unit reservations for groups of instructions with the aid of -@dfn{regular expressions}. - -The GCC instruction scheduler uses a @dfn{pipeline hazard recognizer} to -figure out the possibility of the instruction issue by the processor -on a given simulated processor cycle. The pipeline hazard recognizer is -automatically generated from the processor pipeline description. The -pipeline hazard recognizer generated from the machine description -is based on a deterministic finite state automaton (@acronym{DFA}): -the instruction issue is possible if there is a transition from one -automaton state to another one. This algorithm is very fast, and -furthermore, its speed is not dependent on processor -complexity@footnote{However, the size of the automaton depends on -processor complexity. To limit this effect, machine descriptions -can split orthogonal parts of the machine description among several -automata: but then, since each of these must be stepped independently, -this does cause a small decrease in the algorithm's performance.}. - -@cindex automaton based pipeline description -The rest of this section describes the directives that constitute -an automaton-based processor pipeline description. The order of -these constructions within the machine description file is not -important. - -@findex define_automaton -@cindex pipeline hazard recognizer -The following optional construction describes names of automata -generated and used for the pipeline hazards recognition. Sometimes -the generated finite state automaton used by the pipeline hazard -recognizer is large. If we use more than one automaton and bind functional -units to the automata, the total size of the automata is usually -less than the size of the single automaton. If there is no one such -construction, only one finite state automaton is generated. - -@smallexample -(define_automaton @var{automata-names}) -@end smallexample - -@var{automata-names} is a string giving names of the automata. The -names are separated by commas. All the automata should have unique names. -The automaton name is used in the constructions @code{define_cpu_unit} and -@code{define_query_cpu_unit}. - -@findex define_cpu_unit -@cindex processor functional units -Each processor functional unit used in the description of instruction -reservations should be described by the following construction. - -@smallexample -(define_cpu_unit @var{unit-names} [@var{automaton-name}]) -@end smallexample - -@var{unit-names} is a string giving the names of the functional units -separated by commas. Don't use name @samp{nothing}, it is reserved -for other goals. - -@var{automaton-name} is a string giving the name of the automaton with -which the unit is bound. The automaton should be described in -construction @code{define_automaton}. You should give -@dfn{automaton-name}, if there is a defined automaton. - -The assignment of units to automata are constrained by the uses of the -units in insn reservations. The most important constraint is: if a -unit reservation is present on a particular cycle of an alternative -for an insn reservation, then some unit from the same automaton must -be present on the same cycle for the other alternatives of the insn -reservation. The rest of the constraints are mentioned in the -description of the subsequent constructions. - -@findex define_query_cpu_unit -@cindex querying function unit reservations -The following construction describes CPU functional units analogously -to @code{define_cpu_unit}. The reservation of such units can be -queried for an automaton state. The instruction scheduler never -queries reservation of functional units for given automaton state. So -as a rule, you don't need this construction. This construction could -be used for future code generation goals (e.g.@: to generate -@acronym{VLIW} insn templates). - -@smallexample -(define_query_cpu_unit @var{unit-names} [@var{automaton-name}]) -@end smallexample - -@var{unit-names} is a string giving names of the functional units -separated by commas. - -@var{automaton-name} is a string giving the name of the automaton with -which the unit is bound. - -@findex define_insn_reservation -@cindex instruction latency time -@cindex regular expressions -@cindex data bypass -The following construction is the major one to describe pipeline -characteristics of an instruction. - -@smallexample -(define_insn_reservation @var{insn-name} @var{default_latency} - @var{condition} @var{regexp}) -@end smallexample - -@var{default_latency} is a number giving latency time of the -instruction. There is an important difference between the old -description and the automaton based pipeline description. The latency -time is used for all dependencies when we use the old description. In -the automaton based pipeline description, the given latency time is only -used for true dependencies. The cost of anti-dependencies is always -zero and the cost of output dependencies is the difference between -latency times of the producing and consuming insns (if the difference -is negative, the cost is considered to be zero). You can always -change the default costs for any description by using the target hook -@code{TARGET_SCHED_ADJUST_COST} (@pxref{Scheduling}). - -@var{insn-name} is a string giving the internal name of the insn. The -internal names are used in constructions @code{define_bypass} and in -the automaton description file generated for debugging. The internal -name has nothing in common with the names in @code{define_insn}. It is a -good practice to use insn classes described in the processor manual. - -@var{condition} defines what RTL insns are described by this -construction. You should remember that you will be in trouble if -@var{condition} for two or more different -@code{define_insn_reservation} constructions is TRUE for an insn. In -this case what reservation will be used for the insn is not defined. -Such cases are not checked during generation of the pipeline hazards -recognizer because in general recognizing that two conditions may have -the same value is quite difficult (especially if the conditions -contain @code{symbol_ref}). It is also not checked during the -pipeline hazard recognizer work because it would slow down the -recognizer considerably. - -@var{regexp} is a string describing the reservation of the cpu's functional -units by the instruction. The reservations are described by a regular -expression according to the following syntax: - -@smallexample - regexp = regexp "," oneof - | oneof - - oneof = oneof "|" allof - | allof - - allof = allof "+" repeat - | repeat - - repeat = element "*" number - | element - - element = cpu_function_unit_name - | reservation_name - | result_name - | "nothing" - | "(" regexp ")" -@end smallexample - -@itemize @bullet -@item -@samp{,} is used for describing the start of the next cycle in -the reservation. - -@item -@samp{|} is used for describing a reservation described by the first -regular expression @strong{or} a reservation described by the second -regular expression @strong{or} etc. - -@item -@samp{+} is used for describing a reservation described by the first -regular expression @strong{and} a reservation described by the -second regular expression @strong{and} etc. - -@item -@samp{*} is used for convenience and simply means a sequence in which -the regular expression are repeated @var{number} times with cycle -advancing (see @samp{,}). - -@item -@samp{cpu_function_unit_name} denotes reservation of the named -functional unit. - -@item -@samp{reservation_name} --- see description of construction -@samp{define_reservation}. - -@item -@samp{nothing} denotes no unit reservations. -@end itemize - -@findex define_reservation -Sometimes unit reservations for different insns contain common parts. -In such case, you can simplify the pipeline description by describing -the common part by the following construction - -@smallexample -(define_reservation @var{reservation-name} @var{regexp}) -@end smallexample - -@var{reservation-name} is a string giving name of @var{regexp}. -Functional unit names and reservation names are in the same name -space. So the reservation names should be different from the -functional unit names and can not be the reserved name @samp{nothing}. - -@findex define_bypass -@cindex instruction latency time -@cindex data bypass -The following construction is used to describe exceptions in the -latency time for given instruction pair. This is so called bypasses. - -@smallexample -(define_bypass @var{number} @var{out_insn_names} @var{in_insn_names} - [@var{guard}]) -@end smallexample - -@var{number} defines when the result generated by the instructions -given in string @var{out_insn_names} will be ready for the -instructions given in string @var{in_insn_names}. Each of these -strings is a comma-separated list of filename-style globs and -they refer to the names of @code{define_insn_reservation}s. -For example: -@smallexample -(define_bypass 1 "cpu1_load_*, cpu1_store_*" "cpu1_load_*") -@end smallexample -defines a bypass between instructions that start with -@samp{cpu1_load_} or @samp{cpu1_store_} and those that start with -@samp{cpu1_load_}. - -@var{guard} is an optional string giving the name of a C function which -defines an additional guard for the bypass. The function will get the -two insns as parameters. If the function returns zero the bypass will -be ignored for this case. The additional guard is necessary to -recognize complicated bypasses, e.g.@: when the consumer is only an address -of insn @samp{store} (not a stored value). - -If there are more one bypass with the same output and input insns, the -chosen bypass is the first bypass with a guard in description whose -guard function returns nonzero. If there is no such bypass, then -bypass without the guard function is chosen. - -@findex exclusion_set -@findex presence_set -@findex final_presence_set -@findex absence_set -@findex final_absence_set -@cindex VLIW -@cindex RISC -The following five constructions are usually used to describe -@acronym{VLIW} processors, or more precisely, to describe a placement -of small instructions into @acronym{VLIW} instruction slots. They -can be used for @acronym{RISC} processors, too. - -@smallexample -(exclusion_set @var{unit-names} @var{unit-names}) -(presence_set @var{unit-names} @var{patterns}) -(final_presence_set @var{unit-names} @var{patterns}) -(absence_set @var{unit-names} @var{patterns}) -(final_absence_set @var{unit-names} @var{patterns}) -@end smallexample - -@var{unit-names} is a string giving names of functional units -separated by commas. - -@var{patterns} is a string giving patterns of functional units -separated by comma. Currently pattern is one unit or units -separated by white-spaces. - -The first construction (@samp{exclusion_set}) means that each -functional unit in the first string can not be reserved simultaneously -with a unit whose name is in the second string and vice versa. For -example, the construction is useful for describing processors -(e.g.@: some SPARC processors) with a fully pipelined floating point -functional unit which can execute simultaneously only single floating -point insns or only double floating point insns. - -The second construction (@samp{presence_set}) means that each -functional unit in the first string can not be reserved unless at -least one of pattern of units whose names are in the second string is -reserved. This is an asymmetric relation. For example, it is useful -for description that @acronym{VLIW} @samp{slot1} is reserved after -@samp{slot0} reservation. We could describe it by the following -construction - -@smallexample -(presence_set "slot1" "slot0") -@end smallexample - -Or @samp{slot1} is reserved only after @samp{slot0} and unit @samp{b0} -reservation. In this case we could write - -@smallexample -(presence_set "slot1" "slot0 b0") -@end smallexample - -The third construction (@samp{final_presence_set}) is analogous to -@samp{presence_set}. The difference between them is when checking is -done. When an instruction is issued in given automaton state -reflecting all current and planned unit reservations, the automaton -state is changed. The first state is a source state, the second one -is a result state. Checking for @samp{presence_set} is done on the -source state reservation, checking for @samp{final_presence_set} is -done on the result reservation. This construction is useful to -describe a reservation which is actually two subsequent reservations. -For example, if we use - -@smallexample -(presence_set "slot1" "slot0") -@end smallexample - -the following insn will be never issued (because @samp{slot1} requires -@samp{slot0} which is absent in the source state). - -@smallexample -(define_reservation "insn_and_nop" "slot0 + slot1") -@end smallexample - -but it can be issued if we use analogous @samp{final_presence_set}. - -The forth construction (@samp{absence_set}) means that each functional -unit in the first string can be reserved only if each pattern of units -whose names are in the second string is not reserved. This is an -asymmetric relation (actually @samp{exclusion_set} is analogous to -this one but it is symmetric). For example it might be useful in a -@acronym{VLIW} description to say that @samp{slot0} cannot be reserved -after either @samp{slot1} or @samp{slot2} have been reserved. This -can be described as: - -@smallexample -(absence_set "slot0" "slot1, slot2") -@end smallexample - -Or @samp{slot2} can not be reserved if @samp{slot0} and unit @samp{b0} -are reserved or @samp{slot1} and unit @samp{b1} are reserved. In -this case we could write - -@smallexample -(absence_set "slot2" "slot0 b0, slot1 b1") -@end smallexample - -All functional units mentioned in a set should belong to the same -automaton. - -The last construction (@samp{final_absence_set}) is analogous to -@samp{absence_set} but checking is done on the result (state) -reservation. See comments for @samp{final_presence_set}. - -@findex automata_option -@cindex deterministic finite state automaton -@cindex nondeterministic finite state automaton -@cindex finite state automaton minimization -You can control the generator of the pipeline hazard recognizer with -the following construction. - -@smallexample -(automata_option @var{options}) -@end smallexample - -@var{options} is a string giving options which affect the generated -code. Currently there are the following options: - -@itemize @bullet -@item -@dfn{no-minimization} makes no minimization of the automaton. This is -only worth to do when we are debugging the description and need to -look more accurately at reservations of states. - -@item -@dfn{time} means printing time statistics about the generation of -automata. - -@item -@dfn{stats} means printing statistics about the generated automata -such as the number of DFA states, NDFA states and arcs. - -@item -@dfn{v} means a generation of the file describing the result automata. -The file has suffix @samp{.dfa} and can be used for the description -verification and debugging. - -@item -@dfn{w} means a generation of warning instead of error for -non-critical errors. - -@item -@dfn{no-comb-vect} prevents the automaton generator from generating -two data structures and comparing them for space efficiency. Using -a comb vector to represent transitions may be better, but it can be -very expensive to construct. This option is useful if the build -process spends an unacceptably long time in genautomata. - -@item -@dfn{ndfa} makes nondeterministic finite state automata. This affects -the treatment of operator @samp{|} in the regular expressions. The -usual treatment of the operator is to try the first alternative and, -if the reservation is not possible, the second alternative. The -nondeterministic treatment means trying all alternatives, some of them -may be rejected by reservations in the subsequent insns. - -@item -@dfn{collapse-ndfa} modifies the behaviour of the generator when -producing an automaton. An additional state transition to collapse a -nondeterministic @acronym{NDFA} state to a deterministic @acronym{DFA} -state is generated. It can be triggered by passing @code{const0_rtx} to -state_transition. In such an automaton, cycle advance transitions are -available only for these collapsed states. This option is useful for -ports that want to use the @code{ndfa} option, but also want to use -@code{define_query_cpu_unit} to assign units to insns issued in a cycle. - -@item -@dfn{progress} means output of a progress bar showing how many states -were generated so far for automaton being processed. This is useful -during debugging a @acronym{DFA} description. If you see too many -generated states, you could interrupt the generator of the pipeline -hazard recognizer and try to figure out a reason for generation of the -huge automaton. -@end itemize - -As an example, consider a superscalar @acronym{RISC} machine which can -issue three insns (two integer insns and one floating point insn) on -the cycle but can finish only two insns. To describe this, we define -the following functional units. - -@smallexample -(define_cpu_unit "i0_pipeline, i1_pipeline, f_pipeline") -(define_cpu_unit "port0, port1") -@end smallexample - -All simple integer insns can be executed in any integer pipeline and -their result is ready in two cycles. The simple integer insns are -issued into the first pipeline unless it is reserved, otherwise they -are issued into the second pipeline. Integer division and -multiplication insns can be executed only in the second integer -pipeline and their results are ready correspondingly in 8 and 4 -cycles. The integer division is not pipelined, i.e.@: the subsequent -integer division insn can not be issued until the current division -insn finished. Floating point insns are fully pipelined and their -results are ready in 3 cycles. Where the result of a floating point -insn is used by an integer insn, an additional delay of one cycle is -incurred. To describe all of this we could specify - -@smallexample -(define_cpu_unit "div") - -(define_insn_reservation "simple" 2 (eq_attr "type" "int") - "(i0_pipeline | i1_pipeline), (port0 | port1)") - -(define_insn_reservation "mult" 4 (eq_attr "type" "mult") - "i1_pipeline, nothing*2, (port0 | port1)") - -(define_insn_reservation "div" 8 (eq_attr "type" "div") - "i1_pipeline, div*7, div + (port0 | port1)") - -(define_insn_reservation "float" 3 (eq_attr "type" "float") - "f_pipeline, nothing, (port0 | port1)) - -(define_bypass 4 "float" "simple,mult,div") -@end smallexample - -To simplify the description we could describe the following reservation - -@smallexample -(define_reservation "finish" "port0|port1") -@end smallexample - -and use it in all @code{define_insn_reservation} as in the following -construction - -@smallexample -(define_insn_reservation "simple" 2 (eq_attr "type" "int") - "(i0_pipeline | i1_pipeline), finish") -@end smallexample - - -@end ifset -@ifset INTERNALS -@node Conditional Execution -@section Conditional Execution -@cindex conditional execution -@cindex predication - -A number of architectures provide for some form of conditional -execution, or predication. The hallmark of this feature is the -ability to nullify most of the instructions in the instruction set. -When the instruction set is large and not entirely symmetric, it -can be quite tedious to describe these forms directly in the -@file{.md} file. An alternative is the @code{define_cond_exec} template. - -@findex define_cond_exec -@smallexample -(define_cond_exec - [@var{predicate-pattern}] - "@var{condition}" - "@var{output-template}" - "@var{optional-insn-attribues}") -@end smallexample - -@var{predicate-pattern} is the condition that must be true for the -insn to be executed at runtime and should match a relational operator. -One can use @code{match_operator} to match several relational operators -at once. Any @code{match_operand} operands must have no more than one -alternative. - -@var{condition} is a C expression that must be true for the generated -pattern to match. - -@findex current_insn_predicate -@var{output-template} is a string similar to the @code{define_insn} -output template (@pxref{Output Template}), except that the @samp{*} -and @samp{@@} special cases do not apply. This is only useful if the -assembly text for the predicate is a simple prefix to the main insn. -In order to handle the general case, there is a global variable -@code{current_insn_predicate} that will contain the entire predicate -if the current insn is predicated, and will otherwise be @code{NULL}. - -@var{optional-insn-attributes} is an optional vector of attributes that gets -appended to the insn attributes of the produced cond_exec rtx. It can -be used to add some distinguishing attribute to cond_exec rtxs produced -that way. An example usage would be to use this attribute in conjunction -with attributes on the main pattern to disable particular alternatives under -certain conditions. - -When @code{define_cond_exec} is used, an implicit reference to -the @code{predicable} instruction attribute is made. -@xref{Insn Attributes}. This attribute must be a boolean (i.e.@: have -exactly two elements in its @var{list-of-values}), with the possible -values being @code{no} and @code{yes}. The default and all uses in -the insns must be a simple constant, not a complex expressions. It -may, however, depend on the alternative, by using a comma-separated -list of values. If that is the case, the port should also define an -@code{enabled} attribute (@pxref{Disable Insn Alternatives}), which -should also allow only @code{no} and @code{yes} as its values. - -For each @code{define_insn} for which the @code{predicable} -attribute is true, a new @code{define_insn} pattern will be -generated that matches a predicated version of the instruction. -For example, - -@smallexample -(define_insn "addsi" - [(set (match_operand:SI 0 "register_operand" "r") - (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")))] - "@var{test1}" - "add %2,%1,%0") - -(define_cond_exec - [(ne (match_operand:CC 0 "register_operand" "c") - (const_int 0))] - "@var{test2}" - "(%0)") -@end smallexample - -@noindent -generates a new pattern - -@smallexample -(define_insn "" - [(cond_exec - (ne (match_operand:CC 3 "register_operand" "c") (const_int 0)) - (set (match_operand:SI 0 "register_operand" "r") - (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r"))))] - "(@var{test2}) && (@var{test1})" - "(%3) add %2,%1,%0") -@end smallexample - -@end ifset -@ifset INTERNALS -@node Define Subst -@section RTL Templates Transformations -@cindex define_subst - -For some hardware architectures there are common cases when the RTL -templates for the instructions can be derived from the other RTL -templates using simple transformations. E.g., @file{i386.md} contains -an RTL template for the ordinary @code{sub} instruction--- -@code{*subsi_1}, and for the @code{sub} instruction with subsequent -zero-extension---@code{*subsi_1_zext}. Such cases can be easily -implemented by a single meta-template capable of generating a modified -case based on the initial one: - -@findex define_subst -@smallexample -(define_subst "@var{name}" - [@var{input-template}] - "@var{condition}" - [@var{output-template}]) -@end smallexample -@var{input-template} is a pattern describing the source RTL template, -which will be transformed. - -@var{condition} is a C expression that is conjunct with the condition -from the input-template to generate a condition to be used in the -output-template. - -@var{output-template} is a pattern that will be used in the resulting -template. - -@code{define_subst} mechanism is tightly coupled with the notion of the -subst attribute (@pxref{Subst Iterators}). The use of -@code{define_subst} is triggered by a reference to a subst attribute in -the transforming RTL template. This reference initiates duplication of -the source RTL template and substitution of the attributes with their -values. The source RTL template is left unchanged, while the copy is -transformed by @code{define_subst}. This transformation can fail in the -case when the source RTL template is not matched against the -input-template of the @code{define_subst}. In such case the copy is -deleted. - -@code{define_subst} can be used only in @code{define_insn} and -@code{define_expand}, it cannot be used in other expressions (e.g. in -@code{define_insn_and_split}). - -@menu -* Define Subst Example:: Example of @code{define_subst} work. -* Define Subst Pattern Matching:: Process of template comparison. -* Define Subst Output Template:: Generation of output template. -@end menu - -@node Define Subst Example -@subsection @code{define_subst} Example -@cindex define_subst - -To illustrate how @code{define_subst} works, let us examine a simple -template transformation. - -Suppose there are two kinds of instructions: one that touches flags and -the other that does not. The instructions of the second type could be -generated with the following @code{define_subst}: - -@smallexample -(define_subst "add_clobber_subst" - [(set (match_operand:SI 0 "" "") - (match_operand:SI 1 "" ""))] - "" - [(set (match_dup 0) - (match_dup 1)) - (clobber (reg:CC FLAGS_REG))] -@end smallexample - -This @code{define_subst} can be applied to any RTL pattern containing -@code{set} of mode SI and generates a copy with clobber when it is -applied. - -Assume there is an RTL template for a @code{max} instruction to be used -in @code{define_subst} mentioned above: - -@smallexample -(define_insn "maxsi" - [(set (match_operand:SI 0 "register_operand" "=r") - (max:SI - (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")))] - "" - "max\t@{%2, %1, %0|%0, %1, %2@}" - [@dots{}]) -@end smallexample - -To mark the RTL template for @code{define_subst} application, -subst-attributes are used. They should be declared in advance: - -@smallexample -(define_subst_attr "add_clobber_name" "add_clobber_subst" "_noclobber" "_clobber") -@end smallexample - -Here @samp{add_clobber_name} is the attribute name, -@samp{add_clobber_subst} is the name of the corresponding -@code{define_subst}, the third argument (@samp{_noclobber}) is the -attribute value that would be substituted into the unchanged version of -the source RTL template, and the last argument (@samp{_clobber}) is the -value that would be substituted into the second, transformed, -version of the RTL template. - -Once the subst-attribute has been defined, it should be used in RTL -templates which need to be processed by the @code{define_subst}. So, -the original RTL template should be changed: - -@smallexample -(define_insn "maxsi" - [(set (match_operand:SI 0 "register_operand" "=r") - (max:SI - (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")))] - "" - "max\t@{%2, %1, %0|%0, %1, %2@}" - [@dots{}]) -@end smallexample - -The result of the @code{define_subst} usage would look like the following: - -@smallexample -(define_insn "maxsi_noclobber" - [(set (match_operand:SI 0 "register_operand" "=r") - (max:SI - (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")))] - "" - "max\t@{%2, %1, %0|%0, %1, %2@}" - [@dots{}]) -(define_insn "maxsi_clobber" - [(set (match_operand:SI 0 "register_operand" "=r") - (max:SI - (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r"))) - (clobber (reg:CC FLAGS_REG))] - "" - "max\t@{%2, %1, %0|%0, %1, %2@}" - [@dots{}]) -@end smallexample - -@node Define Subst Pattern Matching -@subsection Pattern Matching in @code{define_subst} -@cindex define_subst - -All expressions, allowed in @code{define_insn} or @code{define_expand}, -are allowed in the input-template of @code{define_subst}, except -@code{match_par_dup}, @code{match_scratch}, @code{match_parallel}. The -meanings of expressions in the input-template were changed: - -@code{match_operand} matches any expression (possibly, a subtree in -RTL-template), if modes of the @code{match_operand} and this expression -are the same, or mode of the @code{match_operand} is @code{VOIDmode}, or -this expression is @code{match_dup}, @code{match_op_dup}. If the -expression is @code{match_operand} too, and predicate of -@code{match_operand} from the input pattern is not empty, then the -predicates are compared. That can be used for more accurate filtering -of accepted RTL-templates. - -@code{match_operator} matches common operators (like @code{plus}, -@code{minus}), @code{unspec}, @code{unspec_volatile} operators and -@code{match_operator}s from the original pattern if the modes match and -@code{match_operator} from the input pattern has the same number of -operands as the operator from the original pattern. - -@node Define Subst Output Template -@subsection Generation of output template in @code{define_subst} -@cindex define_subst - -If all necessary checks for @code{define_subst} application pass, a new -RTL-pattern, based on the output-template, is created to replace the old -template. Like in input-patterns, meanings of some RTL expressions are -changed when they are used in output-patterns of a @code{define_subst}. -Thus, @code{match_dup} is used for copying the whole expression from the -original pattern, which matched corresponding @code{match_operand} from -the input pattern. - -@code{match_dup N} is used in the output template to be replaced with -the expression from the original pattern, which matched -@code{match_operand N} from the input pattern. As a consequence, -@code{match_dup} cannot be used to point to @code{match_operand}s from -the output pattern, it should always refer to a @code{match_operand} -from the input pattern. - -In the output template one can refer to the expressions from the -original pattern and create new ones. For instance, some operands could -be added by means of standard @code{match_operand}. - -After replacing @code{match_dup} with some RTL-subtree from the original -pattern, it could happen that several @code{match_operand}s in the -output pattern have the same indexes. It is unknown, how many and what -indexes would be used in the expression which would replace -@code{match_dup}, so such conflicts in indexes are inevitable. To -overcome this issue, @code{match_operands} and @code{match_operators}, -which were introduced into the output pattern, are renumerated when all -@code{match_dup}s are replaced. - -Number of alternatives in @code{match_operand}s introduced into the -output template @code{M} could differ from the number of alternatives in -the original pattern @code{N}, so in the resultant pattern there would -be @code{N*M} alternatives. Thus, constraints from the original pattern -would be duplicated @code{N} times, constraints from the output pattern -would be duplicated @code{M} times, producing all possible combinations. -@end ifset - -@ifset INTERNALS -@node Constant Definitions -@section Constant Definitions -@cindex constant definitions -@findex define_constants - -Using literal constants inside instruction patterns reduces legibility and -can be a maintenance problem. - -To overcome this problem, you may use the @code{define_constants} -expression. It contains a vector of name-value pairs. From that -point on, wherever any of the names appears in the MD file, it is as -if the corresponding value had been written instead. You may use -@code{define_constants} multiple times; each appearance adds more -constants to the table. It is an error to redefine a constant with -a different value. - -To come back to the a29k load multiple example, instead of - -@smallexample -(define_insn "" - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 1 "gpc_reg_operand" "=r") - (match_operand:SI 2 "memory_operand" "m")) - (use (reg:SI 179)) - (clobber (reg:SI 179))])] - "" - "loadm 0,0,%1,%2") -@end smallexample - -You could write: - -@smallexample -(define_constants [ - (R_BP 177) - (R_FC 178) - (R_CR 179) - (R_Q 180) -]) - -(define_insn "" - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 1 "gpc_reg_operand" "=r") - (match_operand:SI 2 "memory_operand" "m")) - (use (reg:SI R_CR)) - (clobber (reg:SI R_CR))])] - "" - "loadm 0,0,%1,%2") -@end smallexample - -The constants that are defined with a define_constant are also output -in the insn-codes.h header file as #defines. - -@cindex enumerations -@findex define_c_enum -You can also use the machine description file to define enumerations. -Like the constants defined by @code{define_constant}, these enumerations -are visible to both the machine description file and the main C code. - -The syntax is as follows: - -@smallexample -(define_c_enum "@var{name}" [ - @var{value0} - @var{value1} - @dots{} - @var{valuen} -]) -@end smallexample - -This definition causes the equivalent of the following C code to appear -in @file{insn-constants.h}: - -@smallexample -enum @var{name} @{ - @var{value0} = 0, - @var{value1} = 1, - @dots{} - @var{valuen} = @var{n} -@}; -#define NUM_@var{cname}_VALUES (@var{n} + 1) -@end smallexample - -where @var{cname} is the capitalized form of @var{name}. -It also makes each @var{valuei} available in the machine description -file, just as if it had been declared with: - -@smallexample -(define_constants [(@var{valuei} @var{i})]) -@end smallexample - -Each @var{valuei} is usually an upper-case identifier and usually -begins with @var{cname}. - -You can split the enumeration definition into as many statements as -you like. The above example is directly equivalent to: - -@smallexample -(define_c_enum "@var{name}" [@var{value0}]) -(define_c_enum "@var{name}" [@var{value1}]) -@dots{} -(define_c_enum "@var{name}" [@var{valuen}]) -@end smallexample - -Splitting the enumeration helps to improve the modularity of each -individual @code{.md} file. For example, if a port defines its -synchronization instructions in a separate @file{sync.md} file, -it is convenient to define all synchronization-specific enumeration -values in @file{sync.md} rather than in the main @file{.md} file. - -Some enumeration names have special significance to GCC: - -@table @code -@item unspecv -@findex unspec_volatile -If an enumeration called @code{unspecv} is defined, GCC will use it -when printing out @code{unspec_volatile} expressions. For example: - -@smallexample -(define_c_enum "unspecv" [ - UNSPECV_BLOCKAGE -]) -@end smallexample - -causes GCC to print @samp{(unspec_volatile @dots{} 0)} as: - -@smallexample -(unspec_volatile ... UNSPECV_BLOCKAGE) -@end smallexample - -@item unspec -@findex unspec -If an enumeration called @code{unspec} is defined, GCC will use -it when printing out @code{unspec} expressions. GCC will also use -it when printing out @code{unspec_volatile} expressions unless an -@code{unspecv} enumeration is also defined. You can therefore -decide whether to keep separate enumerations for volatile and -non-volatile expressions or whether to use the same enumeration -for both. -@end table - -@findex define_enum -@anchor{define_enum} -Another way of defining an enumeration is to use @code{define_enum}: - -@smallexample -(define_enum "@var{name}" [ - @var{value0} - @var{value1} - @dots{} - @var{valuen} -]) -@end smallexample - -This directive implies: - -@smallexample -(define_c_enum "@var{name}" [ - @var{cname}_@var{cvalue0} - @var{cname}_@var{cvalue1} - @dots{} - @var{cname}_@var{cvaluen} -]) -@end smallexample - -@findex define_enum_attr -where @var{cvaluei} is the capitalized form of @var{valuei}. -However, unlike @code{define_c_enum}, the enumerations defined -by @code{define_enum} can be used in attribute specifications -(@pxref{define_enum_attr}). -@end ifset -@ifset INTERNALS -@node Iterators -@section Iterators -@cindex iterators in @file{.md} files - -Ports often need to define similar patterns for more than one machine -mode or for more than one rtx code. GCC provides some simple iterator -facilities to make this process easier. - -@menu -* Mode Iterators:: Generating variations of patterns for different modes. -* Code Iterators:: Doing the same for codes. -* Int Iterators:: Doing the same for integers. -* Subst Iterators:: Generating variations of patterns for define_subst. -@end menu - -@node Mode Iterators -@subsection Mode Iterators -@cindex mode iterators in @file{.md} files - -Ports often need to define similar patterns for two or more different modes. -For example: - -@itemize @bullet -@item -If a processor has hardware support for both single and double -floating-point arithmetic, the @code{SFmode} patterns tend to be -very similar to the @code{DFmode} ones. - -@item -If a port uses @code{SImode} pointers in one configuration and -@code{DImode} pointers in another, it will usually have very similar -@code{SImode} and @code{DImode} patterns for manipulating pointers. -@end itemize - -Mode iterators allow several patterns to be instantiated from one -@file{.md} file template. They can be used with any type of -rtx-based construct, such as a @code{define_insn}, -@code{define_split}, or @code{define_peephole2}. - -@menu -* Defining Mode Iterators:: Defining a new mode iterator. -* Substitutions:: Combining mode iterators with substitutions -* Examples:: Examples -@end menu - -@node Defining Mode Iterators -@subsubsection Defining Mode Iterators -@findex define_mode_iterator - -The syntax for defining a mode iterator is: - -@smallexample -(define_mode_iterator @var{name} [(@var{mode1} "@var{cond1}") @dots{} (@var{moden} "@var{condn}")]) -@end smallexample - -This allows subsequent @file{.md} file constructs to use the mode suffix -@code{:@var{name}}. Every construct that does so will be expanded -@var{n} times, once with every use of @code{:@var{name}} replaced by -@code{:@var{mode1}}, once with every use replaced by @code{:@var{mode2}}, -and so on. In the expansion for a particular @var{modei}, every -C condition will also require that @var{condi} be true. - -For example: - -@smallexample -(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) -@end smallexample - -defines a new mode suffix @code{:P}. Every construct that uses -@code{:P} will be expanded twice, once with every @code{:P} replaced -by @code{:SI} and once with every @code{:P} replaced by @code{:DI}. -The @code{:SI} version will only apply if @code{Pmode == SImode} and -the @code{:DI} version will only apply if @code{Pmode == DImode}. - -As with other @file{.md} conditions, an empty string is treated -as ``always true''. @code{(@var{mode} "")} can also be abbreviated -to @code{@var{mode}}. For example: - -@smallexample -(define_mode_iterator GPR [SI (DI "TARGET_64BIT")]) -@end smallexample - -means that the @code{:DI} expansion only applies if @code{TARGET_64BIT} -but that the @code{:SI} expansion has no such constraint. - -Iterators are applied in the order they are defined. This can be -significant if two iterators are used in a construct that requires -substitutions. @xref{Substitutions}. - -@node Substitutions -@subsubsection Substitution in Mode Iterators -@findex define_mode_attr - -If an @file{.md} file construct uses mode iterators, each version of the -construct will often need slightly different strings or modes. For -example: - -@itemize @bullet -@item -When a @code{define_expand} defines several @code{add@var{m}3} patterns -(@pxref{Standard Names}), each expander will need to use the -appropriate mode name for @var{m}. - -@item -When a @code{define_insn} defines several instruction patterns, -each instruction will often use a different assembler mnemonic. - -@item -When a @code{define_insn} requires operands with different modes, -using an iterator for one of the operand modes usually requires a specific -mode for the other operand(s). -@end itemize - -GCC supports such variations through a system of ``mode attributes''. -There are two standard attributes: @code{mode}, which is the name of -the mode in lower case, and @code{MODE}, which is the same thing in -upper case. You can define other attributes using: - -@smallexample -(define_mode_attr @var{name} [(@var{mode1} "@var{value1}") @dots{} (@var{moden} "@var{valuen}")]) -@end smallexample - -where @var{name} is the name of the attribute and @var{valuei} -is the value associated with @var{modei}. - -When GCC replaces some @var{:iterator} with @var{:mode}, it will scan -each string and mode in the pattern for sequences of the form -@code{<@var{iterator}:@var{attr}>}, where @var{attr} is the name of a -mode attribute. If the attribute is defined for @var{mode}, the whole -@code{<@dots{}>} sequence will be replaced by the appropriate attribute -value. - -For example, suppose an @file{.md} file has: - -@smallexample -(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) -(define_mode_attr load [(SI "lw") (DI "ld")]) -@end smallexample - -If one of the patterns that uses @code{:P} contains the string -@code{"\t%0,%1"}, the @code{SI} version of that pattern -will use @code{"lw\t%0,%1"} and the @code{DI} version will use -@code{"ld\t%0,%1"}. - -Here is an example of using an attribute for a mode: - -@smallexample -(define_mode_iterator LONG [SI DI]) -(define_mode_attr SHORT [(SI "HI") (DI "SI")]) -(define_insn @dots{} - (sign_extend:LONG (match_operand: @dots{})) @dots{}) -@end smallexample - -The @code{@var{iterator}:} prefix may be omitted, in which case the -substitution will be attempted for every iterator expansion. - -@node Examples -@subsubsection Mode Iterator Examples - -Here is an example from the MIPS port. It defines the following -modes and attributes (among others): - -@smallexample -(define_mode_iterator GPR [SI (DI "TARGET_64BIT")]) -(define_mode_attr d [(SI "") (DI "d")]) -@end smallexample - -and uses the following template to define both @code{subsi3} -and @code{subdi3}: - -@smallexample -(define_insn "sub3" - [(set (match_operand:GPR 0 "register_operand" "=d") - (minus:GPR (match_operand:GPR 1 "register_operand" "d") - (match_operand:GPR 2 "register_operand" "d")))] - "" - "subu\t%0,%1,%2" - [(set_attr "type" "arith") - (set_attr "mode" "")]) -@end smallexample - -This is exactly equivalent to: - -@smallexample -(define_insn "subsi3" - [(set (match_operand:SI 0 "register_operand" "=d") - (minus:SI (match_operand:SI 1 "register_operand" "d") - (match_operand:SI 2 "register_operand" "d")))] - "" - "subu\t%0,%1,%2" - [(set_attr "type" "arith") - (set_attr "mode" "SI")]) - -(define_insn "subdi3" - [(set (match_operand:DI 0 "register_operand" "=d") - (minus:DI (match_operand:DI 1 "register_operand" "d") - (match_operand:DI 2 "register_operand" "d")))] - "" - "dsubu\t%0,%1,%2" - [(set_attr "type" "arith") - (set_attr "mode" "DI")]) -@end smallexample - -@node Code Iterators -@subsection Code Iterators -@cindex code iterators in @file{.md} files -@findex define_code_iterator -@findex define_code_attr - -Code iterators operate in a similar way to mode iterators. @xref{Mode Iterators}. - -The construct: - -@smallexample -(define_code_iterator @var{name} [(@var{code1} "@var{cond1}") @dots{} (@var{coden} "@var{condn}")]) -@end smallexample - -defines a pseudo rtx code @var{name} that can be instantiated as -@var{codei} if condition @var{condi} is true. Each @var{codei} -must have the same rtx format. @xref{RTL Classes}. - -As with mode iterators, each pattern that uses @var{name} will be -expanded @var{n} times, once with all uses of @var{name} replaced by -@var{code1}, once with all uses replaced by @var{code2}, and so on. -@xref{Defining Mode Iterators}. - -It is possible to define attributes for codes as well as for modes. -There are two standard code attributes: @code{code}, the name of the -code in lower case, and @code{CODE}, the name of the code in upper case. -Other attributes are defined using: - -@smallexample -(define_code_attr @var{name} [(@var{code1} "@var{value1}") @dots{} (@var{coden} "@var{valuen}")]) -@end smallexample - -Here's an example of code iterators in action, taken from the MIPS port: - -@smallexample -(define_code_iterator any_cond [unordered ordered unlt unge uneq ltgt unle ungt - eq ne gt ge lt le gtu geu ltu leu]) - -(define_expand "b" - [(set (pc) - (if_then_else (any_cond:CC (cc0) - (const_int 0)) - (label_ref (match_operand 0 "")) - (pc)))] - "" -@{ - gen_conditional_branch (operands, ); - DONE; -@}) -@end smallexample - -This is equivalent to: - -@smallexample -(define_expand "bunordered" - [(set (pc) - (if_then_else (unordered:CC (cc0) - (const_int 0)) - (label_ref (match_operand 0 "")) - (pc)))] - "" -@{ - gen_conditional_branch (operands, UNORDERED); - DONE; -@}) - -(define_expand "bordered" - [(set (pc) - (if_then_else (ordered:CC (cc0) - (const_int 0)) - (label_ref (match_operand 0 "")) - (pc)))] - "" -@{ - gen_conditional_branch (operands, ORDERED); - DONE; -@}) - -@dots{} -@end smallexample - -@node Int Iterators -@subsection Int Iterators -@cindex int iterators in @file{.md} files -@findex define_int_iterator -@findex define_int_attr - -Int iterators operate in a similar way to code iterators. @xref{Code Iterators}. - -The construct: - -@smallexample -(define_int_iterator @var{name} [(@var{int1} "@var{cond1}") @dots{} (@var{intn} "@var{condn}")]) -@end smallexample - -defines a pseudo integer constant @var{name} that can be instantiated as -@var{inti} if condition @var{condi} is true. Each @var{int} -must have the same rtx format. @xref{RTL Classes}. Int iterators can appear -in only those rtx fields that have 'i' as the specifier. This means that -each @var{int} has to be a constant defined using define_constant or -define_c_enum. - -As with mode and code iterators, each pattern that uses @var{name} will be -expanded @var{n} times, once with all uses of @var{name} replaced by -@var{int1}, once with all uses replaced by @var{int2}, and so on. -@xref{Defining Mode Iterators}. - -It is possible to define attributes for ints as well as for codes and modes. -Attributes are defined using: - -@smallexample -(define_int_attr @var{name} [(@var{int1} "@var{value1}") @dots{} (@var{intn} "@var{valuen}")]) -@end smallexample - -Here's an example of int iterators in action, taken from the ARM port: - -@smallexample -(define_int_iterator QABSNEG [UNSPEC_VQABS UNSPEC_VQNEG]) - -(define_int_attr absneg [(UNSPEC_VQABS "abs") (UNSPEC_VQNEG "neg")]) - -(define_insn "neon_vq" - [(set (match_operand:VDQIW 0 "s_register_operand" "=w") - (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") - (match_operand:SI 2 "immediate_operand" "i")] - QABSNEG))] - "TARGET_NEON" - "vq.\t%0, %1" - [(set_attr "type" "neon_vqneg_vqabs")] -) - -@end smallexample - -This is equivalent to: - -@smallexample -(define_insn "neon_vqabs" - [(set (match_operand:VDQIW 0 "s_register_operand" "=w") - (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") - (match_operand:SI 2 "immediate_operand" "i")] - UNSPEC_VQABS))] - "TARGET_NEON" - "vqabs.\t%0, %1" - [(set_attr "type" "neon_vqneg_vqabs")] -) - -(define_insn "neon_vqneg" - [(set (match_operand:VDQIW 0 "s_register_operand" "=w") - (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") - (match_operand:SI 2 "immediate_operand" "i")] - UNSPEC_VQNEG))] - "TARGET_NEON" - "vqneg.\t%0, %1" - [(set_attr "type" "neon_vqneg_vqabs")] -) - -@end smallexample - -@node Subst Iterators -@subsection Subst Iterators -@cindex subst iterators in @file{.md} files -@findex define_subst -@findex define_subst_attr - -Subst iterators are special type of iterators with the following -restrictions: they could not be declared explicitly, they always have -only two values, and they do not have explicit dedicated name. -Subst-iterators are triggered only when corresponding subst-attribute is -used in RTL-pattern. - -Subst iterators transform templates in the following way: the templates -are duplicated, the subst-attributes in these templates are replaced -with the corresponding values, and a new attribute is implicitly added -to the given @code{define_insn}/@code{define_expand}. The name of the -added attribute matches the name of @code{define_subst}. Such -attributes are declared implicitly, and it is not allowed to have a -@code{define_attr} named as a @code{define_subst}. - -Each subst iterator is linked to a @code{define_subst}. It is declared -implicitly by the first appearance of the corresponding -@code{define_subst_attr}, and it is not allowed to define it explicitly. - -Declarations of subst-attributes have the following syntax: - -@findex define_subst_attr -@smallexample -(define_subst_attr "@var{name}" - "@var{subst-name}" - "@var{no-subst-value}" - "@var{subst-applied-value}") -@end smallexample - -@var{name} is a string with which the given subst-attribute could be -referred to. - -@var{subst-name} shows which @code{define_subst} should be applied to an -RTL-template if the given subst-attribute is present in the -RTL-template. - -@var{no-subst-value} is a value with which subst-attribute would be -replaced in the first copy of the original RTL-template. - -@var{subst-applied-value} is a value with which subst-attribute would be -replaced in the second copy of the original RTL-template. - -@end ifset diff --git a/contrib/gcc-5.0/gcc/doc/objc.texi b/contrib/gcc-5.0/gcc/doc/objc.texi deleted file mode 100644 index 5588f67da5..0000000000 --- a/contrib/gcc-5.0/gcc/doc/objc.texi +++ /dev/null @@ -1,1210 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Objective-C -@comment node-name, next, previous, up - -@chapter GNU Objective-C Features - -This document is meant to describe some of the GNU Objective-C -features. It is not intended to teach you Objective-C. There are -several resources on the Internet that present the language. - -@menu -* GNU Objective-C runtime API:: -* Executing code before main:: -* Type encoding:: -* Garbage Collection:: -* Constant string objects:: -* compatibility_alias:: -* Exceptions:: -* Synchronization:: -* Fast enumeration:: -* Messaging with the GNU Objective-C runtime:: -@end menu - -@c ========================================================================= -@node GNU Objective-C runtime API -@section GNU Objective-C Runtime API - -This section is specific for the GNU Objective-C runtime. If you are -using a different runtime, you can skip it. - -The GNU Objective-C runtime provides an API that allows you to -interact with the Objective-C runtime system, querying the live -runtime structures and even manipulating them. This allows you for -example to inspect and navigate classes, methods and protocols; to -define new classes or new methods, and even to modify existing classes -or protocols. - -If you are using a ``Foundation'' library such as GNUstep-Base, this -library will provide you with a rich set of functionality to do most -of the inspection tasks, and you probably will only need direct access -to the GNU Objective-C runtime API to define new classes or methods. - -@menu -* Modern GNU Objective-C runtime API:: -* Traditional GNU Objective-C runtime API:: -@end menu - -@c ========================================================================= -@node Modern GNU Objective-C runtime API -@subsection Modern GNU Objective-C Runtime API - -The GNU Objective-C runtime provides an API which is similar to the -one provided by the ``Objective-C 2.0'' Apple/NeXT Objective-C -runtime. The API is documented in the public header files of the GNU -Objective-C runtime: - -@itemize @bullet - -@item -@file{objc/objc.h}: this is the basic Objective-C header file, -defining the basic Objective-C types such as @code{id}, @code{Class} -and @code{BOOL}. You have to include this header to do almost -anything with Objective-C. - -@item -@file{objc/runtime.h}: this header declares most of the public runtime -API functions allowing you to inspect and manipulate the Objective-C -runtime data structures. These functions are fairly standardized -across Objective-C runtimes and are almost identical to the Apple/NeXT -Objective-C runtime ones. It does not declare functions in some -specialized areas (constructing and forwarding message invocations, -threading) which are in the other headers below. You have to include -@file{objc/objc.h} and @file{objc/runtime.h} to use any of the -functions, such as @code{class_getName()}, declared in -@file{objc/runtime.h}. - -@item -@file{objc/message.h}: this header declares public functions used to -construct, deconstruct and forward message invocations. Because -messaging is done in quite a different way on different runtimes, -functions in this header are specific to the GNU Objective-C runtime -implementation. - -@item -@file{objc/objc-exception.h}: this header declares some public -functions related to Objective-C exceptions. For example functions in -this header allow you to throw an Objective-C exception from plain -C/C++ code. - -@item -@file{objc/objc-sync.h}: this header declares some public functions -related to the Objective-C @code{@@synchronized()} syntax, allowing -you to emulate an Objective-C @code{@@synchronized()} block in plain -C/C++ code. - -@item -@file{objc/thr.h}: this header declares a public runtime API threading -layer that is only provided by the GNU Objective-C runtime. It -declares functions such as @code{objc_mutex_lock()}, which provide a -platform-independent set of threading functions. - -@end itemize - -The header files contain detailed documentation for each function in -the GNU Objective-C runtime API. - -@c ========================================================================= -@node Traditional GNU Objective-C runtime API -@subsection Traditional GNU Objective-C Runtime API - -The GNU Objective-C runtime used to provide a different API, which we -call the ``traditional'' GNU Objective-C runtime API. Functions -belonging to this API are easy to recognize because they use a -different naming convention, such as @code{class_get_super_class()} -(traditional API) instead of @code{class_getSuperclass()} (modern -API). Software using this API includes the file -@file{objc/objc-api.h} where it is declared. - -Starting with GCC 4.7.0, the traditional GNU runtime API is no longer -available. - -@c ========================================================================= -@node Executing code before main -@section @code{+load}: Executing Code before @code{main} - -This section is specific for the GNU Objective-C runtime. If you are -using a different runtime, you can skip it. - -The GNU Objective-C runtime provides a way that allows you to execute -code before the execution of the program enters the @code{main} -function. The code is executed on a per-class and a per-category basis, -through a special class method @code{+load}. - -This facility is very useful if you want to initialize global variables -which can be accessed by the program directly, without sending a message -to the class first. The usual way to initialize global variables, in the -@code{+initialize} method, might not be useful because -@code{+initialize} is only called when the first message is sent to a -class object, which in some cases could be too late. - -Suppose for example you have a @code{FileStream} class that declares -@code{Stdin}, @code{Stdout} and @code{Stderr} as global variables, like -below: - -@smallexample - -FileStream *Stdin = nil; -FileStream *Stdout = nil; -FileStream *Stderr = nil; - -@@implementation FileStream - -+ (void)initialize -@{ - Stdin = [[FileStream new] initWithFd:0]; - Stdout = [[FileStream new] initWithFd:1]; - Stderr = [[FileStream new] initWithFd:2]; -@} - -/* @r{Other methods here} */ -@@end - -@end smallexample - -In this example, the initialization of @code{Stdin}, @code{Stdout} and -@code{Stderr} in @code{+initialize} occurs too late. The programmer can -send a message to one of these objects before the variables are actually -initialized, thus sending messages to the @code{nil} object. The -@code{+initialize} method which actually initializes the global -variables is not invoked until the first message is sent to the class -object. The solution would require these variables to be initialized -just before entering @code{main}. - -The correct solution of the above problem is to use the @code{+load} -method instead of @code{+initialize}: - -@smallexample - -@@implementation FileStream - -+ (void)load -@{ - Stdin = [[FileStream new] initWithFd:0]; - Stdout = [[FileStream new] initWithFd:1]; - Stderr = [[FileStream new] initWithFd:2]; -@} - -/* @r{Other methods here} */ -@@end - -@end smallexample - -The @code{+load} is a method that is not overridden by categories. If a -class and a category of it both implement @code{+load}, both methods are -invoked. This allows some additional initializations to be performed in -a category. - -This mechanism is not intended to be a replacement for @code{+initialize}. -You should be aware of its limitations when you decide to use it -instead of @code{+initialize}. - -@menu -* What you can and what you cannot do in +load:: -@end menu - - -@node What you can and what you cannot do in +load -@subsection What You Can and Cannot Do in @code{+load} - -@code{+load} is to be used only as a last resort. Because it is -executed very early, most of the Objective-C runtime machinery will -not be ready when @code{+load} is executed; hence @code{+load} works -best for executing C code that is independent on the Objective-C -runtime. - -The @code{+load} implementation in the GNU runtime guarantees you the -following things: - -@itemize @bullet - -@item -you can write whatever C code you like; - -@item -you can allocate and send messages to objects whose class is implemented -in the same file; - -@item -the @code{+load} implementation of all super classes of a class are -executed before the @code{+load} of that class is executed; - -@item -the @code{+load} implementation of a class is executed before the -@code{+load} implementation of any category. - -@end itemize - -In particular, the following things, even if they can work in a -particular case, are not guaranteed: - -@itemize @bullet - -@item -allocation of or sending messages to arbitrary objects; - -@item -allocation of or sending messages to objects whose classes have a -category implemented in the same file; - -@item -sending messages to Objective-C constant strings (@code{@@"this is a -constant string"}); - -@end itemize - -You should make no assumptions about receiving @code{+load} in sibling -classes when you write @code{+load} of a class. The order in which -sibling classes receive @code{+load} is not guaranteed. - -The order in which @code{+load} and @code{+initialize} are called could -be problematic if this matters. If you don't allocate objects inside -@code{+load}, it is guaranteed that @code{+load} is called before -@code{+initialize}. If you create an object inside @code{+load} the -@code{+initialize} method of object's class is invoked even if -@code{+load} was not invoked. Note if you explicitly call @code{+load} -on a class, @code{+initialize} will be called first. To avoid possible -problems try to implement only one of these methods. - -The @code{+load} method is also invoked when a bundle is dynamically -loaded into your running program. This happens automatically without any -intervening operation from you. When you write bundles and you need to -write @code{+load} you can safely create and send messages to objects whose -classes already exist in the running program. The same restrictions as -above apply to classes defined in bundle. - - - -@node Type encoding -@section Type Encoding - -This is an advanced section. Type encodings are used extensively by -the compiler and by the runtime, but you generally do not need to know -about them to use Objective-C. - -The Objective-C compiler generates type encodings for all the types. -These type encodings are used at runtime to find out information about -selectors and methods and about objects and classes. - -The types are encoded in the following way: - -@c @sp 1 - -@multitable @columnfractions .25 .75 -@item @code{_Bool} -@tab @code{B} -@item @code{char} -@tab @code{c} -@item @code{unsigned char} -@tab @code{C} -@item @code{short} -@tab @code{s} -@item @code{unsigned short} -@tab @code{S} -@item @code{int} -@tab @code{i} -@item @code{unsigned int} -@tab @code{I} -@item @code{long} -@tab @code{l} -@item @code{unsigned long} -@tab @code{L} -@item @code{long long} -@tab @code{q} -@item @code{unsigned long long} -@tab @code{Q} -@item @code{float} -@tab @code{f} -@item @code{double} -@tab @code{d} -@item @code{long double} -@tab @code{D} -@item @code{void} -@tab @code{v} -@item @code{id} -@tab @code{@@} -@item @code{Class} -@tab @code{#} -@item @code{SEL} -@tab @code{:} -@item @code{char*} -@tab @code{*} -@item @code{enum} -@tab an @code{enum} is encoded exactly as the integer type that the compiler uses for it, which depends on the enumeration -values. Often the compiler users @code{unsigned int}, which is then encoded as @code{I}. -@item unknown type -@tab @code{?} -@item Complex types -@tab @code{j} followed by the inner type. For example @code{_Complex double} is encoded as "jd". -@item bit-fields -@tab @code{b} followed by the starting position of the bit-field, the type of the bit-field and the size of the bit-field (the bit-fields encoding was changed from the NeXT's compiler encoding, see below) -@end multitable - -@c @sp 1 - -The encoding of bit-fields has changed to allow bit-fields to be -properly handled by the runtime functions that compute sizes and -alignments of types that contain bit-fields. The previous encoding -contained only the size of the bit-field. Using only this information -it is not possible to reliably compute the size occupied by the -bit-field. This is very important in the presence of the Boehm's -garbage collector because the objects are allocated using the typed -memory facility available in this collector. The typed memory -allocation requires information about where the pointers are located -inside the object. - -The position in the bit-field is the position, counting in bits, of the -bit closest to the beginning of the structure. - -The non-atomic types are encoded as follows: - -@c @sp 1 - -@multitable @columnfractions .2 .8 -@item pointers -@tab @samp{^} followed by the pointed type. -@item arrays -@tab @samp{[} followed by the number of elements in the array followed by the type of the elements followed by @samp{]} -@item structures -@tab @samp{@{} followed by the name of the structure (or @samp{?} if the structure is unnamed), the @samp{=} sign, the type of the members and by @samp{@}} -@item unions -@tab @samp{(} followed by the name of the structure (or @samp{?} if the union is unnamed), the @samp{=} sign, the type of the members followed by @samp{)} -@item vectors -@tab @samp{![} followed by the vector_size (the number of bytes composing the vector) followed by a comma, followed by the alignment (in bytes) of the vector, followed by the type of the elements followed by @samp{]} -@end multitable - -Here are some types and their encodings, as they are generated by the -compiler on an i386 machine: - -@sp 1 - -@multitable @columnfractions .25 .75 -@item Objective-C type -@tab Compiler encoding -@item -@smallexample -int a[10]; -@end smallexample -@tab @code{[10i]} -@item -@smallexample -struct @{ - int i; - float f[3]; - int a:3; - int b:2; - char c; -@} -@end smallexample -@tab @code{@{?=i[3f]b128i3b131i2c@}} -@item -@smallexample -int a __attribute__ ((vector_size (16))); -@end smallexample -@tab @code{![16,16i]} (alignment would depend on the machine) -@end multitable - -@sp 1 - -In addition to the types the compiler also encodes the type -specifiers. The table below describes the encoding of the current -Objective-C type specifiers: - -@sp 1 - -@multitable @columnfractions .25 .75 -@item Specifier -@tab Encoding -@item @code{const} -@tab @code{r} -@item @code{in} -@tab @code{n} -@item @code{inout} -@tab @code{N} -@item @code{out} -@tab @code{o} -@item @code{bycopy} -@tab @code{O} -@item @code{byref} -@tab @code{R} -@item @code{oneway} -@tab @code{V} -@end multitable - -@sp 1 - -The type specifiers are encoded just before the type. Unlike types -however, the type specifiers are only encoded when they appear in method -argument types. - -Note how @code{const} interacts with pointers: - -@sp 1 - -@multitable @columnfractions .25 .75 -@item Objective-C type -@tab Compiler encoding -@item -@smallexample -const int -@end smallexample -@tab @code{ri} -@item -@smallexample -const int* -@end smallexample -@tab @code{^ri} -@item -@smallexample -int *const -@end smallexample -@tab @code{r^i} -@end multitable - -@sp 1 - -@code{const int*} is a pointer to a @code{const int}, and so is -encoded as @code{^ri}. @code{int* const}, instead, is a @code{const} -pointer to an @code{int}, and so is encoded as @code{r^i}. - -Finally, there is a complication when encoding @code{const char *} -versus @code{char * const}. Because @code{char *} is encoded as -@code{*} and not as @code{^c}, there is no way to express the fact -that @code{r} applies to the pointer or to the pointee. - -Hence, it is assumed as a convention that @code{r*} means @code{const -char *} (since it is what is most often meant), and there is no way to -encode @code{char *const}. @code{char *const} would simply be encoded -as @code{*}, and the @code{const} is lost. - -@menu -* Legacy type encoding:: -* @@encode:: -* Method signatures:: -@end menu - -@node Legacy type encoding -@subsection Legacy Type Encoding - -Unfortunately, historically GCC used to have a number of bugs in its -encoding code. The NeXT runtime expects GCC to emit type encodings in -this historical format (compatible with GCC-3.3), so when using the -NeXT runtime, GCC will introduce on purpose a number of incorrect -encodings: - -@itemize @bullet - -@item -the read-only qualifier of the pointee gets emitted before the '^'. -The read-only qualifier of the pointer itself gets ignored, unless it -is a typedef. Also, the 'r' is only emitted for the outermost type. - -@item -32-bit longs are encoded as 'l' or 'L', but not always. For typedefs, -the compiler uses 'i' or 'I' instead if encoding a struct field or a -pointer. - -@item -@code{enum}s are always encoded as 'i' (int) even if they are actually -unsigned or long. - -@end itemize - -In addition to that, the NeXT runtime uses a different encoding for -bitfields. It encodes them as @code{b} followed by the size, without -a bit offset or the underlying field type. - -@node @@encode -@subsection @code{@@encode} - -GNU Objective-C supports the @code{@@encode} syntax that allows you to -create a type encoding from a C/Objective-C type. For example, -@code{@@encode(int)} is compiled by the compiler into @code{"i"}. - -@code{@@encode} does not support type qualifiers other than -@code{const}. For example, @code{@@encode(const char*)} is valid and -is compiled into @code{"r*"}, while @code{@@encode(bycopy char *)} is -invalid and will cause a compilation error. - -@node Method signatures -@subsection Method Signatures - -This section documents the encoding of method types, which is rarely -needed to use Objective-C. You should skip it at a first reading; the -runtime provides functions that will work on methods and can walk -through the list of parameters and interpret them for you. These -functions are part of the public ``API'' and are the preferred way to -interact with method signatures from user code. - -But if you need to debug a problem with method signatures and need to -know how they are implemented (i.e., the ``ABI''), read on. - -Methods have their ``signature'' encoded and made available to the -runtime. The ``signature'' encodes all the information required to -dynamically build invocations of the method at runtime: return type -and arguments. - -The ``signature'' is a null-terminated string, composed of the following: - -@itemize @bullet - -@item -The return type, including type qualifiers. For example, a method -returning @code{int} would have @code{i} here. - -@item -The total size (in bytes) required to pass all the parameters. This -includes the two hidden parameters (the object @code{self} and the -method selector @code{_cmd}). - -@item -Each argument, with the type encoding, followed by the offset (in -bytes) of the argument in the list of parameters. - -@end itemize - -For example, a method with no arguments and returning @code{int} would -have the signature @code{i8@@0:4} if the size of a pointer is 4. The -signature is interpreted as follows: the @code{i} is the return type -(an @code{int}), the @code{8} is the total size of the parameters in -bytes (two pointers each of size 4), the @code{@@0} is the first -parameter (an object at byte offset @code{0}) and @code{:4} is the -second parameter (a @code{SEL} at byte offset @code{4}). - -You can easily find more examples by running the ``strings'' program -on an Objective-C object file compiled by GCC. You'll see a lot of -strings that look very much like @code{i8@@0:4}. They are signatures -of Objective-C methods. - - -@node Garbage Collection -@section Garbage Collection - -This section is specific for the GNU Objective-C runtime. If you are -using a different runtime, you can skip it. - -Support for garbage collection with the GNU runtime has been added by -using a powerful conservative garbage collector, known as the -Boehm-Demers-Weiser conservative garbage collector. - -To enable the support for it you have to configure the compiler using -an additional argument, @w{@option{--enable-objc-gc}}. This will -build the boehm-gc library, and build an additional runtime library -which has several enhancements to support the garbage collector. The -new library has a new name, @file{libobjc_gc.a} to not conflict with -the non-garbage-collected library. - -When the garbage collector is used, the objects are allocated using the -so-called typed memory allocation mechanism available in the -Boehm-Demers-Weiser collector. This mode requires precise information on -where pointers are located inside objects. This information is computed -once per class, immediately after the class has been initialized. - -There is a new runtime function @code{class_ivar_set_gcinvisible()} -which can be used to declare a so-called @dfn{weak pointer} -reference. Such a pointer is basically hidden for the garbage collector; -this can be useful in certain situations, especially when you want to -keep track of the allocated objects, yet allow them to be -collected. This kind of pointers can only be members of objects, you -cannot declare a global pointer as a weak reference. Every type which is -a pointer type can be declared a weak pointer, including @code{id}, -@code{Class} and @code{SEL}. - -Here is an example of how to use this feature. Suppose you want to -implement a class whose instances hold a weak pointer reference; the -following class does this: - -@smallexample - -@@interface WeakPointer : Object -@{ - const void* weakPointer; -@} - -- initWithPointer:(const void*)p; -- (const void*)weakPointer; -@@end - - -@@implementation WeakPointer - -+ (void)initialize -@{ - if (self == objc_lookUpClass ("WeakPointer")) - class_ivar_set_gcinvisible (self, "weakPointer", YES); -@} - -- initWithPointer:(const void*)p -@{ - weakPointer = p; - return self; -@} - -- (const void*)weakPointer -@{ - return weakPointer; -@} - -@@end - -@end smallexample - -Weak pointers are supported through a new type character specifier -represented by the @samp{!} character. The -@code{class_ivar_set_gcinvisible()} function adds or removes this -specifier to the string type description of the instance variable named -as argument. - -@c ========================================================================= -@node Constant string objects -@section Constant String Objects - -GNU Objective-C provides constant string objects that are generated -directly by the compiler. You declare a constant string object by -prefixing a C constant string with the character @samp{@@}: - -@smallexample - id myString = @@"this is a constant string object"; -@end smallexample - -The constant string objects are by default instances of the -@code{NXConstantString} class which is provided by the GNU Objective-C -runtime. To get the definition of this class you must include the -@file{objc/NXConstStr.h} header file. - -User defined libraries may want to implement their own constant string -class. To be able to support them, the GNU Objective-C compiler provides -a new command line options @option{-fconstant-string-class=@var{class-name}}. -The provided class should adhere to a strict structure, the same -as @code{NXConstantString}'s structure: - -@smallexample - -@@interface MyConstantStringClass -@{ - Class isa; - char *c_string; - unsigned int len; -@} -@@end - -@end smallexample - -@code{NXConstantString} inherits from @code{Object}; user class -libraries may choose to inherit the customized constant string class -from a different class than @code{Object}. There is no requirement in -the methods the constant string class has to implement, but the final -ivar layout of the class must be the compatible with the given -structure. - -When the compiler creates the statically allocated constant string -object, the @code{c_string} field will be filled by the compiler with -the string; the @code{length} field will be filled by the compiler with -the string length; the @code{isa} pointer will be filled with -@code{NULL} by the compiler, and it will later be fixed up automatically -at runtime by the GNU Objective-C runtime library to point to the class -which was set by the @option{-fconstant-string-class} option when the -object file is loaded (if you wonder how it works behind the scenes, the -name of the class to use, and the list of static objects to fixup, are -stored by the compiler in the object file in a place where the GNU -runtime library will find them at runtime). - -As a result, when a file is compiled with the -@option{-fconstant-string-class} option, all the constant string objects -will be instances of the class specified as argument to this option. It -is possible to have multiple compilation units referring to different -constant string classes, neither the compiler nor the linker impose any -restrictions in doing this. - -@c ========================================================================= -@node compatibility_alias -@section @code{compatibility_alias} - -The keyword @code{@@compatibility_alias} allows you to define a class name -as equivalent to another class name. For example: - -@smallexample -@@compatibility_alias WOApplication GSWApplication; -@end smallexample - -tells the compiler that each time it encounters @code{WOApplication} as -a class name, it should replace it with @code{GSWApplication} (that is, -@code{WOApplication} is just an alias for @code{GSWApplication}). - -There are some constraints on how this can be used--- - -@itemize @bullet - -@item @code{WOApplication} (the alias) must not be an existing class; - -@item @code{GSWApplication} (the real class) must be an existing class. - -@end itemize - -@c ========================================================================= -@node Exceptions -@section Exceptions - -GNU Objective-C provides exception support built into the language, as -in the following example: - -@smallexample - @@try @{ - @dots{} - @@throw expr; - @dots{} - @} - @@catch (AnObjCClass *exc) @{ - @dots{} - @@throw expr; - @dots{} - @@throw; - @dots{} - @} - @@catch (AnotherClass *exc) @{ - @dots{} - @} - @@catch (id allOthers) @{ - @dots{} - @} - @@finally @{ - @dots{} - @@throw expr; - @dots{} - @} -@end smallexample - -The @code{@@throw} statement may appear anywhere in an Objective-C or -Objective-C++ program; when used inside of a @code{@@catch} block, the -@code{@@throw} may appear without an argument (as shown above), in -which case the object caught by the @code{@@catch} will be rethrown. - -Note that only (pointers to) Objective-C objects may be thrown and -caught using this scheme. When an object is thrown, it will be caught -by the nearest @code{@@catch} clause capable of handling objects of -that type, analogously to how @code{catch} blocks work in C++ and -Java. A @code{@@catch(id @dots{})} clause (as shown above) may also -be provided to catch any and all Objective-C exceptions not caught by -previous @code{@@catch} clauses (if any). - -The @code{@@finally} clause, if present, will be executed upon exit -from the immediately preceding @code{@@try @dots{} @@catch} section. -This will happen regardless of whether any exceptions are thrown, -caught or rethrown inside the @code{@@try @dots{} @@catch} section, -analogously to the behavior of the @code{finally} clause in Java. - -There are several caveats to using the new exception mechanism: - -@itemize @bullet -@item -The @option{-fobjc-exceptions} command line option must be used when -compiling Objective-C files that use exceptions. - -@item -With the GNU runtime, exceptions are always implemented as ``native'' -exceptions and it is recommended that the @option{-fexceptions} and -@option{-shared-libgcc} options are used when linking. - -@item -With the NeXT runtime, although currently designed to be binary -compatible with @code{NS_HANDLER}-style idioms provided by the -@code{NSException} class, the new exceptions can only be used on Mac -OS X 10.3 (Panther) and later systems, due to additional functionality -needed in the NeXT Objective-C runtime. - -@item -As mentioned above, the new exceptions do not support handling -types other than Objective-C objects. Furthermore, when used from -Objective-C++, the Objective-C exception model does not interoperate with C++ -exceptions at this time. This means you cannot @code{@@throw} an exception -from Objective-C and @code{catch} it in C++, or vice versa -(i.e., @code{throw @dots{} @@catch}). -@end itemize - -@c ========================================================================= -@node Synchronization -@section Synchronization - -GNU Objective-C provides support for synchronized blocks: - -@smallexample - @@synchronized (ObjCClass *guard) @{ - @dots{} - @} -@end smallexample - -Upon entering the @code{@@synchronized} block, a thread of execution -shall first check whether a lock has been placed on the corresponding -@code{guard} object by another thread. If it has, the current thread -shall wait until the other thread relinquishes its lock. Once -@code{guard} becomes available, the current thread will place its own -lock on it, execute the code contained in the @code{@@synchronized} -block, and finally relinquish the lock (thereby making @code{guard} -available to other threads). - -Unlike Java, Objective-C does not allow for entire methods to be -marked @code{@@synchronized}. Note that throwing exceptions out of -@code{@@synchronized} blocks is allowed, and will cause the guarding -object to be unlocked properly. - -Because of the interactions between synchronization and exception -handling, you can only use @code{@@synchronized} when compiling with -exceptions enabled, that is with the command line option -@option{-fobjc-exceptions}. - - -@c ========================================================================= -@node Fast enumeration -@section Fast Enumeration - -@menu -* Using fast enumeration:: -* c99-like fast enumeration syntax:: -* Fast enumeration details:: -* Fast enumeration protocol:: -@end menu - -@c ================================ -@node Using fast enumeration -@subsection Using Fast Enumeration - -GNU Objective-C provides support for the fast enumeration syntax: - -@smallexample - id array = @dots{}; - id object; - - for (object in array) - @{ - /* Do something with 'object' */ - @} -@end smallexample - -@code{array} needs to be an Objective-C object (usually a collection -object, for example an array, a dictionary or a set) which implements -the ``Fast Enumeration Protocol'' (see below). If you are using a -Foundation library such as GNUstep Base or Apple Cocoa Foundation, all -collection objects in the library implement this protocol and can be -used in this way. - -The code above would iterate over all objects in @code{array}. For -each of them, it assigns it to @code{object}, then executes the -@code{Do something with 'object'} statements. - -Here is a fully worked-out example using a Foundation library (which -provides the implementation of @code{NSArray}, @code{NSString} and -@code{NSLog}): - -@smallexample - NSArray *array = [NSArray arrayWithObjects: @@"1", @@"2", @@"3", nil]; - NSString *object; - - for (object in array) - NSLog (@@"Iterating over %@@", object); -@end smallexample - - -@c ================================ -@node c99-like fast enumeration syntax -@subsection C99-Like Fast Enumeration Syntax - -A c99-like declaration syntax is also allowed: - -@smallexample - id array = @dots{}; - - for (id object in array) - @{ - /* Do something with 'object' */ - @} -@end smallexample - -this is completely equivalent to: - -@smallexample - id array = @dots{}; - - @{ - id object; - for (object in array) - @{ - /* Do something with 'object' */ - @} - @} -@end smallexample - -but can save some typing. - -Note that the option @option{-std=c99} is not required to allow this -syntax in Objective-C. - -@c ================================ -@node Fast enumeration details -@subsection Fast Enumeration Details - -Here is a more technical description with the gory details. Consider the code - -@smallexample - for (@var{object expression} in @var{collection expression}) - @{ - @var{statements} - @} -@end smallexample - -here is what happens when you run it: - -@itemize @bullet -@item -@code{@var{collection expression}} is evaluated exactly once and the -result is used as the collection object to iterate over. This means -it is safe to write code such as @code{for (object in [NSDictionary -keyEnumerator]) @dots{}}. - -@item -the iteration is implemented by the compiler by repeatedly getting -batches of objects from the collection object using the fast -enumeration protocol (see below), then iterating over all objects in -the batch. This is faster than a normal enumeration where objects are -retrieved one by one (hence the name ``fast enumeration''). - -@item -if there are no objects in the collection, then -@code{@var{object expression}} is set to @code{nil} and the loop -immediately terminates. - -@item -if there are objects in the collection, then for each object in the -collection (in the order they are returned) @code{@var{object expression}} -is set to the object, then @code{@var{statements}} are executed. - -@item -@code{@var{statements}} can contain @code{break} and @code{continue} -commands, which will abort the iteration or skip to the next loop -iteration as expected. - -@item -when the iteration ends because there are no more objects to iterate -over, @code{@var{object expression}} is set to @code{nil}. This allows -you to determine whether the iteration finished because a @code{break} -command was used (in which case @code{@var{object expression}} will remain -set to the last object that was iterated over) or because it iterated -over all the objects (in which case @code{@var{object expression}} will be -set to @code{nil}). - -@item -@code{@var{statements}} must not make any changes to the collection -object; if they do, it is a hard error and the fast enumeration -terminates by invoking @code{objc_enumerationMutation}, a runtime -function that normally aborts the program but which can be customized -by Foundation libraries via @code{objc_set_mutation_handler} to do -something different, such as raising an exception. - -@end itemize - -@c ================================ -@node Fast enumeration protocol -@subsection Fast Enumeration Protocol - -If you want your own collection object to be usable with fast -enumeration, you need to have it implement the method - -@smallexample -- (unsigned long) countByEnumeratingWithState: (NSFastEnumerationState *)state - objects: (id *)objects - count: (unsigned long)len; -@end smallexample - -where @code{NSFastEnumerationState} must be defined in your code as follows: - -@smallexample -typedef struct -@{ - unsigned long state; - id *itemsPtr; - unsigned long *mutationsPtr; - unsigned long extra[5]; -@} NSFastEnumerationState; -@end smallexample - -If no @code{NSFastEnumerationState} is defined in your code, the -compiler will automatically replace @code{NSFastEnumerationState *} -with @code{struct __objcFastEnumerationState *}, where that type is -silently defined by the compiler in an identical way. This can be -confusing and we recommend that you define -@code{NSFastEnumerationState} (as shown above) instead. - -The method is called repeatedly during a fast enumeration to retrieve -batches of objects. Each invocation of the method should retrieve the -next batch of objects. - -The return value of the method is the number of objects in the current -batch; this should not exceed @code{len}, which is the maximum size of -a batch as requested by the caller. The batch itself is returned in -the @code{itemsPtr} field of the @code{NSFastEnumerationState} struct. - -To help with returning the objects, the @code{objects} array is a C -array preallocated by the caller (on the stack) of size @code{len}. -In many cases you can put the objects you want to return in that -@code{objects} array, then do @code{itemsPtr = objects}. But you -don't have to; if your collection already has the objects to return in -some form of C array, it could return them from there instead. - -The @code{state} and @code{extra} fields of the -@code{NSFastEnumerationState} structure allows your collection object -to keep track of the state of the enumeration. In a simple array -implementation, @code{state} may keep track of the index of the last -object that was returned, and @code{extra} may be unused. - -The @code{mutationsPtr} field of the @code{NSFastEnumerationState} is -used to keep track of mutations. It should point to a number; before -working on each object, the fast enumeration loop will check that this -number has not changed. If it has, a mutation has happened and the -fast enumeration will abort. So, @code{mutationsPtr} could be set to -point to some sort of version number of your collection, which is -increased by one every time there is a change (for example when an -object is added or removed). Or, if you are content with less strict -mutation checks, it could point to the number of objects in your -collection or some other value that can be checked to perform an -approximate check that the collection has not been mutated. - -Finally, note how we declared the @code{len} argument and the return -value to be of type @code{unsigned long}. They could also be declared -to be of type @code{unsigned int} and everything would still work. - -@c ========================================================================= -@node Messaging with the GNU Objective-C runtime -@section Messaging with the GNU Objective-C Runtime - -This section is specific for the GNU Objective-C runtime. If you are -using a different runtime, you can skip it. - -The implementation of messaging in the GNU Objective-C runtime is -designed to be portable, and so is based on standard C. - -Sending a message in the GNU Objective-C runtime is composed of two -separate steps. First, there is a call to the lookup function, -@code{objc_msg_lookup ()} (or, in the case of messages to super, -@code{objc_msg_lookup_super ()}). This runtime function takes as -argument the receiver and the selector of the method to be called; it -returns the @code{IMP}, that is a pointer to the function implementing -the method. The second step of method invocation consists of casting -this pointer function to the appropriate function pointer type, and -calling the function pointed to it with the right arguments. - -For example, when the compiler encounters a method invocation such as -@code{[object init]}, it compiles it into a call to -@code{objc_msg_lookup (object, @@selector(init))} followed by a cast -of the returned value to the appropriate function pointer type, and -then it calls it. - -@menu -* Dynamically registering methods:: -* Forwarding hook:: -@end menu - -@c ========================================================================= -@node Dynamically registering methods -@subsection Dynamically Registering Methods - -If @code{objc_msg_lookup()} does not find a suitable method -implementation, because the receiver does not implement the required -method, it tries to see if the class can dynamically register the -method. - -To do so, the runtime checks if the class of the receiver implements -the method - -@smallexample -+ (BOOL) resolveInstanceMethod: (SEL)selector; -@end smallexample - -in the case of an instance method, or - -@smallexample -+ (BOOL) resolveClassMethod: (SEL)selector; -@end smallexample - -in the case of a class method. If the class implements it, the -runtime invokes it, passing as argument the selector of the original -method, and if it returns @code{YES}, the runtime tries the lookup -again, which could now succeed if a matching method was added -dynamically by @code{+resolveInstanceMethod:} or -@code{+resolveClassMethod:}. - -This allows classes to dynamically register methods (by adding them to -the class using @code{class_addMethod}) when they are first called. -To do so, a class should implement @code{+resolveInstanceMethod:} (or, -depending on the case, @code{+resolveClassMethod:}) and have it -recognize the selectors of methods that can be registered dynamically -at runtime, register them, and return @code{YES}. It should return -@code{NO} for methods that it does not dynamically registered at -runtime. - -If @code{+resolveInstanceMethod:} (or @code{+resolveClassMethod:}) is -not implemented or returns @code{NO}, the runtime then tries the -forwarding hook. - -Support for @code{+resolveInstanceMethod:} and -@code{resolveClassMethod:} was added to the GNU Objective-C runtime in -GCC version 4.6. - -@c ========================================================================= -@node Forwarding hook -@subsection Forwarding Hook - -The GNU Objective-C runtime provides a hook, called -@code{__objc_msg_forward2}, which is called by -@code{objc_msg_lookup()} when it can't find a method implementation in -the runtime tables and after calling @code{+resolveInstanceMethod:} -and @code{+resolveClassMethod:} has been attempted and did not succeed -in dynamically registering the method. - -To configure the hook, you set the global variable -@code{__objc_msg_forward2} to a function with the same argument and -return types of @code{objc_msg_lookup()}. When -@code{objc_msg_lookup()} can not find a method implementation, it -invokes the hook function you provided to get a method implementation -to return. So, in practice @code{__objc_msg_forward2} allows you to -extend @code{objc_msg_lookup()} by adding some custom code that is -called to do a further lookup when no standard method implementation -can be found using the normal lookup. - -This hook is generally reserved for ``Foundation'' libraries such as -GNUstep Base, which use it to implement their high-level method -forwarding API, typically based around the @code{forwardInvocation:} -method. So, unless you are implementing your own ``Foundation'' -library, you should not set this hook. - -In a typical forwarding implementation, the @code{__objc_msg_forward2} -hook function determines the argument and return type of the method -that is being looked up, and then creates a function that takes these -arguments and has that return type, and returns it to the caller. -Creating this function is non-trivial and is typically performed using -a dedicated library such as @code{libffi}. - -The forwarding method implementation thus created is returned by -@code{objc_msg_lookup()} and is executed as if it was a normal method -implementation. When the forwarding method implementation is called, -it is usually expected to pack all arguments into some sort of object -(typically, an @code{NSInvocation} in a ``Foundation'' library), and -hand it over to the programmer (@code{forwardInvocation:}) who is then -allowed to manipulate the method invocation using a high-level API -provided by the ``Foundation'' library. For example, the programmer -may want to examine the method invocation arguments and name and -potentially change them before forwarding the method invocation to one -or more local objects (@code{performInvocation:}) or even to remote -objects (by using Distributed Objects or some other mechanism). When -all this completes, the return value is passed back and must be -returned correctly to the original caller. - -Note that the GNU Objective-C runtime currently provides no support -for method forwarding or method invocations other than the -@code{__objc_msg_forward2} hook. - -If the forwarding hook does not exist or returns @code{NULL}, the -runtime currently attempts forwarding using an older, deprecated API, -and if that fails, it aborts the program. In future versions of the -GNU Objective-C runtime, the runtime will immediately abort. diff --git a/contrib/gcc-5.0/gcc/doc/optinfo.texi b/contrib/gcc-5.0/gcc/doc/optinfo.texi deleted file mode 100644 index 0be5aeb540..0000000000 --- a/contrib/gcc-5.0/gcc/doc/optinfo.texi +++ /dev/null @@ -1,228 +0,0 @@ -@c Copyright (C) 2013-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@cindex optimization dumps - -This section is describes dump infrastructure which is common to both -pass dumps as well as optimization dumps. The goal for this -infrastructure is to provide both gcc developers and users detailed -information about various compiler transformations and optimizations. - -@menu -* Dump setup:: Setup of optimization dumps. -* Optimization groups:: Groups made up of optimization passes. -* Dump files and streams:: Dump output file names and streams. -* Dump output verbosity:: How much information to dump. -* Dump types:: Various types of dump functions. -* Dump examples:: Sample usage. -@end menu - -@node Dump setup -@subsection Dump setup -@cindex dump setup - -A dump_manager class is defined in @file{dumpfile.h}. Various passes -register dumping pass-specific information via @code{dump_register} in -@file{passes.c}. During the registration, an optimization pass can -select its optimization group (@pxref{Optimization groups}). After -that optimization information corresponding to the entire group -(presumably from multiple passes) can be output via command-line -switches. Note that if a pass does not fit into any of the pre-defined -groups, it can select @code{OPTGROUP_NONE}. - -Note that in general, a pass need not know its dump output file name, -whether certain flags are enabled, etc. However, for legacy reasons, -passes could also call @code{dump_begin} which returns a stream in -case the particular pass has optimization dumps enabled. A pass could -call @code{dump_end} when the dump has ended. These methods should go -away once all the passes are converted to use the new dump -infrastructure. - -The recommended way to setup the dump output is via @code{dump_start} -and @code{dump_end}. - -@node Optimization groups -@subsection Optimization groups -@cindex optimization groups -The optimization passes are grouped into several categories. Currently -defined categories in @file{dumpfile.h} are - -@ftable @code - -@item OPTGROUP_IPA -IPA optimization passes. Enabled by @option{-ipa} - -@item OPTGROUP_LOOP -Loop optimization passes. Enabled by @option{-loop}. - -@item OPTGROUP_INLINE -Inlining passes. Enabled by @option{-inline}. - -@item OPTGROUP_VEC -Vectorization passes. Enabled by @option{-vec}. - -@item OPTGROUP_OTHER -All other optimization passes which do not fall into one of the above. - -@item OPTGROUP_ALL -All optimization passes. Enabled by @option{-all}. - -@end ftable - -By using groups a user could selectively enable optimization -information only for a group of passes. By default, the optimization -information for all the passes is dumped. - -@node Dump files and streams -@subsection Dump files and streams -@cindex optimization info file names - -There are two separate output streams available for outputting -optimization information from passes. Note that both these streams -accept @code{stderr} and @code{stdout} as valid streams and thus it is -possible to dump output to standard output or error. This is specially -handy for outputting all available information in a single file by -redirecting @code{stderr}. - -@table @code -@item @code{pstream} -This stream is for pass-specific dump output. For example, -@option{-fdump-tree-vect=foo.v} dumps tree vectorization pass output -into the given file name @file{foo.v}. If the file name is not provided, -the default file name is based on the source file and pass number. Note -that one could also use special file names @code{stdout} and -@code{stderr} for dumping to standard output and standard error -respectively. - -@item @code{alt_stream} -This steam is used for printing optimization specific output in -response to the @option{-fopt-info}. Again a file name can be given. If -the file name is not given, it defaults to @code{stderr}. -@end table - -@node Dump output verbosity -@subsection Dump output verbosity -@cindex dump verbosity - -The dump verbosity has the following options - -@table @samp -@item optimized -Print information when an optimization is successfully applied. It is -up to a pass to decide which information is relevant. For example, the -vectorizer passes print the source location of loops which got -successfully vectorized. - -@item missed -Print information about missed optimizations. Individual passes -control which information to include in the output. For example, - -@smallexample -gcc -O2 -ftree-vectorize -fopt-info-vec-missed -@end smallexample - -will print information about missed optimization opportunities from -vectorization passes on stderr. - -@item note -Print verbose information about optimizations, such as certain -transformations, more detailed messages about decisions etc. - -@item all -Print detailed optimization information. This includes -@var{optimized}, @var{missed}, and @var{note}. -@end table - -@node Dump types -@subsection Dump types -@cindex dump types - -@ftable @code - -@item dump_printf - -This is a generic method for doing formatted output. It takes an -additional argument @code{dump_kind} which signifies the type of -dump. This method outputs information only when the dumps are enabled -for this particular @code{dump_kind}. Note that the caller doesn't -need to know if the particular dump is enabled or not, or even the -file name. The caller only needs to decide which dump output -information is relevant, and under what conditions. This determines -the associated flags. - -Consider the following example from @file{loop-unroll.c} where an -informative message about a loop (along with its location) is printed -when any of the following flags is enabled -@itemize @minus - -@item optimization messages -@item RTL dumps -@item detailed dumps - -@end itemize - -@example -int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS; -dump_printf_loc (report_flags, locus, - "loop turned into non-loop; it never loops.\n"); -@end example - -@item dump_basic_block -Output basic block. -@item dump_generic_expr -Output generic expression. -@item dump_gimple_stmt -Output gimple statement. - -Note that the above methods also have variants prefixed with -@code{_loc}, such as @code{dump_printf_loc}, which are similar except -they also output the source location information. - -@end ftable - -@node Dump examples -@subsection Dump examples -@cindex dump examples - -@smallexample -gcc -O3 -fopt-info-missed=missed.all -@end smallexample - -outputs missed optimization report from all the passes into -@file{missed.all}. - -As another example, -@smallexample -gcc -O3 -fopt-info-inline-optimized-missed=inline.txt -@end smallexample - -will output information about missed optimizations as well as -optimized locations from all the inlining passes into -@file{inline.txt}. - -If the @var{filename} is provided, then the dumps from all the -applicable optimizations are concatenated into the @file{filename}. -Otherwise the dump is output onto @file{stderr}. If @var{options} is -omitted, it defaults to @option{all-all}, which means dump all -available optimization info from all the passes. In the following -example, all optimization info is output on to @file{stderr}. - -@smallexample -gcc -O3 -fopt-info -@end smallexample - -Note that @option{-fopt-info-vec-missed} behaves the same as -@option{-fopt-info-missed-vec}. - -As another example, consider - -@smallexample -gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt -@end smallexample - -Here the two output file names @file{vec.miss} and @file{loop.opt} are -in conflict since only one output file is allowed. In this case, only -the first option takes effect and the subsequent options are -ignored. Thus only the @file{vec.miss} is produced which containts -dumps from the vectorizer about missed opportunities. diff --git a/contrib/gcc-5.0/gcc/doc/options.texi b/contrib/gcc-5.0/gcc/doc/options.texi deleted file mode 100644 index 37ca4747e3..0000000000 --- a/contrib/gcc-5.0/gcc/doc/options.texi +++ /dev/null @@ -1,499 +0,0 @@ -@c Copyright (C) 2003-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Options -@chapter Option specification files -@cindex option specification files -@cindex @samp{optc-gen.awk} - -Most GCC command-line options are described by special option -definition files, the names of which conventionally end in -@code{.opt}. This chapter describes the format of these files. - -@menu -* Option file format:: The general layout of the files -* Option properties:: Supported option properties -@end menu - -@node Option file format -@section Option file format - -Option files are a simple list of records in which each field occupies -its own line and in which the records themselves are separated by -blank lines. Comments may appear on their own line anywhere within -the file and are preceded by semicolons. Whitespace is allowed before -the semicolon. - -The files can contain the following types of record: - -@itemize @bullet -@item -A language definition record. These records have two fields: the -string @samp{Language} and the name of the language. Once a language -has been declared in this way, it can be used as an option property. -@xref{Option properties}. - -@item -A target specific save record to save additional information. These -records have two fields: the string @samp{TargetSave}, and a -declaration type to go in the @code{cl_target_option} structure. - -@item -A variable record to define a variable used to store option -information. These records have two fields: the string -@samp{Variable}, and a declaration of the type and name of the -variable, optionally with an initializer (but without any trailing -@samp{;}). These records may be used for variables used for many -options where declaring the initializer in a single option definition -record, or duplicating it in many records, would be inappropriate, or -for variables set in option handlers rather than referenced by -@code{Var} properties. - -@item -A variable record to define a variable used to store option -information. These records have two fields: the string -@samp{TargetVariable}, and a declaration of the type and name of the -variable, optionally with an initializer (but without any trailing -@samp{;}). @samp{TargetVariable} is a combination of @samp{Variable} -and @samp{TargetSave} records in that the variable is defined in the -@code{gcc_options} structure, but these variables are also stored in -the @code{cl_target_option} structure. The variables are saved in the -target save code and restored in the target restore code. - -@item -A variable record to record any additional files that the -@file{options.h} file should include. This is useful to provide -enumeration or structure definitions needed for target variables. -These records have two fields: the string @samp{HeaderInclude} and the -name of the include file. - -@item -A variable record to record any additional files that the -@file{options.c} or @file{options-save.c} file should include. This -is useful to provide -inline functions needed for target variables and/or @code{#ifdef} -sequences to properly set up the initialization. These records have -two fields: the string @samp{SourceInclude} and the name of the -include file. - -@item -An enumeration record to define a set of strings that may be used as -arguments to an option or options. These records have three fields: -the string @samp{Enum}, a space-separated list of properties and help -text used to describe the set of strings in @option{--help} output. -Properties use the same format as option properties; the following are -valid: -@table @code -@item Name(@var{name}) -This property is required; @var{name} must be a name (suitable for use -in C identifiers) used to identify the set of strings in @code{Enum} -option properties. - -@item Type(@var{type}) -This property is required; @var{type} is the C type for variables set -by options using this enumeration together with @code{Var}. - -@item UnknownError(@var{message}) -The message @var{message} will be used as an error message if the -argument is invalid; for enumerations without @code{UnknownError}, a -generic error message is used. @var{message} should contain a single -@samp{%qs} format, which will be used to format the invalid argument. -@end table - -@item -An enumeration value record to define one of the strings in a set -given in an @samp{Enum} record. These records have two fields: the -string @samp{EnumValue} and a space-separated list of properties. -Properties use the same format as option properties; the following are -valid: -@table @code -@item Enum(@var{name}) -This property is required; @var{name} says which @samp{Enum} record -this @samp{EnumValue} record corresponds to. - -@item String(@var{string}) -This property is required; @var{string} is the string option argument -being described by this record. - -@item Value(@var{value}) -This property is required; it says what value (representable as -@code{int}) should be used for the given string. - -@item Canonical -This property is optional. If present, it says the present string is -the canonical one among all those with the given value. Other strings -yielding that value will be mapped to this one so specs do not need to -handle them. - -@item DriverOnly -This property is optional. If present, the present string will only -be accepted by the driver. This is used for cases such as -@option{-march=native} that are processed by the driver so that -@samp{gcc -v} shows how the options chosen depended on the system on -which the compiler was run. -@end table - -@item -An option definition record. These records have the following fields: -@enumerate -@item -the name of the option, with the leading ``-'' removed -@item -a space-separated list of option properties (@pxref{Option properties}) -@item -the help text to use for @option{--help} (omitted if the second field -contains the @code{Undocumented} property). -@end enumerate - -By default, all options beginning with ``f'', ``W'' or ``m'' are -implicitly assumed to take a ``no-'' form. This form should not be -listed separately. If an option beginning with one of these letters -does not have a ``no-'' form, you can use the @code{RejectNegative} -property to reject it. - -The help text is automatically line-wrapped before being displayed. -Normally the name of the option is printed on the left-hand side of -the output and the help text is printed on the right. However, if the -help text contains a tab character, the text to the left of the tab is -used instead of the option's name and the text to the right of the -tab forms the help text. This allows you to elaborate on what type -of argument the option takes. - -@item -A target mask record. These records have one field of the form -@samp{Mask(@var{x})}. The options-processing script will automatically -allocate a bit in @code{target_flags} (@pxref{Run-time Target}) for -each mask name @var{x} and set the macro @code{MASK_@var{x}} to the -appropriate bitmask. It will also declare a @code{TARGET_@var{x}} -macro that has the value 1 when bit @code{MASK_@var{x}} is set and -0 otherwise. - -They are primarily intended to declare target masks that are not -associated with user options, either because these masks represent -internal switches or because the options are not available on all -configurations and yet the masks always need to be defined. -@end itemize - -@node Option properties -@section Option properties - -The second field of an option record can specify any of the following -properties. When an option takes an argument, it is enclosed in parentheses -following the option property name. The parser that handles option files -is quite simplistic, and will be tricked by any nested parentheses within -the argument text itself; in this case, the entire option argument can -be wrapped in curly braces within the parentheses to demarcate it, e.g.: - -@smallexample -Condition(@{defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)@}) -@end smallexample - -@table @code -@item Common -The option is available for all languages and targets. - -@item Target -The option is available for all languages but is target-specific. - -@item Driver -The option is handled by the compiler driver using code not shared -with the compilers proper (@file{cc1} etc.). - -@item @var{language} -The option is available when compiling for the given language. - -It is possible to specify several different languages for the same -option. Each @var{language} must have been declared by an earlier -@code{Language} record. @xref{Option file format}. - -@item RejectDriver -The option is only handled by the compilers proper (@file{cc1} etc.)@: -and should not be accepted by the driver. - -@item RejectNegative -The option does not have a ``no-'' form. All options beginning with -``f'', ``W'' or ``m'' are assumed to have a ``no-'' form unless this -property is used. - -@item Negative(@var{othername}) -The option will turn off another option @var{othername}, which is -the option name with the leading ``-'' removed. This chain action will -propagate through the @code{Negative} property of the option to be -turned off. - -As a consequence, if you have a group of mutually-exclusive -options, their @code{Negative} properties should form a circular chain. -For example, if options @option{-@var{a}}, @option{-@var{b}} and -@option{-@var{c}} are mutually exclusive, their respective @code{Negative} -properties should be @samp{Negative(@var{b})}, @samp{Negative(@var{c})} -and @samp{Negative(@var{a})}. - -@item Joined -@itemx Separate -The option takes a mandatory argument. @code{Joined} indicates -that the option and argument can be included in the same @code{argv} -entry (as with @code{-mflush-func=@var{name}}, for example). -@code{Separate} indicates that the option and argument can be -separate @code{argv} entries (as with @code{-o}). An option is -allowed to have both of these properties. - -@item JoinedOrMissing -The option takes an optional argument. If the argument is given, -it will be part of the same @code{argv} entry as the option itself. - -This property cannot be used alongside @code{Joined} or @code{Separate}. - -@item MissingArgError(@var{message}) -For an option marked @code{Joined} or @code{Separate}, the message -@var{message} will be used as an error message if the mandatory -argument is missing; for options without @code{MissingArgError}, a -generic error message is used. @var{message} should contain a single -@samp{%qs} format, which will be used to format the name of the option -passed. - -@item Args(@var{n}) -For an option marked @code{Separate}, indicate that it takes @var{n} -arguments. The default is 1. - -@item UInteger -The option's argument is a non-negative integer. The option parser -will check and convert the argument before passing it to the relevant -option handler. @code{UInteger} should also be used on options like -@code{-falign-loops} where both @code{-falign-loops} and -@code{-falign-loops}=@var{n} are supported to make sure the saved -options are given a full integer. - -@item ToLower -The option's argument should be converted to lowercase as part of -putting it in canonical form, and before comparing with the strings -indicated by any @code{Enum} property. - -@item NoDriverArg -For an option marked @code{Separate}, the option only takes an -argument in the compiler proper, not in the driver. This is for -compatibility with existing options that are used both directly and -via @option{-Wp,}; new options should not have this property. - -@item Var(@var{var}) -The state of this option should be stored in variable @var{var} -(actually a macro for @code{global_options.x_@var{var}}). -The way that the state is stored depends on the type of option: - -@itemize @bullet -@item -If the option uses the @code{Mask} or @code{InverseMask} properties, -@var{var} is the integer variable that contains the mask. - -@item -If the option is a normal on/off switch, @var{var} is an integer -variable that is nonzero when the option is enabled. The options -parser will set the variable to 1 when the positive form of the -option is used and 0 when the ``no-'' form is used. - -@item -If the option takes an argument and has the @code{UInteger} property, -@var{var} is an integer variable that stores the value of the argument. - -@item -If the option takes an argument and has the @code{Enum} property, -@var{var} is a variable (type given in the @code{Type} property of the -@samp{Enum} record whose @code{Name} property has the same argument as -the @code{Enum} property of this option) that stores the value of the -argument. - -@item -If the option has the @code{Defer} property, @var{var} is a pointer to -a @code{VEC(cl_deferred_option,heap)} that stores the option for later -processing. (@var{var} is declared with type @code{void *} and needs -to be cast to @code{VEC(cl_deferred_option,heap)} before use.) - -@item -Otherwise, if the option takes an argument, @var{var} is a pointer to -the argument string. The pointer will be null if the argument is optional -and wasn't given. -@end itemize - -The option-processing script will usually zero-initialize @var{var}. -You can modify this behavior using @code{Init}. - -@item Var(@var{var}, @var{set}) -The option controls an integer variable @var{var} and is active when -@var{var} equals @var{set}. The option parser will set @var{var} to -@var{set} when the positive form of the option is used and @code{!@var{set}} -when the ``no-'' form is used. - -@var{var} is declared in the same way as for the single-argument form -described above. - -@item Init(@var{value}) -The variable specified by the @code{Var} property should be statically -initialized to @var{value}. If more than one option using the same -variable specifies @code{Init}, all must specify the same initializer. - -@item Mask(@var{name}) -The option is associated with a bit in the @code{target_flags} -variable (@pxref{Run-time Target}) and is active when that bit is set. -You may also specify @code{Var} to select a variable other than -@code{target_flags}. - -The options-processing script will automatically allocate a unique bit -for the option. If the option is attached to @samp{target_flags}, -the script will set the macro @code{MASK_@var{name}} to the appropriate -bitmask. It will also declare a @code{TARGET_@var{name}} macro that has -the value 1 when the option is active and 0 otherwise. If you use @code{Var} -to attach the option to a different variable, the bitmask macro with be -called @code{OPTION_MASK_@var{name}}. - -@item InverseMask(@var{othername}) -@itemx InverseMask(@var{othername}, @var{thisname}) -The option is the inverse of another option that has the -@code{Mask(@var{othername})} property. If @var{thisname} is given, -the options-processing script will declare a @code{TARGET_@var{thisname}} -macro that is 1 when the option is active and 0 otherwise. - -@item Enum(@var{name}) -The option's argument is a string from the set of strings associated -with the corresponding @samp{Enum} record. The string is checked and -converted to the integer specified in the corresponding -@samp{EnumValue} record before being passed to option handlers. - -@item Defer -The option should be stored in a vector, specified with @code{Var}, -for later processing. - -@item Alias(@var{opt}) -@itemx Alias(@var{opt}, @var{arg}) -@itemx Alias(@var{opt}, @var{posarg}, @var{negarg}) -The option is an alias for @option{-@var{opt}} (or the negative form -of that option, depending on @code{NegativeAlias}). In the first form, -any argument passed to the alias is considered to be passed to -@option{-@var{opt}}, and @option{-@var{opt}} is considered to be -negated if the alias is used in negated form. In the second form, the -alias may not be negated or have an argument, and @var{posarg} is -considered to be passed as an argument to @option{-@var{opt}}. In the -third form, the alias may not have an argument, if the alias is used -in the positive form then @var{posarg} is considered to be passed to -@option{-@var{opt}}, and if the alias is used in the negative form -then @var{negarg} is considered to be passed to @option{-@var{opt}}. - -Aliases should not specify @code{Var} or @code{Mask} or -@code{UInteger}. Aliases should normally specify the same languages -as the target of the alias; the flags on the target will be used to -determine any diagnostic for use of an option for the wrong language, -while those on the alias will be used to identify what command-line -text is the option and what text is any argument to that option. - -When an @code{Alias} definition is used for an option, driver specs do -not need to handle it and no @samp{OPT_} enumeration value is defined -for it; only the canonical form of the option will be seen in those -places. - -@item NegativeAlias -For an option marked with @code{Alias(@var{opt})}, the option is -considered to be an alias for the positive form of @option{-@var{opt}} -if negated and for the negative form of @option{-@var{opt}} if not -negated. @code{NegativeAlias} may not be used with the forms of -@code{Alias} taking more than one argument. - -@item Ignore -This option is ignored apart from printing any warning specified using -@code{Warn}. The option will not be seen by specs and no @samp{OPT_} -enumeration value is defined for it. - -@item SeparateAlias -For an option marked with @code{Joined}, @code{Separate} and -@code{Alias}, the option only acts as an alias when passed a separate -argument; with a joined argument it acts as a normal option, with an -@samp{OPT_} enumeration value. This is for compatibility with the -Java @option{-d} option and should not be used for new options. - -@item Warn(@var{message}) -If this option is used, output the warning @var{message}. -@var{message} is a format string, either taking a single operand with -a @samp{%qs} format which is the option name, or not taking any -operands, which is passed to the @samp{warning} function. If an alias -is marked @code{Warn}, the target of the alias must not also be marked -@code{Warn}. - -@item Report -The state of the option should be printed by @option{-fverbose-asm}. - -@item Warning -This is a warning option and should be shown as such in -@option{--help} output. This flag does not currently affect anything -other than @option{--help}. - -@item Optimization -This is an optimization option. It should be shown as such in -@option{--help} output, and any associated variable named using -@code{Var} should be saved and restored when the optimization level is -changed with @code{optimize} attributes. - -@item Undocumented -The option is deliberately missing documentation and should not -be included in the @option{--help} output. - -@item Condition(@var{cond}) -The option should only be accepted if preprocessor condition -@var{cond} is true. Note that any C declarations associated with the -option will be present even if @var{cond} is false; @var{cond} simply -controls whether the option is accepted and whether it is printed in -the @option{--help} output. - -@item Save -Build the @code{cl_target_option} structure to hold a copy of the -option, add the functions @code{cl_target_option_save} and -@code{cl_target_option_restore} to save and restore the options. - -@item SetByCombined -The option may also be set by a combined option such as -@option{-ffast-math}. This causes the @code{gcc_options} struct to -have a field @code{frontend_set_@var{name}}, where @code{@var{name}} -is the name of the field holding the value of this option (without the -leading @code{x_}). This gives the front end a way to indicate that -the value has been set explicitly and should not be changed by the -combined option. For example, some front ends use this to prevent -@option{-ffast-math} and @option{-fno-fast-math} from changing the -value of @option{-fmath-errno} for languages that do not use -@code{errno}. - -@item EnabledBy(@var{opt}) -@itemx EnabledBy(@var{opt} || @var{opt2}) -@itemx EnabledBy(@var{opt} && @var{opt2}) -If not explicitly set, the option is set to the value of -@option{-@var{opt}}; multiple options can be given, separated by -@code{||}. The third form using @code{&&} specifies that the option is -only set if both @var{opt} and @var{opt2} are set. - -@item LangEnabledBy(@var{language}, @var{opt}) -@itemx LangEnabledBy(@var{language}, @var{opt}, @var{posarg}, @var{negarg}) -When compiling for the given language, the option is set to the value -of @option{-@var{opt}}, if not explicitly set. @var{opt} can be also a list -of @code{||} separated options. In the second form, if -@var{opt} is used in the positive form then @var{posarg} is considered -to be passed to the option, and if @var{opt} is used in the negative -form then @var{negarg} is considered to be passed to the option. It -is possible to specify several different languages. Each -@var{language} must have been declared by an earlier @code{Language} -record. @xref{Option file format}. - -@item NoDWARFRecord -The option is omitted from the producer string written by -@option{-grecord-gcc-switches}. - -@item PchIgnore -Even if this is a target option, this option will not be recorded / compared -to determine if a precompiled header file matches. - -@item CPP(@var{var}) -The state of this option should be kept in sync with the preprocessor -option @var{var}. If this property is set, then properties @code{Var} -and @code{Init} must be set as well. - -@item CppReason(@var{CPP_W_Enum}) -This warning option corresponds to @code{cpplib.h} warning reason code -@var{CPP_W_Enum}. This should only be used for warning options of the -C-family front-ends. - -@end table diff --git a/contrib/gcc-5.0/gcc/doc/passes.texi b/contrib/gcc-5.0/gcc/doc/passes.texi deleted file mode 100644 index 32ad9fc16e..0000000000 --- a/contrib/gcc-5.0/gcc/doc/passes.texi +++ /dev/null @@ -1,988 +0,0 @@ -@c markers: BUG TODO - -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Passes -@chapter Passes and Files of the Compiler -@cindex passes and files of the compiler -@cindex files and passes of the compiler -@cindex compiler passes and files -@cindex pass dumps - -This chapter is dedicated to giving an overview of the optimization and -code generation passes of the compiler. In the process, it describes -some of the language front end interface, though this description is no -where near complete. - -@menu -* Parsing pass:: The language front end turns text into bits. -* Cilk Plus Transformation:: Transform Cilk Plus Code to equivalent C/C++. -* Gimplification pass:: The bits are turned into something we can optimize. -* Pass manager:: Sequencing the optimization passes. -* Tree SSA passes:: Optimizations on a high-level representation. -* RTL passes:: Optimizations on a low-level representation. -* Optimization info:: Dumping optimization information from passes. -@end menu - -@node Parsing pass -@section Parsing pass -@cindex GENERIC -@findex lang_hooks.parse_file -The language front end is invoked only once, via -@code{lang_hooks.parse_file}, to parse the entire input. The language -front end may use any intermediate language representation deemed -appropriate. The C front end uses GENERIC trees (@pxref{GENERIC}), plus -a double handful of language specific tree codes defined in -@file{c-common.def}. The Fortran front end uses a completely different -private representation. - -@cindex GIMPLE -@cindex gimplification -@cindex gimplifier -@cindex language-independent intermediate representation -@cindex intermediate representation lowering -@cindex lowering, language-dependent intermediate representation -At some point the front end must translate the representation used in the -front end to a representation understood by the language-independent -portions of the compiler. Current practice takes one of two forms. -The C front end manually invokes the gimplifier (@pxref{GIMPLE}) on each function, -and uses the gimplifier callbacks to convert the language-specific tree -nodes directly to GIMPLE before passing the function off to be compiled. -The Fortran front end converts from a private representation to GENERIC, -which is later lowered to GIMPLE when the function is compiled. Which -route to choose probably depends on how well GENERIC (plus extensions) -can be made to match up with the source language and necessary parsing -data structures. - -BUG: Gimplification must occur before nested function lowering, -and nested function lowering must be done by the front end before -passing the data off to cgraph. - -TODO: Cgraph should control nested function lowering. It would -only be invoked when it is certain that the outer-most function -is used. - -TODO: Cgraph needs a gimplify_function callback. It should be -invoked when (1) it is certain that the function is used, (2) -warning flags specified by the user require some amount of -compilation in order to honor, (3) the language indicates that -semantic analysis is not complete until gimplification occurs. -Hum@dots{} this sounds overly complicated. Perhaps we should just -have the front end gimplify always; in most cases it's only one -function call. - -The front end needs to pass all function definitions and top level -declarations off to the middle-end so that they can be compiled and -emitted to the object file. For a simple procedural language, it is -usually most convenient to do this as each top level declaration or -definition is seen. There is also a distinction to be made between -generating functional code and generating complete debug information. -The only thing that is absolutely required for functional code is that -function and data @emph{definitions} be passed to the middle-end. For -complete debug information, function, data and type declarations -should all be passed as well. - -@findex rest_of_decl_compilation -@findex rest_of_type_compilation -@findex cgraph_finalize_function -In any case, the front end needs each complete top-level function or -data declaration, and each data definition should be passed to -@code{rest_of_decl_compilation}. Each complete type definition should -be passed to @code{rest_of_type_compilation}. Each function definition -should be passed to @code{cgraph_finalize_function}. - -TODO: I know rest_of_compilation currently has all sorts of -RTL generation semantics. I plan to move all code generation -bits (both Tree and RTL) to compile_function. Should we hide -cgraph from the front ends and move back to rest_of_compilation -as the official interface? Possibly we should rename all three -interfaces such that the names match in some meaningful way and -that is more descriptive than "rest_of". - -The middle-end will, at its option, emit the function and data -definitions immediately or queue them for later processing. - -@node Cilk Plus Transformation -@section Cilk Plus Transformation -@cindex CILK_PLUS - -If Cilk Plus generation (flag @option{-fcilkplus}) is enabled, all the Cilk -Plus code is transformed into equivalent C and C++ functions. Majority of this -transformation occurs toward the end of the parsing and right before the -gimplification pass. - -These are the major components to the Cilk Plus language extension: -@itemize @bullet -@item Array Notations: -During parsing phase, all the array notation specific information is stored in -@code{ARRAY_NOTATION_REF} tree using the function -@code{c_parser_array_notation}. During the end of parsing, we check the entire -function to see if there are any array notation specific code (using the -function @code{contains_array_notation_expr}). If this function returns -true, then we expand them using either @code{expand_array_notation_exprs} or -@code{build_array_notation_expr}. For the cases where array notations are -inside conditions, they are transformed using the function -@code{fix_conditional_array_notations}. The C language-specific routines are -located in @file{c/c-array-notation.c} and the equivalent C++ routines are in -the file @file{cp/cp-array-notation.c}. Common routines such as functions to -initialize built-in functions are stored in @file{array-notation-common.c}. - -@item Cilk keywords: -@itemize @bullet -@item @code{_Cilk_spawn}: -The @code{_Cilk_spawn} keyword is parsed and the function it contains is marked -as a spawning function. The spawning function is called the spawner. At -the end of the parsing phase, appropriate built-in functions are -added to the spawner that are defined in the Cilk runtime. The appropriate -locations of these functions, and the internal structures are detailed in -@code{cilk_init_builtins} in the file @file{cilk-common.c}. The pointers to -Cilk functions and fields of internal structures are described -in @file{cilk.h}. The built-in functions are described in -@file{cilk-builtins.def}. - -During gimplification, a new "spawn-helper" function is created. -The spawned function is replaced with a spawn helper function in the spawner. -The spawned function-call is moved into the spawn helper. The main function -that does these transformations is @code{gimplify_cilk_spawn} in -@file{c-family/cilk.c}. In the spawn-helper, the gimplification function -@code{gimplify_call_expr}, inserts a function call @code{__cilkrts_detach}. -This function is expanded by @code{builtin_expand_cilk_detach} located in -@file{c-family/cilk.c}. - -@item @code{_Cilk_sync}: -@code{_Cilk_sync} is parsed like a keyword. During gimplification, -the function @code{gimplify_cilk_sync} in @file{c-family/cilk.c}, will replace -this keyword with a set of functions that are stored in the Cilk runtime. -One of the internal functions inserted during gimplification, -@code{__cilkrts_pop_frame} must be expanded by the compiler and is -done by @code{builtin_expand_cilk_pop_frame} in @file{cilk-common.c}. - -@end itemize -@end itemize - -Documentation about Cilk Plus and language specification is provided under the -"Learn" section in @w{@uref{http://www.cilkplus.org/}}. It is worth mentioning -that the current implementation follows ABI 1.1. - -@node Gimplification pass -@section Gimplification pass - -@cindex gimplification -@cindex GIMPLE -@dfn{Gimplification} is a whimsical term for the process of converting -the intermediate representation of a function into the GIMPLE language -(@pxref{GIMPLE}). The term stuck, and so words like ``gimplification'', -``gimplify'', ``gimplifier'' and the like are sprinkled throughout this -section of code. - -While a front end may certainly choose to generate GIMPLE directly if -it chooses, this can be a moderately complex process unless the -intermediate language used by the front end is already fairly simple. -Usually it is easier to generate GENERIC trees plus extensions -and let the language-independent gimplifier do most of the work. - -@findex gimplify_function_tree -@findex gimplify_expr -@findex lang_hooks.gimplify_expr -The main entry point to this pass is @code{gimplify_function_tree} -located in @file{gimplify.c}. From here we process the entire -function gimplifying each statement in turn. The main workhorse -for this pass is @code{gimplify_expr}. Approximately everything -passes through here at least once, and it is from here that we -invoke the @code{lang_hooks.gimplify_expr} callback. - -The callback should examine the expression in question and return -@code{GS_UNHANDLED} if the expression is not a language specific -construct that requires attention. Otherwise it should alter the -expression in some way to such that forward progress is made toward -producing valid GIMPLE@. If the callback is certain that the -transformation is complete and the expression is valid GIMPLE, it -should return @code{GS_ALL_DONE}. Otherwise it should return -@code{GS_OK}, which will cause the expression to be processed again. -If the callback encounters an error during the transformation (because -the front end is relying on the gimplification process to finish -semantic checks), it should return @code{GS_ERROR}. - -@node Pass manager -@section Pass manager - -The pass manager is located in @file{passes.c}, @file{tree-optimize.c} -and @file{tree-pass.h}. -It processes passes as described in @file{passes.def}. -Its job is to run all of the individual passes in the correct order, -and take care of standard bookkeeping that applies to every pass. - -The theory of operation is that each pass defines a structure that -represents everything we need to know about that pass---when it -should be run, how it should be run, what intermediate language -form or on-the-side data structures it needs. We register the pass -to be run in some particular order, and the pass manager arranges -for everything to happen in the correct order. - -The actuality doesn't completely live up to the theory at present. -Command-line switches and @code{timevar_id_t} enumerations must still -be defined elsewhere. The pass manager validates constraints but does -not attempt to (re-)generate data structures or lower intermediate -language form based on the requirements of the next pass. Nevertheless, -what is present is useful, and a far sight better than nothing at all. - -Each pass should have a unique name. -Each pass may have its own dump file (for GCC debugging purposes). -Passes with a name starting with a star do not dump anything. -Sometimes passes are supposed to share a dump file / option name. -To still give these unique names, you can use a prefix that is delimited -by a space from the part that is used for the dump file / option name. -E.g. When the pass name is "ud dce", the name used for dump file/options -is "dce". - -TODO: describe the global variables set up by the pass manager, -and a brief description of how a new pass should use it. -I need to look at what info RTL passes use first@enddots{} - -@node Tree SSA passes -@section Tree SSA passes - -The following briefly describes the Tree optimization passes that are -run after gimplification and what source files they are located in. - -@itemize @bullet -@item Remove useless statements - -This pass is an extremely simple sweep across the gimple code in which -we identify obviously dead code and remove it. Here we do things like -simplify @code{if} statements with constant conditions, remove -exception handling constructs surrounding code that obviously cannot -throw, remove lexical bindings that contain no variables, and other -assorted simplistic cleanups. The idea is to get rid of the obvious -stuff quickly rather than wait until later when it's more work to get -rid of it. This pass is located in @file{tree-cfg.c} and described by -@code{pass_remove_useless_stmts}. - -@item OpenMP lowering - -If OpenMP generation (@option{-fopenmp}) is enabled, this pass lowers -OpenMP constructs into GIMPLE. - -Lowering of OpenMP constructs involves creating replacement -expressions for local variables that have been mapped using data -sharing clauses, exposing the control flow of most synchronization -directives and adding region markers to facilitate the creation of the -control flow graph. The pass is located in @file{omp-low.c} and is -described by @code{pass_lower_omp}. - -@item OpenMP expansion - -If OpenMP generation (@option{-fopenmp}) is enabled, this pass expands -parallel regions into their own functions to be invoked by the thread -library. The pass is located in @file{omp-low.c} and is described by -@code{pass_expand_omp}. - -@item Lower control flow - -This pass flattens @code{if} statements (@code{COND_EXPR}) -and moves lexical bindings (@code{BIND_EXPR}) out of line. After -this pass, all @code{if} statements will have exactly two @code{goto} -statements in its @code{then} and @code{else} arms. Lexical binding -information for each statement will be found in @code{TREE_BLOCK} rather -than being inferred from its position under a @code{BIND_EXPR}. This -pass is found in @file{gimple-low.c} and is described by -@code{pass_lower_cf}. - -@item Lower exception handling control flow - -This pass decomposes high-level exception handling constructs -(@code{TRY_FINALLY_EXPR} and @code{TRY_CATCH_EXPR}) into a form -that explicitly represents the control flow involved. After this -pass, @code{lookup_stmt_eh_region} will return a non-negative -number for any statement that may have EH control flow semantics; -examine @code{tree_can_throw_internal} or @code{tree_can_throw_external} -for exact semantics. Exact control flow may be extracted from -@code{foreach_reachable_handler}. The EH region nesting tree is defined -in @file{except.h} and built in @file{except.c}. The lowering pass -itself is in @file{tree-eh.c} and is described by @code{pass_lower_eh}. - -@item Build the control flow graph - -This pass decomposes a function into basic blocks and creates all of -the edges that connect them. It is located in @file{tree-cfg.c} and -is described by @code{pass_build_cfg}. - -@item Find all referenced variables - -This pass walks the entire function and collects an array of all -variables referenced in the function, @code{referenced_vars}. The -index at which a variable is found in the array is used as a UID -for the variable within this function. This data is needed by the -SSA rewriting routines. The pass is located in @file{tree-dfa.c} -and is described by @code{pass_referenced_vars}. - -@item Enter static single assignment form - -This pass rewrites the function such that it is in SSA form. After -this pass, all @code{is_gimple_reg} variables will be referenced by -@code{SSA_NAME}, and all occurrences of other variables will be -annotated with @code{VDEFS} and @code{VUSES}; PHI nodes will have -been inserted as necessary for each basic block. This pass is -located in @file{tree-ssa.c} and is described by @code{pass_build_ssa}. - -@item Warn for uninitialized variables - -This pass scans the function for uses of @code{SSA_NAME}s that -are fed by default definition. For non-parameter variables, such -uses are uninitialized. The pass is run twice, before and after -optimization (if turned on). In the first pass we only warn for uses that are -positively uninitialized; in the second pass we warn for uses that -are possibly uninitialized. The pass is located in @file{tree-ssa.c} -and is defined by @code{pass_early_warn_uninitialized} and -@code{pass_late_warn_uninitialized}. - -@item Dead code elimination - -This pass scans the function for statements without side effects whose -result is unused. It does not do memory life analysis, so any value -that is stored in memory is considered used. The pass is run multiple -times throughout the optimization process. It is located in -@file{tree-ssa-dce.c} and is described by @code{pass_dce}. - -@item Dominator optimizations - -This pass performs trivial dominator-based copy and constant propagation, -expression simplification, and jump threading. It is run multiple times -throughout the optimization process. It is located in @file{tree-ssa-dom.c} -and is described by @code{pass_dominator}. - -@item Forward propagation of single-use variables - -This pass attempts to remove redundant computation by substituting -variables that are used once into the expression that uses them and -seeing if the result can be simplified. It is located in -@file{tree-ssa-forwprop.c} and is described by @code{pass_forwprop}. - -@item Copy Renaming - -This pass attempts to change the name of compiler temporaries involved in -copy operations such that SSA->normal can coalesce the copy away. When compiler -temporaries are copies of user variables, it also renames the compiler -temporary to the user variable resulting in better use of user symbols. It is -located in @file{tree-ssa-copyrename.c} and is described by -@code{pass_copyrename}. - -@item PHI node optimizations - -This pass recognizes forms of PHI inputs that can be represented as -conditional expressions and rewrites them into straight line code. -It is located in @file{tree-ssa-phiopt.c} and is described by -@code{pass_phiopt}. - -@item May-alias optimization - -This pass performs a flow sensitive SSA-based points-to analysis. -The resulting may-alias, must-alias, and escape analysis information -is used to promote variables from in-memory addressable objects to -non-aliased variables that can be renamed into SSA form. We also -update the @code{VDEF}/@code{VUSE} memory tags for non-renameable -aggregates so that we get fewer false kills. The pass is located -in @file{tree-ssa-alias.c} and is described by @code{pass_may_alias}. - -Interprocedural points-to information is located in -@file{tree-ssa-structalias.c} and described by @code{pass_ipa_pta}. - -@item Profiling - -This pass instruments the function in order to collect runtime block -and value profiling data. Such data may be fed back into the compiler -on a subsequent run so as to allow optimization based on expected -execution frequencies. The pass is located in @file{tree-profile.c} and -is described by @code{pass_ipa_tree_profile}. - -@item Static profile estimation - -This pass implements series of heuristics to guess propababilities -of branches. The resulting predictions are turned into edge profile -by propagating branches across the control flow graphs. -The pass is located in @file{tree-profile.c} and is described by -@code{pass_profile}. - -@item Lower complex arithmetic - -This pass rewrites complex arithmetic operations into their component -scalar arithmetic operations. The pass is located in @file{tree-complex.c} -and is described by @code{pass_lower_complex}. - -@item Scalar replacement of aggregates - -This pass rewrites suitable non-aliased local aggregate variables into -a set of scalar variables. The resulting scalar variables are -rewritten into SSA form, which allows subsequent optimization passes -to do a significantly better job with them. The pass is located in -@file{tree-sra.c} and is described by @code{pass_sra}. - -@item Dead store elimination - -This pass eliminates stores to memory that are subsequently overwritten -by another store, without any intervening loads. The pass is located -in @file{tree-ssa-dse.c} and is described by @code{pass_dse}. - -@item Tail recursion elimination - -This pass transforms tail recursion into a loop. It is located in -@file{tree-tailcall.c} and is described by @code{pass_tail_recursion}. - -@item Forward store motion - -This pass sinks stores and assignments down the flowgraph closer to their -use point. The pass is located in @file{tree-ssa-sink.c} and is -described by @code{pass_sink_code}. - -@item Partial redundancy elimination - -This pass eliminates partially redundant computations, as well as -performing load motion. The pass is located in @file{tree-ssa-pre.c} -and is described by @code{pass_pre}. - -Just before partial redundancy elimination, if -@option{-funsafe-math-optimizations} is on, GCC tries to convert -divisions to multiplications by the reciprocal. The pass is located -in @file{tree-ssa-math-opts.c} and is described by -@code{pass_cse_reciprocal}. - -@item Full redundancy elimination - -This is a simpler form of PRE that only eliminates redundancies that -occur on all paths. It is located in @file{tree-ssa-pre.c} and -described by @code{pass_fre}. - -@item Loop optimization - -The main driver of the pass is placed in @file{tree-ssa-loop.c} -and described by @code{pass_loop}. - -The optimizations performed by this pass are: - -Loop invariant motion. This pass moves only invariants that -would be hard to handle on RTL level (function calls, operations that expand to -nontrivial sequences of insns). With @option{-funswitch-loops} it also moves -operands of conditions that are invariant out of the loop, so that we can use -just trivial invariantness analysis in loop unswitching. The pass also includes -store motion. The pass is implemented in @file{tree-ssa-loop-im.c}. - -Canonical induction variable creation. This pass creates a simple counter -for number of iterations of the loop and replaces the exit condition of the -loop using it, in case when a complicated analysis is necessary to determine -the number of iterations. Later optimizations then may determine the number -easily. The pass is implemented in @file{tree-ssa-loop-ivcanon.c}. - -Induction variable optimizations. This pass performs standard induction -variable optimizations, including strength reduction, induction variable -merging and induction variable elimination. The pass is implemented in -@file{tree-ssa-loop-ivopts.c}. - -Loop unswitching. This pass moves the conditional jumps that are invariant -out of the loops. To achieve this, a duplicate of the loop is created for -each possible outcome of conditional jump(s). The pass is implemented in -@file{tree-ssa-loop-unswitch.c}. - -The optimizations also use various utility functions contained in -@file{tree-ssa-loop-manip.c}, @file{cfgloop.c}, @file{cfgloopanal.c} and -@file{cfgloopmanip.c}. - -Vectorization. This pass transforms loops to operate on vector types -instead of scalar types. Data parallelism across loop iterations is exploited -to group data elements from consecutive iterations into a vector and operate -on them in parallel. Depending on available target support the loop is -conceptually unrolled by a factor @code{VF} (vectorization factor), which is -the number of elements operated upon in parallel in each iteration, and the -@code{VF} copies of each scalar operation are fused to form a vector operation. -Additional loop transformations such as peeling and versioning may take place -to align the number of iterations, and to align the memory accesses in the -loop. -The pass is implemented in @file{tree-vectorizer.c} (the main driver), -@file{tree-vect-loop.c} and @file{tree-vect-loop-manip.c} (loop specific parts -and general loop utilities), @file{tree-vect-slp} (loop-aware SLP -functionality), @file{tree-vect-stmts.c} and @file{tree-vect-data-refs.c}. -Analysis of data references is in @file{tree-data-ref.c}. - -SLP Vectorization. This pass performs vectorization of straight-line code. The -pass is implemented in @file{tree-vectorizer.c} (the main driver), -@file{tree-vect-slp.c}, @file{tree-vect-stmts.c} and -@file{tree-vect-data-refs.c}. - -Autoparallelization. This pass splits the loop iteration space to run -into several threads. The pass is implemented in @file{tree-parloops.c}. - -Graphite is a loop transformation framework based on the polyhedral -model. Graphite stands for Gimple Represented as Polyhedra. The -internals of this infrastructure are documented in -@w{@uref{http://gcc.gnu.org/wiki/Graphite}}. The passes working on -this representation are implemented in the various @file{graphite-*} -files. - -@item Tree level if-conversion for vectorizer - -This pass applies if-conversion to simple loops to help vectorizer. -We identify if convertible loops, if-convert statements and merge -basic blocks in one big block. The idea is to present loop in such -form so that vectorizer can have one to one mapping between statements -and available vector operations. This pass is located in -@file{tree-if-conv.c} and is described by @code{pass_if_conversion}. - -@item Conditional constant propagation - -This pass relaxes a lattice of values in order to identify those -that must be constant even in the presence of conditional branches. -The pass is located in @file{tree-ssa-ccp.c} and is described -by @code{pass_ccp}. - -A related pass that works on memory loads and stores, and not just -register values, is located in @file{tree-ssa-ccp.c} and described by -@code{pass_store_ccp}. - -@item Conditional copy propagation - -This is similar to constant propagation but the lattice of values is -the ``copy-of'' relation. It eliminates redundant copies from the -code. The pass is located in @file{tree-ssa-copy.c} and described by -@code{pass_copy_prop}. - -A related pass that works on memory copies, and not just register -copies, is located in @file{tree-ssa-copy.c} and described by -@code{pass_store_copy_prop}. - -@item Value range propagation - -This transformation is similar to constant propagation but -instead of propagating single constant values, it propagates -known value ranges. The implementation is based on Patterson's -range propagation algorithm (Accurate Static Branch Prediction by -Value Range Propagation, J. R. C. Patterson, PLDI '95). In -contrast to Patterson's algorithm, this implementation does not -propagate branch probabilities nor it uses more than a single -range per SSA name. This means that the current implementation -cannot be used for branch prediction (though adapting it would -not be difficult). The pass is located in @file{tree-vrp.c} and is -described by @code{pass_vrp}. - -@item Folding built-in functions - -This pass simplifies built-in functions, as applicable, with constant -arguments or with inferable string lengths. It is located in -@file{tree-ssa-ccp.c} and is described by @code{pass_fold_builtins}. - -@item Split critical edges - -This pass identifies critical edges and inserts empty basic blocks -such that the edge is no longer critical. The pass is located in -@file{tree-cfg.c} and is described by @code{pass_split_crit_edges}. - -@item Control dependence dead code elimination - -This pass is a stronger form of dead code elimination that can -eliminate unnecessary control flow statements. It is located -in @file{tree-ssa-dce.c} and is described by @code{pass_cd_dce}. - -@item Tail call elimination - -This pass identifies function calls that may be rewritten into -jumps. No code transformation is actually applied here, but the -data and control flow problem is solved. The code transformation -requires target support, and so is delayed until RTL@. In the -meantime @code{CALL_EXPR_TAILCALL} is set indicating the possibility. -The pass is located in @file{tree-tailcall.c} and is described by -@code{pass_tail_calls}. The RTL transformation is handled by -@code{fixup_tail_calls} in @file{calls.c}. - -@item Warn for function return without value - -For non-void functions, this pass locates return statements that do -not specify a value and issues a warning. Such a statement may have -been injected by falling off the end of the function. This pass is -run last so that we have as much time as possible to prove that the -statement is not reachable. It is located in @file{tree-cfg.c} and -is described by @code{pass_warn_function_return}. - -@item Leave static single assignment form - -This pass rewrites the function such that it is in normal form. At -the same time, we eliminate as many single-use temporaries as possible, -so the intermediate language is no longer GIMPLE, but GENERIC@. The -pass is located in @file{tree-outof-ssa.c} and is described by -@code{pass_del_ssa}. - -@item Merge PHI nodes that feed into one another - -This is part of the CFG cleanup passes. It attempts to join PHI nodes -from a forwarder CFG block into another block with PHI nodes. The -pass is located in @file{tree-cfgcleanup.c} and is described by -@code{pass_merge_phi}. - -@item Return value optimization - -If a function always returns the same local variable, and that local -variable is an aggregate type, then the variable is replaced with the -return value for the function (i.e., the function's DECL_RESULT). This -is equivalent to the C++ named return value optimization applied to -GIMPLE@. The pass is located in @file{tree-nrv.c} and is described by -@code{pass_nrv}. - -@item Return slot optimization - -If a function returns a memory object and is called as @code{var = -foo()}, this pass tries to change the call so that the address of -@code{var} is sent to the caller to avoid an extra memory copy. This -pass is located in @code{tree-nrv.c} and is described by -@code{pass_return_slot}. - -@item Optimize calls to @code{__builtin_object_size} - -This is a propagation pass similar to CCP that tries to remove calls -to @code{__builtin_object_size} when the size of the object can be -computed at compile-time. This pass is located in -@file{tree-object-size.c} and is described by -@code{pass_object_sizes}. - -@item Loop invariant motion - -This pass removes expensive loop-invariant computations out of loops. -The pass is located in @file{tree-ssa-loop.c} and described by -@code{pass_lim}. - -@item Loop nest optimizations - -This is a family of loop transformations that works on loop nests. It -includes loop interchange, scaling, skewing and reversal and they are -all geared to the optimization of data locality in array traversals -and the removal of dependencies that hamper optimizations such as loop -parallelization and vectorization. The pass is located in -@file{tree-loop-linear.c} and described by -@code{pass_linear_transform}. - -@item Removal of empty loops - -This pass removes loops with no code in them. The pass is located in -@file{tree-ssa-loop-ivcanon.c} and described by -@code{pass_empty_loop}. - -@item Unrolling of small loops - -This pass completely unrolls loops with few iterations. The pass -is located in @file{tree-ssa-loop-ivcanon.c} and described by -@code{pass_complete_unroll}. - -@item Predictive commoning - -This pass makes the code reuse the computations from the previous -iterations of the loops, especially loads and stores to memory. -It does so by storing the values of these computations to a bank -of temporary variables that are rotated at the end of loop. To avoid -the need for this rotation, the loop is then unrolled and the copies -of the loop body are rewritten to use the appropriate version of -the temporary variable. This pass is located in @file{tree-predcom.c} -and described by @code{pass_predcom}. - -@item Array prefetching - -This pass issues prefetch instructions for array references inside -loops. The pass is located in @file{tree-ssa-loop-prefetch.c} and -described by @code{pass_loop_prefetch}. - -@item Reassociation - -This pass rewrites arithmetic expressions to enable optimizations that -operate on them, like redundancy elimination and vectorization. The -pass is located in @file{tree-ssa-reassoc.c} and described by -@code{pass_reassoc}. - -@item Optimization of @code{stdarg} functions - -This pass tries to avoid the saving of register arguments into the -stack on entry to @code{stdarg} functions. If the function doesn't -use any @code{va_start} macros, no registers need to be saved. If -@code{va_start} macros are used, the @code{va_list} variables don't -escape the function, it is only necessary to save registers that will -be used in @code{va_arg} macros. For instance, if @code{va_arg} is -only used with integral types in the function, floating point -registers don't need to be saved. This pass is located in -@code{tree-stdarg.c} and described by @code{pass_stdarg}. - -@end itemize - -@node RTL passes -@section RTL passes - -The following briefly describes the RTL generation and optimization -passes that are run after the Tree optimization passes. - -@itemize @bullet -@item RTL generation - -@c Avoiding overfull is tricky here. -The source files for RTL generation include -@file{stmt.c}, -@file{calls.c}, -@file{expr.c}, -@file{explow.c}, -@file{expmed.c}, -@file{function.c}, -@file{optabs.c} -and @file{emit-rtl.c}. -Also, the file -@file{insn-emit.c}, generated from the machine description by the -program @code{genemit}, is used in this pass. The header file -@file{expr.h} is used for communication within this pass. - -@findex genflags -@findex gencodes -The header files @file{insn-flags.h} and @file{insn-codes.h}, -generated from the machine description by the programs @code{genflags} -and @code{gencodes}, tell this pass which standard names are available -for use and which patterns correspond to them. - -@item Generation of exception landing pads - -This pass generates the glue that handles communication between the -exception handling library routines and the exception handlers within -the function. Entry points in the function that are invoked by the -exception handling library are called @dfn{landing pads}. The code -for this pass is located in @file{except.c}. - -@item Control flow graph cleanup - -This pass removes unreachable code, simplifies jumps to next, jumps to -jump, jumps across jumps, etc. The pass is run multiple times. -For historical reasons, it is occasionally referred to as the ``jump -optimization pass''. The bulk of the code for this pass is in -@file{cfgcleanup.c}, and there are support routines in @file{cfgrtl.c} -and @file{jump.c}. - -@item Forward propagation of single-def values - -This pass attempts to remove redundant computation by substituting -variables that come from a single definition, and -seeing if the result can be simplified. It performs copy propagation -and addressing mode selection. The pass is run twice, with values -being propagated into loops only on the second run. The code is -located in @file{fwprop.c}. - -@item Common subexpression elimination - -This pass removes redundant computation within basic blocks, and -optimizes addressing modes based on cost. The pass is run twice. -The code for this pass is located in @file{cse.c}. - -@item Global common subexpression elimination - -This pass performs two -different types of GCSE depending on whether you are optimizing for -size or not (LCM based GCSE tends to increase code size for a gain in -speed, while Morel-Renvoise based GCSE does not). -When optimizing for size, GCSE is done using Morel-Renvoise Partial -Redundancy Elimination, with the exception that it does not try to move -invariants out of loops---that is left to the loop optimization pass. -If MR PRE GCSE is done, code hoisting (aka unification) is also done, as -well as load motion. -If you are optimizing for speed, LCM (lazy code motion) based GCSE is -done. LCM is based on the work of Knoop, Ruthing, and Steffen. LCM -based GCSE also does loop invariant code motion. We also perform load -and store motion when optimizing for speed. -Regardless of which type of GCSE is used, the GCSE pass also performs -global constant and copy propagation. -The source file for this pass is @file{gcse.c}, and the LCM routines -are in @file{lcm.c}. - -@item Loop optimization - -This pass performs several loop related optimizations. -The source files @file{cfgloopanal.c} and @file{cfgloopmanip.c} contain -generic loop analysis and manipulation code. Initialization and finalization -of loop structures is handled by @file{loop-init.c}. -A loop invariant motion pass is implemented in @file{loop-invariant.c}. -Basic block level optimizations---unrolling, and peeling loops--- -are implemented in @file{loop-unroll.c}. -Replacing of the exit condition of loops by special machine-dependent -instructions is handled by @file{loop-doloop.c}. - -@item Jump bypassing - -This pass is an aggressive form of GCSE that transforms the control -flow graph of a function by propagating constants into conditional -branch instructions. The source file for this pass is @file{gcse.c}. - -@item If conversion - -This pass attempts to replace conditional branches and surrounding -assignments with arithmetic, boolean value producing comparison -instructions, and conditional move instructions. In the very last -invocation after reload/LRA, it will generate predicated instructions -when supported by the target. The code is located in @file{ifcvt.c}. - -@item Web construction - -This pass splits independent uses of each pseudo-register. This can -improve effect of the other transformation, such as CSE or register -allocation. The code for this pass is located in @file{web.c}. - -@item Instruction combination - -This pass attempts to combine groups of two or three instructions that -are related by data flow into single instructions. It combines the -RTL expressions for the instructions by substitution, simplifies the -result using algebra, and then attempts to match the result against -the machine description. The code is located in @file{combine.c}. - -@item Mode switching optimization - -This pass looks for instructions that require the processor to be in a -specific ``mode'' and minimizes the number of mode changes required to -satisfy all users. What these modes are, and what they apply to are -completely target-specific. The code for this pass is located in -@file{mode-switching.c}. - -@cindex modulo scheduling -@cindex sms, swing, software pipelining -@item Modulo scheduling - -This pass looks at innermost loops and reorders their instructions -by overlapping different iterations. Modulo scheduling is performed -immediately before instruction scheduling. The code for this pass is -located in @file{modulo-sched.c}. - -@item Instruction scheduling - -This pass looks for instructions whose output will not be available by -the time that it is used in subsequent instructions. Memory loads and -floating point instructions often have this behavior on RISC machines. -It re-orders instructions within a basic block to try to separate the -definition and use of items that otherwise would cause pipeline -stalls. This pass is performed twice, before and after register -allocation. The code for this pass is located in @file{haifa-sched.c}, -@file{sched-deps.c}, @file{sched-ebb.c}, @file{sched-rgn.c} and -@file{sched-vis.c}. - -@item Register allocation - -These passes make sure that all occurrences of pseudo registers are -eliminated, either by allocating them to a hard register, replacing -them by an equivalent expression (e.g.@: a constant) or by placing -them on the stack. This is done in several subpasses: - -@itemize @bullet -@item -The integrated register allocator (@acronym{IRA}). It is called -integrated because coalescing, register live range splitting, and hard -register preferencing are done on-the-fly during coloring. It also -has better integration with the reload/LRA pass. Pseudo-registers spilled -by the allocator or the reload/LRA have still a chance to get -hard-registers if the reload/LRA evicts some pseudo-registers from -hard-registers. The allocator helps to choose better pseudos for -spilling based on their live ranges and to coalesce stack slots -allocated for the spilled pseudo-registers. IRA is a regional -register allocator which is transformed into Chaitin-Briggs allocator -if there is one region. By default, IRA chooses regions using -register pressure but the user can force it to use one region or -regions corresponding to all loops. - -Source files of the allocator are @file{ira.c}, @file{ira-build.c}, -@file{ira-costs.c}, @file{ira-conflicts.c}, @file{ira-color.c}, -@file{ira-emit.c}, @file{ira-lives}, plus header files @file{ira.h} -and @file{ira-int.h} used for the communication between the allocator -and the rest of the compiler and between the IRA files. - -@cindex reloading -@item -Reloading. This pass renumbers pseudo registers with the hardware -registers numbers they were allocated. Pseudo registers that did not -get hard registers are replaced with stack slots. Then it finds -instructions that are invalid because a value has failed to end up in -a register, or has ended up in a register of the wrong kind. It fixes -up these instructions by reloading the problematical values -temporarily into registers. Additional instructions are generated to -do the copying. - -The reload pass also optionally eliminates the frame pointer and inserts -instructions to save and restore call-clobbered registers around calls. - -Source files are @file{reload.c} and @file{reload1.c}, plus the header -@file{reload.h} used for communication between them. - -@cindex Local Register Allocator (LRA) -@item -This pass is a modern replacement of the reload pass. Source files -are @file{lra.c}, @file{lra-assign.c}, @file{lra-coalesce.c}, -@file{lra-constraints.c}, @file{lra-eliminations.c}, -@file{lra-lives.c}, @file{lra-remat.c}, @file{lra-spills.c}, the -header @file{lra-int.h} used for communication between them, and the -header @file{lra.h} used for communication between LRA and the rest of -compiler. - -Unlike the reload pass, intermediate LRA decisions are reflected in -RTL as much as possible. This reduces the number of target-dependent -macros and hooks, leaving instruction constraints as the primary -source of control. - -LRA is run on targets for which TARGET_LRA_P returns true. -@end itemize - -@item Basic block reordering - -This pass implements profile guided code positioning. If profile -information is not available, various types of static analysis are -performed to make the predictions normally coming from the profile -feedback (IE execution frequency, branch probability, etc). It is -implemented in the file @file{bb-reorder.c}, and the various -prediction routines are in @file{predict.c}. - -@item Variable tracking - -This pass computes where the variables are stored at each -position in code and generates notes describing the variable locations -to RTL code. The location lists are then generated according to these -notes to debug information if the debugging information format supports -location lists. The code is located in @file{var-tracking.c}. - -@item Delayed branch scheduling - -This optional pass attempts to find instructions that can go into the -delay slots of other instructions, usually jumps and calls. The code -for this pass is located in @file{reorg.c}. - -@item Branch shortening - -On many RISC machines, branch instructions have a limited range. -Thus, longer sequences of instructions must be used for long branches. -In this pass, the compiler figures out what how far each instruction -will be from each other instruction, and therefore whether the usual -instructions, or the longer sequences, must be used for each branch. -The code for this pass is located in @file{final.c}. - -@item Register-to-stack conversion - -Conversion from usage of some hard registers to usage of a register -stack may be done at this point. Currently, this is supported only -for the floating-point registers of the Intel 80387 coprocessor. The -code for this pass is located in @file{reg-stack.c}. - -@item Final - -This pass outputs the assembler code for the function. The source files -are @file{final.c} plus @file{insn-output.c}; the latter is generated -automatically from the machine description by the tool @file{genoutput}. -The header file @file{conditions.h} is used for communication between -these files. - -@item Debugging information output - -This is run after final because it must output the stack slot offsets -for pseudo registers that did not get hard registers. Source files -are @file{dbxout.c} for DBX symbol table format, @file{sdbout.c} for -SDB symbol table format, @file{dwarfout.c} for DWARF symbol table -format, files @file{dwarf2out.c} and @file{dwarf2asm.c} for DWARF2 -symbol table format, and @file{vmsdbgout.c} for VMS debug symbol table -format. - -@end itemize - -@node Optimization info -@section Optimization info -@include optinfo.texi diff --git a/contrib/gcc-5.0/gcc/doc/plugins.texi b/contrib/gcc-5.0/gcc/doc/plugins.texi deleted file mode 100644 index 637a00edf5..0000000000 --- a/contrib/gcc-5.0/gcc/doc/plugins.texi +++ /dev/null @@ -1,511 +0,0 @@ -@c Copyright (C) 2009-2015 Free Software Foundation, Inc. -@c Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Plugins -@chapter Plugins -@cindex Plugins - -GCC plugin is a loadable module that provides extra -features to the compiler, which they can further pass -around as a shareable module. - -GCC plugins provide developers with a rich subset of -the GCC API to allow them to extend GCC as they see fit. -Whether it is writing an additional optimization pass, -transforming code, or analyzing information, plugins -can be quite useful. - -@menu -* Plugins loading:: How can we load plugins. -* Plugin API:: The APIs for plugins. -* Plugins pass:: How a plugin interact with the pass manager. -* Plugins GC:: How a plugin Interact with GCC Garbage Collector. -* Plugins description:: Giving information about a plugin itself. -* Plugins attr:: Registering custom attributes or pragmas. -* Plugins recording:: Recording information about pass execution. -* Plugins gate:: Controlling which passes are being run. -* Plugins tracking:: Keeping track of available passes. -* Plugins building:: How can we build a plugin. -@end menu - -@node Plugins loading -@section Loading Plugins - -Plugins are supported on platforms that support @option{-ldl --rdynamic}. They are loaded by the compiler using @code{dlopen} -and invoked at pre-determined locations in the compilation -process. - -Plugins are loaded with - -@option{-fplugin=/path/to/@var{name}.so} @option{-fplugin-arg-@var{name}-@var{key1}[=@var{value1}]} - -The plugin arguments are parsed by GCC and passed to respective -plugins as key-value pairs. Multiple plugins can be invoked by -specifying multiple @option{-fplugin} arguments. - -A plugin can be simply given by its short name (no dots or -slashes). When simply passing @option{-fplugin=@var{name}}, the plugin is -loaded from the @file{plugin} directory, so @option{-fplugin=@var{name}} is -the same as @option{-fplugin=`gcc -print-file-name=plugin`/@var{name}.so}, -using backquote shell syntax to query the @file{plugin} directory. - -@node Plugin API -@section Plugin API - -Plugins are activated by the compiler at specific events as defined in -@file{gcc-plugin.h}. For each event of interest, the plugin should -call @code{register_callback} specifying the name of the event and -address of the callback function that will handle that event. - -The header @file{gcc-plugin.h} must be the first gcc header to be included. - -@subsection Plugin license check - -Every plugin should define the global symbol @code{plugin_is_GPL_compatible} -to assert that it has been licensed under a GPL-compatible license. -If this symbol does not exist, the compiler will emit a fatal error -and exit with the error message: - -@smallexample -fatal error: plugin @var{name} is not licensed under a GPL-compatible license -@var{name}: undefined symbol: plugin_is_GPL_compatible -compilation terminated -@end smallexample - -The declared type of the symbol should be int, to match a forward declaration -in @file{gcc-plugin.h} that suppresses C++ mangling. It does not need to be in -any allocated section, though. The compiler merely asserts that -the symbol exists in the global scope. Something like this is enough: - -@smallexample -int plugin_is_GPL_compatible; -@end smallexample - -@subsection Plugin initialization - -Every plugin should export a function called @code{plugin_init} that -is called right after the plugin is loaded. This function is -responsible for registering all the callbacks required by the plugin -and do any other required initialization. - -This function is called from @code{compile_file} right before invoking -the parser. The arguments to @code{plugin_init} are: - -@itemize @bullet -@item @code{plugin_info}: Plugin invocation information. -@item @code{version}: GCC version. -@end itemize - -The @code{plugin_info} struct is defined as follows: - -@smallexample -struct plugin_name_args -@{ - char *base_name; /* Short name of the plugin - (filename without .so suffix). */ - const char *full_name; /* Path to the plugin as specified with - -fplugin=. */ - int argc; /* Number of arguments specified with - -fplugin-arg-.... */ - struct plugin_argument *argv; /* Array of ARGC key-value pairs. */ - const char *version; /* Version string provided by plugin. */ - const char *help; /* Help string provided by plugin. */ -@} -@end smallexample - -If initialization fails, @code{plugin_init} must return a non-zero -value. Otherwise, it should return 0. - -The version of the GCC compiler loading the plugin is described by the -following structure: - -@smallexample -struct plugin_gcc_version -@{ - const char *basever; - const char *datestamp; - const char *devphase; - const char *revision; - const char *configuration_arguments; -@}; -@end smallexample - -The function @code{plugin_default_version_check} takes two pointers to -such structure and compare them field by field. It can be used by the -plugin's @code{plugin_init} function. - -The version of GCC used to compile the plugin can be found in the symbol -@code{gcc_version} defined in the header @file{plugin-version.h}. The -recommended version check to perform looks like - -@smallexample -#include "plugin-version.h" -... - -int -plugin_init (struct plugin_name_args *plugin_info, - struct plugin_gcc_version *version) -@{ - if (!plugin_default_version_check (version, &gcc_version)) - return 1; - -@} -@end smallexample - -but you can also check the individual fields if you want a less strict check. - -@subsection Plugin callbacks - -Callback functions have the following prototype: - -@smallexample -/* The prototype for a plugin callback function. - gcc_data - event-specific data provided by GCC - user_data - plugin-specific data provided by the plug-in. */ -typedef void (*plugin_callback_func)(void *gcc_data, void *user_data); -@end smallexample - -Callbacks can be invoked at the following pre-determined events: - - -@smallexample -enum plugin_event -@{ - PLUGIN_PASS_MANAGER_SETUP, /* To hook into pass manager. */ - PLUGIN_FINISH_TYPE, /* After finishing parsing a type. */ - PLUGIN_FINISH_DECL, /* After finishing parsing a declaration. */ - PLUGIN_FINISH_UNIT, /* Useful for summary processing. */ - PLUGIN_PRE_GENERICIZE, /* Allows to see low level AST in C and C++ frontends. */ - PLUGIN_FINISH, /* Called before GCC exits. */ - PLUGIN_INFO, /* Information about the plugin. */ - PLUGIN_GGC_START, /* Called at start of GCC Garbage Collection. */ - PLUGIN_GGC_MARKING, /* Extend the GGC marking. */ - PLUGIN_GGC_END, /* Called at end of GGC. */ - PLUGIN_REGISTER_GGC_ROOTS, /* Register an extra GGC root table. */ - PLUGIN_ATTRIBUTES, /* Called during attribute registration */ - PLUGIN_START_UNIT, /* Called before processing a translation unit. */ - PLUGIN_PRAGMAS, /* Called during pragma registration. */ - /* Called before first pass from all_passes. */ - PLUGIN_ALL_PASSES_START, - /* Called after last pass from all_passes. */ - PLUGIN_ALL_PASSES_END, - /* Called before first ipa pass. */ - PLUGIN_ALL_IPA_PASSES_START, - /* Called after last ipa pass. */ - PLUGIN_ALL_IPA_PASSES_END, - /* Allows to override pass gate decision for current_pass. */ - PLUGIN_OVERRIDE_GATE, - /* Called before executing a pass. */ - PLUGIN_PASS_EXECUTION, - /* Called before executing subpasses of a GIMPLE_PASS in - execute_ipa_pass_list. */ - PLUGIN_EARLY_GIMPLE_PASSES_START, - /* Called after executing subpasses of a GIMPLE_PASS in - execute_ipa_pass_list. */ - PLUGIN_EARLY_GIMPLE_PASSES_END, - /* Called when a pass is first instantiated. */ - PLUGIN_NEW_PASS, -/* Called when a file is #include-d or given via the #line directive. - This could happen many times. The event data is the included file path, - as a const char* pointer. */ - PLUGIN_INCLUDE_FILE, - - PLUGIN_EVENT_FIRST_DYNAMIC /* Dummy event used for indexing callback - array. */ -@}; -@end smallexample - -In addition, plugins can also look up the enumerator of a named event, -and / or generate new events dynamically, by calling the function -@code{get_named_event_id}. - -To register a callback, the plugin calls @code{register_callback} with -the arguments: - -@itemize -@item @code{char *name}: Plugin name. -@item @code{int event}: The event code. -@item @code{plugin_callback_func callback}: The function that handles @code{event}. -@item @code{void *user_data}: Pointer to plugin-specific data. -@end itemize - -For the @i{PLUGIN_PASS_MANAGER_SETUP}, @i{PLUGIN_INFO}, and -@i{PLUGIN_REGISTER_GGC_ROOTS} pseudo-events the @code{callback} should be null, -and the @code{user_data} is specific. - -When the @i{PLUGIN_PRAGMAS} event is triggered (with a null pointer as -data from GCC), plugins may register their own pragmas. Notice that -pragmas are not available from @file{lto1}, so plugins used with -@code{-flto} option to GCC during link-time optimization cannot use -pragmas and do not even see functions like @code{c_register_pragma} or -@code{pragma_lex}. - -The @i{PLUGIN_INCLUDE_FILE} event, with a @code{const char*} file path as -GCC data, is triggered for processing of @code{#include} or -@code{#line} directives. - -The @i{PLUGIN_FINISH} event is the last time that plugins can call GCC -functions, notably emit diagnostics with @code{warning}, @code{error} -etc. - - -@node Plugins pass -@section Interacting with the pass manager - -There needs to be a way to add/reorder/remove passes dynamically. This -is useful for both analysis plugins (plugging in after a certain pass -such as CFG or an IPA pass) and optimization plugins. - -Basic support for inserting new passes or replacing existing passes is -provided. A plugin registers a new pass with GCC by calling -@code{register_callback} with the @code{PLUGIN_PASS_MANAGER_SETUP} -event and a pointer to a @code{struct register_pass_info} object defined as follows - -@smallexample -enum pass_positioning_ops -@{ - PASS_POS_INSERT_AFTER, // Insert after the reference pass. - PASS_POS_INSERT_BEFORE, // Insert before the reference pass. - PASS_POS_REPLACE // Replace the reference pass. -@}; - -struct register_pass_info -@{ - struct opt_pass *pass; /* New pass provided by the plugin. */ - const char *reference_pass_name; /* Name of the reference pass for hooking - up the new pass. */ - int ref_pass_instance_number; /* Insert the pass at the specified - instance number of the reference pass. */ - /* Do it for every instance if it is 0. */ - enum pass_positioning_ops pos_op; /* how to insert the new pass. */ -@}; - - -/* Sample plugin code that registers a new pass. */ -int -plugin_init (struct plugin_name_args *plugin_info, - struct plugin_gcc_version *version) -@{ - struct register_pass_info pass_info; - - ... - - /* Code to fill in the pass_info object with new pass information. */ - - ... - - /* Register the new pass. */ - register_callback (plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); - - ... -@} -@end smallexample - - -@node Plugins GC -@section Interacting with the GCC Garbage Collector - -Some plugins may want to be informed when GGC (the GCC Garbage -Collector) is running. They can register callbacks for the -@code{PLUGIN_GGC_START} and @code{PLUGIN_GGC_END} events (for which -the callback is called with a null @code{gcc_data}) to be notified of -the start or end of the GCC garbage collection. - -Some plugins may need to have GGC mark additional data. This can be -done by registering a callback (called with a null @code{gcc_data}) -for the @code{PLUGIN_GGC_MARKING} event. Such callbacks can call the -@code{ggc_set_mark} routine, preferably through the @code{ggc_mark} macro -(and conversely, these routines should usually not be used in plugins -outside of the @code{PLUGIN_GGC_MARKING} event). Plugins that wish to hold -weak references to gc data may also use this event to drop weak references when -the object is about to be collected. The @code{ggc_marked_p} function can be -used to tell if an object is marked, or is about to be collected. The -@code{gt_clear_cache} overloads which some types define may also be of use in -managing weak references. - -Some plugins may need to add extra GGC root tables, e.g. to handle their own -@code{GTY}-ed data. This can be done with the @code{PLUGIN_REGISTER_GGC_ROOTS} -pseudo-event with a null callback and the extra root table (of type @code{struct -ggc_root_tab*}) as @code{user_data}. Running the - @code{gengtype -p @var{source-dir} @var{file-list} @var{plugin*.c} ...} -utility generates these extra root tables. - -You should understand the details of memory management inside GCC -before using @code{PLUGIN_GGC_MARKING} or @code{PLUGIN_REGISTER_GGC_ROOTS}. - - -@node Plugins description -@section Giving information about a plugin - -A plugin should give some information to the user about itself. This -uses the following structure: - -@smallexample -struct plugin_info -@{ - const char *version; - const char *help; -@}; -@end smallexample - -Such a structure is passed as the @code{user_data} by the plugin's -init routine using @code{register_callback} with the -@code{PLUGIN_INFO} pseudo-event and a null callback. - -@node Plugins attr -@section Registering custom attributes or pragmas - -For analysis (or other) purposes it is useful to be able to add custom -attributes or pragmas. - -The @code{PLUGIN_ATTRIBUTES} callback is called during attribute -registration. Use the @code{register_attribute} function to register -custom attributes. - -@smallexample -/* Attribute handler callback */ -static tree -handle_user_attribute (tree *node, tree name, tree args, - int flags, bool *no_add_attrs) -@{ - return NULL_TREE; -@} - -/* Attribute definition */ -static struct attribute_spec user_attr = - @{ "user", 1, 1, false, false, false, handle_user_attribute, false @}; - -/* Plugin callback called during attribute registration. -Registered with register_callback (plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL) -*/ -static void -register_attributes (void *event_data, void *data) -@{ - warning (0, G_("Callback to register attributes")); - register_attribute (&user_attr); -@} - -@end smallexample - - -The @i{PLUGIN_PRAGMAS} callback is called once during pragmas -registration. Use the @code{c_register_pragma}, -@code{c_register_pragma_with_data}, -@code{c_register_pragma_with_expansion}, -@code{c_register_pragma_with_expansion_and_data} functions to register -custom pragmas and their handlers (which often want to call -@code{pragma_lex}) from @file{c-family/c-pragma.h}. - -@smallexample -/* Plugin callback called during pragmas registration. Registered with - register_callback (plugin_name, PLUGIN_PRAGMAS, - register_my_pragma, NULL); -*/ -static void -register_my_pragma (void *event_data, void *data) -@{ - warning (0, G_("Callback to register pragmas")); - c_register_pragma ("GCCPLUGIN", "sayhello", handle_pragma_sayhello); -@} -@end smallexample - -It is suggested to pass @code{"GCCPLUGIN"} (or a short name identifying -your plugin) as the ``space'' argument of your pragma. - -Pragmas registered with @code{c_register_pragma_with_expansion} or -@code{c_register_pragma_with_expansion_and_data} support -preprocessor expansions. For example: - -@smallexample -#define NUMBER 10 -#pragma GCCPLUGIN foothreshold (NUMBER) -@end smallexample - -@node Plugins recording -@section Recording information about pass execution - -The event PLUGIN_PASS_EXECUTION passes the pointer to the executed pass -(the same as current_pass) as @code{gcc_data} to the callback. You can also -inspect cfun to find out about which function this pass is executed for. -Note that this event will only be invoked if the gate check (if -applicable, modified by PLUGIN_OVERRIDE_GATE) succeeds. -You can use other hooks, like @code{PLUGIN_ALL_PASSES_START}, -@code{PLUGIN_ALL_PASSES_END}, @code{PLUGIN_ALL_IPA_PASSES_START}, -@code{PLUGIN_ALL_IPA_PASSES_END}, @code{PLUGIN_EARLY_GIMPLE_PASSES_START}, -and/or @code{PLUGIN_EARLY_GIMPLE_PASSES_END} to manipulate global state -in your plugin(s) in order to get context for the pass execution. - - -@node Plugins gate -@section Controlling which passes are being run - -After the original gate function for a pass is called, its result -- the gate status - is stored as an integer. -Then the event @code{PLUGIN_OVERRIDE_GATE} is invoked, with a pointer -to the gate status in the @code{gcc_data} parameter to the callback function. -A nonzero value of the gate status means that the pass is to be executed. -You can both read and write the gate status via the passed pointer. - - -@node Plugins tracking -@section Keeping track of available passes - -When your plugin is loaded, you can inspect the various -pass lists to determine what passes are available. However, other -plugins might add new passes. Also, future changes to GCC might cause -generic passes to be added after plugin loading. -When a pass is first added to one of the pass lists, the event -@code{PLUGIN_NEW_PASS} is invoked, with the callback parameter -@code{gcc_data} pointing to the new pass. - - -@node Plugins building -@section Building GCC plugins - -If plugins are enabled, GCC installs the headers needed to build a -plugin (somewhere in the installation tree, e.g. under -@file{/usr/local}). In particular a @file{plugin/include} directory -is installed, containing all the header files needed to build plugins. - -On most systems, you can query this @code{plugin} directory by -invoking @command{gcc -print-file-name=plugin} (replace if needed -@command{gcc} with the appropriate program path). - -Inside plugins, this @code{plugin} directory name can be queried by -calling @code{default_plugin_dir_name ()}. - -Plugins may know, when they are compiled, the GCC version for which -@file{plugin-version.h} is provided. The constant macros -@code{GCCPLUGIN_VERSION_MAJOR}, @code{GCCPLUGIN_VERSION_MINOR}, -@code{GCCPLUGIN_VERSION_PATCHLEVEL}, @code{GCCPLUGIN_VERSION} are -integer numbers, so a plugin could ensure it is built for GCC 4.7 with -@smallexample -#if GCCPLUGIN_VERSION != 4007 -#error this GCC plugin is for GCC 4.7 -#endif -@end smallexample - -The following GNU Makefile excerpt shows how to build a simple plugin: - -@smallexample -HOST_GCC=g++ -TARGET_GCC=gcc -PLUGIN_SOURCE_FILES= plugin1.c plugin2.cc -GCCPLUGINS_DIR:= $(shell $(TARGET_GCC) -print-file-name=plugin) -CXXFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -fno-rtti -O2 - -plugin.so: $(PLUGIN_SOURCE_FILES) - $(HOST_GCC) -shared $(CXXFLAGS) $^ -o $@@ -@end smallexample - -A single source file plugin may be built with @code{g++ -I`gcc --print-file-name=plugin`/include -fPIC -shared -fno-rtti -O2 plugin.c -o -plugin.so}, using backquote shell syntax to query the @file{plugin} -directory. - -When a plugin needs to use @command{gengtype}, be sure that both -@file{gengtype} and @file{gtype.state} have the same version as the -GCC for which the plugin is built. diff --git a/contrib/gcc-5.0/gcc/doc/portability.texi b/contrib/gcc-5.0/gcc/doc/portability.texi deleted file mode 100644 index b89a9bf2fd..0000000000 --- a/contrib/gcc-5.0/gcc/doc/portability.texi +++ /dev/null @@ -1,39 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Portability -@chapter GCC and Portability -@cindex portability -@cindex GCC and portability - -GCC itself aims to be portable to any machine where @code{int} is at least -a 32-bit type. It aims to target machines with a flat (non-segmented) byte -addressed data address space (the code address space can be separate). -Target ABIs may have 8, 16, 32 or 64-bit @code{int} type. @code{char} -can be wider than 8 bits. - -GCC gets most of the information about the target machine from a machine -description which gives an algebraic formula for each of the machine's -instructions. This is a very clean way to describe the target. But when -the compiler needs information that is difficult to express in this -fashion, ad-hoc parameters have been defined for machine descriptions. -The purpose of portability is to reduce the total work needed on the -compiler; it was not of interest for its own sake. - -@cindex endianness -@cindex autoincrement addressing, availability -@findex abort -GCC does not contain machine dependent code, but it does contain code -that depends on machine parameters such as endianness (whether the most -significant byte has the highest or lowest address of the bytes in a word) -and the availability of autoincrement addressing. In the RTL-generation -pass, it is often necessary to have multiple strategies for generating code -for a particular kind of syntax tree, strategies that are usable for different -combinations of parameters. Often, not all possible cases have been -addressed, but only the common ones or only the ones that have been -encountered. As a result, a new target may require additional -strategies. You will know -if this happens because the compiler will call @code{abort}. Fortunately, -the new strategies can be added in a machine-independent fashion, and will -affect only the target machines that need them. diff --git a/contrib/gcc-5.0/gcc/doc/rtl.texi b/contrib/gcc-5.0/gcc/doc/rtl.texi deleted file mode 100644 index a5275f4ba0..0000000000 --- a/contrib/gcc-5.0/gcc/doc/rtl.texi +++ /dev/null @@ -1,4238 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node RTL -@chapter RTL Representation -@cindex RTL representation -@cindex representation of RTL -@cindex Register Transfer Language (RTL) - -The last part of the compiler work is done on a low-level intermediate -representation called Register Transfer Language. In this language, the -instructions to be output are described, pretty much one by one, in an -algebraic form that describes what the instruction does. - -RTL is inspired by Lisp lists. It has both an internal form, made up of -structures that point at other structures, and a textual form that is used -in the machine description and in printed debugging dumps. The textual -form uses nested parentheses to indicate the pointers in the internal form. - -@menu -* RTL Objects:: Expressions vs vectors vs strings vs integers. -* RTL Classes:: Categories of RTL expression objects, and their structure. -* Accessors:: Macros to access expression operands or vector elts. -* Special Accessors:: Macros to access specific annotations on RTL. -* Flags:: Other flags in an RTL expression. -* Machine Modes:: Describing the size and format of a datum. -* Constants:: Expressions with constant values. -* Regs and Memory:: Expressions representing register contents or memory. -* Arithmetic:: Expressions representing arithmetic on other expressions. -* Comparisons:: Expressions representing comparison of expressions. -* Bit-Fields:: Expressions representing bit-fields in memory or reg. -* Vector Operations:: Expressions involving vector datatypes. -* Conversions:: Extending, truncating, floating or fixing. -* RTL Declarations:: Declaring volatility, constancy, etc. -* Side Effects:: Expressions for storing in registers, etc. -* Incdec:: Embedded side-effects for autoincrement addressing. -* Assembler:: Representing @code{asm} with operands. -* Debug Information:: Expressions representing debugging information. -* Insns:: Expression types for entire insns. -* Calls:: RTL representation of function call insns. -* Sharing:: Some expressions are unique; others *must* be copied. -* Reading RTL:: Reading textual RTL from a file. -@end menu - -@node RTL Objects -@section RTL Object Types -@cindex RTL object types - -@cindex RTL integers -@cindex RTL strings -@cindex RTL vectors -@cindex RTL expression -@cindex RTX (See RTL) -RTL uses five kinds of objects: expressions, integers, wide integers, -strings and vectors. Expressions are the most important ones. An RTL -expression (``RTX'', for short) is a C structure, but it is usually -referred to with a pointer; a type that is given the typedef name -@code{rtx}. - -An integer is simply an @code{int}; their written form uses decimal -digits. A wide integer is an integral object whose type is -@code{HOST_WIDE_INT}; their written form uses decimal digits. - -A string is a sequence of characters. In core it is represented as a -@code{char *} in usual C fashion, and it is written in C syntax as well. -However, strings in RTL may never be null. If you write an empty string in -a machine description, it is represented in core as a null pointer rather -than as a pointer to a null character. In certain contexts, these null -pointers instead of strings are valid. Within RTL code, strings are most -commonly found inside @code{symbol_ref} expressions, but they appear in -other contexts in the RTL expressions that make up machine descriptions. - -In a machine description, strings are normally written with double -quotes, as you would in C@. However, strings in machine descriptions may -extend over many lines, which is invalid C, and adjacent string -constants are not concatenated as they are in C@. Any string constant -may be surrounded with a single set of parentheses. Sometimes this -makes the machine description easier to read. - -There is also a special syntax for strings, which can be useful when C -code is embedded in a machine description. Wherever a string can -appear, it is also valid to write a C-style brace block. The entire -brace block, including the outermost pair of braces, is considered to be -the string constant. Double quote characters inside the braces are not -special. Therefore, if you write string constants in the C code, you -need not escape each quote character with a backslash. - -A vector contains an arbitrary number of pointers to expressions. The -number of elements in the vector is explicitly present in the vector. -The written form of a vector consists of square brackets -(@samp{[@dots{}]}) surrounding the elements, in sequence and with -whitespace separating them. Vectors of length zero are not created; -null pointers are used instead. - -@cindex expression codes -@cindex codes, RTL expression -@findex GET_CODE -@findex PUT_CODE -Expressions are classified by @dfn{expression codes} (also called RTX -codes). The expression code is a name defined in @file{rtl.def}, which is -also (in uppercase) a C enumeration constant. The possible expression -codes and their meanings are machine-independent. The code of an RTX can -be extracted with the macro @code{GET_CODE (@var{x})} and altered with -@code{PUT_CODE (@var{x}, @var{newcode})}. - -The expression code determines how many operands the expression contains, -and what kinds of objects they are. In RTL, unlike Lisp, you cannot tell -by looking at an operand what kind of object it is. Instead, you must know -from its context---from the expression code of the containing expression. -For example, in an expression of code @code{subreg}, the first operand is -to be regarded as an expression and the second operand as an integer. In -an expression of code @code{plus}, there are two operands, both of which -are to be regarded as expressions. In a @code{symbol_ref} expression, -there is one operand, which is to be regarded as a string. - -Expressions are written as parentheses containing the name of the -expression type, its flags and machine mode if any, and then the operands -of the expression (separated by spaces). - -Expression code names in the @samp{md} file are written in lowercase, -but when they appear in C code they are written in uppercase. In this -manual, they are shown as follows: @code{const_int}. - -@cindex (nil) -@cindex nil -In a few contexts a null pointer is valid where an expression is normally -wanted. The written form of this is @code{(nil)}. - -@node RTL Classes -@section RTL Classes and Formats -@cindex RTL classes -@cindex classes of RTX codes -@cindex RTX codes, classes of -@findex GET_RTX_CLASS - -The various expression codes are divided into several @dfn{classes}, -which are represented by single characters. You can determine the class -of an RTX code with the macro @code{GET_RTX_CLASS (@var{code})}. -Currently, @file{rtl.def} defines these classes: - -@table @code -@item RTX_OBJ -An RTX code that represents an actual object, such as a register -(@code{REG}) or a memory location (@code{MEM}, @code{SYMBOL_REF}). -@code{LO_SUM}) is also included; instead, @code{SUBREG} and -@code{STRICT_LOW_PART} are not in this class, but in class @code{x}. - -@item RTX_CONST_OBJ -An RTX code that represents a constant object. @code{HIGH} is also -included in this class. - -@item RTX_COMPARE -An RTX code for a non-symmetric comparison, such as @code{GEU} or -@code{LT}. - -@item RTX_COMM_COMPARE -An RTX code for a symmetric (commutative) comparison, such as @code{EQ} -or @code{ORDERED}. - -@item RTX_UNARY -An RTX code for a unary arithmetic operation, such as @code{NEG}, -@code{NOT}, or @code{ABS}. This category also includes value extension -(sign or zero) and conversions between integer and floating point. - -@item RTX_COMM_ARITH -An RTX code for a commutative binary operation, such as @code{PLUS} or -@code{AND}. @code{NE} and @code{EQ} are comparisons, so they have class -@code{<}. - -@item RTX_BIN_ARITH -An RTX code for a non-commutative binary operation, such as @code{MINUS}, -@code{DIV}, or @code{ASHIFTRT}. - -@item RTX_BITFIELD_OPS -An RTX code for a bit-field operation. Currently only -@code{ZERO_EXTRACT} and @code{SIGN_EXTRACT}. These have three inputs -and are lvalues (so they can be used for insertion as well). -@xref{Bit-Fields}. - -@item RTX_TERNARY -An RTX code for other three input operations. Currently only -@code{IF_THEN_ELSE}, @code{VEC_MERGE}, @code{SIGN_EXTRACT}, -@code{ZERO_EXTRACT}, and @code{FMA}. - -@item RTX_INSN -An RTX code for an entire instruction: @code{INSN}, @code{JUMP_INSN}, and -@code{CALL_INSN}. @xref{Insns}. - -@item RTX_MATCH -An RTX code for something that matches in insns, such as -@code{MATCH_DUP}. These only occur in machine descriptions. - -@item RTX_AUTOINC -An RTX code for an auto-increment addressing mode, such as -@code{POST_INC}. @samp{XEXP (@var{x}, 0)} gives the auto-modified -register. - -@item RTX_EXTRA -All other RTX codes. This category includes the remaining codes used -only in machine descriptions (@code{DEFINE_*}, etc.). It also includes -all the codes describing side effects (@code{SET}, @code{USE}, -@code{CLOBBER}, etc.) and the non-insns that may appear on an insn -chain, such as @code{NOTE}, @code{BARRIER}, and @code{CODE_LABEL}. -@code{SUBREG} is also part of this class. -@end table - -@cindex RTL format -For each expression code, @file{rtl.def} specifies the number of -contained objects and their kinds using a sequence of characters -called the @dfn{format} of the expression code. For example, -the format of @code{subreg} is @samp{ei}. - -@cindex RTL format characters -These are the most commonly used format characters: - -@table @code -@item e -An expression (actually a pointer to an expression). - -@item i -An integer. - -@item w -A wide integer. - -@item s -A string. - -@item E -A vector of expressions. -@end table - -A few other format characters are used occasionally: - -@table @code -@item u -@samp{u} is equivalent to @samp{e} except that it is printed differently -in debugging dumps. It is used for pointers to insns. - -@item n -@samp{n} is equivalent to @samp{i} except that it is printed differently -in debugging dumps. It is used for the line number or code number of a -@code{note} insn. - -@item S -@samp{S} indicates a string which is optional. In the RTL objects in -core, @samp{S} is equivalent to @samp{s}, but when the object is read, -from an @samp{md} file, the string value of this operand may be omitted. -An omitted string is taken to be the null string. - -@item V -@samp{V} indicates a vector which is optional. In the RTL objects in -core, @samp{V} is equivalent to @samp{E}, but when the object is read -from an @samp{md} file, the vector value of this operand may be omitted. -An omitted vector is effectively the same as a vector of no elements. - -@item B -@samp{B} indicates a pointer to basic block structure. - -@item 0 -@samp{0} means a slot whose contents do not fit any normal category. -@samp{0} slots are not printed at all in dumps, and are often used in -special ways by small parts of the compiler. -@end table - -There are macros to get the number of operands and the format -of an expression code: - -@table @code -@findex GET_RTX_LENGTH -@item GET_RTX_LENGTH (@var{code}) -Number of operands of an RTX of code @var{code}. - -@findex GET_RTX_FORMAT -@item GET_RTX_FORMAT (@var{code}) -The format of an RTX of code @var{code}, as a C string. -@end table - -Some classes of RTX codes always have the same format. For example, it -is safe to assume that all comparison operations have format @code{ee}. - -@table @code -@item 1 -All codes of this class have format @code{e}. - -@item < -@itemx c -@itemx 2 -All codes of these classes have format @code{ee}. - -@item b -@itemx 3 -All codes of these classes have format @code{eee}. - -@item i -All codes of this class have formats that begin with @code{iuueiee}. -@xref{Insns}. Note that not all RTL objects linked onto an insn chain -are of class @code{i}. - -@item o -@itemx m -@itemx x -You can make no assumptions about the format of these codes. -@end table - -@node Accessors -@section Access to Operands -@cindex accessors -@cindex access to operands -@cindex operand access - -@findex XEXP -@findex XINT -@findex XWINT -@findex XSTR -Operands of expressions are accessed using the macros @code{XEXP}, -@code{XINT}, @code{XWINT} and @code{XSTR}. Each of these macros takes -two arguments: an expression-pointer (RTX) and an operand number -(counting from zero). Thus, - -@smallexample -XEXP (@var{x}, 2) -@end smallexample - -@noindent -accesses operand 2 of expression @var{x}, as an expression. - -@smallexample -XINT (@var{x}, 2) -@end smallexample - -@noindent -accesses the same operand as an integer. @code{XSTR}, used in the same -fashion, would access it as a string. - -Any operand can be accessed as an integer, as an expression or as a string. -You must choose the correct method of access for the kind of value actually -stored in the operand. You would do this based on the expression code of -the containing expression. That is also how you would know how many -operands there are. - -For example, if @var{x} is a @code{subreg} expression, you know that it has -two operands which can be correctly accessed as @code{XEXP (@var{x}, 0)} -and @code{XINT (@var{x}, 1)}. If you did @code{XINT (@var{x}, 0)}, you -would get the address of the expression operand but cast as an integer; -that might occasionally be useful, but it would be cleaner to write -@code{(int) XEXP (@var{x}, 0)}. @code{XEXP (@var{x}, 1)} would also -compile without error, and would return the second, integer operand cast as -an expression pointer, which would probably result in a crash when -accessed. Nothing stops you from writing @code{XEXP (@var{x}, 28)} either, -but this will access memory past the end of the expression with -unpredictable results. - -Access to operands which are vectors is more complicated. You can use the -macro @code{XVEC} to get the vector-pointer itself, or the macros -@code{XVECEXP} and @code{XVECLEN} to access the elements and length of a -vector. - -@table @code -@findex XVEC -@item XVEC (@var{exp}, @var{idx}) -Access the vector-pointer which is operand number @var{idx} in @var{exp}. - -@findex XVECLEN -@item XVECLEN (@var{exp}, @var{idx}) -Access the length (number of elements) in the vector which is -in operand number @var{idx} in @var{exp}. This value is an @code{int}. - -@findex XVECEXP -@item XVECEXP (@var{exp}, @var{idx}, @var{eltnum}) -Access element number @var{eltnum} in the vector which is -in operand number @var{idx} in @var{exp}. This value is an RTX@. - -It is up to you to make sure that @var{eltnum} is not negative -and is less than @code{XVECLEN (@var{exp}, @var{idx})}. -@end table - -All the macros defined in this section expand into lvalues and therefore -can be used to assign the operands, lengths and vector elements as well as -to access them. - -@node Special Accessors -@section Access to Special Operands -@cindex access to special operands - -Some RTL nodes have special annotations associated with them. - -@table @code -@item MEM -@table @code -@findex MEM_ALIAS_SET -@item MEM_ALIAS_SET (@var{x}) -If 0, @var{x} is not in any alias set, and may alias anything. Otherwise, -@var{x} can only alias @code{MEM}s in a conflicting alias set. This value -is set in a language-dependent manner in the front-end, and should not be -altered in the back-end. In some front-ends, these numbers may correspond -in some way to types, or other language-level entities, but they need not, -and the back-end makes no such assumptions. -These set numbers are tested with @code{alias_sets_conflict_p}. - -@findex MEM_EXPR -@item MEM_EXPR (@var{x}) -If this register is known to hold the value of some user-level -declaration, this is that tree node. It may also be a -@code{COMPONENT_REF}, in which case this is some field reference, -and @code{TREE_OPERAND (@var{x}, 0)} contains the declaration, -or another @code{COMPONENT_REF}, or null if there is no compile-time -object associated with the reference. - -@findex MEM_OFFSET_KNOWN_P -@item MEM_OFFSET_KNOWN_P (@var{x}) -True if the offset of the memory reference from @code{MEM_EXPR} is known. -@samp{MEM_OFFSET (@var{x})} provides the offset if so. - -@findex MEM_OFFSET -@item MEM_OFFSET (@var{x}) -The offset from the start of @code{MEM_EXPR}. The value is only valid if -@samp{MEM_OFFSET_KNOWN_P (@var{x})} is true. - -@findex MEM_SIZE_KNOWN_P -@item MEM_SIZE_KNOWN_P (@var{x}) -True if the size of the memory reference is known. -@samp{MEM_SIZE (@var{x})} provides its size if so. - -@findex MEM_SIZE -@item MEM_SIZE (@var{x}) -The size in bytes of the memory reference. -This is mostly relevant for @code{BLKmode} references as otherwise -the size is implied by the mode. The value is only valid if -@samp{MEM_SIZE_KNOWN_P (@var{x})} is true. - -@findex MEM_ALIGN -@item MEM_ALIGN (@var{x}) -The known alignment in bits of the memory reference. - -@findex MEM_ADDR_SPACE -@item MEM_ADDR_SPACE (@var{x}) -The address space of the memory reference. This will commonly be zero -for the generic address space. -@end table - -@item REG -@table @code -@findex ORIGINAL_REGNO -@item ORIGINAL_REGNO (@var{x}) -This field holds the number the register ``originally'' had; for a -pseudo register turned into a hard reg this will hold the old pseudo -register number. - -@findex REG_EXPR -@item REG_EXPR (@var{x}) -If this register is known to hold the value of some user-level -declaration, this is that tree node. - -@findex REG_OFFSET -@item REG_OFFSET (@var{x}) -If this register is known to hold the value of some user-level -declaration, this is the offset into that logical storage. -@end table - -@item SYMBOL_REF -@table @code -@findex SYMBOL_REF_DECL -@item SYMBOL_REF_DECL (@var{x}) -If the @code{symbol_ref} @var{x} was created for a @code{VAR_DECL} or -a @code{FUNCTION_DECL}, that tree is recorded here. If this value is -null, then @var{x} was created by back end code generation routines, -and there is no associated front end symbol table entry. - -@code{SYMBOL_REF_DECL} may also point to a tree of class @code{'c'}, -that is, some sort of constant. In this case, the @code{symbol_ref} -is an entry in the per-file constant pool; again, there is no associated -front end symbol table entry. - -@findex SYMBOL_REF_CONSTANT -@item SYMBOL_REF_CONSTANT (@var{x}) -If @samp{CONSTANT_POOL_ADDRESS_P (@var{x})} is true, this is the constant -pool entry for @var{x}. It is null otherwise. - -@findex SYMBOL_REF_DATA -@item SYMBOL_REF_DATA (@var{x}) -A field of opaque type used to store @code{SYMBOL_REF_DECL} or -@code{SYMBOL_REF_CONSTANT}. - -@findex SYMBOL_REF_FLAGS -@item SYMBOL_REF_FLAGS (@var{x}) -In a @code{symbol_ref}, this is used to communicate various predicates -about the symbol. Some of these are common enough to be computed by -common code, some are specific to the target. The common bits are: - -@table @code -@findex SYMBOL_REF_FUNCTION_P -@findex SYMBOL_FLAG_FUNCTION -@item SYMBOL_FLAG_FUNCTION -Set if the symbol refers to a function. - -@findex SYMBOL_REF_LOCAL_P -@findex SYMBOL_FLAG_LOCAL -@item SYMBOL_FLAG_LOCAL -Set if the symbol is local to this ``module''. -See @code{TARGET_BINDS_LOCAL_P}. - -@findex SYMBOL_REF_EXTERNAL_P -@findex SYMBOL_FLAG_EXTERNAL -@item SYMBOL_FLAG_EXTERNAL -Set if this symbol is not defined in this translation unit. -Note that this is not the inverse of @code{SYMBOL_FLAG_LOCAL}. - -@findex SYMBOL_REF_SMALL_P -@findex SYMBOL_FLAG_SMALL -@item SYMBOL_FLAG_SMALL -Set if the symbol is located in the small data section. -See @code{TARGET_IN_SMALL_DATA_P}. - -@findex SYMBOL_FLAG_TLS_SHIFT -@findex SYMBOL_REF_TLS_MODEL -@item SYMBOL_REF_TLS_MODEL (@var{x}) -This is a multi-bit field accessor that returns the @code{tls_model} -to be used for a thread-local storage symbol. It returns zero for -non-thread-local symbols. - -@findex SYMBOL_REF_HAS_BLOCK_INFO_P -@findex SYMBOL_FLAG_HAS_BLOCK_INFO -@item SYMBOL_FLAG_HAS_BLOCK_INFO -Set if the symbol has @code{SYMBOL_REF_BLOCK} and -@code{SYMBOL_REF_BLOCK_OFFSET} fields. - -@findex SYMBOL_REF_ANCHOR_P -@findex SYMBOL_FLAG_ANCHOR -@cindex @option{-fsection-anchors} -@item SYMBOL_FLAG_ANCHOR -Set if the symbol is used as a section anchor. ``Section anchors'' -are symbols that have a known position within an @code{object_block} -and that can be used to access nearby members of that block. -They are used to implement @option{-fsection-anchors}. - -If this flag is set, then @code{SYMBOL_FLAG_HAS_BLOCK_INFO} will be too. -@end table - -Bits beginning with @code{SYMBOL_FLAG_MACH_DEP} are available for -the target's use. -@end table - -@findex SYMBOL_REF_BLOCK -@item SYMBOL_REF_BLOCK (@var{x}) -If @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})}, this is the -@samp{object_block} structure to which the symbol belongs, -or @code{NULL} if it has not been assigned a block. - -@findex SYMBOL_REF_BLOCK_OFFSET -@item SYMBOL_REF_BLOCK_OFFSET (@var{x}) -If @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})}, this is the offset of @var{x} -from the first object in @samp{SYMBOL_REF_BLOCK (@var{x})}. The value is -negative if @var{x} has not yet been assigned to a block, or it has not -been given an offset within that block. -@end table - -@node Flags -@section Flags in an RTL Expression -@cindex flags in RTL expression - -RTL expressions contain several flags (one-bit bit-fields) -that are used in certain types of expression. Most often they -are accessed with the following macros, which expand into lvalues. - -@table @code -@findex CONSTANT_POOL_ADDRESS_P -@cindex @code{symbol_ref} and @samp{/u} -@cindex @code{unchanging}, in @code{symbol_ref} -@item CONSTANT_POOL_ADDRESS_P (@var{x}) -Nonzero in a @code{symbol_ref} if it refers to part of the current -function's constant pool. For most targets these addresses are in a -@code{.rodata} section entirely separate from the function, but for -some targets the addresses are close to the beginning of the function. -In either case GCC assumes these addresses can be addressed directly, -perhaps with the help of base registers. -Stored in the @code{unchanging} field and printed as @samp{/u}. - -@findex RTL_CONST_CALL_P -@cindex @code{call_insn} and @samp{/u} -@cindex @code{unchanging}, in @code{call_insn} -@item RTL_CONST_CALL_P (@var{x}) -In a @code{call_insn} indicates that the insn represents a call to a -const function. Stored in the @code{unchanging} field and printed as -@samp{/u}. - -@findex RTL_PURE_CALL_P -@cindex @code{call_insn} and @samp{/i} -@cindex @code{return_val}, in @code{call_insn} -@item RTL_PURE_CALL_P (@var{x}) -In a @code{call_insn} indicates that the insn represents a call to a -pure function. Stored in the @code{return_val} field and printed as -@samp{/i}. - -@findex RTL_CONST_OR_PURE_CALL_P -@cindex @code{call_insn} and @samp{/u} or @samp{/i} -@item RTL_CONST_OR_PURE_CALL_P (@var{x}) -In a @code{call_insn}, true if @code{RTL_CONST_CALL_P} or -@code{RTL_PURE_CALL_P} is true. - -@findex RTL_LOOPING_CONST_OR_PURE_CALL_P -@cindex @code{call_insn} and @samp{/c} -@cindex @code{call}, in @code{call_insn} -@item RTL_LOOPING_CONST_OR_PURE_CALL_P (@var{x}) -In a @code{call_insn} indicates that the insn represents a possibly -infinite looping call to a const or pure function. Stored in the -@code{call} field and printed as @samp{/c}. Only true if one of -@code{RTL_CONST_CALL_P} or @code{RTL_PURE_CALL_P} is true. - -@findex INSN_ANNULLED_BRANCH_P -@cindex @code{jump_insn} and @samp{/u} -@cindex @code{call_insn} and @samp{/u} -@cindex @code{insn} and @samp{/u} -@cindex @code{unchanging}, in @code{jump_insn}, @code{call_insn} and @code{insn} -@item INSN_ANNULLED_BRANCH_P (@var{x}) -In a @code{jump_insn}, @code{call_insn}, or @code{insn} indicates -that the branch is an annulling one. See the discussion under -@code{sequence} below. Stored in the @code{unchanging} field and -printed as @samp{/u}. - -@findex INSN_DELETED_P -@cindex @code{insn} and @samp{/v} -@cindex @code{call_insn} and @samp{/v} -@cindex @code{jump_insn} and @samp{/v} -@cindex @code{code_label} and @samp{/v} -@cindex @code{jump_table_data} and @samp{/v} -@cindex @code{barrier} and @samp{/v} -@cindex @code{note} and @samp{/v} -@cindex @code{volatil}, in @code{insn}, @code{call_insn}, @code{jump_insn}, @code{code_label}, @code{jump_table_data}, @code{barrier}, and @code{note} -@item INSN_DELETED_P (@var{x}) -In an @code{insn}, @code{call_insn}, @code{jump_insn}, @code{code_label}, -@code{jump_table_data}, @code{barrier}, or @code{note}, -nonzero if the insn has been deleted. Stored in the -@code{volatil} field and printed as @samp{/v}. - -@findex INSN_FROM_TARGET_P -@cindex @code{insn} and @samp{/s} -@cindex @code{jump_insn} and @samp{/s} -@cindex @code{call_insn} and @samp{/s} -@cindex @code{in_struct}, in @code{insn} and @code{jump_insn} and @code{call_insn} -@item INSN_FROM_TARGET_P (@var{x}) -In an @code{insn} or @code{jump_insn} or @code{call_insn} in a delay -slot of a branch, indicates that the insn -is from the target of the branch. If the branch insn has -@code{INSN_ANNULLED_BRANCH_P} set, this insn will only be executed if -the branch is taken. For annulled branches with -@code{INSN_FROM_TARGET_P} clear, the insn will be executed only if the -branch is not taken. When @code{INSN_ANNULLED_BRANCH_P} is not set, -this insn will always be executed. Stored in the @code{in_struct} -field and printed as @samp{/s}. - -@findex LABEL_PRESERVE_P -@cindex @code{code_label} and @samp{/i} -@cindex @code{note} and @samp{/i} -@cindex @code{in_struct}, in @code{code_label} and @code{note} -@item LABEL_PRESERVE_P (@var{x}) -In a @code{code_label} or @code{note}, indicates that the label is referenced by -code or data not visible to the RTL of a given function. -Labels referenced by a non-local goto will have this bit set. Stored -in the @code{in_struct} field and printed as @samp{/s}. - -@findex LABEL_REF_NONLOCAL_P -@cindex @code{label_ref} and @samp{/v} -@cindex @code{reg_label} and @samp{/v} -@cindex @code{volatil}, in @code{label_ref} and @code{reg_label} -@item LABEL_REF_NONLOCAL_P (@var{x}) -In @code{label_ref} and @code{reg_label} expressions, nonzero if this is -a reference to a non-local label. -Stored in the @code{volatil} field and printed as @samp{/v}. - -@findex MEM_KEEP_ALIAS_SET_P -@cindex @code{mem} and @samp{/j} -@cindex @code{jump}, in @code{mem} -@item MEM_KEEP_ALIAS_SET_P (@var{x}) -In @code{mem} expressions, 1 if we should keep the alias set for this -mem unchanged when we access a component. Set to 1, for example, when we -are already in a non-addressable component of an aggregate. -Stored in the @code{jump} field and printed as @samp{/j}. - -@findex MEM_VOLATILE_P -@cindex @code{mem} and @samp{/v} -@cindex @code{asm_input} and @samp{/v} -@cindex @code{asm_operands} and @samp{/v} -@cindex @code{volatil}, in @code{mem}, @code{asm_operands}, and @code{asm_input} -@item MEM_VOLATILE_P (@var{x}) -In @code{mem}, @code{asm_operands}, and @code{asm_input} expressions, -nonzero for volatile memory references. -Stored in the @code{volatil} field and printed as @samp{/v}. - -@findex MEM_NOTRAP_P -@cindex @code{mem} and @samp{/c} -@cindex @code{call}, in @code{mem} -@item MEM_NOTRAP_P (@var{x}) -In @code{mem}, nonzero for memory references that will not trap. -Stored in the @code{call} field and printed as @samp{/c}. - -@findex MEM_POINTER -@cindex @code{mem} and @samp{/f} -@cindex @code{frame_related}, in @code{mem} -@item MEM_POINTER (@var{x}) -Nonzero in a @code{mem} if the memory reference holds a pointer. -Stored in the @code{frame_related} field and printed as @samp{/f}. - -@findex REG_FUNCTION_VALUE_P -@cindex @code{reg} and @samp{/i} -@cindex @code{return_val}, in @code{reg} -@item REG_FUNCTION_VALUE_P (@var{x}) -Nonzero in a @code{reg} if it is the place in which this function's -value is going to be returned. (This happens only in a hard -register.) Stored in the @code{return_val} field and printed as -@samp{/i}. - -@findex REG_POINTER -@cindex @code{reg} and @samp{/f} -@cindex @code{frame_related}, in @code{reg} -@item REG_POINTER (@var{x}) -Nonzero in a @code{reg} if the register holds a pointer. Stored in the -@code{frame_related} field and printed as @samp{/f}. - -@findex REG_USERVAR_P -@cindex @code{reg} and @samp{/v} -@cindex @code{volatil}, in @code{reg} -@item REG_USERVAR_P (@var{x}) -In a @code{reg}, nonzero if it corresponds to a variable present in -the user's source code. Zero for temporaries generated internally by -the compiler. Stored in the @code{volatil} field and printed as -@samp{/v}. - -The same hard register may be used also for collecting the values of -functions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero -in this kind of use. - -@findex RTX_FRAME_RELATED_P -@cindex @code{insn} and @samp{/f} -@cindex @code{call_insn} and @samp{/f} -@cindex @code{jump_insn} and @samp{/f} -@cindex @code{barrier} and @samp{/f} -@cindex @code{set} and @samp{/f} -@cindex @code{frame_related}, in @code{insn}, @code{call_insn}, @code{jump_insn}, @code{barrier}, and @code{set} -@item RTX_FRAME_RELATED_P (@var{x}) -Nonzero in an @code{insn}, @code{call_insn}, @code{jump_insn}, -@code{barrier}, or @code{set} which is part of a function prologue -and sets the stack pointer, sets the frame pointer, or saves a register. -This flag should also be set on an instruction that sets up a temporary -register to use in place of the frame pointer. -Stored in the @code{frame_related} field and printed as @samp{/f}. - -In particular, on RISC targets where there are limits on the sizes of -immediate constants, it is sometimes impossible to reach the register -save area directly from the stack pointer. In that case, a temporary -register is used that is near enough to the register save area, and the -Canonical Frame Address, i.e., DWARF2's logical frame pointer, register -must (temporarily) be changed to be this temporary register. So, the -instruction that sets this temporary register must be marked as -@code{RTX_FRAME_RELATED_P}. - -If the marked instruction is overly complex (defined in terms of what -@code{dwarf2out_frame_debug_expr} can handle), you will also have to -create a @code{REG_FRAME_RELATED_EXPR} note and attach it to the -instruction. This note should contain a simple expression of the -computation performed by this instruction, i.e., one that -@code{dwarf2out_frame_debug_expr} can handle. - -This flag is required for exception handling support on targets with RTL -prologues. - -@findex MEM_READONLY_P -@cindex @code{mem} and @samp{/u} -@cindex @code{unchanging}, in @code{mem} -@item MEM_READONLY_P (@var{x}) -Nonzero in a @code{mem}, if the memory is statically allocated and read-only. - -Read-only in this context means never modified during the lifetime of the -program, not necessarily in ROM or in write-disabled pages. A common -example of the later is a shared library's global offset table. This -table is initialized by the runtime loader, so the memory is technically -writable, but after control is transferred from the runtime loader to the -application, this memory will never be subsequently modified. - -Stored in the @code{unchanging} field and printed as @samp{/u}. - -@findex SCHED_GROUP_P -@cindex @code{insn} and @samp{/s} -@cindex @code{call_insn} and @samp{/s} -@cindex @code{jump_insn} and @samp{/s} -@cindex @code{jump_table_data} and @samp{/s} -@cindex @code{in_struct}, in @code{insn}, @code{call_insn}, @code{jump_insn} and @code{jump_table_data} -@item SCHED_GROUP_P (@var{x}) -During instruction scheduling, in an @code{insn}, @code{call_insn}, -@code{jump_insn} or @code{jump_table_data}, indicates that the -previous insn must be scheduled together with this insn. This is used to -ensure that certain groups of instructions will not be split up by the -instruction scheduling pass, for example, @code{use} insns before -a @code{call_insn} may not be separated from the @code{call_insn}. -Stored in the @code{in_struct} field and printed as @samp{/s}. - -@findex SET_IS_RETURN_P -@cindex @code{insn} and @samp{/j} -@cindex @code{jump}, in @code{insn} -@item SET_IS_RETURN_P (@var{x}) -For a @code{set}, nonzero if it is for a return. -Stored in the @code{jump} field and printed as @samp{/j}. - -@findex SIBLING_CALL_P -@cindex @code{call_insn} and @samp{/j} -@cindex @code{jump}, in @code{call_insn} -@item SIBLING_CALL_P (@var{x}) -For a @code{call_insn}, nonzero if the insn is a sibling call. -Stored in the @code{jump} field and printed as @samp{/j}. - -@findex STRING_POOL_ADDRESS_P -@cindex @code{symbol_ref} and @samp{/f} -@cindex @code{frame_related}, in @code{symbol_ref} -@item STRING_POOL_ADDRESS_P (@var{x}) -For a @code{symbol_ref} expression, nonzero if it addresses this function's -string constant pool. -Stored in the @code{frame_related} field and printed as @samp{/f}. - -@findex SUBREG_PROMOTED_UNSIGNED_P -@cindex @code{subreg} and @samp{/u} and @samp{/v} -@cindex @code{unchanging}, in @code{subreg} -@cindex @code{volatil}, in @code{subreg} -@item SUBREG_PROMOTED_UNSIGNED_P (@var{x}) -Returns a value greater then zero for a @code{subreg} that has -@code{SUBREG_PROMOTED_VAR_P} nonzero if the object being referenced is kept -zero-extended, zero if it is kept sign-extended, and less then zero if it is -extended some other way via the @code{ptr_extend} instruction. -Stored in the @code{unchanging} -field and @code{volatil} field, printed as @samp{/u} and @samp{/v}. -This macro may only be used to get the value it may not be used to change -the value. Use @code{SUBREG_PROMOTED_UNSIGNED_SET} to change the value. - -@findex SUBREG_PROMOTED_UNSIGNED_SET -@cindex @code{subreg} and @samp{/u} -@cindex @code{unchanging}, in @code{subreg} -@cindex @code{volatil}, in @code{subreg} -@item SUBREG_PROMOTED_UNSIGNED_SET (@var{x}) -Set the @code{unchanging} and @code{volatil} fields in a @code{subreg} -to reflect zero, sign, or other extension. If @code{volatil} is -zero, then @code{unchanging} as nonzero means zero extension and as -zero means sign extension. If @code{volatil} is nonzero then some -other type of extension was done via the @code{ptr_extend} instruction. - -@findex SUBREG_PROMOTED_VAR_P -@cindex @code{subreg} and @samp{/s} -@cindex @code{in_struct}, in @code{subreg} -@item SUBREG_PROMOTED_VAR_P (@var{x}) -Nonzero in a @code{subreg} if it was made when accessing an object that -was promoted to a wider mode in accord with the @code{PROMOTED_MODE} machine -description macro (@pxref{Storage Layout}). In this case, the mode of -the @code{subreg} is the declared mode of the object and the mode of -@code{SUBREG_REG} is the mode of the register that holds the object. -Promoted variables are always either sign- or zero-extended to the wider -mode on every assignment. Stored in the @code{in_struct} field and -printed as @samp{/s}. - -@findex SYMBOL_REF_USED -@cindex @code{used}, in @code{symbol_ref} -@item SYMBOL_REF_USED (@var{x}) -In a @code{symbol_ref}, indicates that @var{x} has been used. This is -normally only used to ensure that @var{x} is only declared external -once. Stored in the @code{used} field. - -@findex SYMBOL_REF_WEAK -@cindex @code{symbol_ref} and @samp{/i} -@cindex @code{return_val}, in @code{symbol_ref} -@item SYMBOL_REF_WEAK (@var{x}) -In a @code{symbol_ref}, indicates that @var{x} has been declared weak. -Stored in the @code{return_val} field and printed as @samp{/i}. - -@findex SYMBOL_REF_FLAG -@cindex @code{symbol_ref} and @samp{/v} -@cindex @code{volatil}, in @code{symbol_ref} -@item SYMBOL_REF_FLAG (@var{x}) -In a @code{symbol_ref}, this is used as a flag for machine-specific purposes. -Stored in the @code{volatil} field and printed as @samp{/v}. - -Most uses of @code{SYMBOL_REF_FLAG} are historic and may be subsumed -by @code{SYMBOL_REF_FLAGS}. Certainly use of @code{SYMBOL_REF_FLAGS} -is mandatory if the target requires more than one bit of storage. - -@findex PREFETCH_SCHEDULE_BARRIER_P -@cindex @code{prefetch} and @samp{/v} -@cindex @code{volatile}, in @code{prefetch} -@item PREFETCH_SCHEDULE_BARRIER_P (@var{x}) -In a @code{prefetch}, indicates that the prefetch is a scheduling barrier. -No other INSNs will be moved over it. -Stored in the @code{volatil} field and printed as @samp{/v}. -@end table - -These are the fields to which the above macros refer: - -@table @code -@findex call -@cindex @samp{/c} in RTL dump -@item call -In a @code{mem}, 1 means that the memory reference will not trap. - -In a @code{call}, 1 means that this pure or const call may possibly -infinite loop. - -In an RTL dump, this flag is represented as @samp{/c}. - -@findex frame_related -@cindex @samp{/f} in RTL dump -@item frame_related -In an @code{insn} or @code{set} expression, 1 means that it is part of -a function prologue and sets the stack pointer, sets the frame pointer, -saves a register, or sets up a temporary register to use in place of the -frame pointer. - -In @code{reg} expressions, 1 means that the register holds a pointer. - -In @code{mem} expressions, 1 means that the memory reference holds a pointer. - -In @code{symbol_ref} expressions, 1 means that the reference addresses -this function's string constant pool. - -In an RTL dump, this flag is represented as @samp{/f}. - -@findex in_struct -@cindex @samp{/s} in RTL dump -@item in_struct -In @code{reg} expressions, it is 1 if the register has its entire life -contained within the test expression of some loop. - -In @code{subreg} expressions, 1 means that the @code{subreg} is accessing -an object that has had its mode promoted from a wider mode. - -In @code{label_ref} expressions, 1 means that the referenced label is -outside the innermost loop containing the insn in which the @code{label_ref} -was found. - -In @code{code_label} expressions, it is 1 if the label may never be deleted. -This is used for labels which are the target of non-local gotos. Such a -label that would have been deleted is replaced with a @code{note} of type -@code{NOTE_INSN_DELETED_LABEL}. - -In an @code{insn} during dead-code elimination, 1 means that the insn is -dead code. - -In an @code{insn} or @code{jump_insn} during reorg for an insn in the -delay slot of a branch, -1 means that this insn is from the target of the branch. - -In an @code{insn} during instruction scheduling, 1 means that this insn -must be scheduled as part of a group together with the previous insn. - -In an RTL dump, this flag is represented as @samp{/s}. - -@findex return_val -@cindex @samp{/i} in RTL dump -@item return_val -In @code{reg} expressions, 1 means the register contains -the value to be returned by the current function. On -machines that pass parameters in registers, the same register number -may be used for parameters as well, but this flag is not set on such -uses. - -In @code{symbol_ref} expressions, 1 means the referenced symbol is weak. - -In @code{call} expressions, 1 means the call is pure. - -In an RTL dump, this flag is represented as @samp{/i}. - -@findex jump -@cindex @samp{/j} in RTL dump -@item jump -In a @code{mem} expression, 1 means we should keep the alias set for this -mem unchanged when we access a component. - -In a @code{set}, 1 means it is for a return. - -In a @code{call_insn}, 1 means it is a sibling call. - -In an RTL dump, this flag is represented as @samp{/j}. - -@findex unchanging -@cindex @samp{/u} in RTL dump -@item unchanging -In @code{reg} and @code{mem} expressions, 1 means -that the value of the expression never changes. - -In @code{subreg} expressions, it is 1 if the @code{subreg} references an -unsigned object whose mode has been promoted to a wider mode. - -In an @code{insn} or @code{jump_insn} in the delay slot of a branch -instruction, 1 means an annulling branch should be used. - -In a @code{symbol_ref} expression, 1 means that this symbol addresses -something in the per-function constant pool. - -In a @code{call_insn} 1 means that this instruction is a call to a const -function. - -In an RTL dump, this flag is represented as @samp{/u}. - -@findex used -@item used -This flag is used directly (without an access macro) at the end of RTL -generation for a function, to count the number of times an expression -appears in insns. Expressions that appear more than once are copied, -according to the rules for shared structure (@pxref{Sharing}). - -For a @code{reg}, it is used directly (without an access macro) by the -leaf register renumbering code to ensure that each register is only -renumbered once. - -In a @code{symbol_ref}, it indicates that an external declaration for -the symbol has already been written. - -@findex volatil -@cindex @samp{/v} in RTL dump -@item volatil -@cindex volatile memory references -In a @code{mem}, @code{asm_operands}, or @code{asm_input} -expression, it is 1 if the memory -reference is volatile. Volatile memory references may not be deleted, -reordered or combined. - -In a @code{symbol_ref} expression, it is used for machine-specific -purposes. - -In a @code{reg} expression, it is 1 if the value is a user-level variable. -0 indicates an internal compiler temporary. - -In an @code{insn}, 1 means the insn has been deleted. - -In @code{label_ref} and @code{reg_label} expressions, 1 means a reference -to a non-local label. - -In @code{prefetch} expressions, 1 means that the containing insn is a -scheduling barrier. - -In an RTL dump, this flag is represented as @samp{/v}. -@end table - -@node Machine Modes -@section Machine Modes -@cindex machine modes - -@findex machine_mode -A machine mode describes a size of data object and the representation used -for it. In the C code, machine modes are represented by an enumeration -type, @code{machine_mode}, defined in @file{machmode.def}. Each RTL -expression has room for a machine mode and so do certain kinds of tree -expressions (declarations and types, to be precise). - -In debugging dumps and machine descriptions, the machine mode of an RTL -expression is written after the expression code with a colon to separate -them. The letters @samp{mode} which appear at the end of each machine mode -name are omitted. For example, @code{(reg:SI 38)} is a @code{reg} -expression with machine mode @code{SImode}. If the mode is -@code{VOIDmode}, it is not written at all. - -Here is a table of machine modes. The term ``byte'' below refers to an -object of @code{BITS_PER_UNIT} bits (@pxref{Storage Layout}). - -@table @code -@findex BImode -@item BImode -``Bit'' mode represents a single bit, for predicate registers. - -@findex QImode -@item QImode -``Quarter-Integer'' mode represents a single byte treated as an integer. - -@findex HImode -@item HImode -``Half-Integer'' mode represents a two-byte integer. - -@findex PSImode -@item PSImode -``Partial Single Integer'' mode represents an integer which occupies -four bytes but which doesn't really use all four. On some machines, -this is the right mode to use for pointers. - -@findex SImode -@item SImode -``Single Integer'' mode represents a four-byte integer. - -@findex PDImode -@item PDImode -``Partial Double Integer'' mode represents an integer which occupies -eight bytes but which doesn't really use all eight. On some machines, -this is the right mode to use for certain pointers. - -@findex DImode -@item DImode -``Double Integer'' mode represents an eight-byte integer. - -@findex TImode -@item TImode -``Tetra Integer'' (?) mode represents a sixteen-byte integer. - -@findex OImode -@item OImode -``Octa Integer'' (?) mode represents a thirty-two-byte integer. - -@findex XImode -@item XImode -``Hexadeca Integer'' (?) mode represents a sixty-four-byte integer. - -@findex QFmode -@item QFmode -``Quarter-Floating'' mode represents a quarter-precision (single byte) -floating point number. - -@findex HFmode -@item HFmode -``Half-Floating'' mode represents a half-precision (two byte) floating -point number. - -@findex TQFmode -@item TQFmode -``Three-Quarter-Floating'' (?) mode represents a three-quarter-precision -(three byte) floating point number. - -@findex SFmode -@item SFmode -``Single Floating'' mode represents a four byte floating point number. -In the common case, of a processor with IEEE arithmetic and 8-bit bytes, -this is a single-precision IEEE floating point number; it can also be -used for double-precision (on processors with 16-bit bytes) and -single-precision VAX and IBM types. - -@findex DFmode -@item DFmode -``Double Floating'' mode represents an eight byte floating point number. -In the common case, of a processor with IEEE arithmetic and 8-bit bytes, -this is a double-precision IEEE floating point number. - -@findex XFmode -@item XFmode -``Extended Floating'' mode represents an IEEE extended floating point -number. This mode only has 80 meaningful bits (ten bytes). Some -processors require such numbers to be padded to twelve bytes, others -to sixteen; this mode is used for either. - -@findex SDmode -@item SDmode -``Single Decimal Floating'' mode represents a four byte decimal -floating point number (as distinct from conventional binary floating -point). - -@findex DDmode -@item DDmode -``Double Decimal Floating'' mode represents an eight byte decimal -floating point number. - -@findex TDmode -@item TDmode -``Tetra Decimal Floating'' mode represents a sixteen byte decimal -floating point number all 128 of whose bits are meaningful. - -@findex TFmode -@item TFmode -``Tetra Floating'' mode represents a sixteen byte floating point number -all 128 of whose bits are meaningful. One common use is the -IEEE quad-precision format. - -@findex QQmode -@item QQmode -``Quarter-Fractional'' mode represents a single byte treated as a signed -fractional number. The default format is ``s.7''. - -@findex HQmode -@item HQmode -``Half-Fractional'' mode represents a two-byte signed fractional number. -The default format is ``s.15''. - -@findex SQmode -@item SQmode -``Single Fractional'' mode represents a four-byte signed fractional number. -The default format is ``s.31''. - -@findex DQmode -@item DQmode -``Double Fractional'' mode represents an eight-byte signed fractional number. -The default format is ``s.63''. - -@findex TQmode -@item TQmode -``Tetra Fractional'' mode represents a sixteen-byte signed fractional number. -The default format is ``s.127''. - -@findex UQQmode -@item UQQmode -``Unsigned Quarter-Fractional'' mode represents a single byte treated as an -unsigned fractional number. The default format is ``.8''. - -@findex UHQmode -@item UHQmode -``Unsigned Half-Fractional'' mode represents a two-byte unsigned fractional -number. The default format is ``.16''. - -@findex USQmode -@item USQmode -``Unsigned Single Fractional'' mode represents a four-byte unsigned fractional -number. The default format is ``.32''. - -@findex UDQmode -@item UDQmode -``Unsigned Double Fractional'' mode represents an eight-byte unsigned -fractional number. The default format is ``.64''. - -@findex UTQmode -@item UTQmode -``Unsigned Tetra Fractional'' mode represents a sixteen-byte unsigned -fractional number. The default format is ``.128''. - -@findex HAmode -@item HAmode -``Half-Accumulator'' mode represents a two-byte signed accumulator. -The default format is ``s8.7''. - -@findex SAmode -@item SAmode -``Single Accumulator'' mode represents a four-byte signed accumulator. -The default format is ``s16.15''. - -@findex DAmode -@item DAmode -``Double Accumulator'' mode represents an eight-byte signed accumulator. -The default format is ``s32.31''. - -@findex TAmode -@item TAmode -``Tetra Accumulator'' mode represents a sixteen-byte signed accumulator. -The default format is ``s64.63''. - -@findex UHAmode -@item UHAmode -``Unsigned Half-Accumulator'' mode represents a two-byte unsigned accumulator. -The default format is ``8.8''. - -@findex USAmode -@item USAmode -``Unsigned Single Accumulator'' mode represents a four-byte unsigned -accumulator. The default format is ``16.16''. - -@findex UDAmode -@item UDAmode -``Unsigned Double Accumulator'' mode represents an eight-byte unsigned -accumulator. The default format is ``32.32''. - -@findex UTAmode -@item UTAmode -``Unsigned Tetra Accumulator'' mode represents a sixteen-byte unsigned -accumulator. The default format is ``64.64''. - -@findex CCmode -@item CCmode -``Condition Code'' mode represents the value of a condition code, which -is a machine-specific set of bits used to represent the result of a -comparison operation. Other machine-specific modes may also be used for -the condition code. These modes are not used on machines that use -@code{cc0} (@pxref{Condition Code}). - -@findex BLKmode -@item BLKmode -``Block'' mode represents values that are aggregates to which none of -the other modes apply. In RTL, only memory references can have this mode, -and only if they appear in string-move or vector instructions. On machines -which have no such instructions, @code{BLKmode} will not appear in RTL@. - -@findex VOIDmode -@item VOIDmode -Void mode means the absence of a mode or an unspecified mode. -For example, RTL expressions of code @code{const_int} have mode -@code{VOIDmode} because they can be taken to have whatever mode the context -requires. In debugging dumps of RTL, @code{VOIDmode} is expressed by -the absence of any mode. - -@findex QCmode -@findex HCmode -@findex SCmode -@findex DCmode -@findex XCmode -@findex TCmode -@item QCmode, HCmode, SCmode, DCmode, XCmode, TCmode -These modes stand for a complex number represented as a pair of floating -point values. The floating point values are in @code{QFmode}, -@code{HFmode}, @code{SFmode}, @code{DFmode}, @code{XFmode}, and -@code{TFmode}, respectively. - -@findex CQImode -@findex CHImode -@findex CSImode -@findex CDImode -@findex CTImode -@findex COImode -@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode -These modes stand for a complex number represented as a pair of integer -values. The integer values are in @code{QImode}, @code{HImode}, -@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode}, -respectively. - -@findex BND32mode -@findex BND64mode -@item BND32mode BND64mode -These modes stand for bounds for pointer of 32 and 64 bit size respectively. -Mode size is double pointer mode size. -@end table - -The machine description defines @code{Pmode} as a C macro which expands -into the machine mode used for addresses. Normally this is the mode -whose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines. - -The only modes which a machine description @i{must} support are -@code{QImode}, and the modes corresponding to @code{BITS_PER_WORD}, -@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}. -The compiler will attempt to use @code{DImode} for 8-byte structures and -unions, but this can be prevented by overriding the definition of -@code{MAX_FIXED_MODE_SIZE}. Alternatively, you can have the compiler -use @code{TImode} for 16-byte structures and unions. Likewise, you can -arrange for the C type @code{short int} to avoid using @code{HImode}. - -@cindex mode classes -Very few explicit references to machine modes remain in the compiler and -these few references will soon be removed. Instead, the machine modes -are divided into mode classes. These are represented by the enumeration -type @code{enum mode_class} defined in @file{machmode.h}. The possible -mode classes are: - -@table @code -@findex MODE_INT -@item MODE_INT -Integer modes. By default these are @code{BImode}, @code{QImode}, -@code{HImode}, @code{SImode}, @code{DImode}, @code{TImode}, and -@code{OImode}. - -@findex MODE_PARTIAL_INT -@item MODE_PARTIAL_INT -The ``partial integer'' modes, @code{PQImode}, @code{PHImode}, -@code{PSImode} and @code{PDImode}. - -@findex MODE_FLOAT -@item MODE_FLOAT -Floating point modes. By default these are @code{QFmode}, -@code{HFmode}, @code{TQFmode}, @code{SFmode}, @code{DFmode}, -@code{XFmode} and @code{TFmode}. - -@findex MODE_DECIMAL_FLOAT -@item MODE_DECIMAL_FLOAT -Decimal floating point modes. By default these are @code{SDmode}, -@code{DDmode} and @code{TDmode}. - -@findex MODE_FRACT -@item MODE_FRACT -Signed fractional modes. By default these are @code{QQmode}, @code{HQmode}, -@code{SQmode}, @code{DQmode} and @code{TQmode}. - -@findex MODE_UFRACT -@item MODE_UFRACT -Unsigned fractional modes. By default these are @code{UQQmode}, @code{UHQmode}, -@code{USQmode}, @code{UDQmode} and @code{UTQmode}. - -@findex MODE_ACCUM -@item MODE_ACCUM -Signed accumulator modes. By default these are @code{HAmode}, -@code{SAmode}, @code{DAmode} and @code{TAmode}. - -@findex MODE_UACCUM -@item MODE_UACCUM -Unsigned accumulator modes. By default these are @code{UHAmode}, -@code{USAmode}, @code{UDAmode} and @code{UTAmode}. - -@findex MODE_COMPLEX_INT -@item MODE_COMPLEX_INT -Complex integer modes. (These are not currently implemented). - -@findex MODE_COMPLEX_FLOAT -@item MODE_COMPLEX_FLOAT -Complex floating point modes. By default these are @code{QCmode}, -@code{HCmode}, @code{SCmode}, @code{DCmode}, @code{XCmode}, and -@code{TCmode}. - -@findex MODE_FUNCTION -@item MODE_FUNCTION -Algol or Pascal function variables including a static chain. -(These are not currently implemented). - -@findex MODE_CC -@item MODE_CC -Modes representing condition code values. These are @code{CCmode} plus -any @code{CC_MODE} modes listed in the @file{@var{machine}-modes.def}. -@xref{Jump Patterns}, -also see @ref{Condition Code}. - -@findex MODE_POINTER_BOUNDS -@item MODE_POINTER_BOUNDS -Pointer bounds modes. Used to represent values of pointer bounds type. -Operations in these modes may be executed as NOPs depending on hardware -features and environment setup. - -@findex MODE_RANDOM -@item MODE_RANDOM -This is a catchall mode class for modes which don't fit into the above -classes. Currently @code{VOIDmode} and @code{BLKmode} are in -@code{MODE_RANDOM}. -@end table - -Here are some C macros that relate to machine modes: - -@table @code -@findex GET_MODE -@item GET_MODE (@var{x}) -Returns the machine mode of the RTX @var{x}. - -@findex PUT_MODE -@item PUT_MODE (@var{x}, @var{newmode}) -Alters the machine mode of the RTX @var{x} to be @var{newmode}. - -@findex NUM_MACHINE_MODES -@item NUM_MACHINE_MODES -Stands for the number of machine modes available on the target -machine. This is one greater than the largest numeric value of any -machine mode. - -@findex GET_MODE_NAME -@item GET_MODE_NAME (@var{m}) -Returns the name of mode @var{m} as a string. - -@findex GET_MODE_CLASS -@item GET_MODE_CLASS (@var{m}) -Returns the mode class of mode @var{m}. - -@findex GET_MODE_WIDER_MODE -@item GET_MODE_WIDER_MODE (@var{m}) -Returns the next wider natural mode. For example, the expression -@code{GET_MODE_WIDER_MODE (QImode)} returns @code{HImode}. - -@findex GET_MODE_SIZE -@item GET_MODE_SIZE (@var{m}) -Returns the size in bytes of a datum of mode @var{m}. - -@findex GET_MODE_BITSIZE -@item GET_MODE_BITSIZE (@var{m}) -Returns the size in bits of a datum of mode @var{m}. - -@findex GET_MODE_IBIT -@item GET_MODE_IBIT (@var{m}) -Returns the number of integral bits of a datum of fixed-point mode @var{m}. - -@findex GET_MODE_FBIT -@item GET_MODE_FBIT (@var{m}) -Returns the number of fractional bits of a datum of fixed-point mode @var{m}. - -@findex GET_MODE_MASK -@item GET_MODE_MASK (@var{m}) -Returns a bitmask containing 1 for all bits in a word that fit within -mode @var{m}. This macro can only be used for modes whose bitsize is -less than or equal to @code{HOST_BITS_PER_INT}. - -@findex GET_MODE_ALIGNMENT -@item GET_MODE_ALIGNMENT (@var{m}) -Return the required alignment, in bits, for an object of mode @var{m}. - -@findex GET_MODE_UNIT_SIZE -@item GET_MODE_UNIT_SIZE (@var{m}) -Returns the size in bytes of the subunits of a datum of mode @var{m}. -This is the same as @code{GET_MODE_SIZE} except in the case of complex -modes. For them, the unit size is the size of the real or imaginary -part. - -@findex GET_MODE_NUNITS -@item GET_MODE_NUNITS (@var{m}) -Returns the number of units contained in a mode, i.e., -@code{GET_MODE_SIZE} divided by @code{GET_MODE_UNIT_SIZE}. - -@findex GET_CLASS_NARROWEST_MODE -@item GET_CLASS_NARROWEST_MODE (@var{c}) -Returns the narrowest mode in mode class @var{c}. -@end table - -The following 3 variables are defined on every target. They can be -used to allocate buffers that are guaranteed to be large enough to -hold any value that can be represented on the target. The first two -can be overridden by defining them in the target's mode.def file, -however, the value must be a constant that can determined very early -in the compilation process. The third symbol cannot be overridden. - -@table @code -@findex BITS_PER_UNIT -@item BITS_PER_UNIT -The number of bits in an addressable storage unit (byte). If you do -not define this, the default is 8. - -@findex MAX_BITSIZE_MODE_ANY_INT -@item MAX_BITSIZE_MODE_ANY_INT -The maximum bitsize of any mode that is used in integer math. This -should be overridden by the target if it uses large integers as -containers for larger vectors but otherwise never uses the contents to -compute integer values. - -@findex MAX_BITSIZE_MODE_ANY_MODE -@item MAX_BITSIZE_MODE_ANY_MODE -The bitsize of the largest mode on the target. -@end table - -@findex byte_mode -@findex word_mode -The global variables @code{byte_mode} and @code{word_mode} contain modes -whose classes are @code{MODE_INT} and whose bitsizes are either -@code{BITS_PER_UNIT} or @code{BITS_PER_WORD}, respectively. On 32-bit -machines, these are @code{QImode} and @code{SImode}, respectively. - -@node Constants -@section Constant Expression Types -@cindex RTL constants -@cindex RTL constant expression types - -The simplest RTL expressions are those that represent constant values. - -@table @code -@findex const_int -@item (const_int @var{i}) -This type of expression represents the integer value @var{i}. @var{i} -is customarily accessed with the macro @code{INTVAL} as in -@code{INTVAL (@var{exp})}, which is equivalent to @code{XWINT (@var{exp}, 0)}. - -Constants generated for modes with fewer bits than in -@code{HOST_WIDE_INT} must be sign extended to full width (e.g., with -@code{gen_int_mode}). For constants for modes with more bits than in -@code{HOST_WIDE_INT} the implied high order bits of that constant are -copies of the top bit. Note however that values are neither -inherently signed nor inherently unsigned; where necessary, signedness -is determined by the rtl operation instead. - -@findex const0_rtx -@findex const1_rtx -@findex const2_rtx -@findex constm1_rtx -There is only one expression object for the integer value zero; it is -the value of the variable @code{const0_rtx}. Likewise, the only -expression for integer value one is found in @code{const1_rtx}, the only -expression for integer value two is found in @code{const2_rtx}, and the -only expression for integer value negative one is found in -@code{constm1_rtx}. Any attempt to create an expression of code -@code{const_int} and value zero, one, two or negative one will return -@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or -@code{constm1_rtx} as appropriate. - -@findex const_true_rtx -Similarly, there is only one object for the integer whose value is -@code{STORE_FLAG_VALUE}. It is found in @code{const_true_rtx}. If -@code{STORE_FLAG_VALUE} is one, @code{const_true_rtx} and -@code{const1_rtx} will point to the same object. If -@code{STORE_FLAG_VALUE} is @minus{}1, @code{const_true_rtx} and -@code{constm1_rtx} will point to the same object. - -@findex const_double -@item (const_double:@var{m} @var{i0} @var{i1} @dots{}) -This represents either a floating-point constant of mode @var{m} or -(on older ports that do not define -@code{TARGET_SUPPORTS_WIDE_INT}) an integer constant too large to fit -into @code{HOST_BITS_PER_WIDE_INT} bits but small enough to fit within -twice that number of bits. In the latter case, @var{m} will be -@code{VOIDmode}. For integral values constants for modes with more -bits than twice the number in @code{HOST_WIDE_INT} the implied high -order bits of that constant are copies of the top bit of -@code{CONST_DOUBLE_HIGH}. Note however that integral values are -neither inherently signed nor inherently unsigned; where necessary, -signedness is determined by the rtl operation instead. - -On more modern ports, @code{CONST_DOUBLE} only represents floating -point values. New ports define @code{TARGET_SUPPORTS_WIDE_INT} to -make this designation. - -@findex CONST_DOUBLE_LOW -If @var{m} is @code{VOIDmode}, the bits of the value are stored in -@var{i0} and @var{i1}. @var{i0} is customarily accessed with the macro -@code{CONST_DOUBLE_LOW} and @var{i1} with @code{CONST_DOUBLE_HIGH}. - -If the constant is floating point (regardless of its precision), then -the number of integers used to store the value depends on the size of -@code{REAL_VALUE_TYPE} (@pxref{Floating Point}). The integers -represent a floating point number, but not precisely in the target -machine's or host machine's floating point format. To convert them to -the precise bit pattern used by the target machine, use the macro -@code{REAL_VALUE_TO_TARGET_DOUBLE} and friends (@pxref{Data Output}). - -@findex CONST_WIDE_INT -@item (const_wide_int:@var{m} @var{nunits} @var{elt0} @dots{}) -This contains an array of @code{HOST_WIDE_INT}s that is large enough -to hold any constant that can be represented on the target. This form -of rtl is only used on targets that define -@code{TARGET_SUPPORTS_WIDE_INT} to be nonzero and then -@code{CONST_DOUBLE}s are only used to hold floating-point values. If -the target leaves @code{TARGET_SUPPORTS_WIDE_INT} defined as 0, -@code{CONST_WIDE_INT}s are not used and @code{CONST_DOUBLE}s are as -they were before. - -The values are stored in a compressed format. The higher-order -0s or -1s are not represented if they are just the logical sign -extension of the number that is represented. - -@findex CONST_WIDE_INT_VEC -@item CONST_WIDE_INT_VEC (@var{code}) -Returns the entire array of @code{HOST_WIDE_INT}s that are used to -store the value. This macro should be rarely used. - -@findex CONST_WIDE_INT_NUNITS -@item CONST_WIDE_INT_NUNITS (@var{code}) -The number of @code{HOST_WIDE_INT}s used to represent the number. -Note that this generally is smaller than the number of -@code{HOST_WIDE_INT}s implied by the mode size. - -@findex CONST_WIDE_INT_ELT -@item CONST_WIDE_INT_NUNITS (@var{code},@var{i}) -Returns the @code{i}th element of the array. Element 0 is contains -the low order bits of the constant. - -@findex const_fixed -@item (const_fixed:@var{m} @dots{}) -Represents a fixed-point constant of mode @var{m}. -The operand is a data structure of type @code{struct fixed_value} and -is accessed with the macro @code{CONST_FIXED_VALUE}. The high part of -data is accessed with @code{CONST_FIXED_VALUE_HIGH}; the low part is -accessed with @code{CONST_FIXED_VALUE_LOW}. - -@findex const_vector -@item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}]) -Represents a vector constant. The square brackets stand for the vector -containing the constant elements. @var{x0}, @var{x1} and so on are -the @code{const_int}, @code{const_double} or @code{const_fixed} elements. - -The number of units in a @code{const_vector} is obtained with the macro -@code{CONST_VECTOR_NUNITS} as in @code{CONST_VECTOR_NUNITS (@var{v})}. - -Individual elements in a vector constant are accessed with the macro -@code{CONST_VECTOR_ELT} as in @code{CONST_VECTOR_ELT (@var{v}, @var{n})} -where @var{v} is the vector constant and @var{n} is the element -desired. - -@findex const_string -@item (const_string @var{str}) -Represents a constant string with value @var{str}. Currently this is -used only for insn attributes (@pxref{Insn Attributes}) since constant -strings in C are placed in memory. - -@findex symbol_ref -@item (symbol_ref:@var{mode} @var{symbol}) -Represents the value of an assembler label for data. @var{symbol} is -a string that describes the name of the assembler label. If it starts -with a @samp{*}, the label is the rest of @var{symbol} not including -the @samp{*}. Otherwise, the label is @var{symbol}, usually prefixed -with @samp{_}. - -The @code{symbol_ref} contains a mode, which is usually @code{Pmode}. -Usually that is the only mode for which a symbol is directly valid. - -@findex label_ref -@item (label_ref:@var{mode} @var{label}) -Represents the value of an assembler label for code. It contains one -operand, an expression, which must be a @code{code_label} or a @code{note} -of type @code{NOTE_INSN_DELETED_LABEL} that appears in the instruction -sequence to identify the place where the label should go. - -The reason for using a distinct expression type for code label -references is so that jump optimization can distinguish them. - -The @code{label_ref} contains a mode, which is usually @code{Pmode}. -Usually that is the only mode for which a label is directly valid. - -@findex const -@item (const:@var{m} @var{exp}) -Represents a constant that is the result of an assembly-time -arithmetic computation. The operand, @var{exp}, is an expression that -contains only constants (@code{const_int}, @code{symbol_ref} and -@code{label_ref} expressions) combined with @code{plus} and -@code{minus}. However, not all combinations are valid, since the -assembler cannot do arbitrary arithmetic on relocatable symbols. - -@var{m} should be @code{Pmode}. - -@findex high -@item (high:@var{m} @var{exp}) -Represents the high-order bits of @var{exp}, usually a -@code{symbol_ref}. The number of bits is machine-dependent and is -normally the number of bits specified in an instruction that initializes -the high order bits of a register. It is used with @code{lo_sum} to -represent the typical two-instruction sequence used in RISC machines to -reference a global memory location. - -@var{m} should be @code{Pmode}. -@end table - -@findex CONST0_RTX -@findex CONST1_RTX -@findex CONST2_RTX -The macro @code{CONST0_RTX (@var{mode})} refers to an expression with -value 0 in mode @var{mode}. If mode @var{mode} is of mode class -@code{MODE_INT}, it returns @code{const0_rtx}. If mode @var{mode} is of -mode class @code{MODE_FLOAT}, it returns a @code{CONST_DOUBLE} -expression in mode @var{mode}. Otherwise, it returns a -@code{CONST_VECTOR} expression in mode @var{mode}. Similarly, the macro -@code{CONST1_RTX (@var{mode})} refers to an expression with value 1 in -mode @var{mode} and similarly for @code{CONST2_RTX}. The -@code{CONST1_RTX} and @code{CONST2_RTX} macros are undefined -for vector modes. - -@node Regs and Memory -@section Registers and Memory -@cindex RTL register expressions -@cindex RTL memory expressions - -Here are the RTL expression types for describing access to machine -registers and to main memory. - -@table @code -@findex reg -@cindex hard registers -@cindex pseudo registers -@item (reg:@var{m} @var{n}) -For small values of the integer @var{n} (those that are less than -@code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machine -register number @var{n}: a @dfn{hard register}. For larger values of -@var{n}, it stands for a temporary value or @dfn{pseudo register}. -The compiler's strategy is to generate code assuming an unlimited -number of such pseudo registers, and later convert them into hard -registers or into memory references. - -@var{m} is the machine mode of the reference. It is necessary because -machines can generally refer to each register in more than one mode. -For example, a register may contain a full word but there may be -instructions to refer to it as a half word or as a single byte, as -well as instructions to refer to it as a floating point number of -various precisions. - -Even for a register that the machine can access in only one mode, -the mode must always be specified. - -The symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machine -description, since the number of hard registers on the machine is an -invariant characteristic of the machine. Note, however, that not -all of the machine registers must be general registers. All the -machine registers that can be used for storage of data are given -hard register numbers, even those that can be used only in certain -instructions or can hold only certain types of data. - -A hard register may be accessed in various modes throughout one -function, but each pseudo register is given a natural mode -and is accessed only in that mode. When it is necessary to describe -an access to a pseudo register using a nonnatural mode, a @code{subreg} -expression is used. - -A @code{reg} expression with a machine mode that specifies more than -one word of data may actually stand for several consecutive registers. -If in addition the register number specifies a hardware register, then -it actually represents several consecutive hardware registers starting -with the specified one. - -Each pseudo register number used in a function's RTL code is -represented by a unique @code{reg} expression. - -@findex FIRST_VIRTUAL_REGISTER -@findex LAST_VIRTUAL_REGISTER -Some pseudo register numbers, those within the range of -@code{FIRST_VIRTUAL_REGISTER} to @code{LAST_VIRTUAL_REGISTER} only -appear during the RTL generation phase and are eliminated before the -optimization phases. These represent locations in the stack frame that -cannot be determined until RTL generation for the function has been -completed. The following virtual register numbers are defined: - -@table @code -@findex VIRTUAL_INCOMING_ARGS_REGNUM -@item VIRTUAL_INCOMING_ARGS_REGNUM -This points to the first word of the incoming arguments passed on the -stack. Normally these arguments are placed there by the caller, but the -callee may have pushed some arguments that were previously passed in -registers. - -@cindex @code{FIRST_PARM_OFFSET} and virtual registers -@cindex @code{ARG_POINTER_REGNUM} and virtual registers -When RTL generation is complete, this virtual register is replaced -by the sum of the register given by @code{ARG_POINTER_REGNUM} and the -value of @code{FIRST_PARM_OFFSET}. - -@findex VIRTUAL_STACK_VARS_REGNUM -@cindex @code{FRAME_GROWS_DOWNWARD} and virtual registers -@item VIRTUAL_STACK_VARS_REGNUM -If @code{FRAME_GROWS_DOWNWARD} is defined to a nonzero value, this points -to immediately above the first variable on the stack. Otherwise, it points -to the first variable on the stack. - -@cindex @code{STARTING_FRAME_OFFSET} and virtual registers -@cindex @code{FRAME_POINTER_REGNUM} and virtual registers -@code{VIRTUAL_STACK_VARS_REGNUM} is replaced with the sum of the -register given by @code{FRAME_POINTER_REGNUM} and the value -@code{STARTING_FRAME_OFFSET}. - -@findex VIRTUAL_STACK_DYNAMIC_REGNUM -@item VIRTUAL_STACK_DYNAMIC_REGNUM -This points to the location of dynamically allocated memory on the stack -immediately after the stack pointer has been adjusted by the amount of -memory desired. - -@cindex @code{STACK_DYNAMIC_OFFSET} and virtual registers -@cindex @code{STACK_POINTER_REGNUM} and virtual registers -This virtual register is replaced by the sum of the register given by -@code{STACK_POINTER_REGNUM} and the value @code{STACK_DYNAMIC_OFFSET}. - -@findex VIRTUAL_OUTGOING_ARGS_REGNUM -@item VIRTUAL_OUTGOING_ARGS_REGNUM -This points to the location in the stack at which outgoing arguments -should be written when the stack is pre-pushed (arguments pushed using -push insns should always use @code{STACK_POINTER_REGNUM}). - -@cindex @code{STACK_POINTER_OFFSET} and virtual registers -This virtual register is replaced by the sum of the register given by -@code{STACK_POINTER_REGNUM} and the value @code{STACK_POINTER_OFFSET}. -@end table - -@findex subreg -@item (subreg:@var{m1} @var{reg:m2} @var{bytenum}) - -@code{subreg} expressions are used to refer to a register in a machine -mode other than its natural one, or to refer to one register of -a multi-part @code{reg} that actually refers to several registers. - -Each pseudo register has a natural mode. If it is necessary to -operate on it in a different mode, the register must be -enclosed in a @code{subreg}. - -There are currently three supported types for the first operand of a -@code{subreg}: -@itemize -@item pseudo registers -This is the most common case. Most @code{subreg}s have pseudo -@code{reg}s as their first operand. - -@item mem -@code{subreg}s of @code{mem} were common in earlier versions of GCC and -are still supported. During the reload pass these are replaced by plain -@code{mem}s. On machines that do not do instruction scheduling, use of -@code{subreg}s of @code{mem} are still used, but this is no longer -recommended. Such @code{subreg}s are considered to be -@code{register_operand}s rather than @code{memory_operand}s before and -during reload. Because of this, the scheduling passes cannot properly -schedule instructions with @code{subreg}s of @code{mem}, so for machines -that do scheduling, @code{subreg}s of @code{mem} should never be used. -To support this, the combine and recog passes have explicit code to -inhibit the creation of @code{subreg}s of @code{mem} when -@code{INSN_SCHEDULING} is defined. - -The use of @code{subreg}s of @code{mem} after the reload pass is an area -that is not well understood and should be avoided. There is still some -code in the compiler to support this, but this code has possibly rotted. -This use of @code{subreg}s is discouraged and will most likely not be -supported in the future. - -@item hard registers -It is seldom necessary to wrap hard registers in @code{subreg}s; such -registers would normally reduce to a single @code{reg} rtx. This use of -@code{subreg}s is discouraged and may not be supported in the future. - -@end itemize - -@code{subreg}s of @code{subreg}s are not supported. Using -@code{simplify_gen_subreg} is the recommended way to avoid this problem. - -@code{subreg}s come in two distinct flavors, each having its own -usage and rules: - -@table @asis -@item Paradoxical subregs -When @var{m1} is strictly wider than @var{m2}, the @code{subreg} -expression is called @dfn{paradoxical}. The canonical test for this -class of @code{subreg} is: - -@smallexample -GET_MODE_SIZE (@var{m1}) > GET_MODE_SIZE (@var{m2}) -@end smallexample - -Paradoxical @code{subreg}s can be used as both lvalues and rvalues. -When used as an lvalue, the low-order bits of the source value -are stored in @var{reg} and the high-order bits are discarded. -When used as an rvalue, the low-order bits of the @code{subreg} are -taken from @var{reg} while the high-order bits may or may not be -defined. - -The high-order bits of rvalues are in the following circumstances: - -@itemize -@item @code{subreg}s of @code{mem} -When @var{m2} is smaller than a word, the macro @code{LOAD_EXTEND_OP}, -can control how the high-order bits are defined. - -@item @code{subreg} of @code{reg}s -The upper bits are defined when @code{SUBREG_PROMOTED_VAR_P} is true. -@code{SUBREG_PROMOTED_UNSIGNED_P} describes what the upper bits hold. -Such subregs usually represent local variables, register variables -and parameter pseudo variables that have been promoted to a wider mode. - -@end itemize - -@var{bytenum} is always zero for a paradoxical @code{subreg}, even on -big-endian targets. - -For example, the paradoxical @code{subreg}: - -@smallexample -(set (subreg:SI (reg:HI @var{x}) 0) @var{y}) -@end smallexample - -stores the lower 2 bytes of @var{y} in @var{x} and discards the upper -2 bytes. A subsequent: - -@smallexample -(set @var{z} (subreg:SI (reg:HI @var{x}) 0)) -@end smallexample - -would set the lower two bytes of @var{z} to @var{y} and set the upper -two bytes to an unknown value assuming @code{SUBREG_PROMOTED_VAR_P} is -false. - -@item Normal subregs -When @var{m1} is at least as narrow as @var{m2} the @code{subreg} -expression is called @dfn{normal}. - -Normal @code{subreg}s restrict consideration to certain bits of -@var{reg}. There are two cases. If @var{m1} is smaller than a word, -the @code{subreg} refers to the least-significant part (or -@dfn{lowpart}) of one word of @var{reg}. If @var{m1} is word-sized or -greater, the @code{subreg} refers to one or more complete words. - -When used as an lvalue, @code{subreg} is a word-based accessor. -Storing to a @code{subreg} modifies all the words of @var{reg} that -overlap the @code{subreg}, but it leaves the other words of @var{reg} -alone. - -When storing to a normal @code{subreg} that is smaller than a word, -the other bits of the referenced word are usually left in an undefined -state. This laxity makes it easier to generate efficient code for -such instructions. To represent an instruction that preserves all the -bits outside of those in the @code{subreg}, use @code{strict_low_part} -or @code{zero_extract} around the @code{subreg}. - -@var{bytenum} must identify the offset of the first byte of the -@code{subreg} from the start of @var{reg}, assuming that @var{reg} is -laid out in memory order. The memory order of bytes is defined by -two target macros, @code{WORDS_BIG_ENDIAN} and @code{BYTES_BIG_ENDIAN}: - -@itemize -@item -@cindex @code{WORDS_BIG_ENDIAN}, effect on @code{subreg} -@code{WORDS_BIG_ENDIAN}, if set to 1, says that byte number zero is -part of the most significant word; otherwise, it is part of the least -significant word. - -@item -@cindex @code{BYTES_BIG_ENDIAN}, effect on @code{subreg} -@code{BYTES_BIG_ENDIAN}, if set to 1, says that byte number zero is -the most significant byte within a word; otherwise, it is the least -significant byte within a word. -@end itemize - -@cindex @code{FLOAT_WORDS_BIG_ENDIAN}, (lack of) effect on @code{subreg} -On a few targets, @code{FLOAT_WORDS_BIG_ENDIAN} disagrees with -@code{WORDS_BIG_ENDIAN}. However, most parts of the compiler treat -floating point values as if they had the same endianness as integer -values. This works because they handle them solely as a collection of -integer values, with no particular numerical value. Only real.c and -the runtime libraries care about @code{FLOAT_WORDS_BIG_ENDIAN}. - -Thus, - -@smallexample -(subreg:HI (reg:SI @var{x}) 2) -@end smallexample - -on a @code{BYTES_BIG_ENDIAN}, @samp{UNITS_PER_WORD == 4} target is the same as - -@smallexample -(subreg:HI (reg:SI @var{x}) 0) -@end smallexample - -on a little-endian, @samp{UNITS_PER_WORD == 4} target. Both -@code{subreg}s access the lower two bytes of register @var{x}. - -@end table - -A @code{MODE_PARTIAL_INT} mode behaves as if it were as wide as the -corresponding @code{MODE_INT} mode, except that it has an unknown -number of undefined bits. For example: - -@smallexample -(subreg:PSI (reg:SI 0) 0) -@end smallexample - -accesses the whole of @samp{(reg:SI 0)}, but the exact relationship -between the @code{PSImode} value and the @code{SImode} value is not -defined. If we assume @samp{UNITS_PER_WORD <= 4}, then the following -two @code{subreg}s: - -@smallexample -(subreg:PSI (reg:DI 0) 0) -(subreg:PSI (reg:DI 0) 4) -@end smallexample - -represent independent 4-byte accesses to the two halves of -@samp{(reg:DI 0)}. Both @code{subreg}s have an unknown number -of undefined bits. - -If @samp{UNITS_PER_WORD <= 2} then these two @code{subreg}s: - -@smallexample -(subreg:HI (reg:PSI 0) 0) -(subreg:HI (reg:PSI 0) 2) -@end smallexample - -represent independent 2-byte accesses that together span the whole -of @samp{(reg:PSI 0)}. Storing to the first @code{subreg} does not -affect the value of the second, and vice versa. @samp{(reg:PSI 0)} -has an unknown number of undefined bits, so the assignment: - -@smallexample -(set (subreg:HI (reg:PSI 0) 0) (reg:HI 4)) -@end smallexample - -does not guarantee that @samp{(subreg:HI (reg:PSI 0) 0)} has the -value @samp{(reg:HI 4)}. - -@cindex @code{CANNOT_CHANGE_MODE_CLASS} and subreg semantics -The rules above apply to both pseudo @var{reg}s and hard @var{reg}s. -If the semantics are not correct for particular combinations of -@var{m1}, @var{m2} and hard @var{reg}, the target-specific code -must ensure that those combinations are never used. For example: - -@smallexample -CANNOT_CHANGE_MODE_CLASS (@var{m2}, @var{m1}, @var{class}) -@end smallexample - -must be true for every class @var{class} that includes @var{reg}. - -@findex SUBREG_REG -@findex SUBREG_BYTE -The first operand of a @code{subreg} expression is customarily accessed -with the @code{SUBREG_REG} macro and the second operand is customarily -accessed with the @code{SUBREG_BYTE} macro. - -It has been several years since a platform in which -@code{BYTES_BIG_ENDIAN} not equal to @code{WORDS_BIG_ENDIAN} has -been tested. Anyone wishing to support such a platform in the future -may be confronted with code rot. - -@findex scratch -@cindex scratch operands -@item (scratch:@var{m}) -This represents a scratch register that will be required for the -execution of a single instruction and not used subsequently. It is -converted into a @code{reg} by either the local register allocator or -the reload pass. - -@code{scratch} is usually present inside a @code{clobber} operation -(@pxref{Side Effects}). - -@findex cc0 -@cindex condition code register -@item (cc0) -This refers to the machine's condition code register. It has no -operands and may not have a machine mode. There are two ways to use it: - -@itemize @bullet -@item -To stand for a complete set of condition code flags. This is best on -most machines, where each comparison sets the entire series of flags. - -With this technique, @code{(cc0)} may be validly used in only two -contexts: as the destination of an assignment (in test and compare -instructions) and in comparison operators comparing against zero -(@code{const_int} with value zero; that is to say, @code{const0_rtx}). - -@item -To stand for a single flag that is the result of a single condition. -This is useful on machines that have only a single flag bit, and in -which comparison instructions must specify the condition to test. - -With this technique, @code{(cc0)} may be validly used in only two -contexts: as the destination of an assignment (in test and compare -instructions) where the source is a comparison operator, and as the -first operand of @code{if_then_else} (in a conditional branch). -@end itemize - -@findex cc0_rtx -There is only one expression object of code @code{cc0}; it is the -value of the variable @code{cc0_rtx}. Any attempt to create an -expression of code @code{cc0} will return @code{cc0_rtx}. - -Instructions can set the condition code implicitly. On many machines, -nearly all instructions set the condition code based on the value that -they compute or store. It is not necessary to record these actions -explicitly in the RTL because the machine description includes a -prescription for recognizing the instructions that do so (by means of -the macro @code{NOTICE_UPDATE_CC}). @xref{Condition Code}. Only -instructions whose sole purpose is to set the condition code, and -instructions that use the condition code, need mention @code{(cc0)}. - -On some machines, the condition code register is given a register number -and a @code{reg} is used instead of @code{(cc0)}. This is usually the -preferable approach if only a small subset of instructions modify the -condition code. Other machines store condition codes in general -registers; in such cases a pseudo register should be used. - -Some machines, such as the SPARC and RS/6000, have two sets of -arithmetic instructions, one that sets and one that does not set the -condition code. This is best handled by normally generating the -instruction that does not set the condition code, and making a pattern -that both performs the arithmetic and sets the condition code register -(which would not be @code{(cc0)} in this case). For examples, search -for @samp{addcc} and @samp{andcc} in @file{sparc.md}. - -@findex pc -@item (pc) -@cindex program counter -This represents the machine's program counter. It has no operands and -may not have a machine mode. @code{(pc)} may be validly used only in -certain specific contexts in jump instructions. - -@findex pc_rtx -There is only one expression object of code @code{pc}; it is the value -of the variable @code{pc_rtx}. Any attempt to create an expression of -code @code{pc} will return @code{pc_rtx}. - -All instructions that do not jump alter the program counter implicitly -by incrementing it, but there is no need to mention this in the RTL@. - -@findex mem -@item (mem:@var{m} @var{addr} @var{alias}) -This RTX represents a reference to main memory at an address -represented by the expression @var{addr}. @var{m} specifies how large -a unit of memory is accessed. @var{alias} specifies an alias set for the -reference. In general two items are in different alias sets if they cannot -reference the same memory address. - -The construct @code{(mem:BLK (scratch))} is considered to alias all -other memories. Thus it may be used as a memory barrier in epilogue -stack deallocation patterns. - -@findex concat -@item (concat@var{m} @var{rtx} @var{rtx}) -This RTX represents the concatenation of two other RTXs. This is used -for complex values. It should only appear in the RTL attached to -declarations and during RTL generation. It should not appear in the -ordinary insn chain. - -@findex concatn -@item (concatn@var{m} [@var{rtx} @dots{}]) -This RTX represents the concatenation of all the @var{rtx} to make a -single value. Like @code{concat}, this should only appear in -declarations, and not in the insn chain. -@end table - -@node Arithmetic -@section RTL Expressions for Arithmetic -@cindex arithmetic, in RTL -@cindex math, in RTL -@cindex RTL expressions for arithmetic - -Unless otherwise specified, all the operands of arithmetic expressions -must be valid for mode @var{m}. An operand is valid for mode @var{m} -if it has mode @var{m}, or if it is a @code{const_int} or -@code{const_double} and @var{m} is a mode of class @code{MODE_INT}. - -For commutative binary operations, constants should be placed in the -second operand. - -@table @code -@findex plus -@findex ss_plus -@findex us_plus -@cindex RTL sum -@cindex RTL addition -@cindex RTL addition with signed saturation -@cindex RTL addition with unsigned saturation -@item (plus:@var{m} @var{x} @var{y}) -@itemx (ss_plus:@var{m} @var{x} @var{y}) -@itemx (us_plus:@var{m} @var{x} @var{y}) - -These three expressions all represent the sum of the values -represented by @var{x} and @var{y} carried out in machine mode -@var{m}. They differ in their behavior on overflow of integer modes. -@code{plus} wraps round modulo the width of @var{m}; @code{ss_plus} -saturates at the maximum signed value representable in @var{m}; -@code{us_plus} saturates at the maximum unsigned value. - -@c ??? What happens on overflow of floating point modes? - -@findex lo_sum -@item (lo_sum:@var{m} @var{x} @var{y}) - -This expression represents the sum of @var{x} and the low-order bits -of @var{y}. It is used with @code{high} (@pxref{Constants}) to -represent the typical two-instruction sequence used in RISC machines -to reference a global memory location. - -The number of low order bits is machine-dependent but is -normally the number of bits in a @code{Pmode} item minus the number of -bits set by @code{high}. - -@var{m} should be @code{Pmode}. - -@findex minus -@findex ss_minus -@findex us_minus -@cindex RTL difference -@cindex RTL subtraction -@cindex RTL subtraction with signed saturation -@cindex RTL subtraction with unsigned saturation -@item (minus:@var{m} @var{x} @var{y}) -@itemx (ss_minus:@var{m} @var{x} @var{y}) -@itemx (us_minus:@var{m} @var{x} @var{y}) - -These three expressions represent the result of subtracting @var{y} -from @var{x}, carried out in mode @var{M}. Behavior on overflow is -the same as for the three variants of @code{plus} (see above). - -@findex compare -@cindex RTL comparison -@item (compare:@var{m} @var{x} @var{y}) -Represents the result of subtracting @var{y} from @var{x} for purposes -of comparison. The result is computed without overflow, as if with -infinite precision. - -Of course, machines can't really subtract with infinite precision. -However, they can pretend to do so when only the sign of the result will -be used, which is the case when the result is stored in the condition -code. And that is the @emph{only} way this kind of expression may -validly be used: as a value to be stored in the condition codes, either -@code{(cc0)} or a register. @xref{Comparisons}. - -The mode @var{m} is not related to the modes of @var{x} and @var{y}, but -instead is the mode of the condition code value. If @code{(cc0)} is -used, it is @code{VOIDmode}. Otherwise it is some mode in class -@code{MODE_CC}, often @code{CCmode}. @xref{Condition Code}. If @var{m} -is @code{VOIDmode} or @code{CCmode}, the operation returns sufficient -information (in an unspecified format) so that any comparison operator -can be applied to the result of the @code{COMPARE} operation. For other -modes in class @code{MODE_CC}, the operation only returns a subset of -this information. - -Normally, @var{x} and @var{y} must have the same mode. Otherwise, -@code{compare} is valid only if the mode of @var{x} is in class -@code{MODE_INT} and @var{y} is a @code{const_int} or -@code{const_double} with mode @code{VOIDmode}. The mode of @var{x} -determines what mode the comparison is to be done in; thus it must not -be @code{VOIDmode}. - -If one of the operands is a constant, it should be placed in the -second operand and the comparison code adjusted as appropriate. - -A @code{compare} specifying two @code{VOIDmode} constants is not valid -since there is no way to know in what mode the comparison is to be -performed; the comparison must either be folded during the compilation -or the first operand must be loaded into a register while its mode is -still known. - -@findex neg -@findex ss_neg -@findex us_neg -@cindex negation -@cindex negation with signed saturation -@cindex negation with unsigned saturation -@item (neg:@var{m} @var{x}) -@itemx (ss_neg:@var{m} @var{x}) -@itemx (us_neg:@var{m} @var{x}) -These two expressions represent the negation (subtraction from zero) of -the value represented by @var{x}, carried out in mode @var{m}. They -differ in the behavior on overflow of integer modes. In the case of -@code{neg}, the negation of the operand may be a number not representable -in mode @var{m}, in which case it is truncated to @var{m}. @code{ss_neg} -and @code{us_neg} ensure that an out-of-bounds result saturates to the -maximum or minimum signed or unsigned value. - -@findex mult -@findex ss_mult -@findex us_mult -@cindex multiplication -@cindex product -@cindex multiplication with signed saturation -@cindex multiplication with unsigned saturation -@item (mult:@var{m} @var{x} @var{y}) -@itemx (ss_mult:@var{m} @var{x} @var{y}) -@itemx (us_mult:@var{m} @var{x} @var{y}) -Represents the signed product of the values represented by @var{x} and -@var{y} carried out in machine mode @var{m}. -@code{ss_mult} and @code{us_mult} ensure that an out-of-bounds result -saturates to the maximum or minimum signed or unsigned value. - -Some machines support a multiplication that generates a product wider -than the operands. Write the pattern for this as - -@smallexample -(mult:@var{m} (sign_extend:@var{m} @var{x}) (sign_extend:@var{m} @var{y})) -@end smallexample - -where @var{m} is wider than the modes of @var{x} and @var{y}, which need -not be the same. - -For unsigned widening multiplication, use the same idiom, but with -@code{zero_extend} instead of @code{sign_extend}. - -@findex fma -@item (fma:@var{m} @var{x} @var{y} @var{z}) -Represents the @code{fma}, @code{fmaf}, and @code{fmal} builtin -functions, which compute @samp{@var{x} * @var{y} + @var{z}} -without doing an intermediate rounding step. - -@findex div -@findex ss_div -@cindex division -@cindex signed division -@cindex signed division with signed saturation -@cindex quotient -@item (div:@var{m} @var{x} @var{y}) -@itemx (ss_div:@var{m} @var{x} @var{y}) -Represents the quotient in signed division of @var{x} by @var{y}, -carried out in machine mode @var{m}. If @var{m} is a floating point -mode, it represents the exact quotient; otherwise, the integerized -quotient. -@code{ss_div} ensures that an out-of-bounds result saturates to the maximum -or minimum signed value. - -Some machines have division instructions in which the operands and -quotient widths are not all the same; you should represent -such instructions using @code{truncate} and @code{sign_extend} as in, - -@smallexample -(truncate:@var{m1} (div:@var{m2} @var{x} (sign_extend:@var{m2} @var{y}))) -@end smallexample - -@findex udiv -@cindex unsigned division -@cindex unsigned division with unsigned saturation -@cindex division -@item (udiv:@var{m} @var{x} @var{y}) -@itemx (us_div:@var{m} @var{x} @var{y}) -Like @code{div} but represents unsigned division. -@code{us_div} ensures that an out-of-bounds result saturates to the maximum -or minimum unsigned value. - -@findex mod -@findex umod -@cindex remainder -@cindex division -@item (mod:@var{m} @var{x} @var{y}) -@itemx (umod:@var{m} @var{x} @var{y}) -Like @code{div} and @code{udiv} but represent the remainder instead of -the quotient. - -@findex smin -@findex smax -@cindex signed minimum -@cindex signed maximum -@item (smin:@var{m} @var{x} @var{y}) -@itemx (smax:@var{m} @var{x} @var{y}) -Represents the smaller (for @code{smin}) or larger (for @code{smax}) of -@var{x} and @var{y}, interpreted as signed values in mode @var{m}. -When used with floating point, if both operands are zeros, or if either -operand is @code{NaN}, then it is unspecified which of the two operands -is returned as the result. - -@findex umin -@findex umax -@cindex unsigned minimum and maximum -@item (umin:@var{m} @var{x} @var{y}) -@itemx (umax:@var{m} @var{x} @var{y}) -Like @code{smin} and @code{smax}, but the values are interpreted as unsigned -integers. - -@findex not -@cindex complement, bitwise -@cindex bitwise complement -@item (not:@var{m} @var{x}) -Represents the bitwise complement of the value represented by @var{x}, -carried out in mode @var{m}, which must be a fixed-point machine mode. - -@findex and -@cindex logical-and, bitwise -@cindex bitwise logical-and -@item (and:@var{m} @var{x} @var{y}) -Represents the bitwise logical-and of the values represented by -@var{x} and @var{y}, carried out in machine mode @var{m}, which must be -a fixed-point machine mode. - -@findex ior -@cindex inclusive-or, bitwise -@cindex bitwise inclusive-or -@item (ior:@var{m} @var{x} @var{y}) -Represents the bitwise inclusive-or of the values represented by @var{x} -and @var{y}, carried out in machine mode @var{m}, which must be a -fixed-point mode. - -@findex xor -@cindex exclusive-or, bitwise -@cindex bitwise exclusive-or -@item (xor:@var{m} @var{x} @var{y}) -Represents the bitwise exclusive-or of the values represented by @var{x} -and @var{y}, carried out in machine mode @var{m}, which must be a -fixed-point mode. - -@findex ashift -@findex ss_ashift -@findex us_ashift -@cindex left shift -@cindex shift -@cindex arithmetic shift -@cindex arithmetic shift with signed saturation -@cindex arithmetic shift with unsigned saturation -@item (ashift:@var{m} @var{x} @var{c}) -@itemx (ss_ashift:@var{m} @var{x} @var{c}) -@itemx (us_ashift:@var{m} @var{x} @var{c}) -These three expressions represent the result of arithmetically shifting @var{x} -left by @var{c} places. They differ in their behavior on overflow of integer -modes. An @code{ashift} operation is a plain shift with no special behavior -in case of a change in the sign bit; @code{ss_ashift} and @code{us_ashift} -saturates to the minimum or maximum representable value if any of the bits -shifted out differs from the final sign bit. - -@var{x} have mode @var{m}, a fixed-point machine mode. @var{c} -be a fixed-point mode or be a constant with mode @code{VOIDmode}; which -mode is determined by the mode called for in the machine description -entry for the left-shift instruction. For example, on the VAX, the mode -of @var{c} is @code{QImode} regardless of @var{m}. - -@findex lshiftrt -@cindex right shift -@findex ashiftrt -@item (lshiftrt:@var{m} @var{x} @var{c}) -@itemx (ashiftrt:@var{m} @var{x} @var{c}) -Like @code{ashift} but for right shift. Unlike the case for left shift, -these two operations are distinct. - -@findex rotate -@cindex rotate -@cindex left rotate -@findex rotatert -@cindex right rotate -@item (rotate:@var{m} @var{x} @var{c}) -@itemx (rotatert:@var{m} @var{x} @var{c}) -Similar but represent left and right rotate. If @var{c} is a constant, -use @code{rotate}. - -@findex abs -@findex ss_abs -@cindex absolute value -@item (abs:@var{m} @var{x}) -@item (ss_abs:@var{m} @var{x}) -Represents the absolute value of @var{x}, computed in mode @var{m}. -@code{ss_abs} ensures that an out-of-bounds result saturates to the -maximum signed value. - - -@findex sqrt -@cindex square root -@item (sqrt:@var{m} @var{x}) -Represents the square root of @var{x}, computed in mode @var{m}. -Most often @var{m} will be a floating point mode. - -@findex ffs -@item (ffs:@var{m} @var{x}) -Represents one plus the index of the least significant 1-bit in -@var{x}, represented as an integer of mode @var{m}. (The value is -zero if @var{x} is zero.) The mode of @var{x} must be @var{m} -or @code{VOIDmode}. - -@findex clrsb -@item (clrsb:@var{m} @var{x}) -Represents the number of redundant leading sign bits in @var{x}, -represented as an integer of mode @var{m}, starting at the most -significant bit position. This is one less than the number of leading -sign bits (either 0 or 1), with no special cases. The mode of @var{x} -must be @var{m} or @code{VOIDmode}. - -@findex clz -@item (clz:@var{m} @var{x}) -Represents the number of leading 0-bits in @var{x}, represented as an -integer of mode @var{m}, starting at the most significant bit position. -If @var{x} is zero, the value is determined by -@code{CLZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}). Note that this is one of -the few expressions that is not invariant under widening. The mode of -@var{x} must be @var{m} or @code{VOIDmode}. - -@findex ctz -@item (ctz:@var{m} @var{x}) -Represents the number of trailing 0-bits in @var{x}, represented as an -integer of mode @var{m}, starting at the least significant bit position. -If @var{x} is zero, the value is determined by -@code{CTZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}). Except for this case, -@code{ctz(x)} is equivalent to @code{ffs(@var{x}) - 1}. The mode of -@var{x} must be @var{m} or @code{VOIDmode}. - -@findex popcount -@item (popcount:@var{m} @var{x}) -Represents the number of 1-bits in @var{x}, represented as an integer of -mode @var{m}. The mode of @var{x} must be @var{m} or @code{VOIDmode}. - -@findex parity -@item (parity:@var{m} @var{x}) -Represents the number of 1-bits modulo 2 in @var{x}, represented as an -integer of mode @var{m}. The mode of @var{x} must be @var{m} or -@code{VOIDmode}. - -@findex bswap -@item (bswap:@var{m} @var{x}) -Represents the value @var{x} with the order of bytes reversed, carried out -in mode @var{m}, which must be a fixed-point machine mode. -The mode of @var{x} must be @var{m} or @code{VOIDmode}. -@end table - -@node Comparisons -@section Comparison Operations -@cindex RTL comparison operations - -Comparison operators test a relation on two operands and are considered -to represent a machine-dependent nonzero value described by, but not -necessarily equal to, @code{STORE_FLAG_VALUE} (@pxref{Misc}) -if the relation holds, or zero if it does not, for comparison operators -whose results have a `MODE_INT' mode, -@code{FLOAT_STORE_FLAG_VALUE} (@pxref{Misc}) if the relation holds, or -zero if it does not, for comparison operators that return floating-point -values, and a vector of either @code{VECTOR_STORE_FLAG_VALUE} (@pxref{Misc}) -if the relation holds, or of zeros if it does not, for comparison operators -that return vector results. -The mode of the comparison operation is independent of the mode -of the data being compared. If the comparison operation is being tested -(e.g., the first operand of an @code{if_then_else}), the mode must be -@code{VOIDmode}. - -@cindex condition codes -There are two ways that comparison operations may be used. The -comparison operators may be used to compare the condition codes -@code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}. Such -a construct actually refers to the result of the preceding instruction -in which the condition codes were set. The instruction setting the -condition code must be adjacent to the instruction using the condition -code; only @code{note} insns may separate them. - -Alternatively, a comparison operation may directly compare two data -objects. The mode of the comparison is determined by the operands; they -must both be valid for a common machine mode. A comparison with both -operands constant would be invalid as the machine mode could not be -deduced from it, but such a comparison should never exist in RTL due to -constant folding. - -In the example above, if @code{(cc0)} were last set to -@code{(compare @var{x} @var{y})}, the comparison operation is -identical to @code{(eq @var{x} @var{y})}. Usually only one style -of comparisons is supported on a particular machine, but the combine -pass will try to merge the operations to produce the @code{eq} shown -in case it exists in the context of the particular insn involved. - -Inequality comparisons come in two flavors, signed and unsigned. Thus, -there are distinct expression codes @code{gt} and @code{gtu} for signed and -unsigned greater-than. These can produce different results for the same -pair of integer values: for example, 1 is signed greater-than @minus{}1 but not -unsigned greater-than, because @minus{}1 when regarded as unsigned is actually -@code{0xffffffff} which is greater than 1. - -The signed comparisons are also used for floating point values. Floating -point comparisons are distinguished by the machine modes of the operands. - -@table @code -@findex eq -@cindex equal -@item (eq:@var{m} @var{x} @var{y}) -@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y} -are equal, otherwise 0. - -@findex ne -@cindex not equal -@item (ne:@var{m} @var{x} @var{y}) -@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y} -are not equal, otherwise 0. - -@findex gt -@cindex greater than -@item (gt:@var{m} @var{x} @var{y}) -@code{STORE_FLAG_VALUE} if the @var{x} is greater than @var{y}. If they -are fixed-point, the comparison is done in a signed sense. - -@findex gtu -@cindex greater than -@cindex unsigned greater than -@item (gtu:@var{m} @var{x} @var{y}) -Like @code{gt} but does unsigned comparison, on fixed-point numbers only. - -@findex lt -@cindex less than -@findex ltu -@cindex unsigned less than -@item (lt:@var{m} @var{x} @var{y}) -@itemx (ltu:@var{m} @var{x} @var{y}) -Like @code{gt} and @code{gtu} but test for ``less than''. - -@findex ge -@cindex greater than -@findex geu -@cindex unsigned greater than -@item (ge:@var{m} @var{x} @var{y}) -@itemx (geu:@var{m} @var{x} @var{y}) -Like @code{gt} and @code{gtu} but test for ``greater than or equal''. - -@findex le -@cindex less than or equal -@findex leu -@cindex unsigned less than -@item (le:@var{m} @var{x} @var{y}) -@itemx (leu:@var{m} @var{x} @var{y}) -Like @code{gt} and @code{gtu} but test for ``less than or equal''. - -@findex if_then_else -@item (if_then_else @var{cond} @var{then} @var{else}) -This is not a comparison operation but is listed here because it is -always used in conjunction with a comparison operation. To be -precise, @var{cond} is a comparison expression. This expression -represents a choice, according to @var{cond}, between the value -represented by @var{then} and the one represented by @var{else}. - -On most machines, @code{if_then_else} expressions are valid only -to express conditional jumps. - -@findex cond -@item (cond [@var{test1} @var{value1} @var{test2} @var{value2} @dots{}] @var{default}) -Similar to @code{if_then_else}, but more general. Each of @var{test1}, -@var{test2}, @dots{} is performed in turn. The result of this expression is -the @var{value} corresponding to the first nonzero test, or @var{default} if -none of the tests are nonzero expressions. - -This is currently not valid for instruction patterns and is supported only -for insn attributes. @xref{Insn Attributes}. -@end table - -@node Bit-Fields -@section Bit-Fields -@cindex bit-fields - -Special expression codes exist to represent bit-field instructions. - -@table @code -@findex sign_extract -@cindex @code{BITS_BIG_ENDIAN}, effect on @code{sign_extract} -@item (sign_extract:@var{m} @var{loc} @var{size} @var{pos}) -This represents a reference to a sign-extended bit-field contained or -starting in @var{loc} (a memory or register reference). The bit-field -is @var{size} bits wide and starts at bit @var{pos}. The compilation -option @code{BITS_BIG_ENDIAN} says which end of the memory unit -@var{pos} counts from. - -If @var{loc} is in memory, its mode must be a single-byte integer mode. -If @var{loc} is in a register, the mode to use is specified by the -operand of the @code{insv} or @code{extv} pattern -(@pxref{Standard Names}) and is usually a full-word integer mode, -which is the default if none is specified. - -The mode of @var{pos} is machine-specific and is also specified -in the @code{insv} or @code{extv} pattern. - -The mode @var{m} is the same as the mode that would be used for -@var{loc} if it were a register. - -A @code{sign_extract} can not appear as an lvalue, or part thereof, -in RTL. - -@findex zero_extract -@item (zero_extract:@var{m} @var{loc} @var{size} @var{pos}) -Like @code{sign_extract} but refers to an unsigned or zero-extended -bit-field. The same sequence of bits are extracted, but they -are filled to an entire word with zeros instead of by sign-extension. - -Unlike @code{sign_extract}, this type of expressions can be lvalues -in RTL; they may appear on the left side of an assignment, indicating -insertion of a value into the specified bit-field. -@end table - -@node Vector Operations -@section Vector Operations -@cindex vector operations - -All normal RTL expressions can be used with vector modes; they are -interpreted as operating on each part of the vector independently. -Additionally, there are a few new expressions to describe specific vector -operations. - -@table @code -@findex vec_merge -@item (vec_merge:@var{m} @var{vec1} @var{vec2} @var{items}) -This describes a merge operation between two vectors. The result is a vector -of mode @var{m}; its elements are selected from either @var{vec1} or -@var{vec2}. Which elements are selected is described by @var{items}, which -is a bit mask represented by a @code{const_int}; a zero bit indicates the -corresponding element in the result vector is taken from @var{vec2} while -a set bit indicates it is taken from @var{vec1}. - -@findex vec_select -@item (vec_select:@var{m} @var{vec1} @var{selection}) -This describes an operation that selects parts of a vector. @var{vec1} is -the source vector, and @var{selection} is a @code{parallel} that contains a -@code{const_int} for each of the subparts of the result vector, giving the -number of the source subpart that should be stored into it. -The result mode @var{m} is either the submode for a single element of -@var{vec1} (if only one subpart is selected), or another vector mode -with that element submode (if multiple subparts are selected). - -@findex vec_concat -@item (vec_concat:@var{m} @var{x1} @var{x2}) -Describes a vector concat operation. The result is a concatenation of the -vectors or scalars @var{x1} and @var{x2}; its length is the sum of the -lengths of the two inputs. - -@findex vec_duplicate -@item (vec_duplicate:@var{m} @var{x}) -This operation converts a scalar into a vector or a small vector into a -larger one by duplicating the input values. The output vector mode must have -the same submodes as the input vector mode or the scalar modes, and the -number of output parts must be an integer multiple of the number of input -parts. - -@end table - -@node Conversions -@section Conversions -@cindex conversions -@cindex machine mode conversions - -All conversions between machine modes must be represented by -explicit conversion operations. For example, an expression -which is the sum of a byte and a full word cannot be written as -@code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @code{plus} -operation requires two operands of the same machine mode. -Therefore, the byte-sized operand is enclosed in a conversion -operation, as in - -@smallexample -(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80)) -@end smallexample - -The conversion operation is not a mere placeholder, because there -may be more than one way of converting from a given starting mode -to the desired final mode. The conversion operation code says how -to do it. - -For all conversion operations, @var{x} must not be @code{VOIDmode} -because the mode in which to do the conversion would not be known. -The conversion must either be done at compile-time or @var{x} -must be placed into a register. - -@table @code -@findex sign_extend -@item (sign_extend:@var{m} @var{x}) -Represents the result of sign-extending the value @var{x} -to machine mode @var{m}. @var{m} must be a fixed-point mode -and @var{x} a fixed-point value of a mode narrower than @var{m}. - -@findex zero_extend -@item (zero_extend:@var{m} @var{x}) -Represents the result of zero-extending the value @var{x} -to machine mode @var{m}. @var{m} must be a fixed-point mode -and @var{x} a fixed-point value of a mode narrower than @var{m}. - -@findex float_extend -@item (float_extend:@var{m} @var{x}) -Represents the result of extending the value @var{x} -to machine mode @var{m}. @var{m} must be a floating point mode -and @var{x} a floating point value of a mode narrower than @var{m}. - -@findex truncate -@item (truncate:@var{m} @var{x}) -Represents the result of truncating the value @var{x} -to machine mode @var{m}. @var{m} must be a fixed-point mode -and @var{x} a fixed-point value of a mode wider than @var{m}. - -@findex ss_truncate -@item (ss_truncate:@var{m} @var{x}) -Represents the result of truncating the value @var{x} -to machine mode @var{m}, using signed saturation in the case of -overflow. Both @var{m} and the mode of @var{x} must be fixed-point -modes. - -@findex us_truncate -@item (us_truncate:@var{m} @var{x}) -Represents the result of truncating the value @var{x} -to machine mode @var{m}, using unsigned saturation in the case of -overflow. Both @var{m} and the mode of @var{x} must be fixed-point -modes. - -@findex float_truncate -@item (float_truncate:@var{m} @var{x}) -Represents the result of truncating the value @var{x} -to machine mode @var{m}. @var{m} must be a floating point mode -and @var{x} a floating point value of a mode wider than @var{m}. - -@findex float -@item (float:@var{m} @var{x}) -Represents the result of converting fixed point value @var{x}, -regarded as signed, to floating point mode @var{m}. - -@findex unsigned_float -@item (unsigned_float:@var{m} @var{x}) -Represents the result of converting fixed point value @var{x}, -regarded as unsigned, to floating point mode @var{m}. - -@findex fix -@item (fix:@var{m} @var{x}) -When @var{m} is a floating-point mode, represents the result of -converting floating point value @var{x} (valid for mode @var{m}) to an -integer, still represented in floating point mode @var{m}, by rounding -towards zero. - -When @var{m} is a fixed-point mode, represents the result of -converting floating point value @var{x} to mode @var{m}, regarded as -signed. How rounding is done is not specified, so this operation may -be used validly in compiling C code only for integer-valued operands. - -@findex unsigned_fix -@item (unsigned_fix:@var{m} @var{x}) -Represents the result of converting floating point value @var{x} to -fixed point mode @var{m}, regarded as unsigned. How rounding is done -is not specified. - -@findex fract_convert -@item (fract_convert:@var{m} @var{x}) -Represents the result of converting fixed-point value @var{x} to -fixed-point mode @var{m}, signed integer value @var{x} to -fixed-point mode @var{m}, floating-point value @var{x} to -fixed-point mode @var{m}, fixed-point value @var{x} to integer mode @var{m} -regarded as signed, or fixed-point value @var{x} to floating-point mode @var{m}. -When overflows or underflows happen, the results are undefined. - -@findex sat_fract -@item (sat_fract:@var{m} @var{x}) -Represents the result of converting fixed-point value @var{x} to -fixed-point mode @var{m}, signed integer value @var{x} to -fixed-point mode @var{m}, or floating-point value @var{x} to -fixed-point mode @var{m}. -When overflows or underflows happen, the results are saturated to the -maximum or the minimum. - -@findex unsigned_fract_convert -@item (unsigned_fract_convert:@var{m} @var{x}) -Represents the result of converting fixed-point value @var{x} to -integer mode @var{m} regarded as unsigned, or unsigned integer value @var{x} to -fixed-point mode @var{m}. -When overflows or underflows happen, the results are undefined. - -@findex unsigned_sat_fract -@item (unsigned_sat_fract:@var{m} @var{x}) -Represents the result of converting unsigned integer value @var{x} to -fixed-point mode @var{m}. -When overflows or underflows happen, the results are saturated to the -maximum or the minimum. -@end table - -@node RTL Declarations -@section Declarations -@cindex RTL declarations -@cindex declarations, RTL - -Declaration expression codes do not represent arithmetic operations -but rather state assertions about their operands. - -@table @code -@findex strict_low_part -@cindex @code{subreg}, in @code{strict_low_part} -@item (strict_low_part (subreg:@var{m} (reg:@var{n} @var{r}) 0)) -This expression code is used in only one context: as the destination operand of a -@code{set} expression. In addition, the operand of this expression -must be a non-paradoxical @code{subreg} expression. - -The presence of @code{strict_low_part} says that the part of the -register which is meaningful in mode @var{n}, but is not part of -mode @var{m}, is not to be altered. Normally, an assignment to such -a subreg is allowed to have undefined effects on the rest of the -register when @var{m} is less than a word. -@end table - -@node Side Effects -@section Side Effect Expressions -@cindex RTL side effect expressions - -The expression codes described so far represent values, not actions. -But machine instructions never produce values; they are meaningful -only for their side effects on the state of the machine. Special -expression codes are used to represent side effects. - -The body of an instruction is always one of these side effect codes; -the codes described above, which represent values, appear only as -the operands of these. - -@table @code -@findex set -@item (set @var{lval} @var{x}) -Represents the action of storing the value of @var{x} into the place -represented by @var{lval}. @var{lval} must be an expression -representing a place that can be stored in: @code{reg} (or @code{subreg}, -@code{strict_low_part} or @code{zero_extract}), @code{mem}, @code{pc}, -@code{parallel}, or @code{cc0}. - -If @var{lval} is a @code{reg}, @code{subreg} or @code{mem}, it has a -machine mode; then @var{x} must be valid for that mode. - -If @var{lval} is a @code{reg} whose machine mode is less than the full -width of the register, then it means that the part of the register -specified by the machine mode is given the specified value and the -rest of the register receives an undefined value. Likewise, if -@var{lval} is a @code{subreg} whose machine mode is narrower than -the mode of the register, the rest of the register can be changed in -an undefined way. - -If @var{lval} is a @code{strict_low_part} of a subreg, then the part -of the register specified by the machine mode of the @code{subreg} is -given the value @var{x} and the rest of the register is not changed. - -If @var{lval} is a @code{zero_extract}, then the referenced part of -the bit-field (a memory or register reference) specified by the -@code{zero_extract} is given the value @var{x} and the rest of the -bit-field is not changed. Note that @code{sign_extract} can not -appear in @var{lval}. - -If @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may -be either a @code{compare} expression or a value that may have any mode. -The latter case represents a ``test'' instruction. The expression -@code{(set (cc0) (reg:@var{m} @var{n}))} is equivalent to -@code{(set (cc0) (compare (reg:@var{m} @var{n}) (const_int 0)))}. -Use the former expression to save space during the compilation. - -If @var{lval} is a @code{parallel}, it is used to represent the case of -a function returning a structure in multiple registers. Each element -of the @code{parallel} is an @code{expr_list} whose first operand is a -@code{reg} and whose second operand is a @code{const_int} representing the -offset (in bytes) into the structure at which the data in that register -corresponds. The first element may be null to indicate that the structure -is also passed partly in memory. - -@cindex jump instructions and @code{set} -@cindex @code{if_then_else} usage -If @var{lval} is @code{(pc)}, we have a jump instruction, and the -possibilities for @var{x} are very limited. It may be a -@code{label_ref} expression (unconditional jump). It may be an -@code{if_then_else} (conditional jump), in which case either the -second or the third operand must be @code{(pc)} (for the case which -does not jump) and the other of the two must be a @code{label_ref} -(for the case which does jump). @var{x} may also be a @code{mem} or -@code{(plus:SI (pc) @var{y})}, where @var{y} may be a @code{reg} or a -@code{mem}; these unusual patterns are used to represent jumps through -branch tables. - -If @var{lval} is neither @code{(cc0)} nor @code{(pc)}, the mode of -@var{lval} must not be @code{VOIDmode} and the mode of @var{x} must be -valid for the mode of @var{lval}. - -@findex SET_DEST -@findex SET_SRC -@var{lval} is customarily accessed with the @code{SET_DEST} macro and -@var{x} with the @code{SET_SRC} macro. - -@findex return -@item (return) -As the sole expression in a pattern, represents a return from the -current function, on machines where this can be done with one -instruction, such as VAXen. On machines where a multi-instruction -``epilogue'' must be executed in order to return from the function, -returning is done by jumping to a label which precedes the epilogue, and -the @code{return} expression code is never used. - -Inside an @code{if_then_else} expression, represents the value to be -placed in @code{pc} to return to the caller. - -Note that an insn pattern of @code{(return)} is logically equivalent to -@code{(set (pc) (return))}, but the latter form is never used. - -@findex simple_return -@item (simple_return) -Like @code{(return)}, but truly represents only a function return, while -@code{(return)} may represent an insn that also performs other functions -of the function epilogue. Like @code{(return)}, this may also occur in -conditional jumps. - -@findex call -@item (call @var{function} @var{nargs}) -Represents a function call. @var{function} is a @code{mem} expression -whose address is the address of the function to be called. -@var{nargs} is an expression which can be used for two purposes: on -some machines it represents the number of bytes of stack argument; on -others, it represents the number of argument registers. - -Each machine has a standard machine mode which @var{function} must -have. The machine description defines macro @code{FUNCTION_MODE} to -expand into the requisite mode name. The purpose of this mode is to -specify what kind of addressing is allowed, on machines where the -allowed kinds of addressing depend on the machine mode being -addressed. - -@findex clobber -@item (clobber @var{x}) -Represents the storing or possible storing of an unpredictable, -undescribed value into @var{x}, which must be a @code{reg}, -@code{scratch}, @code{parallel} or @code{mem} expression. - -One place this is used is in string instructions that store standard -values into particular hard registers. It may not be worth the -trouble to describe the values that are stored, but it is essential to -inform the compiler that the registers will be altered, lest it -attempt to keep data in them across the string instruction. - -If @var{x} is @code{(mem:BLK (const_int 0))} or -@code{(mem:BLK (scratch))}, it means that all memory -locations must be presumed clobbered. If @var{x} is a @code{parallel}, -it has the same meaning as a @code{parallel} in a @code{set} expression. - -Note that the machine description classifies certain hard registers as -``call-clobbered''. All function call instructions are assumed by -default to clobber these registers, so there is no need to use -@code{clobber} expressions to indicate this fact. Also, each function -call is assumed to have the potential to alter any memory location, -unless the function is declared @code{const}. - -If the last group of expressions in a @code{parallel} are each a -@code{clobber} expression whose arguments are @code{reg} or -@code{match_scratch} (@pxref{RTL Template}) expressions, the combiner -phase can add the appropriate @code{clobber} expressions to an insn it -has constructed when doing so will cause a pattern to be matched. - -This feature can be used, for example, on a machine that whose multiply -and add instructions don't use an MQ register but which has an -add-accumulate instruction that does clobber the MQ register. Similarly, -a combined instruction might require a temporary register while the -constituent instructions might not. - -When a @code{clobber} expression for a register appears inside a -@code{parallel} with other side effects, the register allocator -guarantees that the register is unoccupied both before and after that -insn if it is a hard register clobber. For pseudo-register clobber, -the register allocator and the reload pass do not assign the same hard -register to the clobber and the input operands if there is an insn -alternative containing the @samp{&} constraint (@pxref{Modifiers}) for -the clobber and the hard register is in register classes of the -clobber in the alternative. You can clobber either a specific hard -register, a pseudo register, or a @code{scratch} expression; in the -latter two cases, GCC will allocate a hard register that is available -there for use as a temporary. - -For instructions that require a temporary register, you should use -@code{scratch} instead of a pseudo-register because this will allow the -combiner phase to add the @code{clobber} when required. You do this by -coding (@code{clobber} (@code{match_scratch} @dots{})). If you do -clobber a pseudo register, use one which appears nowhere else---generate -a new one each time. Otherwise, you may confuse CSE@. - -There is one other known use for clobbering a pseudo register in a -@code{parallel}: when one of the input operands of the insn is also -clobbered by the insn. In this case, using the same pseudo register in -the clobber and elsewhere in the insn produces the expected results. - -@findex use -@item (use @var{x}) -Represents the use of the value of @var{x}. It indicates that the -value in @var{x} at this point in the program is needed, even though -it may not be apparent why this is so. Therefore, the compiler will -not attempt to delete previous instructions whose only effect is to -store a value in @var{x}. @var{x} must be a @code{reg} expression. - -In some situations, it may be tempting to add a @code{use} of a -register in a @code{parallel} to describe a situation where the value -of a special register will modify the behavior of the instruction. -A hypothetical example might be a pattern for an addition that can -either wrap around or use saturating addition depending on the value -of a special control register: - -@smallexample -(parallel [(set (reg:SI 2) (unspec:SI [(reg:SI 3) - (reg:SI 4)] 0)) - (use (reg:SI 1))]) -@end smallexample - -@noindent - -This will not work, several of the optimizers only look at expressions -locally; it is very likely that if you have multiple insns with -identical inputs to the @code{unspec}, they will be optimized away even -if register 1 changes in between. - -This means that @code{use} can @emph{only} be used to describe -that the register is live. You should think twice before adding -@code{use} statements, more often you will want to use @code{unspec} -instead. The @code{use} RTX is most commonly useful to describe that -a fixed register is implicitly used in an insn. It is also safe to use -in patterns where the compiler knows for other reasons that the result -of the whole pattern is variable, such as @samp{movmem@var{m}} or -@samp{call} patterns. - -During the reload phase, an insn that has a @code{use} as pattern -can carry a reg_equal note. These @code{use} insns will be deleted -before the reload phase exits. - -During the delayed branch scheduling phase, @var{x} may be an insn. -This indicates that @var{x} previously was located at this place in the -code and its data dependencies need to be taken into account. These -@code{use} insns will be deleted before the delayed branch scheduling -phase exits. - -@findex parallel -@item (parallel [@var{x0} @var{x1} @dots{}]) -Represents several side effects performed in parallel. The square -brackets stand for a vector; the operand of @code{parallel} is a -vector of expressions. @var{x0}, @var{x1} and so on are individual -side effect expressions---expressions of code @code{set}, @code{call}, -@code{return}, @code{simple_return}, @code{clobber} or @code{use}. - -``In parallel'' means that first all the values used in the individual -side-effects are computed, and second all the actual side-effects are -performed. For example, - -@smallexample -(parallel [(set (reg:SI 1) (mem:SI (reg:SI 1))) - (set (mem:SI (reg:SI 1)) (reg:SI 1))]) -@end smallexample - -@noindent -says unambiguously that the values of hard register 1 and the memory -location addressed by it are interchanged. In both places where -@code{(reg:SI 1)} appears as a memory address it refers to the value -in register 1 @emph{before} the execution of the insn. - -It follows that it is @emph{incorrect} to use @code{parallel} and -expect the result of one @code{set} to be available for the next one. -For example, people sometimes attempt to represent a jump-if-zero -instruction this way: - -@smallexample -(parallel [(set (cc0) (reg:SI 34)) - (set (pc) (if_then_else - (eq (cc0) (const_int 0)) - (label_ref @dots{}) - (pc)))]) -@end smallexample - -@noindent -But this is incorrect, because it says that the jump condition depends -on the condition code value @emph{before} this instruction, not on the -new value that is set by this instruction. - -@cindex peephole optimization, RTL representation -Peephole optimization, which takes place together with final assembly -code output, can produce insns whose patterns consist of a @code{parallel} -whose elements are the operands needed to output the resulting -assembler code---often @code{reg}, @code{mem} or constant expressions. -This would not be well-formed RTL at any other stage in compilation, -but it is OK then because no further optimization remains to be done. -However, the definition of the macro @code{NOTICE_UPDATE_CC}, if -any, must deal with such insns if you define any peephole optimizations. - -@findex cond_exec -@item (cond_exec [@var{cond} @var{expr}]) -Represents a conditionally executed expression. The @var{expr} is -executed only if the @var{cond} is nonzero. The @var{cond} expression -must not have side-effects, but the @var{expr} may very well have -side-effects. - -@findex sequence -@item (sequence [@var{insns} @dots{}]) -Represents a sequence of insns. If a @code{sequence} appears in the -chain of insns, then each of the @var{insns} that appears in the sequence -must be suitable for appearing in the chain of insns, i.e. must satisfy -the @code{INSN_P} predicate. - -After delay-slot scheduling is completed, an insn and all the insns that -reside in its delay slots are grouped together into a @code{sequence}. -The insn requiring the delay slot is the first insn in the vector; -subsequent insns are to be placed in the delay slot. - -@code{INSN_ANNULLED_BRANCH_P} is set on an insn in a delay slot to -indicate that a branch insn should be used that will conditionally annul -the effect of the insns in the delay slots. In such a case, -@code{INSN_FROM_TARGET_P} indicates that the insn is from the target of -the branch and should be executed only if the branch is taken; otherwise -the insn should be executed only if the branch is not taken. -@xref{Delay Slots}. - -Some back ends also use @code{sequence} objects for purposes other than -delay-slot groups. This is not supported in the common parts of the -compiler, which treat such sequences as delay-slot groups. - -DWARF2 Call Frame Address (CFA) adjustments are sometimes also expressed -using @code{sequence} objects as the value of a @code{RTX_FRAME_RELATED_P} -note. This only happens if the CFA adjustments cannot be easily derived -from the pattern of the instruction to which the note is attached. In -such cases, the value of the note is used instead of best-guesing the -semantics of the instruction. The back end can attach notes containing -a @code{sequence} of @code{set} patterns that express the effect of the -parent instruction. -@end table - -These expression codes appear in place of a side effect, as the body of -an insn, though strictly speaking they do not always describe side -effects as such: - -@table @code -@findex asm_input -@item (asm_input @var{s}) -Represents literal assembler code as described by the string @var{s}. - -@findex unspec -@findex unspec_volatile -@item (unspec [@var{operands} @dots{}] @var{index}) -@itemx (unspec_volatile [@var{operands} @dots{}] @var{index}) -Represents a machine-specific operation on @var{operands}. @var{index} -selects between multiple machine-specific operations. -@code{unspec_volatile} is used for volatile operations and operations -that may trap; @code{unspec} is used for other operations. - -These codes may appear inside a @code{pattern} of an -insn, inside a @code{parallel}, or inside an expression. - -@findex addr_vec -@item (addr_vec:@var{m} [@var{lr0} @var{lr1} @dots{}]) -Represents a table of jump addresses. The vector elements @var{lr0}, -etc., are @code{label_ref} expressions. The mode @var{m} specifies -how much space is given to each address; normally @var{m} would be -@code{Pmode}. - -@findex addr_diff_vec -@item (addr_diff_vec:@var{m} @var{base} [@var{lr0} @var{lr1} @dots{}] @var{min} @var{max} @var{flags}) -Represents a table of jump addresses expressed as offsets from -@var{base}. The vector elements @var{lr0}, etc., are @code{label_ref} -expressions and so is @var{base}. The mode @var{m} specifies how much -space is given to each address-difference. @var{min} and @var{max} -are set up by branch shortening and hold a label with a minimum and a -maximum address, respectively. @var{flags} indicates the relative -position of @var{base}, @var{min} and @var{max} to the containing insn -and of @var{min} and @var{max} to @var{base}. See rtl.def for details. - -@findex prefetch -@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality}) -Represents prefetch of memory at address @var{addr}. -Operand @var{rw} is 1 if the prefetch is for data to be written, 0 otherwise; -targets that do not support write prefetches should treat this as a normal -prefetch. -Operand @var{locality} specifies the amount of temporal locality; 0 if there -is none or 1, 2, or 3 for increasing levels of temporal locality; -targets that do not support locality hints should ignore this. - -This insn is used to minimize cache-miss latency by moving data into a -cache before it is accessed. It should use only non-faulting data prefetch -instructions. -@end table - -@node Incdec -@section Embedded Side-Effects on Addresses -@cindex RTL preincrement -@cindex RTL postincrement -@cindex RTL predecrement -@cindex RTL postdecrement - -Six special side-effect expression codes appear as memory addresses. - -@table @code -@findex pre_dec -@item (pre_dec:@var{m} @var{x}) -Represents the side effect of decrementing @var{x} by a standard -amount and represents also the value that @var{x} has after being -decremented. @var{x} must be a @code{reg} or @code{mem}, but most -machines allow only a @code{reg}. @var{m} must be the machine mode -for pointers on the machine in use. The amount @var{x} is decremented -by is the length in bytes of the machine mode of the containing memory -reference of which this expression serves as the address. Here is an -example of its use: - -@smallexample -(mem:DF (pre_dec:SI (reg:SI 39))) -@end smallexample - -@noindent -This says to decrement pseudo register 39 by the length of a @code{DFmode} -value and use the result to address a @code{DFmode} value. - -@findex pre_inc -@item (pre_inc:@var{m} @var{x}) -Similar, but specifies incrementing @var{x} instead of decrementing it. - -@findex post_dec -@item (post_dec:@var{m} @var{x}) -Represents the same side effect as @code{pre_dec} but a different -value. The value represented here is the value @var{x} has @i{before} -being decremented. - -@findex post_inc -@item (post_inc:@var{m} @var{x}) -Similar, but specifies incrementing @var{x} instead of decrementing it. - -@findex post_modify -@item (post_modify:@var{m} @var{x} @var{y}) - -Represents the side effect of setting @var{x} to @var{y} and -represents @var{x} before @var{x} is modified. @var{x} must be a -@code{reg} or @code{mem}, but most machines allow only a @code{reg}. -@var{m} must be the machine mode for pointers on the machine in use. - -The expression @var{y} must be one of three forms: -@code{(plus:@var{m} @var{x} @var{z})}, -@code{(minus:@var{m} @var{x} @var{z})}, or -@code{(plus:@var{m} @var{x} @var{i})}, -where @var{z} is an index register and @var{i} is a constant. - -Here is an example of its use: - -@smallexample -(mem:SF (post_modify:SI (reg:SI 42) (plus (reg:SI 42) - (reg:SI 48)))) -@end smallexample - -This says to modify pseudo register 42 by adding the contents of pseudo -register 48 to it, after the use of what ever 42 points to. - -@findex pre_modify -@item (pre_modify:@var{m} @var{x} @var{expr}) -Similar except side effects happen before the use. -@end table - -These embedded side effect expressions must be used with care. Instruction -patterns may not use them. Until the @samp{flow} pass of the compiler, -they may occur only to represent pushes onto the stack. The @samp{flow} -pass finds cases where registers are incremented or decremented in one -instruction and used as an address shortly before or after; these cases are -then transformed to use pre- or post-increment or -decrement. - -If a register used as the operand of these expressions is used in -another address in an insn, the original value of the register is used. -Uses of the register outside of an address are not permitted within the -same insn as a use in an embedded side effect expression because such -insns behave differently on different machines and hence must be treated -as ambiguous and disallowed. - -An instruction that can be represented with an embedded side effect -could also be represented using @code{parallel} containing an additional -@code{set} to describe how the address register is altered. This is not -done because machines that allow these operations at all typically -allow them wherever a memory address is called for. Describing them as -additional parallel stores would require doubling the number of entries -in the machine description. - -@node Assembler -@section Assembler Instructions as Expressions -@cindex assembler instructions in RTL - -@cindex @code{asm_operands}, usage -The RTX code @code{asm_operands} represents a value produced by a -user-specified assembler instruction. It is used to represent -an @code{asm} statement with arguments. An @code{asm} statement with -a single output operand, like this: - -@smallexample -asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z)); -@end smallexample - -@noindent -is represented using a single @code{asm_operands} RTX which represents -the value that is stored in @code{outputvar}: - -@smallexample -(set @var{rtx-for-outputvar} - (asm_operands "foo %1,%2,%0" "a" 0 - [@var{rtx-for-addition-result} @var{rtx-for-*z}] - [(asm_input:@var{m1} "g") - (asm_input:@var{m2} "di")])) -@end smallexample - -@noindent -Here the operands of the @code{asm_operands} RTX are the assembler -template string, the output-operand's constraint, the index-number of the -output operand among the output operands specified, a vector of input -operand RTX's, and a vector of input-operand modes and constraints. The -mode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of -@code{*z}. - -When an @code{asm} statement has multiple output values, its insn has -several such @code{set} RTX's inside of a @code{parallel}. Each @code{set} -contains an @code{asm_operands}; all of these share the same assembler -template and vectors, but each contains the constraint for the respective -output operand. They are also distinguished by the output-operand index -number, which is 0, 1, @dots{} for successive output operands. - -@node Debug Information -@section Variable Location Debug Information in RTL -@cindex Variable Location Debug Information in RTL - -Variable tracking relies on @code{MEM_EXPR} and @code{REG_EXPR} -annotations to determine what user variables memory and register -references refer to. - -Variable tracking at assignments uses these notes only when they refer -to variables that live at fixed locations (e.g., addressable -variables, global non-automatic variables). For variables whose -location may vary, it relies on the following types of notes. - -@table @code -@findex var_location -@item (var_location:@var{mode} @var{var} @var{exp} @var{stat}) -Binds variable @code{var}, a tree, to value @var{exp}, an RTL -expression. It appears only in @code{NOTE_INSN_VAR_LOCATION} and -@code{DEBUG_INSN}s, with slightly different meanings. @var{mode}, if -present, represents the mode of @var{exp}, which is useful if it is a -modeless expression. @var{stat} is only meaningful in notes, -indicating whether the variable is known to be initialized or -uninitialized. - -@findex debug_expr -@item (debug_expr:@var{mode} @var{decl}) -Stands for the value bound to the @code{DEBUG_EXPR_DECL} @var{decl}, -that points back to it, within value expressions in -@code{VAR_LOCATION} nodes. - -@end table - -@node Insns -@section Insns -@cindex insns - -The RTL representation of the code for a function is a doubly-linked -chain of objects called @dfn{insns}. Insns are expressions with -special codes that are used for no other purpose. Some insns are -actual instructions; others represent dispatch tables for @code{switch} -statements; others represent labels to jump to or various sorts of -declarative information. - -In addition to its own specific data, each insn must have a unique -id-number that distinguishes it from all other insns in the current -function (after delayed branch scheduling, copies of an insn with the -same id-number may be present in multiple places in a function, but -these copies will always be identical and will only appear inside a -@code{sequence}), and chain pointers to the preceding and following -insns. These three fields occupy the same position in every insn, -independent of the expression code of the insn. They could be accessed -with @code{XEXP} and @code{XINT}, but instead three special macros are -always used: - -@table @code -@findex INSN_UID -@item INSN_UID (@var{i}) -Accesses the unique id of insn @var{i}. - -@findex PREV_INSN -@item PREV_INSN (@var{i}) -Accesses the chain pointer to the insn preceding @var{i}. -If @var{i} is the first insn, this is a null pointer. - -@findex NEXT_INSN -@item NEXT_INSN (@var{i}) -Accesses the chain pointer to the insn following @var{i}. -If @var{i} is the last insn, this is a null pointer. -@end table - -@findex get_insns -@findex get_last_insn -The first insn in the chain is obtained by calling @code{get_insns}; the -last insn is the result of calling @code{get_last_insn}. Within the -chain delimited by these insns, the @code{NEXT_INSN} and -@code{PREV_INSN} pointers must always correspond: if @var{insn} is not -the first insn, - -@smallexample -NEXT_INSN (PREV_INSN (@var{insn})) == @var{insn} -@end smallexample - -@noindent -is always true and if @var{insn} is not the last insn, - -@smallexample -PREV_INSN (NEXT_INSN (@var{insn})) == @var{insn} -@end smallexample - -@noindent -is always true. - -After delay slot scheduling, some of the insns in the chain might be -@code{sequence} expressions, which contain a vector of insns. The value -of @code{NEXT_INSN} in all but the last of these insns is the next insn -in the vector; the value of @code{NEXT_INSN} of the last insn in the vector -is the same as the value of @code{NEXT_INSN} for the @code{sequence} in -which it is contained. Similar rules apply for @code{PREV_INSN}. - -This means that the above invariants are not necessarily true for insns -inside @code{sequence} expressions. Specifically, if @var{insn} is the -first insn in a @code{sequence}, @code{NEXT_INSN (PREV_INSN (@var{insn}))} -is the insn containing the @code{sequence} expression, as is the value -of @code{PREV_INSN (NEXT_INSN (@var{insn}))} if @var{insn} is the last -insn in the @code{sequence} expression. You can use these expressions -to find the containing @code{sequence} expression. - -Every insn has one of the following expression codes: - -@table @code -@findex insn -@item insn -The expression code @code{insn} is used for instructions that do not jump -and do not do function calls. @code{sequence} expressions are always -contained in insns with code @code{insn} even if one of those insns -should jump or do function calls. - -Insns with code @code{insn} have four additional fields beyond the three -mandatory ones listed above. These four are described in a table below. - -@findex jump_insn -@item jump_insn -The expression code @code{jump_insn} is used for instructions that may -jump (or, more generally, may contain @code{label_ref} expressions to -which @code{pc} can be set in that instruction). If there is an -instruction to return from the current function, it is recorded as a -@code{jump_insn}. - -@findex JUMP_LABEL -@code{jump_insn} insns have the same extra fields as @code{insn} insns, -accessed in the same way and in addition contain a field -@code{JUMP_LABEL} which is defined once jump optimization has completed. - -For simple conditional and unconditional jumps, this field contains -the @code{code_label} to which this insn will (possibly conditionally) -branch. In a more complex jump, @code{JUMP_LABEL} records one of the -labels that the insn refers to; other jump target labels are recorded -as @code{REG_LABEL_TARGET} notes. The exception is @code{addr_vec} -and @code{addr_diff_vec}, where @code{JUMP_LABEL} is @code{NULL_RTX} -and the only way to find the labels is to scan the entire body of the -insn. - -Return insns count as jumps, but since they do not refer to any -labels, their @code{JUMP_LABEL} is @code{NULL_RTX}. - -@findex call_insn -@item call_insn -The expression code @code{call_insn} is used for instructions that may do -function calls. It is important to distinguish these instructions because -they imply that certain registers and memory locations may be altered -unpredictably. - -@findex CALL_INSN_FUNCTION_USAGE -@code{call_insn} insns have the same extra fields as @code{insn} insns, -accessed in the same way and in addition contain a field -@code{CALL_INSN_FUNCTION_USAGE}, which contains a list (chain of -@code{expr_list} expressions) containing @code{use}, @code{clobber} and -sometimes @code{set} expressions that denote hard registers and -@code{mem}s used or clobbered by the called function. - -A @code{mem} generally points to a stack slot in which arguments passed -to the libcall by reference (@pxref{Register Arguments, -TARGET_PASS_BY_REFERENCE}) are stored. If the argument is -caller-copied (@pxref{Register Arguments, TARGET_CALLEE_COPIES}), -the stack slot will be mentioned in @code{clobber} and @code{use} -entries; if it's callee-copied, only a @code{use} will appear, and the -@code{mem} may point to addresses that are not stack slots. - -Registers occurring inside a @code{clobber} in this list augment -registers specified in @code{CALL_USED_REGISTERS} (@pxref{Register -Basics}). - -If the list contains a @code{set} involving two registers, it indicates -that the function returns one of its arguments. Such a @code{set} may -look like a no-op if the same register holds the argument and the return -value. - -@findex code_label -@findex CODE_LABEL_NUMBER -@item code_label -A @code{code_label} insn represents a label that a jump insn can jump -to. It contains two special fields of data in addition to the three -standard ones. @code{CODE_LABEL_NUMBER} is used to hold the @dfn{label -number}, a number that identifies this label uniquely among all the -labels in the compilation (not just in the current function). -Ultimately, the label is represented in the assembler output as an -assembler label, usually of the form @samp{L@var{n}} where @var{n} is -the label number. - -When a @code{code_label} appears in an RTL expression, it normally -appears within a @code{label_ref} which represents the address of -the label, as a number. - -Besides as a @code{code_label}, a label can also be represented as a -@code{note} of type @code{NOTE_INSN_DELETED_LABEL}. - -@findex LABEL_NUSES -The field @code{LABEL_NUSES} is only defined once the jump optimization -phase is completed. It contains the number of times this label is -referenced in the current function. - -@findex LABEL_KIND -@findex SET_LABEL_KIND -@findex LABEL_ALT_ENTRY_P -@cindex alternate entry points -The field @code{LABEL_KIND} differentiates four different types of -labels: @code{LABEL_NORMAL}, @code{LABEL_STATIC_ENTRY}, -@code{LABEL_GLOBAL_ENTRY}, and @code{LABEL_WEAK_ENTRY}. The only labels -that do not have type @code{LABEL_NORMAL} are @dfn{alternate entry -points} to the current function. These may be static (visible only in -the containing translation unit), global (exposed to all translation -units), or weak (global, but can be overridden by another symbol with the -same name). - -Much of the compiler treats all four kinds of label identically. Some -of it needs to know whether or not a label is an alternate entry point; -for this purpose, the macro @code{LABEL_ALT_ENTRY_P} is provided. It is -equivalent to testing whether @samp{LABEL_KIND (label) == LABEL_NORMAL}. -The only place that cares about the distinction between static, global, -and weak alternate entry points, besides the front-end code that creates -them, is the function @code{output_alternate_entry_point}, in -@file{final.c}. - -To set the kind of a label, use the @code{SET_LABEL_KIND} macro. - -@findex jump_table_data -@item jump_table_data -A @code{jump_table_data} insn is a placeholder for the jump-table data -of a @code{casesi} or @code{tablejump} insn. They are placed after -a @code{tablejump_p} insn. A @code{jump_table_data} insn is not part o -a basic blockm but it is associated with the basic block that ends with -the @code{tablejump_p} insn. The @code{PATTERN} of a @code{jump_table_data} -is always either an @code{addr_vec} or an @code{addr_diff_vec}, and a -@code{jump_table_data} insn is always preceded by a @code{code_label}. -The @code{tablejump_p} insn refers to that @code{code_label} via its -@code{JUMP_LABEL}. - -@findex barrier -@item barrier -Barriers are placed in the instruction stream when control cannot flow -past them. They are placed after unconditional jump instructions to -indicate that the jumps are unconditional and after calls to -@code{volatile} functions, which do not return (e.g., @code{exit}). -They contain no information beyond the three standard fields. - -@findex note -@findex NOTE_LINE_NUMBER -@findex NOTE_SOURCE_FILE -@item note -@code{note} insns are used to represent additional debugging and -declarative information. They contain two nonstandard fields, an -integer which is accessed with the macro @code{NOTE_LINE_NUMBER} and a -string accessed with @code{NOTE_SOURCE_FILE}. - -If @code{NOTE_LINE_NUMBER} is positive, the note represents the -position of a source line and @code{NOTE_SOURCE_FILE} is the source file name -that the line came from. These notes control generation of line -number data in the assembler output. - -Otherwise, @code{NOTE_LINE_NUMBER} is not really a line number but a -code with one of the following values (and @code{NOTE_SOURCE_FILE} -must contain a null pointer): - -@table @code -@findex NOTE_INSN_DELETED -@item NOTE_INSN_DELETED -Such a note is completely ignorable. Some passes of the compiler -delete insns by altering them into notes of this kind. - -@findex NOTE_INSN_DELETED_LABEL -@item NOTE_INSN_DELETED_LABEL -This marks what used to be a @code{code_label}, but was not used for other -purposes than taking its address and was transformed to mark that no -code jumps to it. - -@findex NOTE_INSN_BLOCK_BEG -@findex NOTE_INSN_BLOCK_END -@item NOTE_INSN_BLOCK_BEG -@itemx NOTE_INSN_BLOCK_END -These types of notes indicate the position of the beginning and end -of a level of scoping of variable names. They control the output -of debugging information. - -@findex NOTE_INSN_EH_REGION_BEG -@findex NOTE_INSN_EH_REGION_END -@item NOTE_INSN_EH_REGION_BEG -@itemx NOTE_INSN_EH_REGION_END -These types of notes indicate the position of the beginning and end of a -level of scoping for exception handling. @code{NOTE_EH_HANDLER} -identifies which region is associated with these notes. - -@findex NOTE_INSN_FUNCTION_BEG -@item NOTE_INSN_FUNCTION_BEG -Appears at the start of the function body, after the function -prologue. - -@findex NOTE_INSN_VAR_LOCATION -@findex NOTE_VAR_LOCATION -@item NOTE_INSN_VAR_LOCATION -This note is used to generate variable location debugging information. -It indicates that the user variable in its @code{VAR_LOCATION} operand -is at the location given in the RTL expression, or holds a value that -can be computed by evaluating the RTL expression from that static -point in the program up to the next such note for the same user -variable. - -@end table - -These codes are printed symbolically when they appear in debugging dumps. - -@findex debug_insn -@findex INSN_VAR_LOCATION -@item debug_insn -The expression code @code{debug_insn} is used for pseudo-instructions -that hold debugging information for variable tracking at assignments -(see @option{-fvar-tracking-assignments} option). They are the RTL -representation of @code{GIMPLE_DEBUG} statements -(@ref{@code{GIMPLE_DEBUG}}), with a @code{VAR_LOCATION} operand that -binds a user variable tree to an RTL representation of the -@code{value} in the corresponding statement. A @code{DEBUG_EXPR} in -it stands for the value bound to the corresponding -@code{DEBUG_EXPR_DECL}. - -Throughout optimization passes, binding information is kept in -pseudo-instruction form, so that, unlike notes, it gets the same -treatment and adjustments that regular instructions would. It is the -variable tracking pass that turns these pseudo-instructions into var -location notes, analyzing control flow, value equivalences and changes -to registers and memory referenced in value expressions, propagating -the values of debug temporaries and determining expressions that can -be used to compute the value of each user variable at as many points -(ranges, actually) in the program as possible. - -Unlike @code{NOTE_INSN_VAR_LOCATION}, the value expression in an -@code{INSN_VAR_LOCATION} denotes a value at that specific point in the -program, rather than an expression that can be evaluated at any later -point before an overriding @code{VAR_LOCATION} is encountered. E.g., -if a user variable is bound to a @code{REG} and then a subsequent insn -modifies the @code{REG}, the note location would keep mapping the user -variable to the register across the insn, whereas the insn location -would keep the variable bound to the value, so that the variable -tracking pass would emit another location note for the variable at the -point in which the register is modified. - -@end table - -@cindex @code{TImode}, in @code{insn} -@cindex @code{HImode}, in @code{insn} -@cindex @code{QImode}, in @code{insn} -The machine mode of an insn is normally @code{VOIDmode}, but some -phases use the mode for various purposes. - -The common subexpression elimination pass sets the mode of an insn to -@code{QImode} when it is the first insn in a block that has already -been processed. - -The second Haifa scheduling pass, for targets that can multiple issue, -sets the mode of an insn to @code{TImode} when it is believed that the -instruction begins an issue group. That is, when the instruction -cannot issue simultaneously with the previous. This may be relied on -by later passes, in particular machine-dependent reorg. - -Here is a table of the extra fields of @code{insn}, @code{jump_insn} -and @code{call_insn} insns: - -@table @code -@findex PATTERN -@item PATTERN (@var{i}) -An expression for the side effect performed by this insn. This must -be one of the following codes: @code{set}, @code{call}, @code{use}, -@code{clobber}, @code{return}, @code{simple_return}, @code{asm_input}, -@code{asm_output}, @code{addr_vec}, @code{addr_diff_vec}, -@code{trap_if}, @code{unspec}, @code{unspec_volatile}, -@code{parallel}, @code{cond_exec}, or @code{sequence}. If it is a -@code{parallel}, each element of the @code{parallel} must be one these -codes, except that @code{parallel} expressions cannot be nested and -@code{addr_vec} and @code{addr_diff_vec} are not permitted inside a -@code{parallel} expression. - -@findex INSN_CODE -@item INSN_CODE (@var{i}) -An integer that says which pattern in the machine description matches -this insn, or @minus{}1 if the matching has not yet been attempted. - -Such matching is never attempted and this field remains @minus{}1 on an insn -whose pattern consists of a single @code{use}, @code{clobber}, -@code{asm_input}, @code{addr_vec} or @code{addr_diff_vec} expression. - -@findex asm_noperands -Matching is also never attempted on insns that result from an @code{asm} -statement. These contain at least one @code{asm_operands} expression. -The function @code{asm_noperands} returns a non-negative value for -such insns. - -In the debugging output, this field is printed as a number followed by -a symbolic representation that locates the pattern in the @file{md} -file as some small positive or negative offset from a named pattern. - -@findex LOG_LINKS -@item LOG_LINKS (@var{i}) -A list (chain of @code{insn_list} expressions) giving information about -dependencies between instructions within a basic block. Neither a jump -nor a label may come between the related insns. These are only used by -the schedulers and by combine. This is a deprecated data structure. -Def-use and use-def chains are now preferred. - -@findex REG_NOTES -@item REG_NOTES (@var{i}) -A list (chain of @code{expr_list}, @code{insn_list} and @code{int_list} -expressions) giving miscellaneous information about the insn. It is often -information pertaining to the registers used in this insn. -@end table - -The @code{LOG_LINKS} field of an insn is a chain of @code{insn_list} -expressions. Each of these has two operands: the first is an insn, -and the second is another @code{insn_list} expression (the next one in -the chain). The last @code{insn_list} in the chain has a null pointer -as second operand. The significant thing about the chain is which -insns appear in it (as first operands of @code{insn_list} -expressions). Their order is not significant. - -This list is originally set up by the flow analysis pass; it is a null -pointer until then. Flow only adds links for those data dependencies -which can be used for instruction combination. For each insn, the flow -analysis pass adds a link to insns which store into registers values -that are used for the first time in this insn. - -The @code{REG_NOTES} field of an insn is a chain similar to the -@code{LOG_LINKS} field but it includes @code{expr_list} and @code{int_list} -expressions in addition to @code{insn_list} expressions. There are several -kinds of register notes, which are distinguished by the machine mode, which -in a register note is really understood as being an @code{enum reg_note}. -The first operand @var{op} of the note is data whose meaning depends on -the kind of note. - -@findex REG_NOTE_KIND -@findex PUT_REG_NOTE_KIND -The macro @code{REG_NOTE_KIND (@var{x})} returns the kind of -register note. Its counterpart, the macro @code{PUT_REG_NOTE_KIND -(@var{x}, @var{newkind})} sets the register note type of @var{x} to be -@var{newkind}. - -Register notes are of three classes: They may say something about an -input to an insn, they may say something about an output of an insn, or -they may create a linkage between two insns. There are also a set -of values that are only used in @code{LOG_LINKS}. - -These register notes annotate inputs to an insn: - -@table @code -@findex REG_DEAD -@item REG_DEAD -The value in @var{op} dies in this insn; that is to say, altering the -value immediately after this insn would not affect the future behavior -of the program. - -It does not follow that the register @var{op} has no useful value after -this insn since @var{op} is not necessarily modified by this insn. -Rather, no subsequent instruction uses the contents of @var{op}. - -@findex REG_UNUSED -@item REG_UNUSED -The register @var{op} being set by this insn will not be used in a -subsequent insn. This differs from a @code{REG_DEAD} note, which -indicates that the value in an input will not be used subsequently. -These two notes are independent; both may be present for the same -register. - -@findex REG_INC -@item REG_INC -The register @var{op} is incremented (or decremented; at this level -there is no distinction) by an embedded side effect inside this insn. -This means it appears in a @code{post_inc}, @code{pre_inc}, -@code{post_dec} or @code{pre_dec} expression. - -@findex REG_NONNEG -@item REG_NONNEG -The register @var{op} is known to have a nonnegative value when this -insn is reached. This is used so that decrement and branch until zero -instructions, such as the m68k dbra, can be matched. - -The @code{REG_NONNEG} note is added to insns only if the machine -description has a @samp{decrement_and_branch_until_zero} pattern. - -@findex REG_LABEL_OPERAND -@item REG_LABEL_OPERAND -This insn uses @var{op}, a @code{code_label} or a @code{note} of type -@code{NOTE_INSN_DELETED_LABEL}, but is not a @code{jump_insn}, or it -is a @code{jump_insn} that refers to the operand as an ordinary -operand. The label may still eventually be a jump target, but if so -in an indirect jump in a subsequent insn. The presence of this note -allows jump optimization to be aware that @var{op} is, in fact, being -used, and flow optimization to build an accurate flow graph. - -@findex REG_LABEL_TARGET -@item REG_LABEL_TARGET -This insn is a @code{jump_insn} but not an @code{addr_vec} or -@code{addr_diff_vec}. It uses @var{op}, a @code{code_label} as a -direct or indirect jump target. Its purpose is similar to that of -@code{REG_LABEL_OPERAND}. This note is only present if the insn has -multiple targets; the last label in the insn (in the highest numbered -insn-field) goes into the @code{JUMP_LABEL} field and does not have a -@code{REG_LABEL_TARGET} note. @xref{Insns, JUMP_LABEL}. - -@findex REG_CROSSING_JUMP -@item REG_CROSSING_JUMP -This insn is a branching instruction (either an unconditional jump or -an indirect jump) which crosses between hot and cold sections, which -could potentially be very far apart in the executable. The presence -of this note indicates to other optimizations that this branching -instruction should not be ``collapsed'' into a simpler branching -construct. It is used when the optimization to partition basic blocks -into hot and cold sections is turned on. - -@findex REG_SETJMP -@item REG_SETJMP -Appears attached to each @code{CALL_INSN} to @code{setjmp} or a -related function. -@end table - -The following notes describe attributes of outputs of an insn: - -@table @code -@findex REG_EQUIV -@findex REG_EQUAL -@item REG_EQUIV -@itemx REG_EQUAL -This note is only valid on an insn that sets only one register and -indicates that that register will be equal to @var{op} at run time; the -scope of this equivalence differs between the two types of notes. The -value which the insn explicitly copies into the register may look -different from @var{op}, but they will be equal at run time. If the -output of the single @code{set} is a @code{strict_low_part} expression, -the note refers to the register that is contained in @code{SUBREG_REG} -of the @code{subreg} expression. - -For @code{REG_EQUIV}, the register is equivalent to @var{op} throughout -the entire function, and could validly be replaced in all its -occurrences by @var{op}. (``Validly'' here refers to the data flow of -the program; simple replacement may make some insns invalid.) For -example, when a constant is loaded into a register that is never -assigned any other value, this kind of note is used. - -When a parameter is copied into a pseudo-register at entry to a function, -a note of this kind records that the register is equivalent to the stack -slot where the parameter was passed. Although in this case the register -may be set by other insns, it is still valid to replace the register -by the stack slot throughout the function. - -A @code{REG_EQUIV} note is also used on an instruction which copies a -register parameter into a pseudo-register at entry to a function, if -there is a stack slot where that parameter could be stored. Although -other insns may set the pseudo-register, it is valid for the compiler to -replace the pseudo-register by stack slot throughout the function, -provided the compiler ensures that the stack slot is properly -initialized by making the replacement in the initial copy instruction as -well. This is used on machines for which the calling convention -allocates stack space for register parameters. See -@code{REG_PARM_STACK_SPACE} in @ref{Stack Arguments}. - -In the case of @code{REG_EQUAL}, the register that is set by this insn -will be equal to @var{op} at run time at the end of this insn but not -necessarily elsewhere in the function. In this case, @var{op} -is typically an arithmetic expression. For example, when a sequence of -insns such as a library call is used to perform an arithmetic operation, -this kind of note is attached to the insn that produces or copies the -final value. - -These two notes are used in different ways by the compiler passes. -@code{REG_EQUAL} is used by passes prior to register allocation (such as -common subexpression elimination and loop optimization) to tell them how -to think of that value. @code{REG_EQUIV} notes are used by register -allocation to indicate that there is an available substitute expression -(either a constant or a @code{mem} expression for the location of a -parameter on the stack) that may be used in place of a register if -insufficient registers are available. - -Except for stack homes for parameters, which are indicated by a -@code{REG_EQUIV} note and are not useful to the early optimization -passes and pseudo registers that are equivalent to a memory location -throughout their entire life, which is not detected until later in -the compilation, all equivalences are initially indicated by an attached -@code{REG_EQUAL} note. In the early stages of register allocation, a -@code{REG_EQUAL} note is changed into a @code{REG_EQUIV} note if -@var{op} is a constant and the insn represents the only set of its -destination register. - -Thus, compiler passes prior to register allocation need only check for -@code{REG_EQUAL} notes and passes subsequent to register allocation -need only check for @code{REG_EQUIV} notes. -@end table - -These notes describe linkages between insns. They occur in pairs: one -insn has one of a pair of notes that points to a second insn, which has -the inverse note pointing back to the first insn. - -@table @code -@findex REG_CC_SETTER -@findex REG_CC_USER -@item REG_CC_SETTER -@itemx REG_CC_USER -On machines that use @code{cc0}, the insns which set and use @code{cc0} -set and use @code{cc0} are adjacent. However, when branch delay slot -filling is done, this may no longer be true. In this case a -@code{REG_CC_USER} note will be placed on the insn setting @code{cc0} to -point to the insn using @code{cc0} and a @code{REG_CC_SETTER} note will -be placed on the insn using @code{cc0} to point to the insn setting -@code{cc0}. -@end table - -These values are only used in the @code{LOG_LINKS} field, and indicate -the type of dependency that each link represents. Links which indicate -a data dependence (a read after write dependence) do not use any code, -they simply have mode @code{VOIDmode}, and are printed without any -descriptive text. - -@table @code -@findex REG_DEP_TRUE -@item REG_DEP_TRUE -This indicates a true dependence (a read after write dependence). - -@findex REG_DEP_OUTPUT -@item REG_DEP_OUTPUT -This indicates an output dependence (a write after write dependence). - -@findex REG_DEP_ANTI -@item REG_DEP_ANTI -This indicates an anti dependence (a write after read dependence). - -@end table - -These notes describe information gathered from gcov profile data. They -are stored in the @code{REG_NOTES} field of an insn. - -@table @code -@findex REG_BR_PROB -@item REG_BR_PROB -This is used to specify the ratio of branches to non-branches of a -branch insn according to the profile data. The note is represented -as an @code{int_list} expression whose integer value is between 0 and -REG_BR_PROB_BASE. Larger values indicate a higher probability that -the branch will be taken. - -@findex REG_BR_PRED -@item REG_BR_PRED -These notes are found in JUMP insns after delayed branch scheduling -has taken place. They indicate both the direction and the likelihood -of the JUMP@. The format is a bitmask of ATTR_FLAG_* values. - -@findex REG_FRAME_RELATED_EXPR -@item REG_FRAME_RELATED_EXPR -This is used on an RTX_FRAME_RELATED_P insn wherein the attached expression -is used in place of the actual insn pattern. This is done in cases where -the pattern is either complex or misleading. -@end table - -For convenience, the machine mode in an @code{insn_list} or -@code{expr_list} is printed using these symbolic codes in debugging dumps. - -@findex insn_list -@findex expr_list -The only difference between the expression codes @code{insn_list} and -@code{expr_list} is that the first operand of an @code{insn_list} is -assumed to be an insn and is printed in debugging dumps as the insn's -unique id; the first operand of an @code{expr_list} is printed in the -ordinary way as an expression. - -@node Calls -@section RTL Representation of Function-Call Insns -@cindex calling functions in RTL -@cindex RTL function-call insns -@cindex function-call insns - -Insns that call subroutines have the RTL expression code @code{call_insn}. -These insns must satisfy special rules, and their bodies must use a special -RTL expression code, @code{call}. - -@cindex @code{call} usage -A @code{call} expression has two operands, as follows: - -@smallexample -(call (mem:@var{fm} @var{addr}) @var{nbytes}) -@end smallexample - -@noindent -Here @var{nbytes} is an operand that represents the number of bytes of -argument data being passed to the subroutine, @var{fm} is a machine mode -(which must equal as the definition of the @code{FUNCTION_MODE} macro in -the machine description) and @var{addr} represents the address of the -subroutine. - -For a subroutine that returns no value, the @code{call} expression as -shown above is the entire body of the insn, except that the insn might -also contain @code{use} or @code{clobber} expressions. - -@cindex @code{BLKmode}, and function return values -For a subroutine that returns a value whose mode is not @code{BLKmode}, -the value is returned in a hard register. If this register's number is -@var{r}, then the body of the call insn looks like this: - -@smallexample -(set (reg:@var{m} @var{r}) - (call (mem:@var{fm} @var{addr}) @var{nbytes})) -@end smallexample - -@noindent -This RTL expression makes it clear (to the optimizer passes) that the -appropriate register receives a useful value in this insn. - -When a subroutine returns a @code{BLKmode} value, it is handled by -passing to the subroutine the address of a place to store the value. -So the call insn itself does not ``return'' any value, and it has the -same RTL form as a call that returns nothing. - -On some machines, the call instruction itself clobbers some register, -for example to contain the return address. @code{call_insn} insns -on these machines should have a body which is a @code{parallel} -that contains both the @code{call} expression and @code{clobber} -expressions that indicate which registers are destroyed. Similarly, -if the call instruction requires some register other than the stack -pointer that is not explicitly mentioned in its RTL, a @code{use} -subexpression should mention that register. - -Functions that are called are assumed to modify all registers listed in -the configuration macro @code{CALL_USED_REGISTERS} (@pxref{Register -Basics}) and, with the exception of @code{const} functions and library -calls, to modify all of memory. - -Insns containing just @code{use} expressions directly precede the -@code{call_insn} insn to indicate which registers contain inputs to the -function. Similarly, if registers other than those in -@code{CALL_USED_REGISTERS} are clobbered by the called function, insns -containing a single @code{clobber} follow immediately after the call to -indicate which registers. - -@node Sharing -@section Structure Sharing Assumptions -@cindex sharing of RTL components -@cindex RTL structure sharing assumptions - -The compiler assumes that certain kinds of RTL expressions are unique; -there do not exist two distinct objects representing the same value. -In other cases, it makes an opposite assumption: that no RTL expression -object of a certain kind appears in more than one place in the -containing structure. - -These assumptions refer to a single function; except for the RTL -objects that describe global variables and external functions, -and a few standard objects such as small integer constants, -no RTL objects are common to two functions. - -@itemize @bullet -@cindex @code{reg}, RTL sharing -@item -Each pseudo-register has only a single @code{reg} object to represent it, -and therefore only a single machine mode. - -@cindex symbolic label -@cindex @code{symbol_ref}, RTL sharing -@item -For any symbolic label, there is only one @code{symbol_ref} object -referring to it. - -@cindex @code{const_int}, RTL sharing -@item -All @code{const_int} expressions with equal values are shared. - -@cindex @code{pc}, RTL sharing -@item -There is only one @code{pc} expression. - -@cindex @code{cc0}, RTL sharing -@item -There is only one @code{cc0} expression. - -@cindex @code{const_double}, RTL sharing -@item -There is only one @code{const_double} expression with value 0 for -each floating point mode. Likewise for values 1 and 2. - -@cindex @code{const_vector}, RTL sharing -@item -There is only one @code{const_vector} expression with value 0 for -each vector mode, be it an integer or a double constant vector. - -@cindex @code{label_ref}, RTL sharing -@cindex @code{scratch}, RTL sharing -@item -No @code{label_ref} or @code{scratch} appears in more than one place in -the RTL structure; in other words, it is safe to do a tree-walk of all -the insns in the function and assume that each time a @code{label_ref} -or @code{scratch} is seen it is distinct from all others that are seen. - -@cindex @code{mem}, RTL sharing -@item -Only one @code{mem} object is normally created for each static -variable or stack slot, so these objects are frequently shared in all -the places they appear. However, separate but equal objects for these -variables are occasionally made. - -@cindex @code{asm_operands}, RTL sharing -@item -When a single @code{asm} statement has multiple output operands, a -distinct @code{asm_operands} expression is made for each output operand. -However, these all share the vector which contains the sequence of input -operands. This sharing is used later on to test whether two -@code{asm_operands} expressions come from the same statement, so all -optimizations must carefully preserve the sharing if they copy the -vector at all. - -@item -No RTL object appears in more than one place in the RTL structure -except as described above. Many passes of the compiler rely on this -by assuming that they can modify RTL objects in place without unwanted -side-effects on other insns. - -@findex unshare_all_rtl -@item -During initial RTL generation, shared structure is freely introduced. -After all the RTL for a function has been generated, all shared -structure is copied by @code{unshare_all_rtl} in @file{emit-rtl.c}, -after which the above rules are guaranteed to be followed. - -@findex copy_rtx_if_shared -@item -During the combiner pass, shared structure within an insn can exist -temporarily. However, the shared structure is copied before the -combiner is finished with the insn. This is done by calling -@code{copy_rtx_if_shared}, which is a subroutine of -@code{unshare_all_rtl}. -@end itemize - -@node Reading RTL -@section Reading RTL - -To read an RTL object from a file, call @code{read_rtx}. It takes one -argument, a stdio stream, and returns a single RTL object. This routine -is defined in @file{read-rtl.c}. It is not available in the compiler -itself, only the various programs that generate the compiler back end -from the machine description. - -People frequently have the idea of using RTL stored as text in a file as -an interface between a language front end and the bulk of GCC@. This -idea is not feasible. - -GCC was designed to use RTL internally only. Correct RTL for a given -program is very dependent on the particular target machine. And the RTL -does not contain all the information about the program. - -The proper way to interface GCC to a new language front end is with -the ``tree'' data structure, described in the files @file{tree.h} and -@file{tree.def}. The documentation for this structure (@pxref{GENERIC}) -is incomplete. diff --git a/contrib/gcc-5.0/gcc/doc/service.texi b/contrib/gcc-5.0/gcc/doc/service.texi deleted file mode 100644 index 592e9a9a52..0000000000 --- a/contrib/gcc-5.0/gcc/doc/service.texi +++ /dev/null @@ -1,27 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Service -@chapter How To Get Help with GCC - -If you need help installing, using or changing GCC, there are two -ways to find it: - -@itemize @bullet -@item -Send a message to a suitable network mailing list. First try -@email{gcc-help@@gcc.gnu.org} (for help installing or using GCC), and if -that brings no response, try @email{gcc@@gcc.gnu.org}. For help -changing GCC, ask @email{gcc@@gcc.gnu.org}. If you think you have found -a bug in GCC, please report it following the instructions at -@pxref{Bug Reporting}. - -@item -Look in the service directory for someone who might help you for a fee. -The service directory is found at -@uref{http://www.fsf.org/resources/service}. -@end itemize - -For further information, see -@uref{http://gcc.gnu.org/faq.html#support}. diff --git a/contrib/gcc-5.0/gcc/doc/sourcebuild.texi b/contrib/gcc-5.0/gcc/doc/sourcebuild.texi deleted file mode 100644 index c6ef40e5db..0000000000 --- a/contrib/gcc-5.0/gcc/doc/sourcebuild.texi +++ /dev/null @@ -1,2740 +0,0 @@ -@c Copyright (C) 2002-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Source Tree -@chapter Source Tree Structure and Build System - -This chapter describes the structure of the GCC source tree, and how -GCC is built. The user documentation for building and installing GCC -is in a separate manual (@uref{http://gcc.gnu.org/install/}), with -which it is presumed that you are familiar. - -@menu -* Configure Terms:: Configuration terminology and history. -* Top Level:: The top level source directory. -* gcc Directory:: The @file{gcc} subdirectory. -@end menu - -@include configterms.texi - -@node Top Level -@section Top Level Source Directory - -The top level source directory in a GCC distribution contains several -files and directories that are shared with other software -distributions such as that of GNU Binutils. It also contains several -subdirectories that contain parts of GCC and its runtime libraries: - -@table @file -@item boehm-gc -The Boehm conservative garbage collector, used as part of the Java -runtime library. - -@item config -Autoconf macros and Makefile fragments used throughout the tree. - -@item contrib -Contributed scripts that may be found useful in conjunction with GCC@. -One of these, @file{contrib/texi2pod.pl}, is used to generate man -pages from Texinfo manuals as part of the GCC build process. - -@item fixincludes -The support for fixing system headers to work with GCC@. See -@file{fixincludes/README} for more information. The headers fixed by -this mechanism are installed in @file{@var{libsubdir}/include-fixed}. -Along with those headers, @file{README-fixinc} is also installed, as -@file{@var{libsubdir}/include-fixed/README}. - -@item gcc -The main sources of GCC itself (except for runtime libraries), -including optimizers, support for different target architectures, -language front ends, and testsuites. @xref{gcc Directory, , The -@file{gcc} Subdirectory}, for details. - -@item gnattools -Support tools for GNAT. - -@item include -Headers for the @code{libiberty} library. - -@item intl -GNU @code{libintl}, from GNU @code{gettext}, for systems which do not -include it in @code{libc}. - -@item libada -The Ada runtime library. - -@item libatomic -The runtime support library for atomic operations (e.g. for @code{__sync} -and @code{__atomic}). - -@item libcpp -The C preprocessor library. - -@item libdecnumber -The Decimal Float support library. - -@item libffi -The @code{libffi} library, used as part of the Java runtime library. - -@item libgcc -The GCC runtime library. - -@item libgfortran -The Fortran runtime library. - -@item libgo -The Go runtime library. The bulk of this library is mirrored from the -@uref{http://code.google.com/@/p/@/go/, master Go repository}. - -@item libgomp -The GNU Offloading and Multi Processing Runtime Library. - -@item libiberty -The @code{libiberty} library, used for portability and for some -generally useful data structures and algorithms. @xref{Top, , -Introduction, libiberty, @sc{gnu} libiberty}, for more information -about this library. - -@item libitm -The runtime support library for transactional memory. - -@item libjava -The Java runtime library. - -@item libobjc -The Objective-C and Objective-C++ runtime library. - -@item libquadmath -The runtime support library for quad-precision math operations. - -@item libssp -The Stack protector runtime library. - -@item libstdc++-v3 -The C++ runtime library. - -@item lto-plugin -Plugin used by the linker if link-time optimizations are enabled. - -@item maintainer-scripts -Scripts used by the @code{gccadmin} account on @code{gcc.gnu.org}. - -@item zlib -The @code{zlib} compression library, used by the Java front end, as -part of the Java runtime library, and for compressing and uncompressing -GCC's intermediate language in LTO object files. -@end table - -The build system in the top level directory, including how recursion -into subdirectories works and how building runtime libraries for -multilibs is handled, is documented in a separate manual, included -with GNU Binutils. @xref{Top, , GNU configure and build system, -configure, The GNU configure and build system}, for details. - -@node gcc Directory -@section The @file{gcc} Subdirectory - -The @file{gcc} directory contains many files that are part of the C -sources of GCC, other files used as part of the configuration and -build process, and subdirectories including documentation and a -testsuite. The files that are sources of GCC are documented in a -separate chapter. @xref{Passes, , Passes and Files of the Compiler}. - -@menu -* Subdirectories:: Subdirectories of @file{gcc}. -* Configuration:: The configuration process, and the files it uses. -* Build:: The build system in the @file{gcc} directory. -* Makefile:: Targets in @file{gcc/Makefile}. -* Library Files:: Library source files and headers under @file{gcc/}. -* Headers:: Headers installed by GCC. -* Documentation:: Building documentation in GCC. -* Front End:: Anatomy of a language front end. -* Back End:: Anatomy of a target back end. -@end menu - -@node Subdirectories -@subsection Subdirectories of @file{gcc} - -The @file{gcc} directory contains the following subdirectories: - -@table @file -@item @var{language} -Subdirectories for various languages. Directories containing a file -@file{config-lang.in} are language subdirectories. The contents of -the subdirectories @file{c} (for C), @file{cp} (for C++), -@file{objc} (for Objective-C), @file{objcp} (for Objective-C++), -and @file{lto} (for LTO) are documented in this -manual (@pxref{Passes, , Passes and Files of the Compiler}); -those for other languages are not. @xref{Front End, , -Anatomy of a Language Front End}, for details of the files in these -directories. - -@item common -Source files shared between the compiler drivers (such as -@command{gcc}) and the compilers proper (such as @file{cc1}). If an -architecture defines target hooks shared between those places, it also -has a subdirectory in @file{common/config}. @xref{Target Structure}. - -@item config -Configuration files for supported architectures and operating -systems. @xref{Back End, , Anatomy of a Target Back End}, for -details of the files in this directory. - -@item doc -Texinfo documentation for GCC, together with automatically generated -man pages and support for converting the installation manual to -HTML@. @xref{Documentation}. - -@item ginclude -System headers installed by GCC, mainly those required by the C -standard of freestanding implementations. @xref{Headers, , Headers -Installed by GCC}, for details of when these and other headers are -installed. - -@item po -Message catalogs with translations of messages produced by GCC into -various languages, @file{@var{language}.po}. This directory also -contains @file{gcc.pot}, the template for these message catalogues, -@file{exgettext}, a wrapper around @command{gettext} to extract the -messages from the GCC sources and create @file{gcc.pot}, which is run -by @samp{make gcc.pot}, and @file{EXCLUDES}, a list of files from -which messages should not be extracted. - -@item testsuite -The GCC testsuites (except for those for runtime libraries). -@xref{Testsuites}. -@end table - -@node Configuration -@subsection Configuration in the @file{gcc} Directory - -The @file{gcc} directory is configured with an Autoconf-generated -script @file{configure}. The @file{configure} script is generated -from @file{configure.ac} and @file{aclocal.m4}. From the files -@file{configure.ac} and @file{acconfig.h}, Autoheader generates the -file @file{config.in}. The file @file{cstamp-h.in} is used as a -timestamp. - -@menu -* Config Fragments:: Scripts used by @file{configure}. -* System Config:: The @file{config.build}, @file{config.host}, and - @file{config.gcc} files. -* Configuration Files:: Files created by running @file{configure}. -@end menu - -@node Config Fragments -@subsubsection Scripts Used by @file{configure} - -@file{configure} uses some other scripts to help in its work: - -@itemize @bullet -@item The standard GNU @file{config.sub} and @file{config.guess} -files, kept in the top level directory, are used. - -@item The file @file{config.gcc} is used to handle configuration -specific to the particular target machine. The file -@file{config.build} is used to handle configuration specific to the -particular build machine. The file @file{config.host} is used to handle -configuration specific to the particular host machine. (In general, -these should only be used for features that cannot reasonably be tested in -Autoconf feature tests.) -@xref{System Config, , The @file{config.build}; @file{config.host}; -and @file{config.gcc} Files}, for details of the contents of these files. - -@item Each language subdirectory has a file -@file{@var{language}/config-lang.in} that is used for -front-end-specific configuration. @xref{Front End Config, , The Front -End @file{config-lang.in} File}, for details of this file. - -@item A helper script @file{configure.frag} is used as part of -creating the output of @file{configure}. -@end itemize - -@node System Config -@subsubsection The @file{config.build}; @file{config.host}; and @file{config.gcc} Files - -The @file{config.build} file contains specific rules for particular systems -which GCC is built on. This should be used as rarely as possible, as the -behavior of the build system can always be detected by autoconf. - -The @file{config.host} file contains specific rules for particular systems -which GCC will run on. This is rarely needed. - -The @file{config.gcc} file contains specific rules for particular systems -which GCC will generate code for. This is usually needed. - -Each file has a list of the shell variables it sets, with descriptions, at the -top of the file. - -FIXME: document the contents of these files, and what variables should -be set to control build, host and target configuration. - -@include configfiles.texi - -@node Build -@subsection Build System in the @file{gcc} Directory - -FIXME: describe the build system, including what is built in what -stages. Also list the various source files that are used in the build -process but aren't source files of GCC itself and so aren't documented -below (@pxref{Passes}). - -@include makefile.texi - -@node Library Files -@subsection Library Source Files and Headers under the @file{gcc} Directory - -FIXME: list here, with explanation, all the C source files and headers -under the @file{gcc} directory that aren't built into the GCC -executable but rather are part of runtime libraries and object files, -such as @file{crtstuff.c} and @file{unwind-dw2.c}. @xref{Headers, , -Headers Installed by GCC}, for more information about the -@file{ginclude} directory. - -@node Headers -@subsection Headers Installed by GCC - -In general, GCC expects the system C library to provide most of the -headers to be used with it. However, GCC will fix those headers if -necessary to make them work with GCC, and will install some headers -required of freestanding implementations. These headers are installed -in @file{@var{libsubdir}/include}. Headers for non-C runtime -libraries are also installed by GCC; these are not documented here. -(FIXME: document them somewhere.) - -Several of the headers GCC installs are in the @file{ginclude} -directory. These headers, @file{iso646.h}, -@file{stdarg.h}, @file{stdbool.h}, and @file{stddef.h}, -are installed in @file{@var{libsubdir}/include}, -unless the target Makefile fragment (@pxref{Target Fragment}) -overrides this by setting @code{USER_H}. - -In addition to these headers and those generated by fixing system -headers to work with GCC, some other headers may also be installed in -@file{@var{libsubdir}/include}. @file{config.gcc} may set -@code{extra_headers}; this specifies additional headers under -@file{config} to be installed on some systems. - -GCC installs its own version of @code{}, from @file{ginclude/float.h}. -This is done to cope with command-line options that change the -representation of floating point numbers. - -GCC also installs its own version of @code{}; this is generated -from @file{glimits.h}, together with @file{limitx.h} and -@file{limity.h} if the system also has its own version of -@code{}. (GCC provides its own header because it is -required of ISO C freestanding implementations, but needs to include -the system header from its own header as well because other standards -such as POSIX specify additional values to be defined in -@code{}.) The system's @code{} header is used via -@file{@var{libsubdir}/include/syslimits.h}, which is copied from -@file{gsyslimits.h} if it does not need fixing to work with GCC; if it -needs fixing, @file{syslimits.h} is the fixed copy. - -GCC can also install @code{}. It will do this when -@file{config.gcc} sets @code{use_gcc_tgmath} to @code{yes}. - -@node Documentation -@subsection Building Documentation - -The main GCC documentation is in the form of manuals in Texinfo -format. These are installed in Info format; DVI versions may be -generated by @samp{make dvi}, PDF versions by @samp{make pdf}, and -HTML versions by @samp{make html}. In addition, some man pages are -generated from the Texinfo manuals, there are some other text files -with miscellaneous documentation, and runtime libraries have their own -documentation outside the @file{gcc} directory. FIXME: document the -documentation for runtime libraries somewhere. - -@menu -* Texinfo Manuals:: GCC manuals in Texinfo format. -* Man Page Generation:: Generating man pages from Texinfo manuals. -* Miscellaneous Docs:: Miscellaneous text files with documentation. -@end menu - -@node Texinfo Manuals -@subsubsection Texinfo Manuals - -The manuals for GCC as a whole, and the C and C++ front ends, are in -files @file{doc/*.texi}. Other front ends have their own manuals in -files @file{@var{language}/*.texi}. Common files -@file{doc/include/*.texi} are provided which may be included in -multiple manuals; the following files are in @file{doc/include}: - -@table @file -@item fdl.texi -The GNU Free Documentation License. -@item funding.texi -The section ``Funding Free Software''. -@item gcc-common.texi -Common definitions for manuals. -@item gpl_v3.texi -The GNU General Public License. -@item texinfo.tex -A copy of @file{texinfo.tex} known to work with the GCC manuals. -@end table - -DVI-formatted manuals are generated by @samp{make dvi}, which uses -@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}). -PDF-formatted manuals are generated by @samp{make pdf}, which uses -@command{texi2pdf} (via the Makefile macro @code{$(TEXI2PDF)}). HTML -formatted manuals are generated by @samp{make html}. Info -manuals are generated by @samp{make info} (which is run as part of -a bootstrap); this generates the manuals in the source directory, -using @command{makeinfo} via the Makefile macro @code{$(MAKEINFO)}, -and they are included in release distributions. - -Manuals are also provided on the GCC web site, in both HTML and -PostScript forms. This is done via the script -@file{maintainer-scripts/update_web_docs_svn}. Each manual to be -provided online must be listed in the definition of @code{MANUALS} in -that file; a file @file{@var{name}.texi} must only appear once in the -source tree, and the output manual must have the same name as the -source file. (However, other Texinfo files, included in manuals but -not themselves the root files of manuals, may have names that appear -more than once in the source tree.) The manual file -@file{@var{name}.texi} should only include other files in its own -directory or in @file{doc/include}. HTML manuals will be generated by -@samp{makeinfo --html}, PostScript manuals by @command{texi2dvi} -and @command{dvips}, and PDF manuals by @command{texi2pdf}. -All Texinfo files that are parts of manuals must -be version-controlled, even if they are generated files, for the -generation of online manuals to work. - -The installation manual, @file{doc/install.texi}, is also provided on -the GCC web site. The HTML version is generated by the script -@file{doc/install.texi2html}. - -@node Man Page Generation -@subsubsection Man Page Generation - -Because of user demand, in addition to full Texinfo manuals, man pages -are provided which contain extracts from those manuals. These man -pages are generated from the Texinfo manuals using -@file{contrib/texi2pod.pl} and @command{pod2man}. (The man page for -@command{g++}, @file{cp/g++.1}, just contains a @samp{.so} reference -to @file{gcc.1}, but all the other man pages are generated from -Texinfo manuals.) - -Because many systems may not have the necessary tools installed to -generate the man pages, they are only generated if the -@file{configure} script detects that recent enough tools are -installed, and the Makefiles allow generating man pages to fail -without aborting the build. Man pages are also included in release -distributions. They are generated in the source directory. - -Magic comments in Texinfo files starting @samp{@@c man} control what -parts of a Texinfo file go into a man page. Only a subset of Texinfo -is supported by @file{texi2pod.pl}, and it may be necessary to add -support for more Texinfo features to this script when generating new -man pages. To improve the man page output, some special Texinfo -macros are provided in @file{doc/include/gcc-common.texi} which -@file{texi2pod.pl} understands: - -@table @code -@item @@gcctabopt -Use in the form @samp{@@table @@gcctabopt} for tables of options, -where for printed output the effect of @samp{@@code} is better than -that of @samp{@@option} but for man page output a different effect is -wanted. -@item @@gccoptlist -Use for summary lists of options in manuals. -@item @@gol -Use at the end of each line inside @samp{@@gccoptlist}. This is -necessary to avoid problems with differences in how the -@samp{@@gccoptlist} macro is handled by different Texinfo formatters. -@end table - -FIXME: describe the @file{texi2pod.pl} input language and magic -comments in more detail. - -@node Miscellaneous Docs -@subsubsection Miscellaneous Documentation - -In addition to the formal documentation that is installed by GCC, -there are several other text files in the @file{gcc} subdirectory -with miscellaneous documentation: - -@table @file -@item ABOUT-GCC-NLS -Notes on GCC's Native Language Support. FIXME: this should be part of -this manual rather than a separate file. -@item ABOUT-NLS -Notes on the Free Translation Project. -@item COPYING -@itemx COPYING3 -The GNU General Public License, Versions 2 and 3. -@item COPYING.LIB -@itemx COPYING3.LIB -The GNU Lesser General Public License, Versions 2.1 and 3. -@item *ChangeLog* -@itemx */ChangeLog* -Change log files for various parts of GCC@. -@item LANGUAGES -Details of a few changes to the GCC front-end interface. FIXME: the -information in this file should be part of general documentation of -the front-end interface in this manual. -@item ONEWS -Information about new features in old versions of GCC@. (For recent -versions, the information is on the GCC web site.) -@item README.Portability -Information about portability issues when writing code in GCC@. FIXME: -why isn't this part of this manual or of the GCC Coding Conventions? -@end table - -FIXME: document such files in subdirectories, at least @file{config}, -@file{c}, @file{cp}, @file{objc}, @file{testsuite}. - -@node Front End -@subsection Anatomy of a Language Front End - -A front end for a language in GCC has the following parts: - -@itemize @bullet -@item -A directory @file{@var{language}} under @file{gcc} containing source -files for that front end. @xref{Front End Directory, , The Front End -@file{@var{language}} Directory}, for details. -@item -A mention of the language in the list of supported languages in -@file{gcc/doc/install.texi}. -@item -A mention of the name under which the language's runtime library is -recognized by @option{--enable-shared=@var{package}} in the -documentation of that option in @file{gcc/doc/install.texi}. -@item -A mention of any special prerequisites for building the front end in -the documentation of prerequisites in @file{gcc/doc/install.texi}. -@item -Details of contributors to that front end in -@file{gcc/doc/contrib.texi}. If the details are in that front end's -own manual then there should be a link to that manual's list in -@file{contrib.texi}. -@item -Information about support for that language in -@file{gcc/doc/frontends.texi}. -@item -Information about standards for that language, and the front end's -support for them, in @file{gcc/doc/standards.texi}. This may be a -link to such information in the front end's own manual. -@item -Details of source file suffixes for that language and @option{-x -@var{lang}} options supported, in @file{gcc/doc/invoke.texi}. -@item -Entries in @code{default_compilers} in @file{gcc.c} for source file -suffixes for that language. -@item -Preferably testsuites, which may be under @file{gcc/testsuite} or -runtime library directories. FIXME: document somewhere how to write -testsuite harnesses. -@item -Probably a runtime library for the language, outside the @file{gcc} -directory. FIXME: document this further. -@item -Details of the directories of any runtime libraries in -@file{gcc/doc/sourcebuild.texi}. -@item -Check targets in @file{Makefile.def} for the top-level @file{Makefile} -to check just the compiler or the compiler and runtime library for the -language. -@end itemize - -If the front end is added to the official GCC source repository, the -following are also necessary: - -@itemize @bullet -@item -At least one Bugzilla component for bugs in that front end and runtime -libraries. This category needs to be added to the Bugzilla database. -@item -Normally, one or more maintainers of that front end listed in -@file{MAINTAINERS}. -@item -Mentions on the GCC web site in @file{index.html} and -@file{frontends.html}, with any relevant links on -@file{readings.html}. (Front ends that are not an official part of -GCC may also be listed on @file{frontends.html}, with relevant links.) -@item -A news item on @file{index.html}, and possibly an announcement on the -@email{gcc-announce@@gcc.gnu.org} mailing list. -@item -The front end's manuals should be mentioned in -@file{maintainer-scripts/update_web_docs_svn} (@pxref{Texinfo Manuals}) -and the online manuals should be linked to from -@file{onlinedocs/index.html}. -@item -Any old releases or CVS repositories of the front end, before its -inclusion in GCC, should be made available on the GCC FTP site -@uref{ftp://gcc.gnu.org/pub/gcc/old-releases/}. -@item -The release and snapshot script @file{maintainer-scripts/gcc_release} -should be updated to generate appropriate tarballs for this front end. -@item -If this front end includes its own version files that include the -current date, @file{maintainer-scripts/update_version} should be -updated accordingly. -@end itemize - -@menu -* Front End Directory:: The front end @file{@var{language}} directory. -* Front End Config:: The front end @file{config-lang.in} file. -* Front End Makefile:: The front end @file{Make-lang.in} file. -@end menu - -@node Front End Directory -@subsubsection The Front End @file{@var{language}} Directory - -A front end @file{@var{language}} directory contains the source files -of that front end (but not of any runtime libraries, which should be -outside the @file{gcc} directory). This includes documentation, and -possibly some subsidiary programs built alongside the front end. -Certain files are special and other parts of the compiler depend on -their names: - -@table @file -@item config-lang.in -This file is required in all language subdirectories. @xref{Front End -Config, , The Front End @file{config-lang.in} File}, for details of -its contents -@item Make-lang.in -This file is required in all language subdirectories. @xref{Front End -Makefile, , The Front End @file{Make-lang.in} File}, for details of its -contents. -@item lang.opt -This file registers the set of switches that the front end accepts on -the command line, and their @option{--help} text. @xref{Options}. -@item lang-specs.h -This file provides entries for @code{default_compilers} in -@file{gcc.c} which override the default of giving an error that a -compiler for that language is not installed. -@item @var{language}-tree.def -This file, which need not exist, defines any language-specific tree -codes. -@end table - -@node Front End Config -@subsubsection The Front End @file{config-lang.in} File - -Each language subdirectory contains a @file{config-lang.in} file. -This file is a shell script that may define some variables describing -the language: - -@table @code -@item language -This definition must be present, and gives the name of the language -for some purposes such as arguments to @option{--enable-languages}. -@item lang_requires -If defined, this variable lists (space-separated) language front ends -other than C that this front end requires to be enabled (with the -names given being their @code{language} settings). For example, the -Java front end depends on the C++ front end, so sets -@samp{lang_requires=c++}. -@item subdir_requires -If defined, this variable lists (space-separated) front end directories -other than C that this front end requires to be present. For example, -the Objective-C++ front end uses source files from the C++ and -Objective-C front ends, so sets @samp{subdir_requires="cp objc"}. -@item target_libs -If defined, this variable lists (space-separated) targets in the top -level @file{Makefile} to build the runtime libraries for this -language, such as @code{target-libobjc}. -@item lang_dirs -If defined, this variable lists (space-separated) top level -directories (parallel to @file{gcc}), apart from the runtime libraries, -that should not be configured if this front end is not built. -@item build_by_default -If defined to @samp{no}, this language front end is not built unless -enabled in a @option{--enable-languages} argument. Otherwise, front -ends are built by default, subject to any special logic in -@file{configure.ac} (as is present to disable the Ada front end if the -Ada compiler is not already installed). -@item boot_language -If defined to @samp{yes}, this front end is built in stage1 of the -bootstrap. This is only relevant to front ends written in their own -languages. -@item compilers -If defined, a space-separated list of compiler executables that will -be run by the driver. The names here will each end -with @samp{\$(exeext)}. -@item outputs -If defined, a space-separated list of files that should be generated -by @file{configure} substituting values in them. This mechanism can -be used to create a file @file{@var{language}/Makefile} from -@file{@var{language}/Makefile.in}, but this is deprecated, building -everything from the single @file{gcc/Makefile} is preferred. -@item gtfiles -If defined, a space-separated list of files that should be scanned by -@file{gengtype.c} to generate the garbage collection tables and routines for -this language. This excludes the files that are common to all front -ends. @xref{Type Information}. - -@end table - -@node Front End Makefile -@subsubsection The Front End @file{Make-lang.in} File - -Each language subdirectory contains a @file{Make-lang.in} file. It contains -targets @code{@var{lang}.@var{hook}} (where @code{@var{lang}} is the -setting of @code{language} in @file{config-lang.in}) for the following -values of @code{@var{hook}}, and any other Makefile rules required to -build those targets (which may if necessary use other Makefiles -specified in @code{outputs} in @file{config-lang.in}, although this is -deprecated). It also adds any testsuite targets that can use the -standard rule in @file{gcc/Makefile.in} to the variable -@code{lang_checks}. - -@table @code -@item all.cross -@itemx start.encap -@itemx rest.encap -FIXME: exactly what goes in each of these targets? -@item tags -Build an @command{etags} @file{TAGS} file in the language subdirectory -in the source tree. -@item info -Build info documentation for the front end, in the build directory. -This target is only called by @samp{make bootstrap} if a suitable -version of @command{makeinfo} is available, so does not need to check -for this, and should fail if an error occurs. -@item dvi -Build DVI documentation for the front end, in the build directory. -This should be done using @code{$(TEXI2DVI)}, with appropriate -@option{-I} arguments pointing to directories of included files. -@item pdf -Build PDF documentation for the front end, in the build directory. -This should be done using @code{$(TEXI2PDF)}, with appropriate -@option{-I} arguments pointing to directories of included files. -@item html -Build HTML documentation for the front end, in the build directory. -@item man -Build generated man pages for the front end from Texinfo manuals -(@pxref{Man Page Generation}), in the build directory. This target -is only called if the necessary tools are available, but should ignore -errors so as not to stop the build if errors occur; man pages are -optional and the tools involved may be installed in a broken way. -@item install-common -Install everything that is part of the front end, apart from the -compiler executables listed in @code{compilers} in -@file{config-lang.in}. -@item install-info -Install info documentation for the front end, if it is present in the -source directory. This target should have dependencies on info files -that should be installed. -@item install-man -Install man pages for the front end. This target should ignore -errors. -@item install-plugin -Install headers needed for plugins. -@item srcextra -Copies its dependencies into the source directory. This generally should -be used for generated files such as Bison output files which are not -version-controlled, but should be included in any release tarballs. This -target will be executed during a bootstrap if -@samp{--enable-generated-files-in-srcdir} was specified as a -@file{configure} option. -@item srcinfo -@itemx srcman -Copies its dependencies into the source directory. These targets will be -executed during a bootstrap if @samp{--enable-generated-files-in-srcdir} -was specified as a @file{configure} option. -@item uninstall -Uninstall files installed by installing the compiler. This is -currently documented not to be supported, so the hook need not do -anything. -@item mostlyclean -@itemx clean -@itemx distclean -@itemx maintainer-clean -The language parts of the standard GNU -@samp{*clean} targets. @xref{Standard Targets, , Standard Targets for -Users, standards, GNU Coding Standards}, for details of the standard -targets. For GCC, @code{maintainer-clean} should delete -all generated files in the source directory that are not version-controlled, -but should not delete anything that is. -@end table - -@file{Make-lang.in} must also define a variable @code{@var{lang}_OBJS} -to a list of host object files that are used by that language. - -@node Back End -@subsection Anatomy of a Target Back End - -A back end for a target architecture in GCC has the following parts: - -@itemize @bullet -@item -A directory @file{@var{machine}} under @file{gcc/config}, containing a -machine description @file{@var{machine}.md} file (@pxref{Machine Desc, -, Machine Descriptions}), header files @file{@var{machine}.h} and -@file{@var{machine}-protos.h} and a source file @file{@var{machine}.c} -(@pxref{Target Macros, , Target Description Macros and Functions}), -possibly a target Makefile fragment @file{t-@var{machine}} -(@pxref{Target Fragment, , The Target Makefile Fragment}), and maybe -some other files. The names of these files may be changed from the -defaults given by explicit specifications in @file{config.gcc}. -@item -If necessary, a file @file{@var{machine}-modes.def} in the -@file{@var{machine}} directory, containing additional machine modes to -represent condition codes. @xref{Condition Code}, for further details. -@item -An optional @file{@var{machine}.opt} file in the @file{@var{machine}} -directory, containing a list of target-specific options. You can also -add other option files using the @code{extra_options} variable in -@file{config.gcc}. @xref{Options}. -@item -Entries in @file{config.gcc} (@pxref{System Config, , The -@file{config.gcc} File}) for the systems with this target -architecture. -@item -Documentation in @file{gcc/doc/invoke.texi} for any command-line -options supported by this target (@pxref{Run-time Target, , Run-time -Target Specification}). This means both entries in the summary table -of options and details of the individual options. -@item -Documentation in @file{gcc/doc/extend.texi} for any target-specific -attributes supported (@pxref{Target Attributes, , Defining -target-specific uses of @code{__attribute__}}), including where the -same attribute is already supported on some targets, which are -enumerated in the manual. -@item -Documentation in @file{gcc/doc/extend.texi} for any target-specific -pragmas supported. -@item -Documentation in @file{gcc/doc/extend.texi} of any target-specific -built-in functions supported. -@item -Documentation in @file{gcc/doc/extend.texi} of any target-specific -format checking styles supported. -@item -Documentation in @file{gcc/doc/md.texi} of any target-specific -constraint letters (@pxref{Machine Constraints, , Constraints for -Particular Machines}). -@item -A note in @file{gcc/doc/contrib.texi} under the person or people who -contributed the target support. -@item -Entries in @file{gcc/doc/install.texi} for all target triplets -supported with this target architecture, giving details of any special -notes about installation for this target, or saying that there are no -special notes if there are none. -@item -Possibly other support outside the @file{gcc} directory for runtime -libraries. FIXME: reference docs for this. The @code{libstdc++} porting -manual needs to be installed as info for this to work, or to be a -chapter of this manual. -@end itemize - -If the back end is added to the official GCC source repository, the -following are also necessary: - -@itemize @bullet -@item -An entry for the target architecture in @file{readings.html} on the -GCC web site, with any relevant links. -@item -Details of the properties of the back end and target architecture in -@file{backends.html} on the GCC web site. -@item -A news item about the contribution of support for that target -architecture, in @file{index.html} on the GCC web site. -@item -Normally, one or more maintainers of that target listed in -@file{MAINTAINERS}. Some existing architectures may be unmaintained, -but it would be unusual to add support for a target that does not have -a maintainer when support is added. -@item -Target triplets covering all @file{config.gcc} stanzas for the target, -in the list in @file{contrib/config-list.mk}. -@end itemize - -@node Testsuites -@chapter Testsuites - -GCC contains several testsuites to help maintain compiler quality. -Most of the runtime libraries and language front ends in GCC have -testsuites. Currently only the C language testsuites are documented -here; FIXME: document the others. - -@menu -* Test Idioms:: Idioms used in testsuite code. -* Test Directives:: Directives used within DejaGnu tests. -* Ada Tests:: The Ada language testsuites. -* C Tests:: The C language testsuites. -* libgcj Tests:: The Java library testsuites. -* LTO Testing:: Support for testing link-time optimizations. -* gcov Testing:: Support for testing gcov. -* profopt Testing:: Support for testing profile-directed optimizations. -* compat Testing:: Support for testing binary compatibility. -* Torture Tests:: Support for torture testing using multiple options. -@end menu - -@node Test Idioms -@section Idioms Used in Testsuite Code - -In general, C testcases have a trailing @file{-@var{n}.c}, starting -with @file{-1.c}, in case other testcases with similar names are added -later. If the test is a test of some well-defined feature, it should -have a name referring to that feature such as -@file{@var{feature}-1.c}. If it does not test a well-defined feature -but just happens to exercise a bug somewhere in the compiler, and a -bug report has been filed for this bug in the GCC bug database, -@file{pr@var{bug-number}-1.c} is the appropriate form of name. -Otherwise (for miscellaneous bugs not filed in the GCC bug database), -and previously more generally, test cases are named after the date on -which they were added. This allows people to tell at a glance whether -a test failure is because of a recently found bug that has not yet -been fixed, or whether it may be a regression, but does not give any -other information about the bug or where discussion of it may be -found. Some other language testsuites follow similar conventions. - -In the @file{gcc.dg} testsuite, it is often necessary to test that an -error is indeed a hard error and not just a warning---for example, -where it is a constraint violation in the C standard, which must -become an error with @option{-pedantic-errors}. The following idiom, -where the first line shown is line @var{line} of the file and the line -that generates the error, is used for this: - -@smallexample -/* @{ dg-bogus "warning" "warning in place of error" @} */ -/* @{ dg-error "@var{regexp}" "@var{message}" @{ target *-*-* @} @var{line} @} */ -@end smallexample - -It may be necessary to check that an expression is an integer constant -expression and has a certain value. To check that @code{@var{E}} has -value @code{@var{V}}, an idiom similar to the following is used: - -@smallexample -char x[((E) == (V) ? 1 : -1)]; -@end smallexample - -In @file{gcc.dg} tests, @code{__typeof__} is sometimes used to make -assertions about the types of expressions. See, for example, -@file{gcc.dg/c99-condexpr-1.c}. The more subtle uses depend on the -exact rules for the types of conditional expressions in the C -standard; see, for example, @file{gcc.dg/c99-intconst-1.c}. - -It is useful to be able to test that optimizations are being made -properly. This cannot be done in all cases, but it can be done where -the optimization will lead to code being optimized away (for example, -where flow analysis or alias analysis should show that certain code -cannot be called) or to functions not being called because they have -been expanded as built-in functions. Such tests go in -@file{gcc.c-torture/execute}. Where code should be optimized away, a -call to a nonexistent function such as @code{link_failure ()} may be -inserted; a definition - -@smallexample -#ifndef __OPTIMIZE__ -void -link_failure (void) -@{ - abort (); -@} -#endif -@end smallexample - -@noindent -will also be needed so that linking still succeeds when the test is -run without optimization. When all calls to a built-in function -should have been optimized and no calls to the non-built-in version of -the function should remain, that function may be defined as -@code{static} to call @code{abort ()} (although redeclaring a function -as static may not work on all targets). - -All testcases must be portable. Target-specific testcases must have -appropriate code to avoid causing failures on unsupported systems; -unfortunately, the mechanisms for this differ by directory. - -FIXME: discuss non-C testsuites here. - -@node Test Directives -@section Directives used within DejaGnu tests - -@menu -* Directives:: Syntax and descriptions of test directives. -* Selectors:: Selecting targets to which a test applies. -* Effective-Target Keywords:: Keywords describing target attributes. -* Add Options:: Features for @code{dg-add-options} -* Require Support:: Variants of @code{dg-require-@var{support}} -* Final Actions:: Commands for use in @code{dg-final} -@end menu - -@node Directives -@subsection Syntax and Descriptions of test directives - -Test directives appear within comments in a test source file and begin -with @code{dg-}. Some of these are defined within DejaGnu and others -are local to the GCC testsuite. - -The order in which test directives appear in a test can be important: -directives local to GCC sometimes override information used by the -DejaGnu directives, which know nothing about the GCC directives, so the -DejaGnu directives must precede GCC directives. - -Several test directives include selectors (@pxref{Selectors, , }) -which are usually preceded by the keyword @code{target} or @code{xfail}. - -@subsubsection Specify how to build the test - -@table @code -@item @{ dg-do @var{do-what-keyword} [@{ target/xfail @var{selector} @}] @} -@var{do-what-keyword} specifies how the test is compiled and whether -it is executed. It is one of: - -@table @code -@item preprocess -Compile with @option{-E} to run only the preprocessor. -@item compile -Compile with @option{-S} to produce an assembly code file. -@item assemble -Compile with @option{-c} to produce a relocatable object file. -@item link -Compile, assemble, and link to produce an executable file. -@item run -Produce and run an executable file, which is expected to return -an exit code of 0. -@end table - -The default is @code{compile}. That can be overridden for a set of -tests by redefining @code{dg-do-what-default} within the @code{.exp} -file for those tests. - -If the directive includes the optional @samp{@{ target @var{selector} @}} -then the test is skipped unless the target system matches the -@var{selector}. - -If @var{do-what-keyword} is @code{run} and the directive includes -the optional @samp{@{ xfail @var{selector} @}} and the selector is met -then the test is expected to fail. The @code{xfail} clause is ignored -for other values of @var{do-what-keyword}; those tests can use -directive @code{dg-xfail-if}. -@end table - -@subsubsection Specify additional compiler options - -@table @code -@item @{ dg-options @var{options} [@{ target @var{selector} @}] @} -This DejaGnu directive provides a list of compiler options, to be used -if the target system matches @var{selector}, that replace the default -options used for this set of tests. - -@item @{ dg-add-options @var{feature} @dots{} @} -Add any compiler options that are needed to access certain features. -This directive does nothing on targets that enable the features by -default, or that don't provide them at all. It must come after -all @code{dg-options} directives. -For supported values of @var{feature} see @ref{Add Options, ,}. - -@item @{ dg-additional-options @var{options} [@{ target @var{selector} @}] @} -This directive provides a list of compiler options, to be used -if the target system matches @var{selector}, that are added to the default -options used for this set of tests. -@end table - -@subsubsection Modify the test timeout value - -The normal timeout limit, in seconds, is found by searching the -following in order: - -@itemize @bullet -@item the value defined by an earlier @code{dg-timeout} directive in -the test - -@item variable @var{tool_timeout} defined by the set of tests - -@item @var{gcc},@var{timeout} set in the target board - -@item 300 -@end itemize - -@table @code -@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @} -Set the time limit for the compilation and for the execution of the test -to the specified number of seconds. - -@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @} -Multiply the normal time limit for compilation and execution of the test -by the specified floating-point factor. -@end table - -@subsubsection Skip a test for some targets - -@table @code -@item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} -Arguments @var{include-opts} and @var{exclude-opts} are lists in which -each element is a string of zero or more GCC options. -Skip the test if all of the following conditions are met: -@itemize @bullet -@item the test system is included in @var{selector} - -@item for at least one of the option strings in @var{include-opts}, -every option from that string is in the set of options with which -the test would be compiled; use @samp{"*"} for an @var{include-opts} list -that matches any options; that is the default if @var{include-opts} is -not specified - -@item for each of the option strings in @var{exclude-opts}, at least one -option from that string is not in the set of options with which the test -would be compiled; use @samp{""} for an empty @var{exclude-opts} list; -that is the default if @var{exclude-opts} is not specified -@end itemize - -For example, to skip a test if option @code{-Os} is present: - -@smallexample -/* @{ dg-skip-if "" @{ *-*-* @} @{ "-Os" @} @{ "" @} @} */ -@end smallexample - -To skip a test if both options @code{-O2} and @code{-g} are present: - -@smallexample -/* @{ dg-skip-if "" @{ *-*-* @} @{ "-O2 -g" @} @{ "" @} @} */ -@end smallexample - -To skip a test if either @code{-O2} or @code{-O3} is present: - -@smallexample -/* @{ dg-skip-if "" @{ *-*-* @} @{ "-O2" "-O3" @} @{ "" @} @} */ -@end smallexample - -To skip a test unless option @code{-Os} is present: - -@smallexample -/* @{ dg-skip-if "" @{ *-*-* @} @{ "*" @} @{ "-Os" @} @} */ -@end smallexample - -To skip a test if either @code{-O2} or @code{-O3} is used with @code{-g} -but not if @code{-fpic} is also present: - -@smallexample -/* @{ dg-skip-if "" @{ *-*-* @} @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */ -@end smallexample - -@item @{ dg-require-effective-target @var{keyword} [@{ @var{selector} @}] @} -Skip the test if the test target, including current multilib flags, -is not covered by the effective-target keyword. -If the directive includes the optional @samp{@{ @var{selector} @}} -then the effective-target test is only performed if the target system -matches the @var{selector}. -This directive must appear after any @code{dg-do} directive in the test -and before any @code{dg-additional-sources} directive. -@xref{Effective-Target Keywords, , }. - -@item @{ dg-require-@var{support} args @} -Skip the test if the target does not provide the required support. -These directives must appear after any @code{dg-do} directive in the test -and before any @code{dg-additional-sources} directive. -They require at least one argument, which can be an empty string if the -specific procedure does not examine the argument. -@xref{Require Support, , }, for a complete list of these directives. -@end table - -@subsubsection Expect a test to fail for some targets - -@table @code -@item @{ dg-xfail-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} -Expect the test to fail if the conditions (which are the same as for -@code{dg-skip-if}) are met. This does not affect the execute step. - -@item @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} -Expect the execute step of a test to fail if the conditions (which are -the same as for @code{dg-skip-if}) are met. -@end table - -@subsubsection Expect the test executable to fail - -@table @code -@item @{ dg-shouldfail @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @} -Expect the test executable to return a nonzero exit status if the -conditions (which are the same as for @code{dg-skip-if}) are met. -@end table - -@subsubsection Verify compiler messages - -@table @code -@item @{ dg-error @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @} -This DejaGnu directive appears on a source line that is expected to get -an error message, or else specifies the source line associated with the -message. If there is no message for that line or if the text of that -message is not matched by @var{regexp} then the check fails and -@var{comment} is included in the @code{FAIL} message. The check does -not look for the string @samp{error} unless it is part of @var{regexp}. - -@item @{ dg-warning @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @} -This DejaGnu directive appears on a source line that is expected to get -a warning message, or else specifies the source line associated with the -message. If there is no message for that line or if the text of that -message is not matched by @var{regexp} then the check fails and -@var{comment} is included in the @code{FAIL} message. The check does -not look for the string @samp{warning} unless it is part of @var{regexp}. - -@item @{ dg-message @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @} -The line is expected to get a message other than an error or warning. -If there is no message for that line or if the text of that message is -not matched by @var{regexp} then the check fails and @var{comment} is -included in the @code{FAIL} message. - -@item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @} -This DejaGnu directive appears on a source line that should not get a -message matching @var{regexp}, or else specifies the source line -associated with the bogus message. It is usually used with @samp{xfail} -to indicate that the message is a known problem for a particular set of -targets. - -@item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @} -This DejaGnu directive indicates that the test is expected to fail due -to compiler messages that are not handled by @samp{dg-error}, -@samp{dg-warning} or @samp{dg-bogus}. For this directive @samp{xfail} -has the same effect as @samp{target}. - -@item @{ dg-prune-output @var{regexp} @} -Prune messages matching @var{regexp} from the test output. -@end table - -@subsubsection Verify output of the test executable - -@table @code -@item @{ dg-output @var{regexp} [@{ target/xfail @var{selector} @}] @} -This DejaGnu directive compares @var{regexp} to the combined output -that the test executable writes to @file{stdout} and @file{stderr}. -@end table - -@subsubsection Specify additional files for a test - -@table @code -@item @{ dg-additional-files "@var{filelist}" @} -Specify additional files, other than source files, that must be copied -to the system where the compiler runs. - -@item @{ dg-additional-sources "@var{filelist}" @} -Specify additional source files to appear in the compile line -following the main test file. -@end table - -@subsubsection Add checks at the end of a test - -@table @code -@item @{ dg-final @{ @var{local-directive} @} @} -This DejaGnu directive is placed within a comment anywhere in the -source file and is processed after the test has been compiled and run. -Multiple @samp{dg-final} commands are processed in the order in which -they appear in the source file. @xref{Final Actions, , }, for a list -of directives that can be used within @code{dg-final}. -@end table - -@node Selectors -@subsection Selecting targets to which a test applies - -Several test directives include @var{selector}s to limit the targets -for which a test is run or to declare that a test is expected to fail -on particular targets. - -A selector is: -@itemize @bullet -@item one or more target triplets, possibly including wildcard characters; -use @samp{*-*-*} to match any target -@item a single effective-target keyword (@pxref{Effective-Target Keywords}) -@item a logical expression -@end itemize - -Depending on the context, the selector specifies whether a test is -skipped and reported as unsupported or is expected to fail. A context -that allows either @samp{target} or @samp{xfail} also allows -@samp{@{ target @var{selector1} xfail @var{selector2} @}} -to skip the test for targets that don't match @var{selector1} and the -test to fail for targets that match @var{selector2}. - -A selector expression appears within curly braces and uses a single -logical operator: one of @samp{!}, @samp{&&}, or @samp{||}. An -operand is another selector expression, an effective-target keyword, -a single target triplet, or a list of target triplets within quotes or -curly braces. For example: - -@smallexample -@{ target @{ ! "hppa*-*-* ia64*-*-*" @} @} -@{ target @{ powerpc*-*-* && lp64 @} @} -@{ xfail @{ lp64 || vect_no_align @} @} -@end smallexample - -@node Effective-Target Keywords -@subsection Keywords describing target attributes - -Effective-target keywords identify sets of targets that support -particular functionality. They are used to limit tests to be run only -for particular targets, or to specify that particular sets of targets -are expected to fail some tests. - -Effective-target keywords are defined in @file{lib/target-supports.exp} in -the GCC testsuite, with the exception of those that are documented as -being local to a particular test directory. - -The @samp{effective target} takes into account all of the compiler options -with which the test will be compiled, including the multilib options. -By convention, keywords ending in @code{_nocache} can also include options -specified for the particular test in an earlier @code{dg-options} or -@code{dg-add-options} directive. - -@subsubsection Data type sizes - -@table @code -@item ilp32 -Target has 32-bit @code{int}, @code{long}, and pointers. - -@item lp64 -Target has 32-bit @code{int}, 64-bit @code{long} and pointers. - -@item llp64 -Target has 32-bit @code{int} and @code{long}, 64-bit @code{long long} -and pointers. - -@item double64 -Target has 64-bit @code{double}. - -@item double64plus -Target has @code{double} that is 64 bits or longer. - -@item longdouble128 -Target has 128-bit @code{long double}. - -@item int32plus -Target has @code{int} that is at 32 bits or longer. - -@item int16 -Target has @code{int} that is 16 bits or shorter. - -@item long_neq_int -Target has @code{int} and @code{long} with different sizes. - -@item large_double -Target supports @code{double} that is longer than @code{float}. - -@item large_long_double -Target supports @code{long double} that is longer than @code{double}. - -@item ptr32plus -Target has pointers that are 32 bits or longer. - -@item size32plus -Target supports array and structure sizes that are 32 bits or longer. - -@item 4byte_wchar_t -Target has @code{wchar_t} that is at least 4 bytes. -@end table - -@subsubsection Fortran-specific attributes - -@table @code -@item fortran_integer_16 -Target supports Fortran @code{integer} that is 16 bytes or longer. - -@item fortran_large_int -Target supports Fortran @code{integer} kinds larger than @code{integer(8)}. - -@item fortran_large_real -Target supports Fortran @code{real} kinds larger than @code{real(8)}. -@end table - -@subsubsection Vector-specific attributes - -@table @code -@item vect_condition -Target supports vector conditional operations. - -@item vect_double -Target supports hardware vectors of @code{double}. - -@item vect_float -Target supports hardware vectors of @code{float}. - -@item vect_int -Target supports hardware vectors of @code{int}. - -@item vect_long -Target supports hardware vectors of @code{long}. - -@item vect_long_long -Target supports hardware vectors of @code{long long}. - -@item vect_aligned_arrays -Target aligns arrays to vector alignment boundary. - -@item vect_hw_misalign -Target supports a vector misalign access. - -@item vect_no_align -Target does not support a vector alignment mechanism. - -@item vect_no_int_max -Target does not support a vector max instruction on @code{int}. - -@item vect_no_int_add -Target does not support a vector add instruction on @code{int}. - -@item vect_no_bitwise -Target does not support vector bitwise instructions. - -@item vect_char_mult -Target supports @code{vector char} multiplication. - -@item vect_short_mult -Target supports @code{vector short} multiplication. - -@item vect_int_mult -Target supports @code{vector int} multiplication. - -@item vect_extract_even_odd -Target supports vector even/odd element extraction. - -@item vect_extract_even_odd_wide -Target supports vector even/odd element extraction of vectors with elements -@code{SImode} or larger. - -@item vect_interleave -Target supports vector interleaving. - -@item vect_strided -Target supports vector interleaving and extract even/odd. - -@item vect_strided_wide -Target supports vector interleaving and extract even/odd for wide -element types. - -@item vect_perm -Target supports vector permutation. - -@item vect_shift -Target supports a hardware vector shift operation. - -@item vect_widen_sum_hi_to_si -Target supports a vector widening summation of @code{short} operands -into @code{int} results, or can promote (unpack) from @code{short} -to @code{int}. - -@item vect_widen_sum_qi_to_hi -Target supports a vector widening summation of @code{char} operands -into @code{short} results, or can promote (unpack) from @code{char} -to @code{short}. - -@item vect_widen_sum_qi_to_si -Target supports a vector widening summation of @code{char} operands -into @code{int} results. - -@item vect_widen_mult_qi_to_hi -Target supports a vector widening multiplication of @code{char} operands -into @code{short} results, or can promote (unpack) from @code{char} to -@code{short} and perform non-widening multiplication of @code{short}. - -@item vect_widen_mult_hi_to_si -Target supports a vector widening multiplication of @code{short} operands -into @code{int} results, or can promote (unpack) from @code{short} to -@code{int} and perform non-widening multiplication of @code{int}. - -@item vect_widen_mult_si_to_di_pattern -Target supports a vector widening multiplication of @code{int} operands -into @code{long} results. - -@item vect_sdot_qi -Target supports a vector dot-product of @code{signed char}. - -@item vect_udot_qi -Target supports a vector dot-product of @code{unsigned char}. - -@item vect_sdot_hi -Target supports a vector dot-product of @code{signed short}. - -@item vect_udot_hi -Target supports a vector dot-product of @code{unsigned short}. - -@item vect_pack_trunc -Target supports a vector demotion (packing) of @code{short} to @code{char} -and from @code{int} to @code{short} using modulo arithmetic. - -@item vect_unpack -Target supports a vector promotion (unpacking) of @code{char} to @code{short} -and from @code{char} to @code{int}. - -@item vect_intfloat_cvt -Target supports conversion from @code{signed int} to @code{float}. - -@item vect_uintfloat_cvt -Target supports conversion from @code{unsigned int} to @code{float}. - -@item vect_floatint_cvt -Target supports conversion from @code{float} to @code{signed int}. - -@item vect_floatuint_cvt -Target supports conversion from @code{float} to @code{unsigned int}. -@end table - -@subsubsection Thread Local Storage attributes - -@table @code -@item tls -Target supports thread-local storage. - -@item tls_native -Target supports native (rather than emulated) thread-local storage. - -@item tls_runtime -Test system supports executing TLS executables. -@end table - -@subsubsection Decimal floating point attributes - -@table @code -@item dfp -Targets supports compiling decimal floating point extension to C. - -@item dfp_nocache -Including the options used to compile this particular test, the -target supports compiling decimal floating point extension to C. - -@item dfprt -Test system can execute decimal floating point tests. - -@item dfprt_nocache -Including the options used to compile this particular test, the -test system can execute decimal floating point tests. - -@item hard_dfp -Target generates decimal floating point instructions with current options. -@end table - -@subsubsection ARM-specific attributes - -@table @code -@item arm32 -ARM target generates 32-bit code. - -@item arm_eabi -ARM target adheres to the ABI for the ARM Architecture. - -@item arm_hf_eabi -ARM target adheres to the VFP and Advanced SIMD Register Arguments -variant of the ABI for the ARM Architecture (as selected with -@code{-mfloat-abi=hard}). - -@item arm_hard_vfp_ok -ARM target supports @code{-mfpu=vfp -mfloat-abi=hard}. -Some multilibs may be incompatible with these options. - -@item arm_iwmmxt_ok -ARM target supports @code{-mcpu=iwmmxt}. -Some multilibs may be incompatible with this option. - -@item arm_neon -ARM target supports generating NEON instructions. - -@item arm_tune_string_ops_prefer_neon -Test CPU tune supports inlining string operations with NEON instructions. - -@item arm_neon_hw -Test system supports executing NEON instructions. - -@item arm_neonv2_hw -Test system supports executing NEON v2 instructions. - -@item arm_neon_ok -@anchor{arm_neon_ok} -ARM Target supports @code{-mfpu=neon -mfloat-abi=softfp} or compatible -options. Some multilibs may be incompatible with these options. - -@item arm_neonv2_ok -@anchor{arm_neonv2_ok} -ARM Target supports @code{-mfpu=neon-vfpv4 -mfloat-abi=softfp} or compatible -options. Some multilibs may be incompatible with these options. - -@item arm_neon_fp16_ok -@anchor{arm_neon_fp16_ok} -ARM Target supports @code{-mfpu=neon-fp16 -mfloat-abi=softfp} or compatible -options. Some multilibs may be incompatible with these options. - -@item arm_thumb1_ok -ARM target generates Thumb-1 code for @code{-mthumb}. - -@item arm_thumb2_ok -ARM target generates Thumb-2 code for @code{-mthumb}. - -@item arm_vfp_ok -ARM target supports @code{-mfpu=vfp -mfloat-abi=softfp}. -Some multilibs may be incompatible with these options. - -@item arm_vfp3_ok -@anchor{arm_vfp3_ok} -ARM target supports @code{-mfpu=vfp3 -mfloat-abi=softfp}. -Some multilibs may be incompatible with these options. - -@item arm_v8_vfp_ok -ARM target supports @code{-mfpu=fp-armv8 -mfloat-abi=softfp}. -Some multilibs may be incompatible with these options. - -@item arm_v8_neon_ok -ARM target supports @code{-mfpu=neon-fp-armv8 -mfloat-abi=softfp}. -Some multilibs may be incompatible with these options. - -@item arm_prefer_ldrd_strd -ARM target prefers @code{LDRD} and @code{STRD} instructions over -@code{LDM} and @code{STM} instructions. - -@end table - -@subsubsection MIPS-specific attributes - -@table @code -@item mips64 -MIPS target supports 64-bit instructions. - -@item nomips16 -MIPS target does not produce MIPS16 code. - -@item mips16_attribute -MIPS target can generate MIPS16 code. - -@item mips_loongson -MIPS target is a Loongson-2E or -2F target using an ABI that supports -the Loongson vector modes. - -@item mips_newabi_large_long_double -MIPS target supports @code{long double} larger than @code{double} -when using the new ABI. - -@item mpaired_single -MIPS target supports @code{-mpaired-single}. -@end table - -@subsubsection PowerPC-specific attributes - -@table @code - -@item dfp_hw -PowerPC target supports executing hardware DFP instructions. - -@item p8vector_hw -PowerPC target supports executing VSX instructions (ISA 2.07). - -@item powerpc64 -Test system supports executing 64-bit instructions. - -@item powerpc_altivec -PowerPC target supports AltiVec. - -@item powerpc_altivec_ok -PowerPC target supports @code{-maltivec}. - -@item powerpc_eabi_ok -PowerPC target supports @code{-meabi}. - -@item powerpc_elfv2 -PowerPC target supports @code{-mabi=elfv2}. - -@item powerpc_fprs -PowerPC target supports floating-point registers. - -@item powerpc_hard_double -PowerPC target supports hardware double-precision floating-point. - -@item powerpc_htm_ok -PowerPC target supports @code{-mhtm} - -@item powerpc_p8vector_ok -PowerPC target supports @code{-mpower8-vector} - -@item powerpc_ppu_ok -PowerPC target supports @code{-mcpu=cell}. - -@item powerpc_spe -PowerPC target supports PowerPC SPE. - -@item powerpc_spe_nocache -Including the options used to compile this particular test, the -PowerPC target supports PowerPC SPE. - -@item powerpc_spu -PowerPC target supports PowerPC SPU. - -@item powerpc_vsx_ok -PowerPC target supports @code{-mvsx}. - -@item powerpc_405_nocache -Including the options used to compile this particular test, the -PowerPC target supports PowerPC 405. - -@item ppc_recip_hw -PowerPC target supports executing reciprocal estimate instructions. - -@item spu_auto_overlay -SPU target has toolchain that supports automatic overlay generation. - -@item vmx_hw -PowerPC target supports executing AltiVec instructions. - -@item vsx_hw -PowerPC target supports executing VSX instructions (ISA 2.06). -@end table - -@subsubsection Other hardware attributes - -@table @code -@item avx -Target supports compiling @code{avx} instructions. - -@item avx_runtime -Target supports the execution of @code{avx} instructions. - -@item cell_hw -Test system can execute AltiVec and Cell PPU instructions. - -@item coldfire_fpu -Target uses a ColdFire FPU. - -@item hard_float -Target supports FPU instructions. - -@item non_strict_align -Target does not require strict alignment. - -@item sse -Target supports compiling @code{sse} instructions. - -@item sse_runtime -Target supports the execution of @code{sse} instructions. - -@item sse2 -Target supports compiling @code{sse2} instructions. - -@item sse2_runtime -Target supports the execution of @code{sse2} instructions. - -@item sync_char_short -Target supports atomic operations on @code{char} and @code{short}. - -@item sync_int_long -Target supports atomic operations on @code{int} and @code{long}. - -@item ultrasparc_hw -Test environment appears to run executables on a simulator that -accepts only @code{EM_SPARC} executables and chokes on @code{EM_SPARC32PLUS} -or @code{EM_SPARCV9} executables. - -@item vect_cmdline_needed -Target requires a command line argument to enable a SIMD instruction set. - -@item pie_copyreloc -The x86-64 target linker supports PIE with copy reloc. -@end table - -@subsubsection Environment attributes - -@table @code -@item c -The language for the compiler under test is C. - -@item c++ -The language for the compiler under test is C++. - -@item c99_runtime -Target provides a full C99 runtime. - -@item correct_iso_cpp_string_wchar_protos -Target @code{string.h} and @code{wchar.h} headers provide C++ required -overloads for @code{strchr} etc. functions. - -@item dummy_wcsftime -Target uses a dummy @code{wcsftime} function that always returns zero. - -@item fd_truncate -Target can truncate a file from a file descriptor, as used by -@file{libgfortran/io/unix.c:fd_truncate}; i.e. @code{ftruncate} or -@code{chsize}. - -@item freestanding -Target is @samp{freestanding} as defined in section 4 of the C99 standard. -Effectively, it is a target which supports no extra headers or libraries -other than what is considered essential. - -@item init_priority -Target supports constructors with initialization priority arguments. - -@item inttypes_types -Target has the basic signed and unsigned types in @code{inttypes.h}. -This is for tests that GCC's notions of these types agree with those -in the header, as some systems have only @code{inttypes.h}. - -@item lax_strtofp -Target might have errors of a few ULP in string to floating-point -conversion functions and overflow is not always detected correctly by -those functions. - -@item mempcpy -Target provides @code{mempcpy} function. - -@item mmap -Target supports @code{mmap}. - -@item newlib -Target supports Newlib. - -@item pow10 -Target provides @code{pow10} function. - -@item pthread -Target can compile using @code{pthread.h} with no errors or warnings. - -@item pthread_h -Target has @code{pthread.h}. - -@item run_expensive_tests -Expensive testcases (usually those that consume excessive amounts of CPU -time) should be run on this target. This can be enabled by setting the -@env{GCC_TEST_RUN_EXPENSIVE} environment variable to a non-empty string. - -@item simulator -Test system runs executables on a simulator (i.e. slowly) rather than -hardware (i.e. fast). - -@item stdint_types -Target has the basic signed and unsigned C types in @code{stdint.h}. -This will be obsolete when GCC ensures a working @code{stdint.h} for -all targets. - -@item stpcpy -Target provides @code{stpcpy} function. - -@item trampolines -Target supports trampolines. - -@item uclibc -Target supports uClibc. - -@item unwrapped -Target does not use a status wrapper. - -@item vxworks_kernel -Target is a VxWorks kernel. - -@item vxworks_rtp -Target is a VxWorks RTP. - -@item wchar -Target supports wide characters. -@end table - -@subsubsection Other attributes - -@table @code -@item automatic_stack_alignment -Target supports automatic stack alignment. - -@item cxa_atexit -Target uses @code{__cxa_atexit}. - -@item default_packed -Target has packed layout of structure members by default. - -@item fgraphite -Target supports Graphite optimizations. - -@item fixed_point -Target supports fixed-point extension to C. - -@item fopenacc -Target supports OpenACC via @option{-fopenacc}. - -@item fopenmp -Target supports OpenMP via @option{-fopenmp}. - -@item fpic -Target supports @option{-fpic} and @option{-fPIC}. - -@item freorder -Target supports @option{-freorder-blocks-and-partition}. - -@item fstack_protector -Target supports @option{-fstack-protector}. - -@item gas -Target uses GNU @command{as}. - -@item gc_sections -Target supports @option{--gc-sections}. - -@item gld -Target uses GNU @command{ld}. - -@item keeps_null_pointer_checks -Target keeps null pointer checks, either due to the use of -@option{-fno-delete-null-pointer-checks} or hardwired into the target. - -@item lto -Compiler has been configured to support link-time optimization (LTO). - -@item naked_functions -Target supports the @code{naked} function attribute. - -@item named_sections -Target supports named sections. - -@item natural_alignment_32 -Target uses natural alignment (aligned to type size) for types of -32 bits or less. - -@item target_natural_alignment_64 -Target uses natural alignment (aligned to type size) for types of -64 bits or less. - -@item nonpic -Target does not generate PIC by default. - -@item pie_enabled -Target generates PIE by default. - -@item pcc_bitfield_type_matters -Target defines @code{PCC_BITFIELD_TYPE_MATTERS}. - -@item pe_aligned_commons -Target supports @option{-mpe-aligned-commons}. - -@item pie -Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}. - -@item section_anchors -Target supports section anchors. - -@item short_enums -Target defaults to short enums. - -@item static -Target supports @option{-static}. - -@item static_libgfortran -Target supports statically linking @samp{libgfortran}. - -@item string_merging -Target supports merging string constants at link time. - -@item ucn -Target supports compiling and assembling UCN. - -@item ucn_nocache -Including the options used to compile this particular test, the -target supports compiling and assembling UCN. - -@item unaligned_stack -Target does not guarantee that its @code{STACK_BOUNDARY} is greater than -or equal to the required vector alignment. - -@item vector_alignment_reachable -Vector alignment is reachable for types of 32 bits or less. - -@item vector_alignment_reachable_for_64bit -Vector alignment is reachable for types of 64 bits or less. - -@item wchar_t_char16_t_compatible -Target supports @code{wchar_t} that is compatible with @code{char16_t}. - -@item wchar_t_char32_t_compatible -Target supports @code{wchar_t} that is compatible with @code{char32_t}. - -@item comdat_group -Target uses comdat groups. -@end table - -@subsubsection Local to tests in @code{gcc.target/i386} - -@table @code -@item 3dnow -Target supports compiling @code{3dnow} instructions. - -@item aes -Target supports compiling @code{aes} instructions. - -@item fma4 -Target supports compiling @code{fma4} instructions. - -@item ms_hook_prologue -Target supports attribute @code{ms_hook_prologue}. - -@item pclmul -Target supports compiling @code{pclmul} instructions. - -@item sse3 -Target supports compiling @code{sse3} instructions. - -@item sse4 -Target supports compiling @code{sse4} instructions. - -@item sse4a -Target supports compiling @code{sse4a} instructions. - -@item ssse3 -Target supports compiling @code{ssse3} instructions. - -@item vaes -Target supports compiling @code{vaes} instructions. - -@item vpclmul -Target supports compiling @code{vpclmul} instructions. - -@item xop -Target supports compiling @code{xop} instructions. -@end table - -@subsubsection Local to tests in @code{gcc.target/spu/ea} - -@table @code -@item ealib -Target @code{__ea} library functions are available. -@end table - -@subsubsection Local to tests in @code{gcc.test-framework} - -@table @code -@item no -Always returns 0. - -@item yes -Always returns 1. -@end table - -@node Add Options -@subsection Features for @code{dg-add-options} - -The supported values of @var{feature} for directive @code{dg-add-options} -are: - -@table @code -@item arm_neon -NEON support. Only ARM targets support this feature, and only then -in certain modes; see the @ref{arm_neon_ok,,arm_neon_ok effective target -keyword}. - -@item arm_neon_fp16 -NEON and half-precision floating point support. Only ARM targets -support this feature, and only then in certain modes; see -the @ref{arm_neon_ok,,arm_neon_fp16_ok effective target keyword}. - -@item arm_vfp3 -arm vfp3 floating point support; see -the @ref{arm_vfp3_ok,,arm_vfp3_ok effective target keyword}. - -@item bind_pic_locally -Add the target-specific flags needed to enable functions to bind -locally when using pic/PIC passes in the testsuite. - -@item c99_runtime -Add the target-specific flags needed to access the C99 runtime. - -@item ieee -Add the target-specific flags needed to enable full IEEE -compliance mode. - -@item mips16_attribute -@code{mips16} function attributes. -Only MIPS targets support this feature, and only then in certain modes. - -@item tls -Add the target-specific flags needed to use thread-local storage. -@end table - -@node Require Support -@subsection Variants of @code{dg-require-@var{support}} - -A few of the @code{dg-require} directives take arguments. - -@table @code -@item dg-require-iconv @var{codeset} -Skip the test if the target does not support iconv. @var{codeset} is -the codeset to convert to. - -@item dg-require-profiling @var{profopt} -Skip the test if the target does not support profiling with option -@var{profopt}. - -@item dg-require-visibility @var{vis} -Skip the test if the target does not support the @code{visibility} attribute. -If @var{vis} is @code{""}, support for @code{visibility("hidden")} is -checked, for @code{visibility("@var{vis}")} otherwise. -@end table - -The original @code{dg-require} directives were defined before there -was support for effective-target keywords. The directives that do not -take arguments could be replaced with effective-target keywords. - -@table @code -@item dg-require-alias "" -Skip the test if the target does not support the @samp{alias} attribute. - -@item dg-require-ascii-locale "" -Skip the test if the host does not support an ASCII locale. - -@item dg-require-compat-dfp "" -Skip this test unless both compilers in a @file{compat} testsuite -support decimal floating point. - -@item dg-require-cxa-atexit "" -Skip the test if the target does not support @code{__cxa_atexit}. -This is equivalent to @code{dg-require-effective-target cxa_atexit}. - -@item dg-require-dll "" -Skip the test if the target does not support DLL attributes. - -@item dg-require-fork "" -Skip the test if the target does not support @code{fork}. - -@item dg-require-gc-sections "" -Skip the test if the target's linker does not support the -@code{--gc-sections} flags. -This is equivalent to @code{dg-require-effective-target gc-sections}. - -@item dg-require-host-local "" -Skip the test if the host is remote, rather than the same as the build -system. Some tests are incompatible with DejaGnu's handling of remote -hosts, which involves copying the source file to the host and compiling -it with a relative path and "@code{-o a.out}". - -@item dg-require-mkfifo "" -Skip the test if the target does not support @code{mkfifo}. - -@item dg-require-named-sections "" -Skip the test is the target does not support named sections. -This is equivalent to @code{dg-require-effective-target named_sections}. - -@item dg-require-weak "" -Skip the test if the target does not support weak symbols. - -@item dg-require-weak-override "" -Skip the test if the target does not support overriding weak symbols. -@end table - -@node Final Actions -@subsection Commands for use in @code{dg-final} - -The GCC testsuite defines the following directives to be used within -@code{dg-final}. - -@subsubsection Scan a particular file - -@table @code -@item scan-file @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}] -Passes if @var{regexp} matches text in @var{filename}. -@item scan-file-not @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}] -Passes if @var{regexp} does not match text in @var{filename}. -@item scan-module @var{module} @var{regexp} [@{ target/xfail @var{selector} @}] -Passes if @var{regexp} matches in Fortran module @var{module}. -@end table - -@subsubsection Scan the assembly output - -@table @code -@item scan-assembler @var{regex} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} matches text in the test's assembler output. - -@item scan-assembler-not @var{regex} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} does not match text in the test's assembler output. - -@item scan-assembler-times @var{regex} @var{num} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} is matched exactly @var{num} times in the test's -assembler output. - -@item scan-assembler-dem @var{regex} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} matches text in the test's demangled assembler output. - -@item scan-assembler-dem-not @var{regex} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} does not match text in the test's demangled assembler -output. - -@item scan-hidden @var{symbol} [@{ target/xfail @var{selector} @}] -Passes if @var{symbol} is defined as a hidden symbol in the test's -assembly output. - -@item scan-not-hidden @var{symbol} [@{ target/xfail @var{selector} @}] -Passes if @var{symbol} is not defined as a hidden symbol in the test's -assembly output. -@end table - -@subsubsection Scan optimization dump files - -These commands are available for @var{kind} of @code{tree}, @code{rtl}, -and @code{ipa}. - -@table @code -@item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} matches text in the dump file with suffix @var{suffix}. - -@item scan-@var{kind}-dump-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} does not match text in the dump file with suffix -@var{suffix}. - -@item scan-@var{kind}-dump-times @var{regex} @var{num} @var{suffix} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} is found exactly @var{num} times in the dump file -with suffix @var{suffix}. - -@item scan-@var{kind}-dump-dem @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} matches demangled text in the dump file with -suffix @var{suffix}. - -@item scan-@var{kind}-dump-dem-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}] -Passes if @var{regex} does not match demangled text in the dump file with -suffix @var{suffix}. -@end table - -@subsubsection Verify that an output files exists or not - -@table @code -@item output-exists [@{ target/xfail @var{selector} @}] -Passes if compiler output file exists. - -@item output-exists-not [@{ target/xfail @var{selector} @}] -Passes if compiler output file does not exist. -@end table - -@subsubsection Check for LTO tests - -@table @code -@item scan-symbol @var{regexp} [@{ target/xfail @var{selector} @}] -Passes if the pattern is present in the final executable. -@end table - -@subsubsection Checks for @command{gcov} tests - -@table @code -@item run-gcov @var{sourcefile} -Check line counts in @command{gcov} tests. - -@item run-gcov [branches] [calls] @{ @var{opts} @var{sourcefile} @} -Check branch and/or call counts, in addition to line counts, in -@command{gcov} tests. -@end table - -@subsubsection Clean up generated test files - -@table @code -@item cleanup-coverage-files -Removes coverage data files generated for this test. - -@item cleanup-ipa-dump @var{suffix} -Removes IPA dump files generated for this test. - -@item cleanup-modules "@var{list-of-extra-modules}" -Removes Fortran module files generated for this test, excluding the -module names listed in keep-modules. -Cleaning up module files is usually done automatically by the testsuite -by looking at the source files and removing the modules after the test -has been executed. -@smallexample -module MoD1 -end module MoD1 -module Mod2 -end module Mod2 -module moD3 -end module moD3 -module mod4 -end module mod4 -! @{ dg-final @{ cleanup-modules "mod1 mod2" @} @} ! redundant -! @{ dg-final @{ keep-modules "mod3 mod4" @} @} -@end smallexample - -@item keep-modules "@var{list-of-modules-not-to-delete}" -Whitespace separated list of module names that should not be deleted by -cleanup-modules. -If the list of modules is empty, all modules defined in this file are kept. -@smallexample -module maybe_unneeded -end module maybe_unneeded -module keep1 -end module keep1 -module keep2 -end module keep2 -! @{ dg-final @{ keep-modules "keep1 keep2" @} @} ! just keep these two -! @{ dg-final @{ keep-modules "" @} @} ! keep all -@end smallexample - -@item cleanup-profile-file -Removes profiling files generated for this test. - -@item cleanup-repo-files -Removes files generated for this test for @option{-frepo}. - -@item cleanup-rtl-dump @var{suffix} -Removes RTL dump files generated for this test. - -@item cleanup-saved-temps -Removes files for the current test which were kept for @option{-save-temps}. - -@item cleanup-tree-dump @var{suffix} -Removes tree dump files matching @var{suffix} which were generated for -this test. -@end table - -@node Ada Tests -@section Ada Language Testsuites - -The Ada testsuite includes executable tests from the ACATS -testsuite, publicly available at -@uref{http://www.ada-auth.org/acats.html}. - -These tests are integrated in the GCC testsuite in the -@file{ada/acats} directory, and -enabled automatically when running @code{make check}, assuming -the Ada language has been enabled when configuring GCC@. - -You can also run the Ada testsuite independently, using -@code{make check-ada}, or run a subset of the tests by specifying which -chapter to run, e.g.: - -@smallexample -$ make check-ada CHAPTERS="c3 c9" -@end smallexample - -The tests are organized by directory, each directory corresponding to -a chapter of the Ada Reference Manual. So for example, @file{c9} corresponds -to chapter 9, which deals with tasking features of the language. - -There is also an extra chapter called @file{gcc} containing a template for -creating new executable tests, although this is deprecated in favor of -the @file{gnat.dg} testsuite. - -The tests are run using two @command{sh} scripts: @file{run_acats} and -@file{run_all.sh}. To run the tests using a simulator or a cross -target, see the small -customization section at the top of @file{run_all.sh}. - -These tests are run using the build tree: they can be run without doing -a @code{make install}. - -@node C Tests -@section C Language Testsuites - -GCC contains the following C language testsuites, in the -@file{gcc/testsuite} directory: - -@table @file -@item gcc.dg -This contains tests of particular features of the C compiler, using the -more modern @samp{dg} harness. Correctness tests for various compiler -features should go here if possible. - -Magic comments determine whether the file -is preprocessed, compiled, linked or run. In these tests, error and warning -message texts are compared against expected texts or regular expressions -given in comments. These tests are run with the options @samp{-ansi -pedantic} -unless other options are given in the test. Except as noted below they -are not run with multiple optimization options. -@item gcc.dg/compat -This subdirectory contains tests for binary compatibility using -@file{lib/compat.exp}, which in turn uses the language-independent support -(@pxref{compat Testing, , Support for testing binary compatibility}). -@item gcc.dg/cpp -This subdirectory contains tests of the preprocessor. -@item gcc.dg/debug -This subdirectory contains tests for debug formats. Tests in this -subdirectory are run for each debug format that the compiler supports. -@item gcc.dg/format -This subdirectory contains tests of the @option{-Wformat} format -checking. Tests in this directory are run with and without -@option{-DWIDE}. -@item gcc.dg/noncompile -This subdirectory contains tests of code that should not compile and -does not need any special compilation options. They are run with -multiple optimization options, since sometimes invalid code crashes -the compiler with optimization. -@item gcc.dg/special -FIXME: describe this. - -@item gcc.c-torture -This contains particular code fragments which have historically broken easily. -These tests are run with multiple optimization options, so tests for features -which only break at some optimization levels belong here. This also contains -tests to check that certain optimizations occur. It might be worthwhile to -separate the correctness tests cleanly from the code quality tests, but -it hasn't been done yet. - -@item gcc.c-torture/compat -FIXME: describe this. - -This directory should probably not be used for new tests. -@item gcc.c-torture/compile -This testsuite contains test cases that should compile, but do not -need to link or run. These test cases are compiled with several -different combinations of optimization options. All warnings are -disabled for these test cases, so this directory is not suitable if -you wish to test for the presence or absence of compiler warnings. -While special options can be set, and tests disabled on specific -platforms, by the use of @file{.x} files, mostly these test cases -should not contain platform dependencies. FIXME: discuss how defines -such as @code{NO_LABEL_VALUES} and @code{STACK_SIZE} are used. -@item gcc.c-torture/execute -This testsuite contains test cases that should compile, link and run; -otherwise the same comments as for @file{gcc.c-torture/compile} apply. -@item gcc.c-torture/execute/ieee -This contains tests which are specific to IEEE floating point. -@item gcc.c-torture/unsorted -FIXME: describe this. - -This directory should probably not be used for new tests. -@item gcc.misc-tests -This directory contains C tests that require special handling. Some -of these tests have individual expect files, and others share -special-purpose expect files: - -@table @file -@item @code{bprob*.c} -Test @option{-fbranch-probabilities} using -@file{gcc.misc-tests/bprob.exp}, which -in turn uses the generic, language-independent framework -(@pxref{profopt Testing, , Support for testing profile-directed -optimizations}). - -@item @code{gcov*.c} -Test @command{gcov} output using @file{gcov.exp}, which in turn uses the -language-independent support (@pxref{gcov Testing, , Support for testing gcov}). - -@item @code{i386-pf-*.c} -Test i386-specific support for data prefetch using @file{i386-prefetch.exp}. -@end table - -@item gcc.test-framework -@table @file -@item @code{dg-*.c} -Test the testsuite itself using @file{gcc.test-framework/test-framework.exp}. -@end table - -@end table - -FIXME: merge in @file{testsuite/README.gcc} and discuss the format of -test cases and magic comments more. - -@node libgcj Tests -@section The Java library testsuites. - -Runtime tests are executed via @samp{make check} in the -@file{@var{target}/libjava/testsuite} directory in the build -tree. Additional runtime tests can be checked into this testsuite. - -Regression testing of the core packages in libgcj is also covered by the -Mauve testsuite. The @uref{http://sourceware.org/mauve/,,Mauve Project} -develops tests for the Java Class Libraries. These tests are run as part -of libgcj testing by placing the Mauve tree within the libjava testsuite -sources at @file{libjava/testsuite/libjava.mauve/mauve}, or by specifying -the location of that tree when invoking @samp{make}, as in -@samp{make MAUVEDIR=~/mauve check}. - -To detect regressions, a mechanism in @file{mauve.exp} compares the -failures for a test run against the list of expected failures in -@file{libjava/testsuite/libjava.mauve/xfails} from the source hierarchy. -Update this file when adding new failing tests to Mauve, or when fixing -bugs in libgcj that had caused Mauve test failures. - -We encourage developers to contribute test cases to Mauve. - -@node LTO Testing -@section Support for testing link-time optimizations - -Tests for link-time optimizations usually require multiple source files -that are compiled separately, perhaps with different sets of options. -There are several special-purpose test directives used for these tests. - -@table @code -@item @{ dg-lto-do @var{do-what-keyword} @} -@var{do-what-keyword} specifies how the test is compiled and whether -it is executed. It is one of: - -@table @code -@item assemble -Compile with @option{-c} to produce a relocatable object file. -@item link -Compile, assemble, and link to produce an executable file. -@item run -Produce and run an executable file, which is expected to return -an exit code of 0. -@end table - -The default is @code{assemble}. That can be overridden for a set of -tests by redefining @code{dg-do-what-default} within the @code{.exp} -file for those tests. - -Unlike @code{dg-do}, @code{dg-lto-do} does not support an optional -@samp{target} or @samp{xfail} list. Use @code{dg-skip-if}, -@code{dg-xfail-if}, or @code{dg-xfail-run-if}. - -@item @{ dg-lto-options @{ @{ @var{options} @} [@{ @var{options} @}] @} [@{ target @var{selector} @}]@} -This directive provides a list of one or more sets of compiler options -to override @var{LTO_OPTIONS}. Each test will be compiled and run with -each of these sets of options. - -@item @{ dg-extra-ld-options @var{options} [@{ target @var{selector} @}]@} -This directive adds @var{options} to the linker options used. - -@item @{ dg-suppress-ld-options @var{options} [@{ target @var{selector} @}]@} -This directive removes @var{options} from the set of linker options used. -@end table - -@node gcov Testing -@section Support for testing @command{gcov} - -Language-independent support for testing @command{gcov}, and for checking -that branch profiling produces expected values, is provided by the -expect file @file{lib/gcov.exp}. @command{gcov} tests also rely on procedures -in @file{lib/gcc-dg.exp} to compile and run the test program. A typical -@command{gcov} test contains the following DejaGnu commands within comments: - -@smallexample -@{ dg-options "-fprofile-arcs -ftest-coverage" @} -@{ dg-do run @{ target native @} @} -@{ dg-final @{ run-gcov sourcefile @} @} -@end smallexample - -Checks of @command{gcov} output can include line counts, branch percentages, -and call return percentages. All of these checks are requested via -commands that appear in comments in the test's source file. -Commands to check line counts are processed by default. -Commands to check branch percentages and call return percentages are -processed if the @command{run-gcov} command has arguments @code{branches} -or @code{calls}, respectively. For example, the following specifies -checking both, as well as passing @option{-b} to @command{gcov}: - -@smallexample -@{ dg-final @{ run-gcov branches calls @{ -b sourcefile @} @} @} -@end smallexample - -A line count command appears within a comment on the source line -that is expected to get the specified count and has the form -@code{count(@var{cnt})}. A test should only check line counts for -lines that will get the same count for any architecture. - -Commands to check branch percentages (@code{branch}) and call -return percentages (@code{returns}) are very similar to each other. -A beginning command appears on or before the first of a range of -lines that will report the percentage, and the ending command -follows that range of lines. The beginning command can include a -list of percentages, all of which are expected to be found within -the range. A range is terminated by the next command of the same -kind. A command @code{branch(end)} or @code{returns(end)} marks -the end of a range without starting a new one. For example: - -@smallexample -if (i > 10 && j > i && j < 20) /* @r{branch(27 50 75)} */ - /* @r{branch(end)} */ - foo (i, j); -@end smallexample - -For a call return percentage, the value specified is the -percentage of calls reported to return. For a branch percentage, -the value is either the expected percentage or 100 minus that -value, since the direction of a branch can differ depending on the -target or the optimization level. - -Not all branches and calls need to be checked. A test should not -check for branches that might be optimized away or replaced with -predicated instructions. Don't check for calls inserted by the -compiler or ones that might be inlined or optimized away. - -A single test can check for combinations of line counts, branch -percentages, and call return percentages. The command to check a -line count must appear on the line that will report that count, but -commands to check branch percentages and call return percentages can -bracket the lines that report them. - -@node profopt Testing -@section Support for testing profile-directed optimizations - -The file @file{profopt.exp} provides language-independent support for -checking correct execution of a test built with profile-directed -optimization. This testing requires that a test program be built and -executed twice. The first time it is compiled to generate profile -data, and the second time it is compiled to use the data that was -generated during the first execution. The second execution is to -verify that the test produces the expected results. - -To check that the optimization actually generated better code, a -test can be built and run a third time with normal optimizations to -verify that the performance is better with the profile-directed -optimizations. @file{profopt.exp} has the beginnings of this kind -of support. - -@file{profopt.exp} provides generic support for profile-directed -optimizations. Each set of tests that uses it provides information -about a specific optimization: - -@table @code -@item tool -tool being tested, e.g., @command{gcc} - -@item profile_option -options used to generate profile data - -@item feedback_option -options used to optimize using that profile data - -@item prof_ext -suffix of profile data files - -@item PROFOPT_OPTIONS -list of options with which to run each test, similar to the lists for -torture tests - -@item @{ dg-final-generate @{ @var{local-directive} @} @} -This directive is similar to @code{dg-final}, but the -@var{local-directive} is run after the generation of profile data. - -@item @{ dg-final-use @{ @var{local-directive} @} @} -The @var{local-directive} is run after the profile data have been -used. -@end table - -@node compat Testing -@section Support for testing binary compatibility - -The file @file{compat.exp} provides language-independent support for -binary compatibility testing. It supports testing interoperability of -two compilers that follow the same ABI, or of multiple sets of -compiler options that should not affect binary compatibility. It is -intended to be used for testsuites that complement ABI testsuites. - -A test supported by this framework has three parts, each in a -separate source file: a main program and two pieces that interact -with each other to split up the functionality being tested. - -@table @file -@item @var{testname}_main.@var{suffix} -Contains the main program, which calls a function in file -@file{@var{testname}_x.@var{suffix}}. - -@item @var{testname}_x.@var{suffix} -Contains at least one call to a function in -@file{@var{testname}_y.@var{suffix}}. - -@item @var{testname}_y.@var{suffix} -Shares data with, or gets arguments from, -@file{@var{testname}_x.@var{suffix}}. -@end table - -Within each test, the main program and one functional piece are -compiled by the GCC under test. The other piece can be compiled by -an alternate compiler. If no alternate compiler is specified, -then all three source files are all compiled by the GCC under test. -You can specify pairs of sets of compiler options. The first element -of such a pair specifies options used with the GCC under test, and the -second element of the pair specifies options used with the alternate -compiler. Each test is compiled with each pair of options. - -@file{compat.exp} defines default pairs of compiler options. -These can be overridden by defining the environment variable -@env{COMPAT_OPTIONS} as: - -@smallexample -COMPAT_OPTIONS="[list [list @{@var{tst1}@} @{@var{alt1}@}] - @dots{}[list @{@var{tstn}@} @{@var{altn}@}]]" -@end smallexample - -where @var{tsti} and @var{alti} are lists of options, with @var{tsti} -used by the compiler under test and @var{alti} used by the alternate -compiler. For example, with -@code{[list [list @{-g -O0@} @{-O3@}] [list @{-fpic@} @{-fPIC -O2@}]]}, -the test is first built with @option{-g -O0} by the compiler under -test and with @option{-O3} by the alternate compiler. The test is -built a second time using @option{-fpic} by the compiler under test -and @option{-fPIC -O2} by the alternate compiler. - -An alternate compiler is specified by defining an environment -variable to be the full pathname of an installed compiler; for C -define @env{ALT_CC_UNDER_TEST}, and for C++ define -@env{ALT_CXX_UNDER_TEST}. These will be written to the -@file{site.exp} file used by DejaGnu. The default is to build each -test with the compiler under test using the first of each pair of -compiler options from @env{COMPAT_OPTIONS}. When -@env{ALT_CC_UNDER_TEST} or -@env{ALT_CXX_UNDER_TEST} is @code{same}, each test is built using -the compiler under test but with combinations of the options from -@env{COMPAT_OPTIONS}. - -To run only the C++ compatibility suite using the compiler under test -and another version of GCC using specific compiler options, do the -following from @file{@var{objdir}/gcc}: - -@smallexample -rm site.exp -make -k \ - ALT_CXX_UNDER_TEST=$@{alt_prefix@}/bin/g++ \ - COMPAT_OPTIONS="@var{lists as shown above}" \ - check-c++ \ - RUNTESTFLAGS="compat.exp" -@end smallexample - -A test that fails when the source files are compiled with different -compilers, but passes when the files are compiled with the same -compiler, demonstrates incompatibility of the generated code or -runtime support. A test that fails for the alternate compiler but -passes for the compiler under test probably tests for a bug that was -fixed in the compiler under test but is present in the alternate -compiler. - -The binary compatibility tests support a small number of test framework -commands that appear within comments in a test file. - -@table @code -@item dg-require-* -These commands can be used in @file{@var{testname}_main.@var{suffix}} -to skip the test if specific support is not available on the target. - -@item dg-options -The specified options are used for compiling this particular source -file, appended to the options from @env{COMPAT_OPTIONS}. When this -command appears in @file{@var{testname}_main.@var{suffix}} the options -are also used to link the test program. - -@item dg-xfail-if -This command can be used in a secondary source file to specify that -compilation is expected to fail for particular options on particular -targets. -@end table - -@node Torture Tests -@section Support for torture testing using multiple options - -Throughout the compiler testsuite there are several directories whose -tests are run multiple times, each with a different set of options. -These are known as torture tests. -@file{lib/torture-options.exp} defines procedures to -set up these lists: - -@table @code -@item torture-init -Initialize use of torture lists. -@item set-torture-options -Set lists of torture options to use for tests with and without loops. -Optionally combine a set of torture options with a set of other -options, as is done with Objective-C runtime options. -@item torture-finish -Finalize use of torture lists. -@end table - -The @file{.exp} file for a set of tests that use torture options must -include calls to these three procedures if: - -@itemize @bullet -@item It calls @code{gcc-dg-runtest} and overrides @var{DG_TORTURE_OPTIONS}. - -@item It calls @var{$@{tool@}}@code{-torture} or -@var{$@{tool@}}@code{-torture-execute}, where @var{tool} is @code{c}, -@code{fortran}, or @code{objc}. - -@item It calls @code{dg-pch}. -@end itemize - -It is not necessary for a @file{.exp} file that calls @code{gcc-dg-runtest} -to call the torture procedures if the tests should use the list in -@var{DG_TORTURE_OPTIONS} defined in @file{gcc-dg.exp}. - -Most uses of torture options can override the default lists by defining -@var{TORTURE_OPTIONS} or add to the default list by defining -@var{ADDITIONAL_TORTURE_OPTIONS}. Define these in a @file{.dejagnurc} -file or add them to the @file{site.exp} file; for example - -@smallexample -set ADDITIONAL_TORTURE_OPTIONS [list \ - @{ -O2 -ftree-loop-linear @} \ - @{ -O2 -fpeel-loops @} ] -@end smallexample diff --git a/contrib/gcc-5.0/gcc/doc/standards.texi b/contrib/gcc-5.0/gcc/doc/standards.texi deleted file mode 100644 index f55e24c335..0000000000 --- a/contrib/gcc-5.0/gcc/doc/standards.texi +++ /dev/null @@ -1,293 +0,0 @@ -@c Copyright (C) 2000-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Standards -@chapter Language Standards Supported by GCC - -For each language compiled by GCC for which there is a standard, GCC -attempts to follow one or more versions of that standard, possibly -with some exceptions, and possibly with some extensions. - -@section C Language -@cindex C standard -@cindex C standards -@cindex ANSI C standard -@cindex ANSI C -@cindex ANSI C89 -@cindex C89 -@cindex ANSI X3.159-1989 -@cindex X3.159-1989 -@cindex ISO C standard -@cindex ISO C -@cindex ISO C90 -@cindex ISO/IEC 9899 -@cindex ISO 9899 -@cindex C90 -@cindex ISO C94 -@cindex C94 -@cindex ISO C95 -@cindex C95 -@cindex ISO C99 -@cindex C99 -@cindex ISO C9X -@cindex C9X -@cindex ISO C11 -@cindex C11 -@cindex ISO C1X -@cindex C1X -@cindex Technical Corrigenda -@cindex TC1 -@cindex Technical Corrigendum 1 -@cindex TC2 -@cindex Technical Corrigendum 2 -@cindex TC3 -@cindex Technical Corrigendum 3 -@cindex AMD1 -@cindex freestanding implementation -@cindex freestanding environment -@cindex hosted implementation -@cindex hosted environment -@findex __STDC_HOSTED__ - -GCC supports three versions of the C standard, although support for -the most recent version is not yet complete. - -@opindex std -@opindex ansi -@opindex pedantic -@opindex pedantic-errors -The original ANSI C standard (X3.159-1989) was ratified in 1989 and -published in 1990. This standard was ratified as an ISO standard -(ISO/IEC 9899:1990) later in 1990. There were no technical -differences between these publications, although the sections of the -ANSI standard were renumbered and became clauses in the ISO standard. -This standard, in both its forms, is commonly known as @dfn{C89}, or -occasionally as @dfn{C90}, from the dates of ratification. The ANSI -standard, but not the ISO standard, also came with a Rationale -document. To select this standard in GCC, use one of the options -@option{-ansi}, @option{-std=c90} or @option{-std=iso9899:1990}; to obtain -all the diagnostics required by the standard, you should also specify -@option{-pedantic} (or @option{-pedantic-errors} if you want them to be -errors rather than warnings). @xref{C Dialect Options,,Options -Controlling C Dialect}. - -Errors in the 1990 ISO C standard were corrected in two Technical -Corrigenda published in 1994 and 1996. GCC does not support the -uncorrected version. - -An amendment to the 1990 standard was published in 1995. This -amendment added digraphs and @code{__STDC_VERSION__} to the language, -but otherwise concerned the library. This amendment is commonly known -as @dfn{AMD1}; the amended standard is sometimes known as @dfn{C94} or -@dfn{C95}. To select this standard in GCC, use the option -@option{-std=iso9899:199409} (with, as for other standard versions, -@option{-pedantic} to receive all required diagnostics). - -A new edition of the ISO C standard was published in 1999 as ISO/IEC -9899:1999, and is commonly known as @dfn{C99}. GCC has substantially -complete support for this standard version; see -@uref{http://gcc.gnu.org/c99status.html} for details. To select this -standard, use @option{-std=c99} or @option{-std=iso9899:1999}. (While in -development, drafts of this standard version were referred to as -@dfn{C9X}.) - -Errors in the 1999 ISO C standard were corrected in three Technical -Corrigenda published in 2001, 2004 and 2007. GCC does not support the -uncorrected version. - -A fourth version of the C standard, known as @dfn{C11}, was published -in 2011 as ISO/IEC 9899:2011. GCC has substantially complete support -for this standard, enabled with @option{-std=c11} or -@option{-std=iso9899:2011}. (While in development, drafts of this -standard version were referred to as @dfn{C1X}.) - -By default, GCC provides some extensions to the C language that on -rare occasions conflict with the C standard. @xref{C -Extensions,,Extensions to the C Language Family}. Use of the -@option{-std} options listed above will disable these extensions where -they conflict with the C standard version selected. You may also -select an extended version of the C language explicitly with -@option{-std=gnu90} (for C90 with GNU extensions), @option{-std=gnu99} -(for C99 with GNU extensions) or @option{-std=gnu11} (for C11 with GNU -extensions). The default, if no C language dialect options are given, -is @option{-std=gnu11}. Some features that are part of the C99 standard -are accepted as extensions in C90 mode, and some features that are part -of the C11 standard are accepted as extensions in C90 and C99 modes. - -The ISO C standard defines (in clause 4) two classes of conforming -implementation. A @dfn{conforming hosted implementation} supports the -whole standard including all the library facilities; a @dfn{conforming -freestanding implementation} is only required to provide certain -library facilities: those in @code{}, @code{}, -@code{}, and @code{}; since AMD1, also those in -@code{}; since C99, also those in @code{} and -@code{}; and since C11, also those in @code{} -and @code{}. In addition, complex types, added in C99, are not -required for freestanding implementations. The standard also defines -two environments for programs, a @dfn{freestanding environment}, -required of all implementations and which may not have library -facilities beyond those required of freestanding implementations, -where the handling of program startup and termination are -implementation-defined, and a @dfn{hosted environment}, which is not -required, in which all the library facilities are provided and startup -is through a function @code{int main (void)} or @code{int main (int, -char *[])}. An OS kernel would be a freestanding environment; a -program using the facilities of an operating system would normally be -in a hosted implementation. - -@opindex ffreestanding -GCC aims towards being usable as a conforming freestanding -implementation, or as the compiler for a conforming hosted -implementation. By default, it will act as the compiler for a hosted -implementation, defining @code{__STDC_HOSTED__} as @code{1} and -presuming that when the names of ISO C functions are used, they have -the semantics defined in the standard. To make it act as a conforming -freestanding implementation for a freestanding environment, use the -option @option{-ffreestanding}; it will then define -@code{__STDC_HOSTED__} to @code{0} and not make assumptions about the -meanings of function names from the standard library, with exceptions -noted below. To build an OS kernel, you may well still need to make -your own arrangements for linking and startup. -@xref{C Dialect Options,,Options Controlling C Dialect}. - -GCC does not provide the library facilities required only of hosted -implementations, nor yet all the facilities required by C99 of -freestanding implementations on all platforms; to use the facilities of a hosted -environment, you will need to find them elsewhere (for example, in the -GNU C library). @xref{Standard Libraries,,Standard Libraries}. - -Most of the compiler support routines used by GCC are present in -@file{libgcc}, but there are a few exceptions. GCC requires the -freestanding environment provide @code{memcpy}, @code{memmove}, -@code{memset} and @code{memcmp}. -Finally, if @code{__builtin_trap} is used, and the target does -not implement the @code{trap} pattern, then GCC will emit a call -to @code{abort}. - -For references to Technical Corrigenda, Rationale documents and -information concerning the history of C that is available online, see -@uref{http://gcc.gnu.org/readings.html} - -@section C++ Language - -GCC supports the original ISO C++ standard (1998) and contains -experimental support for the second ISO C++ standard (2011). - -The original ISO C++ standard was published as the ISO standard (ISO/IEC -14882:1998) and amended by a Technical Corrigenda published in 2003 -(ISO/IEC 14882:2003). These standards are referred to as C++98 and -C++03, respectively. GCC implements the majority of C++98 (@code{export} -is a notable exception) and most of the changes in C++03. To select -this standard in GCC, use one of the options @option{-ansi}, -@option{-std=c++98}, or @option{-std=c++03}; to obtain all the diagnostics -required by the standard, you should also specify @option{-pedantic} (or -@option{-pedantic-errors} if you want them to be errors rather than -warnings). - -A revised ISO C++ standard was published in 2011 as ISO/IEC -14882:2011, and is referred to as C++11; before its publication it was -commonly referred to as C++0x. C++11 contains several -changes to the C++ language, most of which have been implemented in an -experimental C++11 mode in GCC@. For information -regarding the C++11 features available in the experimental C++11 mode, -see @uref{http://gcc.gnu.org/projects/@/cxx0x.html}. To select this -standard in GCC, use the option @option{-std=c++11}; to obtain all the -diagnostics required by the standard, you should also specify -@option{-pedantic} (or @option{-pedantic-errors} if you want them to -be errors rather than warnings). - -More information about the C++ standards is available on the ISO C++ -committee's web site at @uref{http://www.open-std.org/@/jtc1/@/sc22/@/wg21/}. - -By default, GCC provides some extensions to the C++ language; @xref{C++ -Dialect Options,Options Controlling C++ Dialect}. Use of the -@option{-std} option listed above will disable these extensions. You -may also select an extended version of the C++ language explicitly with -@option{-std=gnu++98} (for C++98 with GNU extensions) or -@option{-std=gnu++11} (for C++11 with GNU extensions). The default, if -no C++ language dialect options are given, is @option{-std=gnu++98}. - -@section Objective-C and Objective-C++ Languages -@cindex Objective-C -@cindex Objective-C++ - -GCC supports ``traditional'' Objective-C (also known as ``Objective-C -1.0'') and contains support for the Objective-C exception and -synchronization syntax. It has also support for a number of -``Objective-C 2.0'' language extensions, including properties, fast -enumeration (only for Objective-C), method attributes and the -@@optional and @@required keywords in protocols. GCC supports -Objective-C++ and features available in Objective-C are also available -in Objective-C++@. - -GCC by default uses the GNU Objective-C runtime library, which is part -of GCC and is not the same as the Apple/NeXT Objective-C runtime -library used on Apple systems. There are a number of differences -documented in this manual. The options @option{-fgnu-runtime} and -@option{-fnext-runtime} allow you to switch between producing output -that works with the GNU Objective-C runtime library and output that -works with the Apple/NeXT Objective-C runtime library. - -There is no formal written standard for Objective-C or Objective-C++@. -The authoritative manual on traditional Objective-C (1.0) is -``Object-Oriented Programming and the Objective-C Language'', -available at a number of web sites: -@itemize -@item -@uref{http://www.gnustep.org/@/resources/@/documentation/@/ObjectivCBook.pdf} -is the original NeXTstep document; -@item -@uref{http://objc.toodarkpark.net} -is the same document in another format; -@item -@uref{http://developer.apple.com/@/mac/@/library/@/documentation/@/Cocoa/@/Conceptual/@/ObjectiveC/} -has an updated version but make sure you search for ``Object Oriented Programming and the Objective-C Programming Language 1.0'', -not documentation on the newer ``Objective-C 2.0'' language -@end itemize - -The Objective-C exception and synchronization syntax (that is, the -keywords @@try, @@throw, @@catch, @@finally and @@synchronized) is -supported by GCC and is enabled with the option -@option{-fobjc-exceptions}. The syntax is briefly documented in this -manual and in the Objective-C 2.0 manuals from Apple. - -The Objective-C 2.0 language extensions and features are automatically -enabled; they include properties (via the @@property, @@synthesize and -@@dynamic keywords), fast enumeration (not available in -Objective-C++), attributes for methods (such as deprecated, noreturn, -sentinel, format), the unused attribute for method arguments, the -@@package keyword for instance variables and the @@optional and -@@required keywords in protocols. You can disable all these -Objective-C 2.0 language extensions with the option -@option{-fobjc-std=objc1}, which causes the compiler to recognize the -same Objective-C language syntax recognized by GCC 4.0, and to produce -an error if one of the new features is used. - -GCC has currently no support for non-fragile instance variables. - -The authoritative manual on Objective-C 2.0 is available from Apple: -@itemize -@item -@uref{http://developer.apple.com/@/mac/@/library/@/documentation/@/Cocoa/@/Conceptual/@/ObjectiveC/} -@end itemize - -For more information concerning the history of Objective-C that is -available online, see @uref{http://gcc.gnu.org/readings.html} - -@section Go Language - -As of the GCC 4.7.1 release, GCC supports the Go 1 language standard, -described at @uref{http://golang.org/doc/go1.html}. - -@section References for Other Languages - -@xref{Top, GNAT Reference Manual, About This Guide, gnat_rm, -GNAT Reference Manual}, for information on standard -conformance and compatibility of the Ada compiler. - -@xref{Standards,,Standards, gfortran, The GNU Fortran Compiler}, for details -of standards supported by GNU Fortran. - -@xref{Compatibility,,Compatibility with the Java Platform, gcj, GNU gcj}, -for details of compatibility between @command{gcj} and the Java Platform. diff --git a/contrib/gcc-5.0/gcc/doc/tm.texi b/contrib/gcc-5.0/gcc/doc/tm.texi deleted file mode 100644 index 6c5bfabfaa..0000000000 --- a/contrib/gcc-5.0/gcc/doc/tm.texi +++ /dev/null @@ -1,11582 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Target Macros -@chapter Target Description Macros and Functions -@cindex machine description macros -@cindex target description macros -@cindex macros, target description -@cindex @file{tm.h} macros - -In addition to the file @file{@var{machine}.md}, a machine description -includes a C header file conventionally given the name -@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}. -The header file defines numerous macros that convey the information -about the target machine that does not fit into the scheme of the -@file{.md} file. The file @file{tm.h} should be a link to -@file{@var{machine}.h}. The header file @file{config.h} includes -@file{tm.h} and most compiler source files include @file{config.h}. The -source file defines a variable @code{targetm}, which is a structure -containing pointers to functions and data relating to the target -machine. @file{@var{machine}.c} should also contain their definitions, -if they are not defined elsewhere in GCC, and other functions called -through the macros defined in the @file{.h} file. - -@menu -* Target Structure:: The @code{targetm} variable. -* Driver:: Controlling how the driver runs the compilation passes. -* Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}. -* Per-Function Data:: Defining data structures for per-function information. -* Storage Layout:: Defining sizes and alignments of data. -* Type Layout:: Defining sizes and properties of basic user data types. -* Registers:: Naming and describing the hardware registers. -* Register Classes:: Defining the classes of hardware registers. -* Stack and Calling:: Defining which way the stack grows and by how much. -* Varargs:: Defining the varargs macros. -* Trampolines:: Code set up at run time to enter a nested function. -* Library Calls:: Controlling how library routines are implicitly called. -* Addressing Modes:: Defining addressing modes valid for memory operands. -* Anchored Addresses:: Defining how @option{-fsection-anchors} should work. -* Condition Code:: Defining how insns update the condition code. -* Costs:: Defining relative costs of different operations. -* Scheduling:: Adjusting the behavior of the instruction scheduler. -* Sections:: Dividing storage into text, data, and other sections. -* PIC:: Macros for position independent code. -* Assembler Format:: Defining how to write insns and pseudo-ops to output. -* Debugging Info:: Defining the format of debugging output. -* Floating Point:: Handling floating point for cross-compilers. -* Mode Switching:: Insertion of mode-switching instructions. -* Target Attributes:: Defining target-specific uses of @code{__attribute__}. -* Emulated TLS:: Emulated TLS support. -* MIPS Coprocessors:: MIPS coprocessor support and how to customize it. -* PCH Target:: Validity checking for precompiled headers. -* C++ ABI:: Controlling C++ ABI changes. -* Named Address Spaces:: Adding support for named address spaces -* Misc:: Everything else. -@end menu - -@node Target Structure -@section The Global @code{targetm} Variable -@cindex target hooks -@cindex target functions - -@deftypevar {struct gcc_target} targetm -The target @file{.c} file must define the global @code{targetm} variable -which contains pointers to functions and data relating to the target -machine. The variable is declared in @file{target.h}; -@file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is -used to initialize the variable, and macros for the default initializers -for elements of the structure. The @file{.c} file should override those -macros for which the default definition is inappropriate. For example: -@smallexample -#include "target.h" -#include "target-def.h" - -/* @r{Initialize the GCC target structure.} */ - -#undef TARGET_COMP_TYPE_ATTRIBUTES -#define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes - -struct gcc_target targetm = TARGET_INITIALIZER; -@end smallexample -@end deftypevar - -Where a macro should be defined in the @file{.c} file in this manner to -form part of the @code{targetm} structure, it is documented below as a -``Target Hook'' with a prototype. Many macros will change in future -from being defined in the @file{.h} file to being part of the -@code{targetm} structure. - -Similarly, there is a @code{targetcm} variable for hooks that are -specific to front ends for C-family languages, documented as ``C -Target Hook''. This is declared in @file{c-family/c-target.h}, the -initializer @code{TARGETCM_INITIALIZER} in -@file{c-family/c-target-def.h}. If targets initialize @code{targetcm} -themselves, they should set @code{target_has_targetcm=yes} in -@file{config.gcc}; otherwise a default definition is used. - -Similarly, there is a @code{targetm_common} variable for hooks that -are shared between the compiler driver and the compilers proper, -documented as ``Common Target Hook''. This is declared in -@file{common/common-target.h}, the initializer -@code{TARGETM_COMMON_INITIALIZER} in -@file{common/common-target-def.h}. If targets initialize -@code{targetm_common} themselves, they should set -@code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a -default definition is used. - -@node Driver -@section Controlling the Compilation Driver, @file{gcc} -@cindex driver -@cindex controlling the compilation driver - -@c prevent bad page break with this line -You can control the compilation driver. - -@defmac DRIVER_SELF_SPECS -A list of specs for the driver itself. It should be a suitable -initializer for an array of strings, with no surrounding braces. - -The driver applies these specs to its own command line between loading -default @file{specs} files (but not command-line specified ones) and -choosing the multilib directory or running any subcommands. It -applies them in the order given, so each spec can depend on the -options added by earlier ones. It is also possible to remove options -using @samp{%<@var{option}} in the usual way. - -This macro can be useful when a port has several interdependent target -options. It provides a way of standardizing the command line so -that the other specs are easier to write. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac OPTION_DEFAULT_SPECS -A list of specs used to support configure-time default options (i.e.@: -@option{--with} options) in the driver. It should be a suitable initializer -for an array of structures, each containing two strings, without the -outermost pair of surrounding braces. - -The first item in the pair is the name of the default. This must match -the code in @file{config.gcc} for the target. The second item is a spec -to apply if a default with this name was specified. The string -@samp{%(VALUE)} in the spec will be replaced by the value of the default -everywhere it occurs. - -The driver will apply these specs to its own command line between loading -default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using -the same mechanism as @code{DRIVER_SELF_SPECS}. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac CPP_SPEC -A C string constant that tells the GCC driver program options to -pass to CPP@. It can also specify how to translate options you -give to GCC into options for GCC to pass to the CPP@. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac CPLUSPLUS_CPP_SPEC -This macro is just like @code{CPP_SPEC}, but is used for C++, rather -than C@. If you do not define this macro, then the value of -@code{CPP_SPEC} (if any) will be used instead. -@end defmac - -@defmac CC1_SPEC -A C string constant that tells the GCC driver program options to -pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language -front ends. -It can also specify how to translate options you give to GCC into options -for GCC to pass to front ends. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac CC1PLUS_SPEC -A C string constant that tells the GCC driver program options to -pass to @code{cc1plus}. It can also specify how to translate options you -give to GCC into options for GCC to pass to the @code{cc1plus}. - -Do not define this macro if it does not need to do anything. -Note that everything defined in CC1_SPEC is already passed to -@code{cc1plus} so there is no need to duplicate the contents of -CC1_SPEC in CC1PLUS_SPEC@. -@end defmac - -@defmac ASM_SPEC -A C string constant that tells the GCC driver program options to -pass to the assembler. It can also specify how to translate options -you give to GCC into options for GCC to pass to the assembler. -See the file @file{sun3.h} for an example of this. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac ASM_FINAL_SPEC -A C string constant that tells the GCC driver program how to -run any programs which cleanup after the normal assembler. -Normally, this is not needed. See the file @file{mips.h} for -an example of this. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac AS_NEEDS_DASH_FOR_PIPED_INPUT -Define this macro, with no value, if the driver should give the assembler -an argument consisting of a single dash, @option{-}, to instruct it to -read from its standard input (which will be a pipe connected to the -output of the compiler proper). This argument is given after any -@option{-o} option specifying the name of the output file. - -If you do not define this macro, the assembler is assumed to read its -standard input if given no non-option arguments. If your assembler -cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct; -see @file{mips.h} for instance. -@end defmac - -@defmac LINK_SPEC -A C string constant that tells the GCC driver program options to -pass to the linker. It can also specify how to translate options you -give to GCC into options for GCC to pass to the linker. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac LIB_SPEC -Another C string constant used much like @code{LINK_SPEC}. The difference -between the two is that @code{LIB_SPEC} is used at the end of the -command given to the linker. - -If this macro is not defined, a default is provided that -loads the standard C library from the usual place. See @file{gcc.c}. -@end defmac - -@defmac LIBGCC_SPEC -Another C string constant that tells the GCC driver program -how and when to place a reference to @file{libgcc.a} into the -linker command line. This constant is placed both before and after -the value of @code{LIB_SPEC}. - -If this macro is not defined, the GCC driver provides a default that -passes the string @option{-lgcc} to the linker. -@end defmac - -@defmac REAL_LIBGCC_SPEC -By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the -@code{LIBGCC_SPEC} is not directly used by the driver program but is -instead modified to refer to different versions of @file{libgcc.a} -depending on the values of the command line flags @option{-static}, -@option{-shared}, @option{-static-libgcc}, and @option{-shared-libgcc}. On -targets where these modifications are inappropriate, define -@code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells the -driver how to place a reference to @file{libgcc} on the link command -line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified. -@end defmac - -@defmac USE_LD_AS_NEEDED -A macro that controls the modifications to @code{LIBGCC_SPEC} -mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be -generated that uses @option{--as-needed} or equivalent options and the -shared @file{libgcc} in place of the -static exception handler library, when linking without any of -@code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}. -@end defmac - -@defmac LINK_EH_SPEC -If defined, this C string constant is added to @code{LINK_SPEC}. -When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affects -the modifications to @code{LIBGCC_SPEC} mentioned in -@code{REAL_LIBGCC_SPEC}. -@end defmac - -@defmac STARTFILE_SPEC -Another C string constant used much like @code{LINK_SPEC}. The -difference between the two is that @code{STARTFILE_SPEC} is used at -the very beginning of the command given to the linker. - -If this macro is not defined, a default is provided that loads the -standard C startup file from the usual place. See @file{gcc.c}. -@end defmac - -@defmac ENDFILE_SPEC -Another C string constant used much like @code{LINK_SPEC}. The -difference between the two is that @code{ENDFILE_SPEC} is used at -the very end of the command given to the linker. - -Do not define this macro if it does not need to do anything. -@end defmac - -@defmac THREAD_MODEL_SPEC -GCC @code{-v} will print the thread model GCC was configured to use. -However, this doesn't work on platforms that are multilibbed on thread -models, such as AIX 4.3. On such platforms, define -@code{THREAD_MODEL_SPEC} such that it evaluates to a string without -blanks that names one of the recognized thread models. @code{%*}, the -default value of this macro, will expand to the value of -@code{thread_file} set in @file{config.gcc}. -@end defmac - -@defmac SYSROOT_SUFFIX_SPEC -Define this macro to add a suffix to the target sysroot when GCC is -configured with a sysroot. This will cause GCC to search for usr/lib, -et al, within sysroot+suffix. -@end defmac - -@defmac SYSROOT_HEADERS_SUFFIX_SPEC -Define this macro to add a headers_suffix to the target sysroot when -GCC is configured with a sysroot. This will cause GCC to pass the -updated sysroot+headers_suffix to CPP, causing it to search for -usr/include, et al, within sysroot+headers_suffix. -@end defmac - -@defmac EXTRA_SPECS -Define this macro to provide additional specifications to put in the -@file{specs} file that can be used in various specifications like -@code{CC1_SPEC}. - -The definition should be an initializer for an array of structures, -containing a string constant, that defines the specification name, and a -string constant that provides the specification. - -Do not define this macro if it does not need to do anything. - -@code{EXTRA_SPECS} is useful when an architecture contains several -related targets, which have various @code{@dots{}_SPECS} which are similar -to each other, and the maintainer would like one central place to keep -these definitions. - -For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to -define either @code{_CALL_SYSV} when the System V calling sequence is -used or @code{_CALL_AIX} when the older AIX-based calling sequence is -used. - -The @file{config/rs6000/rs6000.h} target file defines: - -@smallexample -#define EXTRA_SPECS \ - @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @}, - -#define CPP_SYS_DEFAULT "" -@end smallexample - -The @file{config/rs6000/sysv.h} target file defines: -@smallexample -#undef CPP_SPEC -#define CPP_SPEC \ -"%@{posix: -D_POSIX_SOURCE @} \ -%@{mcall-sysv: -D_CALL_SYSV @} \ -%@{!mcall-sysv: %(cpp_sysv_default) @} \ -%@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}" - -#undef CPP_SYSV_DEFAULT -#define CPP_SYSV_DEFAULT "-D_CALL_SYSV" -@end smallexample - -while the @file{config/rs6000/eabiaix.h} target file defines -@code{CPP_SYSV_DEFAULT} as: - -@smallexample -#undef CPP_SYSV_DEFAULT -#define CPP_SYSV_DEFAULT "-D_CALL_AIX" -@end smallexample -@end defmac - -@defmac LINK_LIBGCC_SPECIAL_1 -Define this macro if the driver program should find the library -@file{libgcc.a}. If you do not define this macro, the driver program will pass -the argument @option{-lgcc} to tell the linker to do the search. -@end defmac - -@defmac LINK_GCC_C_SEQUENCE_SPEC -The sequence in which libgcc and libc are specified to the linker. -By default this is @code{%G %L %G}. -@end defmac - -@defmac LINK_COMMAND_SPEC -A C string constant giving the complete command line need to execute the -linker. When you do this, you will need to update your port each time a -change is made to the link command line within @file{gcc.c}. Therefore, -define this macro only if you need to completely redefine the command -line for invoking the linker and there is no other way to accomplish -the effect you need. Overriding this macro may be avoidable by overriding -@code{LINK_GCC_C_SEQUENCE_SPEC} instead. -@end defmac - -@deftypevr {Common Target Hook} bool TARGET_ALWAYS_STRIP_DOTDOT -True if @file{..} components should always be removed from directory names computed relative to GCC's internal directories, false (default) if such components should be preserved and directory names containing them passed to other tools such as the linker. -@end deftypevr - -@defmac MULTILIB_DEFAULTS -Define this macro as a C expression for the initializer of an array of -string to tell the driver program which options are defaults for this -target and thus do not need to be handled specially when using -@code{MULTILIB_OPTIONS}. - -Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in -the target makefile fragment or if none of the options listed in -@code{MULTILIB_OPTIONS} are set by default. -@xref{Target Fragment}. -@end defmac - -@defmac RELATIVE_PREFIX_NOT_LINKDIR -Define this macro to tell @command{gcc} that it should only translate -a @option{-B} prefix into a @option{-L} linker option if the prefix -indicates an absolute file name. -@end defmac - -@defmac MD_EXEC_PREFIX -If defined, this macro is an additional prefix to try after -@code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched -when the compiler is built as a cross -compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it -to the list of directories used to find the assembler in @file{configure.in}. -@end defmac - -@defmac STANDARD_STARTFILE_PREFIX -Define this macro as a C string constant if you wish to override the -standard choice of @code{libdir} as the default prefix to -try when searching for startup files such as @file{crt0.o}. -@code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler -is built as a cross compiler. -@end defmac - -@defmac STANDARD_STARTFILE_PREFIX_1 -Define this macro as a C string constant if you wish to override the -standard choice of @code{/lib} as a prefix to try after the default prefix -when searching for startup files such as @file{crt0.o}. -@code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compiler -is built as a cross compiler. -@end defmac - -@defmac STANDARD_STARTFILE_PREFIX_2 -Define this macro as a C string constant if you wish to override the -standard choice of @code{/lib} as yet another prefix to try after the -default prefix when searching for startup files such as @file{crt0.o}. -@code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compiler -is built as a cross compiler. -@end defmac - -@defmac MD_STARTFILE_PREFIX -If defined, this macro supplies an additional prefix to try after the -standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the -compiler is built as a cross compiler. -@end defmac - -@defmac MD_STARTFILE_PREFIX_1 -If defined, this macro supplies yet another prefix to try after the -standard prefixes. It is not searched when the compiler is built as a -cross compiler. -@end defmac - -@defmac INIT_ENVIRONMENT -Define this macro as a C string constant if you wish to set environment -variables for programs called by the driver, such as the assembler and -loader. The driver passes the value of this macro to @code{putenv} to -initialize the necessary environment variables. -@end defmac - -@defmac LOCAL_INCLUDE_DIR -Define this macro as a C string constant if you wish to override the -standard choice of @file{/usr/local/include} as the default prefix to -try when searching for local header files. @code{LOCAL_INCLUDE_DIR} -comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in -@file{config.gcc}, normally @file{/usr/include}) in the search order. - -Cross compilers do not search either @file{/usr/local/include} or its -replacement. -@end defmac - -@defmac NATIVE_SYSTEM_HEADER_COMPONENT -The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. -See @code{INCLUDE_DEFAULTS}, below, for the description of components. -If you do not define this macro, no component is used. -@end defmac - -@defmac INCLUDE_DEFAULTS -Define this macro if you wish to override the entire default search path -for include files. For a native compiler, the default search path -usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, -@code{GPLUSPLUS_INCLUDE_DIR}, and -@code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} -and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, -and specify private search areas for GCC@. The directory -@code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. - -The definition should be an initializer for an array of structures. -Each array element should have four elements: the directory name (a -string constant), the component name (also a string constant), a flag -for C++-only directories, -and a flag showing that the includes in the directory don't need to be -wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of -the array with a null element. - -The component name denotes what GNU package the include file is part of, -if any, in all uppercase letters. For example, it might be @samp{GCC} -or @samp{BINUTILS}. If the package is part of a vendor-supplied -operating system, code the component name as @samp{0}. - -For example, here is the definition used for VAX/VMS: - -@smallexample -#define INCLUDE_DEFAULTS \ -@{ \ - @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \ - @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \ - @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \ - @{ ".", 0, 0, 0@}, \ - @{ 0, 0, 0, 0@} \ -@} -@end smallexample -@end defmac - -Here is the order of prefixes tried for exec files: - -@enumerate -@item -Any prefixes specified by the user with @option{-B}. - -@item -The environment variable @code{GCC_EXEC_PREFIX} or, if @code{GCC_EXEC_PREFIX} -is not set and the compiler has not been installed in the configure-time -@var{prefix}, the location in which the compiler has actually been installed. - -@item -The directories specified by the environment variable @code{COMPILER_PATH}. - -@item -The macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installed -in the configured-time @var{prefix}. - -@item -The location @file{/usr/libexec/gcc/}, but only if this is a native compiler. - -@item -The location @file{/usr/lib/gcc/}, but only if this is a native compiler. - -@item -The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native -compiler. -@end enumerate - -Here is the order of prefixes tried for startfiles: - -@enumerate -@item -Any prefixes specified by the user with @option{-B}. - -@item -The environment variable @code{GCC_EXEC_PREFIX} or its automatically determined -value based on the installed toolchain location. - -@item -The directories specified by the environment variable @code{LIBRARY_PATH} -(or port-specific name; native only, cross compilers do not use this). - -@item -The macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installed -in the configured @var{prefix} or this is a native compiler. - -@item -The location @file{/usr/lib/gcc/}, but only if this is a native compiler. - -@item -The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native -compiler. - -@item -The macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a -native compiler, or we have a target system root. - -@item -The macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a -native compiler, or we have a target system root. - -@item -The macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications. -If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} and -the machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix. - -@item -The macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a native -compiler, or we have a target system root. The default for this macro is -@file{/lib/}. - -@item -The macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a native -compiler, or we have a target system root. The default for this macro is -@file{/usr/lib/}. -@end enumerate - -@node Run-time Target -@section Run-time Target Specification -@cindex run-time target specification -@cindex predefined macros -@cindex target specifications - -@c prevent bad page break with this line -Here are run-time target specifications. - -@defmac TARGET_CPU_CPP_BUILTINS () -This function-like macro expands to a block of code that defines -built-in preprocessor macros and assertions for the target CPU, using -the functions @code{builtin_define}, @code{builtin_define_std} and -@code{builtin_assert}. When the front end -calls this macro it provides a trailing semicolon, and since it has -finished command line option processing your code can use those -results freely. - -@code{builtin_assert} takes a string in the form you pass to the -command-line option @option{-A}, such as @code{cpu=mips}, and creates -the assertion. @code{builtin_define} takes a string in the form -accepted by option @option{-D} and unconditionally defines the macro. - -@code{builtin_define_std} takes a string representing the name of an -object-like macro. If it doesn't lie in the user's namespace, -@code{builtin_define_std} defines it unconditionally. Otherwise, it -defines a version with two leading underscores, and another version -with two leading and trailing underscores, and defines the original -only if an ISO standard was not requested on the command line. For -example, passing @code{unix} defines @code{__unix}, @code{__unix__} -and possibly @code{unix}; passing @code{_mips} defines @code{__mips}, -@code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64} -defines only @code{_ABI64}. - -You can also test for the C dialect being compiled. The variable -@code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus} -or @code{clk_objective_c}. Note that if we are preprocessing -assembler, this variable will be @code{clk_c} but the function-like -macro @code{preprocessing_asm_p()} will return true, so you might want -to check for that first. If you need to check for strict ANSI, the -variable @code{flag_iso} can be used. The function-like macro -@code{preprocessing_trad_p()} can be used to check for traditional -preprocessing. -@end defmac - -@defmac TARGET_OS_CPP_BUILTINS () -Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional -and is used for the target operating system instead. -@end defmac - -@defmac TARGET_OBJFMT_CPP_BUILTINS () -Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional -and is used for the target object format. @file{elfos.h} uses this -macro to define @code{__ELF__}, so you probably do not need to define -it yourself. -@end defmac - -@deftypevar {extern int} target_flags -This variable is declared in @file{options.h}, which is included before -any target-specific headers. -@end deftypevar - -@deftypevr {Common Target Hook} int TARGET_DEFAULT_TARGET_FLAGS -This variable specifies the initial value of @code{target_flags}. -Its default setting is 0. -@end deftypevr - -@cindex optional hardware or system features -@cindex features, optional, in system conventions - -@deftypefn {Common Target Hook} bool TARGET_HANDLE_OPTION (struct gcc_options *@var{opts}, struct gcc_options *@var{opts_set}, const struct cl_decoded_option *@var{decoded}, location_t @var{loc}) -This hook is called whenever the user specifies one of the -target-specific options described by the @file{.opt} definition files -(@pxref{Options}). It has the opportunity to do some option-specific -processing and should return true if the option is valid. The default -definition does nothing but return true. - -@var{decoded} specifies the option and its arguments. @var{opts} and -@var{opts_set} are the @code{gcc_options} structures to be used for -storing option state, and @var{loc} is the location at which the -option was passed (@code{UNKNOWN_LOCATION} except for options passed -via attributes). -@end deftypefn - -@deftypefn {C Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value}) -This target hook is called whenever the user specifies one of the -target-specific C language family options described by the @file{.opt} -definition files(@pxref{Options}). It has the opportunity to do some -option-specific processing and should return true if the option is -valid. The arguments are like for @code{TARGET_HANDLE_OPTION}. The -default definition does nothing but return false. - -In general, you should use @code{TARGET_HANDLE_OPTION} to handle -options. However, if processing an option requires routines that are -only available in the C (and related language) front ends, then you -should use @code{TARGET_HANDLE_C_OPTION} instead. -@end deftypefn - -@deftypefn {C Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree @var{string}) -Targets may provide a string object type that can be used within and between C, C++ and their respective Objective-C dialects. A string object might, for example, embed encoding and length information. These objects are considered opaque to the compiler and handled as references. An ideal implementation makes the composition of the string object match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep), allowing efficient interworking between C-only and Objective-C code. If a target implements string objects then this hook should return a reference to such an object constructed from the normal `C' string representation provided in @var{string}. At present, the hook is used by Objective-C only, to obtain a common-format string object when the target provides one. -@end deftypefn - -@deftypefn {C Target Hook} void TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE (const char *@var{classname}) -Declare that Objective C class @var{classname} is referenced by the current TU. -@end deftypefn - -@deftypefn {C Target Hook} void TARGET_OBJC_DECLARE_CLASS_DEFINITION (const char *@var{classname}) -Declare that Objective C class @var{classname} is defined by the current TU. -@end deftypefn - -@deftypefn {C Target Hook} bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree @var{stringref}) -If a target implements string objects then this hook should return @code{true} if @var{stringref} is a valid reference to such an object. -@end deftypefn - -@deftypefn {C Target Hook} void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree @var{format_arg}, tree @var{args_list}) -If a target implements string objects then this hook should should provide a facility to check the function arguments in @var{args_list} against the format specifiers in @var{format_arg} where the type of @var{format_arg} is one recognized as a valid string reference type. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void) -This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE} -but is called when the optimize level is changed via an attribute or -pragma or when it is reset at the end of the code affected by the -attribute or pragma. It is not called at the beginning of compilation -when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these -actions then, you should have @code{TARGET_OPTION_OVERRIDE} call -@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}. -@end deftypefn - -@defmac C_COMMON_OVERRIDE_OPTIONS -This is similar to the @code{TARGET_OPTION_OVERRIDE} hook -but is only used in the C -language frontends (C, Objective-C, C++, Objective-C++) and so can be -used to alter option flag variables which only exist in those -frontends. -@end defmac - -@deftypevr {Common Target Hook} {const struct default_options *} TARGET_OPTION_OPTIMIZATION_TABLE -Some machines may desire to change what optimizations are performed for -various optimization levels. This variable, if defined, describes -options to enable at particular sets of optimization levels. These -options are processed once -just after the optimization level is determined and before the remainder -of the command options have been parsed, so may be overridden by other -options passed explicitly. - -This processing is run once at program startup and when the optimization -options are changed via @code{#pragma GCC optimize} or by using the -@code{optimize} attribute. -@end deftypevr - -@deftypefn {Common Target Hook} void TARGET_OPTION_INIT_STRUCT (struct gcc_options *@var{opts}) -Set target-dependent initial values of fields in @var{opts}. -@end deftypefn - -@deftypefn {Common Target Hook} void TARGET_OPTION_DEFAULT_PARAMS (void) -Set target-dependent default values for @option{--param} settings, using calls to @code{set_default_param_value}. -@end deftypefn - -@defmac SWITCHABLE_TARGET -Some targets need to switch between substantially different subtargets -during compilation. For example, the MIPS target has one subtarget for -the traditional MIPS architecture and another for MIPS16. Source code -can switch between these two subarchitectures using the @code{mips16} -and @code{nomips16} attributes. - -Such subtargets can differ in things like the set of available -registers, the set of available instructions, the costs of various -operations, and so on. GCC caches a lot of this type of information -in global variables, and recomputing them for each subtarget takes a -significant amount of time. The compiler therefore provides a facility -for maintaining several versions of the global variables and quickly -switching between them; see @file{target-globals.h} for details. - -Define this macro to 1 if your target needs this facility. The default -is 0. -@end defmac - -@deftypefn {Target Hook} bool TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P (void) -Returns true if the target supports IEEE 754 floating-point exceptions and rounding modes, false otherwise. This is intended to relate to the @code{float} and @code{double} types, but not necessarily @code{long double}. By default, returns true if the @code{adddf3} instruction pattern is available and false otherwise, on the assumption that hardware floating point supports exceptions and rounding modes but software floating point does not. -@end deftypefn - -@node Per-Function Data -@section Defining data structures for per-function information. -@cindex per-function data -@cindex data structures - -If the target needs to store information on a per-function basis, GCC -provides a macro and a couple of variables to allow this. Note, just -using statics to store the information is a bad idea, since GCC supports -nested functions, so you can be halfway through encoding one function -when another one comes along. - -GCC defines a data structure called @code{struct function} which -contains all of the data specific to an individual function. This -structure contains a field called @code{machine} whose type is -@code{struct machine_function *}, which can be used by targets to point -to their own specific data. - -If a target needs per-function specific data it should define the type -@code{struct machine_function} and also the macro @code{INIT_EXPANDERS}. -This macro should be used to initialize the function pointer -@code{init_machine_status}. This pointer is explained below. - -One typical use of per-function, target specific data is to create an -RTX to hold the register containing the function's return address. This -RTX can then be used to implement the @code{__builtin_return_address} -function, for level 0. - -Note---earlier implementations of GCC used a single data area to hold -all of the per-function information. Thus when processing of a nested -function began the old per-function data had to be pushed onto a -stack, and when the processing was finished, it had to be popped off the -stack. GCC used to provide function pointers called -@code{save_machine_status} and @code{restore_machine_status} to handle -the saving and restoring of the target specific information. Since the -single data area approach is no longer used, these pointers are no -longer supported. - -@defmac INIT_EXPANDERS -Macro called to initialize any target specific information. This macro -is called once per function, before generation of any RTL has begun. -The intention of this macro is to allow the initialization of the -function pointer @code{init_machine_status}. -@end defmac - -@deftypevar {void (*)(struct function *)} init_machine_status -If this function pointer is non-@code{NULL} it will be called once per -function, before function compilation starts, in order to allow the -target to perform any target specific initialization of the -@code{struct function} structure. It is intended that this would be -used to initialize the @code{machine} of that structure. - -@code{struct machine_function} structures are expected to be freed by GC@. -Generally, any memory that they reference must be allocated by using -GC allocation, including the structure itself. -@end deftypevar - -@node Storage Layout -@section Storage Layout -@cindex storage layout - -Note that the definitions of the macros in this table which are sizes or -alignments measured in bits do not need to be constant. They can be C -expressions that refer to static variables, such as the @code{target_flags}. -@xref{Run-time Target}. - -@defmac BITS_BIG_ENDIAN -Define this macro to have the value 1 if the most significant bit in a -byte has the lowest number; otherwise define it to have the value zero. -This means that bit-field instructions count from the most significant -bit. If the machine has no bit-field instructions, then this must still -be defined, but it doesn't matter which value it is defined to. This -macro need not be a constant. - -This macro does not affect the way structure fields are packed into -bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}. -@end defmac - -@defmac BYTES_BIG_ENDIAN -Define this macro to have the value 1 if the most significant byte in a -word has the lowest number. This macro need not be a constant. -@end defmac - -@defmac WORDS_BIG_ENDIAN -Define this macro to have the value 1 if, in a multiword object, the -most significant word has the lowest number. This applies to both -memory locations and registers; see @code{REG_WORDS_BIG_ENDIAN} if the -order of words in memory is not the same as the order in registers. This -macro need not be a constant. -@end defmac - -@defmac REG_WORDS_BIG_ENDIAN -On some machines, the order of words in a multiword object differs between -registers in memory. In such a situation, define this macro to describe -the order of words in a register. The macro @code{WORDS_BIG_ENDIAN} controls -the order of words in memory. -@end defmac - -@defmac FLOAT_WORDS_BIG_ENDIAN -Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or -@code{TFmode} floating point numbers are stored in memory with the word -containing the sign bit at the lowest address; otherwise define it to -have the value 0. This macro need not be a constant. - -You need not define this macro if the ordering is the same as for -multi-word integers. -@end defmac - -@defmac BITS_PER_WORD -Number of bits in a word. If you do not define this macro, the default -is @code{BITS_PER_UNIT * UNITS_PER_WORD}. -@end defmac - -@defmac MAX_BITS_PER_WORD -Maximum number of bits in a word. If this is undefined, the default is -@code{BITS_PER_WORD}. Otherwise, it is the constant value that is the -largest value that @code{BITS_PER_WORD} can have at run-time. -@end defmac - -@defmac UNITS_PER_WORD -Number of storage units in a word; normally the size of a general-purpose -register, a power of two from 1 or 8. -@end defmac - -@defmac MIN_UNITS_PER_WORD -Minimum number of units in a word. If this is undefined, the default is -@code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the -smallest value that @code{UNITS_PER_WORD} can have at run-time. -@end defmac - -@defmac POINTER_SIZE -Width of a pointer, in bits. You must specify a value no wider than the -width of @code{Pmode}. If it is not equal to the width of @code{Pmode}, -you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify -a value the default is @code{BITS_PER_WORD}. -@end defmac - -@defmac POINTERS_EXTEND_UNSIGNED -A C expression that determines how pointers should be extended from -@code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It is -greater than zero if pointers should be zero-extended, zero if they -should be sign-extended, and negative if some other sort of conversion -is needed. In the last case, the extension is done by the target's -@code{ptr_extend} instruction. - -You need not define this macro if the @code{ptr_mode}, @code{Pmode} -and @code{word_mode} are all the same width. -@end defmac - -@defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type}) -A macro to update @var{m} and @var{unsignedp} when an object whose type -is @var{type} and which has the specified mode and signedness is to be -stored in a register. This macro is only called when @var{type} is a -scalar type. - -On most RISC machines, which only have operations that operate on a full -register, define this macro to set @var{m} to @code{word_mode} if -@var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most -cases, only integer modes should be widened because wider-precision -floating-point operations are usually more expensive than their narrower -counterparts. - -For most machines, the macro definition does not change @var{unsignedp}. -However, some machines, have instructions that preferentially handle -either signed or unsigned quantities of certain modes. For example, on -the DEC Alpha, 32-bit loads from memory and 32-bit add instructions -sign-extend the result to 64 bits. On such machines, set -@var{unsignedp} according to which kind of extension is more efficient. - -Do not define this macro if it would never modify @var{m}. -@end defmac - -@deftypefn {Target Hook} machine_mode TARGET_PROMOTE_FUNCTION_MODE (const_tree @var{type}, machine_mode @var{mode}, int *@var{punsignedp}, const_tree @var{funtype}, int @var{for_return}) -Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or -function return values. The target hook should return the new mode -and possibly change @code{*@var{punsignedp}} if the promotion should -change signedness. This function is called only for scalar @emph{or -pointer} types. - -@var{for_return} allows to distinguish the promotion of arguments and -return values. If it is @code{1}, a return value is being promoted and -@code{TARGET_FUNCTION_VALUE} must perform the same promotions done here. -If it is @code{2}, the returned mode should be that of the register in -which an incoming parameter is copied, or the outgoing result is computed; -then the hook should return the same mode as @code{promote_mode}, though -the signedness may be different. - -@var{type} can be NULL when promoting function arguments of libcalls. - -The default is to not promote arguments and return values. You can -also define the hook to @code{default_promote_function_mode_always_promote} -if you would like to apply the same rules given by @code{PROMOTE_MODE}. -@end deftypefn - -@defmac PARM_BOUNDARY -Normal alignment required for function parameters on the stack, in -bits. All stack parameters receive at least this much alignment -regardless of data type. On most machines, this is the same as the -size of an integer. -@end defmac - -@defmac STACK_BOUNDARY -Define this macro to the minimum alignment enforced by hardware for the -stack pointer on this machine. The definition is a C expression for the -desired alignment (measured in bits). This value is used as a default -if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines, -this should be the same as @code{PARM_BOUNDARY}. -@end defmac - -@defmac PREFERRED_STACK_BOUNDARY -Define this macro if you wish to preserve a certain alignment for the -stack pointer, greater than what the hardware enforces. The definition -is a C expression for the desired alignment (measured in bits). This -macro must evaluate to a value equal to or larger than -@code{STACK_BOUNDARY}. -@end defmac - -@defmac INCOMING_STACK_BOUNDARY -Define this macro if the incoming stack boundary may be different -from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate -to a value equal to or larger than @code{STACK_BOUNDARY}. -@end defmac - -@defmac FUNCTION_BOUNDARY -Alignment required for a function entry point, in bits. -@end defmac - -@defmac BIGGEST_ALIGNMENT -Biggest alignment that any data type can require on this machine, in -bits. Note that this is not the biggest alignment that is supported, -just the biggest alignment that, when violated, may cause a fault. -@end defmac - -@deftypevr {Target Hook} HOST_WIDE_INT TARGET_ABSOLUTE_BIGGEST_ALIGNMENT -If defined, this target hook specifies the absolute biggest alignment -that a type or variable can have on this machine, otherwise, -@code{BIGGEST_ALIGNMENT} is used. -@end deftypevr - -@defmac MALLOC_ABI_ALIGNMENT -Alignment, in bits, a C conformant malloc implementation has to -provide. If not defined, the default value is @code{BITS_PER_WORD}. -@end defmac - -@defmac ATTRIBUTE_ALIGNED_VALUE -Alignment used by the @code{__attribute__ ((aligned))} construct. If -not defined, the default value is @code{BIGGEST_ALIGNMENT}. -@end defmac - -@defmac MINIMUM_ATOMIC_ALIGNMENT -If defined, the smallest alignment, in bits, that can be given to an -object that can be referenced in one operation, without disturbing any -nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger -on machines that don't have byte or half-word store operations. -@end defmac - -@defmac BIGGEST_FIELD_ALIGNMENT -Biggest alignment that any structure or union field can require on this -machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for -structure and union fields only, unless the field alignment has been set -by the @code{__attribute__ ((aligned (@var{n})))} construct. -@end defmac - -@defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed}) -An expression for the alignment of a structure field @var{field} if the -alignment computed in the usual way (including applying of -@code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the -alignment) is @var{computed}. It overrides alignment only if the -field alignment has not been set by the -@code{__attribute__ ((aligned (@var{n})))} construct. -@end defmac - -@defmac MAX_STACK_ALIGNMENT -Biggest stack alignment guaranteed by the backend. Use this macro -to specify the maximum alignment of a variable on stack. - -If not defined, the default value is @code{STACK_BOUNDARY}. - -@c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}. -@c But the fix for PR 32893 indicates that we can only guarantee -@c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not -@c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported. -@end defmac - -@defmac MAX_OFILE_ALIGNMENT -Biggest alignment supported by the object file format of this machine. -Use this macro to limit the alignment which can be specified using the -@code{__attribute__ ((aligned (@var{n})))} construct. If not defined, -the default value is @code{BIGGEST_ALIGNMENT}. - -On systems that use ELF, the default (in @file{config/elfos.h}) is -the largest supported 32-bit ELF section alignment representable on -a 32-bit host e.g. @samp{(((uint64_t) 1 << 28) * 8)}. -On 32-bit ELF the largest supported section alignment in bits is -@samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts. -@end defmac - -@defmac DATA_ALIGNMENT (@var{type}, @var{basic-align}) -If defined, a C expression to compute the alignment for a variable in -the static store. @var{type} is the data type, and @var{basic-align} is -the alignment that the object would ordinarily have. The value of this -macro is used instead of that alignment to align the object. - -If this macro is not defined, then @var{basic-align} is used. - -@findex strcpy -One use of this macro is to increase alignment of medium-size data to -make it all fit in fewer cache lines. Another is to cause character -arrays to be word-aligned so that @code{strcpy} calls that copy -constants to character arrays can be done inline. -@end defmac - -@defmac DATA_ABI_ALIGNMENT (@var{type}, @var{basic-align}) -Similar to @code{DATA_ALIGNMENT}, but for the cases where the ABI mandates -some alignment increase, instead of optimization only purposes. E.g.@ -AMD x86-64 psABI says that variables with array type larger than 15 bytes -must be aligned to 16 byte boundaries. - -If this macro is not defined, then @var{basic-align} is used. -@end defmac - -@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align}) -If defined, a C expression to compute the alignment given to a constant -that is being placed in memory. @var{constant} is the constant and -@var{basic-align} is the alignment that the object would ordinarily -have. The value of this macro is used instead of that alignment to -align the object. - -If this macro is not defined, then @var{basic-align} is used. - -The typical use of this macro is to increase alignment for string -constants to be word aligned so that @code{strcpy} calls that copy -constants can be done inline. -@end defmac - -@defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align}) -If defined, a C expression to compute the alignment for a variable in -the local store. @var{type} is the data type, and @var{basic-align} is -the alignment that the object would ordinarily have. The value of this -macro is used instead of that alignment to align the object. - -If this macro is not defined, then @var{basic-align} is used. - -One use of this macro is to increase alignment of medium-size data to -make it all fit in fewer cache lines. - -If the value of this macro has a type, it should be an unsigned type. -@end defmac - -@deftypefn {Target Hook} HOST_WIDE_INT TARGET_VECTOR_ALIGNMENT (const_tree @var{type}) -This hook can be used to define the alignment for a vector of type -@var{type}, in order to comply with a platform ABI. The default is to -require natural alignment for vector types. The alignment returned by -this hook must be a power-of-two multiple of the default alignment of -the vector element type. -@end deftypefn - -@defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align}) -If defined, a C expression to compute the alignment for stack slot. -@var{type} is the data type, @var{mode} is the widest mode available, -and @var{basic-align} is the alignment that the slot would ordinarily -have. The value of this macro is used instead of that alignment to -align the slot. - -If this macro is not defined, then @var{basic-align} is used when -@var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} will -be used. - -This macro is to set alignment of stack slot to the maximum alignment -of all possible modes which the slot may have. - -If the value of this macro has a type, it should be an unsigned type. -@end defmac - -@defmac LOCAL_DECL_ALIGNMENT (@var{decl}) -If defined, a C expression to compute the alignment for a local -variable @var{decl}. - -If this macro is not defined, then -@code{LOCAL_ALIGNMENT (TREE_TYPE (@var{decl}), DECL_ALIGN (@var{decl}))} -is used. - -One use of this macro is to increase alignment of medium-size data to -make it all fit in fewer cache lines. - -If the value of this macro has a type, it should be an unsigned type. -@end defmac - -@defmac MINIMUM_ALIGNMENT (@var{exp}, @var{mode}, @var{align}) -If defined, a C expression to compute the minimum required alignment -for dynamic stack realignment purposes for @var{exp} (a type or decl), -@var{mode}, assuming normal alignment @var{align}. - -If this macro is not defined, then @var{align} will be used. -@end defmac - -@defmac EMPTY_FIELD_BOUNDARY -Alignment in bits to be given to a structure bit-field that follows an -empty field such as @code{int : 0;}. - -If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro. -@end defmac - -@defmac STRUCTURE_SIZE_BOUNDARY -Number of bits which any structure or union's size must be a multiple of. -Each structure or union's size is rounded up to a multiple of this. - -If you do not define this macro, the default is the same as -@code{BITS_PER_UNIT}. -@end defmac - -@defmac STRICT_ALIGNMENT -Define this macro to be the value 1 if instructions will fail to work -if given data not on the nominal alignment. If instructions will merely -go slower in that case, define this macro as 0. -@end defmac - -@defmac PCC_BITFIELD_TYPE_MATTERS -Define this if you wish to imitate the way many other C compilers handle -alignment of bit-fields and the structures that contain them. - -The behavior is that the type written for a named bit-field (@code{int}, -@code{short}, or other integer type) imposes an alignment for the entire -structure, as if the structure really did contain an ordinary field of -that type. In addition, the bit-field is placed within the structure so -that it would fit within such a field, not crossing a boundary for it. - -Thus, on most machines, a named bit-field whose type is written as -@code{int} would not cross a four-byte boundary, and would force -four-byte alignment for the whole structure. (The alignment used may -not be four bytes; it is controlled by the other alignment parameters.) - -An unnamed bit-field will not affect the alignment of the containing -structure. - -If the macro is defined, its definition should be a C expression; -a nonzero value for the expression enables this behavior. - -Note that if this macro is not defined, or its value is zero, some -bit-fields may cross more than one alignment boundary. The compiler can -support such references if there are @samp{insv}, @samp{extv}, and -@samp{extzv} insns that can directly reference memory. - -The other known way of making bit-fields work is to define -@code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}. -Then every structure can be accessed with fullwords. - -Unless the machine has bit-field instructions or you define -@code{STRUCTURE_SIZE_BOUNDARY} that way, you must define -@code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value. - -If your aim is to make GCC use the same conventions for laying out -bit-fields as are used by another compiler, here is how to investigate -what the other compiler does. Compile and run this program: - -@smallexample -struct foo1 -@{ - char x; - char :0; - char y; -@}; - -struct foo2 -@{ - char x; - int :0; - char y; -@}; - -main () -@{ - printf ("Size of foo1 is %d\n", - sizeof (struct foo1)); - printf ("Size of foo2 is %d\n", - sizeof (struct foo2)); - exit (0); -@} -@end smallexample - -If this prints 2 and 5, then the compiler's behavior is what you would -get from @code{PCC_BITFIELD_TYPE_MATTERS}. -@end defmac - -@defmac BITFIELD_NBYTES_LIMITED -Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited -to aligning a bit-field within the structure. -@end defmac - -@deftypefn {Target Hook} bool TARGET_ALIGN_ANON_BITFIELD (void) -When @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determine -whether unnamed bitfields affect the alignment of the containing -structure. The hook should return true if the structure should inherit -the alignment requirements of an unnamed bitfield's type. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_NARROW_VOLATILE_BITFIELD (void) -This target hook should return @code{true} if accesses to volatile bitfields -should use the narrowest mode possible. It should return @code{false} if -these accesses should use the bitfield container type. - -The default is @code{false}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_MEMBER_TYPE_FORCES_BLK (const_tree @var{field}, machine_mode @var{mode}) -Return true if a structure, union or array containing @var{field} should -be accessed using @code{BLKMODE}. - -If @var{field} is the only field in the structure, @var{mode} is its -mode, otherwise @var{mode} is VOIDmode. @var{mode} is provided in the -case where structures of one field would require the structure's mode to -retain the field's mode. - -Normally, this is not needed. -@end deftypefn - -@defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified}) -Define this macro as an expression for the alignment of a type (given -by @var{type} as a tree node) if the alignment computed in the usual -way is @var{computed} and the alignment explicitly specified was -@var{specified}. - -The default is to use @var{specified} if it is larger; otherwise, use -the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT} -@end defmac - -@defmac MAX_FIXED_MODE_SIZE -An integer expression for the size in bits of the largest integer -machine mode that should actually be used. All integer machine modes of -this size or smaller can be used for structures and unions with the -appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE -(DImode)} is assumed. -@end defmac - -@defmac STACK_SAVEAREA_MODE (@var{save_level}) -If defined, an expression of type @code{machine_mode} that -specifies the mode of the save area operand of a -@code{save_stack_@var{level}} named pattern (@pxref{Standard Names}). -@var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or -@code{SAVE_NONLOCAL} and selects which of the three named patterns is -having its mode specified. - -You need not define this macro if it always returns @code{Pmode}. You -would most commonly define this macro if the -@code{save_stack_@var{level}} patterns need to support both a 32- and a -64-bit mode. -@end defmac - -@defmac STACK_SIZE_MODE -If defined, an expression of type @code{machine_mode} that -specifies the mode of the size increment operand of an -@code{allocate_stack} named pattern (@pxref{Standard Names}). - -You need not define this macro if it always returns @code{word_mode}. -You would most commonly define this macro if the @code{allocate_stack} -pattern needs to support both a 32- and a 64-bit mode. -@end defmac - -@deftypefn {Target Hook} machine_mode TARGET_LIBGCC_CMP_RETURN_MODE (void) -This target hook should return the mode to be used for the return value -of compare instructions expanded to libgcc calls. If not defined -@code{word_mode} is returned which is the right choice for a majority of -targets. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_LIBGCC_SHIFT_COUNT_MODE (void) -This target hook should return the mode to be used for the shift count operand -of shift instructions expanded to libgcc calls. If not defined -@code{word_mode} is returned which is the right choice for a majority of -targets. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_UNWIND_WORD_MODE (void) -Return machine mode to be used for @code{_Unwind_Word} type. -The default is to use @code{word_mode}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (const_tree @var{record_type}) -This target hook returns @code{true} if bit-fields in the given -@var{record_type} are to be laid out following the rules of Microsoft -Visual C/C++, namely: (i) a bit-field won't share the same storage -unit with the previous bit-field if their underlying types have -different sizes, and the bit-field will be aligned to the highest -alignment of the underlying types of itself and of the previous -bit-field; (ii) a zero-sized bit-field will affect the alignment of -the whole enclosing structure, even if it is unnamed; except that -(iii) a zero-sized bit-field will be disregarded unless it follows -another bit-field of nonzero size. If this hook returns @code{true}, -other macros that control bit-field layout are ignored. - -When a bit-field is inserted into a packed record, the whole size -of the underlying type is used by one or more same-size adjacent -bit-fields (that is, if its long:3, 32 bits is used in the record, -and any additional adjacent long bit-fields are packed into the same -chunk of 32 bits. However, if the size changes, a new field of that -size is allocated). In an unpacked record, this is the same as using -alignment, but not equivalent when packing. - -If both MS bit-fields and @samp{__attribute__((packed))} are used, -the latter will take precedence. If @samp{__attribute__((packed))} is -used on a single field when MS bit-fields are in use, it will take -precedence for that field, but the alignment of the rest of the structure -may affect its placement. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_DECIMAL_FLOAT_SUPPORTED_P (void) -Returns true if the target supports decimal floating point. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_FIXED_POINT_SUPPORTED_P (void) -Returns true if the target supports fixed-point arithmetic. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_EXPAND_TO_RTL_HOOK (void) -This hook is called just before expansion into rtl, allowing the target -to perform additional initializations or analysis before the expansion. -For example, the rs6000 port uses it to allocate a scratch stack slot -for use in copying SDmode values between memory and floating point -registers whenever the function being expanded has any SDmode -usage. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_INSTANTIATE_DECLS (void) -This hook allows the backend to perform additional instantiations on rtl -that are not actually in any insns yet, but will be later. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_MANGLE_TYPE (const_tree @var{type}) -If your target defines any fundamental types, or any types your target -uses should be mangled differently from the default, define this hook -to return the appropriate encoding for these types as part of a C++ -mangled name. The @var{type} argument is the tree structure representing -the type to be mangled. The hook may be applied to trees which are -not target-specific fundamental types; it should return @code{NULL} -for all such types, as well as arguments it does not recognize. If the -return value is not @code{NULL}, it must point to a statically-allocated -string constant. - -Target-specific fundamental types might be new fundamental types or -qualified versions of ordinary fundamental types. Encode new -fundamental types as @samp{@w{u @var{n} @var{name}}}, where @var{name} -is the name used for the type in source code, and @var{n} is the -length of @var{name} in decimal. Encode qualified versions of -ordinary types as @samp{@w{U @var{n} @var{name} @var{code}}}, where -@var{name} is the name used for the type qualifier in source code, -@var{n} is the length of @var{name} as above, and @var{code} is the -code used to represent the unqualified version of this type. (See -@code{write_builtin_type} in @file{cp/mangle.c} for the list of -codes.) In both cases the spaces are for clarity; do not include any -spaces in your string. - -This hook is applied to types prior to typedef resolution. If the mangled -name for a particular type depends only on that type's main variant, you -can perform typedef resolution yourself using @code{TYPE_MAIN_VARIANT} -before mangling. - -The default version of this hook always returns @code{NULL}, which is -appropriate for a target that does not define any new fundamental -types. -@end deftypefn - -@node Type Layout -@section Layout of Source Language Data Types - -These macros define the sizes and other characteristics of the standard -basic data types used in programs being compiled. Unlike the macros in -the previous section, these apply to specific features of C and related -languages, rather than to fundamental aspects of storage layout. - -@defmac INT_TYPE_SIZE -A C expression for the size in bits of the type @code{int} on the -target machine. If you don't define this, the default is one word. -@end defmac - -@defmac SHORT_TYPE_SIZE -A C expression for the size in bits of the type @code{short} on the -target machine. If you don't define this, the default is half a word. -(If this would be less than one storage unit, it is rounded up to one -unit.) -@end defmac - -@defmac LONG_TYPE_SIZE -A C expression for the size in bits of the type @code{long} on the -target machine. If you don't define this, the default is one word. -@end defmac - -@defmac ADA_LONG_TYPE_SIZE -On some machines, the size used for the Ada equivalent of the type -@code{long} by a native Ada compiler differs from that used by C@. In -that situation, define this macro to be a C expression to be used for -the size of that type. If you don't define this, the default is the -value of @code{LONG_TYPE_SIZE}. -@end defmac - -@defmac LONG_LONG_TYPE_SIZE -A C expression for the size in bits of the type @code{long long} on the -target machine. If you don't define this, the default is two -words. If you want to support GNU Ada on your machine, the value of this -macro must be at least 64. -@end defmac - -@defmac CHAR_TYPE_SIZE -A C expression for the size in bits of the type @code{char} on the -target machine. If you don't define this, the default is -@code{BITS_PER_UNIT}. -@end defmac - -@defmac BOOL_TYPE_SIZE -A C expression for the size in bits of the C++ type @code{bool} and -C99 type @code{_Bool} on the target machine. If you don't define -this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}. -@end defmac - -@defmac FLOAT_TYPE_SIZE -A C expression for the size in bits of the type @code{float} on the -target machine. If you don't define this, the default is one word. -@end defmac - -@defmac DOUBLE_TYPE_SIZE -A C expression for the size in bits of the type @code{double} on the -target machine. If you don't define this, the default is two -words. -@end defmac - -@defmac LONG_DOUBLE_TYPE_SIZE -A C expression for the size in bits of the type @code{long double} on -the target machine. If you don't define this, the default is two -words. -@end defmac - -@defmac SHORT_FRACT_TYPE_SIZE -A C expression for the size in bits of the type @code{short _Fract} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT}. -@end defmac - -@defmac FRACT_TYPE_SIZE -A C expression for the size in bits of the type @code{_Fract} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 2}. -@end defmac - -@defmac LONG_FRACT_TYPE_SIZE -A C expression for the size in bits of the type @code{long _Fract} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 4}. -@end defmac - -@defmac LONG_LONG_FRACT_TYPE_SIZE -A C expression for the size in bits of the type @code{long long _Fract} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 8}. -@end defmac - -@defmac SHORT_ACCUM_TYPE_SIZE -A C expression for the size in bits of the type @code{short _Accum} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 2}. -@end defmac - -@defmac ACCUM_TYPE_SIZE -A C expression for the size in bits of the type @code{_Accum} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 4}. -@end defmac - -@defmac LONG_ACCUM_TYPE_SIZE -A C expression for the size in bits of the type @code{long _Accum} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 8}. -@end defmac - -@defmac LONG_LONG_ACCUM_TYPE_SIZE -A C expression for the size in bits of the type @code{long long _Accum} on -the target machine. If you don't define this, the default is -@code{BITS_PER_UNIT * 16}. -@end defmac - -@defmac LIBGCC2_GNU_PREFIX -This macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} target -hook and should be defined if that hook is overriden to be true. It -causes function names in libgcc to be changed to use a @code{__gnu_} -prefix for their name rather than the default @code{__}. A port which -uses this macro should also arrange to use @file{t-gnu-prefix} in -the libgcc @file{config.host}. -@end defmac - -@defmac TARGET_FLT_EVAL_METHOD -A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h}, -assuming, if applicable, that the floating-point control word is in its -default state. If you do not define this macro the value of -@code{FLT_EVAL_METHOD} will be zero. -@end defmac - -@defmac WIDEST_HARDWARE_FP_SIZE -A C expression for the size in bits of the widest floating-point format -supported by the hardware. If you define this macro, you must specify a -value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}. -If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE} -is the default. -@end defmac - -@defmac DEFAULT_SIGNED_CHAR -An expression whose value is 1 or 0, according to whether the type -@code{char} should be signed or unsigned by default. The user can -always override this default with the options @option{-fsigned-char} -and @option{-funsigned-char}. -@end defmac - -@deftypefn {Target Hook} bool TARGET_DEFAULT_SHORT_ENUMS (void) -This target hook should return true if the compiler should give an -@code{enum} type only as many bytes as it takes to represent the range -of possible values of that type. It should return false if all -@code{enum} types should be allocated like @code{int}. - -The default is to return false. -@end deftypefn - -@defmac SIZE_TYPE -A C expression for a string describing the name of the data type to use -for size values. The typedef name @code{size_t} is defined using the -contents of the string. - -The string can contain more than one keyword. If so, separate them with -spaces, and write first any length keyword, then @code{unsigned} if -appropriate, and finally @code{int}. The string must exactly match one -of the data type names defined in the function -@code{c_common_nodes_and_builtins} in the file @file{c-family/c-common.c}. -You may not omit @code{int} or change the order---that would cause the -compiler to crash on startup. - -If you don't define this macro, the default is @code{"long unsigned -int"}. -@end defmac - -@defmac SIZETYPE -GCC defines internal types (@code{sizetype}, @code{ssizetype}, -@code{bitsizetype} and @code{sbitsizetype}) for expressions -dealing with size. This macro is a C expression for a string describing -the name of the data type from which the precision of @code{sizetype} -is extracted. - -The string has the same restrictions as @code{SIZE_TYPE} string. - -If you don't define this macro, the default is @code{SIZE_TYPE}. -@end defmac - -@defmac PTRDIFF_TYPE -A C expression for a string describing the name of the data type to use -for the result of subtracting two pointers. The typedef name -@code{ptrdiff_t} is defined using the contents of the string. See -@code{SIZE_TYPE} above for more information. - -If you don't define this macro, the default is @code{"long int"}. -@end defmac - -@defmac WCHAR_TYPE -A C expression for a string describing the name of the data type to use -for wide characters. The typedef name @code{wchar_t} is defined using -the contents of the string. See @code{SIZE_TYPE} above for more -information. - -If you don't define this macro, the default is @code{"int"}. -@end defmac - -@defmac WCHAR_TYPE_SIZE -A C expression for the size in bits of the data type for wide -characters. This is used in @code{cpp}, which cannot make use of -@code{WCHAR_TYPE}. -@end defmac - -@defmac WINT_TYPE -A C expression for a string describing the name of the data type to -use for wide characters passed to @code{printf} and returned from -@code{getwc}. The typedef name @code{wint_t} is defined using the -contents of the string. See @code{SIZE_TYPE} above for more -information. - -If you don't define this macro, the default is @code{"unsigned int"}. -@end defmac - -@defmac INTMAX_TYPE -A C expression for a string describing the name of the data type that -can represent any value of any standard or extended signed integer type. -The typedef name @code{intmax_t} is defined using the contents of the -string. See @code{SIZE_TYPE} above for more information. - -If you don't define this macro, the default is the first of -@code{"int"}, @code{"long int"}, or @code{"long long int"} that has as -much precision as @code{long long int}. -@end defmac - -@defmac UINTMAX_TYPE -A C expression for a string describing the name of the data type that -can represent any value of any standard or extended unsigned integer -type. The typedef name @code{uintmax_t} is defined using the contents -of the string. See @code{SIZE_TYPE} above for more information. - -If you don't define this macro, the default is the first of -@code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long -unsigned int"} that has as much precision as @code{long long unsigned -int}. -@end defmac - -@defmac SIG_ATOMIC_TYPE -@defmacx INT8_TYPE -@defmacx INT16_TYPE -@defmacx INT32_TYPE -@defmacx INT64_TYPE -@defmacx UINT8_TYPE -@defmacx UINT16_TYPE -@defmacx UINT32_TYPE -@defmacx UINT64_TYPE -@defmacx INT_LEAST8_TYPE -@defmacx INT_LEAST16_TYPE -@defmacx INT_LEAST32_TYPE -@defmacx INT_LEAST64_TYPE -@defmacx UINT_LEAST8_TYPE -@defmacx UINT_LEAST16_TYPE -@defmacx UINT_LEAST32_TYPE -@defmacx UINT_LEAST64_TYPE -@defmacx INT_FAST8_TYPE -@defmacx INT_FAST16_TYPE -@defmacx INT_FAST32_TYPE -@defmacx INT_FAST64_TYPE -@defmacx UINT_FAST8_TYPE -@defmacx UINT_FAST16_TYPE -@defmacx UINT_FAST32_TYPE -@defmacx UINT_FAST64_TYPE -@defmacx INTPTR_TYPE -@defmacx UINTPTR_TYPE -C expressions for the standard types @code{sig_atomic_t}, -@code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t}, -@code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t}, -@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, -@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, -@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, -@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, -@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, -@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See -@code{SIZE_TYPE} above for more information. - -If any of these macros evaluates to a null pointer, the corresponding -type is not supported; if GCC is configured to provide -@code{} in such a case, the header provided may not conform -to C99, depending on the type in question. The defaults for all of -these macros are null pointers. -@end defmac - -@defmac TARGET_PTRMEMFUNC_VBIT_LOCATION -The C++ compiler represents a pointer-to-member-function with a struct -that looks like: - -@smallexample - struct @{ - union @{ - void (*fn)(); - ptrdiff_t vtable_index; - @}; - ptrdiff_t delta; - @}; -@end smallexample - -@noindent -The C++ compiler must use one bit to indicate whether the function that -will be called through a pointer-to-member-function is virtual. -Normally, we assume that the low-order bit of a function pointer must -always be zero. Then, by ensuring that the vtable_index is odd, we can -distinguish which variant of the union is in use. But, on some -platforms function pointers can be odd, and so this doesn't work. In -that case, we use the low-order bit of the @code{delta} field, and shift -the remainder of the @code{delta} field to the left. - -GCC will automatically make the right selection about where to store -this bit using the @code{FUNCTION_BOUNDARY} setting for your platform. -However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY} -set such that functions always start at even addresses, but the lowest -bit of pointers to functions indicate whether the function at that -address is in ARM or Thumb mode. If this is the case of your -architecture, you should define this macro to -@code{ptrmemfunc_vbit_in_delta}. - -In general, you should not have to define this macro. On architectures -in which function addresses are always even, according to -@code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to -@code{ptrmemfunc_vbit_in_pfn}. -@end defmac - -@defmac TARGET_VTABLE_USES_DESCRIPTORS -Normally, the C++ compiler uses function pointers in vtables. This -macro allows the target to change to use ``function descriptors'' -instead. Function descriptors are found on targets for whom a -function pointer is actually a small data structure. Normally the -data structure consists of the actual code address plus a data -pointer to which the function's data is relative. - -If vtables are used, the value of this macro should be the number -of words that the function descriptor occupies. -@end defmac - -@defmac TARGET_VTABLE_ENTRY_ALIGN -By default, the vtable entries are void pointers, the so the alignment -is the same as pointer alignment. The value of this macro specifies -the alignment of the vtable entry in bits. It should be defined only -when special alignment is necessary. */ -@end defmac - -@defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE -There are a few non-descriptor entries in the vtable at offsets below -zero. If these entries must be padded (say, to preserve the alignment -specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number -of words in each data entry. -@end defmac - -@node Registers -@section Register Usage -@cindex register usage - -This section explains how to describe what registers the target machine -has, and how (in general) they can be used. - -The description of which registers a specific instruction can use is -done with register classes; see @ref{Register Classes}. For information -on using registers to access a stack frame, see @ref{Frame Registers}. -For passing values in registers, see @ref{Register Arguments}. -For returning values in registers, see @ref{Scalar Return}. - -@menu -* Register Basics:: Number and kinds of registers. -* Allocation Order:: Order in which registers are allocated. -* Values in Registers:: What kinds of values each reg can hold. -* Leaf Functions:: Renumbering registers for leaf functions. -* Stack Registers:: Handling a register stack such as 80387. -@end menu - -@node Register Basics -@subsection Basic Characteristics of Registers - -@c prevent bad page break with this line -Registers have various characteristics. - -@defmac FIRST_PSEUDO_REGISTER -Number of hardware registers known to the compiler. They receive -numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first -pseudo register's number really is assigned the number -@code{FIRST_PSEUDO_REGISTER}. -@end defmac - -@defmac FIXED_REGISTERS -@cindex fixed register -An initializer that says which registers are used for fixed purposes -all throughout the compiled code and are therefore not available for -general allocation. These would include the stack pointer, the frame -pointer (except on machines where that can be used as a general -register when no frame pointer is needed), the program counter on -machines where that is considered one of the addressable registers, -and any other numbered register with a standard use. - -This information is expressed as a sequence of numbers, separated by -commas and surrounded by braces. The @var{n}th number is 1 if -register @var{n} is fixed, 0 otherwise. - -The table initialized from this macro, and the table initialized by -the following one, may be overridden at run time either automatically, -by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by -the user with the command options @option{-ffixed-@var{reg}}, -@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}. -@end defmac - -@defmac CALL_USED_REGISTERS -@cindex call-used register -@cindex call-clobbered register -@cindex call-saved register -Like @code{FIXED_REGISTERS} but has 1 for each register that is -clobbered (in general) by function calls as well as for fixed -registers. This macro therefore identifies the registers that are not -available for general allocation of values that must live across -function calls. - -If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler -automatically saves it on function entry and restores it on function -exit, if the register is used within the function. -@end defmac - -@defmac CALL_REALLY_USED_REGISTERS -@cindex call-used register -@cindex call-clobbered register -@cindex call-saved register -Like @code{CALL_USED_REGISTERS} except this macro doesn't require -that the entire set of @code{FIXED_REGISTERS} be included. -(@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}). -This macro is optional. If not specified, it defaults to the value -of @code{CALL_USED_REGISTERS}. -@end defmac - -@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode}) -@cindex call-used register -@cindex call-clobbered register -@cindex call-saved register -A C expression that is nonzero if it is not permissible to store a -value of mode @var{mode} in hard register number @var{regno} across a -call without some part of it being clobbered. For most machines this -macro need not be defined. It is only required for machines that do not -preserve the entire contents of a register across a call. -@end defmac - -@findex fixed_regs -@findex call_used_regs -@findex global_regs -@findex reg_names -@findex reg_class_contents -@deftypefn {Target Hook} void TARGET_CONDITIONAL_REGISTER_USAGE (void) -This hook may conditionally modify five variables -@code{fixed_regs}, @code{call_used_regs}, @code{global_regs}, -@code{reg_names}, and @code{reg_class_contents}, to take into account -any dependence of these register sets on target flags. The first three -of these are of type @code{char []} (interpreted as Boolean vectors). -@code{global_regs} is a @code{const char *[]}, and -@code{reg_class_contents} is a @code{HARD_REG_SET}. Before the macro is -called, @code{fixed_regs}, @code{call_used_regs}, -@code{reg_class_contents}, and @code{reg_names} have been initialized -from @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS}, -@code{REG_CLASS_CONTENTS}, and @code{REGISTER_NAMES}, respectively. -@code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}}, -@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}} -command options have been applied. - -@cindex disabling certain registers -@cindex controlling register usage -If the usage of an entire class of registers depends on the target -flags, you may indicate this to GCC by using this macro to modify -@code{fixed_regs} and @code{call_used_regs} to 1 for each of the -registers in the classes which should not be used by GCC@. Also make -@code{define_register_constraint}s return @code{NO_REGS} for constraints -that shouldn't be used. - -(However, if this class is not included in @code{GENERAL_REGS} and all -of the insn patterns whose constraints permit this class are -controlled by target switches, then GCC will automatically avoid using -these registers when the target switches are opposed to them.) -@end deftypefn - -@defmac INCOMING_REGNO (@var{out}) -Define this macro if the target machine has register windows. This C -expression returns the register number as seen by the called function -corresponding to the register number @var{out} as seen by the calling -function. Return @var{out} if register number @var{out} is not an -outbound register. -@end defmac - -@defmac OUTGOING_REGNO (@var{in}) -Define this macro if the target machine has register windows. This C -expression returns the register number as seen by the calling function -corresponding to the register number @var{in} as seen by the called -function. Return @var{in} if register number @var{in} is not an inbound -register. -@end defmac - -@defmac LOCAL_REGNO (@var{regno}) -Define this macro if the target machine has register windows. This C -expression returns true if the register is call-saved but is in the -register window. Unlike most call-saved registers, such registers -need not be explicitly restored on function exit or during non-local -gotos. -@end defmac - -@defmac PC_REGNUM -If the program counter has a register number, define this as that -register number. Otherwise, do not define it. -@end defmac - -@node Allocation Order -@subsection Order of Allocation of Registers -@cindex order of register allocation -@cindex register allocation order - -@c prevent bad page break with this line -Registers are allocated in order. - -@defmac REG_ALLOC_ORDER -If defined, an initializer for a vector of integers, containing the -numbers of hard registers in the order in which GCC should prefer -to use them (from most preferred to least). - -If this macro is not defined, registers are used lowest numbered first -(all else being equal). - -One use of this macro is on machines where the highest numbered -registers must always be saved and the save-multiple-registers -instruction supports only sequences of consecutive registers. On such -machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists -the highest numbered allocable register first. -@end defmac - -@defmac ADJUST_REG_ALLOC_ORDER -A C statement (sans semicolon) to choose the order in which to allocate -hard registers for pseudo-registers local to a basic block. - -Store the desired register order in the array @code{reg_alloc_order}. -Element 0 should be the register to allocate first; element 1, the next -register; and so on. - -The macro body should not assume anything about the contents of -@code{reg_alloc_order} before execution of the macro. - -On most machines, it is not necessary to define this macro. -@end defmac - -@defmac HONOR_REG_ALLOC_ORDER -Normally, IRA tries to estimate the costs for saving a register in the -prologue and restoring it in the epilogue. This discourages it from -using call-saved registers. If a machine wants to ensure that IRA -allocates registers in the order given by REG_ALLOC_ORDER even if some -call-saved registers appear earlier than call-used ones, then define this -macro as a C expression to nonzero. Default is 0. -@end defmac - -@defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno}) -In some case register allocation order is not enough for the -Integrated Register Allocator (@acronym{IRA}) to generate a good code. -If this macro is defined, it should return a floating point value -based on @var{regno}. The cost of using @var{regno} for a pseudo will -be increased by approximately the pseudo's usage frequency times the -value returned by this macro. Not defining this macro is equivalent -to having it always return @code{0.0}. - -On most machines, it is not necessary to define this macro. -@end defmac - -@node Values in Registers -@subsection How Values Fit in Registers - -This section discusses the macros that describe which kinds of values -(specifically, which machine modes) each register can hold, and how many -consecutive registers are needed for a given mode. - -@defmac HARD_REGNO_NREGS (@var{regno}, @var{mode}) -A C expression for the number of consecutive hard registers, starting -at register number @var{regno}, required to hold a value of mode -@var{mode}. This macro must never return zero, even if a register -cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK -and/or CANNOT_CHANGE_MODE_CLASS instead. - -On a machine where all registers are exactly one word, a suitable -definition of this macro is - -@smallexample -#define HARD_REGNO_NREGS(REGNO, MODE) \ - ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ - / UNITS_PER_WORD) -@end smallexample -@end defmac - -@defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode}) -A C expression that is nonzero if a value of mode @var{mode}, stored -in memory, ends with padding that causes it to take up more space than -in registers starting at register number @var{regno} (as determined by -multiplying GCC's notion of the size of the register when containing -this mode by the number of registers returned by -@code{HARD_REGNO_NREGS}). By default this is zero. - -For example, if a floating-point value is stored in three 32-bit -registers but takes up 128 bits in memory, then this would be -nonzero. - -This macros only needs to be defined if there are cases where -@code{subreg_get_info} -would otherwise wrongly determine that a @code{subreg} can be -represented by an offset to the register number, when in fact such a -@code{subreg} would contain some of the padding not stored in -registers and so not be representable. -@end defmac - -@defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode}) -For values of @var{regno} and @var{mode} for which -@code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression -returning the greater number of registers required to hold the value -including any padding. In the example above, the value would be four. -@end defmac - -@defmac REGMODE_NATURAL_SIZE (@var{mode}) -Define this macro if the natural size of registers that hold values -of mode @var{mode} is not the word size. It is a C expression that -should give the natural size in bytes for the specified mode. It is -used by the register allocator to try to optimize its results. This -happens for example on SPARC 64-bit where the natural size of -floating-point registers is still 32-bit. -@end defmac - -@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode}) -A C expression that is nonzero if it is permissible to store a value -of mode @var{mode} in hard register number @var{regno} (or in several -registers starting with that one). For a machine where all registers -are equivalent, a suitable definition is - -@smallexample -#define HARD_REGNO_MODE_OK(REGNO, MODE) 1 -@end smallexample - -You need not include code to check for the numbers of fixed registers, -because the allocation mechanism considers them to be always occupied. - -@cindex register pairs -On some machines, double-precision values must be kept in even/odd -register pairs. You can implement that by defining this macro to reject -odd register numbers for such modes. - -The minimum requirement for a mode to be OK in a register is that the -@samp{mov@var{mode}} instruction pattern support moves between the -register and other hard register in the same class and that moving a -value into the register and back out not alter it. - -Since the same instruction used to move @code{word_mode} will work for -all narrower integer modes, it is not necessary on any machine for -@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided -you define patterns @samp{movhi}, etc., to take advantage of this. This -is useful because of the interaction between @code{HARD_REGNO_MODE_OK} -and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes -to be tieable. - -Many machines have special registers for floating point arithmetic. -Often people assume that floating point machine modes are allowed only -in floating point registers. This is not true. Any registers that -can hold integers can safely @emph{hold} a floating point machine -mode, whether or not floating arithmetic can be done on it in those -registers. Integer move instructions can be used to move the values. - -On some machines, though, the converse is true: fixed-point machine -modes may not go in floating registers. This is true if the floating -registers normalize any value stored in them, because storing a -non-floating value there would garble it. In this case, -@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in -floating registers. But if the floating registers do not automatically -normalize, if you can store any bit pattern in one and retrieve it -unchanged without a trap, then any machine mode may go in a floating -register, so you can define this macro to say so. - -The primary significance of special floating registers is rather that -they are the registers acceptable in floating point arithmetic -instructions. However, this is of no concern to -@code{HARD_REGNO_MODE_OK}. You handle it by writing the proper -constraints for those instructions. - -On some machines, the floating registers are especially slow to access, -so that it is better to store a value in a stack frame than in such a -register if floating point arithmetic is not being done. As long as the -floating registers are not in class @code{GENERAL_REGS}, they will not -be used unless some pattern's constraint asks for one. -@end defmac - -@defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to}) -A C expression that is nonzero if it is OK to rename a hard register -@var{from} to another hard register @var{to}. - -One common use of this macro is to prevent renaming of a register to -another register that is not saved by a prologue in an interrupt -handler. - -The default is always nonzero. -@end defmac - -@defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2}) -A C expression that is nonzero if a value of mode -@var{mode1} is accessible in mode @var{mode2} without copying. - -If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and -@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for -any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})} -should be nonzero. If they differ for any @var{r}, you should define -this macro to return zero unless some other mechanism ensures the -accessibility of the value in a narrower mode. - -You should define this macro to return nonzero in as many cases as -possible since doing so will allow GCC to perform better register -allocation. -@end defmac - -@deftypefn {Target Hook} bool TARGET_HARD_REGNO_SCRATCH_OK (unsigned int @var{regno}) -This target hook should return @code{true} if it is OK to use a hard register -@var{regno} as scratch reg in peephole2. - -One common use of this macro is to prevent using of a register that -is not saved by a prologue in an interrupt handler. - -The default version of this hook always returns @code{true}. -@end deftypefn - -@defmac AVOID_CCMODE_COPIES -Define this macro if the compiler should avoid copies to/from @code{CCmode} -registers. You should only define this macro if support for copying to/from -@code{CCmode} is incomplete. -@end defmac - -@node Leaf Functions -@subsection Handling Leaf Functions - -@cindex leaf functions -@cindex functions, leaf -On some machines, a leaf function (i.e., one which makes no calls) can run -more efficiently if it does not make its own register window. Often this -means it is required to receive its arguments in the registers where they -are passed by the caller, instead of the registers where they would -normally arrive. - -The special treatment for leaf functions generally applies only when -other conditions are met; for example, often they may use only those -registers for its own variables and temporaries. We use the term ``leaf -function'' to mean a function that is suitable for this special -handling, so that functions with no calls are not necessarily ``leaf -functions''. - -GCC assigns register numbers before it knows whether the function is -suitable for leaf function treatment. So it needs to renumber the -registers in order to output a leaf function. The following macros -accomplish this. - -@defmac LEAF_REGISTERS -Name of a char vector, indexed by hard register number, which -contains 1 for a register that is allowable in a candidate for leaf -function treatment. - -If leaf function treatment involves renumbering the registers, then the -registers marked here should be the ones before renumbering---those that -GCC would ordinarily allocate. The registers which will actually be -used in the assembler code, after renumbering, should not be marked with 1 -in this vector. - -Define this macro only if the target machine offers a way to optimize -the treatment of leaf functions. -@end defmac - -@defmac LEAF_REG_REMAP (@var{regno}) -A C expression whose value is the register number to which @var{regno} -should be renumbered, when a function is treated as a leaf function. - -If @var{regno} is a register number which should not appear in a leaf -function before renumbering, then the expression should yield @minus{}1, which -will cause the compiler to abort. - -Define this macro only if the target machine offers a way to optimize the -treatment of leaf functions, and registers need to be renumbered to do -this. -@end defmac - -@findex current_function_is_leaf -@findex current_function_uses_only_leaf_regs -@code{TARGET_ASM_FUNCTION_PROLOGUE} and -@code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions -specially. They can test the C variable @code{current_function_is_leaf} -which is nonzero for leaf functions. @code{current_function_is_leaf} is -set prior to local register allocation and is valid for the remaining -compiler passes. They can also test the C variable -@code{current_function_uses_only_leaf_regs} which is nonzero for leaf -functions which only use leaf registers. -@code{current_function_uses_only_leaf_regs} is valid after all passes -that modify the instructions have been run and is only useful if -@code{LEAF_REGISTERS} is defined. -@c changed this to fix overfull. ALSO: why the "it" at the beginning -@c of the next paragraph?! --mew 2feb93 - -@node Stack Registers -@subsection Registers That Form a Stack - -There are special features to handle computers where some of the -``registers'' form a stack. Stack registers are normally written by -pushing onto the stack, and are numbered relative to the top of the -stack. - -Currently, GCC can only handle one group of stack-like registers, and -they must be consecutively numbered. Furthermore, the existing -support for stack-like registers is specific to the 80387 floating -point coprocessor. If you have a new architecture that uses -stack-like registers, you will need to do substantial work on -@file{reg-stack.c} and write your machine description to cooperate -with it, as well as defining these macros. - -@defmac STACK_REGS -Define this if the machine has any stack-like registers. -@end defmac - -@defmac STACK_REG_COVER_CLASS -This is a cover class containing the stack registers. Define this if -the machine has any stack-like registers. -@end defmac - -@defmac FIRST_STACK_REG -The number of the first stack-like register. This one is the top -of the stack. -@end defmac - -@defmac LAST_STACK_REG -The number of the last stack-like register. This one is the bottom of -the stack. -@end defmac - -@node Register Classes -@section Register Classes -@cindex register class definitions -@cindex class definitions, register - -On many machines, the numbered registers are not all equivalent. -For example, certain registers may not be allowed for indexed addressing; -certain registers may not be allowed in some instructions. These machine -restrictions are described to the compiler using @dfn{register classes}. - -You define a number of register classes, giving each one a name and saying -which of the registers belong to it. Then you can specify register classes -that are allowed as operands to particular instruction patterns. - -@findex ALL_REGS -@findex NO_REGS -In general, each register will belong to several classes. In fact, one -class must be named @code{ALL_REGS} and contain all the registers. Another -class must be named @code{NO_REGS} and contain no registers. Often the -union of two classes will be another class; however, this is not required. - -@findex GENERAL_REGS -One of the classes must be named @code{GENERAL_REGS}. There is nothing -terribly special about the name, but the operand constraint letters -@samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is -the same as @code{ALL_REGS}, just define it as a macro which expands -to @code{ALL_REGS}. - -Order the classes so that if class @var{x} is contained in class @var{y} -then @var{x} has a lower class number than @var{y}. - -The way classes other than @code{GENERAL_REGS} are specified in operand -constraints is through machine-dependent operand constraint letters. -You can define such letters to correspond to various classes, then use -them in operand constraints. - -You must define the narrowest register classes for allocatable -registers, so that each class either has no subclasses, or that for -some mode, the move cost between registers within the class is -cheaper than moving a register in the class to or from memory -(@pxref{Costs}). - -You should define a class for the union of two classes whenever some -instruction allows both classes. For example, if an instruction allows -either a floating point (coprocessor) register or a general register for a -certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS} -which includes both of them. Otherwise you will get suboptimal code, -or even internal compiler errors when reload cannot find a register in the -class computed via @code{reg_class_subunion}. - -You must also specify certain redundant information about the register -classes: for each class, which classes contain it and which ones are -contained in it; for each pair of classes, the largest class contained -in their union. - -When a value occupying several consecutive registers is expected in a -certain class, all the registers used must belong to that class. -Therefore, register classes cannot be used to enforce a requirement for -a register pair to start with an even-numbered register. The way to -specify this requirement is with @code{HARD_REGNO_MODE_OK}. - -Register classes used for input-operands of bitwise-and or shift -instructions have a special requirement: each such class must have, for -each fixed-point machine mode, a subclass whose registers can transfer that -mode to or from memory. For example, on some machines, the operations for -single-byte values (@code{QImode}) are limited to certain registers. When -this is so, each register class that is used in a bitwise-and or shift -instruction must have a subclass consisting of registers from which -single-byte values can be loaded or stored. This is so that -@code{PREFERRED_RELOAD_CLASS} can always have a possible value to return. - -@deftp {Data type} {enum reg_class} -An enumerated type that must be defined with all the register class names -as enumerated values. @code{NO_REGS} must be first. @code{ALL_REGS} -must be the last register class, followed by one more enumerated value, -@code{LIM_REG_CLASSES}, which is not a register class but rather -tells how many classes there are. - -Each register class has a number, which is the value of casting -the class name to type @code{int}. The number serves as an index -in many of the tables described below. -@end deftp - -@defmac N_REG_CLASSES -The number of distinct register classes, defined as follows: - -@smallexample -#define N_REG_CLASSES (int) LIM_REG_CLASSES -@end smallexample -@end defmac - -@defmac REG_CLASS_NAMES -An initializer containing the names of the register classes as C string -constants. These names are used in writing some of the debugging dumps. -@end defmac - -@defmac REG_CLASS_CONTENTS -An initializer containing the contents of the register classes, as integers -which are bit masks. The @var{n}th integer specifies the contents of class -@var{n}. The way the integer @var{mask} is interpreted is that -register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1. - -When the machine has more than 32 registers, an integer does not suffice. -Then the integers are replaced by sub-initializers, braced groupings containing -several integers. Each sub-initializer must be suitable as an initializer -for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}. -In this situation, the first integer in each sub-initializer corresponds to -registers 0 through 31, the second integer to registers 32 through 63, and -so on. -@end defmac - -@defmac REGNO_REG_CLASS (@var{regno}) -A C expression whose value is a register class containing hard register -@var{regno}. In general there is more than one such class; choose a class -which is @dfn{minimal}, meaning that no smaller class also contains the -register. -@end defmac - -@defmac BASE_REG_CLASS -A macro whose definition is the name of the class to which a valid -base register must belong. A base register is one used in an address -which is the register value plus a displacement. -@end defmac - -@defmac MODE_BASE_REG_CLASS (@var{mode}) -This is a variation of the @code{BASE_REG_CLASS} macro which allows -the selection of a base register in a mode dependent manner. If -@var{mode} is VOIDmode then it should return the same value as -@code{BASE_REG_CLASS}. -@end defmac - -@defmac MODE_BASE_REG_REG_CLASS (@var{mode}) -A C expression whose value is the register class to which a valid -base register must belong in order to be used in a base plus index -register address. You should define this macro if base plus index -addresses have different requirements than other base register uses. -@end defmac - -@defmac MODE_CODE_BASE_REG_CLASS (@var{mode}, @var{address_space}, @var{outer_code}, @var{index_code}) -A C expression whose value is the register class to which a valid -base register for a memory reference in mode @var{mode} to address -space @var{address_space} must belong. @var{outer_code} and @var{index_code} -define the context in which the base register occurs. @var{outer_code} is -the code of the immediately enclosing expression (@code{MEM} for the top level -of an address, @code{ADDRESS} for something that occurs in an -@code{address_operand}). @var{index_code} is the code of the corresponding -index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise. -@end defmac - -@defmac INDEX_REG_CLASS -A macro whose definition is the name of the class to which a valid -index register must belong. An index register is one used in an -address where its value is either multiplied by a scale factor or -added to another register (as well as added to a displacement). -@end defmac - -@defmac REGNO_OK_FOR_BASE_P (@var{num}) -A C expression which is nonzero if register number @var{num} is -suitable for use as a base register in operand addresses. -@end defmac - -@defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode}) -A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that -that expression may examine the mode of the memory reference in -@var{mode}. You should define this macro if the mode of the memory -reference affects whether a register may be used as a base register. If -you define this macro, the compiler will use it instead of -@code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for -addresses that appear outside a @code{MEM}, i.e., as an -@code{address_operand}. -@end defmac - -@defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode}) -A C expression which is nonzero if register number @var{num} is suitable for -use as a base register in base plus index operand addresses, accessing -memory in mode @var{mode}. It may be either a suitable hard register or a -pseudo register that has been allocated such a hard register. You should -define this macro if base plus index addresses have different requirements -than other base register uses. - -Use of this macro is deprecated; please use the more general -@code{REGNO_MODE_CODE_OK_FOR_BASE_P}. -@end defmac - -@defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{address_space}, @var{outer_code}, @var{index_code}) -A C expression which is nonzero if register number @var{num} is -suitable for use as a base register in operand addresses, accessing -memory in mode @var{mode} in address space @var{address_space}. -This is similar to @code{REGNO_MODE_OK_FOR_BASE_P}, except -that that expression may examine the context in which the register -appears in the memory reference. @var{outer_code} is the code of the -immediately enclosing expression (@code{MEM} if at the top level of the -address, @code{ADDRESS} for something that occurs in an -@code{address_operand}). @var{index_code} is the code of the -corresponding index expression if @var{outer_code} is @code{PLUS}; -@code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses -that appear outside a @code{MEM}, i.e., as an @code{address_operand}. -@end defmac - -@defmac REGNO_OK_FOR_INDEX_P (@var{num}) -A C expression which is nonzero if register number @var{num} is -suitable for use as an index register in operand addresses. It may be -either a suitable hard register or a pseudo register that has been -allocated such a hard register. - -The difference between an index register and a base register is that -the index register may be scaled. If an address involves the sum of -two registers, neither one of them scaled, then either one may be -labeled the ``base'' and the other the ``index''; but whichever -labeling is used must fit the machine's constraints of which registers -may serve in each capacity. The compiler will try both labelings, -looking for one that is valid, and will reload one or both registers -only if neither labeling works. -@end defmac - -@deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RENAME_CLASS (reg_class_t @var{rclass}) -A target hook that places additional preference on the register class to use when it is necessary to rename a register in class @var{rclass} to another class, or perhaps @var{NO_REGS}, if no preferred register class is found or hook @code{preferred_rename_class} is not implemented. Sometimes returning a more restrictive class makes better code. For example, on ARM, thumb-2 instructions using @code{LO_REGS} may be smaller than instructions using @code{GENERIC_REGS}. By returning @code{LO_REGS} from @code{preferred_rename_class}, code size can be reduced. -@end deftypefn - -@deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass}) -A target hook that places additional restrictions on the register class -to use when it is necessary to copy value @var{x} into a register in class -@var{rclass}. The value is a register class; perhaps @var{rclass}, or perhaps -another, smaller class. - -The default version of this hook always returns value of @code{rclass} argument. - -Sometimes returning a more restrictive class makes better code. For -example, on the 68000, when @var{x} is an integer constant that is in range -for a @samp{moveq} instruction, the value of this macro is always -@code{DATA_REGS} as long as @var{rclass} includes the data registers. -Requiring a data register guarantees that a @samp{moveq} will be used. - -One case where @code{TARGET_PREFERRED_RELOAD_CLASS} must not return -@var{rclass} is if @var{x} is a legitimate constant which cannot be -loaded into some register class. By returning @code{NO_REGS} you can -force @var{x} into a memory location. For example, rs6000 can load -immediate values into general-purpose registers, but does not have an -instruction for loading an immediate value into a floating-point -register, so @code{TARGET_PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when -@var{x} is a floating-point constant. If the constant can't be loaded -into any kind of register, code generation will be better if -@code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead -of using @code{TARGET_PREFERRED_RELOAD_CLASS}. - -If an insn has pseudos in it after register allocation, reload will go -through the alternatives and call repeatedly @code{TARGET_PREFERRED_RELOAD_CLASS} -to find the best one. Returning @code{NO_REGS}, in this case, makes -reload add a @code{!} in front of the constraint: the x86 back-end uses -this feature to discourage usage of 387 registers when math is done in -the SSE registers (and vice versa). -@end deftypefn - -@defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) -A C expression that places additional restrictions on the register class -to use when it is necessary to copy value @var{x} into a register in class -@var{class}. The value is a register class; perhaps @var{class}, or perhaps -another, smaller class. On many machines, the following definition is -safe: - -@smallexample -#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS -@end smallexample - -Sometimes returning a more restrictive class makes better code. For -example, on the 68000, when @var{x} is an integer constant that is in range -for a @samp{moveq} instruction, the value of this macro is always -@code{DATA_REGS} as long as @var{class} includes the data registers. -Requiring a data register guarantees that a @samp{moveq} will be used. - -One case where @code{PREFERRED_RELOAD_CLASS} must not return -@var{class} is if @var{x} is a legitimate constant which cannot be -loaded into some register class. By returning @code{NO_REGS} you can -force @var{x} into a memory location. For example, rs6000 can load -immediate values into general-purpose registers, but does not have an -instruction for loading an immediate value into a floating-point -register, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when -@var{x} is a floating-point constant. If the constant can't be loaded -into any kind of register, code generation will be better if -@code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead -of using @code{TARGET_PREFERRED_RELOAD_CLASS}. - -If an insn has pseudos in it after register allocation, reload will go -through the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS} -to find the best one. Returning @code{NO_REGS}, in this case, makes -reload add a @code{!} in front of the constraint: the x86 back-end uses -this feature to discourage usage of 387 registers when math is done in -the SSE registers (and vice versa). -@end defmac - -@deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_OUTPUT_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass}) -Like @code{TARGET_PREFERRED_RELOAD_CLASS}, but for output reloads instead of -input reloads. - -The default version of this hook always returns value of @code{rclass} -argument. - -You can also use @code{TARGET_PREFERRED_OUTPUT_RELOAD_CLASS} to discourage -reload from using some alternatives, like @code{TARGET_PREFERRED_RELOAD_CLASS}. -@end deftypefn - -@defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class}) -A C expression that places additional restrictions on the register class -to use when it is necessary to be able to hold a value of mode -@var{mode} in a reload register for which class @var{class} would -ordinarily be used. - -Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when -there are certain modes that simply can't go in certain reload classes. - -The value is a register class; perhaps @var{class}, or perhaps another, -smaller class. - -Don't define this macro unless the target machine has limitations which -require the macro to do something nontrivial. -@end defmac - -@deftypefn {Target Hook} reg_class_t TARGET_SECONDARY_RELOAD (bool @var{in_p}, rtx @var{x}, reg_class_t @var{reload_class}, machine_mode @var{reload_mode}, secondary_reload_info *@var{sri}) -Many machines have some registers that cannot be copied directly to or -from memory or even from other types of registers. An example is the -@samp{MQ} register, which on most machines, can only be copied to or -from general registers, but not memory. Below, we shall be using the -term 'intermediate register' when a move operation cannot be performed -directly, but has to be done by copying the source into the intermediate -register first, and then copying the intermediate register to the -destination. An intermediate register always has the same mode as -source and destination. Since it holds the actual value being copied, -reload might apply optimizations to re-use an intermediate register -and eliding the copy from the source when it can determine that the -intermediate register still holds the required value. - -Another kind of secondary reload is required on some machines which -allow copying all registers to and from memory, but require a scratch -register for stores to some memory locations (e.g., those with symbolic -address on the RT, and those with certain symbolic address on the SPARC -when compiling PIC)@. Scratch registers need not have the same mode -as the value being copied, and usually hold a different value than -that being copied. Special patterns in the md file are needed to -describe how the copy is performed with the help of the scratch register; -these patterns also describe the number, register class(es) and mode(s) -of the scratch register(s). - -In some cases, both an intermediate and a scratch register are required. - -For input reloads, this target hook is called with nonzero @var{in_p}, -and @var{x} is an rtx that needs to be copied to a register of class -@var{reload_class} in @var{reload_mode}. For output reloads, this target -hook is called with zero @var{in_p}, and a register of class @var{reload_class} -needs to be copied to rtx @var{x} in @var{reload_mode}. - -If copying a register of @var{reload_class} from/to @var{x} requires -an intermediate register, the hook @code{secondary_reload} should -return the register class required for this intermediate register. -If no intermediate register is required, it should return NO_REGS. -If more than one intermediate register is required, describe the one -that is closest in the copy chain to the reload register. - -If scratch registers are needed, you also have to describe how to -perform the copy from/to the reload register to/from this -closest intermediate register. Or if no intermediate register is -required, but still a scratch register is needed, describe the -copy from/to the reload register to/from the reload operand @var{x}. - -You do this by setting @code{sri->icode} to the instruction code of a pattern -in the md file which performs the move. Operands 0 and 1 are the output -and input of this copy, respectively. Operands from operand 2 onward are -for scratch operands. These scratch operands must have a mode, and a -single-register-class -@c [later: or memory] -output constraint. - -When an intermediate register is used, the @code{secondary_reload} -hook will be called again to determine how to copy the intermediate -register to/from the reload operand @var{x}, so your hook must also -have code to handle the register class of the intermediate operand. - -@c [For later: maybe we'll allow multi-alternative reload patterns - -@c the port maintainer could name a mov pattern that has clobbers - -@c and match the constraints of input and output to determine the required -@c alternative. A restriction would be that constraints used to match -@c against reloads registers would have to be written as register class -@c constraints, or we need a new target macro / hook that tells us if an -@c arbitrary constraint can match an unknown register of a given class. -@c Such a macro / hook would also be useful in other places.] - - -@var{x} might be a pseudo-register or a @code{subreg} of a -pseudo-register, which could either be in a hard register or in memory. -Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is -in memory and the hard register number if it is in a register. - -Scratch operands in memory (constraint @code{"=m"} / @code{"=&m"}) are -currently not supported. For the time being, you will have to continue -to use @code{SECONDARY_MEMORY_NEEDED} for that purpose. - -@code{copy_cost} also uses this target hook to find out how values are -copied. If you want it to include some extra cost for the need to allocate -(a) scratch register(s), set @code{sri->extra_cost} to the additional cost. -Or if two dependent moves are supposed to have a lower cost than the sum -of the individual moves due to expected fortuitous scheduling and/or special -forwarding logic, you can set @code{sri->extra_cost} to a negative amount. -@end deftypefn - -@defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) -@defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) -@defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) -These macros are obsolete, new ports should use the target hook -@code{TARGET_SECONDARY_RELOAD} instead. - -These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD} -target hook. Older ports still define these macros to indicate to the -reload phase that it may -need to allocate at least one register for a reload in addition to the -register to contain the data. Specifically, if copying @var{x} to a -register @var{class} in @var{mode} requires an intermediate register, -you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the -largest register class all of whose registers can be used as -intermediate registers or scratch registers. - -If copying a register @var{class} in @var{mode} to @var{x} requires an -intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS} -was supposed to be defined be defined to return the largest register -class required. If the -requirements for input and output reloads were the same, the macro -@code{SECONDARY_RELOAD_CLASS} should have been used instead of defining both -macros identically. - -The values returned by these macros are often @code{GENERAL_REGS}. -Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x} -can be directly copied to or from a register of @var{class} in -@var{mode} without requiring a scratch register. Do not define this -macro if it would always return @code{NO_REGS}. - -If a scratch register is required (either with or without an -intermediate register), you were supposed to define patterns for -@samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required -(@pxref{Standard Names}. These patterns, which were normally -implemented with a @code{define_expand}, should be similar to the -@samp{mov@var{m}} patterns, except that operand 2 is the scratch -register. - -These patterns need constraints for the reload register and scratch -register that -contain a single register class. If the original reload register (whose -class is @var{class}) can meet the constraint given in the pattern, the -value returned by these macros is used for the class of the scratch -register. Otherwise, two additional reload registers are required. -Their classes are obtained from the constraints in the insn pattern. - -@var{x} might be a pseudo-register or a @code{subreg} of a -pseudo-register, which could either be in a hard register or in memory. -Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is -in memory and the hard register number if it is in a register. - -These macros should not be used in the case where a particular class of -registers can only be copied to memory and not to another class of -registers. In that case, secondary reload registers are not needed and -would not be helpful. Instead, a stack location must be used to perform -the copy and the @code{mov@var{m}} pattern should use memory as an -intermediate storage. This case often occurs between floating-point and -general registers. -@end defmac - -@defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m}) -Certain machines have the property that some registers cannot be copied -to some other registers without using memory. Define this macro on -those machines to be a C expression that is nonzero if objects of mode -@var{m} in registers of @var{class1} can only be copied to registers of -class @var{class2} by storing a register of @var{class1} into memory -and loading that memory location into a register of @var{class2}. - -Do not define this macro if its value would always be zero. -@end defmac - -@defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode}) -Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler -allocates a stack slot for a memory location needed for register copies. -If this macro is defined, the compiler instead uses the memory location -defined by this macro. - -Do not define this macro if you do not define -@code{SECONDARY_MEMORY_NEEDED}. -@end defmac - -@defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode}) -When the compiler needs a secondary memory location to copy between two -registers of mode @var{mode}, it normally allocates sufficient memory to -hold a quantity of @code{BITS_PER_WORD} bits and performs the store and -load operations in a mode that many bits wide and whose class is the -same as that of @var{mode}. - -This is right thing to do on most machines because it ensures that all -bits of the register are copied and prevents accesses to the registers -in a narrower mode, which some machines prohibit for floating-point -registers. - -However, this default behavior is not correct on some machines, such as -the DEC Alpha, that store short integers in floating-point registers -differently than in integer registers. On those machines, the default -widening will not work correctly and you must define this macro to -suppress that widening in some cases. See the file @file{alpha.h} for -details. - -Do not define this macro if you do not define -@code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that -is @code{BITS_PER_WORD} bits wide is correct for your machine. -@end defmac - -@deftypefn {Target Hook} bool TARGET_CLASS_LIKELY_SPILLED_P (reg_class_t @var{rclass}) -A target hook which returns @code{true} if pseudos that have been assigned -to registers of class @var{rclass} would likely be spilled because -registers of @var{rclass} are needed for spill registers. - -The default version of this target hook returns @code{true} if @var{rclass} -has exactly one register and @code{false} otherwise. On most machines, this -default should be used. For generally register-starved machines, such as -i386, or machines with right register constraints, such as SH, this hook -can be used to avoid excessive spilling. - -This hook is also used by some of the global intra-procedural code -transformations to throtle code motion, to avoid increasing register -pressure. -@end deftypefn - -@deftypefn {Target Hook} {unsigned char} TARGET_CLASS_MAX_NREGS (reg_class_t @var{rclass}, machine_mode @var{mode}) -A target hook returns the maximum number of consecutive registers -of class @var{rclass} needed to hold a value of mode @var{mode}. - -This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact, -the value returned by @code{TARGET_CLASS_MAX_NREGS (@var{rclass}, -@var{mode})} target hook should be the maximum value of -@code{HARD_REGNO_NREGS (@var{regno}, @var{mode})} for all @var{regno} -values in the class @var{rclass}. - -This target hook helps control the handling of multiple-word values -in the reload pass. - -The default version of this target hook returns the size of @var{mode} -in words. -@end deftypefn - -@defmac CLASS_MAX_NREGS (@var{class}, @var{mode}) -A C expression for the maximum number of consecutive registers -of class @var{class} needed to hold a value of mode @var{mode}. - -This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact, -the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})} -should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno}, -@var{mode})} for all @var{regno} values in the class @var{class}. - -This macro helps control the handling of multiple-word values -in the reload pass. -@end defmac - -@defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class}) -If defined, a C expression that returns nonzero for a @var{class} for which -a change from mode @var{from} to mode @var{to} is invalid. - -For the example, loading 32-bit integer or floating-point objects into -floating-point registers on the Alpha extends them to 64 bits. -Therefore loading a 64-bit object and then storing it as a 32-bit object -does not store the low-order 32 bits, as would be the case for a normal -register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS} -as below: - -@smallexample -#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ - (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ - ? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0) -@end smallexample -@end defmac - -@deftypefn {Target Hook} bool TARGET_LRA_P (void) -A target hook which returns true if we use LRA instead of reload pass. It means that LRA was ported to the target. The default version of this target hook returns always false. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_REGISTER_PRIORITY (int) -A target hook which returns the register priority number to which the register @var{hard_regno} belongs to. The bigger the number, the more preferable the hard register usage (when all other conditions are the same). This hook can be used to prefer some hard register over others in LRA. For example, some x86-64 register usage needs additional prefix which makes instructions longer. The hook can return lower priority number for such registers make them less favorable and as result making the generated code smaller. The default version of this target hook returns always zero. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_REGISTER_USAGE_LEVELING_P (void) -A target hook which returns true if we need register usage leveling. That means if a few hard registers are equally good for the assignment, we choose the least used hard register. The register usage leveling may be profitable for some targets. Don't use the usage leveling for targets with conditional execution or targets with big register files as it hurts if-conversion and cross-jumping optimizations. The default version of this target hook returns always false. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_DIFFERENT_ADDR_DISPLACEMENT_P (void) -A target hook which returns true if an address with the same structure can have different maximal legitimate displacement. For example, the displacement can depend on memory mode or on operand combinations in the insn. The default version of this target hook returns always false. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P (rtx @var{subst}) -A target hook which returns @code{true} if @var{subst} can't -substitute safely pseudos with equivalent memory values during -register allocation. -The default version of this target hook returns @code{false}. -On most machines, this default should be used. For generally -machines with non orthogonal register usage for addressing, such -as SH, this hook can be used to avoid excessive spilling. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT (rtx *@var{disp}, rtx *@var{offset}, machine_mode @var{mode}) -A target hook which returns @code{true} if *@var{disp} is -legitimezed to valid address displacement with subtracting *@var{offset} -at memory mode @var{mode}. -The default version of this target hook returns @code{false}. -This hook will benefit machines with limited base plus displacement -addressing. -@end deftypefn - -@deftypefn {Target Hook} reg_class_t TARGET_SPILL_CLASS (reg_class_t, @var{machine_mode}) -This hook defines a class of registers which could be used for spilling pseudos of the given mode and class, or @code{NO_REGS} if only memory should be used. Not defining this hook is equivalent to returning @code{NO_REGS} for all inputs. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_CSTORE_MODE (enum insn_code @var{icode}) -This hook defines the machine mode to use for the boolean result of conditional store patterns. The ICODE argument is the instruction code for the cstore being performed. Not definiting this hook is the same as accepting the mode encoded into operand 0 of the cstore expander patterns. -@end deftypefn - -@node Stack and Calling -@section Stack Layout and Calling Conventions -@cindex calling conventions - -@c prevent bad page break with this line -This describes the stack layout and calling conventions. - -@menu -* Frame Layout:: -* Exception Handling:: -* Stack Checking:: -* Frame Registers:: -* Elimination:: -* Stack Arguments:: -* Register Arguments:: -* Scalar Return:: -* Aggregate Return:: -* Caller Saves:: -* Function Entry:: -* Profiling:: -* Tail Calls:: -* Stack Smashing Protection:: -* Miscellaneous Register Hooks:: -@end menu - -@node Frame Layout -@subsection Basic Stack Layout -@cindex stack frame layout -@cindex frame layout - -@c prevent bad page break with this line -Here is the basic stack layout. - -@defmac STACK_GROWS_DOWNWARD -Define this macro if pushing a word onto the stack moves the stack -pointer to a smaller address. - -When we say, ``define this macro if @dots{}'', it means that the -compiler checks this macro only with @code{#ifdef} so the precise -definition used does not matter. -@end defmac - -@defmac STACK_PUSH_CODE -This macro defines the operation used when something is pushed -on the stack. In RTL, a push operation will be -@code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})} - -The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC}, -and @code{POST_INC}. Which of these is correct depends on -the stack direction and on whether the stack pointer points -to the last item on the stack or whether it points to the -space for the next item on the stack. - -The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is -defined, which is almost always right, and @code{PRE_INC} otherwise, -which is often wrong. -@end defmac - -@defmac FRAME_GROWS_DOWNWARD -Define this macro to nonzero value if the addresses of local variable slots -are at negative offsets from the frame pointer. -@end defmac - -@defmac ARGS_GROW_DOWNWARD -Define this macro if successive arguments to a function occupy decreasing -addresses on the stack. -@end defmac - -@defmac STARTING_FRAME_OFFSET -Offset from the frame pointer to the first local variable slot to be allocated. - -If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by -subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}. -Otherwise, it is found by adding the length of the first slot to the -value @code{STARTING_FRAME_OFFSET}. -@c i'm not sure if the above is still correct.. had to change it to get -@c rid of an overfull. --mew 2feb93 -@end defmac - -@defmac STACK_ALIGNMENT_NEEDED -Define to zero to disable final alignment of the stack during reload. -The nonzero default for this macro is suitable for most ports. - -On ports where @code{STARTING_FRAME_OFFSET} is nonzero or where there -is a register save block following the local block that doesn't require -alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable -stack alignment and do it in the backend. -@end defmac - -@defmac STACK_POINTER_OFFSET -Offset from the stack pointer register to the first location at which -outgoing arguments are placed. If not specified, the default value of -zero is used. This is the proper value for most machines. - -If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above -the first location at which outgoing arguments are placed. -@end defmac - -@defmac FIRST_PARM_OFFSET (@var{fundecl}) -Offset from the argument pointer register to the first argument's -address. On some machines it may depend on the data type of the -function. - -If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above -the first argument's address. -@end defmac - -@defmac STACK_DYNAMIC_OFFSET (@var{fundecl}) -Offset from the stack pointer register to an item dynamically allocated -on the stack, e.g., by @code{alloca}. - -The default value for this macro is @code{STACK_POINTER_OFFSET} plus the -length of the outgoing arguments. The default is correct for most -machines. See @file{function.c} for details. -@end defmac - -@defmac INITIAL_FRAME_ADDRESS_RTX -A C expression whose value is RTL representing the address of the initial -stack frame. This address is passed to @code{RETURN_ADDR_RTX} and -@code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable -default value will be used. Define this macro in order to make frame pointer -elimination work in the presence of @code{__builtin_frame_address (count)} and -@code{__builtin_return_address (count)} for @code{count} not equal to zero. -@end defmac - -@defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr}) -A C expression whose value is RTL representing the address in a stack -frame where the pointer to the caller's frame is stored. Assume that -@var{frameaddr} is an RTL expression for the address of the stack frame -itself. - -If you don't define this macro, the default is to return the value -of @var{frameaddr}---that is, the stack frame address is also the -address of the stack word that points to the previous frame. -@end defmac - -@defmac SETUP_FRAME_ADDRESSES -If defined, a C expression that produces the machine-specific code to -setup the stack so that arbitrary frames can be accessed. For example, -on the SPARC, we must flush all of the register windows to the stack -before we can access arbitrary stack frames. You will seldom need to -define this macro. -@end defmac - -@deftypefn {Target Hook} rtx TARGET_BUILTIN_SETJMP_FRAME_VALUE (void) -This target hook should return an rtx that is used to store -the address of the current frame into the built in @code{setjmp} buffer. -The default value, @code{virtual_stack_vars_rtx}, is correct for most -machines. One reason you may need to define this target hook is if -@code{hard_frame_pointer_rtx} is the appropriate value on your machine. -@end deftypefn - -@defmac FRAME_ADDR_RTX (@var{frameaddr}) -A C expression whose value is RTL representing the value of the frame -address for the current frame. @var{frameaddr} is the frame pointer -of the current frame. This is used for __builtin_frame_address. -You need only define this macro if the frame address is not the same -as the frame pointer. Most machines do not need to define it. -@end defmac - -@defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr}) -A C expression whose value is RTL representing the value of the return -address for the frame @var{count} steps up from the current frame, after -the prologue. @var{frameaddr} is the frame pointer of the @var{count} -frame, or the frame pointer of the @var{count} @minus{} 1 frame if -@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is nonzero. - -The value of the expression must always be the correct address when -@var{count} is zero, but may be @code{NULL_RTX} if there is no way to -determine the return address of other frames. -@end defmac - -@defmac RETURN_ADDR_IN_PREVIOUS_FRAME -Define this macro to nonzero value if the return address of a particular -stack frame is accessed from the frame pointer of the previous stack -frame. The zero default for this macro is suitable for most ports. -@end defmac - -@defmac INCOMING_RETURN_ADDR_RTX -A C expression whose value is RTL representing the location of the -incoming return address at the beginning of any function, before the -prologue. This RTL is either a @code{REG}, indicating that the return -value is saved in @samp{REG}, or a @code{MEM} representing a location in -the stack. - -You only need to define this macro if you want to support call frame -debugging information like that provided by DWARF 2. - -If this RTL is a @code{REG}, you should also define -@code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}. -@end defmac - -@defmac DWARF_ALT_FRAME_RETURN_COLUMN -A C expression whose value is an integer giving a DWARF 2 column -number that may be used as an alternative return column. The column -must not correspond to any gcc hard register (that is, it must not -be in the range of @code{DWARF_FRAME_REGNUM}). - -This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to a -general register, but an alternative column needs to be used for signal -frames. Some targets have also used different frame return columns -over time. -@end defmac - -@defmac DWARF_ZERO_REG -A C expression whose value is an integer giving a DWARF 2 register -number that is considered to always have the value zero. This should -only be defined if the target has an architected zero register, and -someone decided it was a good idea to use that register number to -terminate the stack backtrace. New ports should avoid this. -@end defmac - -@deftypefn {Target Hook} void TARGET_DWARF_HANDLE_FRAME_UNSPEC (const char *@var{label}, rtx @var{pattern}, int @var{index}) -This target hook allows the backend to emit frame-related insns that -contain UNSPECs or UNSPEC_VOLATILEs. The DWARF 2 call frame debugging -info engine will invoke it on insns of the form -@smallexample -(set (reg) (unspec [@dots{}] UNSPEC_INDEX)) -@end smallexample -and -@smallexample -(set (reg) (unspec_volatile [@dots{}] UNSPECV_INDEX)). -@end smallexample -to let the backend emit the call frame instructions. @var{label} is -the CFI label attached to the insn, @var{pattern} is the pattern of -the insn and @var{index} is @code{UNSPEC_INDEX} or @code{UNSPECV_INDEX}. -@end deftypefn - -@defmac INCOMING_FRAME_SP_OFFSET -A C expression whose value is an integer giving the offset, in bytes, -from the value of the stack pointer register to the top of the stack -frame at the beginning of any function, before the prologue. The top of -the frame is defined to be the value of the stack pointer in the -previous frame, just before the call instruction. - -You only need to define this macro if you want to support call frame -debugging information like that provided by DWARF 2. -@end defmac - -@defmac ARG_POINTER_CFA_OFFSET (@var{fundecl}) -A C expression whose value is an integer giving the offset, in bytes, -from the argument pointer to the canonical frame address (cfa). The -final value should coincide with that calculated by -@code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable -during virtual register instantiation. - -The default value for this macro is -@code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size}, -which is correct for most machines; in general, the arguments are found -immediately before the stack frame. Note that this is not the case on -some targets that save registers into the caller's frame, such as SPARC -and rs6000, and so such targets need to define this macro. - -You only need to define this macro if the default is incorrect, and you -want to support call frame debugging information like that provided by -DWARF 2. -@end defmac - -@defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl}) -If defined, a C expression whose value is an integer giving the offset -in bytes from the frame pointer to the canonical frame address (cfa). -The final value should coincide with that calculated by -@code{INCOMING_FRAME_SP_OFFSET}. - -Normally the CFA is calculated as an offset from the argument pointer, -via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is -variable due to the ABI, this may not be possible. If this macro is -defined, it implies that the virtual register instantiation should be -based on the frame pointer instead of the argument pointer. Only one -of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET} -should be defined. -@end defmac - -@defmac CFA_FRAME_BASE_OFFSET (@var{fundecl}) -If defined, a C expression whose value is an integer giving the offset -in bytes from the canonical frame address (cfa) to the frame base used -in DWARF 2 debug information. The default is zero. A different value -may reduce the size of debug information on some ports. -@end defmac - -@node Exception Handling -@subsection Exception Handling Support -@cindex exception handling - -@defmac EH_RETURN_DATA_REGNO (@var{N}) -A C expression whose value is the @var{N}th register number used for -data by exception handlers, or @code{INVALID_REGNUM} if fewer than -@var{N} registers are usable. - -The exception handling library routines communicate with the exception -handlers via a set of agreed upon registers. Ideally these registers -should be call-clobbered; it is possible to use call-saved registers, -but may negatively impact code size. The target must support at least -2 data registers, but should define 4 if there are enough free registers. - -You must define this macro if you want to support call frame exception -handling like that provided by DWARF 2. -@end defmac - -@defmac EH_RETURN_STACKADJ_RTX -A C expression whose value is RTL representing a location in which -to store a stack adjustment to be applied before function return. -This is used to unwind the stack to an exception handler's call frame. -It will be assigned zero on code paths that return normally. - -Typically this is a call-clobbered hard register that is otherwise -untouched by the epilogue, but could also be a stack slot. - -Do not define this macro if the stack pointer is saved and restored -by the regular prolog and epilog code in the call frame itself; in -this case, the exception handling library routines will update the -stack location to be restored in place. Otherwise, you must define -this macro if you want to support call frame exception handling like -that provided by DWARF 2. -@end defmac - -@defmac EH_RETURN_HANDLER_RTX -A C expression whose value is RTL representing a location in which -to store the address of an exception handler to which we should -return. It will not be assigned on code paths that return normally. - -Typically this is the location in the call frame at which the normal -return address is stored. For targets that return by popping an -address off the stack, this might be a memory address just below -the @emph{target} call frame rather than inside the current call -frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already -been assigned, so it may be used to calculate the location of the -target call frame. - -Some targets have more complex requirements than storing to an -address calculable during initial code generation. In that case -the @code{eh_return} instruction pattern should be used instead. - -If you want to support call frame exception handling, you must -define either this macro or the @code{eh_return} instruction pattern. -@end defmac - -@defmac RETURN_ADDR_OFFSET -If defined, an integer-valued C expression for which rtl will be generated -to add it to the exception handler address before it is searched in the -exception handling tables, and to subtract it again from the address before -using it to return to the exception handler. -@end defmac - -@defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global}) -This macro chooses the encoding of pointers embedded in the exception -handling sections. If at all possible, this should be defined such -that the exception handling section will not require dynamic relocations, -and so may be read-only. - -@var{code} is 0 for data, 1 for code labels, 2 for function pointers. -@var{global} is true if the symbol may be affected by dynamic relocations. -The macro should return a combination of the @code{DW_EH_PE_*} defines -as found in @file{dwarf2.h}. - -If this macro is not defined, pointers will not be encoded but -represented directly. -@end defmac - -@defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done}) -This macro allows the target to emit whatever special magic is required -to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}. -Generic code takes care of pc-relative and indirect encodings; this must -be defined if the target uses text-relative or data-relative encodings. - -This is a C statement that branches to @var{done} if the format was -handled. @var{encoding} is the format chosen, @var{size} is the number -of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF} -to be emitted. -@end defmac - -@defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs}) -This macro allows the target to add CPU and operating system specific -code to the call-frame unwinder for use when there is no unwind data -available. The most common reason to implement this macro is to unwind -through signal frames. - -This macro is called from @code{uw_frame_state_for} in -@file{unwind-dw2.c}, @file{unwind-dw2-xtensa.c} and -@file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context}; -@var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra} -for the address of the code being executed and @code{context->cfa} for -the stack pointer value. If the frame can be decoded, the register -save addresses should be updated in @var{fs} and the macro should -evaluate to @code{_URC_NO_REASON}. If the frame cannot be decoded, -the macro should evaluate to @code{_URC_END_OF_STACK}. - -For proper signal handling in Java this macro is accompanied by -@code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers. -@end defmac - -@defmac MD_HANDLE_UNWABI (@var{context}, @var{fs}) -This macro allows the target to add operating system specific code to the -call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive, -usually used for signal or interrupt frames. - -This macro is called from @code{uw_update_context} in libgcc's -@file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context}; -@var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi} -for the abi and context in the @code{.unwabi} directive. If the -@code{.unwabi} directive can be handled, the register save addresses should -be updated in @var{fs}. -@end defmac - -@defmac TARGET_USES_WEAK_UNWIND_INFO -A C expression that evaluates to true if the target requires unwind -info to be given comdat linkage. Define it to be @code{1} if comdat -linkage is necessary. The default is @code{0}. -@end defmac - -@node Stack Checking -@subsection Specifying How Stack Checking is Done - -GCC will check that stack references are within the boundaries of the -stack, if the option @option{-fstack-check} is specified, in one of -three ways: - -@enumerate -@item -If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC -will assume that you have arranged for full stack checking to be done -at appropriate places in the configuration files. GCC will not do -other special processing. - -@item -If @code{STACK_CHECK_BUILTIN} is zero and the value of the -@code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume -that you have arranged for static stack checking (checking of the -static stack frame of functions) to be done at appropriate places -in the configuration files. GCC will only emit code to do dynamic -stack checking (checking on dynamic stack allocations) using the third -approach below. - -@item -If neither of the above are true, GCC will generate code to periodically -``probe'' the stack pointer using the values of the macros defined below. -@end enumerate - -If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined, -GCC will change its allocation strategy for large objects if the option -@option{-fstack-check} is specified: they will always be allocated -dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes. - -@defmac STACK_CHECK_BUILTIN -A nonzero value if stack checking is done by the configuration files in a -machine-dependent manner. You should define this macro if stack checking -is required by the ABI of your machine or if you would like to do stack -checking in some more efficient way than the generic approach. The default -value of this macro is zero. -@end defmac - -@defmac STACK_CHECK_STATIC_BUILTIN -A nonzero value if static stack checking is done by the configuration files -in a machine-dependent manner. You should define this macro if you would -like to do static stack checking in some more efficient way than the generic -approach. The default value of this macro is zero. -@end defmac - -@defmac STACK_CHECK_PROBE_INTERVAL_EXP -An integer specifying the interval at which GCC must generate stack probe -instructions, defined as 2 raised to this integer. You will normally -define this macro so that the interval be no larger than the size of -the ``guard pages'' at the end of a stack area. The default value -of 12 (4096-byte interval) is suitable for most systems. -@end defmac - -@defmac STACK_CHECK_MOVING_SP -An integer which is nonzero if GCC should move the stack pointer page by page -when doing probes. This can be necessary on systems where the stack pointer -contains the bottom address of the memory area accessible to the executing -thread at any point in time. In this situation an alternate signal stack -is required in order to be able to recover from a stack overflow. The -default value of this macro is zero. -@end defmac - -@defmac STACK_CHECK_PROTECT -The number of bytes of stack needed to recover from a stack overflow, for -languages where such a recovery is supported. The default value of 75 words -with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and -8192 bytes with other exception handling mechanisms should be adequate for -most machines. -@end defmac - -The following macros are relevant only if neither STACK_CHECK_BUILTIN -nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether -in the opposite case. - -@defmac STACK_CHECK_MAX_FRAME_SIZE -The maximum size of a stack frame, in bytes. GCC will generate probe -instructions in non-leaf functions to ensure at least this many bytes of -stack are available. If a stack frame is larger than this size, stack -checking will not be reliable and GCC will issue a warning. The -default is chosen so that GCC only generates one instruction on most -systems. You should normally not change the default value of this macro. -@end defmac - -@defmac STACK_CHECK_FIXED_FRAME_SIZE -GCC uses this value to generate the above warning message. It -represents the amount of fixed frame used by a function, not including -space for any callee-saved registers, temporaries and user variables. -You need only specify an upper bound for this amount and will normally -use the default of four words. -@end defmac - -@defmac STACK_CHECK_MAX_VAR_SIZE -The maximum size, in bytes, of an object that GCC will place in the -fixed area of the stack frame when the user specifies -@option{-fstack-check}. -GCC computed the default from the values of the above macros and you will -normally not need to override that default. -@end defmac - -@need 2000 -@node Frame Registers -@subsection Registers That Address the Stack Frame - -@c prevent bad page break with this line -This discusses registers that address the stack frame. - -@defmac STACK_POINTER_REGNUM -The register number of the stack pointer register, which must also be a -fixed register according to @code{FIXED_REGISTERS}. On most machines, -the hardware determines which register this is. -@end defmac - -@defmac FRAME_POINTER_REGNUM -The register number of the frame pointer register, which is used to -access automatic variables in the stack frame. On some machines, the -hardware determines which register this is. On other machines, you can -choose any register you wish for this purpose. -@end defmac - -@defmac HARD_FRAME_POINTER_REGNUM -On some machines the offset between the frame pointer and starting -offset of the automatic variables is not known until after register -allocation has been done (for example, because the saved registers are -between these two locations). On those machines, define -@code{FRAME_POINTER_REGNUM} the number of a special, fixed register to -be used internally until the offset is known, and define -@code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number -used for the frame pointer. - -You should define this macro only in the very rare circumstances when it -is not possible to calculate the offset between the frame pointer and -the automatic variables until after register allocation has been -completed. When this macro is defined, you must also indicate in your -definition of @code{ELIMINABLE_REGS} how to eliminate -@code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM} -or @code{STACK_POINTER_REGNUM}. - -Do not define this macro if it would be the same as -@code{FRAME_POINTER_REGNUM}. -@end defmac - -@defmac ARG_POINTER_REGNUM -The register number of the arg pointer register, which is used to access -the function's argument list. On some machines, this is the same as the -frame pointer register. On some machines, the hardware determines which -register this is. On other machines, you can choose any register you -wish for this purpose. If this is not the same register as the frame -pointer register, then you must mark it as a fixed register according to -@code{FIXED_REGISTERS}, or arrange to be able to eliminate it -(@pxref{Elimination}). -@end defmac - -@defmac HARD_FRAME_POINTER_IS_FRAME_POINTER -Define this to a preprocessor constant that is nonzero if -@code{hard_frame_pointer_rtx} and @code{frame_pointer_rtx} should be -the same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM -== FRAME_POINTER_REGNUM)}; you only need to define this macro if that -definition is not suitable for use in preprocessor conditionals. -@end defmac - -@defmac HARD_FRAME_POINTER_IS_ARG_POINTER -Define this to a preprocessor constant that is nonzero if -@code{hard_frame_pointer_rtx} and @code{arg_pointer_rtx} should be the -same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM == -ARG_POINTER_REGNUM)}; you only need to define this macro if that -definition is not suitable for use in preprocessor conditionals. -@end defmac - -@defmac RETURN_ADDRESS_POINTER_REGNUM -The register number of the return address pointer register, which is used to -access the current function's return address from the stack. On some -machines, the return address is not at a fixed offset from the frame -pointer or stack pointer or argument pointer. This register can be defined -to point to the return address on the stack, and then be converted by -@code{ELIMINABLE_REGS} into either the frame pointer or stack pointer. - -Do not define this macro unless there is no other way to get the return -address from the stack. -@end defmac - -@defmac STATIC_CHAIN_REGNUM -@defmacx STATIC_CHAIN_INCOMING_REGNUM -Register numbers used for passing a function's static chain pointer. If -register windows are used, the register number as seen by the called -function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register -number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If -these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need -not be defined. - -The static chain register need not be a fixed register. - -If the static chain is passed in memory, these macros should not be -defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used. -@end defmac - -@deftypefn {Target Hook} rtx TARGET_STATIC_CHAIN (const_tree @var{fndecl_or_type}, bool @var{incoming_p}) -This hook replaces the use of @code{STATIC_CHAIN_REGNUM} et al for -targets that may use different static chain locations for different -nested functions. This may be required if the target has function -attributes that affect the calling conventions of the function and -those calling conventions use different static chain locations. - -The default version of this hook uses @code{STATIC_CHAIN_REGNUM} et al. - -If the static chain is passed in memory, this hook should be used to -provide rtx giving @code{mem} expressions that denote where they are stored. -Often the @code{mem} expression as seen by the caller will be at an offset -from the stack pointer and the @code{mem} expression as seen by the callee -will be at an offset from the frame pointer. -@findex stack_pointer_rtx -@findex frame_pointer_rtx -@findex arg_pointer_rtx -The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and -@code{arg_pointer_rtx} will have been initialized and should be used -to refer to those items. -@end deftypefn - -@defmac DWARF_FRAME_REGISTERS -This macro specifies the maximum number of hard registers that can be -saved in a call frame. This is used to size data structures used in -DWARF2 exception handling. - -Prior to GCC 3.0, this macro was needed in order to establish a stable -exception handling ABI in the face of adding new hard registers for ISA -extensions. In GCC 3.0 and later, the EH ABI is insulated from changes -in the number of hard registers. Nevertheless, this macro can still be -used to reduce the runtime memory requirements of the exception handling -routines, which can be substantial if the ISA contains a lot of -registers that are not call-saved. - -If this macro is not defined, it defaults to -@code{FIRST_PSEUDO_REGISTER}. -@end defmac - -@defmac PRE_GCC3_DWARF_FRAME_REGISTERS - -This macro is similar to @code{DWARF_FRAME_REGISTERS}, but is provided -for backward compatibility in pre GCC 3.0 compiled code. - -If this macro is not defined, it defaults to -@code{DWARF_FRAME_REGISTERS}. -@end defmac - -@defmac DWARF_REG_TO_UNWIND_COLUMN (@var{regno}) - -Define this macro if the target's representation for dwarf registers -is different than the internal representation for unwind column. -Given a dwarf register, this macro should return the internal unwind -column number to use instead. - -See the PowerPC's SPE target for an example. -@end defmac - -@defmac DWARF_FRAME_REGNUM (@var{regno}) - -Define this macro if the target's representation for dwarf registers -used in .eh_frame or .debug_frame is different from that used in other -debug info sections. Given a GCC hard register number, this macro -should return the .eh_frame register number. The default is -@code{DBX_REGISTER_NUMBER (@var{regno})}. - -@end defmac - -@defmac DWARF2_FRAME_REG_OUT (@var{regno}, @var{for_eh}) - -Define this macro to map register numbers held in the call frame info -that GCC has collected using @code{DWARF_FRAME_REGNUM} to those that -should be output in .debug_frame (@code{@var{for_eh}} is zero) and -.eh_frame (@code{@var{for_eh}} is nonzero). The default is to -return @code{@var{regno}}. - -@end defmac - -@defmac REG_VALUE_IN_UNWIND_CONTEXT - -Define this macro if the target stores register values as -@code{_Unwind_Word} type in unwind context. It should be defined if -target register size is larger than the size of @code{void *}. The -default is to store register values as @code{void *} type. - -@end defmac - -@defmac ASSUME_EXTENDED_UNWIND_CONTEXT - -Define this macro to be 1 if the target always uses extended unwind -context with version, args_size and by_value fields. If it is undefined, -it will be defined to 1 when @code{REG_VALUE_IN_UNWIND_CONTEXT} is -defined and 0 otherwise. - -@end defmac - -@node Elimination -@subsection Eliminating Frame Pointer and Arg Pointer - -@c prevent bad page break with this line -This is about eliminating the frame pointer and arg pointer. - -@deftypefn {Target Hook} bool TARGET_FRAME_POINTER_REQUIRED (void) -This target hook should return @code{true} if a function must have and use -a frame pointer. This target hook is called in the reload pass. If its return -value is @code{true} the function will have a frame pointer. - -This target hook can in principle examine the current function and decide -according to the facts, but on most machines the constant @code{false} or the -constant @code{true} suffices. Use @code{false} when the machine allows code -to be generated with no frame pointer, and doing so saves some time or space. -Use @code{true} when there is no possible advantage to avoiding a frame -pointer. - -In certain cases, the compiler does not know how to produce valid code -without a frame pointer. The compiler recognizes those cases and -automatically gives the function a frame pointer regardless of what -@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about -them. - -In a function that does not require a frame pointer, the frame pointer -register can be allocated for ordinary usage, unless you mark it as a -fixed register. See @code{FIXED_REGISTERS} for more information. - -Default return value is @code{false}. -@end deftypefn - -@findex get_frame_size -@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var}) -A C statement to store in the variable @var{depth-var} the difference -between the frame pointer and the stack pointer values immediately after -the function prologue. The value would be computed from information -such as the result of @code{get_frame_size ()} and the tables of -registers @code{regs_ever_live} and @code{call_used_regs}. - -If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and -need not be defined. Otherwise, it must be defined even if -@code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that -case, you may set @var{depth-var} to anything. -@end defmac - -@defmac ELIMINABLE_REGS -If defined, this macro specifies a table of register pairs used to -eliminate unneeded registers that point into the stack frame. If it is not -defined, the only elimination attempted by the compiler is to replace -references to the frame pointer with references to the stack pointer. - -The definition of this macro is a list of structure initializations, each -of which specifies an original and replacement register. - -On some machines, the position of the argument pointer is not known until -the compilation is completed. In such a case, a separate hard register -must be used for the argument pointer. This register can be eliminated by -replacing it with either the frame pointer or the argument pointer, -depending on whether or not the frame pointer has been eliminated. - -In this case, you might specify: -@smallexample -#define ELIMINABLE_REGS \ -@{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \ - @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \ - @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@} -@end smallexample - -Note that the elimination of the argument pointer with the stack pointer is -specified first since that is the preferred elimination. -@end defmac - -@deftypefn {Target Hook} bool TARGET_CAN_ELIMINATE (const int @var{from_reg}, const int @var{to_reg}) -This target hook should returns @code{true} if the compiler is allowed to -try to replace register number @var{from_reg} with register number -@var{to_reg}. This target hook need only be defined if @code{ELIMINABLE_REGS} -is defined, and will usually be @code{true}, since most of the cases -preventing register elimination are things that the compiler already -knows about. - -Default return value is @code{true}. -@end deftypefn - -@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var}) -This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It -specifies the initial difference between the specified pair of -registers. This macro must be defined if @code{ELIMINABLE_REGS} is -defined. -@end defmac - -@node Stack Arguments -@subsection Passing Function Arguments on the Stack -@cindex arguments on stack -@cindex stack arguments - -The macros in this section control how arguments are passed -on the stack. See the following section for other macros that -control passing certain arguments in registers. - -@deftypefn {Target Hook} bool TARGET_PROMOTE_PROTOTYPES (const_tree @var{fntype}) -This target hook returns @code{true} if an argument declared in a -prototype as an integral type smaller than @code{int} should actually be -passed as an @code{int}. In addition to avoiding errors in certain -cases of mismatch, it also makes for better code on certain machines. -The default is to not promote prototypes. -@end deftypefn - -@defmac PUSH_ARGS -A C expression. If nonzero, push insns will be used to pass -outgoing arguments. -If the target machine does not have a push instruction, set it to zero. -That directs GCC to use an alternate strategy: to -allocate the entire argument block and then store the arguments into -it. When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too. -@end defmac - -@defmac PUSH_ARGS_REVERSED -A C expression. If nonzero, function arguments will be evaluated from -last to first, rather than from first to last. If this macro is not -defined, it defaults to @code{PUSH_ARGS} on targets where the stack -and args grow in opposite directions, and 0 otherwise. -@end defmac - -@defmac PUSH_ROUNDING (@var{npushed}) -A C expression that is the number of bytes actually pushed onto the -stack when an instruction attempts to push @var{npushed} bytes. - -On some machines, the definition - -@smallexample -#define PUSH_ROUNDING(BYTES) (BYTES) -@end smallexample - -@noindent -will suffice. But on other machines, instructions that appear -to push one byte actually push two bytes in an attempt to maintain -alignment. Then the definition should be - -@smallexample -#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) -@end smallexample - -If the value of this macro has a type, it should be an unsigned type. -@end defmac - -@findex outgoing_args_size -@findex crtl->outgoing_args_size -@defmac ACCUMULATE_OUTGOING_ARGS -A C expression. If nonzero, the maximum amount of space required for outgoing arguments -will be computed and placed into -@code{crtl->outgoing_args_size}. No space will be pushed -onto the stack for each call; instead, the function prologue should -increase the stack frame size by this amount. - -Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS} -is not proper. -@end defmac - -@defmac REG_PARM_STACK_SPACE (@var{fndecl}) -Define this macro if functions should assume that stack space has been -allocated for arguments even when their values are passed in -registers. - -The value of this macro is the size, in bytes, of the area reserved for -arguments passed in registers for the function represented by @var{fndecl}, -which can be zero if GCC is calling a library function. -The argument @var{fndecl} can be the FUNCTION_DECL, or the type itself -of the function. - -This space can be allocated by the caller, or be a part of the -machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says -which. -@end defmac -@c above is overfull. not sure what to do. --mew 5feb93 did -@c something, not sure if it looks good. --mew 10feb93 - -@defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) -Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. -Define this macro if space guaranteed when compiling a function body -is different to space required when making a call, a situation that -can arise with K&R style function definitions. -@end defmac - -@defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) -Define this to a nonzero value if it is the responsibility of the -caller to allocate the area reserved for arguments passed in registers -when calling a function of @var{fntype}. @var{fntype} may be NULL -if the function called is a library function. - -If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls -whether the space for these arguments counts in the value of -@code{crtl->outgoing_args_size}. -@end defmac - -@defmac STACK_PARMS_IN_REG_PARM_AREA -Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the -stack parameters don't skip the area specified by it. -@c i changed this, makes more sens and it should have taken care of the -@c overfull.. not as specific, tho. --mew 5feb93 - -Normally, when a parameter is not passed in registers, it is placed on the -stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro -suppresses this behavior and causes the parameter to be passed on the -stack in its natural location. -@end defmac - -@deftypefn {Target Hook} int TARGET_RETURN_POPS_ARGS (tree @var{fundecl}, tree @var{funtype}, int @var{size}) -This target hook returns the number of bytes of its own arguments that -a function pops on returning, or 0 if the function pops no arguments -and the caller must therefore pop them all after the function returns. - -@var{fundecl} is a C variable whose value is a tree node that describes -the function in question. Normally it is a node of type -@code{FUNCTION_DECL} that describes the declaration of the function. -From this you can obtain the @code{DECL_ATTRIBUTES} of the function. - -@var{funtype} is a C variable whose value is a tree node that -describes the function in question. Normally it is a node of type -@code{FUNCTION_TYPE} that describes the data type of the function. -From this it is possible to obtain the data types of the value and -arguments (if known). - -When a call to a library function is being considered, @var{fundecl} -will contain an identifier node for the library function. Thus, if -you need to distinguish among various library functions, you can do so -by their names. Note that ``library function'' in this context means -a function used to perform arithmetic, whose name is known specially -in the compiler and was not mentioned in the C code being compiled. - -@var{size} is the number of bytes of arguments passed on the -stack. If a variable number of bytes is passed, it is zero, and -argument popping will always be the responsibility of the calling function. - -On the VAX, all functions always pop their arguments, so the definition -of this macro is @var{size}. On the 68000, using the standard -calling convention, no functions pop their arguments, so the value of -the macro is always 0 in this case. But an alternative calling -convention is available in which functions that take a fixed number of -arguments pop them but other functions (such as @code{printf}) pop -nothing (the caller pops all). When this convention is in use, -@var{funtype} is examined to determine whether a function takes a fixed -number of arguments. -@end deftypefn - -@defmac CALL_POPS_ARGS (@var{cum}) -A C expression that should indicate the number of bytes a call sequence -pops off the stack. It is added to the value of @code{RETURN_POPS_ARGS} -when compiling a function call. - -@var{cum} is the variable in which all arguments to the called function -have been accumulated. - -On certain architectures, such as the SH5, a call trampoline is used -that pops certain registers off the stack, depending on the arguments -that have been passed to the function. Since this is a property of the -call site, not of the called function, @code{RETURN_POPS_ARGS} is not -appropriate. -@end defmac - -@node Register Arguments -@subsection Passing Arguments in Registers -@cindex arguments in registers -@cindex registers arguments - -This section describes the macros which let you control how various -types of arguments are passed in registers or how they are arranged in -the stack. - -@deftypefn {Target Hook} rtx TARGET_FUNCTION_ARG (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) -Return an RTX indicating whether a function argument is passed in a -register and if so, which register. - -The arguments are @var{ca}, which summarizes all the previous -arguments; @var{mode}, the machine mode of the argument; @var{type}, -the data type of the argument as a tree node or 0 if that is not known -(which happens for C support library functions); and @var{named}, -which is @code{true} for an ordinary argument and @code{false} for -nameless arguments that correspond to @samp{@dots{}} in the called -function's prototype. @var{type} can be an incomplete type if a -syntax error has previously occurred. - -The return value is usually either a @code{reg} RTX for the hard -register in which to pass the argument, or zero to pass the argument -on the stack. - -The return value can be a @code{const_int} which means argument is -passed in a target specific slot with specified number. Target hooks -should be used to store or load argument in such case. See -@code{TARGET_STORE_BOUNDS_FOR_ARG} and @code{TARGET_LOAD_BOUNDS_FOR_ARG} -for more information. - -The value of the expression can also be a @code{parallel} RTX@. This is -used when an argument is passed in multiple locations. The mode of the -@code{parallel} should be the mode of the entire argument. The -@code{parallel} holds any number of @code{expr_list} pairs; each one -describes where part of the argument is passed. In each -@code{expr_list} the first operand must be a @code{reg} RTX for the hard -register in which to pass this part of the argument, and the mode of the -register RTX indicates how large this part of the argument is. The -second operand of the @code{expr_list} is a @code{const_int} which gives -the offset in bytes into the entire argument of where this part starts. -As a special exception the first @code{expr_list} in the @code{parallel} -RTX may have a first operand of zero. This indicates that the entire -argument is also stored on the stack. - -The last time this hook is called, it is called with @code{MODE == -VOIDmode}, and its result is passed to the @code{call} or @code{call_value} -pattern as operands 2 and 3 respectively. - -@cindex @file{stdarg.h} and register arguments -The usual way to make the ISO library @file{stdarg.h} work on a -machine where some arguments are usually passed in registers, is to -cause nameless arguments to be passed on the stack instead. This is -done by making @code{TARGET_FUNCTION_ARG} return 0 whenever -@var{named} is @code{false}. - -@cindex @code{TARGET_MUST_PASS_IN_STACK}, and @code{TARGET_FUNCTION_ARG} -@cindex @code{REG_PARM_STACK_SPACE}, and @code{TARGET_FUNCTION_ARG} -You may use the hook @code{targetm.calls.must_pass_in_stack} -in the definition of this macro to determine if this argument is of a -type that must be passed in the stack. If @code{REG_PARM_STACK_SPACE} -is not defined and @code{TARGET_FUNCTION_ARG} returns nonzero for such an -argument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} is -defined, the argument will be computed in the stack and then loaded into -a register. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_MUST_PASS_IN_STACK (machine_mode @var{mode}, const_tree @var{type}) -This target hook should return @code{true} if we should not pass @var{type} -solely in registers. The file @file{expr.h} defines a -definition that is usually appropriate, refer to @file{expr.h} for additional -documentation. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) -Define this hook if the target machine has ``register windows'', so -that the register in which a function sees an arguments is not -necessarily the same as the one in which the caller passed the -argument. - -For such machines, @code{TARGET_FUNCTION_ARG} computes the register in -which the caller passes the value, and -@code{TARGET_FUNCTION_INCOMING_ARG} should be defined in a similar -fashion to tell the function being called where the arguments will -arrive. - -If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined, -@code{TARGET_FUNCTION_ARG} serves both purposes. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_USE_PSEUDO_PIC_REG (void) -This hook should return 1 in case pseudo register should be created -for pic_offset_table_rtx during function expand. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_INIT_PIC_REG (void) -Perform a target dependent initialization of pic_offset_table_rtx. -This hook is called at the start of register allocation. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_ARG_PARTIAL_BYTES (cumulative_args_t @var{cum}, machine_mode @var{mode}, tree @var{type}, bool @var{named}) -This target hook returns the number of bytes at the beginning of an -argument that must be put in registers. The value must be zero for -arguments that are passed entirely in registers or that are entirely -pushed on the stack. - -On some machines, certain arguments must be passed partially in -registers and partially in memory. On these machines, typically the -first few words of arguments are passed in registers, and the rest -on the stack. If a multi-word argument (a @code{double} or a -structure) crosses that boundary, its first few words must be passed -in registers and the rest must be pushed. This macro tells the -compiler when this occurs, and how many bytes should go in registers. - -@code{TARGET_FUNCTION_ARG} for these arguments should return the first -register to be used by the caller for this argument; likewise -@code{TARGET_FUNCTION_INCOMING_ARG}, for the called function. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_PASS_BY_REFERENCE (cumulative_args_t @var{cum}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) -This target hook should return @code{true} if an argument at the -position indicated by @var{cum} should be passed by reference. This -predicate is queried after target independent reasons for being -passed by reference, such as @code{TREE_ADDRESSABLE (type)}. - -If the hook returns true, a copy of that argument is made in memory and a -pointer to the argument is passed instead of the argument itself. -The pointer is passed in whatever way is appropriate for passing a pointer -to that type. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CALLEE_COPIES (cumulative_args_t @var{cum}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) -The function argument described by the parameters to this hook is -known to be passed by reference. The hook should return true if the -function argument should be copied by the callee instead of copied -by the caller. - -For any argument for which the hook returns true, if it can be -determined that the argument is not modified, then a copy need -not be generated. - -The default version of this hook always returns false. -@end deftypefn - -@defmac CUMULATIVE_ARGS -A C type for declaring a variable that is used as the first argument -of @code{TARGET_FUNCTION_ARG} and other related values. For some -target machines, the type @code{int} suffices and can hold the number -of bytes of argument so far. - -There is no need to record in @code{CUMULATIVE_ARGS} anything about the -arguments that have been passed on the stack. The compiler has other -variables to keep track of that. For target machines on which all -arguments are passed on the stack, there is no need to store anything in -@code{CUMULATIVE_ARGS}; however, the data structure must exist and -should not be empty, so use @code{int}. -@end defmac - -@defmac OVERRIDE_ABI_FORMAT (@var{fndecl}) -If defined, this macro is called before generating any code for a -function, but after the @var{cfun} descriptor for the function has been -created. The back end may use this macro to update @var{cfun} to -reflect an ABI other than that which would normally be used by default. -If the compiler is generating code for a compiler-generated function, -@var{fndecl} may be @code{NULL}. -@end defmac - -@defmac INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{fndecl}, @var{n_named_args}) -A C statement (sans semicolon) for initializing the variable -@var{cum} for the state at the beginning of the argument list. The -variable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype} -is the tree node for the data type of the function which will receive -the args, or 0 if the args are to a compiler support library function. -For direct calls that are not libcalls, @var{fndecl} contain the -declaration node of the function. @var{fndecl} is also set when -@code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function -being compiled. @var{n_named_args} is set to the number of named -arguments, including a structure return address if it is passed as a -parameter, when making a call. When processing incoming arguments, -@var{n_named_args} is set to @minus{}1. - -When processing a call to a compiler support library function, -@var{libname} identifies which one. It is a @code{symbol_ref} rtx which -contains the name of the function, as a string. @var{libname} is 0 when -an ordinary C function call is being processed. Thus, each time this -macro is called, either @var{libname} or @var{fntype} is nonzero, but -never both of them at once. -@end defmac - -@defmac INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname}) -Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls, -it gets a @code{MODE} argument instead of @var{fntype}, that would be -@code{NULL}. @var{indirect} would always be zero, too. If this macro -is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname, -0)} is used instead. -@end defmac - -@defmac INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname}) -Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of -finding the arguments for the function being compiled. If this macro is -undefined, @code{INIT_CUMULATIVE_ARGS} is used instead. - -The value passed for @var{libname} is always 0, since library routines -with special calling conventions are never compiled with GCC@. The -argument @var{libname} exists for symmetry with -@code{INIT_CUMULATIVE_ARGS}. -@c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe. -@c --mew 5feb93 i switched the order of the sentences. --mew 10feb93 -@end defmac - -@deftypefn {Target Hook} void TARGET_FUNCTION_ARG_ADVANCE (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) -This hook updates the summarizer variable pointed to by @var{ca} to -advance past an argument in the argument list. The values @var{mode}, -@var{type} and @var{named} describe that argument. Once this is done, -the variable @var{cum} is suitable for analyzing the @emph{following} -argument with @code{TARGET_FUNCTION_ARG}, etc. - -This hook need not do anything if the argument in question was passed -on the stack. The compiler knows how to track the amount of stack space -used for arguments without any special help. -@end deftypefn - -@defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type}) -If defined, a C expression that is the number of bytes to add to the -offset of the argument passed in memory. This is needed for the SPU, -which passes @code{char} and @code{short} arguments in the preferred -slot that is in the middle of the quad word instead of starting at the -top. -@end defmac - -@defmac FUNCTION_ARG_PADDING (@var{mode}, @var{type}) -If defined, a C expression which determines whether, and in which direction, -to pad out an argument with extra space. The value should be of type -@code{enum direction}: either @code{upward} to pad above the argument, -@code{downward} to pad below, or @code{none} to inhibit padding. - -The @emph{amount} of padding is not controlled by this macro, but by the -target hook @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. It is -always just enough to reach the next multiple of that boundary. - -This macro has a default definition which is right for most systems. -For little-endian machines, the default is to pad upward. For -big-endian machines, the default is to pad downward for an argument of -constant size shorter than an @code{int}, and upward otherwise. -@end defmac - -@defmac PAD_VARARGS_DOWN -If defined, a C expression which determines whether the default -implementation of va_arg will attempt to pad down before reading the -next argument, if that argument is smaller than its aligned space as -controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such -arguments are padded down if @code{BYTES_BIG_ENDIAN} is true. -@end defmac - -@defmac BLOCK_REG_PADDING (@var{mode}, @var{type}, @var{first}) -Specify padding for the last element of a block move between registers and -memory. @var{first} is nonzero if this is the only element. Defining this -macro allows better control of register function parameters on big-endian -machines, without using @code{PARALLEL} rtl. In particular, -@code{MUST_PASS_IN_STACK} need not test padding and mode of types in -registers, as there is no longer a "wrong" part of a register; For example, -a three byte aggregate may be passed in the high part of a register if so -required. -@end defmac - -@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_BOUNDARY (machine_mode @var{mode}, const_tree @var{type}) -This hook returns the alignment boundary, in bits, of an argument -with the specified mode and type. The default hook returns -@code{PARM_BOUNDARY} for all arguments. -@end deftypefn - -@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY (machine_mode @var{mode}, const_tree @var{type}) -Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY}, -which is the default value for this hook. You can define this hook to -return a different value if an argument size must be rounded to a larger -value. -@end deftypefn - -@defmac FUNCTION_ARG_REGNO_P (@var{regno}) -A C expression that is nonzero if @var{regno} is the number of a hard -register in which function arguments are sometimes passed. This does -@emph{not} include implicit arguments such as the static chain and -the structure-value address. On many machines, no registers can be -used for this purpose since all function arguments are pushed on the -stack. -@end defmac - -@deftypefn {Target Hook} bool TARGET_SPLIT_COMPLEX_ARG (const_tree @var{type}) -This hook should return true if parameter of type @var{type} are passed -as two scalar parameters. By default, GCC will attempt to pack complex -arguments into the target's word size. Some ABIs require complex arguments -to be split and treated as their individual components. For example, on -AIX64, complex floats should be passed in a pair of floating point -registers, even though a complex float would fit in one 64-bit floating -point register. - -The default value of this hook is @code{NULL}, which is treated as always -false. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_BUILD_BUILTIN_VA_LIST (void) -This hook returns a type node for @code{va_list} for the target. -The default version of the hook returns @code{void*}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_ENUM_VA_LIST_P (int @var{idx}, const char **@var{pname}, tree *@var{ptree}) -This target hook is used in function @code{c_common_nodes_and_builtins} -to iterate through the target specific builtin types for va_list. The -variable @var{idx} is used as iterator. @var{pname} has to be a pointer -to a @code{const char *} and @var{ptree} a pointer to a @code{tree} typed -variable. -The arguments @var{pname} and @var{ptree} are used to store the result of -this macro and are set to the name of the va_list builtin type and its -internal type. -If the return value of this macro is zero, then there is no more element. -Otherwise the @var{IDX} should be increased for the next call of this -macro to iterate through all types. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_FN_ABI_VA_LIST (tree @var{fndecl}) -This hook returns the va_list type of the calling convention specified by -@var{fndecl}. -The default version of this hook returns @code{va_list_type_node}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_CANONICAL_VA_LIST_TYPE (tree @var{type}) -This hook returns the va_list type of the calling convention specified by the -type of @var{type}. If @var{type} is not a valid va_list type, it returns -@code{NULL_TREE}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_GIMPLIFY_VA_ARG_EXPR (tree @var{valist}, tree @var{type}, gimple_seq *@var{pre_p}, gimple_seq *@var{post_p}) -This hook performs target-specific gimplification of -@code{VA_ARG_EXPR}. The first two parameters correspond to the -arguments to @code{va_arg}; the latter two are as in -@code{gimplify.c:gimplify_expr}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VALID_POINTER_MODE (machine_mode @var{mode}) -Define this to return nonzero if the port can handle pointers -with machine mode @var{mode}. The default version of this -hook returns true for both @code{ptr_mode} and @code{Pmode}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_REF_MAY_ALIAS_ERRNO (struct ao_ref *@var{ref}) -Define this to return nonzero if the memory reference @var{ref} may alias with the system C library errno location. The default version of this hook assumes the system C library errno location is either a declaration of type int or accessed by dereferencing a pointer to int. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCALAR_MODE_SUPPORTED_P (machine_mode @var{mode}) -Define this to return nonzero if the port is prepared to handle -insns involving scalar mode @var{mode}. For a scalar mode to be -considered supported, all the basic arithmetic and comparisons -must work. - -The default version of this hook returns true for any mode -required to handle the basic C types (as defined by the port). -Included here are the double-word arithmetic supported by the -code in @file{optabs.c}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VECTOR_MODE_SUPPORTED_P (machine_mode @var{mode}) -Define this to return nonzero if the port is prepared to handle -insns involving vector mode @var{mode}. At the very least, it -must have move patterns for this mode. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ARRAY_MODE_SUPPORTED_P (machine_mode @var{mode}, unsigned HOST_WIDE_INT @var{nelems}) -Return true if GCC should try to use a scalar mode to store an array -of @var{nelems} elements, given that each element has mode @var{mode}. -Returning true here overrides the usual @code{MAX_FIXED_MODE} limit -and allows GCC to use any defined integer mode. - -One use of this hook is to support vector load and store operations -that operate on several homogeneous vectors. For example, ARM NEON -has operations like: - -@smallexample -int8x8x3_t vld3_s8 (const int8_t *) -@end smallexample - -where the return type is defined as: - -@smallexample -typedef struct int8x8x3_t -@{ - int8x8_t val[3]; -@} int8x8x3_t; -@end smallexample - -If this hook allows @code{val} to have a scalar mode, then -@code{int8x8x3_t} can have the same mode. GCC can then store -@code{int8x8x3_t}s in registers rather than forcing them onto the stack. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P (machine_mode @var{mode}) -Define this to return nonzero if libgcc provides support for the -floating-point mode @var{mode}, which is known to pass -@code{TARGET_SCALAR_MODE_SUPPORTED_P}. The default version of this -hook returns true for all of @code{SFmode}, @code{DFmode}, -@code{XFmode} and @code{TFmode}, if such modes exist. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P (machine_mode @var{mode}) -Define this to return nonzero for machine modes for which the port has -small register classes. If this target hook returns nonzero for a given -@var{mode}, the compiler will try to minimize the lifetime of registers -in @var{mode}. The hook may be called with @code{VOIDmode} as argument. -In this case, the hook is expected to return nonzero if it returns nonzero -for any mode. - -On some machines, it is risky to let hard registers live across arbitrary -insns. Typically, these machines have instructions that require values -to be in specific registers (like an accumulator), and reload will fail -if the required hard register is used for another purpose across such an -insn. - -Passes before reload do not know which hard registers will be used -in an instruction, but the machine modes of the registers set or used in -the instruction are already known. And for some machines, register -classes are small for, say, integer registers but not for floating point -registers. For example, the AMD x86-64 architecture requires specific -registers for the legacy x86 integer instructions, but there are many -SSE registers for floating point operations. On such targets, a good -strategy may be to return nonzero from this hook for @code{INTEGRAL_MODE_P} -machine modes but zero for the SSE register classes. - -The default version of this hook returns false for any mode. It is always -safe to redefine this hook to return with a nonzero value. But if you -unnecessarily define it, you will reduce the amount of optimizations -that can be performed in some cases. If you do not define this hook -to return a nonzero value when it is required, the compiler will run out -of spill registers and print a fatal error message. -@end deftypefn - -@node Scalar Return -@subsection How Scalar Function Values Are Returned -@cindex return values in registers -@cindex values, returned by functions -@cindex scalars, returned as values - -This section discusses the macros that control returning scalars as -values---values that can fit in registers. - -@deftypefn {Target Hook} rtx TARGET_FUNCTION_VALUE (const_tree @var{ret_type}, const_tree @var{fn_decl_or_type}, bool @var{outgoing}) - -Define this to return an RTX representing the place where a function -returns or receives a value of data type @var{ret_type}, a tree node -representing a data type. @var{fn_decl_or_type} is a tree node -representing @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of a -function being called. If @var{outgoing} is false, the hook should -compute the register in which the caller will see the return value. -Otherwise, the hook should return an RTX representing the place where -a function returns a value. - -On many machines, only @code{TYPE_MODE (@var{ret_type})} is relevant. -(Actually, on most machines, scalar values are returned in the same -place regardless of mode.) The value of the expression is usually a -@code{reg} RTX for the hard register where the return value is stored. -The value can also be a @code{parallel} RTX, if the return value is in -multiple places. See @code{TARGET_FUNCTION_ARG} for an explanation of the -@code{parallel} form. Note that the callee will populate every -location specified in the @code{parallel}, but if the first element of -the @code{parallel} contains the whole return value, callers will use -that element as the canonical location and ignore the others. The m68k -port uses this type of @code{parallel} to return pointers in both -@samp{%a0} (the canonical location) and @samp{%d0}. - -If @code{TARGET_PROMOTE_FUNCTION_RETURN} returns true, you must apply -the same promotion rules specified in @code{PROMOTE_MODE} if -@var{valtype} is a scalar type. - -If the precise function being called is known, @var{func} is a tree -node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null -pointer. This makes it possible to use a different value-returning -convention for specific functions when all their calls are -known. - -Some target machines have ``register windows'' so that the register in -which a function returns its value is not the same as the one in which -the caller sees the value. For such machines, you should return -different RTX depending on @var{outgoing}. - -@code{TARGET_FUNCTION_VALUE} is not used for return values with -aggregate data types, because these are returned in another way. See -@code{TARGET_STRUCT_VALUE_RTX} and related macros, below. -@end deftypefn - -@defmac FUNCTION_VALUE (@var{valtype}, @var{func}) -This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for -a new target instead. -@end defmac - -@defmac LIBCALL_VALUE (@var{mode}) -A C expression to create an RTX representing the place where a library -function returns a value of mode @var{mode}. - -Note that ``library function'' in this context means a compiler -support routine, used to perform arithmetic, whose name is known -specially by the compiler and was not mentioned in the C code being -compiled. -@end defmac - -@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (machine_mode @var{mode}, const_rtx @var{fun}) -Define this hook if the back-end needs to know the name of the libcall -function in order to determine where the result should be returned. - -The mode of the result is given by @var{mode} and the name of the called -library function is given by @var{fun}. The hook should return an RTX -representing the place where the library function result will be returned. - -If this hook is not defined, then LIBCALL_VALUE will be used. -@end deftypefn - -@defmac FUNCTION_VALUE_REGNO_P (@var{regno}) -A C expression that is nonzero if @var{regno} is the number of a hard -register in which the values of called function may come back. - -A register whose use for returning values is limited to serving as the -second of a pair (for a value of type @code{double}, say) need not be -recognized by this macro. So for most machines, this definition -suffices: - -@smallexample -#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) -@end smallexample - -If the machine has register windows, so that the caller and the called -function use different registers for the return value, this macro -should recognize only the caller's register numbers. - -This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE_REGNO_P} -for a new target instead. -@end defmac - -@deftypefn {Target Hook} bool TARGET_FUNCTION_VALUE_REGNO_P (const unsigned int @var{regno}) -A target hook that return @code{true} if @var{regno} is the number of a hard -register in which the values of called function may come back. - -A register whose use for returning values is limited to serving as the -second of a pair (for a value of type @code{double}, say) need not be -recognized by this target hook. - -If the machine has register windows, so that the caller and the called -function use different registers for the return value, this target hook -should recognize only the caller's register numbers. - -If this hook is not defined, then FUNCTION_VALUE_REGNO_P will be used. -@end deftypefn - -@defmac APPLY_RESULT_SIZE -Define this macro if @samp{untyped_call} and @samp{untyped_return} -need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for -saving and restoring an arbitrary return value. -@end defmac - -@deftypevr {Target Hook} bool TARGET_OMIT_STRUCT_RETURN_REG -Normally, when a function returns a structure by memory, the address -is passed as an invisible pointer argument, but the compiler also -arranges to return the address from the function like it would a normal -pointer return value. Define this to true if that behaviour is -undesirable on your target. -@end deftypevr - -@deftypefn {Target Hook} bool TARGET_RETURN_IN_MSB (const_tree @var{type}) -This hook should return true if values of type @var{type} are returned -at the most significant end of a register (in other words, if they are -padded at the least significant end). You can assume that @var{type} -is returned in a register; the caller is required to check this. - -Note that the register provided by @code{TARGET_FUNCTION_VALUE} must -be able to hold the complete return value. For example, if a 1-, 2- -or 3-byte structure is returned at the most significant end of a -4-byte register, @code{TARGET_FUNCTION_VALUE} should provide an -@code{SImode} rtx. -@end deftypefn - -@node Aggregate Return -@subsection How Large Values Are Returned -@cindex aggregates as return values -@cindex large return values -@cindex returning aggregate values -@cindex structure value address - -When a function value's mode is @code{BLKmode} (and in some other -cases), the value is not returned according to -@code{TARGET_FUNCTION_VALUE} (@pxref{Scalar Return}). Instead, the -caller passes the address of a block of memory in which the value -should be stored. This address is called the @dfn{structure value -address}. - -This section describes how to control returning structure values in -memory. - -@deftypefn {Target Hook} bool TARGET_RETURN_IN_MEMORY (const_tree @var{type}, const_tree @var{fntype}) -This target hook should return a nonzero value to say to return the -function value in memory, just as large structures are always returned. -Here @var{type} will be the data type of the value, and @var{fntype} -will be the type of the function doing the returning, or @code{NULL} for -libcalls. - -Note that values of mode @code{BLKmode} must be explicitly handled -by this function. Also, the option @option{-fpcc-struct-return} -takes effect regardless of this macro. On most systems, it is -possible to leave the hook undefined; this causes a default -definition to be used, whose value is the constant 1 for @code{BLKmode} -values, and 0 otherwise. - -Do not use this hook to indicate that structures and unions should always -be returned in memory. You should instead use @code{DEFAULT_PCC_STRUCT_RETURN} -to indicate this. -@end deftypefn - -@defmac DEFAULT_PCC_STRUCT_RETURN -Define this macro to be 1 if all structure and union return values must be -in memory. Since this results in slower code, this should be defined -only if needed for compatibility with other compilers or with an ABI@. -If you define this macro to be 0, then the conventions used for structure -and union return values are decided by the @code{TARGET_RETURN_IN_MEMORY} -target hook. - -If not defined, this defaults to the value 1. -@end defmac - -@deftypefn {Target Hook} rtx TARGET_STRUCT_VALUE_RTX (tree @var{fndecl}, int @var{incoming}) -This target hook should return the location of the structure value -address (normally a @code{mem} or @code{reg}), or 0 if the address is -passed as an ``invisible'' first argument. Note that @var{fndecl} may -be @code{NULL}, for libcalls. You do not need to define this target -hook if the address is always passed as an ``invisible'' first -argument. - -On some architectures the place where the structure value address -is found by the called function is not the same place that the -caller put it. This can be due to register windows, or it could -be because the function prologue moves it to a different place. -@var{incoming} is @code{1} or @code{2} when the location is needed in -the context of the called function, and @code{0} in the context of -the caller. - -If @var{incoming} is nonzero and the address is to be found on the -stack, return a @code{mem} which refers to the frame pointer. If -@var{incoming} is @code{2}, the result is being used to fetch the -structure value address at the beginning of a function. If you need -to emit adjusting code, you should do it at this point. -@end deftypefn - -@defmac PCC_STATIC_STRUCT_RETURN -Define this macro if the usual system convention on the target machine -for returning structures and unions is for the called function to return -the address of a static variable containing the value. - -Do not define this if the usual system convention is for the caller to -pass an address to the subroutine. - -This macro has effect in @option{-fpcc-struct-return} mode, but it does -nothing when you use @option{-freg-struct-return} mode. -@end defmac - -@deftypefn {Target Hook} machine_mode TARGET_GET_RAW_RESULT_MODE (int @var{regno}) -This target hook returns the mode to be used when accessing raw return registers in @code{__builtin_return}. Define this macro if the value in @var{reg_raw_mode} is not correct. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_GET_RAW_ARG_MODE (int @var{regno}) -This target hook returns the mode to be used when accessing raw argument registers in @code{__builtin_apply_args}. Define this macro if the value in @var{reg_raw_mode} is not correct. -@end deftypefn - -@node Caller Saves -@subsection Caller-Saves Register Allocation - -If you enable it, GCC can save registers around function calls. This -makes it possible to use call-clobbered registers to hold variables that -must live across calls. - -@defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs}) -A C expression specifying which mode is required for saving @var{nregs} -of a pseudo-register in call-clobbered hard register @var{regno}. If -@var{regno} is unsuitable for caller save, @code{VOIDmode} should be -returned. For most machines this macro need not be defined since GCC -will select the smallest suitable mode. -@end defmac - -@node Function Entry -@subsection Function Entry and Exit -@cindex function entry and exit -@cindex prologue -@cindex epilogue - -This section describes the macros that output function entry -(@dfn{prologue}) and exit (@dfn{epilogue}) code. - -@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_PROLOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size}) -If defined, a function that outputs the assembler code for entry to a -function. The prologue is responsible for setting up the stack frame, -initializing the frame pointer register, saving registers that must be -saved, and allocating @var{size} additional bytes of storage for the -local variables. @var{size} is an integer. @var{file} is a stdio -stream to which the assembler code should be output. - -The label for the beginning of the function need not be output by this -macro. That has already been done when the macro is run. - -@findex regs_ever_live -To determine which registers to save, the macro can refer to the array -@code{regs_ever_live}: element @var{r} is nonzero if hard register -@var{r} is used anywhere within the function. This implies the function -prologue should save register @var{r}, provided it is not one of the -call-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use -@code{regs_ever_live}.) - -On machines that have ``register windows'', the function entry code does -not save on the stack the registers that are in the windows, even if -they are supposed to be preserved by function calls; instead it takes -appropriate steps to ``push'' the register stack, if any non-call-used -registers are used in the function. - -@findex frame_pointer_needed -On machines where functions may or may not have frame-pointers, the -function entry code must vary accordingly; it must set up the frame -pointer if one is wanted, and not otherwise. To determine whether a -frame pointer is in wanted, the macro can refer to the variable -@code{frame_pointer_needed}. The variable's value will be 1 at run -time in a function that needs a frame pointer. @xref{Elimination}. - -The function entry code is responsible for allocating any stack space -required for the function. This stack space consists of the regions -listed below. In most cases, these regions are allocated in the -order listed, with the last listed region closest to the top of the -stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and -the highest address if it is not defined). You can use a different order -for a machine if doing so is more convenient or required for -compatibility reasons. Except in cases where required by standard -or by a debugger, there is no reason why the stack layout used by GCC -need agree with that used by other compilers for a machine. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_END_PROLOGUE (FILE *@var{file}) -If defined, a function that outputs assembler code at the end of a -prologue. This should be used when the function prologue is being -emitted as RTL, and you have some extra assembler that needs to be -emitted. @xref{prologue instruction pattern}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_BEGIN_EPILOGUE (FILE *@var{file}) -If defined, a function that outputs assembler code at the start of an -epilogue. This should be used when the function epilogue is being -emitted as RTL, and you have some extra assembler that needs to be -emitted. @xref{epilogue instruction pattern}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_EPILOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size}) -If defined, a function that outputs the assembler code for exit from a -function. The epilogue is responsible for restoring the saved -registers and stack pointer to their values when the function was -called, and returning control to the caller. This macro takes the -same arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the -registers to restore are determined from @code{regs_ever_live} and -@code{CALL_USED_REGISTERS} in the same way. - -On some machines, there is a single instruction that does all the work -of returning from the function. On these machines, give that -instruction the name @samp{return} and do not define the macro -@code{TARGET_ASM_FUNCTION_EPILOGUE} at all. - -Do not define a pattern named @samp{return} if you want the -@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the target -switches to control whether return instructions or epilogues are used, -define a @samp{return} pattern with a validity condition that tests the -target switches appropriately. If the @samp{return} pattern's validity -condition is false, epilogues will be used. - -On machines where functions may or may not have frame-pointers, the -function exit code must vary accordingly. Sometimes the code for these -two cases is completely different. To determine whether a frame pointer -is wanted, the macro can refer to the variable -@code{frame_pointer_needed}. The variable's value will be 1 when compiling -a function that needs a frame pointer. - -Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and -@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially. -The C variable @code{current_function_is_leaf} is nonzero for such a -function. @xref{Leaf Functions}. - -On some machines, some functions pop their arguments on exit while -others leave that for the caller to do. For example, the 68020 when -given @option{-mrtd} pops arguments in functions that take a fixed -number of arguments. - -@findex pops_args -@findex crtl->args.pops_args -Your definition of the macro @code{RETURN_POPS_ARGS} decides which -functions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE} -needs to know what was decided. The number of bytes of the current -function's arguments that this function should pop is available in -@code{crtl->args.pops_args}. @xref{Scalar Return}. -@end deftypefn - -@itemize @bullet -@item -@findex pretend_args_size -@findex crtl->args.pretend_args_size -A region of @code{crtl->args.pretend_args_size} bytes of -uninitialized space just underneath the first argument arriving on the -stack. (This may not be at the very start of the allocated stack region -if the calling sequence has pushed anything else since pushing the stack -arguments. But usually, on such machines, nothing else has been pushed -yet, because the function prologue itself does all the pushing.) This -region is used on machines where an argument may be passed partly in -registers and partly in memory, and, in some cases to support the -features in @code{}. - -@item -An area of memory used to save certain registers used by the function. -The size of this area, which may also include space for such things as -the return address and pointers to previous stack frames, is -machine-specific and usually depends on which registers have been used -in the function. Machines with register windows often do not require -a save area. - -@item -A region of at least @var{size} bytes, possibly rounded up to an allocation -boundary, to contain the local variables of the function. On some machines, -this region and the save area may occur in the opposite order, with the -save area closer to the top of the stack. - -@item -@cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames -Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of -@code{crtl->outgoing_args_size} bytes to be used for outgoing -argument lists of the function. @xref{Stack Arguments}. -@end itemize - -@defmac EXIT_IGNORE_STACK -Define this macro as a C expression that is nonzero if the return -instruction or the function epilogue ignores the value of the stack -pointer; in other words, if it is safe to delete an instruction to -adjust the stack pointer before a return from the function. The -default is 0. - -Note that this macro's value is relevant only for functions for which -frame pointers are maintained. It is never safe to delete a final -stack adjustment in a function that has no frame pointer, and the -compiler knows this regardless of @code{EXIT_IGNORE_STACK}. -@end defmac - -@defmac EPILOGUE_USES (@var{regno}) -Define this macro as a C expression that is nonzero for registers that are -used by the epilogue or the @samp{return} pattern. The stack and frame -pointer registers are already assumed to be used as needed. -@end defmac - -@defmac EH_USES (@var{regno}) -Define this macro as a C expression that is nonzero for registers that are -used by the exception handling mechanism, and so should be considered live -on entry to an exception edge. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_MI_THUNK (FILE *@var{file}, tree @var{thunk_fndecl}, HOST_WIDE_INT @var{delta}, HOST_WIDE_INT @var{vcall_offset}, tree @var{function}) -A function that outputs the assembler code for a thunk -function, used to implement C++ virtual function calls with multiple -inheritance. The thunk acts as a wrapper around a virtual function, -adjusting the implicit object parameter before handing control off to -the real function. - -First, emit code to add the integer @var{delta} to the location that -contains the incoming first argument. Assume that this argument -contains a pointer, and is the one used to pass the @code{this} pointer -in C++. This is the incoming argument @emph{before} the function prologue, -e.g.@: @samp{%o0} on a sparc. The addition must preserve the values of -all other incoming arguments. - -Then, if @var{vcall_offset} is nonzero, an additional adjustment should be -made after adding @code{delta}. In particular, if @var{p} is the -adjusted pointer, the following adjustment should be made: - -@smallexample -p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)] -@end smallexample - -After the additions, emit code to jump to @var{function}, which is a -@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does -not touch the return address. Hence returning from @var{FUNCTION} will -return to whoever called the current @samp{thunk}. - -The effect must be as if @var{function} had been called directly with -the adjusted first argument. This macro is responsible for emitting all -of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE} -and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked. - -The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function} -have already been extracted from it.) It might possibly be useful on -some targets, but probably not. - -If you do not define this macro, the target-independent code in the C++ -front end will generate a less efficient heavyweight thunk that calls -@var{function} instead of jumping to it. The generic approach does -not support varargs. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ASM_CAN_OUTPUT_MI_THUNK (const_tree @var{thunk_fndecl}, HOST_WIDE_INT @var{delta}, HOST_WIDE_INT @var{vcall_offset}, const_tree @var{function}) -A function that returns true if TARGET_ASM_OUTPUT_MI_THUNK would be able -to output the assembler code for the thunk function specified by the -arguments it is passed, and false otherwise. In the latter case, the -generic approach will be used by the C++ front end, with the limitations -previously exposed. -@end deftypefn - -@node Profiling -@subsection Generating Code for Profiling -@cindex profiling, code generation - -These macros will help you generate code for profiling. - -@defmac FUNCTION_PROFILER (@var{file}, @var{labelno}) -A C statement or compound statement to output to @var{file} some -assembler code to call the profiling subroutine @code{mcount}. - -@findex mcount -The details of how @code{mcount} expects to be called are determined by -your operating system environment, not by GCC@. To figure them out, -compile a small program for profiling using the system's installed C -compiler and look at the assembler code that results. - -Older implementations of @code{mcount} expect the address of a counter -variable to be loaded into some register. The name of this variable is -@samp{LP} followed by the number @var{labelno}, so you would generate -the name using @samp{LP%d} in a @code{fprintf}. -@end defmac - -@defmac PROFILE_HOOK -A C statement or compound statement to output to @var{file} some assembly -code to call the profiling subroutine @code{mcount} even the target does -not support profiling. -@end defmac - -@defmac NO_PROFILE_COUNTERS -Define this macro to be an expression with a nonzero value if the -@code{mcount} subroutine on your system does not need a counter variable -allocated for each function. This is true for almost all modern -implementations. If you define this macro, you must not use the -@var{labelno} argument to @code{FUNCTION_PROFILER}. -@end defmac - -@defmac PROFILE_BEFORE_PROLOGUE -Define this macro if the code for function profiling should come before -the function prologue. Normally, the profiling code comes after. -@end defmac - -@deftypefn {Target Hook} bool TARGET_KEEP_LEAF_WHEN_PROFILED (void) -This target hook returns true if the target wants the leaf flag for the current function to stay true even if it calls mcount. This might make sense for targets using the leaf flag only to determine whether a stack frame needs to be generated or not and for which the call to mcount is generated before the function prologue. -@end deftypefn - -@node Tail Calls -@subsection Permitting tail calls -@cindex tail calls - -@deftypefn {Target Hook} bool TARGET_FUNCTION_OK_FOR_SIBCALL (tree @var{decl}, tree @var{exp}) -True if it is OK to do sibling call optimization for the specified -call expression @var{exp}. @var{decl} will be the called function, -or @code{NULL} if this is an indirect call. - -It is not uncommon for limitations of calling conventions to prevent -tail calls to functions outside the current unit of translation, or -during PIC compilation. The hook is used to enforce these restrictions, -as the @code{sibcall} md pattern can not fail, or fall over to a -``normal'' call. The criteria for successful sibling call optimization -may vary greatly between different architectures. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_EXTRA_LIVE_ON_ENTRY (bitmap @var{regs}) -Add any hard registers to @var{regs} that are live on entry to the -function. This hook only needs to be defined to provide registers that -cannot be found by examination of FUNCTION_ARG_REGNO_P, the callee saved -registers, STATIC_CHAIN_INCOMING_REGNUM, STATIC_CHAIN_REGNUM, -TARGET_STRUCT_VALUE_RTX, FRAME_POINTER_REGNUM, EH_USES, -FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SET_UP_BY_PROLOGUE (struct hard_reg_set_container *@var{}) -This hook should add additional registers that are computed by the prologue to the hard regset for shrink-wrapping optimization purposes. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_WARN_FUNC_RETURN (tree) -True if a function's return statements should be checked for matching the function's return type. This includes checking for falling off the end of a non-void function. Return false if no such check should be made. -@end deftypefn - -@node Stack Smashing Protection -@subsection Stack smashing protection -@cindex stack smashing protection - -@deftypefn {Target Hook} tree TARGET_STACK_PROTECT_GUARD (void) -This hook returns a @code{DECL} node for the external variable to use -for the stack protection guard. This variable is initialized by the -runtime to some random value and is used to initialize the guard value -that is placed at the top of the local stack frame. The type of this -variable must be @code{ptr_type_node}. - -The default version of this hook creates a variable called -@samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_STACK_PROTECT_FAIL (void) -This hook returns a @code{CALL_EXPR} that alerts the runtime that the -stack protect guard variable has been modified. This expression should -involve a call to a @code{noreturn} function. - -The default version of this hook invokes a function called -@samp{__stack_chk_fail}, taking no arguments. This function is -normally defined in @file{libgcc2.c}. -@end deftypefn - -@deftypefn {Common Target Hook} bool TARGET_SUPPORTS_SPLIT_STACK (bool @var{report}, struct gcc_options *@var{opts}) -Whether this target supports splitting the stack when the options described in @var{opts} have been passed. This is called after options have been parsed, so the target may reject splitting the stack in some configurations. The default version of this hook returns false. If @var{report} is true, this function may issue a warning or error; if @var{report} is false, it must simply return a value -@end deftypefn - -@node Miscellaneous Register Hooks -@subsection Miscellaneous register hooks -@cindex miscellaneous register hooks - -@deftypevr {Target Hook} bool TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS -Set to true if each call that binds to a local definition explicitly -clobbers or sets all non-fixed registers modified by performing the call. -That is, by the call pattern itself, or by code that might be inserted by the -linker (e.g. stubs, veneers, branch islands), but not including those -modifiable by the callee. The affected registers may be mentioned explicitly -in the call pattern, or included as clobbers in CALL_INSN_FUNCTION_USAGE. -The default version of this hook is set to false. The purpose of this hook -is to enable the fipa-ra optimization. -@end deftypevr - -@node Varargs -@section Implementing the Varargs Macros -@cindex varargs implementation - -GCC comes with an implementation of @code{} and -@code{} that work without change on machines that pass arguments -on the stack. Other machines require their own implementations of -varargs, and the two machine independent header files must have -conditionals to include it. - -ISO @code{} differs from traditional @code{} mainly in -the calling convention for @code{va_start}. The traditional -implementation takes just one argument, which is the variable in which -to store the argument pointer. The ISO implementation of -@code{va_start} takes an additional second argument. The user is -supposed to write the last named argument of the function here. - -However, @code{va_start} should not use this argument. The way to find -the end of the named arguments is with the built-in functions described -below. - -@defmac __builtin_saveregs () -Use this built-in function to save the argument registers in memory so -that the varargs mechanism can access them. Both ISO and traditional -versions of @code{va_start} must use @code{__builtin_saveregs}, unless -you use @code{TARGET_SETUP_INCOMING_VARARGS} (see below) instead. - -On some machines, @code{__builtin_saveregs} is open-coded under the -control of the target hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. On -other machines, it calls a routine written in assembler language, -found in @file{libgcc2.c}. - -Code generated for the call to @code{__builtin_saveregs} appears at the -beginning of the function, as opposed to where the call to -@code{__builtin_saveregs} is written, regardless of what the code is. -This is because the registers must be saved before the function starts -to use them for its own purposes. -@c i rewrote the first sentence above to fix an overfull hbox. --mew -@c 10feb93 -@end defmac - -@defmac __builtin_next_arg (@var{lastarg}) -This builtin returns the address of the first anonymous stack -argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it -returns the address of the location above the first anonymous stack -argument. Use it in @code{va_start} to initialize the pointer for -fetching arguments from the stack. Also use it in @code{va_start} to -verify that the second parameter @var{lastarg} is the last named argument -of the current function. -@end defmac - -@defmac __builtin_classify_type (@var{object}) -Since each machine has its own conventions for which data types are -passed in which kind of register, your implementation of @code{va_arg} -has to embody these conventions. The easiest way to categorize the -specified data type is to use @code{__builtin_classify_type} together -with @code{sizeof} and @code{__alignof__}. - -@code{__builtin_classify_type} ignores the value of @var{object}, -considering only its data type. It returns an integer describing what -kind of type that is---integer, floating, pointer, structure, and so on. - -The file @file{typeclass.h} defines an enumeration that you can use to -interpret the values of @code{__builtin_classify_type}. -@end defmac - -These machine description macros help implement varargs: - -@deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN_SAVEREGS (void) -If defined, this hook produces the machine-specific code for a call to -@code{__builtin_saveregs}. This code will be moved to the very -beginning of the function, before any parameter access are made. The -return value of this function should be an RTX that contains the value -to use as the return of @code{__builtin_saveregs}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SETUP_INCOMING_VARARGS (cumulative_args_t @var{args_so_far}, machine_mode @var{mode}, tree @var{type}, int *@var{pretend_args_size}, int @var{second_time}) -This target hook offers an alternative to using -@code{__builtin_saveregs} and defining the hook -@code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Use it to store the anonymous -register arguments into the stack so that all the arguments appear to -have been passed consecutively on the stack. Once this is done, you can -use the standard implementation of varargs that works for machines that -pass all their arguments on the stack. - -The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data -structure, containing the values that are obtained after processing the -named arguments. The arguments @var{mode} and @var{type} describe the -last named argument---its machine mode and its data type as a tree node. - -The target hook should do two things: first, push onto the stack all the -argument registers @emph{not} used for the named arguments, and second, -store the size of the data thus pushed into the @code{int}-valued -variable pointed to by @var{pretend_args_size}. The value that you -store here will serve as additional offset for setting up the stack -frame. - -Because you must generate code to push the anonymous arguments at -compile time without knowing their data types, -@code{TARGET_SETUP_INCOMING_VARARGS} is only useful on machines that -have just a single category of argument register and use it uniformly -for all data types. - -If the argument @var{second_time} is nonzero, it means that the -arguments of the function are being analyzed for the second time. This -happens for an inline function, which is not actually compiled until the -end of the source file. The hook @code{TARGET_SETUP_INCOMING_VARARGS} should -not generate any instructions in this case. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_STRICT_ARGUMENT_NAMING (cumulative_args_t @var{ca}) -Define this hook to return @code{true} if the location where a function -argument is passed depends on whether or not it is a named argument. - -This hook controls how the @var{named} argument to @code{TARGET_FUNCTION_ARG} -is set for varargs and stdarg functions. If this hook returns -@code{true}, the @var{named} argument is always true for named -arguments, and false for unnamed arguments. If it returns @code{false}, -but @code{TARGET_PRETEND_OUTGOING_VARARGS_NAMED} returns @code{true}, -then all arguments are treated as named. Otherwise, all named arguments -except the last are treated as named. - -You need not define this hook if it always returns @code{false}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_CALL_ARGS (rtx, @var{tree}) -While generating RTL for a function call, this target hook is invoked once -for each argument passed to the function, either a register returned by -@code{TARGET_FUNCTION_ARG} or a memory location. It is called just -before the point where argument registers are stored. The type of the -function to be called is also passed as the second argument; it is -@code{NULL_TREE} for libcalls. The @code{TARGET_END_CALL_ARGS} hook is -invoked just after the code to copy the return reg has been emitted. -This functionality can be used to perform special setup of call argument -registers if a target needs it. -For functions without arguments, the hook is called once with @code{pc_rtx} -passed instead of an argument register. -Most ports do not need to implement anything for this hook. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_END_CALL_ARGS (void) -This target hook is invoked while generating RTL for a function call, -just after the point where the return reg is copied into a pseudo. It -signals that all the call argument and return registers for the just -emitted call are now no longer in use. -Most ports do not need to implement anything for this hook. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_PRETEND_OUTGOING_VARARGS_NAMED (cumulative_args_t @var{ca}) -If you need to conditionally change ABIs so that one works with -@code{TARGET_SETUP_INCOMING_VARARGS}, but the other works like neither -@code{TARGET_SETUP_INCOMING_VARARGS} nor @code{TARGET_STRICT_ARGUMENT_NAMING} was -defined, then define this hook to return @code{true} if -@code{TARGET_SETUP_INCOMING_VARARGS} is used, @code{false} otherwise. -Otherwise, you should not define this hook. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_LOAD_BOUNDS_FOR_ARG (rtx @var{slot}, rtx @var{arg}, rtx @var{slot_no}) -This hook is used by expand pass to emit insn to load bounds of -@var{arg} passed in @var{slot}. Expand pass uses this hook in case -bounds of @var{arg} are not passed in register. If @var{slot} is a -memory, then bounds are loaded as for regular pointer loaded from -memory. If @var{slot} is not a memory then @var{slot_no} is an integer -constant holding number of the target dependent special slot which -should be used to obtain bounds. Hook returns RTX holding loaded bounds. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_STORE_BOUNDS_FOR_ARG (rtx @var{arg}, rtx @var{slot}, rtx @var{bounds}, rtx @var{slot_no}) -This hook is used by expand pass to emit insns to store @var{bounds} of -@var{arg} passed in @var{slot}. Expand pass uses this hook in case -@var{bounds} of @var{arg} are not passed in register. If @var{slot} is a -memory, then @var{bounds} are stored as for regular pointer stored in -memory. If @var{slot} is not a memory then @var{slot_no} is an integer -constant holding number of the target dependent special slot which -should be used to store @var{bounds}. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_LOAD_RETURNED_BOUNDS (rtx @var{slot}) -This hook is used by expand pass to emit insn to load bounds -returned by function call in @var{slot}. Hook returns RTX holding -loaded bounds. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_STORE_RETURNED_BOUNDS (rtx @var{slot}, rtx @var{bounds}) -This hook is used by expand pass to emit insn to store @var{bounds} -returned by function call into @var{slot}. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_CHKP_FUNCTION_VALUE_BOUNDS (const_tree @var{ret_type}, const_tree @var{fn_decl_or_type}, bool @var{outgoing}) -Define this to return an RTX representing the place where a function -returns bounds for returned pointers. Arguments meaning is similar to -@code{TARGET_FUNCTION_VALUE}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SETUP_INCOMING_VARARG_BOUNDS (cumulative_args_t @var{args_so_far}, enum machine_mode @var{mode}, tree @var{type}, int *@var{pretend_args_size}, int @var{second_time}) -Use it to store bounds for anonymous register arguments stored -into the stack. Arguments meaning is similar to -@code{TARGET_SETUP_INCOMING_VARARGS}. -@end deftypefn - -@node Trampolines -@section Trampolines for Nested Functions -@cindex trampolines for nested functions -@cindex nested functions, trampolines for - -A @dfn{trampoline} is a small piece of code that is created at run time -when the address of a nested function is taken. It normally resides on -the stack, in the stack frame of the containing function. These macros -tell GCC how to generate code to allocate and initialize a -trampoline. - -The instructions in the trampoline must do two things: load a constant -address into the static chain register, and jump to the real address of -the nested function. On CISC machines such as the m68k, this requires -two instructions, a move immediate and a jump. Then the two addresses -exist in the trampoline as word-long immediate operands. On RISC -machines, it is often necessary to load each address into a register in -two parts. Then pieces of each address form separate immediate -operands. - -The code generated to initialize the trampoline must store the variable -parts---the static chain value and the function address---into the -immediate operands of the instructions. On a CISC machine, this is -simply a matter of copying each address to a memory reference at the -proper offset from the start of the trampoline. On a RISC machine, it -may be necessary to take out pieces of the address and store them -separately. - -@deftypefn {Target Hook} void TARGET_ASM_TRAMPOLINE_TEMPLATE (FILE *@var{f}) -This hook is called by @code{assemble_trampoline_template} to output, -on the stream @var{f}, assembler code for a block of data that contains -the constant parts of a trampoline. This code should not include a -label---the label is taken care of automatically. - -If you do not define this hook, it means no template is needed -for the target. Do not define this hook on systems where the block move -code to copy the trampoline into place would be larger than the code -to generate it on the spot. -@end deftypefn - -@defmac TRAMPOLINE_SECTION -Return the section into which the trampoline template is to be placed -(@pxref{Sections}). The default value is @code{readonly_data_section}. -@end defmac - -@defmac TRAMPOLINE_SIZE -A C expression for the size in bytes of the trampoline, as an integer. -@end defmac - -@defmac TRAMPOLINE_ALIGNMENT -Alignment required for trampolines, in bits. - -If you don't define this macro, the value of @code{FUNCTION_ALIGNMENT} -is used for aligning trampolines. -@end defmac - -@deftypefn {Target Hook} void TARGET_TRAMPOLINE_INIT (rtx @var{m_tramp}, tree @var{fndecl}, rtx @var{static_chain}) -This hook is called to initialize a trampoline. -@var{m_tramp} is an RTX for the memory block for the trampoline; @var{fndecl} -is the @code{FUNCTION_DECL} for the nested function; @var{static_chain} is an -RTX for the static chain value that should be passed to the function -when it is called. - -If the target defines @code{TARGET_ASM_TRAMPOLINE_TEMPLATE}, then the -first thing this hook should do is emit a block move into @var{m_tramp} -from the memory block returned by @code{assemble_trampoline_template}. -Note that the block move need only cover the constant parts of the -trampoline. If the target isolates the variable parts of the trampoline -to the end, not all @code{TRAMPOLINE_SIZE} bytes need be copied. - -If the target requires any other actions, such as flushing caches or -enabling stack execution, these actions should be performed after -initializing the trampoline proper. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_TRAMPOLINE_ADJUST_ADDRESS (rtx @var{addr}) -This hook should perform any machine-specific adjustment in -the address of the trampoline. Its argument contains the address of the -memory block that was passed to @code{TARGET_TRAMPOLINE_INIT}. In case -the address to be used for a function call should be different from the -address at which the template was stored, the different address should -be returned; otherwise @var{addr} should be returned unchanged. -If this hook is not defined, @var{addr} will be used for function calls. -@end deftypefn - -Implementing trampolines is difficult on many machines because they have -separate instruction and data caches. Writing into a stack location -fails to clear the memory in the instruction cache, so when the program -jumps to that location, it executes the old contents. - -Here are two possible solutions. One is to clear the relevant parts of -the instruction cache whenever a trampoline is set up. The other is to -make all trampolines identical, by having them jump to a standard -subroutine. The former technique makes trampoline execution faster; the -latter makes initialization faster. - -To clear the instruction cache when a trampoline is initialized, define -the following macro. - -@defmac CLEAR_INSN_CACHE (@var{beg}, @var{end}) -If defined, expands to a C expression clearing the @emph{instruction -cache} in the specified interval. The definition of this macro would -typically be a series of @code{asm} statements. Both @var{beg} and -@var{end} are both pointer expressions. -@end defmac - -To use a standard subroutine, define the following macro. In addition, -you must make sure that the instructions in a trampoline fill an entire -cache line with identical instructions, or else ensure that the -beginning of the trampoline code is always aligned at the same point in -its cache line. Look in @file{m68k.h} as a guide. - -@defmac TRANSFER_FROM_TRAMPOLINE -Define this macro if trampolines need a special subroutine to do their -work. The macro should expand to a series of @code{asm} statements -which will be compiled with GCC@. They go in a library function named -@code{__transfer_from_trampoline}. - -If you need to avoid executing the ordinary prologue code of a compiled -C function when you jump to the subroutine, you can do so by placing a -special label of your own in the assembler code. Use one @code{asm} -statement to generate an assembler label, and another to make the label -global. Then trampolines can use that label to jump directly to your -special assembler code. -@end defmac - -@node Library Calls -@section Implicit Calls to Library Routines -@cindex library subroutine names -@cindex @file{libgcc.a} - -@c prevent bad page break with this line -Here is an explanation of implicit calls to library routines. - -@defmac DECLARE_LIBRARY_RENAMES -This macro, if defined, should expand to a piece of C code that will get -expanded when compiling functions for libgcc.a. It can be used to -provide alternate names for GCC's internal library functions if there -are ABI-mandated names that the compiler should provide. -@end defmac - -@findex set_optab_libfunc -@findex init_one_libfunc -@deftypefn {Target Hook} void TARGET_INIT_LIBFUNCS (void) -This hook should declare additional library routines or rename -existing ones, using the functions @code{set_optab_libfunc} and -@code{init_one_libfunc} defined in @file{optabs.c}. -@code{init_optabs} calls this macro after initializing all the normal -library routines. - -The default is to do nothing. Most ports don't need to define this hook. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_LIBFUNC_GNU_PREFIX -If false (the default), internal library routines start with two -underscores. If set to true, these routines start with @code{__gnu_} -instead. E.g., @code{__muldi3} changes to @code{__gnu_muldi3}. This -currently only affects functions defined in @file{libgcc2.c}. If this -is set to true, the @file{tm.h} file must also -@code{#define LIBGCC2_GNU_PREFIX}. -@end deftypevr - -@defmac FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison}) -This macro should return @code{true} if the library routine that -implements the floating point comparison operator @var{comparison} in -mode @var{mode} will return a boolean, and @var{false} if it will -return a tristate. - -GCC's own floating point libraries return tristates from the -comparison operators, so the default returns false always. Most ports -don't need to define this macro. -@end defmac - -@defmac TARGET_LIB_INT_CMP_BIASED -This macro should evaluate to @code{true} if the integer comparison -functions (like @code{__cmpdi2}) return 0 to indicate that the first -operand is smaller than the second, 1 to indicate that they are equal, -and 2 to indicate that the first operand is greater than the second. -If this macro evaluates to @code{false} the comparison functions return -@minus{}1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines -in @file{libgcc.a}, you do not need to define this macro. -@end defmac - -@defmac TARGET_HAS_NO_HW_DIVIDE -This macro should be defined if the target has no hardware divide -instructions. If this macro is defined, GCC will use an algorithm which -make use of simple logical and arithmetic operations for 64-bit -division. If the macro is not defined, GCC will use an algorithm which -make use of a 64-bit by 32-bit divide primitive. -@end defmac - -@cindex @code{EDOM}, implicit usage -@findex matherr -@defmac TARGET_EDOM -The value of @code{EDOM} on the target machine, as a C integer constant -expression. If you don't define this macro, GCC does not attempt to -deposit the value of @code{EDOM} into @code{errno} directly. Look in -@file{/usr/include/errno.h} to find the value of @code{EDOM} on your -system. - -If you do not define @code{TARGET_EDOM}, then compiled code reports -domain errors by calling the library function and letting it report the -error. If mathematical functions on your system use @code{matherr} when -there is an error, then you should leave @code{TARGET_EDOM} undefined so -that @code{matherr} is used normally. -@end defmac - -@cindex @code{errno}, implicit usage -@defmac GEN_ERRNO_RTX -Define this macro as a C expression to create an rtl expression that -refers to the global ``variable'' @code{errno}. (On certain systems, -@code{errno} may not actually be a variable.) If you don't define this -macro, a reasonable default is used. -@end defmac - -@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FUNCTION (enum function_class @var{fn_class}) -This hook determines whether a function from a class of functions -@var{fn_class} is present at the runtime. -@end deftypefn - -@defmac NEXT_OBJC_RUNTIME -Set this macro to 1 to use the "NeXT" Objective-C message sending conventions -by default. This calling convention involves passing the object, the selector -and the method arguments all at once to the method-lookup library function. -This is the usual setting when targeting Darwin/Mac OS X systems, which have -the NeXT runtime installed. - -If the macro is set to 0, the "GNU" Objective-C message sending convention -will be used by default. This convention passes just the object and the -selector to the method-lookup function, which returns a pointer to the method. - -In either case, it remains possible to select code-generation for the alternate -scheme, by means of compiler command line switches. -@end defmac - -@node Addressing Modes -@section Addressing Modes -@cindex addressing modes - -@c prevent bad page break with this line -This is about addressing modes. - -@defmac HAVE_PRE_INCREMENT -@defmacx HAVE_PRE_DECREMENT -@defmacx HAVE_POST_INCREMENT -@defmacx HAVE_POST_DECREMENT -A C expression that is nonzero if the machine supports pre-increment, -pre-decrement, post-increment, or post-decrement addressing respectively. -@end defmac - -@defmac HAVE_PRE_MODIFY_DISP -@defmacx HAVE_POST_MODIFY_DISP -A C expression that is nonzero if the machine supports pre- or -post-address side-effect generation involving constants other than -the size of the memory operand. -@end defmac - -@defmac HAVE_PRE_MODIFY_REG -@defmacx HAVE_POST_MODIFY_REG -A C expression that is nonzero if the machine supports pre- or -post-address side-effect generation involving a register displacement. -@end defmac - -@defmac CONSTANT_ADDRESS_P (@var{x}) -A C expression that is 1 if the RTX @var{x} is a constant which -is a valid address. On most machines the default definition of -@code{(CONSTANT_P (@var{x}) && GET_CODE (@var{x}) != CONST_DOUBLE)} -is acceptable, but a few machines are more restrictive as to which -constant addresses are supported. -@end defmac - -@defmac CONSTANT_P (@var{x}) -@code{CONSTANT_P}, which is defined by target-independent code, -accepts integer-values expressions whose values are not explicitly -known, such as @code{symbol_ref}, @code{label_ref}, and @code{high} -expressions and @code{const} arithmetic expressions, in addition to -@code{const_int} and @code{const_double} expressions. -@end defmac - -@defmac MAX_REGS_PER_ADDRESS -A number, the maximum number of registers that can appear in a valid -memory address. Note that it is up to you to specify a value equal to -the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever -accept. -@end defmac - -@deftypefn {Target Hook} bool TARGET_LEGITIMATE_ADDRESS_P (machine_mode @var{mode}, rtx @var{x}, bool @var{strict}) -A function that returns whether @var{x} (an RTX) is a legitimate memory -address on the target machine for a memory operand of mode @var{mode}. - -Legitimate addresses are defined in two variants: a strict variant and a -non-strict one. The @var{strict} parameter chooses which variant is -desired by the caller. - -The strict variant is used in the reload pass. It must be defined so -that any pseudo-register that has not been allocated a hard register is -considered a memory reference. This is because in contexts where some -kind of register is required, a pseudo-register with no hard register -must be rejected. For non-hard registers, the strict variant should look -up the @code{reg_renumber} array; it should then proceed using the hard -register number in the array, or treat the pseudo as a memory reference -if the array holds @code{-1}. - -The non-strict variant is used in other passes. It must be defined to -accept all pseudo-registers in every context where some kind of -register is required. - -Normally, constant addresses which are the sum of a @code{symbol_ref} -and an integer are stored inside a @code{const} RTX to mark them as -constant. Therefore, there is no need to recognize such sums -specifically as legitimate addresses. Normally you would simply -recognize any @code{const} as legitimate. - -Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant -sums that are not marked with @code{const}. It assumes that a naked -@code{plus} indicates indexing. If so, then you @emph{must} reject such -naked constant sums as illegitimate addresses, so that none of them will -be given to @code{PRINT_OPERAND_ADDRESS}. - -@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validation -On some machines, whether a symbolic address is legitimate depends on -the section that the address refers to. On these machines, define the -target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information -into the @code{symbol_ref}, and then check for it here. When you see a -@code{const}, you will have to look inside it to find the -@code{symbol_ref} in order to determine the section. @xref{Assembler -Format}. - -@cindex @code{GO_IF_LEGITIMATE_ADDRESS} -Some ports are still using a deprecated legacy substitute for -this hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macro -has this syntax: - -@example -#define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label}) -@end example - -@noindent -and should @code{goto @var{label}} if the address @var{x} is a valid -address on the target machine for a memory operand of mode @var{mode}. - -@findex REG_OK_STRICT -Compiler source files that want to use the strict variant of this -macro define the macro @code{REG_OK_STRICT}. You should use an -@code{#ifdef REG_OK_STRICT} conditional to define the strict variant in -that case and the non-strict variant otherwise. - -Using the hook is usually simpler because it limits the number of -files that are recompiled when changes are made. -@end deftypefn - -@defmac TARGET_MEM_CONSTRAINT -A single character to be used instead of the default @code{'m'} -character for general memory addresses. This defines the constraint -letter which matches the memory addresses accepted by -@code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to -support new address formats in your back end without changing the -semantics of the @code{'m'} constraint. This is necessary in order to -preserve functionality of inline assembly constructs using the -@code{'m'} constraint. -@end defmac - -@defmac FIND_BASE_TERM (@var{x}) -A C expression to determine the base term of address @var{x}, -or to provide a simplified version of @var{x} from which @file{alias.c} -can easily find the base term. This macro is used in only two places: -@code{find_base_value} and @code{find_base_term} in @file{alias.c}. - -It is always safe for this macro to not be defined. It exists so -that alias analysis can understand machine-dependent addresses. - -The typical use of this macro is to handle addresses containing -a label_ref or symbol_ref within an UNSPEC@. -@end defmac - -@deftypefn {Target Hook} rtx TARGET_LEGITIMIZE_ADDRESS (rtx @var{x}, rtx @var{oldx}, machine_mode @var{mode}) -This hook is given an invalid memory address @var{x} for an -operand of mode @var{mode} and should try to return a valid memory -address. - -@findex break_out_memory_refs -@var{x} will always be the result of a call to @code{break_out_memory_refs}, -and @var{oldx} will be the operand that was given to that function to produce -@var{x}. - -The code of the hook should not alter the substructure of -@var{x}. If it transforms @var{x} into a more legitimate form, it -should return the new @var{x}. - -It is not necessary for this hook to come up with a legitimate address, -with the exception of native TLS addresses (@pxref{Emulated TLS}). -The compiler has standard ways of doing so in all cases. In fact, if -the target supports only emulated TLS, it -is safe to omit this hook or make it return @var{x} if it cannot find -a valid way to legitimize the address. But often a machine-dependent -strategy can generate better code. -@end deftypefn - -@defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win}) -A C compound statement that attempts to replace @var{x}, which is an address -that needs reloading, with a valid memory address for an operand of mode -@var{mode}. @var{win} will be a C statement label elsewhere in the code. -It is not necessary to define this macro, but it might be useful for -performance reasons. - -For example, on the i386, it is sometimes possible to use a single -reload register instead of two by reloading a sum of two pseudo -registers into a register. On the other hand, for number of RISC -processors offsets are limited so that often an intermediate address -needs to be generated in order to address a stack slot. By defining -@code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses -generated for adjacent some stack slots can be made identical, and thus -be shared. - -@emph{Note}: This macro should be used with caution. It is necessary -to know something of how reload works in order to effectively use this, -and it is quite easy to produce macros that build in too much knowledge -of reload internals. - -@emph{Note}: This macro must be able to reload an address created by a -previous invocation of this macro. If it fails to handle such addresses -then the compiler may generate incorrect code or abort. - -@findex push_reload -The macro definition should use @code{push_reload} to indicate parts that -need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually -suitable to be passed unaltered to @code{push_reload}. - -The code generated by this macro must not alter the substructure of -@var{x}. If it transforms @var{x} into a more legitimate form, it -should assign @var{x} (which will always be a C variable) a new value. -This also applies to parts that you change indirectly by calling -@code{push_reload}. - -@findex strict_memory_address_p -The macro definition may use @code{strict_memory_address_p} to test if -the address has become legitimate. - -@findex copy_rtx -If you want to change only a part of @var{x}, one standard way of doing -this is to use @code{copy_rtx}. Note, however, that it unshares only a -single level of rtl. Thus, if the part to be changed is not at the -top level, you'll need to replace first the top level. -It is not necessary for this macro to come up with a legitimate -address; but often a machine-dependent strategy can generate better code. -@end defmac - -@deftypefn {Target Hook} bool TARGET_MODE_DEPENDENT_ADDRESS_P (const_rtx @var{addr}, addr_space_t @var{addrspace}) -This hook returns @code{true} if memory address @var{addr} in address -space @var{addrspace} can have -different meanings depending on the machine mode of the memory -reference it is used for or if the address is valid for some modes -but not others. - -Autoincrement and autodecrement addresses typically have mode-dependent -effects because the amount of the increment or decrement is the size -of the operand being addressed. Some machines have other mode-dependent -addresses. Many RISC machines have no mode-dependent addresses. - -You may assume that @var{addr} is a valid address for the machine. - -The default version of this hook returns @code{false}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_LEGITIMATE_CONSTANT_P (machine_mode @var{mode}, rtx @var{x}) -This hook returns true if @var{x} is a legitimate constant for a -@var{mode}-mode immediate operand on the target machine. You can assume that -@var{x} satisfies @code{CONSTANT_P}, so you need not check this. - -The default definition returns true. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_DELEGITIMIZE_ADDRESS (rtx @var{x}) -This hook is used to undo the possibly obfuscating effects of the -@code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target -macros. Some backend implementations of these macros wrap symbol -references inside an @code{UNSPEC} rtx to represent PIC or similar -addressing modes. This target hook allows GCC's optimizers to understand -the semantics of these opaque @code{UNSPEC}s by converting them back -into their original form. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CONST_NOT_OK_FOR_DEBUG_P (rtx @var{x}) -This hook should return true if @var{x} should not be emitted into -debug sections. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CANNOT_FORCE_CONST_MEM (machine_mode @var{mode}, rtx @var{x}) -This hook should return true if @var{x} is of a form that cannot (or -should not) be spilled to the constant pool. @var{mode} is the mode -of @var{x}. - -The default version of this hook returns false. - -The primary reason to define this hook is to prevent reload from -deciding that a non-legitimate constant would be better reloaded -from the constant pool instead of spilling and reloading a register -holding the constant. This restriction is often true of addresses -of TLS symbols for various targets. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_USE_BLOCKS_FOR_CONSTANT_P (machine_mode @var{mode}, const_rtx @var{x}) -This hook should return true if pool entries for constant @var{x} can -be placed in an @code{object_block} structure. @var{mode} is the mode -of @var{x}. - -The default version returns false for all constants. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_USE_BLOCKS_FOR_DECL_P (const_tree @var{decl}) -This hook should return true if pool entries for @var{decl} should -be placed in an @code{object_block} structure. - -The default version returns true for all decls. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_BUILTIN_RECIPROCAL (unsigned @var{fn}, bool @var{md_fn}, bool @var{sqrt}) -This hook should return the DECL of a function that implements reciprocal of -the builtin function with builtin function code @var{fn}, or -@code{NULL_TREE} if such a function is not available. @var{md_fn} is true -when @var{fn} is a code of a machine-dependent builtin function. When -@var{sqrt} is true, additional optimizations that apply only to the reciprocal -of a square root function are performed, and only reciprocals of @code{sqrt} -function are valid. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD (void) -This hook should return the DECL of a function @var{f} that given an -address @var{addr} as an argument returns a mask @var{m} that can be -used to extract from two vectors the relevant data that resides in -@var{addr} in case @var{addr} is not properly aligned. - -The autovectorizer, when vectorizing a load operation from an address -@var{addr} that may be unaligned, will generate two vector loads from -the two aligned addresses around @var{addr}. It then generates a -@code{REALIGN_LOAD} operation to extract the relevant data from the -two loaded vectors. The first two arguments to @code{REALIGN_LOAD}, -@var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and -the third argument, @var{OFF}, defines how the data will be extracted -from these two vectors: if @var{OFF} is 0, then the returned vector is -@var{v2}; otherwise, the returned vector is composed from the last -@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first -@var{OFF} elements of @var{v2}. - -If this hook is defined, the autovectorizer will generate a call -to @var{f} (using the DECL tree that this hook returns) and will -use the return value of @var{f} as the argument @var{OFF} to -@code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f} -should comply with the semantics expected by @code{REALIGN_LOAD} -described above. -If this hook is not defined, then @var{addr} will be used as -the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low -log2(@var{VS}) @minus{} 1 bits of @var{addr} will be considered. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST (enum vect_cost_for_stmt @var{type_of_cost}, tree @var{vectype}, int @var{misalign}) -Returns cost of different scalar or vector statements for vectorization cost model. -For vector memory operations the cost may depend on type (@var{vectype}) and -misalignment value (@var{misalign}). -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE (const_tree @var{type}, bool @var{is_packed}) -Return true if vector alignment is reachable (by peeling N iterations) for the given type. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST_OK (machine_mode, const unsigned char *@var{sel}) -Return true if a vector created for @code{vec_perm_const} is valid. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_CONVERSION (unsigned @var{code}, tree @var{dest_type}, tree @var{src_type}) -This hook should return the DECL of a function that implements conversion of the -input vector of type @var{src_type} to type @var{dest_type}. -The value of @var{code} is one of the enumerators in @code{enum tree_code} and -specifies how the conversion is to be applied -(truncation, rounding, etc.). - -If this hook is defined, the autovectorizer will use the -@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizing -conversion. Otherwise, it will return @code{NULL_TREE}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION (tree @var{fndecl}, tree @var{vec_type_out}, tree @var{vec_type_in}) -This hook should return the decl of a function that implements the -vectorized variant of the builtin function with builtin function code -@var{code} or @code{NULL_TREE} if such a function is not available. -The value of @var{fndecl} is the builtin function declaration. The -return type of the vectorized function shall be of vector type -@var{vec_type_out} and the argument types should be @var{vec_type_in}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT (machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed}) -This hook should return true if the target supports misaligned vector -store/load of a specific factor denoted in the @var{misalignment} -parameter. The vector store/load should be of machine mode @var{mode} and -the elements in the vectors should be of type @var{type}. @var{is_packed} -parameter is true if the memory access is defined in a packed struct. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_VECTORIZE_PREFERRED_SIMD_MODE (machine_mode @var{mode}) -This hook should return the preferred mode for vectorizing scalar -mode @var{mode}. The default is -equal to @code{word_mode}, because the vectorizer can do some -transformations even in absence of specialized @acronym{SIMD} hardware. -@end deftypefn - -@deftypefn {Target Hook} {unsigned int} TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES (void) -This hook should return a mask of sizes that should be iterated over -after trying to autovectorize using the vector size derived from the -mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}. -The default is zero which means to not iterate over other vector sizes. -@end deftypefn - -@deftypefn {Target Hook} {void *} TARGET_VECTORIZE_INIT_COST (struct loop *@var{loop_info}) -This hook should initialize target-specific data structures in preparation for modeling the costs of vectorizing a loop or basic block. The default allocates three unsigned integers for accumulating costs for the prologue, body, and epilogue of the loop or basic block. If @var{loop_info} is non-NULL, it identifies the loop being vectorized; otherwise a single block is being vectorized. -@end deftypefn - -@deftypefn {Target Hook} unsigned TARGET_VECTORIZE_ADD_STMT_COST (void *@var{data}, int @var{count}, enum vect_cost_for_stmt @var{kind}, struct _stmt_vec_info *@var{stmt_info}, int @var{misalign}, enum vect_cost_model_location @var{where}) -This hook should update the target-specific @var{data} in response to adding @var{count} copies of the given @var{kind} of statement to a loop or basic block. The default adds the builtin vectorizer cost for the copies of the statement to the accumulator specified by @var{where}, (the prologue, body, or epilogue) and returns the amount added. The return value should be viewed as a tentative cost that may later be revised. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_VECTORIZE_FINISH_COST (void *@var{data}, unsigned *@var{prologue_cost}, unsigned *@var{body_cost}, unsigned *@var{epilogue_cost}) -This hook should complete calculations of the cost of vectorizing a loop or basic block based on @var{data}, and return the prologue, body, and epilogue costs as unsigned integers. The default returns the value of the three accumulators. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_VECTORIZE_DESTROY_COST_DATA (void *@var{data}) -This hook should release @var{data} and any related data structures allocated by TARGET_VECTORIZE_INIT_COST. The default releases the accumulator. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_TM_LOAD (tree) -This hook should return the built-in decl needed to load a vector of the given type within a transaction. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_TM_STORE (tree) -This hook should return the built-in decl needed to store a vector of the given type within a transaction. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_GATHER (const_tree @var{mem_vectype}, const_tree @var{index_type}, int @var{scale}) -Target builtin that implements vector gather operation. @var{mem_vectype} -is the vector type of the load and @var{index_type} is scalar type of -the index, scaled by @var{scale}. -The default is @code{NULL_TREE} which means to not vectorize gather -loads. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN (struct cgraph_node *@var{}, struct cgraph_simd_clone *@var{}, @var{tree}, @var{int}) -This hook should set @var{vecsize_mangle}, @var{vecsize_int}, @var{vecsize_float} -fields in @var{simd_clone} structure pointed by @var{clone_info} argument and also -@var{simdlen} field if it was previously 0. -The hook should return 0 if SIMD clones shouldn't be emitted, -or number of @var{vecsize_mangle} variants that should be emitted. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SIMD_CLONE_ADJUST (struct cgraph_node *@var{}) -This hook should add implicit @code{attribute(target("..."))} attribute -to SIMD clone @var{node} if needed. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SIMD_CLONE_USABLE (struct cgraph_node *@var{}) -This hook should return -1 if SIMD clone @var{node} shouldn't be used -in vectorized loops in current function, or non-negative number if it is -usable. In that case, the smaller the number is, the more desirable it is -to use it. -@end deftypefn - -@node Anchored Addresses -@section Anchored Addresses -@cindex anchored addresses -@cindex @option{-fsection-anchors} - -GCC usually addresses every static object as a separate entity. -For example, if we have: - -@smallexample -static int a, b, c; -int foo (void) @{ return a + b + c; @} -@end smallexample - -the code for @code{foo} will usually calculate three separate symbolic -addresses: those of @code{a}, @code{b} and @code{c}. On some targets, -it would be better to calculate just one symbolic address and access -the three variables relative to it. The equivalent pseudocode would -be something like: - -@smallexample -int foo (void) -@{ - register int *xr = &x; - return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; -@} -@end smallexample - -(which isn't valid C). We refer to shared addresses like @code{x} as -``section anchors''. Their use is controlled by @option{-fsection-anchors}. - -The hooks below describe the target properties that GCC needs to know -in order to make effective use of section anchors. It won't use -section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET} -or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value. - -@deftypevr {Target Hook} HOST_WIDE_INT TARGET_MIN_ANCHOR_OFFSET -The minimum offset that should be applied to a section anchor. -On most targets, it should be the smallest offset that can be -applied to a base register while still giving a legitimate address -for every mode. The default value is 0. -@end deftypevr - -@deftypevr {Target Hook} HOST_WIDE_INT TARGET_MAX_ANCHOR_OFFSET -Like @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive) -offset that should be applied to section anchors. The default -value is 0. -@end deftypevr - -@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_ANCHOR (rtx @var{x}) -Write the assembly code to define section anchor @var{x}, which is a -@code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true. -The hook is called with the assembly output position set to the beginning -of @code{SYMBOL_REF_BLOCK (@var{x})}. - -If @code{ASM_OUTPUT_DEF} is available, the hook's default definition uses -it to define the symbol as @samp{. + SYMBOL_REF_BLOCK_OFFSET (@var{x})}. -If @code{ASM_OUTPUT_DEF} is not available, the hook's default definition -is @code{NULL}, which disables the use of section anchors altogether. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_USE_ANCHORS_FOR_SYMBOL_P (const_rtx @var{x}) -Return true if GCC should attempt to use anchors to access @code{SYMBOL_REF} -@var{x}. You can assume @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})} and -@samp{!SYMBOL_REF_ANCHOR_P (@var{x})}. - -The default version is correct for most targets, but you might need to -intercept this hook to handle things like target-specific attributes -or target-specific sections. -@end deftypefn - -@node Condition Code -@section Condition Code Status -@cindex condition code status - -The macros in this section can be split in two families, according to the -two ways of representing condition codes in GCC. - -The first representation is the so called @code{(cc0)} representation -(@pxref{Jump Patterns}), where all instructions can have an implicit -clobber of the condition codes. The second is the condition code -register representation, which provides better schedulability for -architectures that do have a condition code register, but on which -most instructions do not affect it. The latter category includes -most RISC machines. - -The implicit clobbering poses a strong restriction on the placement of -the definition and use of the condition code. In the past the definition -and use were always adjacent. However, recent changes to support trapping -arithmatic may result in the definition and user being in different blocks. -Thus, there may be a @code{NOTE_INSN_BASIC_BLOCK} between them. Additionally, -the definition may be the source of exception handling edges. - -These restrictions can prevent important -optimizations on some machines. For example, on the IBM RS/6000, there -is a delay for taken branches unless the condition code register is set -three instructions earlier than the conditional branch. The instruction -scheduler cannot perform this optimization if it is not permitted to -separate the definition and use of the condition code register. - -For this reason, it is possible and suggested to use a register to -represent the condition code for new ports. If there is a specific -condition code register in the machine, use a hard register. If the -condition code or comparison result can be placed in any general register, -or if there are multiple condition registers, use a pseudo register. -Registers used to store the condition code value will usually have a mode -that is in class @code{MODE_CC}. - -Alternatively, you can use @code{BImode} if the comparison operator is -specified already in the compare instruction. In this case, you are not -interested in most macros in this section. - -@menu -* CC0 Condition Codes:: Old style representation of condition codes. -* MODE_CC Condition Codes:: Modern representation of condition codes. -@end menu - -@node CC0 Condition Codes -@subsection Representation of condition codes using @code{(cc0)} -@findex cc0 - -@findex cc_status -The file @file{conditions.h} defines a variable @code{cc_status} to -describe how the condition code was computed (in case the interpretation of -the condition code depends on the instruction that it was set by). This -variable contains the RTL expressions on which the condition code is -currently based, and several standard flags. - -Sometimes additional machine-specific flags must be defined in the machine -description header file. It can also add additional machine-specific -information by defining @code{CC_STATUS_MDEP}. - -@defmac CC_STATUS_MDEP -C code for a data type which is used for declaring the @code{mdep} -component of @code{cc_status}. It defaults to @code{int}. - -This macro is not used on machines that do not use @code{cc0}. -@end defmac - -@defmac CC_STATUS_MDEP_INIT -A C expression to initialize the @code{mdep} field to ``empty''. -The default definition does nothing, since most machines don't use -the field anyway. If you want to use the field, you should probably -define this macro to initialize it. - -This macro is not used on machines that do not use @code{cc0}. -@end defmac - -@defmac NOTICE_UPDATE_CC (@var{exp}, @var{insn}) -A C compound statement to set the components of @code{cc_status} -appropriately for an insn @var{insn} whose body is @var{exp}. It is -this macro's responsibility to recognize insns that set the condition -code as a byproduct of other activity as well as those that explicitly -set @code{(cc0)}. - -This macro is not used on machines that do not use @code{cc0}. - -If there are insns that do not set the condition code but do alter -other machine registers, this macro must check to see whether they -invalidate the expressions that the condition code is recorded as -reflecting. For example, on the 68000, insns that store in address -registers do not set the condition code, which means that usually -@code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such -insns. But suppose that the previous insn set the condition code -based on location @samp{a4@@(102)} and the current insn stores a new -value in @samp{a4}. Although the condition code is not changed by -this, it will no longer be true that it reflects the contents of -@samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter -@code{cc_status} in this case to say that nothing is known about the -condition code value. - -The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal -with the results of peephole optimization: insns whose patterns are -@code{parallel} RTXs containing various @code{reg}, @code{mem} or -constants which are just the operands. The RTL structure of these -insns is not sufficient to indicate what the insns actually do. What -@code{NOTICE_UPDATE_CC} should do when it sees one is just to run -@code{CC_STATUS_INIT}. - -A possible definition of @code{NOTICE_UPDATE_CC} is to call a function -that looks at an attribute (@pxref{Insn Attributes}) named, for example, -@samp{cc}. This avoids having detailed information about patterns in -two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}. -@end defmac - -@node MODE_CC Condition Codes -@subsection Representation of condition codes using registers -@findex CCmode -@findex MODE_CC - -@defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y}) -On many machines, the condition code may be produced by other instructions -than compares, for example the branch can use directly the condition -code set by a subtract instruction. However, on some machines -when the condition code is set this way some bits (such as the overflow -bit) are not set in the same way as a test instruction, so that a different -branch instruction must be used for some conditional branches. When -this happens, use the machine mode of the condition code register to -record different formats of the condition code register. Modes can -also be used to record which compare instruction (e.g. a signed or an -unsigned comparison) produced the condition codes. - -If other modes than @code{CCmode} are required, add them to -@file{@var{machine}-modes.def} and define @code{SELECT_CC_MODE} to choose -a mode given an operand of a compare. This is needed because the modes -have to be chosen not only during RTL generation but also, for example, -by instruction combination. The result of @code{SELECT_CC_MODE} should -be consistent with the mode used in the patterns; for example to support -the case of the add on the SPARC discussed above, we have the pattern - -@smallexample -(define_insn "" - [(set (reg:CC_NOOV 0) - (compare:CC_NOOV - (plus:SI (match_operand:SI 0 "register_operand" "%r") - (match_operand:SI 1 "arith_operand" "rI")) - (const_int 0)))] - "" - "@dots{}") -@end smallexample - -@noindent -together with a @code{SELECT_CC_MODE} that returns @code{CC_NOOVmode} -for comparisons whose argument is a @code{plus}: - -@smallexample -#define SELECT_CC_MODE(OP,X,Y) \ - (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ - ? ((OP == LT || OP == LE || OP == GT || OP == GE) \ - ? CCFPEmode : CCFPmode) \ - : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \ - || GET_CODE (X) == NEG || GET_CODE (x) == ASHIFT) \ - ? CC_NOOVmode : CCmode)) -@end smallexample - -Another reason to use modes is to retain information on which operands -were used by the comparison; see @code{REVERSIBLE_CC_MODE} later in -this section. - -You should define this macro if and only if you define extra CC modes -in @file{@var{machine}-modes.def}. -@end defmac - -@deftypefn {Target Hook} void TARGET_CANONICALIZE_COMPARISON (int *@var{code}, rtx *@var{op0}, rtx *@var{op1}, bool @var{op0_preserve_value}) -On some machines not all possible comparisons are defined, but you can -convert an invalid comparison into a valid one. For example, the Alpha -does not have a @code{GT} comparison, but you can use an @code{LT} -comparison instead and swap the order of the operands. - -On such machines, implement this hook to do any required conversions. -@var{code} is the initial comparison code and @var{op0} and @var{op1} -are the left and right operands of the comparison, respectively. If -@var{op0_preserve_value} is @code{true} the implementation is not -allowed to change the value of @var{op0} since the value might be used -in RTXs which aren't comparisons. E.g. the implementation is not -allowed to swap operands in that case. - -GCC will not assume that the comparison resulting from this macro is -valid but will see if the resulting insn matches a pattern in the -@file{md} file. - -You need not to implement this hook if it would never change the -comparison code or operands. -@end deftypefn - -@defmac REVERSIBLE_CC_MODE (@var{mode}) -A C expression whose value is one if it is always safe to reverse a -comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE} -can ever return @var{mode} for a floating-point inequality comparison, -then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero. - -You need not define this macro if it would always returns zero or if the -floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}. -For example, here is the definition used on the SPARC, where floating-point -inequality comparisons are given either @code{CCFPEmode} or @code{CCFPmode}: - -@smallexample -#define REVERSIBLE_CC_MODE(MODE) \ - ((MODE) != CCFPEmode && (MODE) != CCFPmode) -@end smallexample -@end defmac - -@defmac REVERSE_CONDITION (@var{code}, @var{mode}) -A C expression whose value is reversed condition code of the @var{code} for -comparison done in CC_MODE @var{mode}. The macro is used only in case -@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case -machine has some non-standard way how to reverse certain conditionals. For -instance in case all floating point conditions are non-trapping, compiler may -freely convert unordered compares to ordered ones. Then definition may look -like: - -@smallexample -#define REVERSE_CONDITION(CODE, MODE) \ - ((MODE) != CCFPmode ? reverse_condition (CODE) \ - : reverse_condition_maybe_unordered (CODE)) -@end smallexample -@end defmac - -@deftypefn {Target Hook} bool TARGET_FIXED_CONDITION_CODE_REGS (unsigned int *@var{p1}, unsigned int *@var{p2}) -On targets which do not use @code{(cc0)}, and which use a hard -register rather than a pseudo-register to hold condition codes, the -regular CSE passes are often not able to identify cases in which the -hard register is set to a common value. Use this hook to enable a -small pass which optimizes such cases. This hook should return true -to enable this pass, and it should set the integers to which its -arguments point to the hard register numbers used for condition codes. -When there is only one such register, as is true on most systems, the -integer pointed to by @var{p2} should be set to -@code{INVALID_REGNUM}. - -The default version of this hook returns false. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_CC_MODES_COMPATIBLE (machine_mode @var{m1}, machine_mode @var{m2}) -On targets which use multiple condition code modes in class -@code{MODE_CC}, it is sometimes the case that a comparison can be -validly done in more than one mode. On such a system, define this -target hook to take two mode arguments and to return a mode in which -both comparisons may be validly done. If there is no such mode, -return @code{VOIDmode}. - -The default version of this hook checks whether the modes are the -same. If they are, it returns that mode. If they are different, it -returns @code{VOIDmode}. -@end deftypefn - -@deftypevr {Target Hook} {unsigned int} TARGET_FLAGS_REGNUM -If the target has a dedicated flags register, and it needs to use the post-reload comparison elimination pass, then this value should be set appropriately. -@end deftypevr - -@node Costs -@section Describing Relative Costs of Operations -@cindex costs of instructions -@cindex relative costs -@cindex speed of instructions - -These macros let you describe the relative speed of various operations -on the target machine. - -@defmac REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to}) -A C expression for the cost of moving data of mode @var{mode} from a -register in class @var{from} to one in class @var{to}. The classes are -expressed using the enumeration values such as @code{GENERAL_REGS}. A -value of 2 is the default; other values are interpreted relative to -that. - -It is not required that the cost always equal 2 when @var{from} is the -same as @var{to}; on some machines it is expensive to move between -registers if they are not general registers. - -If reload sees an insn consisting of a single @code{set} between two -hard registers, and if @code{REGISTER_MOVE_COST} applied to their -classes returns a value of 2, reload does not check to ensure that the -constraints of the insn are met. Setting a cost of other than 2 will -allow reload to verify that the constraints are met. You should do this -if the @samp{mov@var{m}} pattern's constraints do not allow such copying. - -These macros are obsolete, new ports should use the target hook -@code{TARGET_REGISTER_MOVE_COST} instead. -@end defmac - -@deftypefn {Target Hook} int TARGET_REGISTER_MOVE_COST (machine_mode @var{mode}, reg_class_t @var{from}, reg_class_t @var{to}) -This target hook should return the cost of moving data of mode @var{mode} -from a register in class @var{from} to one in class @var{to}. The classes -are expressed using the enumeration values such as @code{GENERAL_REGS}. -A value of 2 is the default; other values are interpreted relative to -that. - -It is not required that the cost always equal 2 when @var{from} is the -same as @var{to}; on some machines it is expensive to move between -registers if they are not general registers. - -If reload sees an insn consisting of a single @code{set} between two -hard registers, and if @code{TARGET_REGISTER_MOVE_COST} applied to their -classes returns a value of 2, reload does not check to ensure that the -constraints of the insn are met. Setting a cost of other than 2 will -allow reload to verify that the constraints are met. You should do this -if the @samp{mov@var{m}} pattern's constraints do not allow such copying. - -The default version of this function returns 2. -@end deftypefn - -@defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in}) -A C expression for the cost of moving data of mode @var{mode} between a -register of class @var{class} and memory; @var{in} is zero if the value -is to be written to memory, nonzero if it is to be read in. This cost -is relative to those in @code{REGISTER_MOVE_COST}. If moving between -registers and memory is more expensive than between two registers, you -should define this macro to express the relative cost. - -If you do not define this macro, GCC uses a default cost of 4 plus -the cost of copying via a secondary reload register, if one is -needed. If your machine requires a secondary reload register to copy -between memory and a register of @var{class} but the reload mechanism is -more complex than copying via an intermediate, define this macro to -reflect the actual cost of the move. - -GCC defines the function @code{memory_move_secondary_cost} if -secondary reloads are needed. It computes the costs due to copying via -a secondary register. If your machine copies from memory using a -secondary register in the conventional way but the default base value of -4 is not correct for your machine, define this macro to add some other -value to the result of that function. The arguments to that function -are the same as to this macro. - -These macros are obsolete, new ports should use the target hook -@code{TARGET_MEMORY_MOVE_COST} instead. -@end defmac - -@deftypefn {Target Hook} int TARGET_MEMORY_MOVE_COST (machine_mode @var{mode}, reg_class_t @var{rclass}, bool @var{in}) -This target hook should return the cost of moving data of mode @var{mode} -between a register of class @var{rclass} and memory; @var{in} is @code{false} -if the value is to be written to memory, @code{true} if it is to be read in. -This cost is relative to those in @code{TARGET_REGISTER_MOVE_COST}. -If moving between registers and memory is more expensive than between two -registers, you should add this target hook to express the relative cost. - -If you do not add this target hook, GCC uses a default cost of 4 plus -the cost of copying via a secondary reload register, if one is -needed. If your machine requires a secondary reload register to copy -between memory and a register of @var{rclass} but the reload mechanism is -more complex than copying via an intermediate, use this target hook to -reflect the actual cost of the move. - -GCC defines the function @code{memory_move_secondary_cost} if -secondary reloads are needed. It computes the costs due to copying via -a secondary register. If your machine copies from memory using a -secondary register in the conventional way but the default base value of -4 is not correct for your machine, use this target hook to add some other -value to the result of that function. The arguments to that function -are the same as to this target hook. -@end deftypefn - -@defmac BRANCH_COST (@var{speed_p}, @var{predictable_p}) -A C expression for the cost of a branch instruction. A value of 1 is -the default; other values are interpreted relative to that. Parameter -@var{speed_p} is true when the branch in question should be optimized -for speed. When it is false, @code{BRANCH_COST} should return a value -optimal for code size rather than performance. @var{predictable_p} is -true for well-predicted branches. On many architectures the -@code{BRANCH_COST} can be reduced then. -@end defmac - -Here are additional macros which do not specify precise relative costs, -but only that certain actions are more expensive than GCC would -ordinarily expect. - -@defmac SLOW_BYTE_ACCESS -Define this macro as a C expression which is nonzero if accessing less -than a word of memory (i.e.@: a @code{char} or a @code{short}) is no -faster than accessing a word of memory, i.e., if such access -require more than one instruction or if there is no difference in cost -between byte and (aligned) word loads. - -When this macro is not defined, the compiler will access a field by -finding the smallest containing object; when it is defined, a fullword -load will be used if alignment permits. Unless bytes accesses are -faster than word accesses, using word accesses is preferable since it -may eliminate subsequent memory access if subsequent accesses occur to -other fields in the same word of the structure, but to different bytes. -@end defmac - -@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment}) -Define this macro to be the value 1 if memory accesses described by the -@var{mode} and @var{alignment} parameters have a cost many times greater -than aligned accesses, for example if they are emulated in a trap -handler. - -When this macro is nonzero, the compiler will act as if -@code{STRICT_ALIGNMENT} were nonzero when generating code for block -moves. This can cause significantly more instructions to be produced. -Therefore, do not set this macro nonzero if unaligned accesses only add a -cycle or two to the time for a memory access. - -If the value of this macro is always zero, it need not be defined. If -this macro is defined, it should produce a nonzero value when -@code{STRICT_ALIGNMENT} is nonzero. -@end defmac - -@defmac MOVE_RATIO (@var{speed}) -The threshold of number of scalar memory-to-memory move insns, @emph{below} -which a sequence of insns should be generated instead of a -string move insn or a library call. Increasing the value will always -make code faster, but eventually incurs high cost in increased code size. - -Note that on machines where the corresponding move insn is a -@code{define_expand} that emits a sequence of insns, this macro counts -the number of such sequences. - -The parameter @var{speed} is true if the code is currently being -optimized for speed rather than size. - -If you don't define this, a reasonable default is used. -@end defmac - -@deftypefn {Target Hook} bool TARGET_USE_BY_PIECES_INFRASTRUCTURE_P (unsigned HOST_WIDE_INT @var{size}, unsigned int @var{alignment}, enum by_pieces_operation @var{op}, bool @var{speed_p}) -GCC will attempt several strategies when asked to copy between -two areas of memory, or to set, clear or store to memory, for example -when copying a @code{struct}. The @code{by_pieces} infrastructure -implements such memory operations as a sequence of load, store or move -insns. Alternate strategies are to expand the -@code{movmem} or @code{setmem} optabs, to emit a library call, or to emit -unit-by-unit, loop-based operations. - -This target hook should return true if, for a memory operation with a -given @var{size} and @var{alignment}, using the @code{by_pieces} -infrastructure is expected to result in better code generation. -Both @var{size} and @var{alignment} are measured in terms of storage -units. - -The parameter @var{op} is one of: @code{CLEAR_BY_PIECES}, -@code{MOVE_BY_PIECES}, @code{SET_BY_PIECES}, @code{STORE_BY_PIECES}. -These describe the type of memory operation under consideration. - -The parameter @var{speed_p} is true if the code is currently being -optimized for speed rather than size. - -Returning true for higher values of @var{size} can improve code generation -for speed if the target does not provide an implementation of the -@code{movmem} or @code{setmem} standard names, if the @code{movmem} or -@code{setmem} implementation would be more expensive than a sequence of -insns, or if the overhead of a library call would dominate that of -the body of the memory operation. - -Returning true for higher values of @code{size} may also cause an increase -in code size, for example where the number of insns emitted to perform a -move would be greater than that of a library call. -@end deftypefn - -@defmac MOVE_MAX_PIECES -A C expression used by @code{move_by_pieces} to determine the largest unit -a load or store used to copy memory is. Defaults to @code{MOVE_MAX}. -@end defmac - -@defmac CLEAR_RATIO (@var{speed}) -The threshold of number of scalar move insns, @emph{below} which a sequence -of insns should be generated to clear memory instead of a string clear insn -or a library call. Increasing the value will always make code faster, but -eventually incurs high cost in increased code size. - -The parameter @var{speed} is true if the code is currently being -optimized for speed rather than size. - -If you don't define this, a reasonable default is used. -@end defmac - -@defmac SET_RATIO (@var{speed}) -The threshold of number of scalar move insns, @emph{below} which a sequence -of insns should be generated to set memory to a constant value, instead of -a block set insn or a library call. -Increasing the value will always make code faster, but -eventually incurs high cost in increased code size. - -The parameter @var{speed} is true if the code is currently being -optimized for speed rather than size. - -If you don't define this, it defaults to the value of @code{MOVE_RATIO}. -@end defmac - -@defmac USE_LOAD_POST_INCREMENT (@var{mode}) -A C expression used to determine whether a load postincrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_POST_INCREMENT}. -@end defmac - -@defmac USE_LOAD_POST_DECREMENT (@var{mode}) -A C expression used to determine whether a load postdecrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_POST_DECREMENT}. -@end defmac - -@defmac USE_LOAD_PRE_INCREMENT (@var{mode}) -A C expression used to determine whether a load preincrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_PRE_INCREMENT}. -@end defmac - -@defmac USE_LOAD_PRE_DECREMENT (@var{mode}) -A C expression used to determine whether a load predecrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_PRE_DECREMENT}. -@end defmac - -@defmac USE_STORE_POST_INCREMENT (@var{mode}) -A C expression used to determine whether a store postincrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_POST_INCREMENT}. -@end defmac - -@defmac USE_STORE_POST_DECREMENT (@var{mode}) -A C expression used to determine whether a store postdecrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_POST_DECREMENT}. -@end defmac - -@defmac USE_STORE_PRE_INCREMENT (@var{mode}) -This macro is used to determine whether a store preincrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_PRE_INCREMENT}. -@end defmac - -@defmac USE_STORE_PRE_DECREMENT (@var{mode}) -This macro is used to determine whether a store predecrement is a good -thing to use for a given mode. Defaults to the value of -@code{HAVE_PRE_DECREMENT}. -@end defmac - -@defmac NO_FUNCTION_CSE -Define this macro if it is as good or better to call a constant -function address than to call an address kept in a register. -@end defmac - -@defmac LOGICAL_OP_NON_SHORT_CIRCUIT -Define this macro if a non-short-circuit operation produced by -@samp{fold_range_test ()} is optimal. This macro defaults to true if -@code{BRANCH_COST} is greater than or equal to the value 2. -@end defmac - -@deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int @var{opno}, int *@var{total}, bool @var{speed}) -This target hook describes the relative costs of RTL expressions. - -The cost may depend on the precise form of the expression, which is -available for examination in @var{x}, and the fact that @var{x} appears -as operand @var{opno} of an expression with rtx code @var{outer_code}. -That is, the hook can assume that there is some rtx @var{y} such -that @samp{GET_CODE (@var{y}) == @var{outer_code}} and such that -either (a) @samp{XEXP (@var{y}, @var{opno}) == @var{x}} or -(b) @samp{XVEC (@var{y}, @var{opno})} contains @var{x}. - -@var{code} is @var{x}'s expression code---redundant, since it can be -obtained with @code{GET_CODE (@var{x})}. - -In implementing this hook, you can use the construct -@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast -instructions. - -On entry to the hook, @code{*@var{total}} contains a default estimate -for the cost of the expression. The hook should modify this value as -necessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)} -for multiplications, @code{COSTS_N_INSNS (7)} for division and modulus -operations, and @code{COSTS_N_INSNS (1)} for all other operations. - -When optimizing for code size, i.e.@: when @code{speed} is -false, this target hook should be used to estimate the relative -size cost of an expression, again relative to @code{COSTS_N_INSNS}. - -The hook returns true when all subexpressions of @var{x} have been -processed, and false when @code{rtx_cost} should recurse. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}, machine_mode @var{mode}, addr_space_t @var{as}, bool @var{speed}) -This hook computes the cost of an addressing mode that contains -@var{address}. If not defined, the cost is computed from -the @var{address} expression and the @code{TARGET_RTX_COST} hook. - -For most CISC machines, the default cost is a good approximation of the -true cost of the addressing mode. However, on RISC machines, all -instructions normally have the same length and execution time. Hence -all addresses will have equal costs. - -In cases where more than one form of an address is known, the form with -the lowest cost will be used. If multiple forms have the same, lowest, -cost, the one that is the most complex will be used. - -For example, suppose an address that is equal to the sum of a register -and a constant is used twice in the same basic block. When this macro -is not defined, the address will be computed in a register and memory -references will be indirect through that register. On machines where -the cost of the addressing mode containing the sum is no higher than -that of a simple indirect reference, this will produce an additional -instruction and possibly require an additional register. Proper -specification of this macro eliminates this overhead for such machines. - -This hook is never called with an invalid address. - -On machines where an address involving more than one register is as -cheap as an address computation involving only one register, defining -@code{TARGET_ADDRESS_COST} to reflect this can cause two registers to -be live over a region of code where only one would have been if -@code{TARGET_ADDRESS_COST} were not defined in that manner. This effect -should be considered in the definition of this macro. Equivalent costs -should probably only be given to addresses with different numbers of -registers on machines with lots of registers. -@end deftypefn - -@node Scheduling -@section Adjusting the Instruction Scheduler - -The instruction scheduler may need a fair amount of machine-specific -adjustment in order to produce good code. GCC provides several target -hooks for this purpose. It is usually enough to define just a few of -them: try the first ones in this list first. - -@deftypefn {Target Hook} int TARGET_SCHED_ISSUE_RATE (void) -This hook returns the maximum number of instructions that can ever -issue at the same time on the target machine. The default is one. -Although the insn scheduler can define itself the possibility of issue -an insn on the same cycle, the value can serve as an additional -constraint to issue insns on the same simulated processor cycle (see -hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}). -This value must be constant over the entire compilation. If you need -it to vary depending on what the instructions are, you must use -@samp{TARGET_SCHED_VARIABLE_ISSUE}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_VARIABLE_ISSUE (FILE *@var{file}, int @var{verbose}, rtx_insn *@var{insn}, int @var{more}) -This hook is executed by the scheduler after it has scheduled an insn -from the ready list. It should return the number of insns which can -still be issued in the current cycle. The default is -@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and -@code{USE}, which normally are not counted against the issue rate. -You should define this hook if some insns take more machine resources -than others, so that fewer insns can follow them in the same cycle. -@var{file} is either a null pointer, or a stdio stream to write any -debug output to. @var{verbose} is the verbose level provided by -@option{-fsched-verbose-@var{n}}. @var{insn} is the instruction that -was scheduled. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_ADJUST_COST (rtx_insn *@var{insn}, rtx @var{link}, rtx_insn *@var{dep_insn}, int @var{cost}) -This function corrects the value of @var{cost} based on the -relationship between @var{insn} and @var{dep_insn} through the -dependence @var{link}. It should return the new value. The default -is to make no adjustment to @var{cost}. This can be used for example -to specify to the scheduler using the traditional pipeline description -that an output- or anti-dependence does not incur the same cost as a -data-dependence. If the scheduler using the automaton based pipeline -description, the cost of anti-dependence is zero and the cost of -output-dependence is maximum of one and the difference of latency -times of the first and the second insns. If these values are not -acceptable, you could use the hook to modify them too. See also -@pxref{Processor pipeline description}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_ADJUST_PRIORITY (rtx_insn *@var{insn}, int @var{priority}) -This hook adjusts the integer scheduling priority @var{priority} of -@var{insn}. It should return the new priority. Increase the priority to -execute @var{insn} earlier, reduce the priority to execute @var{insn} -later. Do not define this hook if you do not need to adjust the -scheduling priorities of insns. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_REORDER (FILE *@var{file}, int @var{verbose}, rtx_insn **@var{ready}, int *@var{n_readyp}, int @var{clock}) -This hook is executed by the scheduler after it has scheduled the ready -list, to allow the machine description to reorder it (for example to -combine two small instructions together on @samp{VLIW} machines). -@var{file} is either a null pointer, or a stdio stream to write any -debug output to. @var{verbose} is the verbose level provided by -@option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready -list of instructions that are ready to be scheduled. @var{n_readyp} is -a pointer to the number of elements in the ready list. The scheduler -reads the ready list in reverse order, starting with -@var{ready}[@var{*n_readyp} @minus{} 1] and going to @var{ready}[0]. @var{clock} -is the timer tick of the scheduler. You may modify the ready list and -the number of ready insns. The return value is the number of insns that -can issue this cycle; normally this is just @code{issue_rate}. See also -@samp{TARGET_SCHED_REORDER2}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_REORDER2 (FILE *@var{file}, int @var{verbose}, rtx_insn **@var{ready}, int *@var{n_readyp}, int @var{clock}) -Like @samp{TARGET_SCHED_REORDER}, but called at a different time. That -function is called whenever the scheduler starts a new cycle. This one -is called once per iteration over a cycle, immediately after -@samp{TARGET_SCHED_VARIABLE_ISSUE}; it can reorder the ready list and -return the number of insns to be scheduled in the same cycle. Defining -this hook can be useful if there are frequent situations where -scheduling one insn causes other insns to become ready in the same -cycle. These other insns can then be taken into account properly. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCHED_MACRO_FUSION_P (void) -This hook is used to check whether target platform supports macro fusion. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCHED_MACRO_FUSION_PAIR_P (rtx_insn *@var{prev}, rtx_insn *@var{curr}) -This hook is used to check whether two insns should be macro fused for -a target microarchitecture. If this hook returns true for the given insn pair -(@var{prev} and @var{curr}), the scheduler will put them into a sched -group, and they will not be scheduled apart. The two insns will be either -two SET insns or a compare and a conditional jump and this hook should -validate any dependencies needed to fuse the two insns together. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK (rtx_insn *@var{head}, rtx_insn *@var{tail}) -This hook is called after evaluation forward dependencies of insns in -chain given by two parameter values (@var{head} and @var{tail} -correspondingly) but before insns scheduling of the insn chain. For -example, it can be used for better insn classification if it requires -analysis of dependencies. This hook can use backward and forward -dependencies of the insn scheduler because they are already -calculated. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_INIT (FILE *@var{file}, int @var{verbose}, int @var{max_ready}) -This hook is executed by the scheduler at the beginning of each block of -instructions that are to be scheduled. @var{file} is either a null -pointer, or a stdio stream to write any debug output to. @var{verbose} -is the verbose level provided by @option{-fsched-verbose-@var{n}}. -@var{max_ready} is the maximum number of insns in the current scheduling -region that can be live at the same time. This can be used to allocate -scratch space if it is needed, e.g.@: by @samp{TARGET_SCHED_REORDER}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FINISH (FILE *@var{file}, int @var{verbose}) -This hook is executed by the scheduler at the end of each block of -instructions that are to be scheduled. It can be used to perform -cleanup of any actions done by the other scheduling hooks. @var{file} -is either a null pointer, or a stdio stream to write any debug output -to. @var{verbose} is the verbose level provided by -@option{-fsched-verbose-@var{n}}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_INIT_GLOBAL (FILE *@var{file}, int @var{verbose}, int @var{old_max_uid}) -This hook is executed by the scheduler after function level initializations. -@var{file} is either a null pointer, or a stdio stream to write any debug output to. -@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}. -@var{old_max_uid} is the maximum insn uid when scheduling begins. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FINISH_GLOBAL (FILE *@var{file}, int @var{verbose}) -This is the cleanup hook corresponding to @code{TARGET_SCHED_INIT_GLOBAL}. -@var{file} is either a null pointer, or a stdio stream to write any debug output to. -@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_SCHED_DFA_PRE_CYCLE_INSN (void) -The hook returns an RTL insn. The automaton state used in the -pipeline hazard recognizer is changed as if the insn were scheduled -when the new simulated processor cycle starts. Usage of the hook may -simplify the automaton pipeline description for some @acronym{VLIW} -processors. If the hook is defined, it is used only for the automaton -based pipeline description. The default is not to change the state -when the new simulated processor cycle starts. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN (void) -The hook can be used to initialize data used by the previous hook. -@end deftypefn - -@deftypefn {Target Hook} {rtx_insn *} TARGET_SCHED_DFA_POST_CYCLE_INSN (void) -The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used -to changed the state as if the insn were scheduled when the new -simulated processor cycle finishes. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN (void) -The hook is analogous to @samp{TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN} but -used to initialize data used by the previous hook. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE (void) -The hook to notify target that the current simulated cycle is about to finish. -The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used -to change the state in more complicated situations - e.g., when advancing -state on a single insn is not enough. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_DFA_POST_ADVANCE_CYCLE (void) -The hook to notify target that new simulated cycle has just started. -The hook is analogous to @samp{TARGET_SCHED_DFA_POST_CYCLE_INSN} but used -to change the state in more complicated situations - e.g., when advancing -state on a single insn is not enough. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD (void) -This hook controls better choosing an insn from the ready insn queue -for the @acronym{DFA}-based insn scheduler. Usually the scheduler -chooses the first insn from the queue. If the hook returns a positive -value, an additional scheduler code tries all permutations of -@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD ()} -subsequent ready insns to choose an insn whose issue will result in -maximal number of issued insns on the same cycle. For the -@acronym{VLIW} processor, the code could actually solve the problem of -packing simple insns into the @acronym{VLIW} insn. Of course, if the -rules of @acronym{VLIW} packing are described in the automaton. - -This code also could be used for superscalar @acronym{RISC} -processors. Let us consider a superscalar @acronym{RISC} processor -with 3 pipelines. Some insns can be executed in pipelines @var{A} or -@var{B}, some insns can be executed only in pipelines @var{B} or -@var{C}, and one insn can be executed in pipeline @var{B}. The -processor may issue the 1st insn into @var{A} and the 2nd one into -@var{B}. In this case, the 3rd insn will wait for freeing @var{B} -until the next cycle. If the scheduler issues the 3rd insn the first, -the processor could issue all 3 insns per cycle. - -Actually this code demonstrates advantages of the automaton based -pipeline hazard recognizer. We try quickly and easy many insn -schedules to choose the best one. - -The default is no multipass scheduling. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD (rtx_insn *@var{insn}, int @var{ready_index}) - -This hook controls what insns from the ready insn queue will be -considered for the multipass insn scheduling. If the hook returns -zero for @var{insn}, the insn will be considered in multipass scheduling. -Positive return values will remove @var{insn} from consideration on -the current round of multipass scheduling. -Negative return values will remove @var{insn} from consideration for given -number of cycles. -Backends should be careful about returning non-zero for highest priority -instruction at position 0 in the ready list. @var{ready_index} is passed -to allow backends make correct judgements. - -The default is that any ready insns can be chosen to be issued. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BEGIN (void *@var{data}, signed char *@var{ready_try}, int @var{n_ready}, bool @var{first_cycle_insn_p}) -This hook prepares the target backend for a new round of multipass -scheduling. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_ISSUE (void *@var{data}, signed char *@var{ready_try}, int @var{n_ready}, rtx_insn *@var{insn}, const void *@var{prev_data}) -This hook is called when multipass scheduling evaluates instruction INSN. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BACKTRACK (const void *@var{data}, signed char *@var{ready_try}, int @var{n_ready}) -This is called when multipass scheduling backtracks from evaluation of -an instruction. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_END (const void *@var{data}) -This hook notifies the target about the result of the concluded current -round of multipass scheduling. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_INIT (void *@var{data}) -This hook initializes target-specific data used in multipass scheduling. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FIRST_CYCLE_MULTIPASS_FINI (void *@var{data}) -This hook finalizes target-specific data used in multipass scheduling. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_DFA_NEW_CYCLE (FILE *@var{dump}, int @var{verbose}, rtx_insn *@var{insn}, int @var{last_clock}, int @var{clock}, int *@var{sort_p}) -This hook is called by the insn scheduler before issuing @var{insn} -on cycle @var{clock}. If the hook returns nonzero, -@var{insn} is not issued on this processor cycle. Instead, -the processor cycle is advanced. If *@var{sort_p} -is zero, the insn ready queue is not sorted on the new cycle -start as usually. @var{dump} and @var{verbose} specify the file and -verbosity level to use for debugging output. -@var{last_clock} and @var{clock} are, respectively, the -processor cycle on which the previous insn has been issued, -and the current processor cycle. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCHED_IS_COSTLY_DEPENDENCE (struct _dep *@var{_dep}, int @var{cost}, int @var{distance}) -This hook is used to define which dependences are considered costly by -the target, so costly that it is not advisable to schedule the insns that -are involved in the dependence too close to one another. The parameters -to this hook are as follows: The first parameter @var{_dep} is the dependence -being evaluated. The second parameter @var{cost} is the cost of the -dependence as estimated by the scheduler, and the third -parameter @var{distance} is the distance in cycles between the two insns. -The hook returns @code{true} if considering the distance between the two -insns the dependence between them is considered costly by the target, -and @code{false} otherwise. - -Defining this hook can be useful in multiple-issue out-of-order machines, -where (a) it's practically hopeless to predict the actual data/resource -delays, however: (b) there's a better chance to predict the actual grouping -that will be formed, and (c) correctly emulating the grouping can be very -important. In such targets one may want to allow issuing dependent insns -closer to one another---i.e., closer than the dependence distance; however, -not in cases of ``costly dependences'', which this hooks allows to define. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_H_I_D_EXTENDED (void) -This hook is called by the insn scheduler after emitting a new instruction to -the instruction stream. The hook notifies a target backend to extend its -per instruction data structures. -@end deftypefn - -@deftypefn {Target Hook} {void *} TARGET_SCHED_ALLOC_SCHED_CONTEXT (void) -Return a pointer to a store large enough to hold target scheduling context. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_INIT_SCHED_CONTEXT (void *@var{tc}, bool @var{clean_p}) -Initialize store pointed to by @var{tc} to hold target scheduling context. -It @var{clean_p} is true then initialize @var{tc} as if scheduler is at the -beginning of the block. Otherwise, copy the current context into @var{tc}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_SET_SCHED_CONTEXT (void *@var{tc}) -Copy target scheduling context pointed to by @var{tc} to the current context. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_CLEAR_SCHED_CONTEXT (void *@var{tc}) -Deallocate internal data in target scheduling context pointed to by @var{tc}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FREE_SCHED_CONTEXT (void *@var{tc}) -Deallocate a store for target scheduling context pointed to by @var{tc}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_SPECULATE_INSN (rtx_insn *@var{insn}, unsigned int @var{dep_status}, rtx *@var{new_pat}) -This hook is called by the insn scheduler when @var{insn} has only -speculative dependencies and therefore can be scheduled speculatively. -The hook is used to check if the pattern of @var{insn} has a speculative -version and, in case of successful check, to generate that speculative -pattern. The hook should return 1, if the instruction has a speculative form, -or @minus{}1, if it doesn't. @var{request} describes the type of requested -speculation. If the return value equals 1 then @var{new_pat} is assigned -the generated speculative pattern. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCHED_NEEDS_BLOCK_P (unsigned int @var{dep_status}) -This hook is called by the insn scheduler during generation of recovery code -for @var{insn}. It should return @code{true}, if the corresponding check -instruction should branch to recovery code, or @code{false} otherwise. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_SCHED_GEN_SPEC_CHECK (rtx_insn *@var{insn}, rtx_insn *@var{label}, unsigned int @var{ds}) -This hook is called by the insn scheduler to generate a pattern for recovery -check instruction. If @var{mutate_p} is zero, then @var{insn} is a -speculative instruction for which the check should be generated. -@var{label} is either a label of a basic block, where recovery code should -be emitted, or a null pointer, when requested check doesn't branch to -recovery code (a simple check). If @var{mutate_p} is nonzero, then -a pattern for a branchy check corresponding to a simple check denoted by -@var{insn} should be generated. In this case @var{label} can't be null. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_SET_SCHED_FLAGS (struct spec_info_def *@var{spec_info}) -This hook is used by the insn scheduler to find out what features should be -enabled/used. -The structure *@var{spec_info} should be filled in by the target. -The structure describes speculation types that can be used in the scheduler. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_SCHED_SMS_RES_MII (struct ddg *@var{g}) -This hook is called by the swing modulo scheduler to calculate a -resource-based lower bound which is based on the resources available in -the machine and the resources required by each instruction. The target -backend can use @var{g} to calculate such bound. A very simple lower -bound will be used in case this hook is not implemented: the total number -of instructions divided by the issue rate. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_SCHED_DISPATCH (rtx_insn *@var{insn}, int @var{x}) -This hook is called by Haifa Scheduler. It returns true if dispatch scheduling -is supported in hardware and the condition specified in the parameter is true. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_DISPATCH_DO (rtx_insn *@var{insn}, int @var{x}) -This hook is called by Haifa Scheduler. It performs the operation specified -in its second parameter. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_SCHED_EXPOSED_PIPELINE -True if the processor has an exposed pipeline, which means that not just -the order of instructions is important for correctness when scheduling, but -also the latencies of operations. -@end deftypevr - -@deftypefn {Target Hook} int TARGET_SCHED_REASSOCIATION_WIDTH (unsigned int @var{opc}, machine_mode @var{mode}) -This hook is called by tree reassociator to determine a level of -parallelism required in output calculations chain. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SCHED_FUSION_PRIORITY (rtx_insn *@var{insn}, int @var{max_pri}, int *@var{fusion_pri}, int *@var{pri}) -This hook is called by scheduling fusion pass. It calculates fusion -priorities for each instruction passed in by parameter. The priorities -are returned via pointer parameters. - -@var{insn} is the instruction whose priorities need to be calculated. -@var{max_pri} is the maximum priority can be returned in any cases. -@var{fusion_pri} is the pointer parameter through which @var{insn}'s -fusion priority should be calculated and returned. -@var{pri} is the pointer parameter through which @var{insn}'s priority -should be calculated and returned. - -Same @var{fusion_pri} should be returned for instructions which should -be scheduled together. Different @var{pri} should be returned for -instructions with same @var{fusion_pri}. @var{fusion_pri} is the major -sort key, @var{pri} is the minor sort key. All instructions will be -scheduled according to the two priorities. All priorities calculated -should be between 0 (exclusive) and @var{max_pri} (inclusive). To avoid -false dependencies, @var{fusion_pri} of instructions which need to be -scheduled together should be smaller than @var{fusion_pri} of irrelevant -instructions. - -Given below example: - -@smallexample - ldr r10, [r1, 4] - add r4, r4, r10 - ldr r15, [r2, 8] - sub r5, r5, r15 - ldr r11, [r1, 0] - add r4, r4, r11 - ldr r16, [r2, 12] - sub r5, r5, r16 -@end smallexample - -On targets like ARM/AArch64, the two pairs of consecutive loads should be -merged. Since peephole2 pass can't help in this case unless consecutive -loads are actually next to each other in instruction flow. That's where -this scheduling fusion pass works. This hook calculates priority for each -instruction based on its fustion type, like: - -@smallexample - ldr r10, [r1, 4] ; fusion_pri=99, pri=96 - add r4, r4, r10 ; fusion_pri=100, pri=100 - ldr r15, [r2, 8] ; fusion_pri=98, pri=92 - sub r5, r5, r15 ; fusion_pri=100, pri=100 - ldr r11, [r1, 0] ; fusion_pri=99, pri=100 - add r4, r4, r11 ; fusion_pri=100, pri=100 - ldr r16, [r2, 12] ; fusion_pri=98, pri=88 - sub r5, r5, r16 ; fusion_pri=100, pri=100 -@end smallexample - -Scheduling fusion pass then sorts all ready to issue instructions according -to the priorities. As a result, instructions of same fusion type will be -pushed together in instruction flow, like: - -@smallexample - ldr r11, [r1, 0] - ldr r10, [r1, 4] - ldr r15, [r2, 8] - ldr r16, [r2, 12] - add r4, r4, r10 - sub r5, r5, r15 - add r4, r4, r11 - sub r5, r5, r16 -@end smallexample - -Now peephole2 pass can simply merge the two pairs of loads. - -Since scheduling fusion pass relies on peephole2 to do real fusion -work, it is only enabled by default when peephole2 is in effect. - -This is firstly introduced on ARM/AArch64 targets, please refer to -the hook implementation for how different fusion types are supported. -@end deftypefn - -@node Sections -@section Dividing the Output into Sections (Texts, Data, @dots{}) -@c the above section title is WAY too long. maybe cut the part between -@c the (...)? --mew 10feb93 - -An object file is divided into sections containing different types of -data. In the most common case, there are three sections: the @dfn{text -section}, which holds instructions and read-only data; the @dfn{data -section}, which holds initialized writable data; and the @dfn{bss -section}, which holds uninitialized data. Some systems have other kinds -of sections. - -@file{varasm.c} provides several well-known sections, such as -@code{text_section}, @code{data_section} and @code{bss_section}. -The normal way of controlling a @code{@var{foo}_section} variable -is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro, -as described below. The macros are only read once, when @file{varasm.c} -initializes itself, so their values must be run-time constants. -They may however depend on command-line flags. - -@emph{Note:} Some run-time files, such @file{crtstuff.c}, also make -use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them -to be string literals. - -Some assemblers require a different string to be written every time a -section is selected. If your assembler falls into this category, you -should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use -@code{get_unnamed_section} to set up the sections. - -You must always create a @code{text_section}, either by defining -@code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section} -in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of -@code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not -create a distinct @code{readonly_data_section}, the default is to -reuse @code{text_section}. - -All the other @file{varasm.c} sections are optional, and are null -if the target does not provide them. - -@defmac TEXT_SECTION_ASM_OP -A C expression whose value is a string, including spacing, containing the -assembler operation that should precede instructions and read-only data. -Normally @code{"\t.text"} is right. -@end defmac - -@defmac HOT_TEXT_SECTION_NAME -If defined, a C string constant for the name of the section containing most -frequently executed functions of the program. If not defined, GCC will provide -a default definition if the target supports named sections. -@end defmac - -@defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME -If defined, a C string constant for the name of the section containing unlikely -executed functions in the program. -@end defmac - -@defmac DATA_SECTION_ASM_OP -A C expression whose value is a string, including spacing, containing the -assembler operation to identify the following data as writable initialized -data. Normally @code{"\t.data"} is right. -@end defmac - -@defmac SDATA_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -initialized, writable small data. -@end defmac - -@defmac READONLY_DATA_SECTION_ASM_OP -A C expression whose value is a string, including spacing, containing the -assembler operation to identify the following data as read-only initialized -data. -@end defmac - -@defmac BSS_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -uninitialized global data. If not defined, and -@code{ASM_OUTPUT_ALIGNED_BSS} not defined, -uninitialized global data will be output in the data section if -@option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be -used. -@end defmac - -@defmac SBSS_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -uninitialized, writable small data. -@end defmac - -@defmac TLS_COMMON_ASM_OP -If defined, a C expression whose value is a string containing the -assembler operation to identify the following data as thread-local -common data. The default is @code{".tls_common"}. -@end defmac - -@defmac TLS_SECTION_ASM_FLAG -If defined, a C expression whose value is a character constant -containing the flag used to mark a section as a TLS section. The -default is @code{'T'}. -@end defmac - -@defmac INIT_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -initialization code. If not defined, GCC will assume such a section does -not exist. This section has no corresponding @code{init_section} -variable; it is used entirely in runtime code. -@end defmac - -@defmac FINI_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -finalization code. If not defined, GCC will assume such a section does -not exist. This section has no corresponding @code{fini_section} -variable; it is used entirely in runtime code. -@end defmac - -@defmac INIT_ARRAY_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -part of the @code{.init_array} (or equivalent) section. If not -defined, GCC will assume such a section does not exist. Do not define -both this macro and @code{INIT_SECTION_ASM_OP}. -@end defmac - -@defmac FINI_ARRAY_SECTION_ASM_OP -If defined, a C expression whose value is a string, including spacing, -containing the assembler operation to identify the following data as -part of the @code{.fini_array} (or equivalent) section. If not -defined, GCC will assume such a section does not exist. Do not define -both this macro and @code{FINI_SECTION_ASM_OP}. -@end defmac - -@defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function}) -If defined, an ASM statement that switches to a different section -via @var{section_op}, calls @var{function}, and switches back to -the text section. This is used in @file{crtstuff.c} if -@code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls -to initialization and finalization functions from the init and fini -sections. By default, this macro uses a simple function call. Some -ports need hand-crafted assembly code to avoid dependencies on -registers initialized in the function prologue or to ensure that -constant pools don't end up too far way in the text section. -@end defmac - -@defmac TARGET_LIBGCC_SDATA_SECTION -If defined, a string which names the section into which small -variables defined in crtstuff and libgcc should go. This is useful -when the target has options for optimizing access to small data, and -you want the crtstuff and libgcc routines to be conservative in what -they expect of your application yet liberal in what your application -expects. For example, for targets with a @code{.sdata} section (like -MIPS), you could compile crtstuff with @code{-G 0} so that it doesn't -require small data support from your application, but use this macro -to put small data into @code{.sdata} so that your application can -access these variables whether it uses small data or not. -@end defmac - -@defmac FORCE_CODE_SECTION_ALIGN -If defined, an ASM statement that aligns a code section to some -arbitrary boundary. This is used to force all fragments of the -@code{.init} and @code{.fini} sections to have to same alignment -and thus prevent the linker from having to add any padding. -@end defmac - -@defmac JUMP_TABLES_IN_TEXT_SECTION -Define this macro to be an expression with a nonzero value if jump -tables (for @code{tablejump} insns) should be output in the text -section, along with the assembler instructions. Otherwise, the -readonly data section is used. - -This macro is irrelevant if there is no separate readonly data section. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_INIT_SECTIONS (void) -Define this hook if you need to do something special to set up the -@file{varasm.c} sections, or if your target has some special sections -of its own that you need to create. - -GCC calls this hook after processing the command line, but before writing -any assembly code, and before calling any of the section-returning hooks -described below. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_ASM_RELOC_RW_MASK (void) -Return a mask describing how relocations should be treated when -selecting sections. Bit 1 should be set if global relocations -should be placed in a read-write section; bit 0 should be set if -local relocations should be placed in a read-write section. - -The default version of this function returns 3 when @option{-fpic} -is in effect, and 0 otherwise. The hook is typically redefined -when the target cannot support (some kinds of) dynamic relocations -in read-only sections even in executables. -@end deftypefn - -@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align}) -Return the section into which @var{exp} should be placed. You can -assume that @var{exp} is either a @code{VAR_DECL} node or a constant of -some sort. @var{reloc} indicates whether the initial value of @var{exp} -requires link-time relocations. Bit 0 is set when variable contains -local relocations only, while bit 1 is set for global relocations. -@var{align} is the constant alignment in bits. - -The default version of this function takes care of putting read-only -variables in @code{readonly_data_section}. - -See also @var{USE_SELECT_SECTION_FOR_FUNCTIONS}. -@end deftypefn - -@defmac USE_SELECT_SECTION_FOR_FUNCTIONS -Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called -for @code{FUNCTION_DECL}s as well as for variables and constants. - -In the case of a @code{FUNCTION_DECL}, @var{reloc} will be zero if the -function has been determined to be likely to be called, and nonzero if -it is unlikely to be called. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_UNIQUE_SECTION (tree @var{decl}, int @var{reloc}) -Build up a unique section name, expressed as a @code{STRING_CST} node, -and assign it to @samp{DECL_SECTION_NAME (@var{decl})}. -As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whether -the initial value of @var{exp} requires link-time relocations. - -The default version of this function appends the symbol name to the -ELF section name that would normally be used for the symbol. For -example, the function @code{foo} would be placed in @code{.text.foo}. -Whatever the actual target object format, this is often good enough. -@end deftypefn - -@deftypefn {Target Hook} {section *} TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl}) -Return the readonly data section associated with -@samp{DECL_SECTION_NAME (@var{decl})}. -The default version of this function selects @code{.gnu.linkonce.r.name} if -the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name} -if function is in @code{.text.name}, and the normal readonly-data section -otherwise. -@end deftypefn - -@deftypevr {Target Hook} {const char *} TARGET_ASM_MERGEABLE_RODATA_PREFIX -Usually, the compiler uses the prefix @code{".rodata"} to construct -section names for mergeable constant data. Define this macro to override -the string if a different section name should be used. -@end deftypevr - -@deftypefn {Target Hook} {section *} TARGET_ASM_TM_CLONE_TABLE_SECTION (void) -Return the section that should be used for transactional memory clone tables. -@end deftypefn - -@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align}) -Return the section into which a constant @var{x}, of mode @var{mode}, -should be placed. You can assume that @var{x} is some kind of -constant in RTL@. The argument @var{mode} is redundant except in the -case of a @code{const_int} rtx. @var{align} is the constant alignment -in bits. - -The default version of this function takes care of putting symbolic -constants in @code{flag_pic} mode in @code{data_section} and everything -else in @code{readonly_data_section}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_MANGLE_DECL_ASSEMBLER_NAME (tree @var{decl}, tree @var{id}) -Define this hook if you need to postprocess the assembler name generated -by target-independent code. The @var{id} provided to this hook will be -the computed name (e.g., the macro @code{DECL_NAME} of the @var{decl} in C, -or the mangled name of the @var{decl} in C++). The return value of the -hook is an @code{IDENTIFIER_NODE} for the appropriate mangled name on -your target system. The default implementation of this hook just -returns the @var{id} provided. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, rtx @var{rtl}, int @var{new_decl_p}) -Define this hook if references to a symbol or a constant must be -treated differently depending on something about the variable or -function named by the symbol (such as what section it is in). - -The hook is executed immediately after rtl has been created for -@var{decl}, which may be a variable or function declaration or -an entry in the constant pool. In either case, @var{rtl} is the -rtl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})} -in this hook; that field may not have been initialized yet. - -In the case of a constant, it is safe to assume that the rtl is -a @code{mem} whose address is a @code{symbol_ref}. Most decls -will also have this form, but that is not guaranteed. Global -register variables, for instance, will have a @code{reg} for their -rtl. (Normally the right thing to do with such unusual rtl is -leave it alone.) - -The @var{new_decl_p} argument will be true if this is the first time -that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It will -be false for subsequent invocations, which will happen for duplicate -declarations. Whether or not anything must be done for the duplicate -declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}. -@var{new_decl_p} is always true when the hook is called for a constant. - -@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO} -The usual thing for this hook to do is to record flags in the -@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}. -Historically, the name string was modified if it was necessary to -encode more than one bit of information, but this practice is now -discouraged; use @code{SYMBOL_REF_FLAGS}. - -The default definition of this hook, @code{default_encode_section_info} -in @file{varasm.c}, sets a number of commonly-useful bits in -@code{SYMBOL_REF_FLAGS}. Check whether the default does what you need -before overriding it. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_STRIP_NAME_ENCODING (const char *@var{name}) -Decode @var{name} and return the real name part, sans -the characters that @code{TARGET_ENCODE_SECTION_INFO} -may have added. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_IN_SMALL_DATA_P (const_tree @var{exp}) -Returns true if @var{exp} should be placed into a ``small data'' section. -The default version of this hook always returns false. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_HAVE_SRODATA_SECTION -Contains the value true if the target places read-only -``small data'' into a separate section. The default value is false. -@end deftypevr - -@deftypefn {Target Hook} bool TARGET_PROFILE_BEFORE_PROLOGUE (void) -It returns true if target wants profile code emitted before prologue. - -The default version of this hook use the target macro -@code{PROFILE_BEFORE_PROLOGUE}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_BINDS_LOCAL_P (const_tree @var{exp}) -Returns true if @var{exp} names an object for which name resolution -rules must resolve to the current ``module'' (dynamic shared library -or executable image). - -The default version of this hook implements the name resolution rules -for ELF, which has a looser model of global name binding than other -currently supported object file formats. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_HAVE_TLS -Contains the value true if the target supports thread-local storage. -The default value is false. -@end deftypevr - - -@node PIC -@section Position Independent Code -@cindex position independent code -@cindex PIC - -This section describes macros that help implement generation of position -independent code. Simply defining these macros is not enough to -generate valid PIC; you must also add support to the hook -@code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro -@code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You -must modify the definition of @samp{movsi} to do something appropriate -when the source operand contains a symbolic address. You may also -need to alter the handling of switch statements so that they use -relative addresses. -@c i rearranged the order of the macros above to try to force one of -@c them to the next line, to eliminate an overfull hbox. --mew 10feb93 - -@defmac PIC_OFFSET_TABLE_REGNUM -The register number of the register used to address a table of static -data addresses in memory. In some cases this register is defined by a -processor's ``application binary interface'' (ABI)@. When this macro -is defined, RTL is generated for this register once, as with the stack -pointer and frame pointer registers. If this macro is not defined, it -is up to the machine-dependent files to allocate such a register (if -necessary). Note that this register must be fixed when in use (e.g.@: -when @code{flag_pic} is true). -@end defmac - -@defmac PIC_OFFSET_TABLE_REG_CALL_CLOBBERED -A C expression that is nonzero if the register defined by -@code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. If not defined, -the default is zero. Do not define -this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined. -@end defmac - -@defmac LEGITIMATE_PIC_OPERAND_P (@var{x}) -A C expression that is nonzero if @var{x} is a legitimate immediate -operand on the target machine when generating position independent code. -You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not -check this. You can also assume @var{flag_pic} is true, so you need not -check it either. You need not define this macro if all constants -(including @code{SYMBOL_REF}) can be immediate operands when generating -position independent code. -@end defmac - -@node Assembler Format -@section Defining the Output Assembler Language - -This section describes macros whose principal purpose is to describe how -to write instructions in assembler language---rather than what the -instructions do. - -@menu -* File Framework:: Structural information for the assembler file. -* Data Output:: Output of constants (numbers, strings, addresses). -* Uninitialized Data:: Output of uninitialized variables. -* Label Output:: Output and generation of labels. -* Initialization:: General principles of initialization - and termination routines. -* Macros for Initialization:: - Specific macros that control the handling of - initialization and termination routines. -* Instruction Output:: Output of actual instructions. -* Dispatch Tables:: Output of jump tables. -* Exception Region Output:: Output of exception region code. -* Alignment Output:: Pseudo ops for alignment and skipping data. -@end menu - -@node File Framework -@subsection The Overall Framework of an Assembler File -@cindex assembler format -@cindex output of assembler code - -@c prevent bad page break with this line -This describes the overall framework of an assembly file. - -@findex default_file_start -@deftypefn {Target Hook} void TARGET_ASM_FILE_START (void) -Output to @code{asm_out_file} any text which the assembler expects to -find at the beginning of a file. The default behavior is controlled -by two flags, documented below. Unless your target's assembler is -quite unusual, if you override the default, you should call -@code{default_file_start} at some point in your target hook. This -lets other target files rely on these variables. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_ASM_FILE_START_APP_OFF -If this flag is true, the text of the macro @code{ASM_APP_OFF} will be -printed as the very first line in the assembly file, unless -@option{-fverbose-asm} is in effect. (If that macro has been defined -to the empty string, this variable has no effect.) With the normal -definition of @code{ASM_APP_OFF}, the effect is to notify the GNU -assembler that it need not bother stripping comments or extra -whitespace from its input. This allows it to work a bit faster. - -The default is false. You should not set it to true unless you have -verified that your port does not generate any extra whitespace or -comments that will cause GAS to issue errors in NO_APP mode. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_ASM_FILE_START_FILE_DIRECTIVE -If this flag is true, @code{output_file_directive} will be called -for the primary source file, immediately after printing -@code{ASM_APP_OFF} (if that is enabled). Most ELF assemblers expect -this to be done. The default is false. -@end deftypevr - -@deftypefn {Target Hook} void TARGET_ASM_FILE_END (void) -Output to @code{asm_out_file} any text which the assembler expects -to find at the end of a file. The default is to output nothing. -@end deftypefn - -@deftypefun void file_end_indicate_exec_stack () -Some systems use a common convention, the @samp{.note.GNU-stack} -special section, to indicate whether or not an object file relies on -the stack being executable. If your system uses this convention, you -should define @code{TARGET_ASM_FILE_END} to this function. If you -need to do other things in that hook, have your hook function call -this function. -@end deftypefun - -@deftypefn {Target Hook} void TARGET_ASM_LTO_START (void) -Output to @code{asm_out_file} any text which the assembler expects -to find at the start of an LTO section. The default is to output -nothing. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_LTO_END (void) -Output to @code{asm_out_file} any text which the assembler expects -to find at the end of an LTO section. The default is to output -nothing. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_CODE_END (void) -Output to @code{asm_out_file} any text which is needed before emitting -unwind info and debug info at the end of a file. Some targets emit -here PIC setup thunks that cannot be emitted at the end of file, -because they couldn't have unwind info then. The default is to output -nothing. -@end deftypefn - -@defmac ASM_COMMENT_START -A C string constant describing how to begin a comment in the target -assembler language. The compiler assumes that the comment will end at -the end of the line. -@end defmac - -@defmac ASM_APP_ON -A C string constant for text to be output before each @code{asm} -statement or group of consecutive ones. Normally this is -@code{"#APP"}, which is a comment that has no effect on most -assemblers but tells the GNU assembler that it must check the lines -that follow for all valid assembler constructs. -@end defmac - -@defmac ASM_APP_OFF -A C string constant for text to be output after each @code{asm} -statement or group of consecutive ones. Normally this is -@code{"#NO_APP"}, which tells the GNU assembler to resume making the -time-saving assumptions that are valid for ordinary compiler output. -@end defmac - -@defmac ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name}) -A C statement to output COFF information or DWARF debugging information -which indicates that filename @var{name} is the current source file to -the stdio stream @var{stream}. - -This macro need not be defined if the standard form of output -for the file format in use is appropriate. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_SOURCE_FILENAME (FILE *@var{file}, const char *@var{name}) -Output COFF information or DWARF debugging information which indicates that filename @var{name} is the current source file to the stdio stream @var{file}. - - This target hook need not be defined if the standard form of output for the file format in use is appropriate. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_IDENT (const char *@var{name}) -Output a string based on @var{name}, suitable for the @samp{#ident} directive, or the equivalent directive or pragma in non-C-family languages. If this hook is not defined, nothing is output for the @samp{#ident} directive. -@end deftypefn - -@defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string}) -A C statement to output the string @var{string} to the stdio stream -@var{stream}. If you do not call the function @code{output_quoted_string} -in your config files, GCC will only call it to output filenames to -the assembler source. So you can use it to canonicalize the format -of the filename using this macro. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_NAMED_SECTION (const char *@var{name}, unsigned int @var{flags}, tree @var{decl}) -Output assembly directives to switch to section @var{name}. The section -should have attributes as specified by @var{flags}, which is a bit mask -of the @code{SECTION_*} flags defined in @file{output.h}. If @var{decl} -is non-NULL, it is the @code{VAR_DECL} or @code{FUNCTION_DECL} with which -this section is associated. -@end deftypefn - -@deftypefn {Target Hook} {section *} TARGET_ASM_FUNCTION_SECTION (tree @var{decl}, enum node_frequency @var{freq}, bool @var{startup}, bool @var{exit}) -Return preferred text (sub)section for function @var{decl}. -Main purpose of this function is to separate cold, normal and hot -functions. @var{startup} is true when function is known to be used only -at startup (from static constructors or it is @code{main()}). -@var{exit} is true when function is known to be used only at exit -(from static destructors). -Return NULL if function should go to default text section. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS (FILE *@var{file}, tree @var{decl}, bool @var{new_is_cold}) -Used by the target to emit any assembler directives or additional labels needed when a function is partitioned between different sections. Output should be written to @var{file}. The function decl is available as @var{decl} and the new section is `cold' if @var{new_is_cold} is @code{true}. -@end deftypefn - -@deftypevr {Common Target Hook} bool TARGET_HAVE_NAMED_SECTIONS -This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}. -It must not be modified by command-line option processing. -@end deftypevr - -@anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS} -@deftypevr {Target Hook} bool TARGET_HAVE_SWITCHABLE_BSS_SECTIONS -This flag is true if we can create zeroed data by switching to a BSS -section and then using @code{ASM_OUTPUT_SKIP} to allocate the space. -This is true on most ELF targets. -@end deftypevr - -@deftypefn {Target Hook} {unsigned int} TARGET_SECTION_TYPE_FLAGS (tree @var{decl}, const char *@var{name}, int @var{reloc}) -Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION} -based on a variable or function decl, a section name, and whether or not the -declaration's initializer may contain runtime relocations. @var{decl} may be -null, in which case read-write data should be assumed. - -The default version of this function handles choosing code vs data, -read-only vs read-write data, and @code{flag_pic}. You should only -need to override this if your target has special flags that might be -set via @code{__attribute__}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_ASM_RECORD_GCC_SWITCHES (print_switch_type @var{type}, const char *@var{text}) -Provides the target with the ability to record the gcc command line -switches that have been passed to the compiler, and options that are -enabled. The @var{type} argument specifies what is being recorded. -It can take the following values: - -@table @gcctabopt -@item SWITCH_TYPE_PASSED -@var{text} is a command line switch that has been set by the user. - -@item SWITCH_TYPE_ENABLED -@var{text} is an option which has been enabled. This might be as a -direct result of a command line switch, or because it is enabled by -default or because it has been enabled as a side effect of a different -command line switch. For example, the @option{-O2} switch enables -various different individual optimization passes. - -@item SWITCH_TYPE_DESCRIPTIVE -@var{text} is either NULL or some descriptive text which should be -ignored. If @var{text} is NULL then it is being used to warn the -target hook that either recording is starting or ending. The first -time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the -warning is for start up and the second time the warning is for -wind down. This feature is to allow the target hook to make any -necessary preparations before it starts to record switches and to -perform any necessary tidying up after it has finished recording -switches. - -@item SWITCH_TYPE_LINE_START -This option can be ignored by this target hook. - -@item SWITCH_TYPE_LINE_END -This option can be ignored by this target hook. -@end table - -The hook's return value must be zero. Other return values may be -supported in the future. - -By default this hook is set to NULL, but an example implementation is -provided for ELF based targets. Called @var{elf_record_gcc_switches}, -it records the switches as ASCII text inside a new, string mergeable -section in the assembler output file. The name of the new section is -provided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} target -hook. -@end deftypefn - -@deftypevr {Target Hook} {const char *} TARGET_ASM_RECORD_GCC_SWITCHES_SECTION -This is the name of the section that will be created by the example -ELF implementation of the @code{TARGET_ASM_RECORD_GCC_SWITCHES} target -hook. -@end deftypevr - -@need 2000 -@node Data Output -@subsection Output of Data - - -@deftypevr {Target Hook} {const char *} TARGET_ASM_BYTE_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP -@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP -These hooks specify assembly directives for creating certain kinds -of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a -byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an -aligned two-byte object, and so on. Any of the hooks may be -@code{NULL}, indicating that no suitable directive is available. - -The compiler will print these strings at the start of a new line, -followed immediately by the object's initial value. In most cases, -the string should contain a tab, a pseudo-op, and then another tab. -@end deftypevr - -@deftypefn {Target Hook} bool TARGET_ASM_INTEGER (rtx @var{x}, unsigned int @var{size}, int @var{aligned_p}) -The @code{assemble_integer} function uses this hook to output an -integer object. @var{x} is the object's value, @var{size} is its size -in bytes and @var{aligned_p} indicates whether it is aligned. The -function should return @code{true} if it was able to output the -object. If it returns false, @code{assemble_integer} will try to -split the object into smaller parts. - -The default implementation of this hook will use the -@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false} -when the relevant string is @code{NULL}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_DECL_END (void) -Define this hook if the target assembler requires a special marker to -terminate an initialized variable declaration. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA (FILE *@var{file}, rtx @var{x}) -A target hook to recognize @var{rtx} patterns that @code{output_addr_const} -can't deal with, and output assembly code to @var{file} corresponding to -the pattern @var{x}. This may be used to allow machine-dependent -@code{UNSPEC}s to appear within constants. - -If target hook fails to recognize a pattern, it must return @code{false}, -so that a standard error message is printed. If it prints an error message -itself, by calling, for example, @code{output_operand_lossage}, it may just -return @code{true}. -@end deftypefn - -@defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len}) -A C statement to output to the stdio stream @var{stream} an assembler -instruction to assemble a string constant containing the @var{len} -bytes at @var{ptr}. @var{ptr} will be a C expression of type -@code{char *} and @var{len} a C expression of type @code{int}. - -If the assembler has a @code{.ascii} pseudo-op as found in the -Berkeley Unix assembler, do not define the macro -@code{ASM_OUTPUT_ASCII}. -@end defmac - -@defmac ASM_OUTPUT_FDESC (@var{stream}, @var{decl}, @var{n}) -A C statement to output word @var{n} of a function descriptor for -@var{decl}. This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS} -is defined, and is otherwise unused. -@end defmac - -@defmac CONSTANT_POOL_BEFORE_FUNCTION -You may define this macro as a C expression. You should define the -expression to have a nonzero value if GCC should output the constant -pool for a function before the code for the function, or a zero value if -GCC should output the constant pool after the function. If you do -not define this macro, the usual case, GCC will output the constant -pool before the function. -@end defmac - -@defmac ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size}) -A C statement to output assembler commands to define the start of the -constant pool for a function. @var{funname} is a string giving -the name of the function. Should the return type of the function -be required, it can be obtained via @var{fundecl}. @var{size} -is the size, in bytes, of the constant pool that will be written -immediately after this call. - -If no constant-pool prefix is required, the usual case, this macro need -not be defined. -@end defmac - -@defmac ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto}) -A C statement (with or without semicolon) to output a constant in the -constant pool, if it needs special treatment. (This macro need not do -anything for RTL expressions that can be output normally.) - -The argument @var{file} is the standard I/O stream to output the -assembler code on. @var{x} is the RTL expression for the constant to -output, and @var{mode} is the machine mode (in case @var{x} is a -@samp{const_int}). @var{align} is the required alignment for the value -@var{x}; you should output an assembler directive to force this much -alignment. - -The argument @var{labelno} is a number to use in an internal label for -the address of this pool entry. The definition of this macro is -responsible for outputting the label definition at the proper place. -Here is how to do this: - -@smallexample -@code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno}); -@end smallexample - -When you output a pool entry specially, you should end with a -@code{goto} to the label @var{jumpto}. This will prevent the same pool -entry from being output a second time in the usual manner. - -You need not define this macro if it would do nothing. -@end defmac - -@defmac ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size}) -A C statement to output assembler commands to at the end of the constant -pool for a function. @var{funname} is a string giving the name of the -function. Should the return type of the function be required, you can -obtain it via @var{fundecl}. @var{size} is the size, in bytes, of the -constant pool that GCC wrote immediately before this call. - -If no constant-pool epilogue is required, the usual case, you need not -define this macro. -@end defmac - -@defmac IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C}, @var{STR}) -Define this macro as a C expression which is nonzero if @var{C} is -used as a logical line separator by the assembler. @var{STR} points -to the position in the string where @var{C} was found; this can be used if -a line separator uses multiple characters. - -If you do not define this macro, the default is that only -the character @samp{;} is treated as a logical line separator. -@end defmac - -@deftypevr {Target Hook} {const char *} TARGET_ASM_OPEN_PAREN -@deftypevrx {Target Hook} {const char *} TARGET_ASM_CLOSE_PAREN -These target hooks are C string constants, describing the syntax in the -assembler for grouping arithmetic expressions. If not overridden, they -default to normal parentheses, which is correct for most assemblers. -@end deftypevr - -These macros are provided by @file{real.h} for writing the definitions -of @code{ASM_OUTPUT_DOUBLE} and the like: - -@defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l}) -@defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l}) -@defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l}) -@defmacx REAL_VALUE_TO_TARGET_DECIMAL32 (@var{x}, @var{l}) -@defmacx REAL_VALUE_TO_TARGET_DECIMAL64 (@var{x}, @var{l}) -@defmacx REAL_VALUE_TO_TARGET_DECIMAL128 (@var{x}, @var{l}) -These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the -target's floating point representation, and store its bit pattern in -the variable @var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE} and -@code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be a -simple @code{long int}. For the others, it should be an array of -@code{long int}. The number of elements in this array is determined -by the size of the desired target floating point data type: 32 bits of -it go in each @code{long int} array element. Each array element holds -32 bits of the result, even if @code{long int} is wider than 32 bits -on the host machine. - -The array element values are designed so that you can print them out -using @code{fprintf} in the order they should appear in the target -machine's memory. -@end defmac - -@node Uninitialized Data -@subsection Output of Uninitialized Variables - -Each of the macros in this section is used to do the whole job of -outputting a single uninitialized variable. - -@defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} the assembler definition of a common-label named -@var{name} whose size is @var{size} bytes. The variable @var{rounded} -is the size rounded up to whatever alignment the caller wants. It is -possible that @var{size} may be zero, for instance if a struct with no -other member than a zero-length array is defined. In this case, the -backend must output a symbol definition that allocates at least one -byte, both so that the address of the resulting object does not compare -equal to any other, and because some object formats cannot even express -the concept of a zero-sized common symbol, as that is how they represent -an ordinary undefined external. - -Use the expression @code{assemble_name (@var{stream}, @var{name})} to -output the name itself; before and after that, output the additional -assembler syntax for defining the name, and a newline. - -This macro controls how the assembler definitions of uninitialized -common global variables are output. -@end defmac - -@defmac ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment}) -Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a -separate, explicit argument. If you define this macro, it is used in -place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in -handling the required alignment of the variable. The alignment is specified -as the number of bits. -@end defmac - -@defmac ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) -Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the -variable to be output, if there is one, or @code{NULL_TREE} if there -is no corresponding variable. If you define this macro, GCC will use it -in place of both @code{ASM_OUTPUT_COMMON} and -@code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to see -the variable's decl in order to chose what to output. -@end defmac - -@defmac ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} the assembler definition of uninitialized global @var{decl} named -@var{name} whose size is @var{size} bytes. The variable @var{alignment} -is the alignment specified as the number of bits. - -Try to use function @code{asm_output_aligned_bss} defined in file -@file{varasm.c} when defining this macro. If unable, use the expression -@code{assemble_name (@var{stream}, @var{name})} to output the name itself; -before and after that, output the additional assembler syntax for defining -the name, and a newline. - -There are two ways of handling global BSS@. One is to define this macro. -The other is to have @code{TARGET_ASM_SELECT_SECTION} return a -switchable BSS section (@pxref{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}). -You do not need to do both. - -Some languages do not have @code{common} data, and require a -non-common form of global BSS in order to handle uninitialized globals -efficiently. C++ is one example of this. However, if the target does -not support global BSS, the front end may choose to make globals -common in order to save space in the object file. -@end defmac - -@defmac ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} the assembler definition of a local-common-label named -@var{name} whose size is @var{size} bytes. The variable @var{rounded} -is the size rounded up to whatever alignment the caller wants. - -Use the expression @code{assemble_name (@var{stream}, @var{name})} to -output the name itself; before and after that, output the additional -assembler syntax for defining the name, and a newline. - -This macro controls how the assembler definitions of uninitialized -static variables are output. -@end defmac - -@defmac ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment}) -Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a -separate, explicit argument. If you define this macro, it is used in -place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in -handling the required alignment of the variable. The alignment is specified -as the number of bits. -@end defmac - -@defmac ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) -Like @code{ASM_OUTPUT_ALIGNED_DECL} except that @var{decl} of the -variable to be output, if there is one, or @code{NULL_TREE} if there -is no corresponding variable. If you define this macro, GCC will use it -in place of both @code{ASM_OUTPUT_DECL} and -@code{ASM_OUTPUT_ALIGNED_DECL}. Define this macro when you need to see -the variable's decl in order to chose what to output. -@end defmac - -@node Label Output -@subsection Output and Generation of Labels - -@c prevent bad page break with this line -This is about outputting labels. - -@findex assemble_name -@defmac ASM_OUTPUT_LABEL (@var{stream}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} the assembler definition of a label named @var{name}. -Use the expression @code{assemble_name (@var{stream}, @var{name})} to -output the name itself; before and after that, output the additional -assembler syntax for defining the name, and a newline. A default -definition of this macro is provided which is correct for most systems. -@end defmac - -@defmac ASM_OUTPUT_FUNCTION_LABEL (@var{stream}, @var{name}, @var{decl}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} the assembler definition of a label named @var{name} of -a function. -Use the expression @code{assemble_name (@var{stream}, @var{name})} to -output the name itself; before and after that, output the additional -assembler syntax for defining the name, and a newline. A default -definition of this macro is provided which is correct for most systems. - -If this macro is not defined, then the function name is defined in the -usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). -@end defmac - -@findex assemble_name_raw -@defmac ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{name}) -Identical to @code{ASM_OUTPUT_LABEL}, except that @var{name} is known -to refer to a compiler-generated label. The default definition uses -@code{assemble_name_raw}, which is like @code{assemble_name} except -that it is more efficient. -@end defmac - -@defmac SIZE_ASM_OP -A C string containing the appropriate assembler directive to specify the -size of a symbol, without any arguments. On systems that use ELF, the -default (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on other -systems, the default is not to define this macro. - -Define this macro only if it is correct to use the default definitions -of @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE} -for your system. If you need your own custom definitions of those -macros, or if you do not need explicit symbol sizes at all, do not -define this macro. -@end defmac - -@defmac ASM_OUTPUT_SIZE_DIRECTIVE (@var{stream}, @var{name}, @var{size}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} a directive telling the assembler that the size of the -symbol @var{name} is @var{size}. @var{size} is a @code{HOST_WIDE_INT}. -If you define @code{SIZE_ASM_OP}, a default definition of this macro is -provided. -@end defmac - -@defmac ASM_OUTPUT_MEASURED_SIZE (@var{stream}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} a directive telling the assembler to calculate the size of -the symbol @var{name} by subtracting its address from the current -address. - -If you define @code{SIZE_ASM_OP}, a default definition of this macro is -provided. The default assumes that the assembler recognizes a special -@samp{.} symbol as referring to the current address, and can calculate -the difference between this and another symbol. If your assembler does -not recognize @samp{.} or cannot do calculations with it, you will need -to redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique. -@end defmac - -@defmac NO_DOLLAR_IN_LABEL -Define this macro if the assembler does not accept the character -@samp{$} in label names. By default constructors and destructors in -G++ have @samp{$} in the identifiers. If this macro is defined, -@samp{.} is used instead. -@end defmac - -@defmac NO_DOT_IN_LABEL -Define this macro if the assembler does not accept the character -@samp{.} in label names. By default constructors and destructors in G++ -have names that use @samp{.}. If this macro is defined, these names -are rewritten to avoid @samp{.}. -@end defmac - -@defmac TYPE_ASM_OP -A C string containing the appropriate assembler directive to specify the -type of a symbol, without any arguments. On systems that use ELF, the -default (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on other -systems, the default is not to define this macro. - -Define this macro only if it is correct to use the default definition of -@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own -custom definition of this macro, or if you do not need explicit symbol -types at all, do not define this macro. -@end defmac - -@defmac TYPE_OPERAND_FMT -A C string which specifies (using @code{printf} syntax) the format of -the second operand to @code{TYPE_ASM_OP}. On systems that use ELF, the -default (in @file{config/elfos.h}) is @samp{"@@%s"}; on other systems, -the default is not to define this macro. - -Define this macro only if it is correct to use the default definition of -@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own -custom definition of this macro, or if you do not need explicit symbol -types at all, do not define this macro. -@end defmac - -@defmac ASM_OUTPUT_TYPE_DIRECTIVE (@var{stream}, @var{type}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} a directive telling the assembler that the type of the -symbol @var{name} is @var{type}. @var{type} is a C string; currently, -that string is always either @samp{"function"} or @samp{"object"}, but -you should not count on this. - -If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default -definition of this macro is provided. -@end defmac - -@defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} any text necessary for declaring the name @var{name} of a -function which is being defined. This macro is responsible for -outputting the label definition (perhaps using -@code{ASM_OUTPUT_FUNCTION_LABEL}). The argument @var{decl} is the -@code{FUNCTION_DECL} tree node representing the function. - -If this macro is not defined, then the function name is defined in the -usual manner as a label (by means of @code{ASM_OUTPUT_FUNCTION_LABEL}). - -You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition -of this macro. -@end defmac - -@defmac ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} any text necessary for declaring the size of a function -which is being defined. The argument @var{name} is the name of the -function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node -representing the function. - -If this macro is not defined, then the function size is not defined. - -You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition -of this macro. -@end defmac - -@defmac ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} any text necessary for declaring the name @var{name} of an -initialized variable which is being defined. This macro must output the -label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument -@var{decl} is the @code{VAR_DECL} tree node representing the variable. - -If this macro is not defined, then the variable name is defined in the -usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). - -You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or -@code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_DECLARE_CONSTANT_NAME (FILE *@var{file}, const char *@var{name}, const_tree @var{expr}, HOST_WIDE_INT @var{size}) -A target hook to output to the stdio stream @var{file} any text necessary -for declaring the name @var{name} of a constant which is being defined. This -target hook is responsible for outputting the label definition (perhaps using -@code{assemble_label}). The argument @var{exp} is the value of the constant, -and @var{size} is the size of the constant in bytes. The @var{name} -will be an internal label. - -The default version of this target hook, define the @var{name} in the -usual manner as a label (by means of @code{assemble_label}). - -You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook. -@end deftypefn - -@defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} any text necessary for claiming a register @var{regno} -for a global variable @var{decl} with name @var{name}. - -If you don't define this macro, that is equivalent to defining it to do -nothing. -@end defmac - -@defmac ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend}) -A C statement (sans semicolon) to finish up declaring a variable name -once the compiler has processed its initializer fully and thus has had a -chance to determine the size of an array when controlled by an -initializer. This is used on systems where it's necessary to declare -something about the size of the object. - -If you don't define this macro, that is equivalent to defining it to do -nothing. - -You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or -@code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_GLOBALIZE_LABEL (FILE *@var{stream}, const char *@var{name}) -This target hook is a function to output to the stdio stream -@var{stream} some commands that will make the label @var{name} global; -that is, available for reference from other files. - -The default implementation relies on a proper definition of -@code{GLOBAL_ASM_OP}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_GLOBALIZE_DECL_NAME (FILE *@var{stream}, tree @var{decl}) -This target hook is a function to output to the stdio stream -@var{stream} some commands that will make the name associated with @var{decl} -global; that is, available for reference from other files. - -The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_ASSEMBLE_UNDEFINED_DECL (FILE *@var{stream}, const char *@var{name}, const_tree @var{decl}) -This target hook is a function to output to the stdio stream -@var{stream} some commands that will declare the name associated with -@var{decl} which is not defined in the current translation unit. Most -assemblers do not require anything to be output in this case. -@end deftypefn - -@defmac ASM_WEAKEN_LABEL (@var{stream}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} some commands that will make the label @var{name} weak; -that is, available for reference from other files but only used if -no other definition is available. Use the expression -@code{assemble_name (@var{stream}, @var{name})} to output the name -itself; before and after that, output the additional assembler syntax -for making that name weak, and a newline. - -If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will not -support weak symbols and you should not define the @code{SUPPORTS_WEAK} -macro. -@end defmac - -@defmac ASM_WEAKEN_DECL (@var{stream}, @var{decl}, @var{name}, @var{value}) -Combines (and replaces) the function of @code{ASM_WEAKEN_LABEL} and -@code{ASM_OUTPUT_WEAK_ALIAS}, allowing access to the associated function -or variable decl. If @var{value} is not @code{NULL}, this C statement -should output to the stdio stream @var{stream} assembler code which -defines (equates) the weak symbol @var{name} to have the value -@var{value}. If @var{value} is @code{NULL}, it should output commands -to make @var{name} weak. -@end defmac - -@defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value}) -Outputs a directive that enables @var{name} to be used to refer to -symbol @var{value} with weak-symbol semantics. @code{decl} is the -declaration of @code{name}. -@end defmac - -@defmac SUPPORTS_WEAK -A preprocessor constant expression which evaluates to true if the target -supports weak symbols. - -If you don't define this macro, @file{defaults.h} provides a default -definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL} -is defined, the default definition is @samp{1}; otherwise, it is @samp{0}. -@end defmac - -@defmac TARGET_SUPPORTS_WEAK -A C expression which evaluates to true if the target supports weak symbols. - -If you don't define this macro, @file{defaults.h} provides a default -definition. The default definition is @samp{(SUPPORTS_WEAK)}. Define -this macro if you want to control weak symbol support with a compiler -flag such as @option{-melf}. -@end defmac - -@defmac MAKE_DECL_ONE_ONLY (@var{decl}) -A C statement (sans semicolon) to mark @var{decl} to be emitted as a -public symbol such that extra copies in multiple translation units will -be discarded by the linker. Define this macro if your object file -format provides support for this concept, such as the @samp{COMDAT} -section flags in the Microsoft Windows PE/COFF format, and this support -requires changes to @var{decl}, such as putting it in a separate section. -@end defmac - -@defmac SUPPORTS_ONE_ONLY -A C expression which evaluates to true if the target supports one-only -semantics. - -If you don't define this macro, @file{varasm.c} provides a default -definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default -definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if -you want to control one-only symbol support with a compiler flag, or if -setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to -be emitted as one-only. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_ASSEMBLE_VISIBILITY (tree @var{decl}, int @var{visibility}) -This target hook is a function to output to @var{asm_out_file} some -commands that will make the symbol(s) associated with @var{decl} have -hidden, protected or internal visibility as specified by @var{visibility}. -@end deftypefn - -@defmac TARGET_WEAK_NOT_IN_ARCHIVE_TOC -A C expression that evaluates to true if the target's linker expects -that weak symbols do not appear in a static archive's table of contents. -The default is @code{0}. - -Leaving weak symbols out of an archive's table of contents means that, -if a symbol will only have a definition in one translation unit and -will have undefined references from other translation units, that -symbol should not be weak. Defining this macro to be nonzero will -thus have the effect that certain symbols that would normally be weak -(explicit template instantiations, and vtables for polymorphic classes -with noninline key methods) will instead be nonweak. - -The C++ ABI requires this macro to be zero. Define this macro for -targets where full C++ ABI compliance is impossible and where linker -restrictions require weak symbols to be left out of a static archive's -table of contents. -@end defmac - -@defmac ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} any text necessary for declaring the name of an external -symbol named @var{name} which is referenced in this compilation but -not defined. The value of @var{decl} is the tree node for the -declaration. - -This macro need not be defined if it does not need to output anything. -The GNU assembler and most Unix assemblers don't require anything. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_EXTERNAL_LIBCALL (rtx @var{symref}) -This target hook is a function to output to @var{asm_out_file} an assembler -pseudo-op to declare a library function name external. The name of the -library function is given by @var{symref}, which is a @code{symbol_ref}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_MARK_DECL_PRESERVED (const char *@var{symbol}) -This target hook is a function to output to @var{asm_out_file} an assembler -directive to annotate @var{symbol} as used. The Darwin target uses the -.no_dead_code_strip directive. -@end deftypefn - -@defmac ASM_OUTPUT_LABELREF (@var{stream}, @var{name}) -A C statement (sans semicolon) to output to the stdio stream -@var{stream} a reference in assembler syntax to a label named -@var{name}. This should add @samp{_} to the front of the name, if that -is customary on your operating system, as it is in most Berkeley Unix -systems. This macro is used in @code{assemble_name}. -@end defmac - -@deftypefn {Target Hook} tree TARGET_MANGLE_ASSEMBLER_NAME (const char *@var{name}) -Given a symbol @var{name}, perform same mangling as @code{varasm.c}'s @code{assemble_name}, but in memory rather than to a file stream, returning result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and then prepends the @code{USER_LABEL_PREFIX}, if any. -@end deftypefn - -@defmac ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym}) -A C statement (sans semicolon) to output a reference to -@code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name} -will be used to output the name of the symbol. This macro may be used -to modify the way a symbol is referenced depending on information -encoded by @code{TARGET_ENCODE_SECTION_INFO}. -@end defmac - -@defmac ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf}) -A C statement (sans semicolon) to output a reference to @var{buf}, the -result of @code{ASM_GENERATE_INTERNAL_LABEL}. If not defined, -@code{assemble_name} will be used to output the name of the symbol. -This macro is not used by @code{output_asm_label}, or the @code{%l} -specifier that calls it; the intention is that this macro should be set -when it is necessary to output a label differently when its address is -being taken. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_INTERNAL_LABEL (FILE *@var{stream}, const char *@var{prefix}, unsigned long @var{labelno}) -A function to output to the stdio stream @var{stream} a label whose -name is made from the string @var{prefix} and the number @var{labelno}. - -It is absolutely essential that these labels be distinct from the labels -used for user-level functions and variables. Otherwise, certain programs -will have name conflicts with internal labels. - -It is desirable to exclude internal labels from the symbol table of the -object file. Most assemblers have a naming convention for labels that -should be excluded; on many systems, the letter @samp{L} at the -beginning of a label has this effect. You should find out what -convention your system uses, and follow it. - -The default version of this function utilizes @code{ASM_GENERATE_INTERNAL_LABEL}. -@end deftypefn - -@defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num}) -A C statement to output to the stdio stream @var{stream} a debug info -label whose name is made from the string @var{prefix} and the number -@var{num}. This is useful for VLIW targets, where debug info labels -may need to be treated differently than branch target labels. On some -systems, branch target labels must be at the beginning of instruction -bundles, but debug info labels can occur in the middle of instruction -bundles. - -If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will be -used. -@end defmac - -@defmac ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num}) -A C statement to store into the string @var{string} a label whose name -is made from the string @var{prefix} and the number @var{num}. - -This string, when output subsequently by @code{assemble_name}, should -produce the output that @code{(*targetm.asm_out.internal_label)} would produce -with the same @var{prefix} and @var{num}. - -If the string begins with @samp{*}, then @code{assemble_name} will -output the rest of the string unchanged. It is often convenient for -@code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the -string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets -to output the string, and may change it. (Of course, -@code{ASM_OUTPUT_LABELREF} is also part of your machine description, so -you should know what it does on your machine.) -@end defmac - -@defmac ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number}) -A C expression to assign to @var{outvar} (which is a variable of type -@code{char *}) a newly allocated string made from the string -@var{name} and the number @var{number}, with some suitable punctuation -added. Use @code{alloca} to get space for the string. - -The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to -produce an assembler label for an internal static variable whose name is -@var{name}. Therefore, the string must be such as to result in valid -assembler code. The argument @var{number} is different each time this -macro is executed; it prevents conflicts between similarly-named -internal static variables in different scopes. - -Ideally this string should not be a valid C identifier, to prevent any -conflict with the user's own symbols. Most assemblers allow periods -or percent signs in assembler symbols; putting at least one of these -between the name and the number will suffice. - -If this macro is not defined, a default definition will be provided -which is correct for most systems. -@end defmac - -@defmac ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value}) -A C statement to output to the stdio stream @var{stream} assembler code -which defines (equates) the symbol @var{name} to have the value @var{value}. - -@findex SET_ASM_OP -If @code{SET_ASM_OP} is defined, a default definition is provided which is -correct for most systems. -@end defmac - -@defmac ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value}) -A C statement to output to the stdio stream @var{stream} assembler code -which defines (equates) the symbol whose tree node is @var{decl_of_name} -to have the value of the tree node @var{decl_of_value}. This macro will -be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if -the tree nodes are available. - -@findex SET_ASM_OP -If @code{SET_ASM_OP} is defined, a default definition is provided which is -correct for most systems. -@end defmac - -@defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value}) -A C statement that evaluates to true if the assembler code which defines -(equates) the symbol whose tree node is @var{decl_of_name} to have the value -of the tree node @var{decl_of_value} should be emitted near the end of the -current compilation unit. The default is to not defer output of defines. -This macro affects defines output by @samp{ASM_OUTPUT_DEF} and -@samp{ASM_OUTPUT_DEF_FROM_DECLS}. -@end defmac - -@defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value}) -A C statement to output to the stdio stream @var{stream} assembler code -which defines (equates) the weak symbol @var{name} to have the value -@var{value}. If @var{value} is @code{NULL}, it defines @var{name} as -an undefined weak symbol. - -Define this macro if the target only supports weak aliases; define -@code{ASM_OUTPUT_DEF} instead if possible. -@end defmac - -@defmac OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name}) -Define this macro to override the default assembler names used for -Objective-C methods. - -The default name is a unique method number followed by the name of the -class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of -the category is also included in the assembler name (e.g.@: -@samp{_1_Foo_Bar}). - -These names are safe on most systems, but make debugging difficult since -the method's selector is not present in the name. Therefore, particular -systems define other ways of computing names. - -@var{buf} is an expression of type @code{char *} which gives you a -buffer in which to store the name; its length is as long as -@var{class_name}, @var{cat_name} and @var{sel_name} put together, plus -50 characters extra. - -The argument @var{is_inst} specifies whether the method is an instance -method or a class method; @var{class_name} is the name of the class; -@var{cat_name} is the name of the category (or @code{NULL} if the method is not -in a category); and @var{sel_name} is the name of the selector. - -On systems where the assembler can handle quoted names, you can use this -macro to provide more human-readable names. -@end defmac - -@node Initialization -@subsection How Initialization Functions Are Handled -@cindex initialization routines -@cindex termination routines -@cindex constructors, output of -@cindex destructors, output of - -The compiled code for certain languages includes @dfn{constructors} -(also called @dfn{initialization routines})---functions to initialize -data in the program when the program is started. These functions need -to be called before the program is ``started''---that is to say, before -@code{main} is called. - -Compiling some languages generates @dfn{destructors} (also called -@dfn{termination routines}) that should be called when the program -terminates. - -To make the initialization and termination functions work, the compiler -must output something in the assembler code to cause those functions to -be called at the appropriate time. When you port the compiler to a new -system, you need to specify how to do this. - -There are two major ways that GCC currently supports the execution of -initialization and termination functions. Each way has two variants. -Much of the structure is common to all four variations. - -@findex __CTOR_LIST__ -@findex __DTOR_LIST__ -The linker must build two lists of these functions---a list of -initialization functions, called @code{__CTOR_LIST__}, and a list of -termination functions, called @code{__DTOR_LIST__}. - -Each list always begins with an ignored function pointer (which may hold -0, @minus{}1, or a count of the function pointers after it, depending on -the environment). This is followed by a series of zero or more function -pointers to constructors (or destructors), followed by a function -pointer containing zero. - -Depending on the operating system and its executable file format, either -@file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup -time and exit time. Constructors are called in reverse order of the -list; destructors in forward order. - -The best way to handle static constructors works only for object file -formats which provide arbitrarily-named sections. A section is set -aside for a list of constructors, and another for a list of destructors. -Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each -object file that defines an initialization function also puts a word in -the constructor section to point to that function. The linker -accumulates all these words into one contiguous @samp{.ctors} section. -Termination functions are handled similarly. - -This method will be chosen as the default by @file{target-def.h} if -@code{TARGET_ASM_NAMED_SECTION} is defined. A target that does not -support arbitrary sections, but does support special designated -constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP} -and @code{DTORS_SECTION_ASM_OP} to achieve the same effect. - -When arbitrary sections are available, there are two variants, depending -upon how the code in @file{crtstuff.c} is called. On systems that -support a @dfn{.init} section which is executed at program startup, -parts of @file{crtstuff.c} are compiled into that section. The -program is linked by the @command{gcc} driver like this: - -@smallexample -ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o -@end smallexample - -The prologue of a function (@code{__init}) appears in the @code{.init} -section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise -for the function @code{__fini} in the @dfn{.fini} section. Normally these -files are provided by the operating system or by the GNU C library, but -are provided by GCC for a few targets. - -The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets) -compiled from @file{crtstuff.c}. They contain, among other things, code -fragments within the @code{.init} and @code{.fini} sections that branch -to routines in the @code{.text} section. The linker will pull all parts -of a section together, which results in a complete @code{__init} function -that invokes the routines we need at startup. - -To use this variant, you must define the @code{INIT_SECTION_ASM_OP} -macro properly. - -If no init section is available, when GCC compiles any function called -@code{main} (or more accurately, any function designated as a program -entry point by the language front end calling @code{expand_main_function}), -it inserts a procedure call to @code{__main} as the first executable code -after the function prologue. The @code{__main} function is defined -in @file{libgcc2.c} and runs the global constructors. - -In file formats that don't support arbitrary sections, there are again -two variants. In the simplest variant, the GNU linker (GNU @code{ld}) -and an `a.out' format must be used. In this case, -@code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs} -entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__}, -and with the address of the void function containing the initialization -code as its value. The GNU linker recognizes this as a request to add -the value to a @dfn{set}; the values are accumulated, and are eventually -placed in the executable as a vector in the format described above, with -a leading (ignored) count and a trailing zero element. -@code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no init -section is available, the absence of @code{INIT_SECTION_ASM_OP} causes -the compilation of @code{main} to call @code{__main} as above, starting -the initialization process. - -The last variant uses neither arbitrary sections nor the GNU linker. -This is preferable when you want to do dynamic linking and when using -file formats which the GNU linker does not support, such as `ECOFF'@. In -this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and -termination functions are recognized simply by their names. This requires -an extra program in the linkage step, called @command{collect2}. This program -pretends to be the linker, for use with GCC; it does its job by running -the ordinary linker, but also arranges to include the vectors of -initialization and termination functions. These functions are called -via @code{__main} as described above. In order to use this method, -@code{use_collect2} must be defined in the target in @file{config.gcc}. - -@ifinfo -The following section describes the specific macros that control and -customize the handling of initialization and termination functions. -@end ifinfo - -@node Macros for Initialization -@subsection Macros Controlling Initialization Routines - -Here are the macros that control how the compiler handles initialization -and termination functions: - -@defmac INIT_SECTION_ASM_OP -If defined, a C string constant, including spacing, for the assembler -operation to identify the following data as initialization code. If not -defined, GCC will assume such a section does not exist. When you are -using special sections for initialization and termination functions, this -macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to -run the initialization functions. -@end defmac - -@defmac HAS_INIT_SECTION -If defined, @code{main} will not call @code{__main} as described above. -This macro should be defined for systems that control start-up code -on a symbol-by-symbol basis, such as OSF/1, and should not -be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}. -@end defmac - -@defmac LD_INIT_SWITCH -If defined, a C string constant for a switch that tells the linker that -the following symbol is an initialization routine. -@end defmac - -@defmac LD_FINI_SWITCH -If defined, a C string constant for a switch that tells the linker that -the following symbol is a finalization routine. -@end defmac - -@defmac COLLECT_SHARED_INIT_FUNC (@var{stream}, @var{func}) -If defined, a C statement that will write a function that can be -automatically called when a shared library is loaded. The function -should call @var{func}, which takes no arguments. If not defined, and -the object format requires an explicit initialization function, then a -function called @code{_GLOBAL__DI} will be generated. - -This function and the following one are used by collect2 when linking a -shared library that needs constructors or destructors, or has DWARF2 -exception tables embedded in the code. -@end defmac - -@defmac COLLECT_SHARED_FINI_FUNC (@var{stream}, @var{func}) -If defined, a C statement that will write a function that can be -automatically called when a shared library is unloaded. The function -should call @var{func}, which takes no arguments. If not defined, and -the object format requires an explicit finalization function, then a -function called @code{_GLOBAL__DD} will be generated. -@end defmac - -@defmac INVOKE__main -If defined, @code{main} will call @code{__main} despite the presence of -@code{INIT_SECTION_ASM_OP}. This macro should be defined for systems -where the init section is not actually run automatically, but is still -useful for collecting the lists of constructors and destructors. -@end defmac - -@defmac SUPPORTS_INIT_PRIORITY -If nonzero, the C++ @code{init_priority} attribute is supported and the -compiler should emit instructions to control the order of initialization -of objects. If zero, the compiler will issue an error message upon -encountering an @code{init_priority} attribute. -@end defmac - -@deftypevr {Target Hook} bool TARGET_HAVE_CTORS_DTORS -This value is true if the target supports some ``native'' method of -collecting constructors and destructors to be run at startup and exit. -It is false if we must use @command{collect2}. -@end deftypevr - -@deftypefn {Target Hook} void TARGET_ASM_CONSTRUCTOR (rtx @var{symbol}, int @var{priority}) -If defined, a function that outputs assembler code to arrange to call -the function referenced by @var{symbol} at initialization time. - -Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking -no arguments and with no return value. If the target supports initialization -priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY}; -otherwise it must be @code{DEFAULT_INIT_PRIORITY}. - -If this macro is not defined by the target, a suitable default will -be chosen if (1) the target supports arbitrary section names, (2) the -target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2} -is not defined. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_DESTRUCTOR (rtx @var{symbol}, int @var{priority}) -This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination -functions rather than initialization functions. -@end deftypefn - -If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine -generated for the generated object file will have static linkage. - -If your system uses @command{collect2} as the means of processing -constructors, then that program normally uses @command{nm} to scan -an object file for constructor functions to be called. - -On certain kinds of systems, you can define this macro to make -@command{collect2} work faster (and, in some cases, make it work at all): - -@defmac OBJECT_FORMAT_COFF -Define this macro if the system uses COFF (Common Object File Format) -object files, so that @command{collect2} can assume this format and scan -object files directly for dynamic constructor/destructor functions. - -This macro is effective only in a native compiler; @command{collect2} as -part of a cross compiler always uses @command{nm} for the target machine. -@end defmac - -@defmac REAL_NM_FILE_NAME -Define this macro as a C string constant containing the file name to use -to execute @command{nm}. The default is to search the path normally for -@command{nm}. -@end defmac - -@defmac NM_FLAGS -@command{collect2} calls @command{nm} to scan object files for static -constructors and destructors and LTO info. By default, @option{-n} is -passed. Define @code{NM_FLAGS} to a C string constant if other options -are needed to get the same output format as GNU @command{nm -n} -produces. -@end defmac - -If your system supports shared libraries and has a program to list the -dynamic dependencies of a given library or executable, you can define -these macros to enable support for running initialization and -termination functions in shared libraries: - -@defmac LDD_SUFFIX -Define this macro to a C string constant containing the name of the program -which lists dynamic dependencies, like @command{ldd} under SunOS 4. -@end defmac - -@defmac PARSE_LDD_OUTPUT (@var{ptr}) -Define this macro to be C code that extracts filenames from the output -of the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variable -of type @code{char *} that points to the beginning of a line of output -from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the -code must advance @var{ptr} to the beginning of the filename on that -line. Otherwise, it must set @var{ptr} to @code{NULL}. -@end defmac - -@defmac SHLIB_SUFFIX -Define this macro to a C string constant containing the default shared -library extension of the target (e.g., @samp{".so"}). @command{collect2} -strips version information after this suffix when generating global -constructor and destructor names. This define is only needed on targets -that use @command{collect2} to process constructors and destructors. -@end defmac - -@node Instruction Output -@subsection Output of Assembler Instructions - -@c prevent bad page break with this line -This describes assembler instruction output. - -@defmac REGISTER_NAMES -A C initializer containing the assembler's names for the machine -registers, each one as a C string constant. This is what translates -register numbers in the compiler into assembler language. -@end defmac - -@defmac ADDITIONAL_REGISTER_NAMES -If defined, a C initializer for an array of structures containing a name -and a register number. This macro defines additional names for hard -registers, thus allowing the @code{asm} option in declarations to refer -to registers using alternate names. -@end defmac - -@defmac OVERLAPPING_REGISTER_NAMES -If defined, a C initializer for an array of structures containing a -name, a register number and a count of the number of consecutive -machine registers the name overlaps. This macro defines additional -names for hard registers, thus allowing the @code{asm} option in -declarations to refer to registers using alternate names. Unlike -@code{ADDITIONAL_REGISTER_NAMES}, this macro should be used when the -register name implies multiple underlying registers. - -This macro should be used when it is important that a clobber in an -@code{asm} statement clobbers all the underlying values implied by the -register name. For example, on ARM, clobbering the double-precision -VFP register ``d0'' implies clobbering both single-precision registers -``s0'' and ``s1''. -@end defmac - -@defmac ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr}) -Define this macro if you are using an unusual assembler that -requires different names for the machine instructions. - -The definition is a C statement or statements which output an -assembler instruction opcode to the stdio stream @var{stream}. The -macro-operand @var{ptr} is a variable of type @code{char *} which -points to the opcode name in its ``internal'' form---the form that is -written in the machine description. The definition should output the -opcode name to @var{stream}, performing any translation you desire, and -increment the variable @var{ptr} to point at the end of the opcode -so that it will not be output twice. - -In fact, your macro definition may process less than the entire opcode -name, or more than the opcode name; but if you want to process text -that includes @samp{%}-sequences to substitute operands, you must take -care of the substitution yourself. Just be sure to increment -@var{ptr} over whatever text should not be output normally. - -@findex recog_data.operand -If you need to look at the operand values, they can be found as the -elements of @code{recog_data.operand}. - -If the macro definition does nothing, the instruction is output -in the usual way. -@end defmac - -@defmac FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands}) -If defined, a C statement to be executed just prior to the output of -assembler code for @var{insn}, to modify the extracted operands so -they will be output differently. - -Here the argument @var{opvec} is the vector containing the operands -extracted from @var{insn}, and @var{noperands} is the number of -elements of the vector which contain meaningful data for this insn. -The contents of this vector are what will be used to convert the insn -template into assembler code, so you can change the assembler output -by changing the contents of the vector. - -This macro is useful when various assembler syntaxes share a single -file of instruction patterns; by defining this macro differently, you -can cause a large class of instructions to be output differently (such -as with rearranged operands). Naturally, variations in assembler -syntax affecting individual insn patterns ought to be handled by -writing conditional output routines in those patterns. - -If this macro is not defined, it is equivalent to a null statement. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_FINAL_POSTSCAN_INSN (FILE *@var{file}, rtx_insn *@var{insn}, rtx *@var{opvec}, int @var{noperands}) -If defined, this target hook is a function which is executed just after the -output of assembler code for @var{insn}, to change the mode of the assembler -if necessary. - -Here the argument @var{opvec} is the vector containing the operands -extracted from @var{insn}, and @var{noperands} is the number of -elements of the vector which contain meaningful data for this insn. -The contents of this vector are what was used to convert the insn -template into assembler code, so you can change the assembler mode -by checking the contents of the vector. -@end deftypefn - -@defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code}) -A C compound statement to output to stdio stream @var{stream} the -assembler syntax for an instruction operand @var{x}. @var{x} is an -RTL expression. - -@var{code} is a value that can be used to specify one of several ways -of printing the operand. It is used when identical operands must be -printed differently depending on the context. @var{code} comes from -the @samp{%} specification that was used to request printing of the -operand. If the specification was just @samp{%@var{digit}} then -@var{code} is 0; if the specification was @samp{%@var{ltr} -@var{digit}} then @var{code} is the ASCII code for @var{ltr}. - -@findex reg_names -If @var{x} is a register, this macro should print the register's name. -The names can be found in an array @code{reg_names} whose type is -@code{char *[]}. @code{reg_names} is initialized from -@code{REGISTER_NAMES}. - -When the machine description has a specification @samp{%@var{punct}} -(a @samp{%} followed by a punctuation character), this macro is called -with a null pointer for @var{x} and the punctuation character for -@var{code}. -@end defmac - -@defmac PRINT_OPERAND_PUNCT_VALID_P (@var{code}) -A C expression which evaluates to true if @var{code} is a valid -punctuation character for use in the @code{PRINT_OPERAND} macro. If -@code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no -punctuation characters (except for the standard one, @samp{%}) are used -in this way. -@end defmac - -@defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x}) -A C compound statement to output to stdio stream @var{stream} the -assembler syntax for an instruction operand that is a memory reference -whose address is @var{x}. @var{x} is an RTL expression. - -@cindex @code{TARGET_ENCODE_SECTION_INFO} usage -On some machines, the syntax for a symbolic address depends on the -section that the address refers to. On these machines, define the hook -@code{TARGET_ENCODE_SECTION_INFO} to store the information into the -@code{symbol_ref}, and then check for it here. @xref{Assembler -Format}. -@end defmac - -@findex dbr_sequence_length -@defmac DBR_OUTPUT_SEQEND (@var{file}) -A C statement, to be executed after all slot-filler instructions have -been output. If necessary, call @code{dbr_sequence_length} to -determine the number of slots filled in a sequence (zero if not -currently outputting a sequence), to decide how many no-ops to output, -or whatever. - -Don't define this macro if it has nothing to do, but it is helpful in -reading assembly output if the extent of the delay sequence is made -explicit (e.g.@: with white space). -@end defmac - -@findex final_sequence -Note that output routines for instructions with delay slots must be -prepared to deal with not being output as part of a sequence -(i.e.@: when the scheduling pass is not run, or when no slot fillers could be -found.) The variable @code{final_sequence} is null when not -processing a sequence, otherwise it contains the @code{sequence} rtx -being output. - -@findex asm_fprintf -@defmac REGISTER_PREFIX -@defmacx LOCAL_LABEL_PREFIX -@defmacx USER_LABEL_PREFIX -@defmacx IMMEDIATE_PREFIX -If defined, C string expressions to be used for the @samp{%R}, @samp{%L}, -@samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see -@file{final.c}). These are useful when a single @file{md} file must -support multiple assembler formats. In that case, the various @file{tm.h} -files can define these macros differently. -@end defmac - -@defmac ASM_FPRINTF_EXTENSIONS (@var{file}, @var{argptr}, @var{format}) -If defined this macro should expand to a series of @code{case} -statements which will be parsed inside the @code{switch} statement of -the @code{asm_fprintf} function. This allows targets to define extra -printf formats which may useful when generating their assembler -statements. Note that uppercase letters are reserved for future -generic extensions to asm_fprintf, and so are not available to target -specific code. The output file is given by the parameter @var{file}. -The varargs input pointer is @var{argptr} and the rest of the format -string, starting the character after the one that is being switched -upon, is pointed to by @var{format}. -@end defmac - -@defmac ASSEMBLER_DIALECT -If your target supports multiple dialects of assembler language (such as -different opcodes), define this macro as a C expression that gives the -numeric index of the assembler language dialect to use, with zero as the -first variant. - -If this macro is defined, you may use constructs of the form -@smallexample -@samp{@{option0|option1|option2@dots{}@}} -@end smallexample -@noindent -in the output templates of patterns (@pxref{Output Template}) or in the -first argument of @code{asm_fprintf}. This construct outputs -@samp{option0}, @samp{option1}, @samp{option2}, etc., if the value of -@code{ASSEMBLER_DIALECT} is zero, one, two, etc. Any special characters -within these strings retain their usual meaning. If there are fewer -alternatives within the braces than the value of -@code{ASSEMBLER_DIALECT}, the construct outputs nothing. If it's needed -to print curly braces or @samp{|} character in assembler output directly, -@samp{%@{}, @samp{%@}} and @samp{%|} can be used. - -If you do not define this macro, the characters @samp{@{}, @samp{|} and -@samp{@}} do not have any special meaning when used in templates or -operands to @code{asm_fprintf}. - -Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX}, -@code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express -the variations in assembler language syntax with that mechanism. Define -@code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax -if the syntax variant are larger and involve such things as different -opcodes or operand order. -@end defmac - -@defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno}) -A C expression to output to @var{stream} some assembler code -which will push hard register number @var{regno} onto the stack. -The code need not be optimal, since this macro is used only when -profiling. -@end defmac - -@defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno}) -A C expression to output to @var{stream} some assembler code -which will pop hard register number @var{regno} off of the stack. -The code need not be optimal, since this macro is used only when -profiling. -@end defmac - -@node Dispatch Tables -@subsection Output of Dispatch Tables - -@c prevent bad page break with this line -This concerns dispatch tables. - -@cindex dispatch table -@defmac ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel}) -A C statement to output to the stdio stream @var{stream} an assembler -pseudo-instruction to generate a difference between two labels. -@var{value} and @var{rel} are the numbers of two internal labels. The -definitions of these labels are output using -@code{(*targetm.asm_out.internal_label)}, and they must be printed in the same -way here. For example, - -@smallexample -fprintf (@var{stream}, "\t.word L%d-L%d\n", - @var{value}, @var{rel}) -@end smallexample - -You must provide this macro on machines where the addresses in a -dispatch table are relative to the table's own address. If defined, GCC -will also use this macro on all machines when producing PIC@. -@var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the -mode and flags can be read. -@end defmac - -@defmac ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value}) -This macro should be provided on machines where the addresses -in a dispatch table are absolute. - -The definition should be a C statement to output to the stdio stream -@var{stream} an assembler pseudo-instruction to generate a reference to -a label. @var{value} is the number of an internal label whose -definition is output using @code{(*targetm.asm_out.internal_label)}. -For example, - -@smallexample -fprintf (@var{stream}, "\t.word L%d\n", @var{value}) -@end smallexample -@end defmac - -@defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table}) -Define this if the label before a jump-table needs to be output -specially. The first three arguments are the same as for -@code{(*targetm.asm_out.internal_label)}; the fourth argument is the -jump-table which follows (a @code{jump_table_data} containing an -@code{addr_vec} or @code{addr_diff_vec}). - -This feature is used on system V to output a @code{swbeg} statement -for the table. - -If this macro is not defined, these labels are output with -@code{(*targetm.asm_out.internal_label)}. -@end defmac - -@defmac ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table}) -Define this if something special must be output at the end of a -jump-table. The definition should be a C statement to be executed -after the assembler code for the table is written. It should write -the appropriate code to stdio stream @var{stream}. The argument -@var{table} is the jump-table insn, and @var{num} is the label-number -of the preceding label. - -If this macro is not defined, nothing special is output at the end of -the jump-table. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_EMIT_UNWIND_LABEL (FILE *@var{stream}, tree @var{decl}, int @var{for_eh}, int @var{empty}) -This target hook emits a label at the beginning of each FDE@. It -should be defined on targets where FDEs need special labels, and it -should write the appropriate label, for the FDE associated with the -function declaration @var{decl}, to the stdio stream @var{stream}. -The third argument, @var{for_eh}, is a boolean: true if this is for an -exception table. The fourth argument, @var{empty}, is a boolean: -true if this is a placeholder label for an omitted FDE@. - -The default is that FDEs are not given nonlocal labels. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL (FILE *@var{stream}) -This target hook emits a label at the beginning of the exception table. -It should be defined on targets where it is desirable for the table -to be broken up according to function. - -The default is that no label is emitted. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_EMIT_EXCEPT_PERSONALITY (rtx @var{personality}) -If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be used to emit a directive to install a personality hook into the unwind info. This hook should not be used if dwarf2 unwind info is used. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ASM_UNWIND_EMIT (FILE *@var{stream}, rtx_insn *@var{insn}) -This target hook emits assembly directives required to unwind the -given instruction. This is only used when @code{TARGET_EXCEPT_UNWIND_INFO} -returns @code{UI_TARGET}. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_ASM_UNWIND_EMIT_BEFORE_INSN -True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before the assembly for @var{insn} has been emitted, false if the hook should be called afterward. -@end deftypevr - -@node Exception Region Output -@subsection Assembler Commands for Exception Regions - -@c prevent bad page break with this line - -This describes commands marking the start and the end of an exception -region. - -@defmac EH_FRAME_SECTION_NAME -If defined, a C string constant for the name of the section containing -exception handling frame unwind information. If not defined, GCC will -provide a default definition if the target supports named sections. -@file{crtstuff.c} uses this macro to switch to the appropriate section. - -You should define this symbol if your target supports DWARF 2 frame -unwind information and the default definition does not work. -@end defmac - -@defmac EH_FRAME_IN_DATA_SECTION -If defined, DWARF 2 frame unwind information will be placed in the -data section even though the target supports named sections. This -might be necessary, for instance, if the system linker does garbage -collection and sections cannot be marked as not to be collected. - -Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is -also defined. -@end defmac - -@defmac EH_TABLES_CAN_BE_READ_ONLY -Define this macro to 1 if your target is such that no frame unwind -information encoding used with non-PIC code will ever require a -runtime relocation, but the linker may not support merging read-only -and read-write sections into a single read-write section. -@end defmac - -@defmac MASK_RETURN_ADDR -An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so -that it does not contain any extraneous set bits in it. -@end defmac - -@defmac DWARF2_UNWIND_INFO -Define this macro to 0 if your target supports DWARF 2 frame unwind -information, but it does not yet work with exception handling. -Otherwise, if your target supports this information (if it defines -@code{INCOMING_RETURN_ADDR_RTX} and @code{OBJECT_FORMAT_ELF}), -GCC will provide a default definition of 1. -@end defmac - -@deftypefn {Common Target Hook} {enum unwind_info_type} TARGET_EXCEPT_UNWIND_INFO (struct gcc_options *@var{opts}) -This hook defines the mechanism that will be used for exception handling -by the target. If the target has ABI specified unwind tables, the hook -should return @code{UI_TARGET}. If the target is to use the -@code{setjmp}/@code{longjmp}-based exception handling scheme, the hook -should return @code{UI_SJLJ}. If the target supports DWARF 2 frame unwind -information, the hook should return @code{UI_DWARF2}. - -A target may, if exceptions are disabled, choose to return @code{UI_NONE}. -This may end up simplifying other parts of target-specific code. The -default implementation of this hook never returns @code{UI_NONE}. - -Note that the value returned by this hook should be constant. It should -not depend on anything except the command-line switches described by -@var{opts}. In particular, the -setting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processor -macros and builtin functions related to exception handling are set up -depending on this setting. - -The default implementation of the hook first honors the -@option{--enable-sjlj-exceptions} configure option, then -@code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}. If -@code{DWARF2_UNWIND_INFO} depends on command-line options, the target -must define this hook so that @var{opts} is used correctly. -@end deftypefn - -@deftypevr {Common Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT -This variable should be set to @code{true} if the target ABI requires unwinding -tables even when exceptions are not used. It must not be modified by -command-line option processing. -@end deftypevr - -@defmac DONT_USE_BUILTIN_SETJMP -Define this macro to 1 if the @code{setjmp}/@code{longjmp}-based scheme -should use the @code{setjmp}/@code{longjmp} functions from the C library -instead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery. -@end defmac - -@defmac JMP_BUF_SIZE -This macro has no effect unless @code{DONT_USE_BUILTIN_SETJMP} is also -defined. Define this macro if the default size of @code{jmp_buf} buffer -for the @code{setjmp}/@code{longjmp}-based exception handling mechanism -is not large enough, or if it is much too large. -The default size is @code{FIRST_PSEUDO_REGISTER * sizeof(void *)}. -@end defmac - -@defmac DWARF_CIE_DATA_ALIGNMENT -This macro need only be defined if the target might save registers in the -function prologue at an offset to the stack pointer that is not aligned to -@code{UNITS_PER_WORD}. The definition should be the negative minimum -alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive -minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if -the target supports DWARF 2 frame unwind information. -@end defmac - -@deftypevr {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO -Contains the value true if the target should add a zero word onto the -end of a Dwarf-2 frame info section when used for exception handling. -Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, and -true otherwise. -@end deftypevr - -@deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg}) -Given a register, this hook should return a parallel of registers to -represent where to find the register pieces. Define this hook if the -register and its mode are represented in Dwarf in non-contiguous -locations, or if the register should be represented in more than one -register in Dwarf. Otherwise, this hook should return @code{NULL_RTX}. -If not defined, the default is to return @code{NULL_RTX}. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_DWARF_FRAME_REG_MODE (int @var{regno}) -Given a register, this hook should return the mode which the -corresponding Dwarf frame register should have. This is normally -used to return a smaller mode than the raw mode to prevent call -clobbered parts of a register altering the frame register size -@end deftypefn - -@deftypefn {Target Hook} void TARGET_INIT_DWARF_REG_SIZES_EXTRA (tree @var{address}) -If some registers are represented in Dwarf-2 unwind information in -multiple pieces, define this hook to fill in information about the -sizes of those pieces in the table used by the unwinder at runtime. -It will be called by @code{expand_builtin_init_dwarf_reg_sizes} after -filling in a single size corresponding to each hard register; -@var{address} is the address of the table. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ASM_TTYPE (rtx @var{sym}) -This hook is used to output a reference from a frame unwinding table to -the type_info object identified by @var{sym}. It should return @code{true} -if the reference was output. Returning @code{false} will cause the -reference to be output using the normal Dwarf2 routines. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_ARM_EABI_UNWINDER -This flag should be set to @code{true} on targets that use an ARM EABI -based unwinding library, and @code{false} on other targets. This effects -the format of unwinding tables, and how the unwinder in entered after -running a cleanup. The default is @code{false}. -@end deftypevr - -@node Alignment Output -@subsection Assembler Commands for Alignment - -@c prevent bad page break with this line -This describes commands for alignment. - -@defmac JUMP_ALIGN (@var{label}) -The alignment (log base 2) to put in front of @var{label}, which is -a common destination of jumps and has no fallthru incoming edge. - -This macro need not be defined if you don't want any special alignment -to be done at such a time. Most machine descriptions do not currently -define the macro. - -Unless it's necessary to inspect the @var{label} parameter, it is better -to set the variable @var{align_jumps} in the target's -@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's -selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation. -@end defmac - -@deftypefn {Target Hook} int TARGET_ASM_JUMP_ALIGN_MAX_SKIP (rtx_insn *@var{label}) -The maximum number of bytes to skip before @var{label} when applying -@code{JUMP_ALIGN}. This works only if -@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined. -@end deftypefn - -@defmac LABEL_ALIGN_AFTER_BARRIER (@var{label}) -The alignment (log base 2) to put in front of @var{label}, which follows -a @code{BARRIER}. - -This macro need not be defined if you don't want any special alignment -to be done at such a time. Most machine descriptions do not currently -define the macro. -@end defmac - -@deftypefn {Target Hook} int TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP (rtx_insn *@var{label}) -The maximum number of bytes to skip before @var{label} when applying -@code{LABEL_ALIGN_AFTER_BARRIER}. This works only if -@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined. -@end deftypefn - -@defmac LOOP_ALIGN (@var{label}) -The alignment (log base 2) to put in front of @var{label} that heads -a frequently executed basic block (usually the header of a loop). - -This macro need not be defined if you don't want any special alignment -to be done at such a time. Most machine descriptions do not currently -define the macro. - -Unless it's necessary to inspect the @var{label} parameter, it is better -to set the variable @code{align_loops} in the target's -@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's -selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation. -@end defmac - -@deftypefn {Target Hook} int TARGET_ASM_LOOP_ALIGN_MAX_SKIP (rtx_insn *@var{label}) -The maximum number of bytes to skip when applying @code{LOOP_ALIGN} to -@var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is -defined. -@end deftypefn - -@defmac LABEL_ALIGN (@var{label}) -The alignment (log base 2) to put in front of @var{label}. -If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment, -the maximum of the specified values is used. - -Unless it's necessary to inspect the @var{label} parameter, it is better -to set the variable @code{align_labels} in the target's -@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's -selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation. -@end defmac - -@deftypefn {Target Hook} int TARGET_ASM_LABEL_ALIGN_MAX_SKIP (rtx_insn *@var{label}) -The maximum number of bytes to skip when applying @code{LABEL_ALIGN} -to @var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} -is defined. -@end deftypefn - -@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes}) -A C statement to output to the stdio stream @var{stream} an assembler -instruction to advance the location counter by @var{nbytes} bytes. -Those bytes should be zero when loaded. @var{nbytes} will be a C -expression of type @code{unsigned HOST_WIDE_INT}. -@end defmac - -@defmac ASM_NO_SKIP_IN_TEXT -Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the -text section because it fails to put zeros in the bytes that are skipped. -This is true on many Unix systems, where the pseudo--op to skip bytes -produces no-op instructions rather than zeros when used in the text -section. -@end defmac - -@defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power}) -A C statement to output to the stdio stream @var{stream} an assembler -command to advance the location counter to a multiple of 2 to the -@var{power} bytes. @var{power} will be a C expression of type @code{int}. -@end defmac - -@defmac ASM_OUTPUT_ALIGN_WITH_NOP (@var{stream}, @var{power}) -Like @code{ASM_OUTPUT_ALIGN}, except that the ``nop'' instruction is used -for padding, if necessary. -@end defmac - -@defmac ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip}) -A C statement to output to the stdio stream @var{stream} an assembler -command to advance the location counter to a multiple of 2 to the -@var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to -satisfy the alignment request. @var{power} and @var{max_skip} will be -a C expression of type @code{int}. -@end defmac - -@need 3000 -@node Debugging Info -@section Controlling Debugging Information Format - -@c prevent bad page break with this line -This describes how to specify debugging information. - -@menu -* All Debuggers:: Macros that affect all debugging formats uniformly. -* DBX Options:: Macros enabling specific options in DBX format. -* DBX Hooks:: Hook macros for varying DBX format. -* File Names and DBX:: Macros controlling output of file names in DBX format. -* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats. -* VMS Debug:: Macros for VMS debug format. -@end menu - -@node All Debuggers -@subsection Macros Affecting All Debugging Formats - -@c prevent bad page break with this line -These macros affect all debugging formats. - -@defmac DBX_REGISTER_NUMBER (@var{regno}) -A C expression that returns the DBX register number for the compiler -register number @var{regno}. In the default macro provided, the value -of this expression will be @var{regno} itself. But sometimes there are -some registers that the compiler knows about and DBX does not, or vice -versa. In such cases, some register may need to have one number in the -compiler and another for DBX@. - -If two registers have consecutive numbers inside GCC, and they can be -used as a pair to hold a multiword value, then they @emph{must} have -consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}. -Otherwise, debuggers will be unable to access such a pair, because they -expect register pairs to be consecutive in their own numbering scheme. - -If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that -does not preserve register pairs, then what you must do instead is -redefine the actual register numbering scheme. -@end defmac - -@defmac DEBUGGER_AUTO_OFFSET (@var{x}) -A C expression that returns the integer offset value for an automatic -variable having address @var{x} (an RTL expression). The default -computation assumes that @var{x} is based on the frame-pointer and -gives the offset from the frame-pointer. This is required for targets -that produce debugging output for DBX or COFF-style debugging output -for SDB and allow the frame-pointer to be eliminated when the -@option{-g} options is used. -@end defmac - -@defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x}) -A C expression that returns the integer offset value for an argument -having address @var{x} (an RTL expression). The nominal offset is -@var{offset}. -@end defmac - -@defmac PREFERRED_DEBUGGING_TYPE -A C expression that returns the type of debugging output GCC should -produce when the user specifies just @option{-g}. Define -this if you have arranged for GCC to support more than one format of -debugging output. Currently, the allowable values are @code{DBX_DEBUG}, -@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, -@code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}. - -When the user specifies @option{-ggdb}, GCC normally also uses the -value of this macro to select the debugging output format, but with two -exceptions. If @code{DWARF2_DEBUGGING_INFO} is defined, GCC uses the -value @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} is -defined, GCC uses @code{DBX_DEBUG}. - -The value of this macro only affects the default debugging output; the -user can always get a specific type of output by using @option{-gstabs}, -@option{-gcoff}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. -@end defmac - -@node DBX Options -@subsection Specific Options for DBX Output - -@c prevent bad page break with this line -These are specific options for DBX output. - -@defmac DBX_DEBUGGING_INFO -Define this macro if GCC should produce debugging output for DBX -in response to the @option{-g} option. -@end defmac - -@defmac XCOFF_DEBUGGING_INFO -Define this macro if GCC should produce XCOFF format debugging output -in response to the @option{-g} option. This is a variant of DBX format. -@end defmac - -@defmac DEFAULT_GDB_EXTENSIONS -Define this macro to control whether GCC should by default generate -GDB's extended version of DBX debugging information (assuming DBX-format -debugging information is enabled at all). If you don't define the -macro, the default is 1: always generate the extended information -if there is any occasion to. -@end defmac - -@defmac DEBUG_SYMS_TEXT -Define this macro if all @code{.stabs} commands should be output while -in the text section. -@end defmac - -@defmac ASM_STABS_OP -A C string constant, including spacing, naming the assembler pseudo op to -use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol. -If you don't define this macro, @code{"\t.stabs\t"} is used. This macro -applies only to DBX debugging information format. -@end defmac - -@defmac ASM_STABD_OP -A C string constant, including spacing, naming the assembler pseudo op to -use instead of @code{"\t.stabd\t"} to define a debugging symbol whose -value is the current location. If you don't define this macro, -@code{"\t.stabd\t"} is used. This macro applies only to DBX debugging -information format. -@end defmac - -@defmac ASM_STABN_OP -A C string constant, including spacing, naming the assembler pseudo op to -use instead of @code{"\t.stabn\t"} to define a debugging symbol with no -name. If you don't define this macro, @code{"\t.stabn\t"} is used. This -macro applies only to DBX debugging information format. -@end defmac - -@defmac DBX_NO_XREFS -Define this macro if DBX on your system does not support the construct -@samp{xs@var{tagname}}. On some systems, this construct is used to -describe a forward reference to a structure named @var{tagname}. -On other systems, this construct is not supported at all. -@end defmac - -@defmac DBX_CONTIN_LENGTH -A symbol name in DBX-format debugging information is normally -continued (split into two separate @code{.stabs} directives) when it -exceeds a certain length (by default, 80 characters). On some -operating systems, DBX requires this splitting; on others, splitting -must not be done. You can inhibit splitting by defining this macro -with the value zero. You can override the default splitting-length by -defining this macro as an expression for the length you desire. -@end defmac - -@defmac DBX_CONTIN_CHAR -Normally continuation is indicated by adding a @samp{\} character to -the end of a @code{.stabs} string when a continuation follows. To use -a different character instead, define this macro as a character -constant for the character you want to use. Do not define this macro -if backslash is correct for your system. -@end defmac - -@defmac DBX_STATIC_STAB_DATA_SECTION -Define this macro if it is necessary to go to the data section before -outputting the @samp{.stabs} pseudo-op for a non-global static -variable. -@end defmac - -@defmac DBX_TYPE_DECL_STABS_CODE -The value to use in the ``code'' field of the @code{.stabs} directive -for a typedef. The default is @code{N_LSYM}. -@end defmac - -@defmac DBX_STATIC_CONST_VAR_CODE -The value to use in the ``code'' field of the @code{.stabs} directive -for a static variable located in the text section. DBX format does not -provide any ``right'' way to do this. The default is @code{N_FUN}. -@end defmac - -@defmac DBX_REGPARM_STABS_CODE -The value to use in the ``code'' field of the @code{.stabs} directive -for a parameter passed in registers. DBX format does not provide any -``right'' way to do this. The default is @code{N_RSYM}. -@end defmac - -@defmac DBX_REGPARM_STABS_LETTER -The letter to use in DBX symbol data to identify a symbol as a parameter -passed in registers. DBX format does not customarily provide any way to -do this. The default is @code{'P'}. -@end defmac - -@defmac DBX_FUNCTION_FIRST -Define this macro if the DBX information for a function and its -arguments should precede the assembler code for the function. Normally, -in DBX format, the debugging information entirely follows the assembler -code. -@end defmac - -@defmac DBX_BLOCKS_FUNCTION_RELATIVE -Define this macro, with value 1, if the value of a symbol describing -the scope of a block (@code{N_LBRAC} or @code{N_RBRAC}) should be -relative to the start of the enclosing function. Normally, GCC uses -an absolute address. -@end defmac - -@defmac DBX_LINES_FUNCTION_RELATIVE -Define this macro, with value 1, if the value of a symbol indicating -the current line number (@code{N_SLINE}) should be relative to the -start of the enclosing function. Normally, GCC uses an absolute address. -@end defmac - -@defmac DBX_USE_BINCL -Define this macro if GCC should generate @code{N_BINCL} and -@code{N_EINCL} stabs for included header files, as on Sun systems. This -macro also directs GCC to output a type number as a pair of a file -number and a type number within the file. Normally, GCC does not -generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single -number for a type number. -@end defmac - -@node DBX Hooks -@subsection Open-Ended Hooks for DBX Format - -@c prevent bad page break with this line -These are hooks for DBX format. - -@defmac DBX_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter}) -A C statement to output DBX debugging information before code for line -number @var{line} of the current source file to the stdio stream -@var{stream}. @var{counter} is the number of time the macro was -invoked, including the current invocation; it is intended to generate -unique labels in the assembly output. - -This macro should not be defined if the default output is correct, or -if it can be made correct by defining @code{DBX_LINES_FUNCTION_RELATIVE}. -@end defmac - -@defmac NO_DBX_FUNCTION_END -Some stabs encapsulation formats (in particular ECOFF), cannot handle the -@code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct. -On those machines, define this macro to turn this feature off without -disturbing the rest of the gdb extensions. -@end defmac - -@defmac NO_DBX_BNSYM_ENSYM -Some assemblers cannot handle the @code{.stabd BNSYM/ENSYM,0,0} gdb dbx -extension construct. On those machines, define this macro to turn this -feature off without disturbing the rest of the gdb extensions. -@end defmac - -@node File Names and DBX -@subsection File Names in DBX Format - -@c prevent bad page break with this line -This describes file names in DBX format. - -@defmac DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name}) -A C statement to output DBX debugging information to the stdio stream -@var{stream}, which indicates that file @var{name} is the main source -file---the file specified as the input file for compilation. -This macro is called only once, at the beginning of compilation. - -This macro need not be defined if the standard form of output -for DBX debugging information is appropriate. - -It may be necessary to refer to a label equal to the beginning of the -text section. You can use @samp{assemble_name (stream, ltext_label_name)} -to do so. If you do this, you must also set the variable -@var{used_ltext_label_name} to @code{true}. -@end defmac - -@defmac NO_DBX_MAIN_SOURCE_DIRECTORY -Define this macro, with value 1, if GCC should not emit an indication -of the current directory for compilation and current source language at -the beginning of the file. -@end defmac - -@defmac NO_DBX_GCC_MARKER -Define this macro, with value 1, if GCC should not emit an indication -that this object file was compiled by GCC@. The default is to emit -an @code{N_OPT} stab at the beginning of every source file, with -@samp{gcc2_compiled.} for the string and value 0. -@end defmac - -@defmac DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name}) -A C statement to output DBX debugging information at the end of -compilation of the main source file @var{name}. Output should be -written to the stdio stream @var{stream}. - -If you don't define this macro, nothing special is output at the end -of compilation, which is correct for most machines. -@end defmac - -@defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END -Define this macro @emph{instead of} defining -@code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at -the end of compilation is an @code{N_SO} stab with an empty string, -whose value is the highest absolute text address in the file. -@end defmac - -@need 2000 -@node SDB and DWARF -@subsection Macros for SDB and DWARF Output - -@c prevent bad page break with this line -Here are macros for SDB and DWARF output. - -@defmac SDB_DEBUGGING_INFO -Define this macro if GCC should produce COFF-style debugging output -for SDB in response to the @option{-g} option. -@end defmac - -@defmac DWARF2_DEBUGGING_INFO -Define this macro if GCC should produce dwarf version 2 format -debugging output in response to the @option{-g} option. - -@deftypefn {Target Hook} int TARGET_DWARF_CALLING_CONVENTION (const_tree @var{function}) -Define this to enable the dwarf attribute @code{DW_AT_calling_convention} to -be emitted for each function. Instead of an integer return the enum -value for the @code{DW_CC_} tag. -@end deftypefn - -To support optional call frame debugging information, you must also -define @code{INCOMING_RETURN_ADDR_RTX} and either set -@code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the -prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save} -as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't. -@end defmac - -@defmac DWARF2_FRAME_INFO -Define this macro to a nonzero value if GCC should always output -Dwarf 2 frame information. If @code{TARGET_EXCEPT_UNWIND_INFO} -(@pxref{Exception Region Output}) returns @code{UI_DWARF2}, and -exceptions are enabled, GCC will output this information not matter -how you define @code{DWARF2_FRAME_INFO}. -@end defmac - -@deftypefn {Target Hook} {enum unwind_info_type} TARGET_DEBUG_UNWIND_INFO (void) -This hook defines the mechanism that will be used for describing frame -unwind information to the debugger. Normally the hook will return -@code{UI_DWARF2} if DWARF 2 debug information is enabled, and -return @code{UI_NONE} otherwise. - -A target may return @code{UI_DWARF2} even when DWARF 2 debug information -is disabled in order to always output DWARF 2 frame information. - -A target may return @code{UI_TARGET} if it has ABI specified unwind tables. -This will suppress generation of the normal debug frame unwind information. -@end deftypefn - -@defmac DWARF2_ASM_LINE_DEBUG_INFO -Define this macro to be a nonzero value if the assembler can generate Dwarf 2 -line debug info sections. This will result in much more compact line number -tables, and hence is desirable if it works. -@end defmac - -@deftypevr {Target Hook} bool TARGET_WANT_DEBUG_PUB_SECTIONS -True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted. These sections are not used on most platforms, and in particular GDB does not use them. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_FORCE_AT_COMP_DIR -True if the @code{DW_AT_comp_dir} attribute should be emitted for each compilation unit. This attribute is required for the darwin linker to emit debug information. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_DELAY_SCHED2 -True if sched2 is not to be run at its normal place. -This usually means it will be run as part of machine-specific reorg. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_DELAY_VARTRACK -True if vartrack is not to be run at its normal place. -This usually means it will be run as part of machine-specific reorg. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_NO_REGISTER_ALLOCATION -True if register allocation and the passes -following it should not be run. Usually true only for virtual assembler -targets. -@end deftypevr - -@defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) -A C statement to issue assembly directives that create a difference -@var{lab1} minus @var{lab2}, using an integer of the given @var{size}. -@end defmac - -@defmac ASM_OUTPUT_DWARF_VMS_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) -A C statement to issue assembly directives that create a difference -between the two given labels in system defined units, e.g. instruction -slots on IA64 VMS, using an integer of the given size. -@end defmac - -@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section}) -A C statement to issue assembly directives that create a -section-relative reference to the given @var{label}, using an integer of the -given @var{size}. The label is known to be defined in the given @var{section}. -@end defmac - -@defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label}) -A C statement to issue assembly directives that create a self-relative -reference to the given @var{label}, using an integer of the given @var{size}. -@end defmac - -@defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label}) -A C statement to issue assembly directives that create a reference to -the DWARF table identifier @var{label} from the current section. This -is used on some systems to avoid garbage collecting a DWARF table which -is referenced by a function. -@end defmac - -@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{file}, int @var{size}, rtx @var{x}) -If defined, this target hook is a function which outputs a DTP-relative -reference to the given TLS symbol of the specified size. -@end deftypefn - -@defmac PUT_SDB_@dots{} -Define these macros to override the assembler syntax for the special -SDB assembler directives. See @file{sdbout.c} for a list of these -macros and their arguments. If the standard syntax is used, you need -not define them yourself. -@end defmac - -@defmac SDB_DELIM -Some assemblers do not support a semicolon as a delimiter, even between -SDB assembler directives. In that case, define this macro to be the -delimiter to use (usually @samp{\n}). It is not necessary to define -a new set of @code{PUT_SDB_@var{op}} macros if this is the only change -required. -@end defmac - -@defmac SDB_ALLOW_UNKNOWN_REFERENCES -Define this macro to allow references to unknown structure, -union, or enumeration tags to be emitted. Standard COFF does not -allow handling of unknown references, MIPS ECOFF has support for -it. -@end defmac - -@defmac SDB_ALLOW_FORWARD_REFERENCES -Define this macro to allow references to structure, union, or -enumeration tags that have not yet been seen to be handled. Some -assemblers choke if forward tags are used, while some require it. -@end defmac - -@defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}) -A C statement to output SDB debugging information before code for line -number @var{line} of the current source file to the stdio stream -@var{stream}. The default is to emit an @code{.ln} directive. -@end defmac - -@need 2000 -@node VMS Debug -@subsection Macros for VMS Debug Format - -@c prevent bad page break with this line -Here are macros for VMS debug format. - -@defmac VMS_DEBUGGING_INFO -Define this macro if GCC should produce debugging output for VMS -in response to the @option{-g} option. The default behavior for VMS -is to generate minimal debug info for a traceback in the absence of -@option{-g} unless explicitly overridden with @option{-g0}. This -behavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and -@code{TARGET_OPTION_OVERRIDE}. -@end defmac - -@node Floating Point -@section Cross Compilation and Floating Point -@cindex cross compilation and floating point -@cindex floating point and cross compilation - -While all modern machines use twos-complement representation for integers, -there are a variety of representations for floating point numbers. This -means that in a cross-compiler the representation of floating point numbers -in the compiled program may be different from that used in the machine -doing the compilation. - -Because different representation systems may offer different amounts of -range and precision, all floating point constants must be represented in -the target machine's format. Therefore, the cross compiler cannot -safely use the host machine's floating point arithmetic; it must emulate -the target's arithmetic. To ensure consistency, GCC always uses -emulation to work with floating point values, even when the host and -target floating point formats are identical. - -The following macros are provided by @file{real.h} for the compiler to -use. All parts of the compiler which generate or optimize -floating-point calculations must use these macros. They may evaluate -their operands more than once, so operands must not have side effects. - -@defmac REAL_VALUE_TYPE -The C data type to be used to hold a floating point value in the target -machine's format. Typically this is a @code{struct} containing an -array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque -quantity. -@end defmac - -@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y}) -Compares for equality the two values, @var{x} and @var{y}. If the target -floating point format supports negative zeroes and/or NaNs, -@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and -@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false. -@end deftypefn - -@deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y}) -Tests whether @var{x} is less than @var{y}. -@end deftypefn - -@deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x}) -Truncates @var{x} to a signed integer, rounding toward zero. -@end deftypefn - -@deftypefn Macro {unsigned HOST_WIDE_INT} REAL_VALUE_UNSIGNED_FIX (REAL_VALUE_TYPE @var{x}) -Truncates @var{x} to an unsigned integer, rounding toward zero. If -@var{x} is negative, returns zero. -@end deftypefn - -@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *@var{string}, machine_mode @var{mode}) -Converts @var{string} into a floating point number in the target machine's -representation for mode @var{mode}. This routine can handle both -decimal and hexadecimal floating point constants, using the syntax -defined by the C language for both. -@end deftypefn - -@deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x}) -Returns 1 if @var{x} is negative (including negative zero), 0 otherwise. -@end deftypefn - -@deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x}) -Determines whether @var{x} represents infinity (positive or negative). -@end deftypefn - -@deftypefn Macro int REAL_VALUE_ISNAN (REAL_VALUE_TYPE @var{x}) -Determines whether @var{x} represents a ``NaN'' (not-a-number). -@end deftypefn - -@deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y}) -Calculates an arithmetic operation on the two floating point values -@var{x} and @var{y}, storing the result in @var{output} (which must be a -variable). - -The operation to be performed is specified by @var{code}. Only the -following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR}, -@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}. - -If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the -target's floating point format cannot represent infinity, it will call -@code{abort}. Callers should check for this situation first, using -@code{MODE_HAS_INFINITIES}. @xref{Storage Layout}. -@end deftypefn - -@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x}) -Returns the negative of the floating point value @var{x}. -@end deftypefn - -@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x}) -Returns the absolute value of @var{x}. -@end deftypefn - -@node Mode Switching -@section Mode Switching Instructions -@cindex mode switching -The following macros control mode switching optimizations: - -@defmac OPTIMIZE_MODE_SWITCHING (@var{entity}) -Define this macro if the port needs extra instructions inserted for mode -switching in an optimizing compilation. - -For an example, the SH4 can perform both single and double precision -floating point operations, but to perform a single precision operation, -the FPSCR PR bit has to be cleared, while for a double precision -operation, this bit has to be set. Changing the PR bit requires a general -purpose register as a scratch register, hence these FPSCR sets have to -be inserted before reload, i.e.@: you can't put this into instruction emitting -or @code{TARGET_MACHINE_DEPENDENT_REORG}. - -You can have multiple entities that are mode-switched, and select at run time -which entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} should -return nonzero for any @var{entity} that needs mode-switching. -If you define this macro, you also have to define -@code{NUM_MODES_FOR_MODE_SWITCHING}, @code{TARGET_MODE_NEEDED}, -@code{TARGET_MODE_PRIORITY} and @code{TARGET_MODE_EMIT}. -@code{TARGET_MODE_AFTER}, @code{TARGET_MODE_ENTRY}, and @code{TARGET_MODE_EXIT} -are optional. -@end defmac - -@defmac NUM_MODES_FOR_MODE_SWITCHING -If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as -initializer for an array of integers. Each initializer element -N refers to an entity that needs mode switching, and specifies the number -of different modes that might need to be set for this entity. -The position of the initializer in the initializer---starting counting at -zero---determines the integer that is used to refer to the mode-switched -entity in question. -In macros that take mode arguments / yield a mode result, modes are -represented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no mode -switch is needed / supplied. -@end defmac - -@deftypefn {Target Hook} void TARGET_MODE_EMIT (int @var{entity}, int @var{mode}, int @var{prev_mode}, HARD_REG_SET @var{regs_live}) -Generate one or more insns to set @var{entity} to @var{mode}. @var{hard_reg_live} is the set of hard registers live at the point where the insn(s) are to be inserted. @var{prev_moxde} indicates the mode to switch from. Sets of a lower numbered entity will be emitted before sets of a higher numbered entity to a mode of the same or lower priority. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_MODE_NEEDED (int @var{entity}, rtx_insn *@var{insn}) -@var{entity} is an integer specifying a mode-switched entity. If @code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro to return an integer value not larger than the corresponding element in @code{NUM_MODES_FOR_MODE_SWITCHING}, to denote the mode that @var{entity} must be switched into prior to the execution of @var{insn}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_MODE_AFTER (int @var{entity}, int @var{mode}, rtx_insn *@var{insn}) -@var{entity} is an integer specifying a mode-switched entity. If this macro is defined, it is evaluated for every @var{insn} during mode switching. It determines the mode that an insn results in (if different from the incoming mode). -@end deftypefn - -@deftypefn {Target Hook} int TARGET_MODE_ENTRY (int @var{entity}) -If this macro is defined, it is evaluated for every @var{entity} that needs mode switching. It should evaluate to an integer, which is a mode that @var{entity} is assumed to be switched to at function entry. If @code{TARGET_MODE_ENTRY} is defined then @code{TARGET_MODE_EXIT} must be defined. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_MODE_EXIT (int @var{entity}) -If this macro is defined, it is evaluated for every @var{entity} that needs mode switching. It should evaluate to an integer, which is a mode that @var{entity} is assumed to be switched to at function exit. If @code{TARGET_MODE_EXIT} is defined then @code{TARGET_MODE_ENTRY} must be defined. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_MODE_PRIORITY (int @var{entity}, int @var{n}) -This macro specifies the order in which modes for @var{entity} are processed. 0 is the highest priority, @code{NUM_MODES_FOR_MODE_SWITCHING[@var{entity}] - 1} the lowest. The value of the macro should be an integer designating a mode for @var{entity}. For any fixed @var{entity}, @code{mode_priority} (@var{entity}, @var{n}) shall be a bijection in 0 @dots{} @code{num_modes_for_mode_switching[@var{entity}] - 1}. -@end deftypefn - -@node Target Attributes -@section Defining target-specific uses of @code{__attribute__} -@cindex target attributes -@cindex machine attributes -@cindex attributes, target-specific - -Target-specific attributes may be defined for functions, data and types. -These are described using the following target hooks; they also need to -be documented in @file{extend.texi}. - -@deftypevr {Target Hook} {const struct attribute_spec *} TARGET_ATTRIBUTE_TABLE -If defined, this target hook points to an array of @samp{struct -attribute_spec} (defined in @file{tree.h}) specifying the machine -specific attributes for this target and some of the restrictions on the -entities to which these attributes are applied and the arguments they -take. -@end deftypevr - -@deftypefn {Target Hook} bool TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P (const_tree @var{name}) -If defined, this target hook is a function which returns true if the -machine-specific attribute named @var{name} expects an identifier -given as its first argument to be passed on as a plain identifier, not -subjected to name lookup. If this is not defined, the default is -false for all machine-specific attributes. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (const_tree @var{type1}, const_tree @var{type2}) -If defined, this target hook is a function which returns zero if the attributes on -@var{type1} and @var{type2} are incompatible, one if they are compatible, -and two if they are nearly compatible (which causes a warning to be -generated). If this is not defined, machine-specific attributes are -supposed always to be compatible. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree @var{type}) -If defined, this target hook is a function which assigns default attributes to -the newly defined @var{type}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_MERGE_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2}) -Define this target hook if the merging of type attributes needs special -handling. If defined, the result is a list of the combined -@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed -that @code{comptypes} has already been called and returned 1. This -function may call @code{merge_attributes} to handle machine-independent -merging. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_MERGE_DECL_ATTRIBUTES (tree @var{olddecl}, tree @var{newdecl}) -Define this target hook if the merging of decl attributes needs special -handling. If defined, the result is a list of the combined -@code{DECL_ATTRIBUTES} of @var{olddecl} and @var{newdecl}. -@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of -when this is needed are when one attribute overrides another, or when an -attribute is nullified by a subsequent definition. This function may -call @code{merge_attributes} to handle machine-independent merging. - -@findex TARGET_DLLIMPORT_DECL_ATTRIBUTES -If the only target-specific handling you require is @samp{dllimport} -for Microsoft Windows targets, you should define the macro -@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES} to @code{1}. The compiler -will then define a function called -@code{merge_dllimport_decl_attributes} which can then be defined as -the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. You can also -add @code{handle_dll_attribute} in the attribute table for your port -to perform initial processing of the @samp{dllimport} and -@samp{dllexport} attributes. This is done in @file{i386/cygwin.h} and -@file{i386/i386.c}, for example. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_VALID_DLLIMPORT_ATTRIBUTE_P (const_tree @var{decl}) -@var{decl} is a variable or function with @code{__attribute__((dllimport))} specified. Use this hook if the target needs to add extra validation checks to @code{handle_dll_attribute}. -@end deftypefn - -@defmac TARGET_DECLSPEC -Define this macro to a nonzero value if you want to treat -@code{__declspec(X)} as equivalent to @code{__attribute((X))}. By -default, this behavior is enabled only for targets that define -@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementation -of @code{__declspec} is via a built-in macro, but you should not rely -on this implementation detail. -@end defmac - -@deftypefn {Target Hook} void TARGET_INSERT_ATTRIBUTES (tree @var{node}, tree *@var{attr_ptr}) -Define this target hook if you want to be able to add attributes to a decl -when it is being created. This is normally useful for back ends which -wish to implement a pragma by using the attributes which correspond to -the pragma's effect. The @var{node} argument is the decl which is being -created. The @var{attr_ptr} argument is a pointer to the attribute list -for this decl. The list itself should not be modified, since it may be -shared with other decls, but attributes may be chained on the head of -the list and @code{*@var{attr_ptr}} modified to point to the new -attributes, or a copy of the list may be made if further changes are -needed. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P (const_tree @var{fndecl}) -@cindex inlining -This target hook returns @code{true} if it is OK to inline @var{fndecl} -into the current function, despite its having target-specific -attributes, @code{false} otherwise. By default, if a function has a -target specific attribute attached to it, it will not be inlined. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_OPTION_VALID_ATTRIBUTE_P (tree @var{fndecl}, tree @var{name}, tree @var{args}, int @var{flags}) -This hook is called to parse @code{attribute(target("..."))}, which -allows setting target-specific options on individual functions. -These function-specific options may differ -from the options specified on the command line. The hook should return -@code{true} if the options are valid. - -The hook should set the @code{DECL_FUNCTION_SPECIFIC_TARGET} field in -the function declaration to hold a pointer to a target-specific -@code{struct cl_target_option} structure. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OPTION_SAVE (struct cl_target_option *@var{ptr}, struct gcc_options *@var{opts}) -This hook is called to save any additional target-specific information -in the @code{struct cl_target_option} structure for function-specific -options from the @code{struct gcc_options} structure. -@xref{Option file format}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OPTION_RESTORE (struct gcc_options *@var{opts}, struct cl_target_option *@var{ptr}) -This hook is called to restore any additional target-specific -information in the @code{struct cl_target_option} structure for -function-specific options to the @code{struct gcc_options} structure. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OPTION_POST_STREAM_IN (struct cl_target_option *@var{ptr}) -This hook is called to update target-specific information in the -@code{struct cl_target_option} structure after it is streamed in from -LTO bytecode. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OPTION_PRINT (FILE *@var{file}, int @var{indent}, struct cl_target_option *@var{ptr}) -This hook is called to print any additional target-specific -information in the @code{struct cl_target_option} structure for -function-specific options. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_OPTION_PRAGMA_PARSE (tree @var{args}, tree @var{pop_target}) -This target hook parses the options for @code{#pragma GCC target}, which -sets the target-specific options for functions that occur later in the -input stream. The options accepted should be the same as those handled by the -@code{TARGET_OPTION_VALID_ATTRIBUTE_P} hook. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_OPTION_OVERRIDE (void) -Sometimes certain combinations of command options do not make sense on -a particular target machine. You can override the hook -@code{TARGET_OPTION_OVERRIDE} to take account of this. This hooks is called -once just after all the command options have been parsed. - -Don't use this hook to turn on various extra optimizations for -@option{-O}. That is what @code{TARGET_OPTION_OPTIMIZATION} is for. - -If you need to do something whenever the optimization level is -changed via the optimize attribute or pragma, see -@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE} -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_OPTION_FUNCTION_VERSIONS (tree @var{decl1}, tree @var{decl2}) -This target hook returns @code{true} if @var{DECL1} and @var{DECL2} are -versions of the same function. @var{DECL1} and @var{DECL2} are function -versions if and only if they have the same function signature and -different target specific attributes, that is, they are compiled for -different target machines. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee}) -This target hook returns @code{false} if the @var{caller} function -cannot inline @var{callee}, based on target specific information. By -default, inlining is not allowed if the callee function has function -specific target options and the caller does not use the same options. -@end deftypefn - -@node Emulated TLS -@section Emulating TLS -@cindex Emulated TLS - -For targets whose psABI does not provide Thread Local Storage via -specific relocations and instruction sequences, an emulation layer is -used. A set of target hooks allows this emulation layer to be -configured for the requirements of a particular target. For instance -the psABI may in fact specify TLS support in terms of an emulation -layer. - -The emulation layer works by creating a control object for every TLS -object. To access the TLS object, a lookup function is provided -which, when given the address of the control object, will return the -address of the current thread's instance of the TLS object. - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_GET_ADDRESS -Contains the name of the helper function that uses a TLS control -object to locate a TLS instance. The default causes libgcc's -emulated TLS helper function to be used. -@end deftypevr - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_REGISTER_COMMON -Contains the name of the helper function that should be used at -program startup to register TLS objects that are implicitly -initialized to zero. If this is @code{NULL}, all TLS objects will -have explicit initializers. The default causes libgcc's emulated TLS -registration function to be used. -@end deftypevr - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_VAR_SECTION -Contains the name of the section in which TLS control variables should -be placed. The default of @code{NULL} allows these to be placed in -any section. -@end deftypevr - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_TMPL_SECTION -Contains the name of the section in which TLS initializers should be -placed. The default of @code{NULL} allows these to be placed in any -section. -@end deftypevr - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_VAR_PREFIX -Contains the prefix to be prepended to TLS control variable names. -The default of @code{NULL} uses a target-specific prefix. -@end deftypevr - -@deftypevr {Target Hook} {const char *} TARGET_EMUTLS_TMPL_PREFIX -Contains the prefix to be prepended to TLS initializer objects. The -default of @code{NULL} uses a target-specific prefix. -@end deftypevr - -@deftypefn {Target Hook} tree TARGET_EMUTLS_VAR_FIELDS (tree @var{type}, tree *@var{name}) -Specifies a function that generates the FIELD_DECLs for a TLS control -object type. @var{type} is the RECORD_TYPE the fields are for and -@var{name} should be filled with the structure tag, if the default of -@code{__emutls_object} is unsuitable. The default creates a type suitable -for libgcc's emulated TLS function. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_EMUTLS_VAR_INIT (tree @var{var}, tree @var{decl}, tree @var{tmpl_addr}) -Specifies a function that generates the CONSTRUCTOR to initialize a -TLS control object. @var{var} is the TLS control object, @var{decl} -is the TLS object and @var{tmpl_addr} is the address of the -initializer. The default initializes libgcc's emulated TLS control object. -@end deftypefn - -@deftypevr {Target Hook} bool TARGET_EMUTLS_VAR_ALIGN_FIXED -Specifies whether the alignment of TLS control variable objects is -fixed and should not be increased as some backends may do to optimize -single objects. The default is false. -@end deftypevr - -@deftypevr {Target Hook} bool TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS -Specifies whether a DWARF @code{DW_OP_form_tls_address} location descriptor -may be used to describe emulated TLS control objects. -@end deftypevr - -@node MIPS Coprocessors -@section Defining coprocessor specifics for MIPS targets. -@cindex MIPS coprocessor-definition macros - -The MIPS specification allows MIPS implementations to have as many as 4 -coprocessors, each with as many as 32 private registers. GCC supports -accessing these registers and transferring values between the registers -and memory using asm-ized variables. For example: - -@smallexample - register unsigned int cp0count asm ("c0r1"); - unsigned int d; - - d = cp0count + 3; -@end smallexample - -(``c0r1'' is the default name of register 1 in coprocessor 0; alternate -names may be added as described below, or the default names may be -overridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.) - -Coprocessor registers are assumed to be epilogue-used; sets to them will -be preserved even if it does not appear that the register is used again -later in the function. - -Another note: according to the MIPS spec, coprocessor 1 (if present) is -the FPU@. One accesses COP1 registers through standard mips -floating-point support; they are not included in this mechanism. - -@node PCH Target -@section Parameters for Precompiled Header Validity Checking -@cindex parameters, precompiled headers - -@deftypefn {Target Hook} {void *} TARGET_GET_PCH_VALIDITY (size_t *@var{sz}) -This hook returns a pointer to the data needed by -@code{TARGET_PCH_VALID_P} and sets -@samp{*@var{sz}} to the size of the data in bytes. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_PCH_VALID_P (const void *@var{data}, size_t @var{sz}) -This hook checks whether the options used to create a PCH file are -compatible with the current settings. It returns @code{NULL} -if so and a suitable error message if not. Error messages will -be presented to the user and must be localized using @samp{_(@var{msg})}. - -@var{data} is the data that was returned by @code{TARGET_GET_PCH_VALIDITY} -when the PCH file was created and @var{sz} is the size of that data in bytes. -It's safe to assume that the data was created by the same version of the -compiler, so no format checking is needed. - -The default definition of @code{default_pch_valid_p} should be -suitable for most targets. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_CHECK_PCH_TARGET_FLAGS (int @var{pch_flags}) -If this hook is nonnull, the default implementation of -@code{TARGET_PCH_VALID_P} will use it to check for compatible values -of @code{target_flags}. @var{pch_flags} specifies the value that -@code{target_flags} had when the PCH file was created. The return -value is the same as for @code{TARGET_PCH_VALID_P}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_PREPARE_PCH_SAVE (void) -Called before writing out a PCH file. If the target has some -garbage-collected data that needs to be in a particular state on PCH loads, -it can use this hook to enforce that state. Very few targets need -to do anything here. -@end deftypefn - -@node C++ ABI -@section C++ ABI parameters -@cindex parameters, c++ abi - -@deftypefn {Target Hook} tree TARGET_CXX_GUARD_TYPE (void) -Define this hook to override the integer type used for guard variables. -These are used to implement one-time construction of static objects. The -default is long_long_integer_type_node. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_GUARD_MASK_BIT (void) -This hook determines how guard variables are used. It should return -@code{false} (the default) if the first byte should be used. A return value of -@code{true} indicates that only the least significant bit should be used. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_CXX_GET_COOKIE_SIZE (tree @var{type}) -This hook returns the size of the cookie to use when allocating an array -whose elements have the indicated @var{type}. Assumes that it is already -known that a cookie is needed. The default is -@code{max(sizeof (size_t), alignof(type))}, as defined in section 2.7 of the -IA64/Generic C++ ABI@. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_COOKIE_HAS_SIZE (void) -This hook should return @code{true} if the element size should be stored in -array cookies. The default is to return @code{false}. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree @var{type}, int @var{import_export}) -If defined by a backend this hook allows the decision made to export -class @var{type} to be overruled. Upon entry @var{import_export} -will contain 1 if the class is going to be exported, @minus{}1 if it is going -to be imported and 0 otherwise. This function should return the -modified value and perform any other actions necessary to support the -backend's targeted operating system. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_CDTOR_RETURNS_THIS (void) -This hook should return @code{true} if constructors and destructors return -the address of the object created/destroyed. The default is to return -@code{false}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_KEY_METHOD_MAY_BE_INLINE (void) -This hook returns true if the key method for a class (i.e., the method -which, if defined in the current translation unit, causes the virtual -table to be emitted) may be an inline function. Under the standard -Itanium C++ ABI the key method may be an inline function so long as -the function is not declared inline in the class definition. Under -some variants of the ABI, an inline function can never be the key -method. The default is to return @code{true}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY (tree @var{decl}) -@var{decl} is a virtual table, virtual table table, typeinfo object, or other similar implicit class data object that will be emitted with external linkage in this translation unit. No ELF visibility has been explicitly specified. If the target needs to specify a visibility other than that of the containing class, use this hook to set @code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT (void) -This hook returns true (the default) if virtual tables and other -similar implicit class data objects are always COMDAT if they have -external linkage. If this hook returns false, then class data for -classes whose virtual table will be emitted in only one translation -unit will not be COMDAT. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_LIBRARY_RTTI_COMDAT (void) -This hook returns true (the default) if the RTTI information for -the basic types which is defined in the C++ runtime should always -be COMDAT, false if it should not be COMDAT. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_USE_AEABI_ATEXIT (void) -This hook returns true if @code{__aeabi_atexit} (as defined by the ARM EABI) -should be used to register static destructors when @option{-fuse-cxa-atexit} -is in effect. The default is to return false to use @code{__cxa_atexit}. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT (void) -This hook returns true if the target @code{atexit} function can be used -in the same manner as @code{__cxa_atexit} to register C++ static -destructors. This requires that @code{atexit}-registered functions in -shared libraries are run in the correct order when the libraries are -unloaded. The default is to return false. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_CXX_ADJUST_CLASS_AT_DEFINITION (tree @var{type}) -@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been defined. Use this hook to make adjustments to the class (eg, tweak visibility or perform any other required target modifications). -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_CXX_DECL_MANGLING_CONTEXT (const_tree @var{decl}) -Return target-specific mangling context of @var{decl} or @code{NULL_TREE}. -@end deftypefn - -@node Named Address Spaces -@section Adding support for named address spaces -@cindex named address spaces - -The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275 -standards committee, @cite{Programming Languages - C - Extensions to -support embedded processors}, specifies a syntax for embedded -processors to specify alternate address spaces. You can configure a -GCC port to support section 5.1 of the draft report to add support for -address spaces other than the default address space. These address -spaces are new keywords that are similar to the @code{volatile} and -@code{const} type attributes. - -Pointers to named address spaces can have a different size than -pointers to the generic address space. - -For example, the SPU port uses the @code{__ea} address space to refer -to memory in the host processor, rather than memory local to the SPU -processor. Access to memory in the @code{__ea} address space involves -issuing DMA operations to move data between the host processor and the -local processor memory address space. Pointers in the @code{__ea} -address space are either 32 bits or 64 bits based on the -@option{-mea32} or @option{-mea64} switches (native SPU pointers are -always 32 bits). - -Internally, address spaces are represented as a small integer in the -range 0 to 15 with address space 0 being reserved for the generic -address space. - -To register a named address space qualifier keyword with the C front end, -the target may call the @code{c_register_addr_space} routine. For example, -the SPU port uses the following to declare @code{__ea} as the keyword for -named address space #1: -@smallexample -#define ADDR_SPACE_EA 1 -c_register_addr_space ("__ea", ADDR_SPACE_EA); -@end smallexample - -@deftypefn {Target Hook} machine_mode TARGET_ADDR_SPACE_POINTER_MODE (addr_space_t @var{address_space}) -Define this to return the machine mode to use for pointers to -@var{address_space} if the target supports named address spaces. -The default version of this hook returns @code{ptr_mode} for the -generic address space only. -@end deftypefn - -@deftypefn {Target Hook} machine_mode TARGET_ADDR_SPACE_ADDRESS_MODE (addr_space_t @var{address_space}) -Define this to return the machine mode to use for addresses in -@var{address_space} if the target supports named address spaces. -The default version of this hook returns @code{Pmode} for the -generic address space only. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ADDR_SPACE_VALID_POINTER_MODE (machine_mode @var{mode}, addr_space_t @var{as}) -Define this to return nonzero if the port can handle pointers -with machine mode @var{mode} to address space @var{as}. This target -hook is the same as the @code{TARGET_VALID_POINTER_MODE} target hook, -except that it includes explicit named address space support. The default -version of this hook returns true for the modes returned by either the -@code{TARGET_ADDR_SPACE_POINTER_MODE} or @code{TARGET_ADDR_SPACE_ADDRESS_MODE} -target hooks for the given address space. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P (machine_mode @var{mode}, rtx @var{exp}, bool @var{strict}, addr_space_t @var{as}) -Define this to return true if @var{exp} is a valid address for mode -@var{mode} in the named address space @var{as}. The @var{strict} -parameter says whether strict addressing is in effect after reload has -finished. This target hook is the same as the -@code{TARGET_LEGITIMATE_ADDRESS_P} target hook, except that it includes -explicit named address space support. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS (rtx @var{x}, rtx @var{oldx}, machine_mode @var{mode}, addr_space_t @var{as}) -Define this to modify an invalid address @var{x} to be a valid address -with mode @var{mode} in the named address space @var{as}. This target -hook is the same as the @code{TARGET_LEGITIMIZE_ADDRESS} target hook, -except that it includes explicit named address space support. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ADDR_SPACE_SUBSET_P (addr_space_t @var{subset}, addr_space_t @var{superset}) -Define this to return whether the @var{subset} named address space is -contained within the @var{superset} named address space. Pointers to -a named address space that is a subset of another named address space -will be converted automatically without a cast if used together in -arithmetic operations. Pointers to a superset address space can be -converted to pointers to a subset address space via explicit casts. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_ADDR_SPACE_CONVERT (rtx @var{op}, tree @var{from_type}, tree @var{to_type}) -Define this to convert the pointer expression represented by the RTL -@var{op} with type @var{from_type} that points to a named address -space to a new pointer expression with type @var{to_type} that points -to a different named address space. When this hook it called, it is -guaranteed that one of the two address spaces is a subset of the other, -as determined by the @code{TARGET_ADDR_SPACE_SUBSET_P} target hook. -@end deftypefn - -@node Misc -@section Miscellaneous Parameters -@cindex parameters, miscellaneous - -@c prevent bad page break with this line -Here are several miscellaneous parameters. - -@defmac HAS_LONG_COND_BRANCH -Define this boolean macro to indicate whether or not your architecture -has conditional branches that can span all of memory. It is used in -conjunction with an optimization that partitions hot and cold basic -blocks into separate sections of the executable. If this macro is -set to false, gcc will convert any conditional branches that attempt -to cross between sections into unconditional branches or indirect jumps. -@end defmac - -@defmac HAS_LONG_UNCOND_BRANCH -Define this boolean macro to indicate whether or not your architecture -has unconditional branches that can span all of memory. It is used in -conjunction with an optimization that partitions hot and cold basic -blocks into separate sections of the executable. If this macro is -set to false, gcc will convert any unconditional branches that attempt -to cross between sections into indirect jumps. -@end defmac - -@defmac CASE_VECTOR_MODE -An alias for a machine mode name. This is the machine mode that -elements of a jump-table should have. -@end defmac - -@defmac CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body}) -Optional: return the preferred mode for an @code{addr_diff_vec} -when the minimum and maximum offset are known. If you define this, -it enables extra code in branch shortening to deal with @code{addr_diff_vec}. -To make this work, you also have to define @code{INSN_ALIGN} and -make the alignment for @code{addr_diff_vec} explicit. -The @var{body} argument is provided so that the offset_unsigned and scale -flags can be updated. -@end defmac - -@defmac CASE_VECTOR_PC_RELATIVE -Define this macro to be a C expression to indicate when jump-tables -should contain relative addresses. You need not define this macro if -jump-tables never contain relative addresses, or jump-tables should -contain relative addresses only when @option{-fPIC} or @option{-fPIC} -is in effect. -@end defmac - -@deftypefn {Target Hook} {unsigned int} TARGET_CASE_VALUES_THRESHOLD (void) -This function return the smallest number of different values for which it -is best to use a jump-table instead of a tree of conditional branches. -The default is four for machines with a @code{casesi} instruction and -five otherwise. This is best for most machines. -@end deftypefn - -@defmac WORD_REGISTER_OPERATIONS -Define this macro if operations between registers with integral mode -smaller than a word are always performed on the entire register. -Most RISC machines have this property and most CISC machines do not. -@end defmac - -@defmac LOAD_EXTEND_OP (@var{mem_mode}) -Define this macro to be a C expression indicating when insns that read -memory in @var{mem_mode}, an integral mode narrower than a word, set the -bits outside of @var{mem_mode} to be either the sign-extension or the -zero-extension of the data read. Return @code{SIGN_EXTEND} for values -of @var{mem_mode} for which the -insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and -@code{UNKNOWN} for other modes. - -This macro is not called with @var{mem_mode} non-integral or with a width -greater than or equal to @code{BITS_PER_WORD}, so you may return any -value in this case. Do not define this macro if it would always return -@code{UNKNOWN}. On machines where this macro is defined, you will normally -define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}. - -You may return a non-@code{UNKNOWN} value even if for some hard registers -the sign extension is not performed, if for the @code{REGNO_REG_CLASS} -of these hard registers @code{CANNOT_CHANGE_MODE_CLASS} returns nonzero -when the @var{from} mode is @var{mem_mode} and the @var{to} mode is any -integral mode larger than this but not larger than @code{word_mode}. - -You must return @code{UNKNOWN} if for some hard registers that allow this -mode, @code{CANNOT_CHANGE_MODE_CLASS} says that they cannot change to -@code{word_mode}, but that they can change to another integral mode that -is larger then @var{mem_mode} but still smaller than @code{word_mode}. -@end defmac - -@defmac SHORT_IMMEDIATES_SIGN_EXTEND -Define this macro if loading short immediate values into registers sign -extends. -@end defmac - -@deftypefn {Target Hook} {unsigned int} TARGET_MIN_DIVISIONS_FOR_RECIP_MUL (machine_mode @var{mode}) -When @option{-ffast-math} is in effect, GCC tries to optimize -divisions by the same divisor, by turning them into multiplications by -the reciprocal. This target hook specifies the minimum number of divisions -that should be there for GCC to perform the optimization for a variable -of mode @var{mode}. The default implementation returns 3 if the machine -has an instruction for the division, and 2 if it does not. -@end deftypefn - -@defmac MOVE_MAX -The maximum number of bytes that a single instruction can move quickly -between memory and registers or between two memory locations. -@end defmac - -@defmac MAX_MOVE_MAX -The maximum number of bytes that a single instruction can move quickly -between memory and registers or between two memory locations. If this -is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the -constant value that is the largest value that @code{MOVE_MAX} can have -at run-time. -@end defmac - -@defmac SHIFT_COUNT_TRUNCATED -A C expression that is nonzero if on this machine the number of bits -actually used for the count of a shift operation is equal to the number -of bits needed to represent the size of the object being shifted. When -this macro is nonzero, the compiler will assume that it is safe to omit -a sign-extend, zero-extend, and certain bitwise `and' instructions that -truncates the count of a shift operation. On machines that have -instructions that act on bit-fields at variable positions, which may -include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED} -also enables deletion of truncations of the values that serve as -arguments to bit-field instructions. - -If both types of instructions truncate the count (for shifts) and -position (for bit-field operations), or if no variable-position bit-field -instructions exist, you should define this macro. - -However, on some machines, such as the 80386 and the 680x0, truncation -only applies to shift operations and not the (real or pretended) -bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on -such machines. Instead, add patterns to the @file{md} file that include -the implied truncation of the shift instructions. - -You need not define this macro if it would always have the value of zero. -@end defmac - -@anchor{TARGET_SHIFT_TRUNCATION_MASK} -@deftypefn {Target Hook} {unsigned HOST_WIDE_INT} TARGET_SHIFT_TRUNCATION_MASK (machine_mode @var{mode}) -This function describes how the standard shift patterns for @var{mode} -deal with shifts by negative amounts or by more than the width of the mode. -@xref{shift patterns}. - -On many machines, the shift patterns will apply a mask @var{m} to the -shift count, meaning that a fixed-width shift of @var{x} by @var{y} is -equivalent to an arbitrary-width shift of @var{x} by @var{y & m}. If -this is true for mode @var{mode}, the function should return @var{m}, -otherwise it should return 0. A return value of 0 indicates that no -particular behavior is guaranteed. - -Note that, unlike @code{SHIFT_COUNT_TRUNCATED}, this function does -@emph{not} apply to general shift rtxes; it applies only to instructions -that are generated by the named shift patterns. - -The default implementation of this function returns -@code{GET_MODE_BITSIZE (@var{mode}) - 1} if @code{SHIFT_COUNT_TRUNCATED} -and 0 otherwise. This definition is always safe, but if -@code{SHIFT_COUNT_TRUNCATED} is false, and some shift patterns -nevertheless truncate the shift count, you may get better code -by overriding it. -@end deftypefn - -@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec}) -A C expression which is nonzero if on this machine it is safe to -``convert'' an integer of @var{inprec} bits to one of @var{outprec} -bits (where @var{outprec} is smaller than @var{inprec}) by merely -operating on it as if it had only @var{outprec} bits. - -On many machines, this expression can be 1. - -@c rearranged this, removed the phrase "it is reported that". this was -@c to fix an overfull hbox. --mew 10feb93 -When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for -modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result. -If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in -such cases may improve things. -@end defmac - -@deftypefn {Target Hook} int TARGET_MODE_REP_EXTENDED (machine_mode @var{mode}, machine_mode @var{rep_mode}) -The representation of an integral mode can be such that the values -are always extended to a wider integral mode. Return -@code{SIGN_EXTEND} if values of @var{mode} are represented in -sign-extended form to @var{rep_mode}. Return @code{UNKNOWN} -otherwise. (Currently, none of the targets use zero-extended -representation this way so unlike @code{LOAD_EXTEND_OP}, -@code{TARGET_MODE_REP_EXTENDED} is expected to return either -@code{SIGN_EXTEND} or @code{UNKNOWN}. Also no target extends -@var{mode} to @var{rep_mode} so that @var{rep_mode} is not the next -widest integral mode and currently we take advantage of this fact.) - -Similarly to @code{LOAD_EXTEND_OP} you may return a non-@code{UNKNOWN} -value even if the extension is not performed on certain hard registers -as long as for the @code{REGNO_REG_CLASS} of these hard registers -@code{CANNOT_CHANGE_MODE_CLASS} returns nonzero. - -Note that @code{TARGET_MODE_REP_EXTENDED} and @code{LOAD_EXTEND_OP} -describe two related properties. If you define -@code{TARGET_MODE_REP_EXTENDED (mode, word_mode)} you probably also want -to define @code{LOAD_EXTEND_OP (mode)} to return the same type of -extension. - -In order to enforce the representation of @code{mode}, -@code{TRULY_NOOP_TRUNCATION} should return false when truncating to -@code{mode}. -@end deftypefn - -@defmac STORE_FLAG_VALUE -A C expression describing the value returned by a comparison operator -with an integral mode and stored by a store-flag instruction -(@samp{cstore@var{mode}4}) when the condition is true. This description must -apply to @emph{all} the @samp{cstore@var{mode}4} patterns and all the -comparison operators whose results have a @code{MODE_INT} mode. - -A value of 1 or @minus{}1 means that the instruction implementing the -comparison operator returns exactly 1 or @minus{}1 when the comparison is true -and 0 when the comparison is false. Otherwise, the value indicates -which bits of the result are guaranteed to be 1 when the comparison is -true. This value is interpreted in the mode of the comparison -operation, which is given by the mode of the first operand in the -@samp{cstore@var{mode}4} pattern. Either the low bit or the sign bit of -@code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by -the compiler. - -If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will -generate code that depends only on the specified bits. It can also -replace comparison operators with equivalent operations if they cause -the required bits to be set, even if the remaining bits are undefined. -For example, on a machine whose comparison operators return an -@code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as -@samp{0x80000000}, saying that just the sign bit is relevant, the -expression - -@smallexample -(ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0)) -@end smallexample - -@noindent -can be converted to - -@smallexample -(ashift:SI @var{x} (const_int @var{n})) -@end smallexample - -@noindent -where @var{n} is the appropriate shift count to move the bit being -tested into the sign bit. - -There is no way to describe a machine that always sets the low-order bit -for a true value, but does not guarantee the value of any other bits, -but we do not know of any machine that has such an instruction. If you -are trying to port GCC to such a machine, include an instruction to -perform a logical-and of the result with 1 in the pattern for the -comparison operators and let us know at @email{gcc@@gcc.gnu.org}. - -Often, a machine will have multiple instructions that obtain a value -from a comparison (or the condition codes). Here are rules to guide the -choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions -to be used: - -@itemize @bullet -@item -Use the shortest sequence that yields a valid definition for -@code{STORE_FLAG_VALUE}. It is more efficient for the compiler to -``normalize'' the value (convert it to, e.g., 1 or 0) than for the -comparison operators to do so because there may be opportunities to -combine the normalization with other operations. - -@item -For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being -slightly preferred on machines with expensive jumps and 1 preferred on -other machines. - -@item -As a second choice, choose a value of @samp{0x80000001} if instructions -exist that set both the sign and low-order bits but do not define the -others. - -@item -Otherwise, use a value of @samp{0x80000000}. -@end itemize - -Many machines can produce both the value chosen for -@code{STORE_FLAG_VALUE} and its negation in the same number of -instructions. On those machines, you should also define a pattern for -those cases, e.g., one matching - -@smallexample -(set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C}))) -@end smallexample - -Some machines can also perform @code{and} or @code{plus} operations on -condition code values with less instructions than the corresponding -@samp{cstore@var{mode}4} insn followed by @code{and} or @code{plus}. On those -machines, define the appropriate patterns. Use the names @code{incscc} -and @code{decscc}, respectively, for the patterns which perform -@code{plus} or @code{minus} operations on condition code values. See -@file{rs6000.md} for some examples. The GNU Superoptimizer can be used to -find such instruction sequences on other machines. - -If this macro is not defined, the default value, 1, is used. You need -not define @code{STORE_FLAG_VALUE} if the machine has no store-flag -instructions, or if the value generated by these instructions is 1. -@end defmac - -@defmac FLOAT_STORE_FLAG_VALUE (@var{mode}) -A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is -returned when comparison operators with floating-point results are true. -Define this macro on machines that have comparison operations that return -floating-point values. If there are no such operations, do not define -this macro. -@end defmac - -@defmac VECTOR_STORE_FLAG_VALUE (@var{mode}) -A C expression that gives a rtx representing the nonzero true element -for vector comparisons. The returned rtx should be valid for the inner -mode of @var{mode} which is guaranteed to be a vector mode. Define -this macro on machines that have vector comparison operations that -return a vector result. If there are no such operations, do not define -this macro. Typically, this macro is defined as @code{const1_rtx} or -@code{constm1_rtx}. This macro may return @code{NULL_RTX} to prevent -the compiler optimizing such vector comparison operations for the -given mode. -@end defmac - -@defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value}) -@defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value}) -A C expression that indicates whether the architecture defines a value -for @code{clz} or @code{ctz} with a zero operand. -A result of @code{0} indicates the value is undefined. -If the value is defined for only the RTL expression, the macro should -evaluate to @code{1}; if the value applies also to the corresponding optab -entry (which is normally the case if it expands directly into -the corresponding RTL), then the macro should evaluate to @code{2}. -In the cases where the value is defined, @var{value} should be set to -this value. - -If this macro is not defined, the value of @code{clz} or -@code{ctz} at zero is assumed to be undefined. - -This macro must be defined if the target's expansion for @code{ffs} -relies on a particular value to get correct results. Otherwise it -is not necessary, though it may be used to optimize some corner cases, and -to provide a default expansion for the @code{ffs} optab. - -Note that regardless of this macro the ``definedness'' of @code{clz} -and @code{ctz} at zero do @emph{not} extend to the builtin functions -visible to the user. Thus one may be free to adjust the value at will -to match the target expansion of these operations without fear of -breaking the API@. -@end defmac - -@defmac Pmode -An alias for the machine mode for pointers. On most machines, define -this to be the integer mode corresponding to the width of a hardware -pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines. -On some machines you must define this to be one of the partial integer -modes, such as @code{PSImode}. - -The width of @code{Pmode} must be at least as large as the value of -@code{POINTER_SIZE}. If it is not equal, you must define the macro -@code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended -to @code{Pmode}. -@end defmac - -@defmac FUNCTION_MODE -An alias for the machine mode used for memory references to functions -being called, in @code{call} RTL expressions. On most CISC machines, -where an instruction can begin at any byte address, this should be -@code{QImode}. On most RISC machines, where all instructions have fixed -size and alignment, this should be a mode with the same size and alignment -as the machine instruction words - typically @code{SImode} or @code{HImode}. -@end defmac - -@defmac STDC_0_IN_SYSTEM_HEADERS -In normal operation, the preprocessor expands @code{__STDC__} to the -constant 1, to signify that GCC conforms to ISO Standard C@. On some -hosts, like Solaris, the system compiler uses a different convention, -where @code{__STDC__} is normally 0, but is 1 if the user specifies -strict conformance to the C Standard. - -Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host -convention when processing system header files, but when processing user -files @code{__STDC__} will always expand to 1. -@end defmac - -@deftypefn {C Target Hook} {const char *} TARGET_C_PREINCLUDE (void) -Define this hook to return the name of a header file to be included at the start of all compilations, as if it had been included with @code{#include <@var{file}>}. If this hook returns @code{NULL}, or is not defined, or the header is not found, or if the user specifies @option{-ffreestanding} or @option{-nostdinc}, no header is included. - - This hook can be used together with a header provided by the system C library to implement ISO C requirements for certain macros to be predefined that describe properties of the whole implementation rather than just the compiler. -@end deftypefn - -@deftypefn {C Target Hook} bool TARGET_CXX_IMPLICIT_EXTERN_C (const char*@var{}) -Define this hook to add target-specific C++ implicit extern C functions. If this function returns true for the name of a file-scope function, that function implicitly gets extern "C" linkage rather than whatever language linkage the declaration would normally have. An example of such function is WinMain on Win32 targets. -@end deftypefn - -@defmac NO_IMPLICIT_EXTERN_C -Define this macro if the system header files support C++ as well as C@. -This macro inhibits the usual method of using system header files in -C++, which is to pretend that the file's contents are enclosed in -@samp{extern "C" @{@dots{}@}}. -@end defmac - -@findex #pragma -@findex pragma -@defmac REGISTER_TARGET_PRAGMAS () -Define this macro if you want to implement any target-specific pragmas. -If defined, it is a C expression which makes a series of calls to -@code{c_register_pragma} or @code{c_register_pragma_with_expansion} -for each pragma. The macro may also do any -setup required for the pragmas. - -The primary reason to define this macro is to provide compatibility with -other compilers for the same target. In general, we discourage -definition of target-specific pragmas for GCC@. - -If the pragma can be implemented by attributes then you should consider -defining the target hook @samp{TARGET_INSERT_ATTRIBUTES} as well. - -Preprocessor macros that appear on pragma lines are not expanded. All -@samp{#pragma} directives that do not match any registered pragma are -silently ignored, unless the user specifies @option{-Wunknown-pragmas}. -@end defmac - -@deftypefun void c_register_pragma (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *)) -@deftypefunx void c_register_pragma_with_expansion (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *)) - -Each call to @code{c_register_pragma} or -@code{c_register_pragma_with_expansion} establishes one pragma. The -@var{callback} routine will be called when the preprocessor encounters a -pragma of the form - -@smallexample -#pragma [@var{space}] @var{name} @dots{} -@end smallexample - -@var{space} is the case-sensitive namespace of the pragma, or -@code{NULL} to put the pragma in the global namespace. The callback -routine receives @var{pfile} as its first argument, which can be passed -on to cpplib's functions if necessary. You can lex tokens after the -@var{name} by calling @code{pragma_lex}. Tokens that are not read by the -callback will be silently ignored. The end of the line is indicated by -a token of type @code{CPP_EOF}. Macro expansion occurs on the -arguments of pragmas registered with -@code{c_register_pragma_with_expansion} but not on the arguments of -pragmas registered with @code{c_register_pragma}. - -Note that the use of @code{pragma_lex} is specific to the C and C++ -compilers. It will not work in the Java or Fortran compilers, or any -other language compilers for that matter. Thus if @code{pragma_lex} is going -to be called from target-specific code, it must only be done so when -building the C and C++ compilers. This can be done by defining the -variables @code{c_target_objs} and @code{cxx_target_objs} in the -target entry in the @file{config.gcc} file. These variables should name -the target-specific, language-specific object file which contains the -code that uses @code{pragma_lex}. Note it will also be necessary to add a -rule to the makefile fragment pointed to by @code{tmake_file} that shows -how to build this object file. -@end deftypefun - -@defmac HANDLE_PRAGMA_PACK_WITH_EXPANSION -Define this macro if macros should be expanded in the -arguments of @samp{#pragma pack}. -@end defmac - -@defmac TARGET_DEFAULT_PACK_STRUCT -If your target requires a structure packing default other than 0 (meaning -the machine default), define this macro to the necessary value (in bytes). -This must be a value that would also be valid to use with -@samp{#pragma pack()} (that is, a small power of two). -@end defmac - -@defmac DOLLARS_IN_IDENTIFIERS -Define this macro to control use of the character @samp{$} in -identifier names for the C family of languages. 0 means @samp{$} is -not allowed by default; 1 means it is allowed. 1 is the default; -there is no need to define this macro in that case. -@end defmac - -@defmac INSN_SETS_ARE_DELAYED (@var{insn}) -Define this macro as a C expression that is nonzero if it is safe for the -delay slot scheduler to place instructions in the delay slot of @var{insn}, -even if they appear to use a resource set or clobbered in @var{insn}. -@var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that -every @code{call_insn} has this behavior. On machines where some @code{insn} -or @code{jump_insn} is really a function call and hence has this behavior, -you should define this macro. - -You need not define this macro if it would always return zero. -@end defmac - -@defmac INSN_REFERENCES_ARE_DELAYED (@var{insn}) -Define this macro as a C expression that is nonzero if it is safe for the -delay slot scheduler to place instructions in the delay slot of @var{insn}, -even if they appear to set or clobber a resource referenced in @var{insn}. -@var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where -some @code{insn} or @code{jump_insn} is really a function call and its operands -are registers whose use is actually in the subroutine it calls, you should -define this macro. Doing so allows the delay slot scheduler to move -instructions which copy arguments into the argument registers into the delay -slot of @var{insn}. - -You need not define this macro if it would always return zero. -@end defmac - -@defmac MULTIPLE_SYMBOL_SPACES -Define this macro as a C expression that is nonzero if, in some cases, -global symbols from one translation unit may not be bound to undefined -symbols in another translation unit without user intervention. For -instance, under Microsoft Windows symbols must be explicitly imported -from shared libraries (DLLs). - -You need not define this macro if it would always evaluate to zero. -@end defmac - -@deftypefn {Target Hook} tree TARGET_MD_ASM_CLOBBERS (tree @var{outputs}, tree @var{inputs}, tree @var{clobbers}) -This target hook should add to @var{clobbers} @code{STRING_CST} trees for -any hard regs the port wishes to automatically clobber for an asm. -It should return the result of the last @code{tree_cons} used to add a -clobber. The @var{outputs}, @var{inputs} and @var{clobber} lists are the -corresponding parameters to the asm and may be inspected to avoid -clobbering a register that is an input or output of the asm. You can use -@code{tree_overlaps_hard_reg_set}, declared in @file{tree.h}, to test -for overlap with regards to asm-declared registers. -@end deftypefn - -@defmac MATH_LIBRARY -Define this macro as a C string constant for the linker argument to link -in the system math library, minus the initial @samp{"-l"}, or -@samp{""} if the target does not have a -separate math library. - -You need only define this macro if the default of @samp{"m"} is wrong. -@end defmac - -@defmac LIBRARY_PATH_ENV -Define this macro as a C string constant for the environment variable that -specifies where the linker should look for libraries. - -You need only define this macro if the default of @samp{"LIBRARY_PATH"} -is wrong. -@end defmac - -@defmac TARGET_POSIX_IO -Define this macro if the target supports the following POSIX@ file -functions, access, mkdir and file locking with fcntl / F_SETLKW@. -Defining @code{TARGET_POSIX_IO} will enable the test coverage code -to use file locking when exiting a program, which avoids race conditions -if the program has forked. It will also create directories at run-time -for cross-profiling. -@end defmac - -@defmac MAX_CONDITIONAL_EXECUTE - -A C expression for the maximum number of instructions to execute via -conditional execution instructions instead of a branch. A value of -@code{BRANCH_COST}+1 is the default if the machine does not use cc0, and -1 if it does use cc0. -@end defmac - -@defmac IFCVT_MODIFY_TESTS (@var{ce_info}, @var{true_expr}, @var{false_expr}) -Used if the target needs to perform machine-dependent modifications on the -conditionals used for turning basic blocks into conditionally executed code. -@var{ce_info} points to a data structure, @code{struct ce_if_block}, which -contains information about the currently processed blocks. @var{true_expr} -and @var{false_expr} are the tests that are used for converting the -then-block and the else-block, respectively. Set either @var{true_expr} or -@var{false_expr} to a null pointer if the tests cannot be converted. -@end defmac - -@defmac IFCVT_MODIFY_MULTIPLE_TESTS (@var{ce_info}, @var{bb}, @var{true_expr}, @var{false_expr}) -Like @code{IFCVT_MODIFY_TESTS}, but used when converting more complicated -if-statements into conditions combined by @code{and} and @code{or} operations. -@var{bb} contains the basic block that contains the test that is currently -being processed and about to be turned into a condition. -@end defmac - -@defmac IFCVT_MODIFY_INSN (@var{ce_info}, @var{pattern}, @var{insn}) -A C expression to modify the @var{PATTERN} of an @var{INSN} that is to -be converted to conditional execution format. @var{ce_info} points to -a data structure, @code{struct ce_if_block}, which contains information -about the currently processed blocks. -@end defmac - -@defmac IFCVT_MODIFY_FINAL (@var{ce_info}) -A C expression to perform any final machine dependent modifications in -converting code to conditional execution. The involved basic blocks -can be found in the @code{struct ce_if_block} structure that is pointed -to by @var{ce_info}. -@end defmac - -@defmac IFCVT_MODIFY_CANCEL (@var{ce_info}) -A C expression to cancel any machine dependent modifications in -converting code to conditional execution. The involved basic blocks -can be found in the @code{struct ce_if_block} structure that is pointed -to by @var{ce_info}. -@end defmac - -@defmac IFCVT_MACHDEP_INIT (@var{ce_info}) -A C expression to initialize any machine specific data for if-conversion -of the if-block in the @code{struct ce_if_block} structure that is pointed -to by @var{ce_info}. -@end defmac - -@deftypefn {Target Hook} void TARGET_MACHINE_DEPENDENT_REORG (void) -If non-null, this hook performs a target-specific pass over the -instruction stream. The compiler will run it at all optimization levels, -just before the point at which it normally does delayed-branch scheduling. - -The exact purpose of the hook varies from target to target. Some use -it to do transformations that are necessary for correctness, such as -laying out in-function constant pools or avoiding hardware hazards. -Others use it as an opportunity to do some machine-dependent optimizations. - -You need not implement the hook if it has nothing to do. The default -definition is null. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_INIT_BUILTINS (void) -Define this hook if you have any machine-specific built-in functions -that need to be defined. It should be a function that performs the -necessary setup. - -Machine specific built-in functions can be useful to expand special machine -instructions that would otherwise not normally be generated because -they have no equivalent in the source language (for example, SIMD vector -instructions or prefetch instructions). - -To create a built-in function, call the function -@code{lang_hooks.builtin_function} -which is defined by the language front end. You can use any type nodes set -up by @code{build_common_tree_nodes}; -only language front ends that use those two functions will call -@samp{TARGET_INIT_BUILTINS}. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_BUILTIN_DECL (unsigned @var{code}, bool @var{initialize_p}) -Define this hook if you have any machine-specific built-in functions -that need to be defined. It should be a function that returns the -builtin function declaration for the builtin function code @var{code}. -If there is no such builtin and it cannot be initialized at this time -if @var{initialize_p} is true the function should return @code{NULL_TREE}. -If @var{code} is out of range the function should return -@code{error_mark_node}. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN (tree @var{exp}, rtx @var{target}, rtx @var{subtarget}, machine_mode @var{mode}, int @var{ignore}) - -Expand a call to a machine specific built-in function that was set up by -@samp{TARGET_INIT_BUILTINS}. @var{exp} is the expression for the -function call; the result should go to @var{target} if that is -convenient, and have mode @var{mode} if that is convenient. -@var{subtarget} may be used as the target for computing one of -@var{exp}'s operands. @var{ignore} is nonzero if the value is to be -ignored. This function should return the result of the call to the -built-in function. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_BUILTIN_CHKP_FUNCTION (unsigned @var{fcode}) -This hook allows target to redefine built-in functions used by -Pointer Bounds Checker for code instrumentation. Hook should return -fndecl of function implementing generic builtin whose code is -passed in @var{fcode}. Currently following built-in functions are -obtained using this hook: -@deftypefn {Built-in Function} __bounds_type __chkp_bndmk (const void *@var{lb}, size_t @var{size}) -Function code - BUILT_IN_CHKP_BNDMK. This built-in function is used -by Pointer Bounds Checker to create bound values. @var{lb} holds low -bound of the resulting bounds. @var{size} holds size of created bounds. -@end deftypefn - -@deftypefn {Built-in Function} void __chkp_bndstx (const void *@var{ptr}, __bounds_type @var{b}, const void **@var{loc}) -Function code - @code{BUILT_IN_CHKP_BNDSTX}. This built-in function is used -by Pointer Bounds Checker to store bounds @var{b} for pointer @var{ptr} -when @var{ptr} is stored by address @var{loc}. -@end deftypefn - -@deftypefn {Built-in Function} __bounds_type __chkp_bndldx (const void **@var{loc}, const void *@var{ptr}) -Function code - @code{BUILT_IN_CHKP_BNDLDX}. This built-in function is used -by Pointer Bounds Checker to get bounds of pointer @var{ptr} loaded by -address @var{loc}. -@end deftypefn - -@deftypefn {Built-in Function} void __chkp_bndcl (const void *@var{ptr}, __bounds_type @var{b}) -Function code - @code{BUILT_IN_CHKP_BNDCL}. This built-in function is used -by Pointer Bounds Checker to perform check for pointer @var{ptr} against -lower bound of bounds @var{b}. -@end deftypefn - -@deftypefn {Built-in Function} void __chkp_bndcu (const void *@var{ptr}, __bounds_type @var{b}) -Function code - @code{BUILT_IN_CHKP_BNDCU}. This built-in function is used -by Pointer Bounds Checker to perform check for pointer @var{ptr} against -upper bound of bounds @var{b}. -@end deftypefn - -@deftypefn {Built-in Function} __bounds_type __chkp_bndret (void *@var{ptr}) -Function code - @code{BUILT_IN_CHKP_BNDRET}. This built-in function is used -by Pointer Bounds Checker to obtain bounds returned by a call statement. -@var{ptr} passed to built-in is @code{SSA_NAME} returned by the call. -@end deftypefn - -@deftypefn {Built-in Function} __bounds_type __chkp_intersect (__bounds_type @var{b1}, __bounds_type @var{b2}) -Function code - @code{BUILT_IN_CHKP_INTERSECT}. This built-in function -returns intersection of bounds @var{b1} and @var{b2}. -@end deftypefn - -@deftypefn {Built-in Function} __bounds_type __chkp_narrow (const void *@var{ptr}, __bounds_type @var{b}, size_t @var{s}) -Function code - @code{BUILT_IN_CHKP_NARROW}. This built-in function -returns intersection of bounds @var{b} and -[@var{ptr}, @var{ptr} + @var{s} - @code{1}]. -@end deftypefn - -@deftypefn {Built-in Function} size_t __chkp_sizeof (const void *@var{ptr}) -Function code - @code{BUILT_IN_CHKP_SIZEOF}. This built-in function -returns size of object referenced by @var{ptr}. @var{ptr} is always -@code{ADDR_EXPR} of @code{VAR_DECL}. This built-in is used by -Pointer Bounds Checker when bounds of object cannot be computed statically -(e.g. object has incomplete type). -@end deftypefn - -@deftypefn {Built-in Function} const void *__chkp_extract_lower (__bounds_type @var{b}) -Function code - @code{BUILT_IN_CHKP_EXTRACT_LOWER}. This built-in function -returns lower bound of bounds @var{b}. -@end deftypefn - -@deftypefn {Built-in Function} const void *__chkp_extract_upper (__bounds_type @var{b}) -Function code - @code{BUILT_IN_CHKP_EXTRACT_UPPER}. This built-in function -returns upper bound of bounds @var{b}. -@end deftypefn -@end deftypefn -@deftypefn {Target Hook} tree TARGET_CHKP_BOUND_TYPE (void) -Return type to be used for bounds -@end deftypefn -@deftypefn {Target Hook} {enum machine_mode} TARGET_CHKP_BOUND_MODE (void) -Return mode to be used for bounds. -@end deftypefn -@deftypefn {Target Hook} tree TARGET_CHKP_MAKE_BOUNDS_CONSTANT (HOST_WIDE_INT @var{lb}, HOST_WIDE_INT @var{ub}) -Return constant used to statically initialize constant bounds -with specified lower bound @var{lb} and upper bounds @var{ub}. -@end deftypefn -@deftypefn {Target Hook} int TARGET_CHKP_INITIALIZE_BOUNDS (tree @var{var}, tree @var{lb}, tree @var{ub}, tree *@var{stmts}) -Generate a list of statements @var{stmts} to initialize pointer -bounds variable @var{var} with bounds @var{lb} and @var{ub}. Return -the number of generated statements. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_RESOLVE_OVERLOADED_BUILTIN (unsigned int @var{loc}, tree @var{fndecl}, void *@var{arglist}) -Select a replacement for a machine specific built-in function that -was set up by @samp{TARGET_INIT_BUILTINS}. This is done -@emph{before} regular type checking, and so allows the target to -implement a crude form of function overloading. @var{fndecl} is the -declaration of the built-in function. @var{arglist} is the list of -arguments passed to the built-in function. The result is a -complete expression that implements the operation, usually -another @code{CALL_EXPR}. -@var{arglist} really has type @samp{VEC(tree,gc)*} -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_FOLD_BUILTIN (tree @var{fndecl}, int @var{n_args}, tree *@var{argp}, bool @var{ignore}) -Fold a call to a machine specific built-in function that was set up by -@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the -built-in function. @var{n_args} is the number of arguments passed to -the function; the arguments themselves are pointed to by @var{argp}. -The result is another tree, valid for both GIMPLE and GENERIC, -containing a simplified expression for the call's result. If -@var{ignore} is true the value will be ignored. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_GIMPLE_FOLD_BUILTIN (gimple_stmt_iterator *@var{gsi}) -Fold a call to a machine specific built-in function that was set up -by @samp{TARGET_INIT_BUILTINS}. @var{gsi} points to the gimple -statement holding the function call. Returns true if any change -was made to the GIMPLE stream. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_COMPARE_VERSION_PRIORITY (tree @var{decl1}, tree @var{decl2}) -This hook is used to compare the target attributes in two functions to -determine which function's features get higher priority. This is used -during function multi-versioning to figure out the order in which two -versions must be dispatched. A function version with a higher priority -is checked for dispatching earlier. @var{decl1} and @var{decl2} are - the two function decls that will be compared. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_GET_FUNCTION_VERSIONS_DISPATCHER (void *@var{decl}) -This hook is used to get the dispatcher function for a set of function -versions. The dispatcher function is called to invoke the right function -version at run-time. @var{decl} is one version from a set of semantically -identical versions. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_GENERATE_VERSION_DISPATCHER_BODY (void *@var{arg}) -This hook is used to generate the dispatcher logic to invoke the right -function version at run-time for a given set of function versions. -@var{arg} points to the callgraph node of the dispatcher function whose -body must be generated. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CAN_USE_DOLOOP_P (const widest_int @var{&iterations}, const widest_int @var{&iterations_max}, unsigned int @var{loop_depth}, bool @var{entered_at_top}) -Return true if it is possible to use low-overhead loops (@code{doloop_end} -and @code{doloop_begin}) for a particular loop. @var{iterations} gives the -exact number of iterations, or 0 if not known. @var{iterations_max} gives -the maximum number of iterations, or 0 if not known. @var{loop_depth} is -the nesting depth of the loop, with 1 for innermost loops, 2 for loops that -contain innermost loops, and so on. @var{entered_at_top} is true if the -loop is only entered from the top. - -This hook is only used if @code{doloop_end} is available. The default -implementation returns true. You can use @code{can_use_doloop_if_innermost} -if the loop must be the innermost, and if there are no other restrictions. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_WITHIN_DOLOOP (const rtx_insn *@var{insn}) - -Take an instruction in @var{insn} and return NULL if it is valid within a -low-overhead loop, otherwise return a string explaining why doloop -could not be applied. - -Many targets use special registers for low-overhead looping. For any -instruction that clobbers these this function should return a string indicating -the reason why the doloop could not be applied. -By default, the RTL loop optimizer does not use a present doloop pattern for -loops containing function calls or branch on table instructions. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_LEGITIMATE_COMBINED_INSN (rtx_insn *@var{insn}) -Take an instruction in @var{insn} and return @code{false} if the instruction is not appropriate as a combination of two or more instructions. The default is to accept all instructions. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_CAN_FOLLOW_JUMP (const rtx_insn *@var{follower}, const rtx_insn *@var{followee}) -FOLLOWER and FOLLOWEE are JUMP_INSN instructions; return true if FOLLOWER may be modified to follow FOLLOWEE; false, if it can't. For example, on some targets, certain kinds of branches can't be made to follow through a hot/cold partitioning. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_COMMUTATIVE_P (const_rtx @var{x}, int @var{outer_code}) -This target hook returns @code{true} if @var{x} is considered to be commutative. -Usually, this is just COMMUTATIVE_P (@var{x}), but the HP PA doesn't consider -PLUS to be commutative inside a MEM@. @var{outer_code} is the rtx code -of the enclosing rtl, if known, otherwise it is UNKNOWN. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_ALLOCATE_INITIAL_VALUE (rtx @var{hard_reg}) - -When the initial value of a hard register has been copied in a pseudo -register, it is often not necessary to actually allocate another register -to this pseudo register, because the original hard register or a stack slot -it has been saved into can be used. @code{TARGET_ALLOCATE_INITIAL_VALUE} -is called at the start of register allocation once for each hard register -that had its initial value copied by using -@code{get_func_hard_reg_initial_val} or @code{get_hard_reg_initial_val}. -Possible values are @code{NULL_RTX}, if you don't want -to do any special allocation, a @code{REG} rtx---that would typically be -the hard register itself, if it is known not to be clobbered---or a -@code{MEM}. -If you are returning a @code{MEM}, this is only a hint for the allocator; -it might decide to use another register anyways. -You may use @code{current_function_is_leaf} or -@code{REG_N_SETS} in the hook to determine if the hard -register in question will not be clobbered. -The default value of this hook is @code{NULL}, which disables any special -allocation. -@end deftypefn - -@deftypefn {Target Hook} int TARGET_UNSPEC_MAY_TRAP_P (const_rtx @var{x}, unsigned @var{flags}) -This target hook returns nonzero if @var{x}, an @code{unspec} or -@code{unspec_volatile} operation, might cause a trap. Targets can use -this hook to enhance precision of analysis for @code{unspec} and -@code{unspec_volatile} operations. You may call @code{may_trap_p_1} -to analyze inner elements of @var{x} in which case @var{flags} should be -passed along. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_SET_CURRENT_FUNCTION (tree @var{decl}) -The compiler invokes this hook whenever it changes its current function -context (@code{cfun}). You can define this function if -the back end needs to perform any initialization or reset actions on a -per-function basis. For example, it may be used to implement function -attributes that affect register usage or code generation patterns. -The argument @var{decl} is the declaration for the new function context, -and may be null to indicate that the compiler has left a function context -and is returning to processing at the top level. -The default hook function does nothing. - -GCC sets @code{cfun} to a dummy function context during initialization of -some parts of the back end. The hook function is not invoked in this -situation; you need not worry about the hook being invoked recursively, -or when the back end is in a partially-initialized state. -@code{cfun} might be @code{NULL} to indicate processing at top level, -outside of any function scope. -@end deftypefn - -@defmac TARGET_OBJECT_SUFFIX -Define this macro to be a C string representing the suffix for object -files on your target machine. If you do not define this macro, GCC will -use @samp{.o} as the suffix for object files. -@end defmac - -@defmac TARGET_EXECUTABLE_SUFFIX -Define this macro to be a C string representing the suffix to be -automatically added to executable files on your target machine. If you -do not define this macro, GCC will use the null string as the suffix for -executable files. -@end defmac - -@defmac COLLECT_EXPORT_LIST -If defined, @code{collect2} will scan the individual object files -specified on its command line and create an export list for the linker. -Define this macro for systems like AIX, where the linker discards -object files that are not referenced from @code{main} and uses export -lists. -@end defmac - -@defmac MODIFY_JNI_METHOD_CALL (@var{mdecl}) -Define this macro to a C expression representing a variant of the -method call @var{mdecl}, if Java Native Interface (JNI) methods -must be invoked differently from other methods on your target. -For example, on 32-bit Microsoft Windows, JNI methods must be invoked using -the @code{stdcall} calling convention and this macro is then -defined as this expression: - -@smallexample -build_type_attribute_variant (@var{mdecl}, - build_tree_list - (get_identifier ("stdcall"), - NULL)) -@end smallexample -@end defmac - -@deftypefn {Target Hook} bool TARGET_CANNOT_MODIFY_JUMPS_P (void) -This target hook returns @code{true} past the point in which new jump -instructions could be created. On machines that require a register for -every jump such as the SHmedia ISA of SH5, this point would typically be -reload, so this target hook should be defined to a function such as: - -@smallexample -static bool -cannot_modify_jumps_past_reload_p () -@{ - return (reload_completed || reload_in_progress); -@} -@end smallexample -@end deftypefn - -@deftypefn {Target Hook} reg_class_t TARGET_BRANCH_TARGET_REGISTER_CLASS (void) -This target hook returns a register class for which branch target register -optimizations should be applied. All registers in this class should be -usable interchangeably. After reload, registers in this class will be -re-allocated and loads will be hoisted out of loops and be subjected -to inter-block scheduling. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED (bool @var{after_prologue_epilogue_gen}) -Branch target register optimization will by default exclude callee-saved -registers -that are not already live during the current function; if this target hook -returns true, they will be included. The target code must than make sure -that all target registers in the class returned by -@samp{TARGET_BRANCH_TARGET_REGISTER_CLASS} that might need saving are -saved. @var{after_prologue_epilogue_gen} indicates if prologues and -epilogues have already been generated. Note, even if you only return -true when @var{after_prologue_epilogue_gen} is false, you still are likely -to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET} -to reserve space for caller-saved target registers. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_HAVE_CONDITIONAL_EXECUTION (void) -This target hook returns true if the target supports conditional execution. -This target hook is required only when the target has several different -modes and they have different conditional execution capability, such as ARM. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_GEN_CCMP_FIRST (rtx *@var{prep_seq}, rtx *@var{gen_seq}, int @var{code}, tree @var{op0}, tree @var{op1}) -This function prepares to emit a comparison insn for the first compare in a - sequence of conditional comparisions. It returns a appropriate @code{CC} - for passing to @code{gen_ccmp_next} or @code{cbranch_optab}. The insns to - prepare the compare are saved in @var{prep_seq} and the compare insns are - saved in @var{gen_seq}. They will be emitted when all the compares in the - the conditional comparision are generated without error. @var{code} is - the @code{rtx_code} of the compare for @var{op0} and @var{op1}. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_GEN_CCMP_NEXT (rtx *@var{prep_seq}, rtx *@var{gen_seq}, rtx @var{prev}, int @var{cmp_code}, tree @var{op0}, tree @var{op1}, int @var{bit_code}) -This function prepare to emit a conditional comparison within a sequence of - conditional comparisons. It returns a appropriate @code{CC} for passing to - @code{gen_ccmp_next} or @code{cbranch_optab}. The insns to prepare the - compare are saved in @var{prep_seq} and the compare insns are saved in - @var{gen_seq}. They will be emitted when all the compares in the conditional - comparision are generated without error. The @var{prev} expression is the - result of a prior call to @code{gen_ccmp_first} or @code{gen_ccmp_next}. It - may return @code{NULL} if the combination of @var{prev} and this comparison is - not supported, otherwise the result must be appropriate for passing to - @code{gen_ccmp_next} or @code{cbranch_optab}. @var{code} is the - @code{rtx_code} of the compare for @var{op0} and @var{op1}. @var{bit_code} - is @code{AND} or @code{IOR}, which is the op on the two compares. -@end deftypefn - -@deftypefn {Target Hook} unsigned TARGET_LOOP_UNROLL_ADJUST (unsigned @var{nunroll}, struct loop *@var{loop}) -This target hook returns a new value for the number of times @var{loop} -should be unrolled. The parameter @var{nunroll} is the number of times -the loop is to be unrolled. The parameter @var{loop} is a pointer to -the loop, which is going to be checked for unrolling. This target hook -is required only when the target has special constraints like maximum -number of memory accesses. -@end deftypefn - -@defmac POWI_MAX_MULTS -If defined, this macro is interpreted as a signed integer C expression -that specifies the maximum number of floating point multiplications -that should be emitted when expanding exponentiation by an integer -constant inline. When this value is defined, exponentiation requiring -more than this number of multiplications is implemented by calling the -system library's @code{pow}, @code{powf} or @code{powl} routines. -The default value places no upper bound on the multiplication count. -@end defmac - -@deftypefn Macro void TARGET_EXTRA_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc}) -This target hook should register any extra include files for the -target. The parameter @var{stdinc} indicates if normal include files -are present. The parameter @var{sysroot} is the system root directory. -The parameter @var{iprefix} is the prefix for the gcc directory. -@end deftypefn - -@deftypefn Macro void TARGET_EXTRA_PRE_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc}) -This target hook should register any extra include files for the -target before any standard headers. The parameter @var{stdinc} -indicates if normal include files are present. The parameter -@var{sysroot} is the system root directory. The parameter -@var{iprefix} is the prefix for the gcc directory. -@end deftypefn - -@deftypefn Macro void TARGET_OPTF (char *@var{path}) -This target hook should register special include paths for the target. -The parameter @var{path} is the include to register. On Darwin -systems, this is used for Framework includes, which have semantics -that are different from @option{-I}. -@end deftypefn - -@defmac bool TARGET_USE_LOCAL_THUNK_ALIAS_P (tree @var{fndecl}) -This target macro returns @code{true} if it is safe to use a local alias -for a virtual function @var{fndecl} when constructing thunks, -@code{false} otherwise. By default, the macro returns @code{true} for all -functions, if a target supports aliases (i.e.@: defines -@code{ASM_OUTPUT_DEF}), @code{false} otherwise, -@end defmac - -@defmac TARGET_FORMAT_TYPES -If defined, this macro is the name of a global variable containing -target-specific format checking information for the @option{-Wformat} -option. The default is to have no target-specific format checks. -@end defmac - -@defmac TARGET_N_FORMAT_TYPES -If defined, this macro is the number of entries in -@code{TARGET_FORMAT_TYPES}. -@end defmac - -@defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES -If defined, this macro is the name of a global variable containing -target-specific format overrides for the @option{-Wformat} option. The -default is to have no target-specific format overrides. If defined, -@code{TARGET_FORMAT_TYPES} must be defined, too. -@end defmac - -@defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT -If defined, this macro specifies the number of entries in -@code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}. -@end defmac - -@defmac TARGET_OVERRIDES_FORMAT_INIT -If defined, this macro specifies the optional initialization -routine for target specific customizations of the system printf -and scanf formatter settings. -@end defmac - -@deftypevr {Target Hook} bool TARGET_RELAXED_ORDERING -If set to @code{true}, means that the target's memory model does not -guarantee that loads which do not depend on one another will access -main memory in the order of the instruction stream; if ordering is -important, an explicit memory barrier must be used. This is true of -many recent processors which implement a policy of ``relaxed,'' -``weak,'' or ``release'' memory consistency, such as Alpha, PowerPC, -and ia64. The default is @code{false}. -@end deftypevr - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN (const_tree @var{typelist}, const_tree @var{funcdecl}, const_tree @var{val}) -If defined, this macro returns the diagnostic message when it is -illegal to pass argument @var{val} to function @var{funcdecl} -with prototype @var{typelist}. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_CONVERSION (const_tree @var{fromtype}, const_tree @var{totype}) -If defined, this macro returns the diagnostic message when it is -invalid to convert from @var{fromtype} to @var{totype}, or @code{NULL} -if validity should be determined by the front end. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_UNARY_OP (int @var{op}, const_tree @var{type}) -If defined, this macro returns the diagnostic message when it is -invalid to apply operation @var{op} (where unary plus is denoted by -@code{CONVERT_EXPR}) to an operand of type @var{type}, or @code{NULL} -if validity should be determined by the front end. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_BINARY_OP (int @var{op}, const_tree @var{type1}, const_tree @var{type2}) -If defined, this macro returns the diagnostic message when it is -invalid to apply operation @var{op} to operands of types @var{type1} -and @var{type2}, or @code{NULL} if validity should be determined by -the front end. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_PARAMETER_TYPE (const_tree @var{type}) -If defined, this macro returns the diagnostic message when it is -invalid for functions to include parameters of type @var{type}, -or @code{NULL} if validity should be determined by -the front end. This is currently used only by the C and C++ front ends. -@end deftypefn - -@deftypefn {Target Hook} {const char *} TARGET_INVALID_RETURN_TYPE (const_tree @var{type}) -If defined, this macro returns the diagnostic message when it is -invalid for functions to have return type @var{type}, -or @code{NULL} if validity should be determined by -the front end. This is currently used only by the C and C++ front ends. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_PROMOTED_TYPE (const_tree @var{type}) -If defined, this target hook returns the type to which values of -@var{type} should be promoted when they appear in expressions, -analogous to the integer promotions, or @code{NULL_TREE} to use the -front end's normal promotion rules. This hook is useful when there are -target-specific types with special promotion rules. -This is currently used only by the C and C++ front ends. -@end deftypefn - -@deftypefn {Target Hook} tree TARGET_CONVERT_TO_TYPE (tree @var{type}, tree @var{expr}) -If defined, this hook returns the result of converting @var{expr} to -@var{type}. It should return the converted expression, -or @code{NULL_TREE} to apply the front end's normal conversion rules. -This hook is useful when there are target-specific types with special -conversion rules. -This is currently used only by the C and C++ front ends. -@end deftypefn - -@defmac TARGET_USE_JCR_SECTION -This macro determines whether to use the JCR section to register Java -classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both -SUPPORTS_WEAK and TARGET_HAVE_NAMED_SECTIONS are true, else 0. -@end defmac - -@defmac OBJC_JBLEN -This macro determines the size of the objective C jump buffer for the -NeXT runtime. By default, OBJC_JBLEN is defined to an innocuous value. -@end defmac - -@defmac LIBGCC2_UNWIND_ATTRIBUTE -Define this macro if any target-specific attributes need to be attached -to the functions in @file{libgcc} that provide low-level support for -call stack unwinding. It is used in declarations in @file{unwind-generic.h} -and the associated definitions of those functions. -@end defmac - -@deftypefn {Target Hook} void TARGET_UPDATE_STACK_BOUNDARY (void) -Define this macro to update the current function stack boundary if -necessary. -@end deftypefn - -@deftypefn {Target Hook} rtx TARGET_GET_DRAP_RTX (void) -This hook should return an rtx for Dynamic Realign Argument Pointer (DRAP) if a -different argument pointer register is needed to access the function's -argument list due to stack realignment. Return @code{NULL} if no DRAP -is needed. -@end deftypefn - -@deftypefn {Target Hook} bool TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS (void) -When optimization is disabled, this hook indicates whether or not -arguments should be allocated to stack slots. Normally, GCC allocates -stacks slots for arguments when not optimizing in order to make -debugging easier. However, when a function is declared with -@code{__attribute__((naked))}, there is no stack frame, and the compiler -cannot safely move arguments from the registers in which they are passed -to the stack. Therefore, this hook should return true in general, but -false for naked functions. The default implementation always returns true. -@end deftypefn - -@deftypevr {Target Hook} {unsigned HOST_WIDE_INT} TARGET_CONST_ANCHOR -On some architectures it can take multiple instructions to synthesize -a constant. If there is another constant already in a register that -is close enough in value then it is preferable that the new constant -is computed from this register using immediate addition or -subtraction. We accomplish this through CSE. Besides the value of -the constant we also add a lower and an upper constant anchor to the -available expressions. These are then queried when encountering new -constants. The anchors are computed by rounding the constant up and -down to a multiple of the value of @code{TARGET_CONST_ANCHOR}. -@code{TARGET_CONST_ANCHOR} should be the maximum positive value -accepted by immediate-add plus one. We currently assume that the -value of @code{TARGET_CONST_ANCHOR} is a power of 2. For example, on -MIPS, where add-immediate takes a 16-bit signed value, -@code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}. The default value -is zero, which disables this optimization. -@end deftypevr - -@deftypefn {Target Hook} {unsigned HOST_WIDE_INT} TARGET_ASAN_SHADOW_OFFSET (void) -Return the offset bitwise ored into shifted address to get corresponding -Address Sanitizer shadow memory address. NULL if Address Sanitizer is not -supported by the target. -@end deftypefn - -@deftypefn {Target Hook} {unsigned HOST_WIDE_INT} TARGET_MEMMODEL_CHECK (unsigned HOST_WIDE_INT @var{val}) -Validate target specific memory model mask bits. When NULL no target specific -memory model bits are allowed. -@end deftypefn - -@deftypevr {Target Hook} {unsigned char} TARGET_ATOMIC_TEST_AND_SET_TRUEVAL -This value should be set if the result written by @code{atomic_test_and_set} is not exactly 1, i.e. the @code{bool} @code{true}. -@end deftypevr - -@deftypefn {Target Hook} bool TARGET_HAS_IFUNC_P (void) -It returns true if the target supports GNU indirect functions. -The support includes the assembler, linker and dynamic linker. -The default value of this hook is based on target's libc. -@end deftypefn - -@deftypefn {Target Hook} {unsigned int} TARGET_ATOMIC_ALIGN_FOR_MODE (machine_mode @var{mode}) -If defined, this function returns an appropriate alignment in bits for an atomic object of machine_mode @var{mode}. If 0 is returned then the default alignment for the specified mode is used. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_ATOMIC_ASSIGN_EXPAND_FENV (tree *@var{hold}, tree *@var{clear}, tree *@var{update}) -ISO C11 requires atomic compound assignments that may raise floating-point exceptions to raise exceptions corresponding to the arithmetic operation whose result was successfully stored in a compare-and-exchange sequence. This requires code equivalent to calls to @code{feholdexcept}, @code{feclearexcept} and @code{feupdateenv} to be generated at appropriate points in the compare-and-exchange sequence. This hook should set @code{*@var{hold}} to an expression equivalent to the call to @code{feholdexcept}, @code{*@var{clear}} to an expression equivalent to the call to @code{feclearexcept} and @code{*@var{update}} to an expression equivalent to the call to @code{feupdateenv}. The three expressions are @code{NULL_TREE} on entry to the hook and may be left as @code{NULL_TREE} if no code is required in a particular place. The default implementation leaves all three expressions as @code{NULL_TREE}. The @code{__atomic_feraiseexcept} function from @code{libatomic} may be of use as part of the code generated in @code{*@var{update}}. -@end deftypefn - -@deftypefn {Target Hook} void TARGET_RECORD_OFFLOAD_SYMBOL (tree) -Used when offloaded functions are seen in the compilation unit and no named -sections are available. It is called once for each symbol that must be -recorded in the offload function and variable table. -@end deftypefn - -@deftypefn {Target Hook} {char *} TARGET_OFFLOAD_OPTIONS (void) -Used when writing out the list of options into an LTO file. It should -translate any relevant target-specific options (such as the ABI in use) -into one of the @option{-foffload} options that exist as a common interface -to express such options. It should return a string containing these options, -separated by spaces, which the caller will free. - -@end deftypefn - -@defmac TARGET_SUPPORTS_WIDE_INT - -On older ports, large integers are stored in @code{CONST_DOUBLE} rtl -objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero -to indicate that large integers are stored in -@code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows -very large integer constants to be represented. @code{CONST_DOUBLE} -is limited to twice the size of the host's @code{HOST_WIDE_INT} -representation. - -Converting a port mostly requires looking for the places where -@code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that -code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i -const_double"} at the port level gets you to 95% of the changes that -need to be made. There are a few places that require a deeper look. - -@itemize @bullet -@item -There is no equivalent to @code{hval} and @code{lval} for -@code{CONST_WIDE_INT}s. This would be difficult to express in the md -language since there are a variable number of elements. - -Most ports only check that @code{hval} is either 0 or -1 to see if the -value is small. As mentioned above, this will no longer be necessary -since small constants are always @code{CONST_INT}. Of course there -are still a few exceptions, the alpha's constraint used by the zap -instruction certainly requires careful examination by C code. -However, all the current code does is pass the hval and lval to C -code, so evolving the c code to look at the @code{CONST_WIDE_INT} is -not really a large change. - -@item -Because there is no standard template that ports use to materialize -constants, there is likely to be some futzing that is unique to each -port in this code. - -@item -The rtx costs may have to be adjusted to properly account for larger -constants that are represented as @code{CONST_WIDE_INT}. -@end itemize - -All and all it does not take long to convert ports that the -maintainer is familiar with. - -@end defmac diff --git a/contrib/gcc-5.0/gcc/doc/tree-ssa.texi b/contrib/gcc-5.0/gcc/doc/tree-ssa.texi deleted file mode 100644 index d853593d4c..0000000000 --- a/contrib/gcc-5.0/gcc/doc/tree-ssa.texi +++ /dev/null @@ -1,872 +0,0 @@ -@c Copyright (C) 2004-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@c --------------------------------------------------------------------- -@c Tree SSA -@c --------------------------------------------------------------------- - -@node Tree SSA -@chapter Analysis and Optimization of GIMPLE tuples -@cindex Tree SSA -@cindex Optimization infrastructure for GIMPLE - -GCC uses three main intermediate languages to represent the program -during compilation: GENERIC, GIMPLE and RTL@. GENERIC is a -language-independent representation generated by each front end. It -is used to serve as an interface between the parser and optimizer. -GENERIC is a common representation that is able to represent programs -written in all the languages supported by GCC@. - -GIMPLE and RTL are used to optimize the program. GIMPLE is used for -target and language independent optimizations (e.g., inlining, -constant propagation, tail call elimination, redundancy elimination, -etc). Much like GENERIC, GIMPLE is a language independent, tree based -representation. However, it differs from GENERIC in that the GIMPLE -grammar is more restrictive: expressions contain no more than 3 -operands (except function calls), it has no control flow structures -and expressions with side-effects are only allowed on the right hand -side of assignments. See the chapter describing GENERIC and GIMPLE -for more details. - -This chapter describes the data structures and functions used in the -GIMPLE optimizers (also known as ``tree optimizers'' or ``middle -end''). In particular, it focuses on all the macros, data structures, -functions and programming constructs needed to implement optimization -passes for GIMPLE@. - -@menu -* Annotations:: Attributes for variables. -* SSA Operands:: SSA names referenced by GIMPLE statements. -* SSA:: Static Single Assignment representation. -* Alias analysis:: Representing aliased loads and stores. -* Memory model:: Memory model used by the middle-end. -@end menu - -@node Annotations -@section Annotations -@cindex annotations - -The optimizers need to associate attributes with variables during the -optimization process. For instance, we need to know whether a -variable has aliases. All these attributes are stored in data -structures called annotations which are then linked to the field -@code{ann} in @code{struct tree_common}. - - -@node SSA Operands -@section SSA Operands -@cindex operands -@cindex virtual operands -@cindex real operands -@findex update_stmt - -Almost every GIMPLE statement will contain a reference to a variable -or memory location. Since statements come in different shapes and -sizes, their operands are going to be located at various spots inside -the statement's tree. To facilitate access to the statement's -operands, they are organized into lists associated inside each -statement's annotation. Each element in an operand list is a pointer -to a @code{VAR_DECL}, @code{PARM_DECL} or @code{SSA_NAME} tree node. -This provides a very convenient way of examining and replacing -operands. - -Data flow analysis and optimization is done on all tree nodes -representing variables. Any node for which @code{SSA_VAR_P} returns -nonzero is considered when scanning statement operands. However, not -all @code{SSA_VAR_P} variables are processed in the same way. For the -purposes of optimization, we need to distinguish between references to -local scalar variables and references to globals, statics, structures, -arrays, aliased variables, etc. The reason is simple, the compiler -can gather complete data flow information for a local scalar. On the -other hand, a global variable may be modified by a function call, it -may not be possible to keep track of all the elements of an array or -the fields of a structure, etc. - -The operand scanner gathers two kinds of operands: @dfn{real} and -@dfn{virtual}. An operand for which @code{is_gimple_reg} returns true -is considered real, otherwise it is a virtual operand. We also -distinguish between uses and definitions. An operand is used if its -value is loaded by the statement (e.g., the operand at the RHS of an -assignment). If the statement assigns a new value to the operand, the -operand is considered a definition (e.g., the operand at the LHS of -an assignment). - -Virtual and real operands also have very different data flow -properties. Real operands are unambiguous references to the -full object that they represent. For instance, given - -@smallexample -@{ - int a, b; - a = b -@} -@end smallexample - -Since @code{a} and @code{b} are non-aliased locals, the statement -@code{a = b} will have one real definition and one real use because -variable @code{a} is completely modified with the contents of -variable @code{b}. Real definition are also known as @dfn{killing -definitions}. Similarly, the use of @code{b} reads all its bits. - -In contrast, virtual operands are used with variables that can have -a partial or ambiguous reference. This includes structures, arrays, -globals, and aliased variables. In these cases, we have two types of -definitions. For globals, structures, and arrays, we can determine from -a statement whether a variable of these types has a killing definition. -If the variable does, then the statement is marked as having a -@dfn{must definition} of that variable. However, if a statement is only -defining a part of the variable (i.e.@: a field in a structure), or if we -know that a statement might define the variable but we cannot say for sure, -then we mark that statement as having a @dfn{may definition}. For -instance, given - -@smallexample -@{ - int a, b, *p; - - if (@dots{}) - p = &a; - else - p = &b; - *p = 5; - return *p; -@} -@end smallexample - -The assignment @code{*p = 5} may be a definition of @code{a} or -@code{b}. If we cannot determine statically where @code{p} is -pointing to at the time of the store operation, we create virtual -definitions to mark that statement as a potential definition site for -@code{a} and @code{b}. Memory loads are similarly marked with virtual -use operands. Virtual operands are shown in tree dumps right before -the statement that contains them. To request a tree dump with virtual -operands, use the @option{-vops} option to @option{-fdump-tree}: - -@smallexample -@{ - int a, b, *p; - - if (@dots{}) - p = &a; - else - p = &b; - # a = VDEF - # b = VDEF - *p = 5; - - # VUSE - # VUSE - return *p; -@} -@end smallexample - -Notice that @code{VDEF} operands have two copies of the referenced -variable. This indicates that this is not a killing definition of -that variable. In this case we refer to it as a @dfn{may definition} -or @dfn{aliased store}. The presence of the second copy of the -variable in the @code{VDEF} operand will become important when the -function is converted into SSA form. This will be used to link all -the non-killing definitions to prevent optimizations from making -incorrect assumptions about them. - -Operands are updated as soon as the statement is finished via a call -to @code{update_stmt}. If statement elements are changed via -@code{SET_USE} or @code{SET_DEF}, then no further action is required -(i.e., those macros take care of updating the statement). If changes -are made by manipulating the statement's tree directly, then a call -must be made to @code{update_stmt} when complete. Calling one of the -@code{bsi_insert} routines or @code{bsi_replace} performs an implicit -call to @code{update_stmt}. - -@subsection Operand Iterators And Access Routines -@cindex Operand Iterators -@cindex Operand Access Routines - -Operands are collected by @file{tree-ssa-operands.c}. They are stored -inside each statement's annotation and can be accessed through either the -operand iterators or an access routine. - -The following access routines are available for examining operands: - -@enumerate -@item @code{SINGLE_SSA_@{USE,DEF,TREE@}_OPERAND}: These accessors will return -NULL unless there is exactly one operand matching the specified flags. If -there is exactly one operand, the operand is returned as either a @code{tree}, -@code{def_operand_p}, or @code{use_operand_p}. - -@smallexample -tree t = SINGLE_SSA_TREE_OPERAND (stmt, flags); -use_operand_p u = SINGLE_SSA_USE_OPERAND (stmt, SSA_ALL_VIRTUAL_USES); -def_operand_p d = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_ALL_DEFS); -@end smallexample - -@item @code{ZERO_SSA_OPERANDS}: This macro returns true if there are no -operands matching the specified flags. - -@smallexample -if (ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)) - return; -@end smallexample - -@item @code{NUM_SSA_OPERANDS}: This macro Returns the number of operands -matching 'flags'. This actually executes a loop to perform the count, so -only use this if it is really needed. - -@smallexample -int count = NUM_SSA_OPERANDS (stmt, flags) -@end smallexample -@end enumerate - - -If you wish to iterate over some or all operands, use the -@code{FOR_EACH_SSA_@{USE,DEF,TREE@}_OPERAND} iterator. For example, to print -all the operands for a statement: - -@smallexample -void -print_ops (tree stmt) -@{ - ssa_op_iter; - tree var; - - FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_OPERANDS) - print_generic_expr (stderr, var, TDF_SLIM); -@} -@end smallexample - - -How to choose the appropriate iterator: - -@enumerate -@item Determine whether you are need to see the operand pointers, or just the -trees, and choose the appropriate macro: - -@smallexample -Need Macro: ----- ------- -use_operand_p FOR_EACH_SSA_USE_OPERAND -def_operand_p FOR_EACH_SSA_DEF_OPERAND -tree FOR_EACH_SSA_TREE_OPERAND -@end smallexample - -@item You need to declare a variable of the type you are interested -in, and an ssa_op_iter structure which serves as the loop controlling -variable. - -@item Determine which operands you wish to use, and specify the flags of -those you are interested in. They are documented in -@file{tree-ssa-operands.h}: - -@smallexample -#define SSA_OP_USE 0x01 /* @r{Real USE operands.} */ -#define SSA_OP_DEF 0x02 /* @r{Real DEF operands.} */ -#define SSA_OP_VUSE 0x04 /* @r{VUSE operands.} */ -#define SSA_OP_VDEF 0x08 /* @r{VDEF operands.} */ - -/* @r{These are commonly grouped operand flags.} */ -#define SSA_OP_VIRTUAL_USES (SSA_OP_VUSE) -#define SSA_OP_VIRTUAL_DEFS (SSA_OP_VDEF) -#define SSA_OP_ALL_VIRTUALS (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS) -#define SSA_OP_ALL_USES (SSA_OP_VIRTUAL_USES | SSA_OP_USE) -#define SSA_OP_ALL_DEFS (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF) -#define SSA_OP_ALL_OPERANDS (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS) -@end smallexample -@end enumerate - -So if you want to look at the use pointers for all the @code{USE} and -@code{VUSE} operands, you would do something like: - -@smallexample - use_operand_p use_p; - ssa_op_iter iter; - - FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, (SSA_OP_USE | SSA_OP_VUSE)) - @{ - process_use_ptr (use_p); - @} -@end smallexample - -The @code{TREE} macro is basically the same as the @code{USE} and -@code{DEF} macros, only with the use or def dereferenced via -@code{USE_FROM_PTR (use_p)} and @code{DEF_FROM_PTR (def_p)}. Since we -aren't using operand pointers, use and defs flags can be mixed. - -@smallexample - tree var; - ssa_op_iter iter; - - FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_VUSE) - @{ - print_generic_expr (stderr, var, TDF_SLIM); - @} -@end smallexample - -@code{VDEF}s are broken into two flags, one for the -@code{DEF} portion (@code{SSA_OP_VDEF}) and one for the USE portion -(@code{SSA_OP_VUSE}). - -There are many examples in the code, in addition to the documentation -in @file{tree-ssa-operands.h} and @file{ssa-iterators.h}. - -There are also a couple of variants on the stmt iterators regarding PHI -nodes. - -@code{FOR_EACH_PHI_ARG} Works exactly like -@code{FOR_EACH_SSA_USE_OPERAND}, except it works over @code{PHI} arguments -instead of statement operands. - -@smallexample -/* Look at every virtual PHI use. */ -FOR_EACH_PHI_ARG (use_p, phi_stmt, iter, SSA_OP_VIRTUAL_USES) -@{ - my_code; -@} - -/* Look at every real PHI use. */ -FOR_EACH_PHI_ARG (use_p, phi_stmt, iter, SSA_OP_USES) - my_code; - -/* Look at every PHI use. */ -FOR_EACH_PHI_ARG (use_p, phi_stmt, iter, SSA_OP_ALL_USES) - my_code; -@end smallexample - -@code{FOR_EACH_PHI_OR_STMT_@{USE,DEF@}} works exactly like -@code{FOR_EACH_SSA_@{USE,DEF@}_OPERAND}, except it will function on -either a statement or a @code{PHI} node. These should be used when it is -appropriate but they are not quite as efficient as the individual -@code{FOR_EACH_PHI} and @code{FOR_EACH_SSA} routines. - -@smallexample -FOR_EACH_PHI_OR_STMT_USE (use_operand_p, stmt, iter, flags) - @{ - my_code; - @} - -FOR_EACH_PHI_OR_STMT_DEF (def_operand_p, phi, iter, flags) - @{ - my_code; - @} -@end smallexample - -@subsection Immediate Uses -@cindex Immediate Uses - -Immediate use information is now always available. Using the immediate use -iterators, you may examine every use of any @code{SSA_NAME}. For instance, -to change each use of @code{ssa_var} to @code{ssa_var2} and call fold_stmt on -each stmt after that is done: - -@smallexample - use_operand_p imm_use_p; - imm_use_iterator iterator; - tree ssa_var, stmt; - - - FOR_EACH_IMM_USE_STMT (stmt, iterator, ssa_var) - @{ - FOR_EACH_IMM_USE_ON_STMT (imm_use_p, iterator) - SET_USE (imm_use_p, ssa_var_2); - fold_stmt (stmt); - @} -@end smallexample - -There are 2 iterators which can be used. @code{FOR_EACH_IMM_USE_FAST} is -used when the immediate uses are not changed, i.e., you are looking at the -uses, but not setting them. - -If they do get changed, then care must be taken that things are not changed -under the iterators, so use the @code{FOR_EACH_IMM_USE_STMT} and -@code{FOR_EACH_IMM_USE_ON_STMT} iterators. They attempt to preserve the -sanity of the use list by moving all the uses for a statement into -a controlled position, and then iterating over those uses. Then the -optimization can manipulate the stmt when all the uses have been -processed. This is a little slower than the FAST version since it adds a -placeholder element and must sort through the list a bit for each statement. -This placeholder element must be also be removed if the loop is -terminated early. The macro @code{BREAK_FROM_IMM_USE_SAFE} is provided -to do this : - -@smallexample - FOR_EACH_IMM_USE_STMT (stmt, iterator, ssa_var) - @{ - if (stmt == last_stmt) - BREAK_FROM_SAFE_IMM_USE (iter); - - FOR_EACH_IMM_USE_ON_STMT (imm_use_p, iterator) - SET_USE (imm_use_p, ssa_var_2); - fold_stmt (stmt); - @} -@end smallexample - -There are checks in @code{verify_ssa} which verify that the immediate use list -is up to date, as well as checking that an optimization didn't break from the -loop without using this macro. It is safe to simply 'break'; from a -@code{FOR_EACH_IMM_USE_FAST} traverse. - -Some useful functions and macros: -@enumerate -@item @code{has_zero_uses (ssa_var)} : Returns true if there are no uses of -@code{ssa_var}. -@item @code{has_single_use (ssa_var)} : Returns true if there is only a -single use of @code{ssa_var}. -@item @code{single_imm_use (ssa_var, use_operand_p *ptr, tree *stmt)} : -Returns true if there is only a single use of @code{ssa_var}, and also returns -the use pointer and statement it occurs in, in the second and third parameters. -@item @code{num_imm_uses (ssa_var)} : Returns the number of immediate uses of -@code{ssa_var}. It is better not to use this if possible since it simply -utilizes a loop to count the uses. -@item @code{PHI_ARG_INDEX_FROM_USE (use_p)} : Given a use within a @code{PHI} -node, return the index number for the use. An assert is triggered if the use -isn't located in a @code{PHI} node. -@item @code{USE_STMT (use_p)} : Return the statement a use occurs in. -@end enumerate - -Note that uses are not put into an immediate use list until their statement is -actually inserted into the instruction stream via a @code{bsi_*} routine. - -It is also still possible to utilize lazy updating of statements, but this -should be used only when absolutely required. Both alias analysis and the -dominator optimizations currently do this. - -When lazy updating is being used, the immediate use information is out of date -and cannot be used reliably. Lazy updating is achieved by simply marking -statements modified via calls to @code{mark_stmt_modified} instead of -@code{update_stmt}. When lazy updating is no longer required, all the -modified statements must have @code{update_stmt} called in order to bring them -up to date. This must be done before the optimization is finished, or -@code{verify_ssa} will trigger an abort. - -This is done with a simple loop over the instruction stream: -@smallexample - block_stmt_iterator bsi; - basic_block bb; - FOR_EACH_BB (bb) - @{ - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) - update_stmt_if_modified (bsi_stmt (bsi)); - @} -@end smallexample - -@node SSA -@section Static Single Assignment -@cindex SSA -@cindex static single assignment - -Most of the tree optimizers rely on the data flow information provided -by the Static Single Assignment (SSA) form. We implement the SSA form -as described in @cite{R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and -K. Zadeck. Efficiently Computing Static Single Assignment Form and the -Control Dependence Graph. ACM Transactions on Programming Languages -and Systems, 13(4):451-490, October 1991}. - -The SSA form is based on the premise that program variables are -assigned in exactly one location in the program. Multiple assignments -to the same variable create new versions of that variable. Naturally, -actual programs are seldom in SSA form initially because variables -tend to be assigned multiple times. The compiler modifies the program -representation so that every time a variable is assigned in the code, -a new version of the variable is created. Different versions of the -same variable are distinguished by subscripting the variable name with -its version number. Variables used in the right-hand side of -expressions are renamed so that their version number matches that of -the most recent assignment. - -We represent variable versions using @code{SSA_NAME} nodes. The -renaming process in @file{tree-ssa.c} wraps every real and -virtual operand with an @code{SSA_NAME} node which contains -the version number and the statement that created the -@code{SSA_NAME}. Only definitions and virtual definitions may -create new @code{SSA_NAME} nodes. - -@cindex PHI nodes -Sometimes, flow of control makes it impossible to determine the -most recent version of a variable. In these cases, the compiler -inserts an artificial definition for that variable called -@dfn{PHI function} or @dfn{PHI node}. This new definition merges -all the incoming versions of the variable to create a new name -for it. For instance, - -@smallexample -if (@dots{}) - a_1 = 5; -else if (@dots{}) - a_2 = 2; -else - a_3 = 13; - -# a_4 = PHI -return a_4; -@end smallexample - -Since it is not possible to determine which of the three branches -will be taken at runtime, we don't know which of @code{a_1}, -@code{a_2} or @code{a_3} to use at the return statement. So, the -SSA renamer creates a new version @code{a_4} which is assigned -the result of ``merging'' @code{a_1}, @code{a_2} and @code{a_3}. -Hence, PHI nodes mean ``one of these operands. I don't know -which''. - -The following functions can be used to examine PHI nodes - -@defun gimple_phi_result (@var{phi}) -Returns the @code{SSA_NAME} created by PHI node @var{phi} (i.e., -@var{phi}'s LHS)@. -@end defun - -@defun gimple_phi_num_args (@var{phi}) -Returns the number of arguments in @var{phi}. This number is exactly -the number of incoming edges to the basic block holding @var{phi}@. -@end defun - -@defun gimple_phi_arg (@var{phi}, @var{i}) -Returns @var{i}th argument of @var{phi}@. -@end defun - -@defun gimple_phi_arg_edge (@var{phi}, @var{i}) -Returns the incoming edge for the @var{i}th argument of @var{phi}. -@end defun - -@defun gimple_phi_arg_def (@var{phi}, @var{i}) -Returns the @code{SSA_NAME} for the @var{i}th argument of @var{phi}. -@end defun - - -@subsection Preserving the SSA form -@findex update_ssa -@cindex preserving SSA form -Some optimization passes make changes to the function that -invalidate the SSA property. This can happen when a pass has -added new symbols or changed the program so that variables that -were previously aliased aren't anymore. Whenever something like this -happens, the affected symbols must be renamed into SSA form again. -Transformations that emit new code or replicate existing statements -will also need to update the SSA form@. - -Since GCC implements two different SSA forms for register and virtual -variables, keeping the SSA form up to date depends on whether you are -updating register or virtual names. In both cases, the general idea -behind incremental SSA updates is similar: when new SSA names are -created, they typically are meant to replace other existing names in -the program@. - -For instance, given the following code: - -@smallexample - 1 L0: - 2 x_1 = PHI (0, x_5) - 3 if (x_1 < 10) - 4 if (x_1 > 7) - 5 y_2 = 0 - 6 else - 7 y_3 = x_1 + x_7 - 8 endif - 9 x_5 = x_1 + 1 - 10 goto L0; - 11 endif -@end smallexample - -Suppose that we insert new names @code{x_10} and @code{x_11} (lines -@code{4} and @code{8})@. - -@smallexample - 1 L0: - 2 x_1 = PHI (0, x_5) - 3 if (x_1 < 10) - 4 x_10 = @dots{} - 5 if (x_1 > 7) - 6 y_2 = 0 - 7 else - 8 x_11 = @dots{} - 9 y_3 = x_1 + x_7 - 10 endif - 11 x_5 = x_1 + 1 - 12 goto L0; - 13 endif -@end smallexample - -We want to replace all the uses of @code{x_1} with the new definitions -of @code{x_10} and @code{x_11}. Note that the only uses that should -be replaced are those at lines @code{5}, @code{9} and @code{11}. -Also, the use of @code{x_7} at line @code{9} should @emph{not} be -replaced (this is why we cannot just mark symbol @code{x} for -renaming)@. - -Additionally, we may need to insert a PHI node at line @code{11} -because that is a merge point for @code{x_10} and @code{x_11}. So the -use of @code{x_1} at line @code{11} will be replaced with the new PHI -node. The insertion of PHI nodes is optional. They are not strictly -necessary to preserve the SSA form, and depending on what the caller -inserted, they may not even be useful for the optimizers@. - -Updating the SSA form is a two step process. First, the pass has to -identify which names need to be updated and/or which symbols need to -be renamed into SSA form for the first time. When new names are -introduced to replace existing names in the program, the mapping -between the old and the new names are registered by calling -@code{register_new_name_mapping} (note that if your pass creates new -code by duplicating basic blocks, the call to @code{tree_duplicate_bb} -will set up the necessary mappings automatically). - -After the replacement mappings have been registered and new symbols -marked for renaming, a call to @code{update_ssa} makes the registered -changes. This can be done with an explicit call or by creating -@code{TODO} flags in the @code{tree_opt_pass} structure for your pass. -There are several @code{TODO} flags that control the behavior of -@code{update_ssa}: - -@itemize @bullet -@item @code{TODO_update_ssa}. Update the SSA form inserting PHI nodes -for newly exposed symbols and virtual names marked for updating. -When updating real names, only insert PHI nodes for a real name -@code{O_j} in blocks reached by all the new and old definitions for -@code{O_j}. If the iterated dominance frontier for @code{O_j} -is not pruned, we may end up inserting PHI nodes in blocks that -have one or more edges with no incoming definition for -@code{O_j}. This would lead to uninitialized warnings for -@code{O_j}'s symbol@. - -@item @code{TODO_update_ssa_no_phi}. Update the SSA form without -inserting any new PHI nodes at all. This is used by passes that -have either inserted all the PHI nodes themselves or passes that -need only to patch use-def and def-def chains for virtuals -(e.g., DCE)@. - - -@item @code{TODO_update_ssa_full_phi}. Insert PHI nodes everywhere -they are needed. No pruning of the IDF is done. This is used -by passes that need the PHI nodes for @code{O_j} even if it -means that some arguments will come from the default definition -of @code{O_j}'s symbol (e.g., @code{pass_linear_transform})@. - -WARNING: If you need to use this flag, chances are that your -pass may be doing something wrong. Inserting PHI nodes for an -old name where not all edges carry a new replacement may lead to -silent codegen errors or spurious uninitialized warnings@. - -@item @code{TODO_update_ssa_only_virtuals}. Passes that update the -SSA form on their own may want to delegate the updating of -virtual names to the generic updater. Since FUD chains are -easier to maintain, this simplifies the work they need to do. -NOTE: If this flag is used, any OLD->NEW mappings for real names -are explicitly destroyed and only the symbols marked for -renaming are processed@. -@end itemize - -@subsection Preserving the virtual SSA form -@cindex preserving virtual SSA form - -The virtual SSA form is harder to preserve than the non-virtual SSA form -mainly because the set of virtual operands for a statement may change at -what some would consider unexpected times. In general, statement -modifications should be bracketed between calls to -@code{push_stmt_changes} and @code{pop_stmt_changes}. For example, - -@smallexample - munge_stmt (tree stmt) - @{ - push_stmt_changes (&stmt); - @dots{} rewrite STMT @dots{} - pop_stmt_changes (&stmt); - @} -@end smallexample - -The call to @code{push_stmt_changes} saves the current state of the -statement operands and the call to @code{pop_stmt_changes} compares -the saved state with the current one and does the appropriate symbol -marking for the SSA renamer. - -It is possible to modify several statements at a time, provided that -@code{push_stmt_changes} and @code{pop_stmt_changes} are called in -LIFO order, as when processing a stack of statements. - -Additionally, if the pass discovers that it did not need to make -changes to the statement after calling @code{push_stmt_changes}, it -can simply discard the topmost change buffer by calling -@code{discard_stmt_changes}. This will avoid the expensive operand -re-scan operation and the buffer comparison that determines if symbols -need to be marked for renaming. - -@subsection Examining @code{SSA_NAME} nodes -@cindex examining SSA_NAMEs - -The following macros can be used to examine @code{SSA_NAME} nodes - -@defmac SSA_NAME_DEF_STMT (@var{var}) -Returns the statement @var{s} that creates the @code{SSA_NAME} -@var{var}. If @var{s} is an empty statement (i.e., @code{IS_EMPTY_STMT -(@var{s})} returns @code{true}), it means that the first reference to -this variable is a USE or a VUSE@. -@end defmac - -@defmac SSA_NAME_VERSION (@var{var}) -Returns the version number of the @code{SSA_NAME} object @var{var}. -@end defmac - - -@subsection Walking the dominator tree - -@deftypefn {Tree SSA function} void walk_dominator_tree (@var{walk_data}, @var{bb}) - -This function walks the dominator tree for the current CFG calling a -set of callback functions defined in @var{struct dom_walk_data} in -@file{domwalk.h}. The call back functions you need to define give you -hooks to execute custom code at various points during traversal: - -@enumerate -@item Once to initialize any local data needed while processing -@var{bb} and its children. This local data is pushed into an -internal stack which is automatically pushed and popped as the -walker traverses the dominator tree. - -@item Once before traversing all the statements in the @var{bb}. - -@item Once for every statement inside @var{bb}. - -@item Once after traversing all the statements and before recursing -into @var{bb}'s dominator children. - -@item It then recurses into all the dominator children of @var{bb}. - -@item After recursing into all the dominator children of @var{bb} it -can, optionally, traverse every statement in @var{bb} again -(i.e., repeating steps 2 and 3). - -@item Once after walking the statements in @var{bb} and @var{bb}'s -dominator children. At this stage, the block local data stack -is popped. -@end enumerate -@end deftypefn - -@node Alias analysis -@section Alias analysis -@cindex alias -@cindex flow-sensitive alias analysis -@cindex flow-insensitive alias analysis - -Alias analysis in GIMPLE SSA form consists of two pieces. First -the virtual SSA web ties conflicting memory accesses and provides -a SSA use-def chain and SSA immediate-use chains for walking -possibly dependent memory accesses. Second an alias-oracle can -be queried to disambiguate explicit and implicit memory references. - -@enumerate -@item Memory SSA form. - -All statements that may use memory have exactly one accompanied use of -a virtual SSA name that represents the state of memory at the -given point in the IL. - -All statements that may define memory have exactly one accompanied -definition of a virtual SSA name using the previous state of memory -and defining the new state of memory after the given point in the IL. - -@smallexample -int i; -int foo (void) -@{ - # .MEM_3 = VDEF <.MEM_2(D)> - i = 1; - # VUSE <.MEM_3> - return i; -@} -@end smallexample - -The virtual SSA names in this case are @code{.MEM_2(D)} and -@code{.MEM_3}. The store to the global variable @code{i} -defines @code{.MEM_3} invalidating @code{.MEM_2(D)}. The -load from @code{i} uses that new state @code{.MEM_3}. - -The virtual SSA web serves as constraints to SSA optimizers -preventing illegitimate code-motion and optimization. It -also provides a way to walk related memory statements. - -@item Points-to and escape analysis. - -Points-to analysis builds a set of constraints from the GIMPLE -SSA IL representing all pointer operations and facts we do -or do not know about pointers. Solving this set of constraints -yields a conservatively correct solution for each pointer -variable in the program (though we are only interested in -SSA name pointers) as to what it may possibly point to. - -This points-to solution for a given SSA name pointer is stored -in the @code{pt_solution} sub-structure of the -@code{SSA_NAME_PTR_INFO} record. The following accessor -functions are available: - -@itemize @bullet -@item @code{pt_solution_includes} -@item @code{pt_solutions_intersect} -@end itemize - -Points-to analysis also computes the solution for two special -set of pointers, @code{ESCAPED} and @code{CALLUSED}. Those -represent all memory that has escaped the scope of analysis -or that is used by pure or nested const calls. - -@item Type-based alias analysis - -Type-based alias analysis is frontend dependent though generic -support is provided by the middle-end in @code{alias.c}. TBAA -code is used by both tree optimizers and RTL optimizers. - -Every language that wishes to perform language-specific alias analysis -should define a function that computes, given a @code{tree} -node, an alias set for the node. Nodes in different alias sets are not -allowed to alias. For an example, see the C front-end function -@code{c_get_alias_set}. - -@item Tree alias-oracle - -The tree alias-oracle provides means to disambiguate two memory -references and memory references against statements. The following -queries are available: - -@itemize @bullet -@item @code{refs_may_alias_p} -@item @code{ref_maybe_used_by_stmt_p} -@item @code{stmt_may_clobber_ref_p} -@end itemize - -In addition to those two kind of statement walkers are available -walking statements related to a reference ref. -@code{walk_non_aliased_vuses} walks over dominating memory defining -statements and calls back if the statement does not clobber ref -providing the non-aliased VUSE. The walk stops at -the first clobbering statement or if asked to. -@code{walk_aliased_vdefs} walks over dominating memory defining -statements and calls back on each statement clobbering ref -providing its aliasing VDEF. The walk stops if asked to. - -@end enumerate - - -@node Memory model -@section Memory model -@cindex memory model - -The memory model used by the middle-end models that of the C/C++ -languages. The middle-end has the notion of an effective type -of a memory region which is used for type-based alias analysis. - -The following is a refinement of ISO C99 6.5/6, clarifying the block copy case -to follow common sense and extending the concept of a dynamic effective -type to objects with a declared type as required for C++. - -@smallexample -The effective type of an object for an access to its stored value is -the declared type of the object or the effective type determined by -a previous store to it. If a value is stored into an object through -an lvalue having a type that is not a character type, then the -type of the lvalue becomes the effective type of the object for that -access and for subsequent accesses that do not modify the stored value. -If a value is copied into an object using @code{memcpy} or @code{memmove}, -or is copied as an array of character type, then the effective type -of the modified object for that access and for subsequent accesses that -do not modify the value is undetermined. For all other accesses to an -object, the effective type of the object is simply the type of the -lvalue used for the access. -@end smallexample - diff --git a/contrib/gcc-5.0/gcc/doc/trouble.texi b/contrib/gcc-5.0/gcc/doc/trouble.texi deleted file mode 100644 index f2baff477d..0000000000 --- a/contrib/gcc-5.0/gcc/doc/trouble.texi +++ /dev/null @@ -1,1196 +0,0 @@ -@c Copyright (C) 1988-2015 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file gcc.texi. - -@node Trouble -@chapter Known Causes of Trouble with GCC -@cindex bugs, known -@cindex installation trouble -@cindex known causes of trouble - -This section describes known problems that affect users of GCC@. Most -of these are not GCC bugs per se---if they were, we would fix them. -But the result for a user may be like the result of a bug. - -Some of these problems are due to bugs in other software, some are -missing features that are too much work to add, and some are places -where people's opinions differ as to what is best. - -@menu -* Actual Bugs:: Bugs we will fix later. -* Interoperation:: Problems using GCC with other compilers, - and with certain linkers, assemblers and debuggers. -* Incompatibilities:: GCC is incompatible with traditional C. -* Fixed Headers:: GCC uses corrected versions of system header files. - This is necessary, but doesn't always work smoothly. -* Standard Libraries:: GCC uses the system C library, which might not be - compliant with the ISO C standard. -* Disappointments:: Regrettable things we can't change, but not quite bugs. -* C++ Misunderstandings:: Common misunderstandings with GNU C++. -* Non-bugs:: Things we think are right, but some others disagree. -* Warnings and Errors:: Which problems in your code get warnings, - and which get errors. -@end menu - -@node Actual Bugs -@section Actual Bugs We Haven't Fixed Yet - -@itemize @bullet -@item -The @code{fixincludes} script interacts badly with automounters; if the -directory of system header files is automounted, it tends to be -unmounted while @code{fixincludes} is running. This would seem to be a -bug in the automounter. We don't know any good way to work around it. -@end itemize - -@node Interoperation -@section Interoperation - -This section lists various difficulties encountered in using GCC -together with other compilers or with the assemblers, linkers, -libraries and debuggers on certain systems. - -@itemize @bullet -@item -On many platforms, GCC supports a different ABI for C++ than do other -compilers, so the object files compiled by GCC cannot be used with object -files generated by another C++ compiler. - -An area where the difference is most apparent is name mangling. The use -of different name mangling is intentional, to protect you from more subtle -problems. -Compilers differ as to many internal details of C++ implementation, -including: how class instances are laid out, how multiple inheritance is -implemented, and how virtual function calls are handled. If the name -encoding were made the same, your programs would link against libraries -provided from other compilers---but the programs would then crash when -run. Incompatible libraries are then detected at link time, rather than -at run time. - -@item -On some BSD systems, including some versions of Ultrix, use of profiling -causes static variable destructors (currently used only in C++) not to -be run. - -@item -On a SPARC, GCC aligns all values of type @code{double} on an 8-byte -boundary, and it expects every @code{double} to be so aligned. The Sun -compiler usually gives @code{double} values 8-byte alignment, with one -exception: function arguments of type @code{double} may not be aligned. - -As a result, if a function compiled with Sun CC takes the address of an -argument of type @code{double} and passes this pointer of type -@code{double *} to a function compiled with GCC, dereferencing the -pointer may cause a fatal signal. - -One way to solve this problem is to compile your entire program with GCC@. -Another solution is to modify the function that is compiled with -Sun CC to copy the argument into a local variable; local variables -are always properly aligned. A third solution is to modify the function -that uses the pointer to dereference it via the following function -@code{access_double} instead of directly with @samp{*}: - -@smallexample -inline double -access_double (double *unaligned_ptr) -@{ - union d2i @{ double d; int i[2]; @}; - - union d2i *p = (union d2i *) unaligned_ptr; - union d2i u; - - u.i[0] = p->i[0]; - u.i[1] = p->i[1]; - - return u.d; -@} -@end smallexample - -@noindent -Storing into the pointer can be done likewise with the same union. - -@item -On Solaris, the @code{malloc} function in the @file{libmalloc.a} library -may allocate memory that is only 4 byte aligned. Since GCC on the -SPARC assumes that doubles are 8 byte aligned, this may result in a -fatal signal if doubles are stored in memory allocated by the -@file{libmalloc.a} library. - -The solution is to not use the @file{libmalloc.a} library. Use instead -@code{malloc} and related functions from @file{libc.a}; they do not have -this problem. - -@item -On the HP PA machine, ADB sometimes fails to work on functions compiled -with GCC@. Specifically, it fails to work on functions that use -@code{alloca} or variable-size arrays. This is because GCC doesn't -generate HP-UX unwind descriptors for such functions. It may even be -impossible to generate them. - -@item -Debugging (@option{-g}) is not supported on the HP PA machine, unless you use -the preliminary GNU tools. - -@item -Taking the address of a label may generate errors from the HP-UX -PA assembler. GAS for the PA does not have this problem. - -@item -Using floating point parameters for indirect calls to static functions -will not work when using the HP assembler. There simply is no way for GCC -to specify what registers hold arguments for static functions when using -the HP assembler. GAS for the PA does not have this problem. - -@item -In extremely rare cases involving some very large functions you may -receive errors from the HP linker complaining about an out of bounds -unconditional branch offset. This used to occur more often in previous -versions of GCC, but is now exceptionally rare. If you should run -into it, you can work around by making your function smaller. - -@item -GCC compiled code sometimes emits warnings from the HP-UX assembler of -the form: - -@smallexample -(warning) Use of GR3 when - frame >= 8192 may cause conflict. -@end smallexample - -These warnings are harmless and can be safely ignored. - -@item -In extremely rare cases involving some very large functions you may -receive errors from the AIX Assembler complaining about a displacement -that is too large. If you should run into it, you can work around by -making your function smaller. - -@item -The @file{libstdc++.a} library in GCC relies on the SVR4 dynamic -linker semantics which merges global symbols between libraries and -applications, especially necessary for C++ streams functionality. -This is not the default behavior of AIX shared libraries and dynamic -linking. @file{libstdc++.a} is built on AIX with ``runtime-linking'' -enabled so that symbol merging can occur. To utilize this feature, -the application linked with @file{libstdc++.a} must include the -@option{-Wl,-brtl} flag on the link line. G++ cannot impose this -because this option may interfere with the semantics of the user -program and users may not always use @samp{g++} to link his or her -application. Applications are not required to use the -@option{-Wl,-brtl} flag on the link line---the rest of the -@file{libstdc++.a} library which is not dependent on the symbol -merging semantics will continue to function correctly. - -@item -An application can interpose its own definition of functions for -functions invoked by @file{libstdc++.a} with ``runtime-linking'' -enabled on AIX@. To accomplish this the application must be linked -with ``runtime-linking'' option and the functions explicitly must be -exported by the application (@option{-Wl,-brtl,-bE:exportfile}). - -@item -AIX on the RS/6000 provides support (NLS) for environments outside of -the United States. Compilers and assemblers use NLS to support -locale-specific representations of various objects including -floating-point numbers (@samp{.} vs @samp{,} for separating decimal -fractions). There have been problems reported where the library linked -with GCC does not produce the same floating-point formats that the -assembler accepts. If you have this problem, set the @env{LANG} -environment variable to @samp{C} or @samp{En_US}. - -@item -@opindex fdollars-in-identifiers -Even if you specify @option{-fdollars-in-identifiers}, -you cannot successfully use @samp{$} in identifiers on the RS/6000 due -to a restriction in the IBM assembler. GAS supports these -identifiers. - -@end itemize - -@node Incompatibilities -@section Incompatibilities of GCC -@cindex incompatibilities of GCC -@opindex traditional - -There are several noteworthy incompatibilities between GNU C and K&R -(non-ISO) versions of C@. - -@itemize @bullet -@cindex string constants -@cindex read-only strings -@cindex shared strings -@item -GCC normally makes string constants read-only. If several -identical-looking string constants are used, GCC stores only one -copy of the string. - -@cindex @code{mktemp}, and constant strings -One consequence is that you cannot call @code{mktemp} with a string -constant argument. The function @code{mktemp} always alters the -string its argument points to. - -@cindex @code{sscanf}, and constant strings -@cindex @code{fscanf}, and constant strings -@cindex @code{scanf}, and constant strings -Another consequence is that @code{sscanf} does not work on some very -old systems when passed a string constant as its format control string -or input. This is because @code{sscanf} incorrectly tries to write -into the string constant. Likewise @code{fscanf} and @code{scanf}. - -The solution to these problems is to change the program to use -@code{char}-array variables with initialization strings for these -purposes instead of string constants. - -@item -@code{-2147483648} is positive. - -This is because 2147483648 cannot fit in the type @code{int}, so -(following the ISO C rules) its data type is @code{unsigned long int}. -Negating this value yields 2147483648 again. - -@item -GCC does not substitute macro arguments when they appear inside of -string constants. For example, the following macro in GCC - -@smallexample -#define foo(a) "a" -@end smallexample - -@noindent -will produce output @code{"a"} regardless of what the argument @var{a} is. - -@cindex @code{setjmp} incompatibilities -@cindex @code{longjmp} incompatibilities -@item -When you use @code{setjmp} and @code{longjmp}, the only automatic -variables guaranteed to remain valid are those declared -@code{volatile}. This is a consequence of automatic register -allocation. Consider this function: - -@smallexample -jmp_buf j; - -foo () -@{ - int a, b; - - a = fun1 (); - if (setjmp (j)) - return a; - - a = fun2 (); - /* @r{@code{longjmp (j)} may occur in @code{fun3}.} */ - return a + fun3 (); -@} -@end smallexample - -Here @code{a} may or may not be restored to its first value when the -@code{longjmp} occurs. If @code{a} is allocated in a register, then -its first value is restored; otherwise, it keeps the last value stored -in it. - -@opindex W -If you use the @option{-W} option with the @option{-O} option, you will -get a warning when GCC thinks such a problem might be possible. - -@item -Programs that use preprocessing directives in the middle of macro -arguments do not work with GCC@. For example, a program like this -will not work: - -@smallexample -@group -foobar ( -#define luser - hack) -@end group -@end smallexample - -ISO C does not permit such a construct. - -@item -K&R compilers allow comments to cross over an inclusion boundary -(i.e.@: started in an include file and ended in the including file). - -@cindex external declaration scope -@cindex scope of external declarations -@cindex declaration scope -@item -Declarations of external variables and functions within a block apply -only to the block containing the declaration. In other words, they -have the same scope as any other declaration in the same place. - -In some other C compilers, an @code{extern} declaration affects all the -rest of the file even if it happens within a block. - -@item -In traditional C, you can combine @code{long}, etc., with a typedef name, -as shown here: - -@smallexample -typedef int foo; -typedef long foo bar; -@end smallexample - -In ISO C, this is not allowed: @code{long} and other type modifiers -require an explicit @code{int}. - -@cindex typedef names as function parameters -@item -PCC allows typedef names to be used as function parameters. - -@item -Traditional C allows the following erroneous pair of declarations to -appear together in a given scope: - -@smallexample -typedef int foo; -typedef foo foo; -@end smallexample - -@item -GCC treats all characters of identifiers as significant. According to -K&R-1 (2.2), ``No more than the first eight characters are significant, -although more may be used.''. Also according to K&R-1 (2.2), ``An -identifier is a sequence of letters and digits; the first character must -be a letter. The underscore _ counts as a letter.'', but GCC also -allows dollar signs in identifiers. - -@cindex whitespace -@item -PCC allows whitespace in the middle of compound assignment operators -such as @samp{+=}. GCC, following the ISO standard, does not -allow this. - -@cindex apostrophes -@cindex @code{'} -@item -GCC complains about unterminated character constants inside of -preprocessing conditionals that fail. Some programs have English -comments enclosed in conditionals that are guaranteed to fail; if these -comments contain apostrophes, GCC will probably report an error. For -example, this code would produce an error: - -@smallexample -#if 0 -You can't expect this to work. -#endif -@end smallexample - -The best solution to such a problem is to put the text into an actual -C comment delimited by @samp{/*@dots{}*/}. - -@item -Many user programs contain the declaration @samp{long time ();}. In the -past, the system header files on many systems did not actually declare -@code{time}, so it did not matter what type your program declared it to -return. But in systems with ISO C headers, @code{time} is declared to -return @code{time_t}, and if that is not the same as @code{long}, then -@samp{long time ();} is erroneous. - -The solution is to change your program to use appropriate system headers -(@code{} on systems with ISO C headers) and not to declare -@code{time} if the system header files declare it, or failing that to -use @code{time_t} as the return type of @code{time}. - -@cindex @code{float} as function value type -@item -When compiling functions that return @code{float}, PCC converts it to -a double. GCC actually returns a @code{float}. If you are concerned -with PCC compatibility, you should declare your functions to return -@code{double}; you might as well say what you mean. - -@cindex structures -@cindex unions -@item -When compiling functions that return structures or unions, GCC -output code normally uses a method different from that used on most -versions of Unix. As a result, code compiled with GCC cannot call -a structure-returning function compiled with PCC, and vice versa. - -The method used by GCC is as follows: a structure or union which is -1, 2, 4 or 8 bytes long is returned like a scalar. A structure or union -with any other size is stored into an address supplied by the caller -(usually in a special, fixed register, but on some machines it is passed -on the stack). The target hook @code{TARGET_STRUCT_VALUE_RTX} -tells GCC where to pass this address. - -By contrast, PCC on most target machines returns structures and unions -of any size by copying the data into an area of static storage, and then -returning the address of that storage as if it were a pointer value. -The caller must copy the data from that memory area to the place where -the value is wanted. GCC does not use this method because it is -slower and nonreentrant. - -On some newer machines, PCC uses a reentrant convention for all -structure and union returning. GCC on most of these machines uses a -compatible convention when returning structures and unions in memory, -but still returns small structures and unions in registers. - -@opindex fpcc-struct-return -You can tell GCC to use a compatible convention for all structure and -union returning with the option @option{-fpcc-struct-return}. - -@cindex preprocessing tokens -@cindex preprocessing numbers -@item -GCC complains about program fragments such as @samp{0x74ae-0x4000} -which appear to be two hexadecimal constants separated by the minus -operator. Actually, this string is a single @dfn{preprocessing token}. -Each such token must correspond to one token in C@. Since this does not, -GCC prints an error message. Although it may appear obvious that what -is meant is an operator and two values, the ISO C standard specifically -requires that this be treated as erroneous. - -A @dfn{preprocessing token} is a @dfn{preprocessing number} if it -begins with a digit and is followed by letters, underscores, digits, -periods and @samp{e+}, @samp{e-}, @samp{E+}, @samp{E-}, @samp{p+}, -@samp{p-}, @samp{P+}, or @samp{P-} character sequences. (In strict C90 -mode, the sequences @samp{p+}, @samp{p-}, @samp{P+} and @samp{P-} cannot -appear in preprocessing numbers.) - -To make the above program fragment valid, place whitespace in front of -the minus sign. This whitespace will end the preprocessing number. -@end itemize - -@node Fixed Headers -@section Fixed Header Files - -GCC needs to install corrected versions of some system header files. -This is because most target systems have some header files that won't -work with GCC unless they are changed. Some have bugs, some are -incompatible with ISO C, and some depend on special features of other -compilers. - -Installing GCC automatically creates and installs the fixed header -files, by running a program called @code{fixincludes}. Normally, you -don't need to pay attention to this. But there are cases where it -doesn't do the right thing automatically. - -@itemize @bullet -@item -If you update the system's header files, such as by installing a new -system version, the fixed header files of GCC are not automatically -updated. They can be updated using the @command{mkheaders} script -installed in -@file{@var{libexecdir}/gcc/@var{target}/@var{version}/install-tools/}. - -@item -On some systems, header file directories contain -machine-specific symbolic links in certain places. This makes it -possible to share most of the header files among hosts running the -same version of the system on different machine models. - -The programs that fix the header files do not understand this special -way of using symbolic links; therefore, the directory of fixed header -files is good only for the machine model used to build it. - -It is possible to make separate sets of fixed header files for the -different machine models, and arrange a structure of symbolic links so -as to use the proper set, but you'll have to do this by hand. -@end itemize - -@node Standard Libraries -@section Standard Libraries - -@opindex Wall -GCC by itself attempts to be a conforming freestanding implementation. -@xref{Standards,,Language Standards Supported by GCC}, for details of -what this means. Beyond the library facilities required of such an -implementation, the rest of the C library is supplied by the vendor of -the operating system. If that C library doesn't conform to the C -standards, then your programs might get warnings (especially when using -@option{-Wall}) that you don't expect. - -For example, the @code{sprintf} function on SunOS 4.1.3 returns -@code{char *} while the C standard says that @code{sprintf} returns an -@code{int}. The @code{fixincludes} program could make the prototype for -this function match the Standard, but that would be wrong, since the -function will still return @code{char *}. - -If you need a Standard compliant library, then you need to find one, as -GCC does not provide one. The GNU C library (called @code{glibc}) -provides ISO C, POSIX, BSD, SystemV and X/Open compatibility for -GNU/Linux and HURD-based GNU systems; no recent version of it supports -other systems, though some very old versions did. Version 2.2 of the -GNU C library includes nearly complete C99 support. You could also ask -your operating system vendor if newer libraries are available. - -@node Disappointments -@section Disappointments and Misunderstandings - -These problems are perhaps regrettable, but we don't know any practical -way around them. - -@itemize @bullet -@item -Certain local variables aren't recognized by debuggers when you compile -with optimization. - -This occurs because sometimes GCC optimizes the variable out of -existence. There is no way to tell the debugger how to compute the -value such a variable ``would have had'', and it is not clear that would -be desirable anyway. So GCC simply does not mention the eliminated -variable when it writes debugging information. - -You have to expect a certain amount of disagreement between the -executable and your source code, when you use optimization. - -@cindex conflicting types -@cindex scope of declaration -@item -Users often think it is a bug when GCC reports an error for code -like this: - -@smallexample -int foo (struct mumble *); - -struct mumble @{ @dots{} @}; - -int foo (struct mumble *x) -@{ @dots{} @} -@end smallexample - -This code really is erroneous, because the scope of @code{struct -mumble} in the prototype is limited to the argument list containing it. -It does not refer to the @code{struct mumble} defined with file scope -immediately below---they are two unrelated types with similar names in -different scopes. - -But in the definition of @code{foo}, the file-scope type is used -because that is available to be inherited. Thus, the definition and -the prototype do not match, and you get an error. - -This behavior may seem silly, but it's what the ISO standard specifies. -It is easy enough for you to make your code work by moving the -definition of @code{struct mumble} above the prototype. It's not worth -being incompatible with ISO C just to avoid an error for the example -shown above. - -@item -Accesses to bit-fields even in volatile objects works by accessing larger -objects, such as a byte or a word. You cannot rely on what size of -object is accessed in order to read or write the bit-field; it may even -vary for a given bit-field according to the precise usage. - -If you care about controlling the amount of memory that is accessed, use -volatile but do not use bit-fields. - -@item -GCC comes with shell scripts to fix certain known problems in system -header files. They install corrected copies of various header files in -a special directory where only GCC will normally look for them. The -scripts adapt to various systems by searching all the system header -files for the problem cases that we know about. - -If new system header files are installed, nothing automatically arranges -to update the corrected header files. They can be updated using the -@command{mkheaders} script installed in -@file{@var{libexecdir}/gcc/@var{target}/@var{version}/install-tools/}. - -@item -@cindex floating point precision -On 68000 and x86 systems, for instance, you can get paradoxical results -if you test the precise values of floating point numbers. For example, -you can find that a floating point value which is not a NaN is not equal -to itself. This results from the fact that the floating point registers -hold a few more bits of precision than fit in a @code{double} in memory. -Compiled code moves values between memory and floating point registers -at its convenience, and moving them into memory truncates them. - -@opindex ffloat-store -You can partially avoid this problem by using the @option{-ffloat-store} -option (@pxref{Optimize Options}). - -@item -On AIX and other platforms without weak symbol support, templates -need to be instantiated explicitly and symbols for static members -of templates will not be generated. - -@item -On AIX, GCC scans object files and library archives for static -constructors and destructors when linking an application before the -linker prunes unreferenced symbols. This is necessary to prevent the -AIX linker from mistakenly assuming that static constructor or -destructor are unused and removing them before the scanning can occur. -All static constructors and destructors found will be referenced even -though the modules in which they occur may not be used by the program. -This may lead to both increased executable size and unexpected symbol -references. -@end itemize - -@node C++ Misunderstandings -@section Common Misunderstandings with GNU C++ - -@cindex misunderstandings in C++ -@cindex surprises in C++ -@cindex C++ misunderstandings -C++ is a complex language and an evolving one, and its standard -definition (the ISO C++ standard) was only recently completed. As a -result, your C++ compiler may occasionally surprise you, even when its -behavior is correct. This section discusses some areas that frequently -give rise to questions of this sort. - -@menu -* Static Definitions:: Static member declarations are not definitions -* Name lookup:: Name lookup, templates, and accessing members of base classes -* Temporaries:: Temporaries may vanish before you expect -* Copy Assignment:: Copy Assignment operators copy virtual bases twice -@end menu - -@node Static Definitions -@subsection Declare @emph{and} Define Static Members - -@cindex C++ static data, declaring and defining -@cindex static data in C++, declaring and defining -@cindex declaring static data in C++ -@cindex defining static data in C++ -When a class has static data members, it is not enough to @emph{declare} -the static member; you must also @emph{define} it. For example: - -@smallexample -class Foo -@{ - @dots{} - void method(); - static int bar; -@}; -@end smallexample - -This declaration only establishes that the class @code{Foo} has an -@code{int} named @code{Foo::bar}, and a member function named -@code{Foo::method}. But you still need to define @emph{both} -@code{method} and @code{bar} elsewhere. According to the ISO -standard, you must supply an initializer in one (and only one) source -file, such as: - -@smallexample -int Foo::bar = 0; -@end smallexample - -Other C++ compilers may not correctly implement the standard behavior. -As a result, when you switch to @command{g++} from one of these compilers, -you may discover that a program that appeared to work correctly in fact -does not conform to the standard: @command{g++} reports as undefined -symbols any static data members that lack definitions. - - -@node Name lookup -@subsection Name Lookup, Templates, and Accessing Members of Base Classes - -@cindex base class members -@cindex two-stage name lookup -@cindex dependent name lookup - -The C++ standard prescribes that all names that are not dependent on -template parameters are bound to their present definitions when parsing -a template function or class.@footnote{The C++ standard just uses the -term ``dependent'' for names that depend on the type or value of -template parameters. This shorter term will also be used in the rest of -this section.} Only names that are dependent are looked up at the point -of instantiation. For example, consider - -@smallexample - void foo(double); - - struct A @{ - template - void f () @{ - foo (1); // @r{1} - int i = N; // @r{2} - T t; - t.bar(); // @r{3} - foo (t); // @r{4} - @} - - static const int N; - @}; -@end smallexample - -Here, the names @code{foo} and @code{N} appear in a context that does -not depend on the type of @code{T}. The compiler will thus require that -they are defined in the context of use in the template, not only before -the point of instantiation, and will here use @code{::foo(double)} and -@code{A::N}, respectively. In particular, it will convert the integer -value to a @code{double} when passing it to @code{::foo(double)}. - -Conversely, @code{bar} and the call to @code{foo} in the fourth marked -line are used in contexts that do depend on the type of @code{T}, so -they are only looked up at the point of instantiation, and you can -provide declarations for them after declaring the template, but before -instantiating it. In particular, if you instantiate @code{A::f}, -the last line will call an overloaded @code{::foo(int)} if one was -provided, even if after the declaration of @code{struct A}. - -This distinction between lookup of dependent and non-dependent names is -called two-stage (or dependent) name lookup. G++ implements it -since version 3.4. - -Two-stage name lookup sometimes leads to situations with behavior -different from non-template codes. The most common is probably this: - -@smallexample - template struct Base @{ - int i; - @}; - - template struct Derived : public Base @{ - int get_i() @{ return i; @} - @}; -@end smallexample - -In @code{get_i()}, @code{i} is not used in a dependent context, so the -compiler will look for a name declared at the enclosing namespace scope -(which is the global scope here). It will not look into the base class, -since that is dependent and you may declare specializations of -@code{Base} even after declaring @code{Derived}, so the compiler can't -really know what @code{i} would refer to. If there is no global -variable @code{i}, then you will get an error message. - -In order to make it clear that you want the member of the base class, -you need to defer lookup until instantiation time, at which the base -class is known. For this, you need to access @code{i} in a dependent -context, by either using @code{this->i} (remember that @code{this} is of -type @code{Derived*}, so is obviously dependent), or using -@code{Base::i}. Alternatively, @code{Base::i} might be brought -into scope by a @code{using}-declaration. - -Another, similar example involves calling member functions of a base -class: - -@smallexample - template struct Base @{ - int f(); - @}; - - template struct Derived : Base @{ - int g() @{ return f(); @}; - @}; -@end smallexample - -Again, the call to @code{f()} is not dependent on template arguments -(there are no arguments that depend on the type @code{T}, and it is also -not otherwise specified that the call should be in a dependent context). -Thus a global declaration of such a function must be available, since -the one in the base class is not visible until instantiation time. The -compiler will consequently produce the following error message: - -@smallexample - x.cc: In member function `int Derived::g()': - x.cc:6: error: there are no arguments to `f' that depend on a template - parameter, so a declaration of `f' must be available - x.cc:6: error: (if you use `-fpermissive', G++ will accept your code, but - allowing the use of an undeclared name is deprecated) -@end smallexample - -To make the code valid either use @code{this->f()}, or -@code{Base::f()}. Using the @option{-fpermissive} flag will also let -the compiler accept the code, by marking all function calls for which no -declaration is visible at the time of definition of the template for -later lookup at instantiation time, as if it were a dependent call. -We do not recommend using @option{-fpermissive} to work around invalid -code, and it will also only catch cases where functions in base classes -are called, not where variables in base classes are used (as in the -example above). - -Note that some compilers (including G++ versions prior to 3.4) get these -examples wrong and accept above code without an error. Those compilers -do not implement two-stage name lookup correctly. - - -@node Temporaries -@subsection Temporaries May Vanish Before You Expect - -@cindex temporaries, lifetime of -@cindex portions of temporary objects, pointers to -It is dangerous to use pointers or references to @emph{portions} of a -temporary object. The compiler may very well delete the object before -you expect it to, leaving a pointer to garbage. The most common place -where this problem crops up is in classes like string classes, -especially ones that define a conversion function to type @code{char *} -or @code{const char *}---which is one reason why the standard -@code{string} class requires you to call the @code{c_str} member -function. However, any class that returns a pointer to some internal -structure is potentially subject to this problem. - -For example, a program may use a function @code{strfunc} that returns -@code{string} objects, and another function @code{charfunc} that -operates on pointers to @code{char}: - -@smallexample -string strfunc (); -void charfunc (const char *); - -void -f () -@{ - const char *p = strfunc().c_str(); - @dots{} - charfunc (p); - @dots{} - charfunc (p); -@} -@end smallexample - -@noindent -In this situation, it may seem reasonable to save a pointer to the C -string returned by the @code{c_str} member function and use that rather -than call @code{c_str} repeatedly. However, the temporary string -created by the call to @code{strfunc} is destroyed after @code{p} is -initialized, at which point @code{p} is left pointing to freed memory. - -Code like this may run successfully under some other compilers, -particularly obsolete cfront-based compilers that delete temporaries -along with normal local variables. However, the GNU C++ behavior is -standard-conforming, so if your program depends on late destruction of -temporaries it is not portable. - -The safe way to write such code is to give the temporary a name, which -forces it to remain until the end of the scope of the name. For -example: - -@smallexample -const string& tmp = strfunc (); -charfunc (tmp.c_str ()); -@end smallexample - -@node Copy Assignment -@subsection Implicit Copy-Assignment for Virtual Bases - -When a base class is virtual, only one subobject of the base class -belongs to each full object. Also, the constructors and destructors are -invoked only once, and called from the most-derived class. However, such -objects behave unspecified when being assigned. For example: - -@smallexample -struct Base@{ - char *name; - Base(char *n) : name(strdup(n))@{@} - Base& operator= (const Base& other)@{ - free (name); - name = strdup (other.name); - @} -@}; - -struct A:virtual Base@{ - int val; - A():Base("A")@{@} -@}; - -struct B:virtual Base@{ - int bval; - B():Base("B")@{@} -@}; - -struct Derived:public A, public B@{ - Derived():Base("Derived")@{@} -@}; - -void func(Derived &d1, Derived &d2) -@{ - d1 = d2; -@} -@end smallexample - -The C++ standard specifies that @samp{Base::Base} is only called once -when constructing or copy-constructing a Derived object. It is -unspecified whether @samp{Base::operator=} is called more than once when -the implicit copy-assignment for Derived objects is invoked (as it is -inside @samp{func} in the example). - -G++ implements the ``intuitive'' algorithm for copy-assignment: assign all -direct bases, then assign all members. In that algorithm, the virtual -base subobject can be encountered more than once. In the example, copying -proceeds in the following order: @samp{val}, @samp{name} (via -@code{strdup}), @samp{bval}, and @samp{name} again. - -If application code relies on copy-assignment, a user-defined -copy-assignment operator removes any uncertainties. With such an -operator, the application can define whether and how the virtual base -subobject is assigned. - -@node Non-bugs -@section Certain Changes We Don't Want to Make - -This section lists changes that people frequently request, but which -we do not make because we think GCC is better without them. - -@itemize @bullet -@item -Checking the number and type of arguments to a function which has an -old-fashioned definition and no prototype. - -Such a feature would work only occasionally---only for calls that appear -in the same file as the called function, following the definition. The -only way to check all calls reliably is to add a prototype for the -function. But adding a prototype eliminates the motivation for this -feature. So the feature is not worthwhile. - -@item -Warning about using an expression whose type is signed as a shift count. - -Shift count operands are probably signed more often than unsigned. -Warning about this would cause far more annoyance than good. - -@item -Warning about assigning a signed value to an unsigned variable. - -Such assignments must be very common; warning about them would cause -more annoyance than good. - -@item -Warning when a non-void function value is ignored. - -C contains many standard functions that return a value that most -programs choose to ignore. One obvious example is @code{printf}. -Warning about this practice only leads the defensive programmer to -clutter programs with dozens of casts to @code{void}. Such casts are -required so frequently that they become visual noise. Writing those -casts becomes so automatic that they no longer convey useful -information about the intentions of the programmer. For functions -where the return value should never be ignored, use the -@code{warn_unused_result} function attribute (@pxref{Function -Attributes}). - -@item -@opindex fshort-enums -Making @option{-fshort-enums} the default. - -This would cause storage layout to be incompatible with most other C -compilers. And it doesn't seem very important, given that you can get -the same result in other ways. The case where it matters most is when -the enumeration-valued object is inside a structure, and in that case -you can specify a field width explicitly. - -@item -Making bit-fields unsigned by default on particular machines where ``the -ABI standard'' says to do so. - -The ISO C standard leaves it up to the implementation whether a bit-field -declared plain @code{int} is signed or not. This in effect creates two -alternative dialects of C@. - -@opindex fsigned-bitfields -@opindex funsigned-bitfields -The GNU C compiler supports both dialects; you can specify the signed -dialect with @option{-fsigned-bitfields} and the unsigned dialect with -@option{-funsigned-bitfields}. However, this leaves open the question of -which dialect to use by default. - -Currently, the preferred dialect makes plain bit-fields signed, because -this is simplest. Since @code{int} is the same as @code{signed int} in -every other context, it is cleanest for them to be the same in bit-fields -as well. - -Some computer manufacturers have published Application Binary Interface -standards which specify that plain bit-fields should be unsigned. It is -a mistake, however, to say anything about this issue in an ABI@. This is -because the handling of plain bit-fields distinguishes two dialects of C@. -Both dialects are meaningful on every type of machine. Whether a -particular object file was compiled using signed bit-fields or unsigned -is of no concern to other object files, even if they access the same -bit-fields in the same data structures. - -A given program is written in one or the other of these two dialects. -The program stands a chance to work on most any machine if it is -compiled with the proper dialect. It is unlikely to work at all if -compiled with the wrong dialect. - -Many users appreciate the GNU C compiler because it provides an -environment that is uniform across machines. These users would be -inconvenienced if the compiler treated plain bit-fields differently on -certain machines. - -Occasionally users write programs intended only for a particular machine -type. On these occasions, the users would benefit if the GNU C compiler -were to support by default the same dialect as the other compilers on -that machine. But such applications are rare. And users writing a -program to run on more than one type of machine cannot possibly benefit -from this kind of compatibility. - -This is why GCC does and will treat plain bit-fields in the same -fashion on all types of machines (by default). - -There are some arguments for making bit-fields unsigned by default on all -machines. If, for example, this becomes a universal de facto standard, -it would make sense for GCC to go along with it. This is something -to be considered in the future. - -(Of course, users strongly concerned about portability should indicate -explicitly in each bit-field whether it is signed or not. In this way, -they write programs which have the same meaning in both C dialects.) - -@item -@opindex ansi -@opindex std -Undefining @code{__STDC__} when @option{-ansi} is not used. - -Currently, GCC defines @code{__STDC__} unconditionally. This provides -good results in practice. - -Programmers normally use conditionals on @code{__STDC__} to ask whether -it is safe to use certain features of ISO C, such as function -prototypes or ISO token concatenation. Since plain @command{gcc} supports -all the features of ISO C, the correct answer to these questions is -``yes''. - -Some users try to use @code{__STDC__} to check for the availability of -certain library facilities. This is actually incorrect usage in an ISO -C program, because the ISO C standard says that a conforming -freestanding implementation should define @code{__STDC__} even though it -does not have the library facilities. @samp{gcc -ansi -pedantic} is a -conforming freestanding implementation, and it is therefore required to -define @code{__STDC__}, even though it does not come with an ISO C -library. - -Sometimes people say that defining @code{__STDC__} in a compiler that -does not completely conform to the ISO C standard somehow violates the -standard. This is illogical. The standard is a standard for compilers -that claim to support ISO C, such as @samp{gcc -ansi}---not for other -compilers such as plain @command{gcc}. Whatever the ISO C standard says -is relevant to the design of plain @command{gcc} without @option{-ansi} only -for pragmatic reasons, not as a requirement. - -GCC normally defines @code{__STDC__} to be 1, and in addition -defines @code{__STRICT_ANSI__} if you specify the @option{-ansi} option, -or a @option{-std} option for strict conformance to some version of ISO C@. -On some hosts, system include files use a different convention, where -@code{__STDC__} is normally 0, but is 1 if the user specifies strict -conformance to the C Standard. GCC follows the host convention when -processing system include files, but when processing user files it follows -the usual GNU C convention. - -@item -Undefining @code{__STDC__} in C++. - -Programs written to compile with C++-to-C translators get the -value of @code{__STDC__} that goes with the C compiler that is -subsequently used. These programs must test @code{__STDC__} -to determine what kind of C preprocessor that compiler uses: -whether they should concatenate tokens in the ISO C fashion -or in the traditional fashion. - -These programs work properly with GNU C++ if @code{__STDC__} is defined. -They would not work otherwise. - -In addition, many header files are written to provide prototypes in ISO -C but not in traditional C@. Many of these header files can work without -change in C++ provided @code{__STDC__} is defined. If @code{__STDC__} -is not defined, they will all fail, and will all need to be changed to -test explicitly for C++ as well. - -@item -Deleting ``empty'' loops. - -Historically, GCC has not deleted ``empty'' loops under the -assumption that the most likely reason you would put one in a program is -to have a delay, so deleting them will not make real programs run any -faster. - -However, the rationale here is that optimization of a nonempty loop -cannot produce an empty one. This held for carefully written C compiled -with less powerful optimizers but is not always the case for carefully -written C++ or with more powerful optimizers. -Thus GCC will remove operations from loops whenever it can determine -those operations are not externally visible (apart from the time taken -to execute them, of course). In case the loop can be proved to be finite, -GCC will also remove the loop itself. - -Be aware of this when performing timing tests, for instance the -following loop can be completely removed, provided -@code{some_expression} can provably not change any global state. - -@smallexample -@{ - int sum = 0; - int ix; - - for (ix = 0; ix != 10000; ix++) - sum += some_expression; -@} -@end smallexample - -Even though @code{sum} is accumulated in the loop, no use is made of -that summation, so the accumulation can be removed. - -@item -Making side effects happen in the same order as in some other compiler. - -@cindex side effects, order of evaluation -@cindex order of evaluation, side effects -It is never safe to depend on the order of evaluation of side effects. -For example, a function call like this may very well behave differently -from one compiler to another: - -@smallexample -void func (int, int); - -int i = 2; -func (i++, i++); -@end smallexample - -There is no guarantee (in either the C or the C++ standard language -definitions) that the increments will be evaluated in any particular -order. Either increment might happen first. @code{func} might get the -arguments @samp{2, 3}, or it might get @samp{3, 2}, or even @samp{2, 2}. - -@item -Making certain warnings into errors by default. - -Some ISO C testsuites report failure when the compiler does not produce -an error message for a certain program. - -@opindex pedantic-errors -ISO C requires a ``diagnostic'' message for certain kinds of invalid -programs, but a warning is defined by GCC to count as a diagnostic. If -GCC produces a warning but not an error, that is correct ISO C support. -If testsuites call this ``failure'', they should be run with the GCC -option @option{-pedantic-errors}, which will turn these warnings into -errors. - -@end itemize - -@node Warnings and Errors -@section Warning Messages and Error Messages - -@cindex error messages -@cindex warnings vs errors -@cindex messages, warning and error -The GNU compiler can produce two kinds of diagnostics: errors and -warnings. Each kind has a different purpose: - -@itemize @w{} -@item -@dfn{Errors} report problems that make it impossible to compile your -program. GCC reports errors with the source file name and line -number where the problem is apparent. - -@item -@dfn{Warnings} report other unusual conditions in your code that -@emph{may} indicate a problem, although compilation can (and does) -proceed. Warning messages also report the source file name and line -number, but include the text @samp{warning:} to distinguish them -from error messages. -@end itemize - -Warnings may indicate danger points where you should check to make sure -that your program really does what you intend; or the use of obsolete -features; or the use of nonstandard features of GNU C or C++. Many -warnings are issued only if you ask for them, with one of the @option{-W} -options (for instance, @option{-Wall} requests a variety of useful -warnings). - -@opindex pedantic -@opindex pedantic-errors -GCC always tries to compile your program if possible; it never -gratuitously rejects a program whose meaning is clear merely because -(for instance) it fails to conform to a standard. In some cases, -however, the C and C++ standards specify that certain extensions are -forbidden, and a diagnostic @emph{must} be issued by a conforming -compiler. The @option{-pedantic} option tells GCC to issue warnings in -such cases; @option{-pedantic-errors} says to make them errors instead. -This does not mean that @emph{all} non-ISO constructs get warnings -or errors. - -@xref{Warning Options,,Options to Request or Suppress Warnings}, for -more detail on these and related command-line options. diff --git a/contrib/gcc-5.0/gcc/dwarf2out.c b/contrib/gcc-5.0/gcc/dwarf2out.c index 6c8e51fcab..b34a3ed3d0 100644 --- a/contrib/gcc-5.0/gcc/dwarf2out.c +++ b/contrib/gcc-5.0/gcc/dwarf2out.c @@ -14642,6 +14642,7 @@ loc_list_from_tree (tree loc, int want_address, case TARGET_MEM_REF: case SSA_NAME: + case DEBUG_EXPR_DECL: return NULL; case COMPOUND_EXPR: diff --git a/contrib/gcc-5.0/gcc/expr.c b/contrib/gcc-5.0/gcc/expr.c index dc13a14f4e..5c095507f4 100644 --- a/contrib/gcc-5.0/gcc/expr.c +++ b/contrib/gcc-5.0/gcc/expr.c @@ -6941,7 +6941,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, if (offset) { /* Avoid returning a negative bitpos as this may wreak havoc later. */ - if (wi::neg_p (bit_offset)) + if (wi::neg_p (bit_offset) || !wi::fits_shwi_p (bit_offset)) { offset_int mask = wi::mask (LOG2_BITS_PER_UNIT, false); offset_int tem = bit_offset.and_not (mask); diff --git a/contrib/gcc-5.0/gcc/gcov.c b/contrib/gcc-5.0/gcc/gcov.c index f5de08fa61..796b1b9761 100644 --- a/contrib/gcc-5.0/gcc/gcov.c +++ b/contrib/gcc-5.0/gcc/gcov.c @@ -1141,7 +1141,7 @@ find_source (const char *file_name) if (!info_emitted) { fnotice (stderr, - "(the message is only displayed one per source file)\n"); + "(the message is displayed only once per source file)\n"); info_emitted = 1; } sources[idx].file_time = 0; diff --git a/contrib/gcc-5.0/gcc/gimple-fold.c b/contrib/gcc-5.0/gcc/gimple-fold.c index f89220c5a6..9458f96545 100644 --- a/contrib/gcc-5.0/gcc/gimple-fold.c +++ b/contrib/gcc-5.0/gcc/gimple-fold.c @@ -769,7 +769,7 @@ var_decl_component_p (tree var) } /* Fold function call to builtin mem{{,p}cpy,move}. Return - NULL_TREE if no simplification can be made. + false if no simplification can be made. If ENDP is 0, return DEST (like memcpy). If ENDP is 1, return DEST+LEN (like mempcpy). If ENDP is 2, return DEST+LEN-1 (like stpcpy). @@ -5472,7 +5472,7 @@ fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl); ret = fold_unary (VIEW_CONVERT_EXPR, type, ret); if (ret) - STRIP_NOPS (ret); + STRIP_USELESS_TYPE_CONVERSION (ret); return ret; } /* For constants and byte-aligned/sized reads try to go through diff --git a/contrib/gcc-5.0/gcc/ipa-chkp.c b/contrib/gcc-5.0/gcc/ipa-chkp.c index 3218d42330..03abab5641 100644 --- a/contrib/gcc-5.0/gcc/ipa-chkp.c +++ b/contrib/gcc-5.0/gcc/ipa-chkp.c @@ -550,6 +550,9 @@ chkp_maybe_create_clone (tree fndecl) clone->thunk.thunk_p = true; clone->thunk.add_pointer_bounds_args = true; clone->create_edge (node, NULL, 0, CGRAPH_FREQ_BASE); + /* Thunk shouldn't be a cdtor. */ + DECL_STATIC_CONSTRUCTOR (clone->decl) = 0; + DECL_STATIC_DESTRUCTOR (clone->decl) = 0; } else { @@ -714,6 +717,9 @@ chkp_produce_thunks (bool early) 0, CGRAPH_FREQ_BASE); node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL); + /* Thunk shouldn't be a cdtor. */ + DECL_STATIC_CONSTRUCTOR (node->decl) = 0; + DECL_STATIC_DESTRUCTOR (node->decl) = 0; } } diff --git a/contrib/gcc-5.0/gcc/ipa-comdats.c b/contrib/gcc-5.0/gcc/ipa-comdats.c index f349f9f087..3e6fc1d030 100644 --- a/contrib/gcc-5.0/gcc/ipa-comdats.c +++ b/contrib/gcc-5.0/gcc/ipa-comdats.c @@ -142,12 +142,14 @@ propagate_comdat_group (struct symtab_node *symbol, { struct symtab_node *symbol2 = edge->caller; - /* If we see inline clone, its comdat group actually - corresponds to the comdat group of the function it is inlined - to. */ - if (cgraph_node * cn = dyn_cast (symbol2)) { + /* Thunks can not call across section boundary. */ + if (cn->thunk.thunk_p) + newgroup = propagate_comdat_group (symbol2, newgroup, map); + /* If we see inline clone, its comdat group actually + corresponds to the comdat group of the function it + is inlined to. */ if (cn->global.inlined_to) symbol2 = cn->global.inlined_to; } @@ -377,7 +379,7 @@ ipa_comdats (void) fprintf (dump_file, "To group: %s\n", IDENTIFIER_POINTER (group)); } if (is_a (symbol)) - dyn_cast (symbol)->call_for_symbol_and_aliases + dyn_cast (symbol)->call_for_symbol_thunks_and_aliases (set_comdat_group_1, *comdat_head_map.get (group), true); diff --git a/contrib/gcc-5.0/gcc/ipa-cp.c b/contrib/gcc-5.0/gcc/ipa-cp.c index d9aa92ed5b..bfe4821da3 100644 --- a/contrib/gcc-5.0/gcc/ipa-cp.c +++ b/contrib/gcc-5.0/gcc/ipa-cp.c @@ -839,7 +839,6 @@ set_single_call_flag (cgraph_node *node, void *) cs = cs->next_caller; if (cs) { - gcc_assert (!cs->next_caller); IPA_NODE_REF (cs->caller)->node_calling_single_call = true; return true; } diff --git a/contrib/gcc-5.0/gcc/ipa-icf-gimple.c b/contrib/gcc-5.0/gcc/ipa-icf-gimple.c index 568407da2f..9efdea465c 100644 --- a/contrib/gcc-5.0/gcc/ipa-icf-gimple.c +++ b/contrib/gcc-5.0/gcc/ipa-icf-gimple.c @@ -521,8 +521,8 @@ func_checker::compare_operand (tree t1, tree t2) if (!types_same_for_odr (obj_type_ref_class (t1), obj_type_ref_class (t2))) return return_false_with_msg ("OBJ_TYPE_REF OTR type mismatch"); - if (!compare_ssa_name (OBJ_TYPE_REF_OBJECT (t1), - OBJ_TYPE_REF_OBJECT (t2))) + if (!compare_operand (OBJ_TYPE_REF_OBJECT (t1), + OBJ_TYPE_REF_OBJECT (t2))) return return_false_with_msg ("OBJ_TYPE_REF object mismatch"); } @@ -706,7 +706,11 @@ func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2) return return_different_stmts (s1, s2, "GIMPLE_SWITCH"); break; case GIMPLE_DEBUG: + break; case GIMPLE_EH_DISPATCH: + if (gimple_eh_dispatch_region (as_a (s1)) + != gimple_eh_dispatch_region (as_a (s2))) + return return_different_stmts (s1, s2, "GIMPLE_EH_DISPATCH"); break; case GIMPLE_RESX: if (!compare_gimple_resx (as_a (s1), @@ -734,7 +738,7 @@ func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2) break; case GIMPLE_PREDICT: case GIMPLE_NOP: - return true; + break; default: return return_false_with_msg ("Unknown GIMPLE code reached"); } diff --git a/contrib/gcc-5.0/gcc/ipa-icf.c b/contrib/gcc-5.0/gcc/ipa-icf.c index 8626730dca..b902373b31 100644 --- a/contrib/gcc-5.0/gcc/ipa-icf.c +++ b/contrib/gcc-5.0/gcc/ipa-icf.c @@ -368,6 +368,10 @@ sem_item::compare_cgraph_references ( if (n1 == n2) return true; + /* Never match variable and function. */ + if (is_a (n1) != is_a (n2)) + return false; + /* Merging two definitions with a reference to equivalent vtables, but belonging to a different type may result in ipa-polymorphic-call analysis giving a wrong answer about the dynamic type of instance. */ @@ -535,7 +539,8 @@ sem_function::equals_wpa (sem_item *item, && (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE || TREE_CODE (TREE_TYPE (item->decl)) == METHOD_TYPE) && (ipa_node_params_sum == NULL - || ipa_is_param_used (IPA_NODE_REF (dyn_cast (node)), + || IPA_NODE_REF (get_node ())->descriptors.is_empty () + || ipa_is_param_used (IPA_NODE_REF (get_node ()), 0)) && compare_polymorphic_p ()) { @@ -586,9 +591,6 @@ void sem_item::update_hash_by_addr_refs (hash_map &m_symtab_node_map) { - if (is_a (node) && DECL_VIRTUAL_P (node->decl)) - return; - ipa_ref* ref; inchash::hash hstate (hash); for (unsigned i = 0; i < node->num_references (); i++) @@ -1666,17 +1668,19 @@ sem_variable::equals_wpa (sem_item *item, ref->address_matters_p ())) return false; - /* DECL_FINAL_P flag on methods referred by virtual tables is used - to decide on completeness possible_polymorphic_call_targets lists - and therefore it must match. */ - if ((DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl)) - && (DECL_VIRTUAL_P (ref->referred->decl) - || DECL_VIRTUAL_P (ref2->referred->decl)) - && ((DECL_VIRTUAL_P (ref->referred->decl) - != DECL_VIRTUAL_P (ref2->referred->decl)) - || (DECL_FINAL_P (ref->referred->decl) - != DECL_FINAL_P (ref2->referred->decl)))) - return return_false_with_msg ("virtual or final flag mismatch"); + /* When matching virtual tables, be sure to also match information + relevant for polymorphic call analysis. */ + if (DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl)) + { + if (DECL_VIRTUAL_P (ref->referred->decl) + != DECL_VIRTUAL_P (ref2->referred->decl)) + return return_false_with_msg ("virtual flag mismatch"); + if (DECL_VIRTUAL_P (ref->referred->decl) + && is_a (ref->referred) + && (DECL_FINAL_P (ref->referred->decl) + != DECL_FINAL_P (ref2->referred->decl))) + return return_false_with_msg ("final flag mismatch"); + } } return true; @@ -2501,14 +2505,15 @@ sem_item_optimizer::update_hash_by_addr_refs () m_items[i]->update_hash_by_addr_refs (m_symtab_node_map); if (m_items[i]->type == FUNC) { + cgraph_node *cnode = dyn_cast (m_items[i]->node); + if (TREE_CODE (TREE_TYPE (m_items[i]->decl)) == METHOD_TYPE && contains_polymorphic_type_p (method_class_type (TREE_TYPE (m_items[i]->decl))) && (DECL_CXX_CONSTRUCTOR_P (m_items[i]->decl) || ((ipa_node_params_sum == NULL - || ipa_is_param_used ( - IPA_NODE_REF - (dyn_cast (m_items[i]->node)), 0)) + || IPA_NODE_REF (cnode)->descriptors.is_empty () + || ipa_is_param_used (IPA_NODE_REF (cnode), 0)) && static_cast (m_items[i]) ->compare_polymorphic_p ()))) { diff --git a/contrib/gcc-5.0/gcc/ipa-inline-analysis.c b/contrib/gcc-5.0/gcc/ipa-inline-analysis.c index 2f4eb9fd6f..5d998870f3 100644 --- a/contrib/gcc-5.0/gcc/ipa-inline-analysis.c +++ b/contrib/gcc-5.0/gcc/ipa-inline-analysis.c @@ -793,7 +793,11 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate) { /* If the edge is determined to be never executed, redirect it to BUILTIN_UNREACHABLE to save inliner from inlining into it. */ - if (predicate && false_predicate_p (predicate)) + if (predicate && false_predicate_p (predicate) + /* When handling speculative edges, we need to do the redirection + just once. Do it always on the direct edge, so we do not + attempt to resolve speculation while duplicating the edge. */ + && (!e->speculative || e->callee)) e = redirect_to_unreachable (e); struct inline_edge_summary *es = inline_edge_summary (e); diff --git a/contrib/gcc-5.0/gcc/ipa-inline-transform.c b/contrib/gcc-5.0/gcc/ipa-inline-transform.c index 952659c99f..5a628f39dd 100644 --- a/contrib/gcc-5.0/gcc/ipa-inline-transform.c +++ b/contrib/gcc-5.0/gcc/ipa-inline-transform.c @@ -64,7 +64,6 @@ along with GCC; see the file COPYING3. If not see int ncalls_inlined; int nfunctions_inlined; -bool speculation_removed; /* Scale frequency of NODE edges by FREQ_SCALE. */ @@ -256,12 +255,29 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, next = e->next_callee; if (!e->inline_failed) clone_inlined_nodes (e, duplicate, update_original, overall_size, freq_scale); + } +} + +/* Check all speculations in N and resolve them if they seems useless. */ + +static bool +check_speculations (cgraph_node *n) +{ + bool speculation_removed = false; + cgraph_edge *next; + + for (cgraph_edge *e = n->callees; e; e = next) + { + next = e->next_callee; if (e->speculative && !speculation_useful_p (e, true)) { e->resolve_speculation (NULL); speculation_removed = true; } + else if (!e->inline_failed) + speculation_removed |= check_speculations (e->callee); } + return speculation_removed; } /* Mark all call graph edges coming out of NODE and all nodes that have been @@ -304,12 +320,12 @@ inline_call (struct cgraph_edge *e, bool update_original, struct cgraph_node *callee = e->callee->ultimate_alias_target (); bool new_edges_found = false; -#ifdef ENABLE_CHECKING + /* This is used only for assert bellow. */ +#if 0 int estimated_growth = estimate_edge_growth (e); bool predicated = inline_edge_summary (e)->predicate != NULL; #endif - speculation_removed = false; /* Don't inline inlined edges. */ gcc_assert (e->inline_failed); /* Don't even think of inlining inline clone. */ @@ -359,6 +375,7 @@ inline_call (struct cgraph_edge *e, bool update_original, mark_all_inlined_calls_cdtor (e->callee); if (opt_for_fn (e->caller->decl, optimize)) new_edges_found = ipa_propagate_indirect_call_infos (curr, new_edges); + check_speculations (e->callee); if (update_overall_summary) inline_update_overall_summary (to); new_size = inline_summaries->get (to)->size; @@ -375,7 +392,10 @@ inline_call (struct cgraph_edge *e, bool update_original, to->calls_comdat_local = false; } -#ifdef ENABLE_CHECKING + /* FIXME: This assert suffers from roundoff errors, disable it for GCC 5 + and revisit it after conversion to sreals in GCC 6. + See PR 65654. */ +#if 0 /* Verify that estimated growth match real growth. Allow off-by-one error due to INLINE_SIZE_SCALE roudoff errors. */ gcc_assert (!update_overall_summary || !overall_size || new_edges_found diff --git a/contrib/gcc-5.0/gcc/ipa-inline.c b/contrib/gcc-5.0/gcc/ipa-inline.c index 77d6d85025..4533ea46be 100644 --- a/contrib/gcc-5.0/gcc/ipa-inline.c +++ b/contrib/gcc-5.0/gcc/ipa-inline.c @@ -1077,8 +1077,8 @@ edge_badness (struct cgraph_edge *edge, bool dump) /* When profile is available. Compute badness as: time_saved * caller_count - goodness = --------------------------------- - growth_of_caller * overall_growth + goodness = ------------------------------------------------- + growth_of_caller * overall_growth * combined_size badness = - goodness @@ -1167,6 +1167,7 @@ edge_badness (struct cgraph_edge *edge, bool dump) overall_growth += 256 * 256 - 256; denominator *= overall_growth; } + denominator *= inline_summaries->get (caller)->self_size + growth; badness = - numerator / denominator; diff --git a/contrib/gcc-5.0/gcc/ipa-prop.c b/contrib/gcc-5.0/gcc/ipa-prop.c index 89a4623e0c..dc8f3606b1 100644 --- a/contrib/gcc-5.0/gcc/ipa-prop.c +++ b/contrib/gcc-5.0/gcc/ipa-prop.c @@ -2626,9 +2626,29 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target, target = canonicalize_constructor_val (target, NULL); if (!target || TREE_CODE (target) != FUNCTION_DECL) { - if (ie->indirect_info->member_ptr) - /* Member pointer call that goes through a VMT lookup. */ - return NULL; + /* Member pointer call that goes through a VMT lookup. */ + if (ie->indirect_info->member_ptr + /* Or if target is not an invariant expression and we do not + know if it will evaulate to function at runtime. + This can happen when folding through &VAR, where &VAR + is IP invariant, but VAR itself is not. + + TODO: Revisit this when GCC 5 is branched. It seems that + member_ptr check is not needed and that we may try to fold + the expression and see if VAR is readonly. */ + || !is_gimple_ip_invariant (target)) + { + if (dump_enabled_p ()) + { + location_t loc = gimple_location_safe (ie->call_stmt); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + "discovered direct call non-invariant " + "%s/%i\n", + ie->caller->name (), ie->caller->order); + } + return NULL; + } + if (dump_enabled_p ()) { diff --git a/contrib/gcc-5.0/gcc/ipa-split.c b/contrib/gcc-5.0/gcc/ipa-split.c index a28f3a1ad9..5d6763d102 100644 --- a/contrib/gcc-5.0/gcc/ipa-split.c +++ b/contrib/gcc-5.0/gcc/ipa-split.c @@ -1230,20 +1230,6 @@ find_split_points (basic_block return_bb, int overall_time, int overall_size) BITMAP_FREE (current.ssa_names_to_pass); } -/* Build and insert initialization of returned bounds RETBND - for returned value RETVAL. Statements are inserted after - a statement pointed by GSI and GSI is modified to point to - the last inserted statement. */ - -static void -insert_bndret_call_after (tree retbnd, tree retval, gimple_stmt_iterator *gsi) -{ - tree fndecl = targetm.builtin_chkp_function (BUILT_IN_CHKP_BNDRET); - gimple bndret = gimple_build_call (fndecl, 1, retval); - gimple_call_set_lhs (bndret, retbnd); - gsi_insert_after (gsi, bndret, GSI_CONTINUE_LINKING); -} - /* Split function at SPLIT_POINT. */ static void @@ -1652,7 +1638,7 @@ split_function (basic_block return_bb, struct split_point *split_point, } /* Build bndret call to obtain returned bounds. */ if (retbnd) - insert_bndret_call_after (retbnd, retval, &gsi); + chkp_insert_retbnd_call (retbnd, retval, &gsi); gimple_call_set_lhs (call, retval); update_stmt (call); } @@ -1702,7 +1688,7 @@ split_function (basic_block return_bb, struct split_point *split_point, gsi_insert_after (&gsi, call, GSI_NEW_STMT); /* Build bndret call to obtain returned bounds. */ if (retbnd) - insert_bndret_call_after (retbnd, retval, &gsi); + chkp_insert_retbnd_call (retbnd, retval, &gsi); if (tsan_func_exit_call) gsi_insert_after (&gsi, tsan_func_exit_call, GSI_NEW_STMT); ret = gimple_build_return (retval); diff --git a/contrib/gcc-5.0/gcc/lra-assigns.c b/contrib/gcc-5.0/gcc/lra-assigns.c index e19156b328..994b04fc64 100644 --- a/contrib/gcc-5.0/gcc/lra-assigns.c +++ b/contrib/gcc-5.0/gcc/lra-assigns.c @@ -910,6 +910,7 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) enum reg_class rclass; unsigned int spill_regno, reload_regno, uid; int insn_pseudos_num, best_insn_pseudos_num; + int bad_spills_num, smallest_bad_spills_num; lra_live_range_t r; bitmap_iterator bi; @@ -928,6 +929,7 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) best_hard_regno = -1; best_cost = INT_MAX; best_insn_pseudos_num = INT_MAX; + smallest_bad_spills_num = INT_MAX; rclass_size = ira_class_hard_regs_num[rclass]; mode = PSEUDO_REGNO_MODE (regno); /* Invalidate try_hard_reg_pseudos elements. */ @@ -958,6 +960,7 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) && ! bitmap_bit_p (&lra_optional_reload_pseudos, spill_regno))) goto fail; insn_pseudos_num = 0; + bad_spills_num = 0; if (lra_dump_file != NULL) fprintf (lra_dump_file, " Trying %d:", hard_regno); sparseset_clear (live_range_reload_inheritance_pseudos); @@ -965,6 +968,8 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) { if (bitmap_bit_p (&insn_conflict_pseudos, spill_regno)) insn_pseudos_num++; + if (spill_regno >= (unsigned int) lra_bad_spill_regno_start) + bad_spills_num++; for (r = lra_reg_info[spill_regno].live_ranges; r != NULL; r = r->next) @@ -1035,15 +1040,19 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) } if (best_insn_pseudos_num > insn_pseudos_num || (best_insn_pseudos_num == insn_pseudos_num - && best_cost > cost)) + && (bad_spills_num < smallest_bad_spills_num + || (bad_spills_num == smallest_bad_spills_num + && best_cost > cost)))) { best_insn_pseudos_num = insn_pseudos_num; + smallest_bad_spills_num = bad_spills_num; best_cost = cost; best_hard_regno = hard_regno; bitmap_copy (&best_spill_pseudos_bitmap, &spill_pseudos_bitmap); if (lra_dump_file != NULL) - fprintf (lra_dump_file, " Now best %d(cost=%d)\n", - hard_regno, cost); + fprintf (lra_dump_file, + " Now best %d(cost=%d, bad_spills=%d, insn_pseudos=%d)\n", + hard_regno, cost, bad_spills_num, insn_pseudos_num); } assign_temporarily (regno, -1); for (j = 0; j < n; j++) diff --git a/contrib/gcc-5.0/gcc/lra-constraints.c b/contrib/gcc-5.0/gcc/lra-constraints.c index 57d731a556..7353e7c2c7 100644 --- a/contrib/gcc-5.0/gcc/lra-constraints.c +++ b/contrib/gcc-5.0/gcc/lra-constraints.c @@ -1656,7 +1656,8 @@ prohibited_class_reg_set_mode_p (enum reg_class rclass, { HARD_REG_SET temp; - lra_assert (hard_reg_set_subset_p (set, reg_class_contents[rclass])); + // ??? Is this assert right + // lra_assert (hard_reg_set_subset_p (set, reg_class_contents[rclass])); COPY_HARD_REG_SET (temp, set); AND_COMPL_HARD_REG_SET (temp, lra_no_alloc_regs); return (hard_reg_set_subset_p diff --git a/contrib/gcc-5.0/gcc/lra-int.h b/contrib/gcc-5.0/gcc/lra-int.h index 735259123d..12923ee216 100644 --- a/contrib/gcc-5.0/gcc/lra-int.h +++ b/contrib/gcc-5.0/gcc/lra-int.h @@ -271,6 +271,14 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t; #error wrong LRA_MAX_INHERITANCE_PASSES value #endif +/* Analogous macro to the above one but for rematerialization. */ +#define LRA_MAX_REMATERIALIZATION_PASSES 2 + +#if LRA_MAX_REMATERIALIZATION_PASSES <= 0 \ + || LRA_MAX_REMATERIALIZATION_PASSES >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER - 8 +#error wrong LRA_MAX_REMATERIALIZATION_PASSES value +#endif + /* lra.c: */ extern FILE *lra_dump_file; @@ -325,6 +333,7 @@ extern void lra_register_new_scratch_op (rtx_insn *, int); extern int lra_new_regno_start; extern int lra_constraint_new_regno_start; +extern int lra_bad_spill_regno_start; extern bitmap_head lra_inheritance_pseudos; extern bitmap_head lra_split_regs; extern bitmap_head lra_subreg_reload_pseudos; @@ -392,6 +401,7 @@ extern void lra_final_code_change (void); /* lra-remat.c: */ +extern int lra_rematerialization_iter; extern bool lra_remat (void); /* lra-elimination.c: */ diff --git a/contrib/gcc-5.0/gcc/lra-remat.c b/contrib/gcc-5.0/gcc/lra-remat.c index ac82779571..a23cb5ba3e 100644 --- a/contrib/gcc-5.0/gcc/lra-remat.c +++ b/contrib/gcc-5.0/gcc/lra-remat.c @@ -1234,22 +1234,25 @@ do_remat (void) for (i = 0; i < nregs; i++) CLEAR_HARD_REG_BIT (live_hard_regs, hard_regno + i); } - else if (reg->type != OP_IN - && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL) + /* Process also hard regs (e.g. CC register) which are part + of insn definition. */ + for (reg = static_id->hard_regs; reg != NULL; reg = reg->next) + if (reg->type == OP_IN + && find_regno_note (insn, REG_DEAD, reg->regno) != NULL) + CLEAR_HARD_REG_BIT (live_hard_regs, reg->regno); + /* Inputs have been processed, now process outputs. */ + for (reg = id->regs; reg != NULL; reg = reg->next) + if (reg->type != OP_IN + && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL) { if ((hard_regno = get_hard_regs (reg, nregs)) < 0) continue; for (i = 0; i < nregs; i++) SET_HARD_REG_BIT (live_hard_regs, hard_regno + i); } - /* Process also hard regs (e.g. CC register) which are part - of insn definition. */ for (reg = static_id->hard_regs; reg != NULL; reg = reg->next) - if (reg->type == OP_IN - && find_regno_note (insn, REG_DEAD, reg->regno) != NULL) - CLEAR_HARD_REG_BIT (live_hard_regs, reg->regno); - else if (reg->type != OP_IN - && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL) + if (reg->type != OP_IN + && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL) SET_HARD_REG_BIT (live_hard_regs, reg->regno); } } @@ -1259,6 +1262,9 @@ do_remat (void) +/* Current number of rematerialization iteration. */ +int lra_rematerialization_iter; + /* Entry point of the rematerialization sub-pass. Return true if we did any rematerialization. */ bool @@ -1270,6 +1276,13 @@ lra_remat (void) if (! flag_lra_remat) return false; + lra_rematerialization_iter++; + if (lra_rematerialization_iter > LRA_MAX_REMATERIALIZATION_PASSES) + return false; + if (lra_dump_file != NULL) + fprintf (lra_dump_file, + "\n******** Rematerialization #%d: ********\n\n", + lra_rematerialization_iter); timevar_push (TV_LRA_REMAT); insn_to_cand = XCNEWVEC (cand_t, get_max_uid ()); regno_cands = XCNEWVEC (cand_t, max_regno); diff --git a/contrib/gcc-5.0/gcc/lra.c b/contrib/gcc-5.0/gcc/lra.c index 269a0f14f7..f4d7a3c071 100644 --- a/contrib/gcc-5.0/gcc/lra.c +++ b/contrib/gcc-5.0/gcc/lra.c @@ -2180,6 +2180,10 @@ int lra_new_regno_start; /* Start of reload pseudo regnos before the new spill pass. */ int lra_constraint_new_regno_start; +/* Avoid spilling pseudos with regno more than the following value if + it is possible. */ +int lra_bad_spill_regno_start; + /* Inheritance pseudo regnos before the new spill pass. */ bitmap_head lra_inheritance_pseudos; @@ -2260,6 +2264,7 @@ lra (FILE *f) lra_live_range_iter = lra_coalesce_iter = lra_constraint_iter = 0; lra_assignment_iter = lra_assignment_iter_after_spill = 0; lra_inheritance_iter = lra_undo_inheritance_iter = 0; + lra_rematerialization_iter = 0; setup_reg_spill_flag (); @@ -2268,6 +2273,7 @@ lra (FILE *f) permit changing reg classes for pseudos created by this simplification. */ lra_constraint_new_regno_start = lra_new_regno_start = max_reg_num (); + lra_bad_spill_regno_start = INT_MAX; remove_scratches (); scratch_p = lra_constraint_new_regno_start != max_reg_num (); @@ -2406,6 +2412,13 @@ lra (FILE *f) some eliminations. So update the offsets here. */ lra_eliminate (false, false); lra_constraint_new_regno_start = max_reg_num (); + if (lra_bad_spill_regno_start == INT_MAX + && lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES + && lra_rematerialization_iter > LRA_MAX_REMATERIALIZATION_PASSES) + /* After switching off inheritance and rematerialization + passes, avoid spilling reload pseudos will be created to + prevent LRA cycling in some complicated cases. */ + lra_bad_spill_regno_start = lra_constraint_new_regno_start; lra_assignment_iter_after_spill = 0; } restore_scratches (); diff --git a/contrib/gcc-5.0/gcc/lto-cgraph.c b/contrib/gcc-5.0/gcc/lto-cgraph.c index fa18d363b2..ac50e4bbd2 100644 --- a/contrib/gcc-5.0/gcc/lto-cgraph.c +++ b/contrib/gcc-5.0/gcc/lto-cgraph.c @@ -1617,9 +1617,8 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, } /* Restore decl names reference. */ - if (IDENTIFIER_TRANSPARENT_ALIAS (DECL_ASSEMBLER_NAME (cnode->decl)) - && !TREE_CHAIN (DECL_ASSEMBLER_NAME (cnode->decl))) - TREE_CHAIN (DECL_ASSEMBLER_NAME (cnode->decl)) + IDENTIFIER_TRANSPARENT_ALIAS (DECL_ASSEMBLER_NAME (cnode->decl)) = 1; + TREE_CHAIN (DECL_ASSEMBLER_NAME (cnode->decl)) = DECL_ASSEMBLER_NAME (cnode->orig_decl); } } diff --git a/contrib/gcc-5.0/gcc/omp-low.c b/contrib/gcc-5.0/gcc/omp-low.c index 80bddf059b..835ff71391 100644 --- a/contrib/gcc-5.0/gcc/omp-low.c +++ b/contrib/gcc-5.0/gcc/omp-low.c @@ -2351,6 +2351,7 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx) DECL_ARTIFICIAL (name) = 1; DECL_NAMELESS (name) = 1; TYPE_NAME (ctx->record_type) = name; + TYPE_ARTIFICIAL (ctx->record_type) = 1; create_omp_child_function (ctx, false); gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn); @@ -2391,6 +2392,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx) DECL_ARTIFICIAL (name) = 1; DECL_NAMELESS (name) = 1; TYPE_NAME (ctx->record_type) = name; + TYPE_ARTIFICIAL (ctx->record_type) = 1; create_omp_child_function (ctx, false); gimple_omp_task_set_child_fn (stmt, ctx->cb.dst_fn); @@ -2404,6 +2406,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx) DECL_ARTIFICIAL (name) = 1; DECL_NAMELESS (name) = 1; TYPE_NAME (ctx->srecord_type) = name; + TYPE_ARTIFICIAL (ctx->srecord_type) = 1; create_omp_child_function (ctx, true); } @@ -2671,6 +2674,7 @@ scan_omp_target (gomp_target *stmt, omp_context *outer_ctx) DECL_ARTIFICIAL (name) = 1; DECL_NAMELESS (name) = 1; TYPE_NAME (ctx->record_type) = name; + TYPE_ARTIFICIAL (ctx->record_type) = 1; if (offloaded) { if (is_gimple_omp_oacc (stmt)) diff --git a/contrib/gcc-5.0/gcc/params.def b/contrib/gcc-5.0/gcc/params.def index 5e2c769586..48b39a2504 100644 --- a/contrib/gcc-5.0/gcc/params.def +++ b/contrib/gcc-5.0/gcc/params.def @@ -190,7 +190,7 @@ DEFPARAM(PARAM_LARGE_UNIT_INSNS, DEFPARAM(PARAM_INLINE_UNIT_GROWTH, "inline-unit-growth", "How much can given compilation unit grow because of the inlining (in percent)", - 15, 0, 0) + 20, 0, 0) DEFPARAM(PARAM_IPCP_UNIT_GROWTH, "ipcp-unit-growth", "How much can given compilation unit grow because of the interprocedural constant propagation (in percent)", diff --git a/contrib/gcc-5.0/gcc/tree-chkp.c b/contrib/gcc-5.0/gcc/tree-chkp.c index 03f75b35da..8c5a628a9a 100644 --- a/contrib/gcc-5.0/gcc/tree-chkp.c +++ b/contrib/gcc-5.0/gcc/tree-chkp.c @@ -500,6 +500,35 @@ chkp_expand_bounds_reset_for_mem (tree mem, tree ptr) expand_normal (bndstx); } +/* Build retbnd call for returned value RETVAL. + + If BNDVAL is not NULL then result is stored + in it. Otherwise a temporary is created to + hold returned value. + + GSI points to a position for a retbnd call + and is set to created stmt. + + Cgraph edge is created for a new call if + UPDATE_EDGE is 1. + + Obtained bounds are returned. */ +tree +chkp_insert_retbnd_call (tree bndval, tree retval, + gimple_stmt_iterator *gsi) +{ + gimple call; + + if (!bndval) + bndval = create_tmp_reg (pointer_bounds_type_node, "retbnd"); + + call = gimple_build_call (chkp_ret_bnd_fndecl, 1, retval); + gimple_call_set_lhs (call, bndval); + gsi_insert_after (gsi, call, GSI_CONTINUE_LINKING); + + return bndval; +} + /* Mark statement S to not be instrumented. */ static void chkp_mark_stmt (gimple s) @@ -1873,33 +1902,6 @@ chkp_add_bounds_to_call_stmt (gimple_stmt_iterator *gsi) gimple_call_set_with_bounds (new_call, true); } -/* Return constant static bounds var with specified LB and UB - if such var exists in varpool. Return NULL otherwise. */ -static tree -chkp_find_const_bounds_var (HOST_WIDE_INT lb, - HOST_WIDE_INT ub) -{ - tree val = targetm.chkp_make_bounds_constant (lb, ub); - struct varpool_node *node; - - /* We expect bounds constant is represented as a complex value - of two pointer sized integers. */ - gcc_assert (TREE_CODE (val) == COMPLEX_CST); - - FOR_EACH_VARIABLE (node) - if (POINTER_BOUNDS_P (node->decl) - && TREE_READONLY (node->decl) - && DECL_INITIAL (node->decl) - && TREE_CODE (DECL_INITIAL (node->decl)) == COMPLEX_CST - && tree_int_cst_equal (TREE_REALPART (DECL_INITIAL (node->decl)), - TREE_REALPART (val)) - && tree_int_cst_equal (TREE_IMAGPART (DECL_INITIAL (node->decl)), - TREE_IMAGPART (val))) - return node->decl; - - return NULL; -} - /* Return constant static bounds var with specified bounds LB and UB. If such var does not exists then new var is created with specified NAME. */ static tree @@ -1907,37 +1909,43 @@ chkp_make_static_const_bounds (HOST_WIDE_INT lb, HOST_WIDE_INT ub, const char *name) { + tree id = get_identifier (name); tree var; + varpool_node *node; + symtab_node *snode; + + var = build_decl (UNKNOWN_LOCATION, VAR_DECL, id, + pointer_bounds_type_node); + TREE_STATIC (var) = 1; + TREE_PUBLIC (var) = 1; /* With LTO we may have constant bounds already in varpool. Try to find it. */ - var = chkp_find_const_bounds_var (lb, ub); - - if (var) - return var; - - var = build_decl (UNKNOWN_LOCATION, VAR_DECL, - get_identifier (name), pointer_bounds_type_node); + if ((snode = symtab_node::get_for_asmname (DECL_ASSEMBLER_NAME (var)))) + { + /* We don't allow this symbol usage for non bounds. */ + if (snode->type != SYMTAB_VARIABLE + || !POINTER_BOUNDS_P (snode->decl)) + sorry ("-fcheck-pointer-bounds requires '%s' " + "name for internal usage", + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (var))); + + return snode->decl; + } - TREE_PUBLIC (var) = 1; TREE_USED (var) = 1; TREE_READONLY (var) = 1; - TREE_STATIC (var) = 1; TREE_ADDRESSABLE (var) = 0; DECL_ARTIFICIAL (var) = 1; DECL_READ_P (var) = 1; + DECL_INITIAL (var) = targetm.chkp_make_bounds_constant (lb, ub); + make_decl_one_only (var, DECL_ASSEMBLER_NAME (var)); /* We may use this symbol during ctors generation in chkp_finish_file when all symbols are emitted. Force output to avoid undefined symbols in ctors. */ - if (!in_lto_p) - { - DECL_INITIAL (var) = targetm.chkp_make_bounds_constant (lb, ub); - DECL_COMDAT (var) = 1; - varpool_node::get_create (var)->set_comdat_group (DECL_ASSEMBLER_NAME (var)); - varpool_node::get_create (var)->force_output = 1; - } - else - DECL_EXTERNAL (var) = 1; + node = varpool_node::get_create (var); + node->force_output = 1; + varpool_node::finalize_decl (var); return var; @@ -2000,14 +2008,6 @@ chkp_make_bounds (tree lb, tree size, gimple_stmt_iterator *iter, bool after) tree chkp_get_zero_bounds_var (void) { - if (!chkp_zero_bounds_var) - { - tree id = get_identifier (CHKP_ZERO_BOUNDS_VAR_NAME); - symtab_node *node = symtab_node::get_for_asmname (id); - if (node) - chkp_zero_bounds_var = node->decl; - } - if (!chkp_zero_bounds_var) chkp_zero_bounds_var = chkp_make_static_const_bounds (0, -1, @@ -2019,14 +2019,6 @@ chkp_get_zero_bounds_var (void) tree chkp_get_none_bounds_var (void) { - if (!chkp_none_bounds_var) - { - tree id = get_identifier (CHKP_NONE_BOUNDS_VAR_NAME); - symtab_node *node = symtab_node::get_for_asmname (id); - if (node) - chkp_none_bounds_var = node->decl; - } - if (!chkp_none_bounds_var) chkp_none_bounds_var = chkp_make_static_const_bounds (-1, 0, diff --git a/contrib/gcc-5.0/gcc/tree-chkp.h b/contrib/gcc-5.0/gcc/tree-chkp.h index 86f3618bd6..1bafe994da 100644 --- a/contrib/gcc-5.0/gcc/tree-chkp.h +++ b/contrib/gcc-5.0/gcc/tree-chkp.h @@ -54,5 +54,7 @@ extern void chkp_copy_bounds_for_assign (gimple assign, extern bool chkp_gimple_call_builtin_p (gimple call, enum built_in_function code); extern void chkp_expand_bounds_reset_for_mem (tree mem, tree ptr); +extern tree chkp_insert_retbnd_call (tree bndval, tree retval, + gimple_stmt_iterator *gsi); #endif /* GCC_TREE_CHKP_H */ diff --git a/contrib/gcc-5.0/gcc/tree-ssa-threadedge.c b/contrib/gcc-5.0/gcc/tree-ssa-threadedge.c index 7187d065e9..90c1e2af94 100644 --- a/contrib/gcc-5.0/gcc/tree-ssa-threadedge.c +++ b/contrib/gcc-5.0/gcc/tree-ssa-threadedge.c @@ -1015,7 +1015,7 @@ static int max_threaded_paths; static void fsm_find_control_statement_thread_paths (tree expr, - hash_set *visited_phis, + hash_set *visited_bbs, vec *&path, bool seen_loop_phi) { @@ -1034,7 +1034,7 @@ fsm_find_control_statement_thread_paths (tree expr, return; /* Avoid infinite recursion. */ - if (visited_phis->add (def_stmt)) + if (visited_bbs->add (var_bb)) return; gphi *phi = as_a (def_stmt); @@ -1109,7 +1109,7 @@ fsm_find_control_statement_thread_paths (tree expr, { vec_safe_push (path, bbi); /* Recursively follow SSA_NAMEs looking for a constant definition. */ - fsm_find_control_statement_thread_paths (arg, visited_phis, path, + fsm_find_control_statement_thread_paths (arg, visited_bbs, path, seen_loop_phi); path->pop (); @@ -1391,13 +1391,13 @@ thread_through_normal_block (edge e, vec *bb_path; vec_alloc (bb_path, n_basic_blocks_for_fn (cfun)); vec_safe_push (bb_path, e->dest); - hash_set *visited_phis = new hash_set; + hash_set *visited_bbs = new hash_set; max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS); - fsm_find_control_statement_thread_paths (cond, visited_phis, bb_path, + fsm_find_control_statement_thread_paths (cond, visited_bbs, bb_path, false); - delete visited_phis; + delete visited_bbs; vec_free (bb_path); } return 0; diff --git a/contrib/gcc-5.0/gcc/tree-vect-data-refs.c b/contrib/gcc-5.0/gcc/tree-vect-data-refs.c index 094275e843..3913862eb6 100644 --- a/contrib/gcc-5.0/gcc/tree-vect-data-refs.c +++ b/contrib/gcc-5.0/gcc/tree-vect-data-refs.c @@ -1152,7 +1152,6 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, vec datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); struct data_reference *dr; stmt_vector_for_cost prologue_cost_vec, body_cost_vec, epilogue_cost_vec; - int single_iter_cost; prologue_cost_vec.create (2); body_cost_vec.create (2); @@ -1175,14 +1174,11 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, SET_DR_MISALIGNMENT (dr, save_misalignment); } - single_iter_cost = vect_get_single_scalar_iteration_cost (loop_vinfo); + auto_vec scalar_cost_vec; + vect_get_single_scalar_iteration_cost (loop_vinfo, &scalar_cost_vec); outside_cost += vect_get_known_peeling_cost (loop_vinfo, elem->npeel, &dummy, - /* ??? We use this cost as number of stmts with scalar_stmt cost, - thus divide by that. This introduces rounding errors, thus better - introduce a new cost kind (raw_cost? scalar_iter_cost?). */ - single_iter_cost / vect_get_stmt_cost (scalar_stmt), - &prologue_cost_vec, &epilogue_cost_vec); + &scalar_cost_vec, &prologue_cost_vec, &epilogue_cost_vec); /* Prologue and epilogue costs are added to the target model later. These costs depend only on the scalar iteration cost, the diff --git a/contrib/gcc-5.0/gcc/tree-vect-loop.c b/contrib/gcc-5.0/gcc/tree-vect-loop.c index dd4ada2d09..88ef251e91 100644 --- a/contrib/gcc-5.0/gcc/tree-vect-loop.c +++ b/contrib/gcc-5.0/gcc/tree-vect-loop.c @@ -2653,12 +2653,13 @@ vect_force_simple_reduction (loop_vec_info loop_info, gimple phi, /* Calculate the cost of one scalar iteration of the loop. */ int -vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo) +vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo, + stmt_vector_for_cost *scalar_cost_vec) { struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo); int nbbs = loop->num_nodes, factor, scalar_single_iter_cost = 0; - int innerloop_iters, i, stmt_cost; + int innerloop_iters, i; /* Count statements in scalar loop. Using this as scalar cost for a single iteration for now. @@ -2699,17 +2700,20 @@ vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo) && !STMT_VINFO_IN_PATTERN_P (stmt_info)) continue; + vect_cost_for_stmt kind; if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt))) { if (DR_IS_READ (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)))) - stmt_cost = vect_get_stmt_cost (scalar_load); + kind = scalar_load; else - stmt_cost = vect_get_stmt_cost (scalar_store); + kind = scalar_store; } else - stmt_cost = vect_get_stmt_cost (scalar_stmt); + kind = scalar_stmt; - scalar_single_iter_cost += stmt_cost * factor; + scalar_single_iter_cost + += record_stmt_cost (scalar_cost_vec, factor, kind, + NULL, 0, vect_prologue); } } return scalar_single_iter_cost; @@ -2719,7 +2723,7 @@ vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo) int vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, int *peel_iters_epilogue, - int scalar_single_iter_cost, + stmt_vector_for_cost *scalar_cost_vec, stmt_vector_for_cost *prologue_cost_vec, stmt_vector_for_cost *epilogue_cost_vec) { @@ -2736,8 +2740,10 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, /* If peeled iterations are known but number of scalar loop iterations are unknown, count a taken branch per peeled loop. */ - retval = record_stmt_cost (prologue_cost_vec, 2, cond_branch_taken, + retval = record_stmt_cost (prologue_cost_vec, 1, cond_branch_taken, NULL, 0, vect_prologue); + retval = record_stmt_cost (prologue_cost_vec, 1, cond_branch_taken, + NULL, 0, vect_epilogue); } else { @@ -2751,14 +2757,21 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, *peel_iters_epilogue = vf; } + stmt_info_for_cost *si; + int j; if (peel_iters_prologue) - retval += record_stmt_cost (prologue_cost_vec, - peel_iters_prologue * scalar_single_iter_cost, - scalar_stmt, NULL, 0, vect_prologue); + FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) + retval += record_stmt_cost (prologue_cost_vec, + si->count * peel_iters_prologue, + si->kind, NULL, si->misalign, + vect_prologue); if (*peel_iters_epilogue) - retval += record_stmt_cost (epilogue_cost_vec, - *peel_iters_epilogue * scalar_single_iter_cost, - scalar_stmt, NULL, 0, vect_epilogue); + FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) + retval += record_stmt_cost (epilogue_cost_vec, + si->count * *peel_iters_epilogue, + si->kind, NULL, si->misalign, + vect_epilogue); + return retval; } @@ -2833,12 +2846,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, TODO: Consider assigning different costs to different scalar statements. */ - scalar_single_iter_cost = vect_get_single_scalar_iteration_cost (loop_vinfo); - /* ??? Below we use this cost as number of stmts with scalar_stmt cost, - thus divide by that. This introduces rounding errors, thus better - introduce a new cost kind (raw_cost? scalar_iter_cost?). */ - int scalar_single_iter_stmts - = scalar_single_iter_cost / vect_get_stmt_cost (scalar_stmt); + auto_vec scalar_cost_vec; + scalar_single_iter_cost + = vect_get_single_scalar_iteration_cost (loop_vinfo, &scalar_cost_vec); /* Add additional cost for the peeled instructions in prologue and epilogue loop. @@ -2866,18 +2876,29 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, branch per peeled loop. Even if scalar loop iterations are known, vector iterations are not known since peeled prologue iterations are not known. Hence guards remain the same. */ - (void) add_stmt_cost (target_cost_data, 2, cond_branch_taken, + (void) add_stmt_cost (target_cost_data, 1, cond_branch_taken, NULL, 0, vect_prologue); - (void) add_stmt_cost (target_cost_data, 2, cond_branch_not_taken, + (void) add_stmt_cost (target_cost_data, 1, cond_branch_not_taken, NULL, 0, vect_prologue); - /* FORNOW: Don't attempt to pass individual scalar instructions to - the model; just assume linear cost for scalar iterations. */ - (void) add_stmt_cost (target_cost_data, - peel_iters_prologue * scalar_single_iter_stmts, - scalar_stmt, NULL, 0, vect_prologue); - (void) add_stmt_cost (target_cost_data, - peel_iters_epilogue * scalar_single_iter_stmts, - scalar_stmt, NULL, 0, vect_epilogue); + (void) add_stmt_cost (target_cost_data, 1, cond_branch_taken, + NULL, 0, vect_epilogue); + (void) add_stmt_cost (target_cost_data, 1, cond_branch_not_taken, + NULL, 0, vect_epilogue); + stmt_info_for_cost *si; + int j; + FOR_EACH_VEC_ELT (scalar_cost_vec, j, si) + { + struct _stmt_vec_info *stmt_info + = si->stmt ? vinfo_for_stmt (si->stmt) : NULL; + (void) add_stmt_cost (target_cost_data, + si->count * peel_iters_prologue, + si->kind, stmt_info, si->misalign, + vect_prologue); + (void) add_stmt_cost (target_cost_data, + si->count * peel_iters_epilogue, + si->kind, stmt_info, si->misalign, + vect_epilogue); + } } else { @@ -2892,7 +2913,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, (void) vect_get_known_peeling_cost (loop_vinfo, peel_iters_prologue, &peel_iters_epilogue, - scalar_single_iter_stmts, + &scalar_cost_vec, &prologue_cost_vec, &epilogue_cost_vec); diff --git a/contrib/gcc-5.0/gcc/tree-vectorizer.h b/contrib/gcc-5.0/gcc/tree-vectorizer.h index 0ede62390f..66d592d523 100644 --- a/contrib/gcc-5.0/gcc/tree-vectorizer.h +++ b/contrib/gcc-5.0/gcc/tree-vectorizer.h @@ -1101,10 +1101,12 @@ extern bool vectorizable_reduction (gimple, gimple_stmt_iterator *, gimple *, extern bool vectorizable_induction (gimple, gimple_stmt_iterator *, gimple *); extern tree get_initial_def_for_reduction (gimple, tree, tree *); extern int vect_min_worthwhile_factor (enum tree_code); -extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, int, +extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, + stmt_vector_for_cost *, stmt_vector_for_cost *, stmt_vector_for_cost *); -extern int vect_get_single_scalar_iteration_cost (loop_vec_info); +extern int vect_get_single_scalar_iteration_cost (loop_vec_info, + stmt_vector_for_cost *); /* In tree-vect-slp.c. */ extern void vect_free_slp_instance (slp_instance); diff --git a/contrib/gcc-5.0/gcc/tree.h b/contrib/gcc-5.0/gcc/tree.h index 4fcc272c75..bedf103627 100644 --- a/contrib/gcc-5.0/gcc/tree.h +++ b/contrib/gcc-5.0/gcc/tree.h @@ -428,7 +428,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define CONVERT_EXPR_CODE_P(CODE) \ ((CODE) == NOP_EXPR || (CODE) == CONVERT_EXPR) -/* Similarly, but accept an expressions instead of a tree code. */ +/* Similarly, but accept an expression instead of a tree code. */ #define CONVERT_EXPR_P(EXP) CONVERT_EXPR_CODE_P (TREE_CODE (EXP)) /* Generate case for NOP_EXPR, CONVERT_EXPR. */ diff --git a/contrib/gcc-5.0/gcc/ubsan.c b/contrib/gcc-5.0/gcc/ubsan.c index b9d9f30e66..701e9f2922 100644 --- a/contrib/gcc-5.0/gcc/ubsan.c +++ b/contrib/gcc-5.0/gcc/ubsan.c @@ -1232,9 +1232,9 @@ instrument_mem_ref (tree mem, tree base, gimple_stmt_iterator *iter, tree t = TREE_OPERAND (base, 0); if (!POINTER_TYPE_P (TREE_TYPE (t))) return; - if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (TREE_TYPE (t))) && mem != base) + if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (base)) && mem != base) ikind = UBSAN_MEMBER_ACCESS; - tree kind = build_int_cst (TREE_TYPE (t), ikind); + tree kind = build_int_cst (build_pointer_type (TREE_TYPE (base)), ikind); tree alignt = build_int_cst (pointer_sized_int_node, align); gcall *g = gimple_build_call_internal (IFN_UBSAN_NULL, 3, t, kind, alignt); gimple_set_location (g, gimple_location (gsi_stmt (*iter))); diff --git a/contrib/gcc-5.0/gcc/valtrack.c b/contrib/gcc-5.0/gcc/valtrack.c index 804b8e880e..3dfb8a97ae 100644 --- a/contrib/gcc-5.0/gcc/valtrack.c +++ b/contrib/gcc-5.0/gcc/valtrack.c @@ -534,6 +534,22 @@ dead_debug_add (struct dead_debug_local *debug, df_ref use, unsigned int uregno) bitmap_set_bit (debug->used, uregno); } +/* Like lowpart_subreg, but if a subreg is not valid for machine, force + it anyway - for use in debug insns. */ + +static rtx +debug_lowpart_subreg (machine_mode outer_mode, rtx expr, + machine_mode inner_mode) +{ + if (inner_mode == VOIDmode) + inner_mode = GET_MODE (expr); + int offset = subreg_lowpart_offset (outer_mode, inner_mode); + rtx ret = simplify_gen_subreg (outer_mode, expr, inner_mode, offset); + if (ret) + return ret; + return gen_rtx_raw_SUBREG (outer_mode, expr, offset); +} + /* If UREGNO is referenced by any entry in DEBUG, emit a debug insn before or after INSN (depending on WHERE), that binds a (possibly global) debug temp to the widest-mode use of UREGNO, if WHERE is @@ -662,9 +678,9 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, /* Ok, it's the same (hardware) REG, but with a different mode, so SUBREG it. */ else - breg = lowpart_subreg (GET_MODE (reg), - cleanup_auto_inc_dec (src, VOIDmode), - GET_MODE (dest)); + breg = debug_lowpart_subreg (GET_MODE (reg), + cleanup_auto_inc_dec (src, VOIDmode), + GET_MODE (dest)); } else if (GET_CODE (dest) == SUBREG) { @@ -684,9 +700,9 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, breg = NULL; /* Yay, we can use SRC, just adjust its mode. */ else - breg = lowpart_subreg (GET_MODE (reg), - cleanup_auto_inc_dec (src, VOIDmode), - GET_MODE (dest)); + breg = debug_lowpart_subreg (GET_MODE (reg), + cleanup_auto_inc_dec (src, VOIDmode), + GET_MODE (dest)); } /* Oh well, we're out of luck. */ else @@ -740,7 +756,8 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, *DF_REF_REAL_LOC (cur->use) = dval; else *DF_REF_REAL_LOC (cur->use) - = gen_lowpart_SUBREG (GET_MODE (*DF_REF_REAL_LOC (cur->use)), dval); + = debug_lowpart_subreg (GET_MODE (*DF_REF_REAL_LOC (cur->use)), dval, + GET_MODE (dval)); /* ??? Should we simplify subreg of subreg? */ bitmap_set_bit (debug->to_rescan, INSN_UID (DF_REF_INSN (cur->use))); uses = cur->next; diff --git a/contrib/gcc-5.0/gcc/varasm.c b/contrib/gcc-5.0/gcc/varasm.c index 537a64d347..e644b1daa7 100644 --- a/contrib/gcc-5.0/gcc/varasm.c +++ b/contrib/gcc-5.0/gcc/varasm.c @@ -1928,17 +1928,18 @@ assemble_string (const char *p, int size) /* A noswitch_section_callback for lcomm_section. */ static bool -emit_local (tree decl, +emit_local (tree decl ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT size ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED) { - int align = symtab_node::get (decl)->definition_alignment (); #if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL + int align = symtab_node::get (decl)->definition_alignment (); ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name, size, align); return true; #elif defined ASM_OUTPUT_ALIGNED_LOCAL + int align = symtab_node::get (decl)->definition_alignment (); ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, align); return true; #else diff --git a/contrib/gcc-5.0/libcpp/files.c b/contrib/gcc-5.0/libcpp/files.c index a995071ad0..2f491224c6 100644 --- a/contrib/gcc-5.0/libcpp/files.c +++ b/contrib/gcc-5.0/libcpp/files.c @@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) /* If the file is not included as first include from either the toplevel file or the command-line it is not a valid use of PCH. */ - if (pfile->all_files - && pfile->all_files->next_file - && !(pfile->all_files->implicit_preinclude - || pfile->all_files->next_file->implicit_preinclude)) - return false; + for (_cpp_file *f = pfile->all_files; f; f = f->next_file) + if (f->implicit_preinclude) + continue; + else if (f->main_file) + break; + else + return false; flen = strlen (path); len = flen + sizeof (extension); diff --git a/contrib/gcc-5.0/libcpp/lex.c b/contrib/gcc-5.0/libcpp/lex.c index d1e221110f..ac96ff8dbe 100644 --- a/contrib/gcc-5.0/libcpp/lex.c +++ b/contrib/gcc-5.0/libcpp/lex.c @@ -2090,11 +2090,14 @@ cpp_peek_token (cpp_reader *pfile, int index) { peektok = _cpp_lex_token (pfile); if (peektok->type == CPP_EOF) - return peektok; + { + index--; + break; + } } while (index--); - _cpp_backup_tokens_direct (pfile, count + 1); + _cpp_backup_tokens_direct (pfile, count - index); pfile->keep_tokens--; pfile->cb.line_change = line_change; diff --git a/contrib/gcc-5.0/libgomp/libgomp-plugin.h b/contrib/gcc-5.0/libgomp/libgomp-plugin.h index d9cbff5fe7..1072ae467b 100644 --- a/contrib/gcc-5.0/libgomp/libgomp-plugin.h +++ b/contrib/gcc-5.0/libgomp/libgomp-plugin.h @@ -51,14 +51,12 @@ enum offload_target_type OFFLOAD_TARGET_TYPE_INTEL_MIC = 6 }; -/* Auxiliary struct, used for transferring a host-target address range mapping - from plugin to libgomp. */ -struct mapping_table +/* Auxiliary struct, used for transferring pairs of addresses from plugin + to libgomp. */ +struct addr_pair { - uintptr_t host_start; - uintptr_t host_end; - uintptr_t tgt_start; - uintptr_t tgt_end; + uintptr_t start; + uintptr_t end; }; /* Miscellaneous functions. */ diff --git a/contrib/gcc-5.0/libgomp/libgomp.h b/contrib/gcc-5.0/libgomp/libgomp.h index 3089401c47..5272f0154b 100644 --- a/contrib/gcc-5.0/libgomp/libgomp.h +++ b/contrib/gcc-5.0/libgomp/libgomp.h @@ -224,7 +224,6 @@ struct gomp_team_state }; struct target_mem_desc; -struct gomp_memory_mapping; /* These are the OpenMP 4.0 Internal Control Variables described in section 2.3.1. Those described as having one copy per task are @@ -656,9 +655,6 @@ struct target_mem_desc { /* Corresponding target device descriptor. */ struct gomp_device_descr *device_descr; - /* Memory mapping info for the thread that created this descriptor. */ - struct gomp_memory_mapping *mem_map; - /* List of splay keys to remove (or decrease refcount) at the end of region. */ splay_tree_key list[]; @@ -683,20 +679,6 @@ struct splay_tree_key_s { #include "splay-tree.h" -/* Information about mapped memory regions (per device/context). */ - -struct gomp_memory_mapping -{ - /* Mutex for operating with the splay tree and other shared structures. */ - gomp_mutex_t lock; - - /* True when tables have been added to this memory map. */ - bool is_initialized; - - /* Splay tree containing information about mapped memory regions. */ - struct splay_tree_s splay_tree; -}; - typedef struct acc_dispatch_t { /* This is a linked list of data mapped using the @@ -706,18 +688,6 @@ typedef struct acc_dispatch_t /* This is guarded by the lock in the "outer" struct gomp_device_descr. */ struct target_mem_desc *data_environ; - /* Extra information required for a device instance by a given target. */ - /* This is guarded by the lock in the "outer" struct gomp_device_descr. */ - void *target_data; - - /* Open or close a device instance. */ - void *(*open_device_func) (int n); - int (*close_device_func) (void *h); - - /* Set or get the device number. */ - int (*get_device_num_func) (void); - void (*set_device_num_func) (int); - /* Execute. */ void (*exec_func) (void (*) (void *), size_t, void **, void **, size_t *, unsigned short *, int, int, int, int, void *); @@ -735,7 +705,7 @@ typedef struct acc_dispatch_t void (*async_set_async_func) (int); /* Create/destroy TLS data. */ - void *(*create_thread_data_func) (void *); + void *(*create_thread_data_func) (int); void (*destroy_thread_data_func) (void *); /* NVIDIA target specific routines. */ @@ -773,19 +743,18 @@ struct gomp_device_descr unsigned int (*get_caps_func) (void); int (*get_type_func) (void); int (*get_num_devices_func) (void); - void (*register_image_func) (void *, void *); void (*init_device_func) (int); void (*fini_device_func) (int); - int (*get_table_func) (int, struct mapping_table **); + int (*load_image_func) (int, void *, struct addr_pair **); + void (*unload_image_func) (int, void *); void *(*alloc_func) (int, size_t); void (*free_func) (int, void *); void *(*dev2host_func) (int, void *, const void *, size_t); void *(*host2dev_func) (int, void *, const void *, size_t); void (*run_func) (int, void *, void *); - /* Memory-mapping info for this device instance. */ - /* Uses a separate lock. */ - struct gomp_memory_mapping mem_map; + /* Splay tree containing information about mapped memory regions. */ + struct splay_tree_s mem_map; /* Mutex for the mutable data. */ gomp_mutex_t lock; @@ -793,9 +762,6 @@ struct gomp_device_descr /* Set to true when device is initialized. */ bool is_initialized; - /* True when offload regions have been registered with this device. */ - bool offload_regions_registered; - /* OpenACC-specific data and functions. */ /* This is mutable because of its mutable data_environ and target_data members. */ @@ -811,9 +777,7 @@ extern struct target_mem_desc *gomp_map_vars (struct gomp_device_descr *, extern void gomp_copy_from_async (struct target_mem_desc *); extern void gomp_unmap_vars (struct target_mem_desc *, bool); extern void gomp_init_device (struct gomp_device_descr *); -extern void gomp_init_tables (struct gomp_device_descr *, - struct gomp_memory_mapping *); -extern void gomp_free_memmap (struct gomp_memory_mapping *); +extern void gomp_free_memmap (struct splay_tree_s *); extern void gomp_fini_device (struct gomp_device_descr *); /* work.c */ diff --git a/contrib/gcc-5.0/libgomp/libgomp.map b/contrib/gcc-5.0/libgomp/libgomp.map index f44174e83b..2b2b953e48 100644 --- a/contrib/gcc-5.0/libgomp/libgomp.map +++ b/contrib/gcc-5.0/libgomp/libgomp.map @@ -231,6 +231,7 @@ GOMP_4.0 { GOMP_4.0.1 { global: GOMP_offload_register; + GOMP_offload_unregister; } GOMP_4.0; OACC_2.0 { diff --git a/contrib/gcc-5.0/libgomp/oacc-async.c b/contrib/gcc-5.0/libgomp/oacc-async.c index 08b7c5e194..1f5827e79f 100644 --- a/contrib/gcc-5.0/libgomp/oacc-async.c +++ b/contrib/gcc-5.0/libgomp/oacc-async.c @@ -26,7 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ - +#include #include "openacc.h" #include "libgomp.h" #include "oacc-int.h" @@ -37,13 +37,23 @@ acc_async_test (int async) if (async < acc_async_sync) gomp_fatal ("invalid async argument: %d", async); - return base_dev->openacc.async_test_func (async); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + return thr->dev->openacc.async_test_func (async); } int acc_async_test_all (void) { - return base_dev->openacc.async_test_all_func (); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + return thr->dev->openacc.async_test_all_func (); } void @@ -52,19 +62,34 @@ acc_wait (int async) if (async < acc_async_sync) gomp_fatal ("invalid async argument: %d", async); - base_dev->openacc.async_wait_func (async); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + thr->dev->openacc.async_wait_func (async); } void acc_wait_async (int async1, int async2) { - base_dev->openacc.async_wait_async_func (async1, async2); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + thr->dev->openacc.async_wait_async_func (async1, async2); } void acc_wait_all (void) { - base_dev->openacc.async_wait_all_func (); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + thr->dev->openacc.async_wait_all_func (); } void @@ -73,5 +98,10 @@ acc_wait_all_async (int async) if (async < acc_async_sync) gomp_fatal ("invalid async argument: %d", async); - base_dev->openacc.async_wait_all_async_func (async); + struct goacc_thread *thr = goacc_thread (); + + if (!thr || !thr->dev) + gomp_fatal ("no device active"); + + thr->dev->openacc.async_wait_all_async_func (async); } diff --git a/contrib/gcc-5.0/libgomp/oacc-cuda.c b/contrib/gcc-5.0/libgomp/oacc-cuda.c index c8ef376e3a..4aab4221a4 100644 --- a/contrib/gcc-5.0/libgomp/oacc-cuda.c +++ b/contrib/gcc-5.0/libgomp/oacc-cuda.c @@ -34,51 +34,53 @@ void * acc_get_current_cuda_device (void) { - void *p = NULL; + struct goacc_thread *thr = goacc_thread (); - if (base_dev && base_dev->openacc.cuda.get_current_device_func) - p = base_dev->openacc.cuda.get_current_device_func (); + if (thr && thr->dev && thr->dev->openacc.cuda.get_current_device_func) + return thr->dev->openacc.cuda.get_current_device_func (); - return p; + return NULL; } void * acc_get_current_cuda_context (void) { - void *p = NULL; + struct goacc_thread *thr = goacc_thread (); - if (base_dev && base_dev->openacc.cuda.get_current_context_func) - p = base_dev->openacc.cuda.get_current_context_func (); - - return p; + if (thr && thr->dev && thr->dev->openacc.cuda.get_current_context_func) + return thr->dev->openacc.cuda.get_current_context_func (); + + return NULL; } void * acc_get_cuda_stream (int async) { - void *p = NULL; + struct goacc_thread *thr = goacc_thread (); if (async < 0) - return p; - - if (base_dev && base_dev->openacc.cuda.get_stream_func) - p = base_dev->openacc.cuda.get_stream_func (async); + return NULL; - return p; + if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func) + return thr->dev->openacc.cuda.get_stream_func (async); + + return NULL; } int acc_set_cuda_stream (int async, void *stream) { - int s = -1; + struct goacc_thread *thr; if (async < 0 || stream == NULL) return 0; goacc_lazy_initialize (); - if (base_dev && base_dev->openacc.cuda.set_stream_func) - s = base_dev->openacc.cuda.set_stream_func (async, stream); + thr = goacc_thread (); + + if (thr && thr->dev && thr->dev->openacc.cuda.set_stream_func) + return thr->dev->openacc.cuda.set_stream_func (async, stream); - return s; + return -1; } diff --git a/contrib/gcc-5.0/libgomp/oacc-host.c b/contrib/gcc-5.0/libgomp/oacc-host.c index 6aeb1e765d..6dcdbf3658 100644 --- a/contrib/gcc-5.0/libgomp/oacc-host.c +++ b/contrib/gcc-5.0/libgomp/oacc-host.c @@ -43,28 +43,19 @@ static struct gomp_device_descr host_dispatch = .get_caps_func = GOMP_OFFLOAD_get_caps, .get_type_func = GOMP_OFFLOAD_get_type, .get_num_devices_func = GOMP_OFFLOAD_get_num_devices, - .register_image_func = GOMP_OFFLOAD_register_image, .init_device_func = GOMP_OFFLOAD_init_device, .fini_device_func = GOMP_OFFLOAD_fini_device, - .get_table_func = GOMP_OFFLOAD_get_table, + .load_image_func = GOMP_OFFLOAD_load_image, + .unload_image_func = GOMP_OFFLOAD_unload_image, .alloc_func = GOMP_OFFLOAD_alloc, .free_func = GOMP_OFFLOAD_free, .dev2host_func = GOMP_OFFLOAD_dev2host, .host2dev_func = GOMP_OFFLOAD_host2dev, .run_func = GOMP_OFFLOAD_run, - .mem_map.is_initialized = false, - .mem_map.splay_tree.root = NULL, .is_initialized = false, - .offload_regions_registered = false, .openacc = { - .open_device_func = GOMP_OFFLOAD_openacc_open_device, - .close_device_func = GOMP_OFFLOAD_openacc_close_device, - - .get_device_num_func = GOMP_OFFLOAD_openacc_get_device_num, - .set_device_num_func = GOMP_OFFLOAD_openacc_set_device_num, - .exec_func = GOMP_OFFLOAD_openacc_parallel, .register_async_cleanup_func @@ -94,7 +85,6 @@ static struct gomp_device_descr host_dispatch = static __attribute__ ((constructor)) void goacc_host_init (void) { - gomp_mutex_init (&host_dispatch.mem_map.lock); gomp_mutex_init (&host_dispatch.lock); goacc_register (&host_dispatch); } diff --git a/contrib/gcc-5.0/libgomp/oacc-init.c b/contrib/gcc-5.0/libgomp/oacc-init.c index 166eb553a6..dc40fb6ffe 100644 --- a/contrib/gcc-5.0/libgomp/oacc-init.c +++ b/contrib/gcc-5.0/libgomp/oacc-init.c @@ -37,14 +37,13 @@ static gomp_mutex_t acc_device_lock; -/* The dispatch table for the current accelerator device. This is global, so - you can only have one type of device open at any given time in a program. - This is the "base" device in that several devices that use the same - dispatch table may be active concurrently: this one (the "zeroth") is used - for overall initialisation/shutdown, and other instances -- not necessarily - including this one -- may be opened and closed once the base device has - been initialized. */ -struct gomp_device_descr *base_dev; +/* A cached version of the dispatcher for the global "current" accelerator type, + e.g. used as the default when creating new host threads. This is the + device-type equivalent of goacc_device_num (which specifies which device to + use out of potentially several of the same type). If there are several + devices of a given type, this points at the first one. */ + +static struct gomp_device_descr *cached_base_dev = NULL; #if defined HAVE_TLS || defined USE_EMUTLS __thread struct goacc_thread *goacc_tls_data; @@ -53,9 +52,6 @@ pthread_key_t goacc_tls_key; #endif static pthread_key_t goacc_cleanup_key; -/* Current dispatcher, and how it was initialized */ -static acc_device_t init_key = _ACC_device_hwm; - static struct goacc_thread *goacc_threads; static gomp_mutex_t goacc_thread_lock; @@ -94,6 +90,21 @@ get_openacc_name (const char *name) return name; } +static const char * +name_of_acc_device_t (enum acc_device_t type) +{ + switch (type) + { + case acc_device_none: return "none"; + case acc_device_default: return "default"; + case acc_device_host: return "host"; + case acc_device_host_nonshm: return "host_nonshm"; + case acc_device_not_host: return "not_host"; + case acc_device_nvidia: return "nvidia"; + default: gomp_fatal ("unknown device type %u", (unsigned) type); + } +} + static struct gomp_device_descr * resolve_device (acc_device_t d) { @@ -159,22 +170,87 @@ resolve_device (acc_device_t d) static struct gomp_device_descr * acc_init_1 (acc_device_t d) { - struct gomp_device_descr *acc_dev; + struct gomp_device_descr *base_dev, *acc_dev; + int ndevs; - acc_dev = resolve_device (d); + base_dev = resolve_device (d); + + ndevs = base_dev->get_num_devices_func (); + + if (!base_dev || ndevs <= 0 || goacc_device_num >= ndevs) + gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); - if (!acc_dev || acc_dev->get_num_devices_func () <= 0) - gomp_fatal ("device %u not supported", (unsigned)d); + acc_dev = &base_dev[goacc_device_num]; if (acc_dev->is_initialized) gomp_fatal ("device already active"); - /* We need to remember what we were intialized as, to check shutdown etc. */ - init_key = d; - gomp_init_device (acc_dev); - return acc_dev; + return base_dev; +} + +static void +acc_shutdown_1 (acc_device_t d) +{ + struct gomp_device_descr *base_dev; + struct goacc_thread *walk; + int ndevs, i; + bool devices_active = false; + + /* Get the base device for this device type. */ + base_dev = resolve_device (d); + + if (!base_dev) + gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); + + gomp_mutex_lock (&goacc_thread_lock); + + /* Free target-specific TLS data and close all devices. */ + for (walk = goacc_threads; walk != NULL; walk = walk->next) + { + if (walk->target_tls) + base_dev->openacc.destroy_thread_data_func (walk->target_tls); + + walk->target_tls = NULL; + + /* This would mean the user is shutting down OpenACC in the middle of an + "acc data" pragma. Likely not intentional. */ + if (walk->mapped_data) + gomp_fatal ("shutdown in 'acc data' region"); + + /* Similarly, if this happens then user code has done something weird. */ + if (walk->saved_bound_dev) + gomp_fatal ("shutdown during host fallback"); + + if (walk->dev) + { + gomp_mutex_lock (&walk->dev->lock); + gomp_free_memmap (&walk->dev->mem_map); + gomp_mutex_unlock (&walk->dev->lock); + + walk->dev = NULL; + walk->base_dev = NULL; + } + } + + gomp_mutex_unlock (&goacc_thread_lock); + + ndevs = base_dev->get_num_devices_func (); + + /* Close all the devices of this type that have been opened. */ + for (i = 0; i < ndevs; i++) + { + struct gomp_device_descr *acc_dev = &base_dev[i]; + if (acc_dev->is_initialized) + { + devices_active = true; + gomp_fini_device (acc_dev); + } + } + + if (!devices_active) + gomp_fatal ("no device initialized"); } static struct goacc_thread * @@ -207,9 +283,11 @@ goacc_destroy_thread (void *data) if (thr) { - if (base_dev && thr->target_tls) + struct gomp_device_descr *acc_dev = thr->dev; + + if (acc_dev && thr->target_tls) { - base_dev->openacc.destroy_thread_data_func (thr->target_tls); + acc_dev->openacc.destroy_thread_data_func (thr->target_tls); thr->target_tls = NULL; } @@ -236,60 +314,50 @@ goacc_destroy_thread (void *data) gomp_mutex_unlock (&goacc_thread_lock); } -/* Open the ORD'th device of the currently-active type (base_dev must be - initialised before calling). If ORD is < 0, open the default-numbered - device (set by the ACC_DEVICE_NUM environment variable or a call to - acc_set_device_num), or leave any currently-opened device as is. "Opening" - consists of calling the device's open_device_func hook, and setting up - thread-local data (maybe allocating, then initializing with information - pertaining to the newly-opened or previously-opened device). */ +/* Use the ORD'th device instance for the current host thread (or -1 for the + current global default). The device (and the runtime) must be initialised + before calling this function. */ -static void -lazy_open (int ord) +void +goacc_attach_host_thread_to_device (int ord) { struct goacc_thread *thr = goacc_thread (); - struct gomp_device_descr *acc_dev; - - if (thr && thr->dev) - { - assert (ord < 0 || ord == thr->dev->target_id); - return; - } - - assert (base_dev); - + struct gomp_device_descr *acc_dev = NULL, *base_dev = NULL; + int num_devices; + + if (thr && thr->dev && (thr->dev->target_id == ord || ord < 0)) + return; + if (ord < 0) ord = goacc_device_num; - - /* The OpenACC 2.0 spec leaves the runtime's behaviour when an out-of-range - device is requested as implementation-defined (4.2 ACC_DEVICE_NUM). - We choose to raise an error in such a case. */ - if (ord >= base_dev->get_num_devices_func ()) - gomp_fatal ("device %u does not exist", ord); - + + /* Decide which type of device to use. If the current thread has a device + type already (e.g. set by acc_set_device_type), use that, else use the + global default. */ + if (thr && thr->base_dev) + base_dev = thr->base_dev; + else + { + assert (cached_base_dev); + base_dev = cached_base_dev; + } + + num_devices = base_dev->get_num_devices_func (); + if (num_devices <= 0 || ord >= num_devices) + gomp_fatal ("device %u out of range", ord); + if (!thr) thr = goacc_new_thread (); - - acc_dev = thr->dev = &base_dev[ord]; - - assert (acc_dev->target_id == ord); - + + thr->base_dev = base_dev; + thr->dev = acc_dev = &base_dev[ord]; thr->saved_bound_dev = NULL; thr->mapped_data = NULL; - - if (!acc_dev->openacc.target_data) - acc_dev->openacc.target_data = acc_dev->openacc.open_device_func (ord); - + thr->target_tls - = acc_dev->openacc.create_thread_data_func (acc_dev->openacc.target_data); - + = acc_dev->openacc.create_thread_data_func (ord); + acc_dev->openacc.async_set_async_func (acc_async_sync); - - struct gomp_memory_mapping *mem_map = &acc_dev->mem_map; - gomp_mutex_lock (&mem_map->lock); - if (!mem_map->is_initialized) - gomp_init_tables (acc_dev, mem_map); - gomp_mutex_unlock (&mem_map->lock); } /* OpenACC 2.0a (3.2.12, 3.2.13) doesn't specify whether the serialization of @@ -298,75 +366,20 @@ lazy_open (int ord) void acc_init (acc_device_t d) { - if (!base_dev) + if (!cached_base_dev) gomp_init_targets_once (); gomp_mutex_lock (&acc_device_lock); - base_dev = acc_init_1 (d); - - lazy_open (-1); + cached_base_dev = acc_init_1 (d); gomp_mutex_unlock (&acc_device_lock); + + goacc_attach_host_thread_to_device (-1); } ialias (acc_init) -static void -acc_shutdown_1 (acc_device_t d) -{ - struct goacc_thread *walk; - - /* We don't check whether d matches the actual device found, because - OpenACC 2.0 (3.2.12) says the parameters to the init and this - call must match (for the shutdown call anyway, it's silent on - others). */ - - if (!base_dev) - gomp_fatal ("no device initialized"); - if (d != init_key) - gomp_fatal ("device %u(%u) is initialized", - (unsigned) init_key, (unsigned) base_dev->type); - - gomp_mutex_lock (&goacc_thread_lock); - - /* Free target-specific TLS data and close all devices. */ - for (walk = goacc_threads; walk != NULL; walk = walk->next) - { - if (walk->target_tls) - base_dev->openacc.destroy_thread_data_func (walk->target_tls); - - walk->target_tls = NULL; - - /* This would mean the user is shutting down OpenACC in the middle of an - "acc data" pragma. Likely not intentional. */ - if (walk->mapped_data) - gomp_fatal ("shutdown in 'acc data' region"); - - if (walk->dev) - { - void *target_data = walk->dev->openacc.target_data; - if (walk->dev->openacc.close_device_func (target_data) < 0) - gomp_fatal ("failed to close device"); - - walk->dev->openacc.target_data = target_data = NULL; - - struct gomp_memory_mapping *mem_map = &walk->dev->mem_map; - gomp_mutex_lock (&mem_map->lock); - gomp_free_memmap (mem_map); - gomp_mutex_unlock (&mem_map->lock); - - walk->dev = NULL; - } - } - - gomp_mutex_unlock (&goacc_thread_lock); - - gomp_fini_device (base_dev); - - base_dev = NULL; -} - void acc_shutdown (acc_device_t d) { @@ -379,59 +392,16 @@ acc_shutdown (acc_device_t d) ialias (acc_shutdown) -/* This function is called after plugins have been initialized. It deals with - the "base" device, and is used to prepare the runtime for dealing with a - number of such devices (as implemented by some particular plugin). If the - argument device type D matches a previous call to the function, return the - current base device, else shut the old device down and re-initialize with - the new device type. */ - -static struct gomp_device_descr * -lazy_init (acc_device_t d) -{ - if (base_dev) - { - /* Re-initializing the same device, do nothing. */ - if (d == init_key) - return base_dev; - - acc_shutdown_1 (init_key); - } - - assert (!base_dev); - - return acc_init_1 (d); -} - -/* Ensure that plugins are loaded, initialize and open the (default-numbered) - device. */ - -static void -lazy_init_and_open (acc_device_t d) -{ - if (!base_dev) - gomp_init_targets_once (); - - gomp_mutex_lock (&acc_device_lock); - - base_dev = lazy_init (d); - - lazy_open (-1); - - gomp_mutex_unlock (&acc_device_lock); -} - int acc_get_num_devices (acc_device_t d) { int n = 0; - const struct gomp_device_descr *acc_dev; + struct gomp_device_descr *acc_dev; if (d == acc_device_none) return 0; - if (!base_dev) - gomp_init_targets_once (); + gomp_init_targets_once (); acc_dev = resolve_device (d); if (!acc_dev) @@ -446,10 +416,39 @@ acc_get_num_devices (acc_device_t d) ialias (acc_get_num_devices) +/* Set the device type for the current thread only (using the current global + default device number), initialising that device if necessary. Also set the + default device type for new threads to D. */ + void acc_set_device_type (acc_device_t d) { - lazy_init_and_open (d); + struct gomp_device_descr *base_dev, *acc_dev; + struct goacc_thread *thr = goacc_thread (); + + gomp_mutex_lock (&acc_device_lock); + + if (!cached_base_dev) + gomp_init_targets_once (); + + cached_base_dev = base_dev = resolve_device (d); + acc_dev = &base_dev[goacc_device_num]; + + if (!acc_dev->is_initialized) + gomp_init_device (acc_dev); + + gomp_mutex_unlock (&acc_device_lock); + + /* We're changing device type: invalidate the current thread's dev and + base_dev pointers. */ + if (thr && thr->base_dev != base_dev) + { + thr->base_dev = thr->dev = NULL; + if (thr->mapped_data) + gomp_fatal ("acc_set_device_type in 'acc data' region"); + } + + goacc_attach_host_thread_to_device (-1); } ialias (acc_set_device_type) @@ -458,10 +457,11 @@ acc_device_t acc_get_device_type (void) { acc_device_t res = acc_device_none; - const struct gomp_device_descr *dev; + struct gomp_device_descr *dev; + struct goacc_thread *thr = goacc_thread (); - if (base_dev) - res = acc_device_type (base_dev->type); + if (thr && thr->base_dev) + res = acc_device_type (thr->base_dev->type); else { gomp_init_targets_once (); @@ -482,78 +482,65 @@ int acc_get_device_num (acc_device_t d) { const struct gomp_device_descr *dev; - int num; + struct goacc_thread *thr = goacc_thread (); if (d >= _ACC_device_hwm) gomp_fatal ("device %u out of range", (unsigned)d); - if (!base_dev) + if (!cached_base_dev) gomp_init_targets_once (); dev = resolve_device (d); if (!dev) - gomp_fatal ("no devices of type %u", d); + gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); - /* We might not have called lazy_open for this host thread yet, in which case - the get_device_num_func hook will return -1. */ - num = dev->openacc.get_device_num_func (); - if (num < 0) - num = goacc_device_num; + if (thr && thr->base_dev == dev && thr->dev) + return thr->dev->target_id; - return num; + return goacc_device_num; } ialias (acc_get_device_num) void -acc_set_device_num (int n, acc_device_t d) +acc_set_device_num (int ord, acc_device_t d) { - const struct gomp_device_descr *dev; + struct gomp_device_descr *base_dev, *acc_dev; int num_devices; - if (!base_dev) + if (!cached_base_dev) gomp_init_targets_once (); - if ((int) d == 0) - { - int i; - - /* A device setting of zero sets all device types on the system to use - the Nth instance of that device type. Only attempt it for initialized - devices though. */ - for (i = acc_device_not_host + 1; i < _ACC_device_hwm; i++) - { - dev = resolve_device (d); - if (dev && dev->is_initialized) - dev->openacc.set_device_num_func (n); - } + if (ord < 0) + ord = goacc_device_num; - /* ...and for future calls to acc_init/acc_set_device_type, etc. */ - goacc_device_num = n; - } + if ((int) d == 0) + /* Set whatever device is being used by the current host thread to use + device instance ORD. It's unclear if this is supposed to affect other + host threads too (OpenACC 2.0 (3.2.4) acc_set_device_num). */ + goacc_attach_host_thread_to_device (ord); else { - struct goacc_thread *thr = goacc_thread (); - gomp_mutex_lock (&acc_device_lock); - base_dev = lazy_init (d); + cached_base_dev = base_dev = resolve_device (d); num_devices = base_dev->get_num_devices_func (); - if (n >= num_devices) - gomp_fatal ("device %u out of range", n); + if (ord >= num_devices) + gomp_fatal ("device %u out of range", ord); - /* If we're changing the device number, de-associate this thread with - the device (but don't close the device, since it may be in use by - other threads). */ - if (thr && thr->dev && n != thr->dev->target_id) - thr->dev = NULL; + acc_dev = &base_dev[ord]; - lazy_open (n); + if (!acc_dev->is_initialized) + gomp_init_device (acc_dev); gomp_mutex_unlock (&acc_device_lock); + + goacc_attach_host_thread_to_device (ord); } + + goacc_device_num = ord; } ialias (acc_set_device_num) @@ -561,10 +548,7 @@ ialias (acc_set_device_num) int acc_on_device (acc_device_t dev) { - struct goacc_thread *thr = goacc_thread (); - - if (thr && thr->dev - && acc_device_type (thr->dev->type) == acc_device_host_nonshm) + if (acc_get_device_type () == acc_device_host_nonshm) return dev == acc_device_host_nonshm || dev == acc_device_not_host; /* Just rely on the compiler builtin. */ @@ -584,7 +568,7 @@ goacc_runtime_initialize (void) pthread_key_create (&goacc_cleanup_key, goacc_destroy_thread); - base_dev = NULL; + cached_base_dev = NULL; goacc_threads = NULL; gomp_mutex_init (&goacc_thread_lock); @@ -613,9 +597,8 @@ goacc_restore_bind (void) } /* This is called from any OpenACC support function that may need to implicitly - initialize the libgomp runtime. On exit all such initialization will have - been done, and both the global ACC_dev and the per-host-thread ACC_memmap - pointers will be valid. */ + initialize the libgomp runtime, either globally or from a new host thread. + On exit "goacc_thread" will return a valid & populated thread block. */ attribute_hidden void goacc_lazy_initialize (void) @@ -625,12 +608,8 @@ goacc_lazy_initialize (void) if (thr && thr->dev) return; - if (!base_dev) - lazy_init_and_open (acc_device_default); + if (!cached_base_dev) + acc_init (acc_device_default); else - { - gomp_mutex_lock (&acc_device_lock); - lazy_open (-1); - gomp_mutex_unlock (&acc_device_lock); - } + goacc_attach_host_thread_to_device (-1); } diff --git a/contrib/gcc-5.0/libgomp/oacc-int.h b/contrib/gcc-5.0/libgomp/oacc-int.h index 85619c8d10..0ace737884 100644 --- a/contrib/gcc-5.0/libgomp/oacc-int.h +++ b/contrib/gcc-5.0/libgomp/oacc-int.h @@ -56,6 +56,9 @@ acc_device_type (enum offload_target_type type) struct goacc_thread { + /* The base device for the current thread. */ + struct gomp_device_descr *base_dev; + /* The device for the current thread. */ struct gomp_device_descr *dev; @@ -89,10 +92,7 @@ goacc_thread (void) #endif void goacc_register (struct gomp_device_descr *) __GOACC_NOTHROW; - -/* Current dispatcher. */ -extern struct gomp_device_descr *base_dev; - +void goacc_attach_host_thread_to_device (int); void goacc_runtime_initialize (void); void goacc_save_and_set_bind (acc_device_t); void goacc_restore_bind (void); diff --git a/contrib/gcc-5.0/libgomp/oacc-mem.c b/contrib/gcc-5.0/libgomp/oacc-mem.c index 0096d51429..89ef5fcd88 100644 --- a/contrib/gcc-5.0/libgomp/oacc-mem.c +++ b/contrib/gcc-5.0/libgomp/oacc-mem.c @@ -38,7 +38,7 @@ /* Return block containing [H->S), or NULL if not contained. */ static splay_tree_key -lookup_host (struct gomp_memory_mapping *mem_map, void *h, size_t s) +lookup_host (struct gomp_device_descr *dev, void *h, size_t s) { struct splay_tree_key_s node; splay_tree_key key; @@ -46,11 +46,9 @@ lookup_host (struct gomp_memory_mapping *mem_map, void *h, size_t s) node.host_start = (uintptr_t) h; node.host_end = (uintptr_t) h + s; - gomp_mutex_lock (&mem_map->lock); - - key = splay_tree_lookup (&mem_map->splay_tree, &node); - - gomp_mutex_unlock (&mem_map->lock); + gomp_mutex_lock (&dev->lock); + key = splay_tree_lookup (&dev->mem_map, &node); + gomp_mutex_unlock (&dev->lock); return key; } @@ -65,14 +63,11 @@ lookup_dev (struct target_mem_desc *tgt, void *d, size_t s) { int i; struct target_mem_desc *t; - struct gomp_memory_mapping *mem_map; if (!tgt) return NULL; - mem_map = tgt->mem_map; - - gomp_mutex_lock (&mem_map->lock); + gomp_mutex_lock (&tgt->device_descr->lock); for (t = tgt; t != NULL; t = t->prev) { @@ -80,7 +75,7 @@ lookup_dev (struct target_mem_desc *tgt, void *d, size_t s) break; } - gomp_mutex_unlock (&mem_map->lock); + gomp_mutex_unlock (&tgt->device_descr->lock); if (!t) return NULL; @@ -112,7 +107,9 @@ acc_malloc (size_t s) struct goacc_thread *thr = goacc_thread (); - return base_dev->alloc_func (thr->dev->target_id, s); + assert (thr->dev); + + return thr->dev->alloc_func (thr->dev->target_id, s); } /* OpenACC 2.0a (3.2.16) doesn't specify what to do in the event @@ -127,6 +124,8 @@ acc_free (void *d) if (!d) return; + assert (thr && thr->dev); + /* We don't have to call lazy open here, as the ptr value must have been returned by acc_malloc. It's not permitted to pass NULL in (unless you got that null from acc_malloc). */ @@ -139,7 +138,7 @@ acc_free (void *d) acc_unmap_data ((void *)(k->host_start + offset)); } - base_dev->free_func (thr->dev->target_id, d); + thr->dev->free_func (thr->dev->target_id, d); } void @@ -149,7 +148,9 @@ acc_memcpy_to_device (void *d, void *h, size_t s) been obtained from a routine that did that. */ struct goacc_thread *thr = goacc_thread (); - base_dev->host2dev_func (thr->dev->target_id, d, h, s); + assert (thr && thr->dev); + + thr->dev->host2dev_func (thr->dev->target_id, d, h, s); } void @@ -159,7 +160,9 @@ acc_memcpy_from_device (void *h, void *d, size_t s) been obtained from a routine that did that. */ struct goacc_thread *thr = goacc_thread (); - base_dev->dev2host_func (thr->dev->target_id, h, d, s); + assert (thr && thr->dev); + + thr->dev->dev2host_func (thr->dev->target_id, h, d, s); } /* Return the device pointer that corresponds to host data H. Or NULL @@ -176,7 +179,7 @@ acc_deviceptr (void *h) struct goacc_thread *thr = goacc_thread (); - n = lookup_host (&thr->dev->mem_map, h, 1); + n = lookup_host (thr->dev, h, 1); if (!n) return NULL; @@ -229,7 +232,7 @@ acc_is_present (void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; - n = lookup_host (&acc_dev->mem_map, h, s); + n = lookup_host (acc_dev, h, s); if (n && ((uintptr_t)h < n->host_start || (uintptr_t)h + s > n->host_end @@ -271,7 +274,7 @@ acc_map_data (void *h, void *d, size_t s) gomp_fatal ("[%p,+%d]->[%p,+%d] is a bad map", (void *)h, (int)s, (void *)d, (int)s); - if (lookup_host (&acc_dev->mem_map, h, s)) + if (lookup_host (acc_dev, h, s)) gomp_fatal ("host address [%p, +%d] is already mapped", (void *)h, (int)s); @@ -296,7 +299,7 @@ acc_unmap_data (void *h) /* No need to call lazy open, as the address must have been mapped. */ size_t host_size; - splay_tree_key n = lookup_host (&acc_dev->mem_map, h, 1); + splay_tree_key n = lookup_host (acc_dev, h, 1); struct target_mem_desc *t; if (!n) @@ -320,7 +323,7 @@ acc_unmap_data (void *h) t->tgt_end = 0; t->to_free = 0; - gomp_mutex_lock (&acc_dev->mem_map.lock); + gomp_mutex_lock (&acc_dev->lock); for (tp = NULL, t = acc_dev->openacc.data_environ; t != NULL; tp = t, t = t->prev) @@ -334,7 +337,7 @@ acc_unmap_data (void *h) break; } - gomp_mutex_unlock (&acc_dev->mem_map.lock); + gomp_mutex_unlock (&acc_dev->lock); } gomp_unmap_vars (t, true); @@ -358,7 +361,7 @@ present_create_copy (unsigned f, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; - n = lookup_host (&acc_dev->mem_map, h, s); + n = lookup_host (acc_dev, h, s); if (n) { /* Present. */ @@ -389,13 +392,13 @@ present_create_copy (unsigned f, void *h, size_t s) tgt = gomp_map_vars (acc_dev, mapnum, &hostaddrs, NULL, &s, &kinds, true, false); - gomp_mutex_lock (&acc_dev->mem_map.lock); + gomp_mutex_lock (&acc_dev->lock); d = tgt->to_free; tgt->prev = acc_dev->openacc.data_environ; acc_dev->openacc.data_environ = tgt; - gomp_mutex_unlock (&acc_dev->mem_map.lock); + gomp_mutex_unlock (&acc_dev->lock); } return d; @@ -436,7 +439,7 @@ delete_copyout (unsigned f, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; - n = lookup_host (&acc_dev->mem_map, h, s); + n = lookup_host (acc_dev, h, s); /* No need to call lazy open, as the data must already have been mapped. */ @@ -479,7 +482,7 @@ update_dev_host (int is_dev, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; - n = lookup_host (&acc_dev->mem_map, h, s); + n = lookup_host (acc_dev, h, s); /* No need to call lazy open, as the data must already have been mapped. */ @@ -532,7 +535,7 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum) struct target_mem_desc *t; int minrefs = (mapnum == 1) ? 2 : 3; - n = lookup_host (&acc_dev->mem_map, h, 1); + n = lookup_host (acc_dev, h, 1); if (!n) gomp_fatal ("%p is not a mapped block", (void *)h); @@ -543,7 +546,7 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum) struct target_mem_desc *tp; - gomp_mutex_lock (&acc_dev->mem_map.lock); + gomp_mutex_lock (&acc_dev->lock); if (t->refcount == minrefs) { @@ -570,7 +573,7 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum) if (force_copyfrom) t->list[0]->copy_from = 1; - gomp_mutex_unlock (&acc_dev->mem_map.lock); + gomp_mutex_unlock (&acc_dev->lock); /* If running synchronously, unmap immediately. */ if (async < acc_async_noval) diff --git a/contrib/gcc-5.0/libgomp/oacc-parallel.c b/contrib/gcc-5.0/libgomp/oacc-parallel.c index 0c74f547a2..d8999463d6 100644 --- a/contrib/gcc-5.0/libgomp/oacc-parallel.c +++ b/contrib/gcc-5.0/libgomp/oacc-parallel.c @@ -49,32 +49,6 @@ find_pset (int pos, size_t mapnum, unsigned short *kinds) return kind == GOMP_MAP_TO_PSET; } - -/* Ensure that the target device for DEVICE_TYPE is initialised (and that - plugins have been loaded if appropriate). The ACC_dev variable for the - current thread will be set appropriately for the given device type on - return. */ - -attribute_hidden void -select_acc_device (int device_type) -{ - goacc_lazy_initialize (); - - if (device_type == GOMP_DEVICE_HOST_FALLBACK) - return; - - if (device_type == acc_device_none) - device_type = acc_device_host; - - if (device_type >= 0) - { - /* NOTE: this will go badly if the surrounding data environment is set up - to use a different device type. We'll just have to trust that users - know what they're doing... */ - acc_set_device_type (device_type); - } -} - static void goacc_wait (int async, int num_waits, va_list ap); void @@ -111,7 +85,7 @@ GOACC_parallel (int device, void (*fn) (void *), __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds, async); #endif - select_acc_device (device); + goacc_lazy_initialize (); thr = goacc_thread (); acc_dev = thr->dev; @@ -144,14 +118,14 @@ GOACC_parallel (int device, void (*fn) (void *), { k.host_start = (uintptr_t) fn; k.host_end = k.host_start + 1; - gomp_mutex_lock (&acc_dev->mem_map.lock); - tgt_fn_key = splay_tree_lookup (&acc_dev->mem_map.splay_tree, &k); - gomp_mutex_unlock (&acc_dev->mem_map.lock); + gomp_mutex_lock (&acc_dev->lock); + tgt_fn_key = splay_tree_lookup (&acc_dev->mem_map, &k); + gomp_mutex_unlock (&acc_dev->lock); if (tgt_fn_key == NULL) gomp_fatal ("target function wasn't mapped"); - tgt_fn = (void (*)) tgt_fn_key->tgt->tgt_start; + tgt_fn = (void (*)) tgt_fn_key->tgt_offset; } else tgt_fn = (void (*)) fn; @@ -195,7 +169,7 @@ GOACC_data_start (int device, size_t mapnum, __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds); #endif - select_acc_device (device); + goacc_lazy_initialize (); struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; @@ -242,7 +216,7 @@ GOACC_enter_exit_data (int device, size_t mapnum, bool data_enter = false; size_t i; - select_acc_device (device); + goacc_lazy_initialize (); thr = goacc_thread (); acc_dev = thr->dev; @@ -429,7 +403,7 @@ GOACC_update (int device, size_t mapnum, bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK; size_t i; - select_acc_device (device); + goacc_lazy_initialize (); struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; diff --git a/contrib/gcc-5.0/libgomp/plugin/plugin-host.c b/contrib/gcc-5.0/libgomp/plugin/plugin-host.c index ebf7f11caf..1faf5bc194 100644 --- a/contrib/gcc-5.0/libgomp/plugin/plugin-host.c +++ b/contrib/gcc-5.0/libgomp/plugin/plugin-host.c @@ -94,12 +94,6 @@ GOMP_OFFLOAD_get_num_devices (void) return 1; } -STATIC void -GOMP_OFFLOAD_register_image (void *host_table __attribute__ ((unused)), - void *target_data __attribute__ ((unused))) -{ -} - STATIC void GOMP_OFFLOAD_init_device (int n __attribute__ ((unused))) { @@ -111,35 +105,17 @@ GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused))) } STATIC int -GOMP_OFFLOAD_get_table (int n __attribute__ ((unused)), - struct mapping_table **table __attribute__ ((unused))) -{ - return 0; -} - -STATIC void * -GOMP_OFFLOAD_openacc_open_device (int n) -{ - return (void *) (intptr_t) n; -} - -STATIC int -GOMP_OFFLOAD_openacc_close_device (void *hnd) -{ - return 0; -} - -STATIC int -GOMP_OFFLOAD_openacc_get_device_num (void) +GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)), + void *i __attribute__ ((unused)), + struct addr_pair **r __attribute__ ((unused))) { return 0; } STATIC void -GOMP_OFFLOAD_openacc_set_device_num (int n) +GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)), + void *i __attribute__ ((unused))) { - if (n > 0) - GOMP (fatal) ("device number %u out of range for host execution", n); } STATIC void * @@ -253,7 +229,7 @@ GOMP_OFFLOAD_openacc_async_wait_all_async (int async __attribute__ ((unused))) } STATIC void * -GOMP_OFFLOAD_openacc_create_thread_data (void *targ_data +GOMP_OFFLOAD_openacc_create_thread_data (int ord __attribute__ ((unused))) { return NULL; diff --git a/contrib/gcc-5.0/libgomp/plugin/plugin-nvptx.c b/contrib/gcc-5.0/libgomp/plugin/plugin-nvptx.c index 483cb7559e..583ec87aee 100644 --- a/contrib/gcc-5.0/libgomp/plugin/plugin-nvptx.c +++ b/contrib/gcc-5.0/libgomp/plugin/plugin-nvptx.c @@ -133,7 +133,8 @@ struct targ_fn_descriptor const char *name; }; -static bool ptx_inited = false; +static unsigned int instantiated_devices = 0; +static pthread_mutex_t ptx_dev_lock = PTHREAD_MUTEX_INITIALIZER; struct ptx_stream { @@ -331,9 +332,21 @@ struct ptx_event struct ptx_event *next; }; +struct ptx_image_data +{ + void *target_data; + CUmodule module; + struct ptx_image_data *next; +}; + static pthread_mutex_t ptx_event_lock; static struct ptx_event *ptx_events; +static struct ptx_device **ptx_devices; + +static struct ptx_image_data *ptx_images = NULL; +static pthread_mutex_t ptx_image_lock = PTHREAD_MUTEX_INITIALIZER; + #define _XSTR(s) _STR(s) #define _STR(s) #s @@ -450,8 +463,8 @@ fini_streams_for_device (struct ptx_device *ptx_dev) struct ptx_stream *s = ptx_dev->active_streams; ptx_dev->active_streams = ptx_dev->active_streams->next; - cuStreamDestroy (s->stream); map_fini (s); + cuStreamDestroy (s->stream); free (s); } @@ -575,21 +588,21 @@ select_stream_for_async (int async, pthread_t thread, bool create, return stream; } -static int nvptx_get_num_devices (void); - -/* Initialize the device. */ -static int +/* Initialize the device. Return TRUE on success, else FALSE. PTX_DEV_LOCK + should be locked on entry and remains locked on exit. */ +static bool nvptx_init (void) { CUresult r; int rc; + int ndevs; - if (ptx_inited) - return nvptx_get_num_devices (); + if (instantiated_devices != 0) + return true; rc = verify_device_library (); if (rc < 0) - return -1; + return false; r = cuInit (0); if (r != CUDA_SUCCESS) @@ -599,22 +612,64 @@ nvptx_init (void) pthread_mutex_init (&ptx_event_lock, NULL); - ptx_inited = true; + r = cuDeviceGetCount (&ndevs); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuDeviceGetCount error: %s", cuda_error (r)); - return nvptx_get_num_devices (); + ptx_devices = GOMP_PLUGIN_malloc_cleared (sizeof (struct ptx_device *) + * ndevs); + + return true; } +/* Select the N'th PTX device for the current host thread. The device must + have been previously opened before calling this function. */ + static void -nvptx_fini (void) +nvptx_attach_host_thread_to_device (int n) { - ptx_inited = false; + CUdevice dev; + CUresult r; + struct ptx_device *ptx_dev; + CUcontext thd_ctx; + + r = cuCtxGetDevice (&dev); + if (r != CUDA_SUCCESS && r != CUDA_ERROR_INVALID_CONTEXT) + GOMP_PLUGIN_fatal ("cuCtxGetDevice error: %s", cuda_error (r)); + + if (r != CUDA_ERROR_INVALID_CONTEXT && dev == n) + return; + else + { + CUcontext old_ctx; + + ptx_dev = ptx_devices[n]; + assert (ptx_dev); + + r = cuCtxGetCurrent (&thd_ctx); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuCtxGetCurrent error: %s", cuda_error (r)); + + /* We don't necessarily have a current context (e.g. if it has been + destroyed. Pop it if we do though. */ + if (thd_ctx != NULL) + { + r = cuCtxPopCurrent (&old_ctx); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuCtxPopCurrent error: %s", cuda_error (r)); + } + + r = cuCtxPushCurrent (ptx_dev->ctx); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuCtxPushCurrent error: %s", cuda_error (r)); + } } -static void * +static struct ptx_device * nvptx_open_device (int n) { struct ptx_device *ptx_dev; - CUdevice dev; + CUdevice dev, ctx_dev; CUresult r; int async_engines, pi; @@ -628,6 +683,21 @@ nvptx_open_device (int n) ptx_dev->dev = dev; ptx_dev->ctx_shared = false; + r = cuCtxGetDevice (&ctx_dev); + if (r != CUDA_SUCCESS && r != CUDA_ERROR_INVALID_CONTEXT) + GOMP_PLUGIN_fatal ("cuCtxGetDevice error: %s", cuda_error (r)); + + if (r != CUDA_ERROR_INVALID_CONTEXT && ctx_dev != dev) + { + /* The current host thread has an active context for a different device. + Detach it. */ + CUcontext old_ctx; + + r = cuCtxPopCurrent (&old_ctx); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuCtxPopCurrent error: %s", cuda_error (r)); + } + r = cuCtxGetCurrent (&ptx_dev->ctx); if (r != CUDA_SUCCESS) GOMP_PLUGIN_fatal ("cuCtxGetCurrent error: %s", cuda_error (r)); @@ -678,17 +748,16 @@ nvptx_open_device (int n) init_streams_for_device (ptx_dev, async_engines); - return (void *) ptx_dev; + return ptx_dev; } -static int -nvptx_close_device (void *targ_data) +static void +nvptx_close_device (struct ptx_device *ptx_dev) { CUresult r; - struct ptx_device *ptx_dev = targ_data; if (!ptx_dev) - return 0; + return; fini_streams_for_device (ptx_dev); @@ -700,8 +769,6 @@ nvptx_close_device (void *targ_data) } free (ptx_dev); - - return 0; } static int @@ -714,7 +781,7 @@ nvptx_get_num_devices (void) order to enumerate available devices, but CUDA API routines can't be used until cuInit has been called. Just call it now (but don't yet do any further initialization). */ - if (!ptx_inited) + if (instantiated_devices == 0) cuInit (0); r = cuDeviceGetCount (&n); @@ -1507,64 +1574,84 @@ GOMP_OFFLOAD_get_num_devices (void) return nvptx_get_num_devices (); } -static void **kernel_target_data; -static void **kernel_host_table; - void -GOMP_OFFLOAD_register_image (void *host_table, void *target_data) +GOMP_OFFLOAD_init_device (int n) { - kernel_target_data = target_data; - kernel_host_table = host_table; -} + pthread_mutex_lock (&ptx_dev_lock); -void -GOMP_OFFLOAD_init_device (int n __attribute__ ((unused))) -{ - (void) nvptx_init (); + if (!nvptx_init () || ptx_devices[n] != NULL) + { + pthread_mutex_unlock (&ptx_dev_lock); + return; + } + + ptx_devices[n] = nvptx_open_device (n); + instantiated_devices++; + + pthread_mutex_unlock (&ptx_dev_lock); } void -GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused))) +GOMP_OFFLOAD_fini_device (int n) { - nvptx_fini (); + pthread_mutex_lock (&ptx_dev_lock); + + if (ptx_devices[n] != NULL) + { + nvptx_attach_host_thread_to_device (n); + nvptx_close_device (ptx_devices[n]); + ptx_devices[n] = NULL; + instantiated_devices--; + } + + pthread_mutex_unlock (&ptx_dev_lock); } int -GOMP_OFFLOAD_get_table (int n __attribute__ ((unused)), - struct mapping_table **tablep) +GOMP_OFFLOAD_load_image (int ord, void *target_data, + struct addr_pair **target_table) { CUmodule module; - void **fn_table; - char **fn_names; - int fn_entries, i; + char **fn_names, **var_names; + unsigned int fn_entries, var_entries, i, j; CUresult r; struct targ_fn_descriptor *targ_fns; + void **img_header = (void **) target_data; + struct ptx_image_data *new_image; - if (nvptx_init () <= 0) - return 0; + GOMP_OFFLOAD_init_device (ord); - /* This isn't an error, because an image may legitimately have no offloaded - regions and so will not call GOMP_offload_register. */ - if (kernel_target_data == NULL) - return 0; + nvptx_attach_host_thread_to_device (ord); + + link_ptx (&module, img_header[0]); - link_ptx (&module, kernel_target_data[0]); + pthread_mutex_lock (&ptx_image_lock); + new_image = GOMP_PLUGIN_malloc (sizeof (struct ptx_image_data)); + new_image->target_data = target_data; + new_image->module = module; + new_image->next = ptx_images; + ptx_images = new_image; + pthread_mutex_unlock (&ptx_image_lock); - /* kernel_target_data[0] -> ptx code - kernel_target_data[1] -> variable mappings - kernel_target_data[2] -> array of kernel names in ascii + /* The mkoffload utility emits a table of pointers/integers at the start of + each offload image: - kernel_host_table[0] -> start of function addresses (__offload_func_table) - kernel_host_table[1] -> end of function addresses (__offload_funcs_end) + img_header[0] -> ptx code + img_header[1] -> number of variables + img_header[2] -> array of variable names (pointers to strings) + img_header[3] -> number of kernels + img_header[4] -> array of kernel names (pointers to strings) The array of kernel names and the functions addresses form a one-to-one correspondence. */ - fn_table = kernel_host_table[0]; - fn_names = (char **) kernel_target_data[2]; - fn_entries = (kernel_host_table[1] - kernel_host_table[0]) / sizeof (void *); + var_entries = (uintptr_t) img_header[1]; + var_names = (char **) img_header[2]; + fn_entries = (uintptr_t) img_header[3]; + fn_names = (char **) img_header[4]; - *tablep = GOMP_PLUGIN_malloc (sizeof (struct mapping_table) * fn_entries); + *target_table = GOMP_PLUGIN_malloc (sizeof (struct addr_pair) + * (fn_entries + var_entries)); targ_fns = GOMP_PLUGIN_malloc (sizeof (struct targ_fn_descriptor) * fn_entries); @@ -1579,38 +1666,86 @@ GOMP_OFFLOAD_get_table (int n __attribute__ ((unused)), targ_fns[i].fn = function; targ_fns[i].name = (const char *) fn_names[i]; - (*tablep)[i].host_start = (uintptr_t) fn_table[i]; - (*tablep)[i].host_end = (*tablep)[i].host_start + 1; - (*tablep)[i].tgt_start = (uintptr_t) &targ_fns[i]; - (*tablep)[i].tgt_end = (*tablep)[i].tgt_start + 1; + (*target_table)[i].start = (uintptr_t) &targ_fns[i]; + (*target_table)[i].end = (*target_table)[i].start + 1; } - return fn_entries; + for (j = 0; j < var_entries; j++, i++) + { + CUdeviceptr var; + size_t bytes; + + r = cuModuleGetGlobal (&var, &bytes, module, var_names[j]); + if (r != CUDA_SUCCESS) + GOMP_PLUGIN_fatal ("cuModuleGetGlobal error: %s", cuda_error (r)); + + (*target_table)[i].start = (uintptr_t) var; + (*target_table)[i].end = (*target_table)[i].start + bytes; + } + + return i; +} + +void +GOMP_OFFLOAD_unload_image (int tid __attribute__((unused)), void *target_data) +{ + void **img_header = (void **) target_data; + struct targ_fn_descriptor *targ_fns + = (struct targ_fn_descriptor *) img_header[0]; + struct ptx_image_data *image, *prev = NULL, *newhd = NULL; + + free (targ_fns); + + pthread_mutex_lock (&ptx_image_lock); + for (image = ptx_images; image != NULL;) + { + struct ptx_image_data *next = image->next; + + if (image->target_data == target_data) + { + cuModuleUnload (image->module); + free (image); + if (prev) + prev->next = next; + } + else + { + prev = image; + if (!newhd) + newhd = image; + } + + image = next; + } + ptx_images = newhd; + pthread_mutex_unlock (&ptx_image_lock); } void * -GOMP_OFFLOAD_alloc (int n __attribute__ ((unused)), size_t size) +GOMP_OFFLOAD_alloc (int ord, size_t size) { + nvptx_attach_host_thread_to_device (ord); return nvptx_alloc (size); } void -GOMP_OFFLOAD_free (int n __attribute__ ((unused)), void *ptr) +GOMP_OFFLOAD_free (int ord, void *ptr) { + nvptx_attach_host_thread_to_device (ord); nvptx_free (ptr); } void * -GOMP_OFFLOAD_dev2host (int ord __attribute__ ((unused)), void *dst, - const void *src, size_t n) +GOMP_OFFLOAD_dev2host (int ord, void *dst, const void *src, size_t n) { + nvptx_attach_host_thread_to_device (ord); return nvptx_dev2host (dst, src, n); } void * -GOMP_OFFLOAD_host2dev (int ord __attribute__ ((unused)), void *dst, - const void *src, size_t n) +GOMP_OFFLOAD_host2dev (int ord, void *dst, const void *src, size_t n) { + nvptx_attach_host_thread_to_device (ord); return nvptx_host2dev (dst, src, n); } @@ -1627,45 +1762,6 @@ GOMP_OFFLOAD_openacc_parallel (void (*fn) (void *), size_t mapnum, num_workers, vector_length, async, targ_mem_desc); } -void * -GOMP_OFFLOAD_openacc_open_device (int n) -{ - return nvptx_open_device (n); -} - -int -GOMP_OFFLOAD_openacc_close_device (void *h) -{ - return nvptx_close_device (h); -} - -void -GOMP_OFFLOAD_openacc_set_device_num (int n) -{ - struct nvptx_thread *nvthd = nvptx_thread (); - - assert (n >= 0); - - if (!nvthd->ptx_dev || nvthd->ptx_dev->ord != n) - (void) nvptx_open_device (n); -} - -/* This can be called before the device is "opened" for the current thread, in - which case we can't tell which device number should be returned. We don't - actually want to open the device here, so just return -1 and let the caller - (oacc-init.c:acc_get_device_num) handle it. */ - -int -GOMP_OFFLOAD_openacc_get_device_num (void) -{ - struct nvptx_thread *nvthd = nvptx_thread (); - - if (nvthd && nvthd->ptx_dev) - return nvthd->ptx_dev->ord; - else - return -1; -} - void GOMP_OFFLOAD_openacc_register_async_cleanup (void *targ_mem_desc) { @@ -1729,14 +1825,18 @@ GOMP_OFFLOAD_openacc_async_set_async (int async) } void * -GOMP_OFFLOAD_openacc_create_thread_data (void *targ_data) +GOMP_OFFLOAD_openacc_create_thread_data (int ord) { - struct ptx_device *ptx_dev = (struct ptx_device *) targ_data; + struct ptx_device *ptx_dev; struct nvptx_thread *nvthd = GOMP_PLUGIN_malloc (sizeof (struct nvptx_thread)); CUresult r; CUcontext thd_ctx; + ptx_dev = ptx_devices[ord]; + + assert (ptx_dev); + r = cuCtxGetCurrent (&thd_ctx); if (r != CUDA_SUCCESS) GOMP_PLUGIN_fatal ("cuCtxGetCurrent error: %s", cuda_error (r)); diff --git a/contrib/gcc-5.0/libgomp/target.c b/contrib/gcc-5.0/libgomp/target.c index c5dda3f0c9..d8da7833aa 100644 --- a/contrib/gcc-5.0/libgomp/target.c +++ b/contrib/gcc-5.0/libgomp/target.c @@ -49,6 +49,9 @@ static void gomp_target_init (void); /* The whole initialization code for offloading plugins is only run one. */ static pthread_once_t gomp_is_initialized = PTHREAD_ONCE_INIT; +/* Mutex for offload image registration. */ +static gomp_mutex_t register_lock; + /* This structure describes an offload image. It contains type of the target device, pointer to host table descriptor, and pointer to target data. */ @@ -67,14 +70,26 @@ static int num_offload_images; /* Array of descriptors for all available devices. */ static struct gomp_device_descr *devices; -#ifdef PLUGIN_SUPPORT /* Total number of available devices. */ static int num_devices; -#endif /* Number of GOMP_OFFLOAD_CAP_OPENMP_400 devices. */ static int num_devices_openmp; +/* Similar to gomp_realloc, but release register_lock before gomp_fatal. */ + +static void * +gomp_realloc_unlock (void *old, size_t size) +{ + void *ret = realloc (old, size); + if (ret == NULL) + { + gomp_mutex_unlock (®ister_lock); + gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size); + } + return ret; +} + /* The comparison function. */ attribute_hidden int @@ -125,16 +140,19 @@ resolve_device (int device_id) Helper function of gomp_map_vars. */ static inline void -gomp_map_vars_existing (splay_tree_key oldn, splay_tree_key newn, - unsigned char kind) +gomp_map_vars_existing (struct gomp_device_descr *devicep, splay_tree_key oldn, + splay_tree_key newn, unsigned char kind) { if ((kind & GOMP_MAP_FLAG_FORCE) || oldn->host_start > newn->host_start || oldn->host_end < newn->host_end) - gomp_fatal ("Trying to map into device [%p..%p) object when " - "[%p..%p) is already mapped", - (void *) newn->host_start, (void *) newn->host_end, - (void *) oldn->host_start, (void *) oldn->host_end); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Trying to map into device [%p..%p) object when " + "[%p..%p) is already mapped", + (void *) newn->host_start, (void *) newn->host_end, + (void *) oldn->host_start, (void *) oldn->host_end); + } oldn->refcount++; } @@ -153,14 +171,13 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, size_t i, tgt_align, tgt_size, not_found_cnt = 0; const int rshift = is_openacc ? 8 : 3; const int typemask = is_openacc ? 0xff : 0x7; - struct gomp_memory_mapping *mm = &devicep->mem_map; + struct splay_tree_s *mem_map = &devicep->mem_map; struct splay_tree_key_s cur_node; struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt) + sizeof (tgt->list[0]) * mapnum); tgt->list_count = mapnum; tgt->refcount = 1; tgt->device_descr = devicep; - tgt->mem_map = mm; if (mapnum == 0) return tgt; @@ -174,7 +191,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, tgt_size = mapnum * sizeof (void *); } - gomp_mutex_lock (&mm->lock); + gomp_mutex_lock (&devicep->lock); for (i = 0; i < mapnum; i++) { @@ -189,11 +206,11 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, cur_node.host_end = cur_node.host_start + sizes[i]; else cur_node.host_end = cur_node.host_start + sizeof (void *); - splay_tree_key n = splay_tree_lookup (&mm->splay_tree, &cur_node); + splay_tree_key n = splay_tree_lookup (mem_map, &cur_node); if (n) { tgt->list[i] = n; - gomp_map_vars_existing (n, &cur_node, kind & typemask); + gomp_map_vars_existing (devicep, n, &cur_node, kind & typemask); } else { @@ -228,7 +245,10 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, if (devaddrs) { if (mapnum != 1) - gomp_fatal ("unexpected aggregation"); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("unexpected aggregation"); + } tgt->to_free = devaddrs[0]; tgt->tgt_start = (uintptr_t) tgt->to_free; tgt->tgt_end = tgt->tgt_start + sizes[0]; @@ -274,11 +294,11 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, k->host_end = k->host_start + sizes[i]; else k->host_end = k->host_start + sizeof (void *); - splay_tree_key n = splay_tree_lookup (&mm->splay_tree, k); + splay_tree_key n = splay_tree_lookup (mem_map, k); if (n) { tgt->list[i] = n; - gomp_map_vars_existing (n, k, kind & typemask); + gomp_map_vars_existing (devicep, n, k, kind & typemask); } else { @@ -294,7 +314,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, tgt->refcount++; array->left = NULL; array->right = NULL; - splay_tree_insert (&mm->splay_tree, array); + splay_tree_insert (mem_map, array); switch (kind & typemask) { case GOMP_MAP_ALLOC: @@ -332,22 +352,25 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, /* Add bias to the pointer value. */ cur_node.host_start += sizes[i]; cur_node.host_end = cur_node.host_start + 1; - n = splay_tree_lookup (&mm->splay_tree, &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); if (n == NULL) { /* Could be possibly zero size array section. */ cur_node.host_end--; - n = splay_tree_lookup (&mm->splay_tree, &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); if (n == NULL) { cur_node.host_start--; - n = splay_tree_lookup (&mm->splay_tree, &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); cur_node.host_start++; } } if (n == NULL) - gomp_fatal ("Pointer target of array section " - "wasn't mapped"); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Pointer target of array section " + "wasn't mapped"); + } cur_node.host_start -= n->host_start; cur_node.tgt_offset = n->tgt->tgt_start + n->tgt_offset + cur_node.host_start; @@ -400,24 +423,25 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, /* Add bias to the pointer value. */ cur_node.host_start += sizes[j]; cur_node.host_end = cur_node.host_start + 1; - n = splay_tree_lookup (&mm->splay_tree, &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); if (n == NULL) { /* Could be possibly zero size array section. */ cur_node.host_end--; - n = splay_tree_lookup (&mm->splay_tree, - &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); if (n == NULL) { cur_node.host_start--; - n = splay_tree_lookup (&mm->splay_tree, - &cur_node); + n = splay_tree_lookup (mem_map, &cur_node); cur_node.host_start++; } } if (n == NULL) - gomp_fatal ("Pointer target of array section " - "wasn't mapped"); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Pointer target of array section " + "wasn't mapped"); + } cur_node.host_start -= n->host_start; cur_node.tgt_offset = n->tgt->tgt_start + n->tgt_offset @@ -441,6 +465,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, /* We already looked up the memory region above and it was missing. */ size_t size = k->host_end - k->host_start; + gomp_mutex_unlock (&devicep->lock); #ifdef HAVE_INTTYPES_H gomp_fatal ("present clause: !acc_is_present (%p, " "%"PRIu64" (0x%"PRIx64"))", @@ -463,6 +488,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, sizeof (void *)); break; default: + gomp_mutex_unlock (&devicep->lock); gomp_fatal ("%s: unhandled kind 0x%.2x", __FUNCTION__, kind); } @@ -489,7 +515,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, } } - gomp_mutex_unlock (&mm->lock); + gomp_mutex_unlock (&devicep->lock); return tgt; } @@ -514,10 +540,9 @@ attribute_hidden void gomp_copy_from_async (struct target_mem_desc *tgt) { struct gomp_device_descr *devicep = tgt->device_descr; - struct gomp_memory_mapping *mm = tgt->mem_map; size_t i; - gomp_mutex_lock (&mm->lock); + gomp_mutex_lock (&devicep->lock); for (i = 0; i < tgt->list_count; i++) if (tgt->list[i] == NULL) @@ -536,7 +561,7 @@ gomp_copy_from_async (struct target_mem_desc *tgt) k->host_end - k->host_start); } - gomp_mutex_unlock (&mm->lock); + gomp_mutex_unlock (&devicep->lock); } /* Unmap variables described by TGT. If DO_COPYFROM is true, copy relevant @@ -547,7 +572,6 @@ attribute_hidden void gomp_unmap_vars (struct target_mem_desc *tgt, bool do_copyfrom) { struct gomp_device_descr *devicep = tgt->device_descr; - struct gomp_memory_mapping *mm = tgt->mem_map; if (tgt->list_count == 0) { @@ -555,7 +579,7 @@ gomp_unmap_vars (struct target_mem_desc *tgt, bool do_copyfrom) return; } - gomp_mutex_lock (&mm->lock); + gomp_mutex_lock (&devicep->lock); size_t i; for (i = 0; i < tgt->list_count; i++) @@ -572,7 +596,7 @@ gomp_unmap_vars (struct target_mem_desc *tgt, bool do_copyfrom) devicep->dev2host_func (devicep->target_id, (void *) k->host_start, (void *) (k->tgt->tgt_start + k->tgt_offset), k->host_end - k->host_start); - splay_tree_remove (&mm->splay_tree, k); + splay_tree_remove (&devicep->mem_map, k); if (k->tgt->refcount > 1) k->tgt->refcount--; else @@ -584,13 +608,12 @@ gomp_unmap_vars (struct target_mem_desc *tgt, bool do_copyfrom) else gomp_unmap_tgt (tgt); - gomp_mutex_unlock (&mm->lock); + gomp_mutex_unlock (&devicep->lock); } static void -gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm, - size_t mapnum, void **hostaddrs, size_t *sizes, void *kinds, - bool is_openacc) +gomp_update (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs, + size_t *sizes, void *kinds, bool is_openacc) { size_t i; struct splay_tree_key_s cur_node; @@ -602,25 +625,27 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm, if (mapnum == 0) return; - gomp_mutex_lock (&mm->lock); + gomp_mutex_lock (&devicep->lock); for (i = 0; i < mapnum; i++) if (sizes[i]) { cur_node.host_start = (uintptr_t) hostaddrs[i]; cur_node.host_end = cur_node.host_start + sizes[i]; - splay_tree_key n = splay_tree_lookup (&mm->splay_tree, - &cur_node); + splay_tree_key n = splay_tree_lookup (&devicep->mem_map, &cur_node); if (n) { int kind = get_kind (is_openacc, kinds, i); if (n->host_start > cur_node.host_start || n->host_end < cur_node.host_end) - gomp_fatal ("Trying to update [%p..%p) object when" - "only [%p..%p) is mapped", - (void *) cur_node.host_start, - (void *) cur_node.host_end, - (void *) n->host_start, - (void *) n->host_end); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Trying to update [%p..%p) object when " + "only [%p..%p) is mapped", + (void *) cur_node.host_start, + (void *) cur_node.host_end, + (void *) n->host_start, + (void *) n->host_end); + } if (GOMP_MAP_COPY_TO_P (kind & typemask)) devicep->host2dev_func (devicep->target_id, (void *) (n->tgt->tgt_start @@ -639,14 +664,106 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm, cur_node.host_end - cur_node.host_start); } else - gomp_fatal ("Trying to update [%p..%p) object that is not mapped", - (void *) cur_node.host_start, - (void *) cur_node.host_end); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Trying to update [%p..%p) object that is not mapped", + (void *) cur_node.host_start, + (void *) cur_node.host_end); + } } - gomp_mutex_unlock (&mm->lock); + gomp_mutex_unlock (&devicep->lock); +} + +/* Load image pointed by TARGET_DATA to the device, specified by DEVICEP. + And insert to splay tree the mapping between addresses from HOST_TABLE and + from loaded target image. */ + +static void +gomp_offload_image_to_device (struct gomp_device_descr *devicep, + void *host_table, void *target_data, + bool is_register_lock) +{ + void **host_func_table = ((void ***) host_table)[0]; + void **host_funcs_end = ((void ***) host_table)[1]; + void **host_var_table = ((void ***) host_table)[2]; + void **host_vars_end = ((void ***) host_table)[3]; + + /* The func table contains only addresses, the var table contains addresses + and corresponding sizes. */ + int num_funcs = host_funcs_end - host_func_table; + int num_vars = (host_vars_end - host_var_table) / 2; + + /* Load image to device and get target addresses for the image. */ + struct addr_pair *target_table = NULL; + int i, num_target_entries + = devicep->load_image_func (devicep->target_id, target_data, &target_table); + + if (num_target_entries != num_funcs + num_vars) + { + gomp_mutex_unlock (&devicep->lock); + if (is_register_lock) + gomp_mutex_unlock (®ister_lock); + gomp_fatal ("Can't map target functions or variables"); + } + + /* Insert host-target address mapping into splay tree. */ + struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt)); + tgt->array = gomp_malloc ((num_funcs + num_vars) * sizeof (*tgt->array)); + tgt->refcount = 1; + tgt->tgt_start = 0; + tgt->tgt_end = 0; + tgt->to_free = NULL; + tgt->prev = NULL; + tgt->list_count = 0; + tgt->device_descr = devicep; + splay_tree_node array = tgt->array; + + for (i = 0; i < num_funcs; i++) + { + splay_tree_key k = &array->key; + k->host_start = (uintptr_t) host_func_table[i]; + k->host_end = k->host_start + 1; + k->tgt = tgt; + k->tgt_offset = target_table[i].start; + k->refcount = 1; + k->async_refcount = 0; + k->copy_from = false; + array->left = NULL; + array->right = NULL; + splay_tree_insert (&devicep->mem_map, array); + array++; + } + + for (i = 0; i < num_vars; i++) + { + struct addr_pair *target_var = &target_table[num_funcs + i]; + if (target_var->end - target_var->start + != (uintptr_t) host_var_table[i * 2 + 1]) + { + gomp_mutex_unlock (&devicep->lock); + if (is_register_lock) + gomp_mutex_unlock (®ister_lock); + gomp_fatal ("Can't map target variables (size mismatch)"); + } + + splay_tree_key k = &array->key; + k->host_start = (uintptr_t) host_var_table[i * 2]; + k->host_end = k->host_start + (uintptr_t) host_var_table[i * 2 + 1]; + k->tgt = tgt; + k->tgt_offset = target_var->start; + k->refcount = 1; + k->async_refcount = 0; + k->copy_from = false; + array->left = NULL; + array->right = NULL; + splay_tree_insert (&devicep->mem_map, array); + array++; + } + + free (target_table); } -/* This function should be called from every offload image. +/* This function should be called from every offload image while loading. It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of the target, and TARGET_DATA needed by target plugin. */ @@ -654,83 +771,152 @@ void GOMP_offload_register (void *host_table, enum offload_target_type target_type, void *target_data) { - offload_images = gomp_realloc (offload_images, - (num_offload_images + 1) - * sizeof (struct offload_image_descr)); + int i; + gomp_mutex_lock (®ister_lock); + + /* Load image to all initialized devices. */ + for (i = 0; i < num_devices; i++) + { + struct gomp_device_descr *devicep = &devices[i]; + gomp_mutex_lock (&devicep->lock); + if (devicep->type == target_type && devicep->is_initialized) + gomp_offload_image_to_device (devicep, host_table, target_data, true); + gomp_mutex_unlock (&devicep->lock); + } + /* Insert image to array of pending images. */ + offload_images + = gomp_realloc_unlock (offload_images, + (num_offload_images + 1) + * sizeof (struct offload_image_descr)); offload_images[num_offload_images].type = target_type; offload_images[num_offload_images].host_table = host_table; offload_images[num_offload_images].target_data = target_data; num_offload_images++; + gomp_mutex_unlock (®ister_lock); } -/* This function initializes the target device, specified by DEVICEP. DEVICEP - must be locked on entry, and remains locked on return. */ +/* This function should be called from every offload image while unloading. + It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of + the target, and TARGET_DATA needed by target plugin. */ -attribute_hidden void -gomp_init_device (struct gomp_device_descr *devicep) +void +GOMP_offload_unregister (void *host_table, enum offload_target_type target_type, + void *target_data) { - devicep->init_device_func (devicep->target_id); - devicep->is_initialized = true; + void **host_func_table = ((void ***) host_table)[0]; + void **host_funcs_end = ((void ***) host_table)[1]; + void **host_var_table = ((void ***) host_table)[2]; + void **host_vars_end = ((void ***) host_table)[3]; + int i; + + /* The func table contains only addresses, the var table contains addresses + and corresponding sizes. */ + int num_funcs = host_funcs_end - host_func_table; + int num_vars = (host_vars_end - host_var_table) / 2; + + gomp_mutex_lock (®ister_lock); + + /* Unload image from all initialized devices. */ + for (i = 0; i < num_devices; i++) + { + int j; + struct gomp_device_descr *devicep = &devices[i]; + gomp_mutex_lock (&devicep->lock); + if (devicep->type != target_type || !devicep->is_initialized) + { + gomp_mutex_unlock (&devicep->lock); + continue; + } + + devicep->unload_image_func (devicep->target_id, target_data); + + /* Remove mapping from splay tree. */ + struct splay_tree_key_s k; + splay_tree_key node = NULL; + if (num_funcs > 0) + { + k.host_start = (uintptr_t) host_func_table[0]; + k.host_end = k.host_start + 1; + node = splay_tree_lookup (&devicep->mem_map, &k); + } + else if (num_vars > 0) + { + k.host_start = (uintptr_t) host_var_table[0]; + k.host_end = k.host_start + (uintptr_t) host_var_table[1]; + node = splay_tree_lookup (&devicep->mem_map, &k); + } + + for (j = 0; j < num_funcs; j++) + { + k.host_start = (uintptr_t) host_func_table[j]; + k.host_end = k.host_start + 1; + splay_tree_remove (&devicep->mem_map, &k); + } + + for (j = 0; j < num_vars; j++) + { + k.host_start = (uintptr_t) host_var_table[j * 2]; + k.host_end = k.host_start + (uintptr_t) host_var_table[j * 2 + 1]; + splay_tree_remove (&devicep->mem_map, &k); + } + + if (node) + { + free (node->tgt); + free (node); + } + + gomp_mutex_unlock (&devicep->lock); + } + + /* Remove image from array of pending images. */ + for (i = 0; i < num_offload_images; i++) + if (offload_images[i].target_data == target_data) + { + offload_images[i] = offload_images[--num_offload_images]; + break; + } + + gomp_mutex_unlock (®ister_lock); } -/* Initialize address mapping tables. MM must be locked on entry, and remains - locked on return. */ +/* This function initializes the target device, specified by DEVICEP. DEVICEP + must be locked on entry, and remains locked on return. */ attribute_hidden void -gomp_init_tables (struct gomp_device_descr *devicep, - struct gomp_memory_mapping *mm) +gomp_init_device (struct gomp_device_descr *devicep) { - /* Get address mapping table for device. */ - struct mapping_table *table = NULL; - int num_entries = devicep->get_table_func (devicep->target_id, &table); - - /* Insert host-target address mapping into dev_splay_tree. */ int i; - for (i = 0; i < num_entries; i++) + devicep->init_device_func (devicep->target_id); + + /* Load to device all images registered by the moment. */ + for (i = 0; i < num_offload_images; i++) { - struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt)); - tgt->refcount = 1; - tgt->array = gomp_malloc (sizeof (*tgt->array)); - tgt->tgt_start = table[i].tgt_start; - tgt->tgt_end = table[i].tgt_end; - tgt->to_free = NULL; - tgt->list_count = 0; - tgt->device_descr = devicep; - splay_tree_node node = tgt->array; - splay_tree_key k = &node->key; - k->host_start = table[i].host_start; - k->host_end = table[i].host_end; - k->tgt_offset = 0; - k->refcount = 1; - k->copy_from = false; - k->tgt = tgt; - node->left = NULL; - node->right = NULL; - splay_tree_insert (&mm->splay_tree, node); + struct offload_image_descr *image = &offload_images[i]; + if (image->type == devicep->type) + gomp_offload_image_to_device (devicep, image->host_table, + image->target_data, false); } - free (table); - mm->is_initialized = true; + devicep->is_initialized = true; } /* Free address mapping tables. MM must be locked on entry, and remains locked on return. */ attribute_hidden void -gomp_free_memmap (struct gomp_memory_mapping *mm) +gomp_free_memmap (struct splay_tree_s *mem_map) { - while (mm->splay_tree.root) + while (mem_map->root) { - struct target_mem_desc *tgt = mm->splay_tree.root->key.tgt; + struct target_mem_desc *tgt = mem_map->root->key.tgt; - splay_tree_remove (&mm->splay_tree, &mm->splay_tree.root->key); + splay_tree_remove (mem_map, &mem_map->root->key); free (tgt->array); free (tgt); } - - mm->is_initialized = false; } /* This function de-initializes the target device, specified by DEVICEP. @@ -791,22 +977,19 @@ GOMP_target (int device, void (*fn) (void *), const void *unused, fn_addr = (void *) fn; else { - struct gomp_memory_mapping *mm = &devicep->mem_map; - gomp_mutex_lock (&mm->lock); - - if (!mm->is_initialized) - gomp_init_tables (devicep, mm); - + gomp_mutex_lock (&devicep->lock); struct splay_tree_key_s k; k.host_start = (uintptr_t) fn; k.host_end = k.host_start + 1; - splay_tree_key tgt_fn = splay_tree_lookup (&mm->splay_tree, &k); + splay_tree_key tgt_fn = splay_tree_lookup (&devicep->mem_map, &k); if (tgt_fn == NULL) - gomp_fatal ("Target function wasn't mapped"); - - gomp_mutex_unlock (&mm->lock); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Target function wasn't mapped"); + } + gomp_mutex_unlock (&devicep->lock); - fn_addr = (void *) tgt_fn->tgt->tgt_start; + fn_addr = (void *) tgt_fn->tgt_offset; } struct target_mem_desc *tgt_vars @@ -856,12 +1039,6 @@ GOMP_target_data (int device, const void *unused, size_t mapnum, gomp_init_device (devicep); gomp_mutex_unlock (&devicep->lock); - struct gomp_memory_mapping *mm = &devicep->mem_map; - gomp_mutex_lock (&mm->lock); - if (!mm->is_initialized) - gomp_init_tables (devicep, mm); - gomp_mutex_unlock (&mm->lock); - struct target_mem_desc *tgt = gomp_map_vars (devicep, mapnum, hostaddrs, NULL, sizes, kinds, false, false); @@ -897,13 +1074,7 @@ GOMP_target_update (int device, const void *unused, size_t mapnum, gomp_init_device (devicep); gomp_mutex_unlock (&devicep->lock); - struct gomp_memory_mapping *mm = &devicep->mem_map; - gomp_mutex_lock (&mm->lock); - if (!mm->is_initialized) - gomp_init_tables (devicep, mm); - gomp_mutex_unlock (&mm->lock); - - gomp_update (devicep, mm, mapnum, hostaddrs, sizes, kinds, false); + gomp_update (devicep, mapnum, hostaddrs, sizes, kinds, false); } void @@ -972,10 +1143,10 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device, DLSYM (get_caps); DLSYM (get_type); DLSYM (get_num_devices); - DLSYM (register_image); DLSYM (init_device); DLSYM (fini_device); - DLSYM (get_table); + DLSYM (load_image); + DLSYM (unload_image); DLSYM (alloc); DLSYM (free); DLSYM (dev2host); @@ -987,10 +1158,6 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device, { optional_present = optional_total = 0; DLSYM_OPT (openacc.exec, openacc_parallel); - DLSYM_OPT (openacc.open_device, openacc_open_device); - DLSYM_OPT (openacc.close_device, openacc_close_device); - DLSYM_OPT (openacc.get_device_num, openacc_get_device_num); - DLSYM_OPT (openacc.set_device_num, openacc_set_device_num); DLSYM_OPT (openacc.register_async_cleanup, openacc_register_async_cleanup); DLSYM_OPT (openacc.async_test, openacc_async_test); @@ -1038,22 +1205,6 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device, return err == NULL; } -/* This function adds a compatible offload image IMAGE to an accelerator device - DEVICE. DEVICE must be locked on entry, and remains locked on return. */ - -static void -gomp_register_image_for_device (struct gomp_device_descr *device, - struct offload_image_descr *image) -{ - if (!device->offload_regions_registered - && (device->type == image->type - || device->type == OFFLOAD_TARGET_TYPE_HOST)) - { - device->register_image_func (image->host_table, image->target_data); - device->offload_regions_registered = true; - } -} - /* This function initializes the runtime needed for offloading. It parses the list of offload targets and tries to load the plugins for these targets. On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP @@ -1112,17 +1263,13 @@ gomp_target_init (void) current_device.name = current_device.get_name_func (); /* current_device.capabilities has already been set. */ current_device.type = current_device.get_type_func (); - current_device.mem_map.is_initialized = false; - current_device.mem_map.splay_tree.root = NULL; + current_device.mem_map.root = NULL; current_device.is_initialized = false; - current_device.offload_regions_registered = false; current_device.openacc.data_environ = NULL; - current_device.openacc.target_data = NULL; for (i = 0; i < new_num_devices; i++) { current_device.target_id = i; devices[num_devices] = current_device; - gomp_mutex_init (&devices[num_devices].mem_map.lock); gomp_mutex_init (&devices[num_devices].lock); num_devices++; } @@ -1157,21 +1304,12 @@ gomp_target_init (void) for (i = 0; i < num_devices; i++) { - int j; - - for (j = 0; j < num_offload_images; j++) - gomp_register_image_for_device (&devices[i], &offload_images[j]); - /* The 'devices' array can be moved (by the realloc call) until we have found all the plugins, so registering with the OpenACC runtime (which takes a copy of the pointer argument) must be delayed until now. */ if (devices[i].capabilities & GOMP_OFFLOAD_CAP_OPENACC_200) goacc_register (&devices[i]); } - - free (offload_images); - offload_images = NULL; - num_offload_images = 0; } #else /* PLUGIN_SUPPORT */ diff --git a/contrib/gcc-5.0/libiberty/at-file.texi b/contrib/gcc-5.0/libiberty/at-file.texi deleted file mode 100644 index 080d1951d6..0000000000 --- a/contrib/gcc-5.0/libiberty/at-file.texi +++ /dev/null @@ -1,15 +0,0 @@ -@c This file is designed to be included in manuals that use -@c expandargv. - -@item @@@var{file} -Read command-line options from @var{file}. The options read are -inserted in place of the original @@@var{file} option. If @var{file} -does not exist, or cannot be read, then the option will be treated -literally, and not removed. - -Options in @var{file} are separated by whitespace. A whitespace -character may be included in an option by surrounding the entire -option in either single or double quotes. Any character (including a -backslash) may be included by prefixing the character to be included -with a backslash. The @var{file} may itself contain additional -@@@var{file} options; any such options will be processed recursively. diff --git a/contrib/gcc-5.0/libitm/libitm.texi b/contrib/gcc-5.0/libitm/libitm.texi deleted file mode 100644 index d3678c5b52..0000000000 --- a/contrib/gcc-5.0/libitm/libitm.texi +++ /dev/null @@ -1,774 +0,0 @@ -\input texinfo @c -*-texinfo-*- - -@c %**start of header -@setfilename libitm.info -@settitle GNU libitm -@c %**end of header - - -@copying -Copyright @copyright{} 2011-2015 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.2 or -any later version published by the Free Software Foundation; with no -Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -A copy of the license is included in the section entitled ``GNU -Free Documentation License''. -@end copying - -@ifinfo -@dircategory GNU Libraries -@direntry -* libitm: (libitm). GNU Transactional Memory Library -@end direntry - -This manual documents the GNU Transactional Memory Library. - -@insertcopying -@end ifinfo - - -@setchapternewpage odd - -@titlepage -@title The GNU Transactional Memory Library -@page -@vskip 0pt plus 1filll -@comment For the @value{version-GCC} Version* -@sp 1 -@insertcopying -@end titlepage - -@summarycontents -@contents -@page - - -@node Top -@top Introduction -@cindex Introduction - -This manual documents the usage and internals of libitm, the GNU Transactional -Memory Library. It provides transaction support for accesses to a process' -memory, enabling easy-to-use synchronization of accesses to shared memory by -several threads. - - -@comment -@comment When you add a new menu item, please keep the right hand -@comment aligned to the same column. Do not use tabs. This provides -@comment better formatting. -@comment -@menu -* Enabling libitm:: How to enable libitm for your applications. -* C/C++ Language Constructs for TM:: - Notes on the language-level interface supported - by gcc. -* The libitm ABI:: Notes on the external ABI provided by libitm. -* Internals:: Notes on libitm's internal synchronization. -* GNU Free Documentation License:: - How you can copy and share this manual. -* Library Index:: Index of this documentation. -@end menu - - -@c --------------------------------------------------------------------- -@c Enabling libitm -@c --------------------------------------------------------------------- - -@node Enabling libitm -@chapter Enabling libitm - -To activate support for TM in C/C++, the compile-time flag @option{-fgnu-tm} -must be specified. This enables TM language-level constructs such as -transaction statements (e.g., @code{__transaction_atomic}, @pxref{C/C++ -Language Constructs for TM} for details). - -@c --------------------------------------------------------------------- -@c C/C++ Language Constructs for TM -@c --------------------------------------------------------------------- - -@node C/C++ Language Constructs for TM -@chapter C/C++ Language Constructs for TM - -Transactions are supported in C++ and C in the form of transaction statements, -transaction expressions, and function transactions. In the following example, -both @code{a} and @code{b} will be read and the difference will be written to -@code{c}, all atomically and isolated from other transactions: - -@example -__transaction_atomic @{ c = a - b; @} -@end example - -Therefore, another thread can use the following code to concurrently update -@code{b} without ever causing @code{c} to hold a negative value (and without -having to use other synchronization constructs such as locks or C++11 -atomics): - -@example -__transaction_atomic @{ if (a > b) b++; @} -@end example - -GCC follows the @uref{https://sites.google.com/site/tmforcplusplus/, Draft -Specification of Transactional Language Constructs for C++ (v1.1)} in its -implementation of transactions. - -The precise semantics of transactions are defined in terms of the C++11/C11 -memory model (see the specification). Roughly, transactions provide -synchronization guarantees that are similar to what would be guaranteed when -using a single global lock as a guard for all transactions. Note that like -other synchronization constructs in C/C++, transactions rely on a -data-race-free program (e.g., a nontransactional write that is concurrent -with a transactional read to the same memory location is a data race). - -@c --------------------------------------------------------------------- -@c The libitm ABI -@c --------------------------------------------------------------------- - -@node The libitm ABI -@chapter The libitm ABI - -The ABI provided by libitm is basically equal to the Linux variant of Intel's -current TM ABI specification document (Revision 1.1, May 6 2009) but with the -differences listed in this chapter. It would be good if these changes would -eventually be merged into a future version of this specification. To ease -look-up, the following subsections mirror the structure of this specification. - -@section [No changes] Objectives -@section [No changes] Non-objectives - -@section Library design principles -@subsection [No changes] Calling conventions -@subsection [No changes] TM library algorithms -@subsection [No changes] Optimized load and store routines -@subsection [No changes] Aligned load and store routines - -@subsection Data logging functions - -The memory locations accessed with transactional loads and stores and the -memory locations whose values are logged must not overlap. This required -separation only extends to the scope of the execution of one transaction -including all the executions of all nested transactions. - -The compiler must be consistent (within the scope of a single transaction) -about which memory locations are shared and which are not shared with other -threads (i.e., data must be accessed either transactionally or -nontransactionally). Otherwise, non-write-through TM algorithms would not work. - -For memory locations on the stack, this requirement extends to only the -lifetime of the stack frame that the memory location belongs to (or the -lifetime of the transaction, whichever is shorter). Thus, memory that is -reused for several stack frames could be target of both data logging and -transactional accesses; however, this is harmless because these stack frames' -lifetimes will end before the transaction finishes. - -@subsection [No changes] Scatter/gather calls -@subsection [No changes] Serial and irrevocable mode -@subsection [No changes] Transaction descriptor -@subsection Store allocation - -There is no @code{getTransaction} function. - -@subsection [No changes] Naming conventions - -@subsection Function pointer encryption - -Currently, this is not implemented. - - -@section Types and macros list - -@code{_ITM_codeProperties} has changed, @pxref{txn-code-properties,,Starting a -transaction}. -@code{_ITM_srcLocation} is not used. - - -@section Function list - -@subsection Initialization and finalization functions -These functions are not part of the ABI. - -@subsection [No changes] Version checking -@subsection [No changes] Error reporting -@subsection [No changes] inTransaction call - -@subsection State manipulation functions -There is no @code{getTransaction} function. Transaction identifiers for -nested transactions will be ordered but not necessarily sequential (i.e., for -a nested transaction's identifier @var{IN} and its enclosing transaction's -identifier @var{IE}, it is guaranteed that @math{IN >= IE}). - -@subsection [No changes] Source locations - -@subsection Starting a transaction - -@subsubsection Transaction code properties - -@anchor{txn-code-properties} -The bit @code{hasNoXMMUpdate} is instead called @code{hasNoVectorUpdate}. -Iff it is set, vector register save/restore is not necessary for any target -machine. - -The @code{hasNoFloatUpdate} bit (@code{0x0010}) is new. Iff it is set, floating -point register save/restore is not necessary for any target machine. - -@code{undoLogCode} is not supported and a fatal runtime error will be raised -if this bit is set. It is not properly defined in the ABI why barriers -other than undo logging are not present; Are they not necessary (e.g., a -transaction operating purely on thread-local data) or have they been omitted by -the compiler because it thinks that some kind of global synchronization -(e.g., serial mode) might perform better? The specification suggests that the -latter might be the case, but the former seems to be more useful. - -The @code{readOnly} bit (@code{0x4000}) is new. @strong{TODO} Lexical or dynamic -scope? - -@code{hasNoRetry} is not supported. If this bit is not set, but -@code{hasNoAbort} is set, the library can assume that transaction -rollback will not be requested. - -It would be useful if the absence of externally-triggered rollbacks would be -reported for the dynamic scope as well, not just for the lexical scope -(@code{hasNoAbort}). Without this, a library cannot exploit this together -with flat nesting. - -@code{exceptionBlock} is not supported because exception blocks are not used. - -@subsubsection [No changes] Windows exception state -@subsubsection [No changes] Other machine state - -@subsubsection [No changes] Results from beginTransaction - -@subsection Aborting a transaction - -@code{_ITM_rollbackTransaction} is not supported. @code{_ITM_abortTransaction} -is supported but the abort reasons @code{exceptionBlockAbort}, -@code{TMConflict}, and @code{userRetry} are not supported. There are no -exception blocks in general, so the related cases also do not have to be -considered. To encode @code{__transaction_cancel [[outer]]}, compilers must -set the new @code{outerAbort} bit (@code{0x10}) additionally to the -@code{userAbort} bit in the abort reason. - -@subsection Committing a transaction - -The exception handling (EH) scheme is different. The Intel ABI requires the -@code{_ITM_tryCommitTransaction} function that will return even when the -commit failed and will have to be matched with calls to either -@code{_ITM_abortTransaction} or @code{_ITM_commitTransaction}. In contrast, -gcc relies on transactional wrappers for the functions of the Exception -Handling ABI and on one additional commit function (shown below). This allows -the TM to keep track of EH internally and thus it does not have to embed the -cleanup of EH state into the existing EH code in the program. -@code{_ITM_tryCommitTransaction} is not supported. -@code{_ITM_commitTransactionToId} is also not supported because the -propagation of thrown exceptions will not bypass commits of nested -transactions. - -@example -void _ITM_commitTransactionEH(void *exc_ptr) ITM_REGPARM; -void *_ITM_cxa_allocate_exception (size_t); -void _ITM_cxa_throw (void *obj, void *tinfo, void *dest); -void *_ITM_cxa_begin_catch (void *exc_ptr); -void _ITM_cxa_end_catch (void); -@end example - -@code{_ITM_commitTransactionEH} must be called to commit a transaction if an -exception could be in flight at this position in the code. @code{exc_ptr} is -the current exception or zero if there is no current exception. -The @code{_ITM_cxa...} functions are transactional wrappers for the respective -@code{__cxa...} functions and must be called instead of these in transactional -code. - -To support this EH scheme, libstdc++ needs to provide one additional function -(@code{_cxa_tm_cleanup}), which is used by the TM to clean up the exception -handling state while rolling back a transaction: - -@example -void __cxa_tm_cleanup (void *unthrown_obj, void *cleanup_exc, - unsigned int caught_count); -@end example - -@code{unthrown_obj} is non-null if the program called -@code{__cxa_allocate_exception} for this exception but did not yet called -@code{__cxa_throw} for it. @code{cleanup_exc} is non-null if the program is -currently processing a cleanup along an exception path but has not caught this -exception yet. @code{caught_count} is the nesting depth of -@code{__cxa_begin_catch} within the transaction (which can be counted by the TM -using @code{_ITM_cxa_begin_catch} and @code{_ITM_cxa_end_catch}); -@code{__cxa_tm_cleanup} then performs rollback by essentially performing -@code{__cxa_end_catch} that many times. - - - -@subsection Exception handling support - -Currently, there is no support for functionality like -@code{__transaction_cancel throw} as described in the C++ TM specification. -Supporting this should be possible with the EH scheme explained previously -because via the transactional wrappers for the EH ABI, the TM is able to -observe and intercept EH. - - -@subsection [No changes] Transition to serial--irrevocable mode -@subsection [No changes] Data transfer functions -@subsection [No changes] Transactional memory copies - -@subsection Transactional versions of memmove - -If either the source or destination memory region is to be accessed -nontransactionally, then source and destination regions must not be -overlapping. The respective @code{_ITM_memmove} functions are still -available but a fatal runtime error will be raised if such regions do overlap. -To support this functionality, the ABI would have to specify how the -intersection of the regions has to be accessed (i.e., transactionally or -nontransactionally). - -@subsection [No changes] Transactional versions of memset -@subsection [No changes] Logging functions - -@subsection User-registered commit and undo actions - -Commit actions will get executed in the same order in which the respective -calls to @code{_ITM_addUserCommitAction} happened. Only -@code{_ITM_noTransactionId} is allowed as value for the -@code{resumingTransactionId} argument. Commit actions get executed after -privatization safety has been ensured. - -Undo actions will get executed in reverse order compared to the order in which -the respective calls to @code{_ITM_addUserUndoAction} happened. The ordering of -undo actions w.r.t. the roll-back of other actions (e.g., data transfers or -memory allocations) is undefined. - -@code{_ITM_getThreadnum} is not supported currently because its only purpose -is to provide a thread ID that matches some assumed performance tuning output, -but this output is not part of the ABI nor further defined by it. - -@code{_ITM_dropReferences} is not supported currently because its semantics and -the intention behind it is not entirely clear. The -specification suggests that this function is necessary because of certain -orderings of data transfer undos and the releasing of memory regions (i.e., -privatization). However, this ordering is never defined, nor is the ordering of -dropping references w.r.t. other events. - -@subsection [New] Transactional indirect calls - -Indirect calls (i.e., calls through a function pointer) within transactions -should execute the transactional clone of the original function (i.e., a clone -of the original that has been fully instrumented to use the TM runtime), if -such a clone is available. The runtime provides two functions to -register/deregister clone tables: - -@example -struct clone_entry -@{ - void *orig, *clone; -@}; - -void _ITM_registerTMCloneTable (clone_entry *table, size_t entries); -void _ITM_deregisterTMCloneTable (clone_entry *table); -@end example - -Registered tables must be writable by the TM runtime, and must be live -throughout the life-time of the TM runtime. - -@strong{TODO} The intention was always to drop the registration functions -entirely, and create a new ELF Phdr describing the linker-sorted table. Much -like what currently happens for @code{PT_GNU_EH_FRAME}. -This work kept getting bogged down in how to represent the @var{N} different -code generation variants. We clearly needed at least two---SW and HW -transactional clones---but there was always a suggestion of more variants for -different TM assumptions/invariants. - -The compiler can then use two TM runtime functions to perform indirect calls in -transactions: -@example -void *_ITM_getTMCloneOrIrrevocable (void *function) ITM_REGPARM; -void *_ITM_getTMCloneSafe (void *function) ITM_REGPARM; -@end example - -If there is a registered clone for supplied function, both will return a -pointer to the clone. If not, the first runtime function will attempt to switch -to serial--irrevocable mode and return the original pointer, whereas the second -will raise a fatal runtime error. - -@subsection [New] Transactional dynamic memory management - -@example -void *_ITM_malloc (size_t) - __attribute__((__malloc__)) ITM_PURE; -void *_ITM_calloc (size_t, size_t) - __attribute__((__malloc__)) ITM_PURE; -void _ITM_free (void *) ITM_PURE; -@end example - -These functions are essentially transactional wrappers for @code{malloc}, -@code{calloc}, and @code{free}. Within transactions, the compiler should -replace calls to the original functions with calls to the wrapper functions. - - -@section [No changes] Future Enhancements to the ABI - -@section Sample code - -The code examples might not be correct w.r.t. the current version of the ABI, -especially everything related to exception handling. - - -@section [New] Memory model - -The ABI should define a memory model and the ordering that is guaranteed for -data transfers and commit/undo actions, or at least refer to another memory -model that needs to be preserved. Without that, the compiler cannot ensure the -memory model specified on the level of the programming language (e.g., by the -C++ TM specification). - -For example, if a transactional load is ordered before another load/store, then -the TM runtime must also ensure this ordering when accessing shared state. If -not, this might break the kind of publication safety used in the C++ TM -specification. Likewise, the TM runtime must ensure privatization safety. - - - -@c --------------------------------------------------------------------- -@c Internals -@c --------------------------------------------------------------------- - -@node Internals -@chapter Internals - -@section TM methods and method groups - -libitm supports several ways of synchronizing transactions with each other. -These TM methods (or TM algorithms) are implemented in the form of -subclasses of @code{abi_dispatch}, which provide methods for -transactional loads and stores as well as callbacks for rollback and commit. -All methods that are compatible with each other (i.e., that let concurrently -running transactions still synchronize correctly even if different methods -are used) belong to the same TM method group. Pointers to TM methods can be -obtained using the factory methods prefixed with @code{dispatch_} in -@file{libitm_i.h}. There are two special methods, @code{dispatch_serial} and -@code{dispatch_serialirr}, that are compatible with all methods because they -run transactions completely in serial mode. - -@subsection TM method life cycle - -The state of TM methods does not change after construction, but they do alter -the state of transactions that use this method. However, because -per-transaction data gets used by several methods, @code{gtm_thread} is -responsible for setting an initial state that is useful for all methods. -After that, methods are responsible for resetting/clearing this state on each -rollback or commit (of outermost transactions), so that the transaction -executed next is not affected by the previous transaction. - -There is also global state associated with each method group, which is -initialized and shut down (@code{method_group::init()} and @code{fini()}) -when switching between method groups (see @file{retry.cc}). - -@subsection Selecting the default method - -The default method that libitm uses for freshly started transactions (but -not necessarily for restarted transactions) can be set via an environment -variable (@env{ITM_DEFAULT_METHOD}), whose value should be equal to the name -of one of the factory methods returning abi_dispatch subclasses but without -the "dispatch_" prefix (e.g., "serialirr" instead of -@code{GTM::dispatch_serialirr()}). - -Note that this environment variable is only a hint for libitm and might not -be supported in the future. - - -@section Nesting: flat vs. closed - -We support two different kinds of nesting of transactions. In the case of -@emph{flat nesting}, the nesting structure is flattened and all nested -transactions are subsumed by the enclosing transaction. In contrast, -with @emph{closed nesting}, nested transactions that have not yet committed -can be rolled back separately from the enclosing transactions; when they -commit, they are subsumed by the enclosing transaction, and their effects -will be finally committed when the outermost transaction commits. -@emph{Open nesting} (where nested transactions can commit independently of the -enclosing transactions) are not supported. - -Flat nesting is the default nesting mode, but closed nesting is supported and -used when transactions contain user-controlled aborts -(@code{__transaction_cancel} statements). We assume that user-controlled -aborts are rare in typical code and used mostly in exceptional situations. -Thus, it makes more sense to use flat nesting by default to avoid the -performance overhead of the additional checkpoints required for closed -nesting. User-controlled aborts will correctly abort the innermost enclosing -transaction, whereas the whole (i.e., outermost) transaction will be restarted -otherwise (e.g., when a transaction encounters data conflicts during -optimistic execution). - - -@section Locking conventions - -This section documents the locking scheme and rules for all uses of locking -in libitm. We have to support serial(-irrevocable) mode, which is implemented -using a global lock as explained next (called the @emph{serial lock}). To -simplify the overall design, we use the same lock as catch-all locking -mechanism for other infrequent tasks such as (de)registering clone tables or -threads. Besides the serial lock, there are @emph{per-method-group locks} that -are managed by specific method groups (i.e., groups of similar TM concurrency -control algorithms), and lock-like constructs for quiescence-based operations -such as ensuring privatization safety. - -Thus, the actions that participate in the libitm-internal locking are either -@emph{active transactions} that do not run in serial mode, @emph{serial -transactions} (which (are about to) run in serial mode), and management tasks -that do not execute within a transaction but have acquired the serial mode -like a serial transaction would do (e.g., to be able to register threads with -libitm). Transactions become active as soon as they have successfully used the -serial lock to announce this globally (@pxref{serial-lock-impl,,Serial lock -implementation}). Likewise, transactions become serial transactions as soon as -they have acquired the exclusive rights provided by the serial lock (i.e., -serial mode, which also means that there are no other concurrent active or -serial transactions). Note that active transactions can become serial -transactions when they enter serial mode during the runtime of the -transaction. - -@subsection State-to-lock mapping - -Application data is protected by the serial lock if there is a serial -transaction and no concurrently running active transaction (i.e., non-serial). -Otherwise, application data is protected by the currently selected method -group, which might use per-method-group locks or other mechanisms. Also note -that application data that is about to be privatized might not be allowed to be -accessed by nontransactional code until privatization safety has been ensured; -the details of this are handled by the current method group. - -libitm-internal state is either protected by the serial lock or accessed -through custom concurrent code. The latter applies to the public/shared part -of a transaction object and most typical method-group-specific state. - -The former category (protected by the serial lock) includes: -@itemize @bullet -@item The list of active threads that have used transactions. -@item The tables that map functions to their transactional clones. -@item The current selection of which method group to use. -@item Some method-group-specific data, or invariants of this data. For example, -resetting a method group to its initial state is handled by switching to the -same method group, so the serial lock protects such resetting as well. -@end itemize -In general, such state is immutable whenever there exists an active -(non-serial) transaction. If there is no active transaction, a serial -transaction (or a thread that is not currently executing a transaction but has -acquired the serial lock) is allowed to modify this state (but must of course -be careful to not surprise the current method group's implementation with such -modifications). - -@subsection Lock acquisition order - -To prevent deadlocks, locks acquisition must happen in a globally agreed-upon -order. Note that this applies to other forms of blocking too, but does not -necessarily apply to lock acquisitions that do not block (e.g., trylock() -calls that do not get retried forever). Note that serial transactions are -never return back to active transactions until the transaction has committed. -Likewise, active transactions stay active until they have committed. -Per-method-group locks are typically also not released before commit. - -Lock acquisition / blocking rules: -@itemize @bullet - -@item Transactions must become active or serial before they are allowed to -use method-group-specific locks or blocking (i.e., the serial lock must be -acquired before those other locks, either in serial or nonserial mode). - -@item Any number of threads that do not currently run active transactions can -block while trying to get the serial lock in exclusive mode. Note that active -transactions must not block when trying to upgrade to serial mode unless there -is no other transaction that is trying that (the latter is ensured by the -serial lock implementation. - -@item Method groups must prevent deadlocks on their locks. In particular, they -must also be prepared for another active transaction that has acquired -method-group-specific locks but is blocked during an attempt to upgrade to -being a serial transaction. See below for details. - -@item Serial transactions can acquire method-group-specific locks because there -will be no other active nor serial transaction. - -@end itemize - -There is no single rule for per-method-group blocking because this depends on -when a TM method might acquire locks. If no active transaction can upgrade to -being a serial transaction after it has acquired per-method-group locks (e.g., -when those locks are only acquired during an attempt to commit), then the TM -method does not need to consider a potential deadlock due to serial mode. - -If there can be upgrades to serial mode after the acquisition of -per-method-group locks, then TM methods need to avoid those deadlocks: -@itemize @bullet -@item When upgrading to a serial transaction, after acquiring exclusive rights -to the serial lock but before waiting for concurrent active transactions to -finish (@pxref{serial-lock-impl,,Serial lock implementation} for details), -we have to wake up all active transactions waiting on the upgrader's -per-method-group locks. -@item Active transactions blocking on per-method-group locks need to check the -serial lock and abort if there is a pending serial transaction. -@item Lost wake-ups have to be prevented (e.g., by changing a bit in each -per-method-group lock before doing the wake-up, and only blocking on this lock -using a futex if this bit is not group). -@end itemize - -@strong{TODO}: Can reuse serial lock for gl-*? And if we can, does it make -sense to introduce further complexity in the serial lock? For gl-*, we can -really only avoid an abort if we do -wb and -vbv. - - -@subsection Serial lock implementation -@anchor{serial-lock-impl} - -The serial lock implementation is optimized towards assuming that serial -transactions are infrequent and not the common case. However, the performance -of entering serial mode can matter because when only few transactions are run -concurrently or if there are few threads, then it can be efficient to run -transactions serially. - -The serial lock is similar to a multi-reader-single-writer lock in that there -can be several active transactions but only one serial transaction. However, -we do want to avoid contention (in the lock implementation) between active -transactions, so we split up the reader side of the lock into per-transaction -flags that are true iff the transaction is active. The exclusive writer side -remains a shared single flag, which is acquired using a CAS, for example. -On the fast-path, the serial lock then works similar to Dekker's algorithm but -with several reader flags that a serial transaction would have to check. -A serial transaction thus requires a list of all threads with potentially -active transactions; we can use the serial lock itself to protect this list -(i.e., only threads that have acquired the serial lock can modify this list). - -We want starvation-freedom for the serial lock to allow for using it to ensure -progress for potentially starved transactions (@pxref{progress-guarantees,, -Progress Guarantees} for details). However, this is currently not enforced by -the implementation of the serial lock. - -Here is pseudo-code for the read/write fast paths of acquiring the serial -lock (read-to-write upgrade is similar to write_lock: -@example -// read_lock: -tx->shared_state |= active; -__sync_synchronize(); // or STLD membar, or C++0x seq-cst fence -while (!serial_lock.exclusive) - if (spinning_for_too_long) goto slowpath; - -// write_lock: -if (CAS(&serial_lock.exclusive, 0, this) != 0) - goto slowpath; // writer-writer contention -// need a membar here, but CAS already has full membar semantics -bool need_blocking = false; -for (t: all txns) - @{ - for (;t->shared_state & active;) - if (spinning_for_too_long) @{ need_blocking = true; break; @} - @} -if (need_blocking) goto slowpath; -@end example - -Releasing a lock in this spin-lock version then just consists of resetting -@code{tx->shared_state} to inactive or clearing @code{serial_lock.exclusive}. - -However, we can't rely on a pure spinlock because we need to get the OS -involved at some time (e.g., when there are more threads than CPUs to run on). -Therefore, the real implementation falls back to a blocking slow path, either -based on pthread mutexes or Linux futexes. - - -@subsection Reentrancy - -libitm has to consider the following cases of reentrancy: -@itemize @bullet - -@item Transaction calls unsafe code that starts a new transaction: The outer -transaction will become a serial transaction before executing unsafe code. -Therefore, nesting within serial transactions must work, even if the nested -transaction is called from within uninstrumented code. - -@item Transaction calls either a transactional wrapper or safe code, which in -turn starts a new transaction: It is not yet defined in the specification -whether this is allowed. Thus, it is undefined whether libitm supports this. - -@item Code that starts new transactions might be called from within any part -of libitm: This kind of reentrancy would likely be rather complex and can -probably be avoided. Therefore, it is not supported. - -@end itemize - -@subsection Privatization safety - -Privatization safety is ensured by libitm using a quiescence-based approach. -Basically, a privatizing transaction waits until all concurrent active -transactions will either have finished (are not active anymore) or operate on -a sufficiently recent snapshot to not access the privatized data anymore. This -happens after the privatizing transaction has stopped being an active -transaction, so waiting for quiescence does not contribute to deadlocks. - -In method groups that need to ensure publication safety explicitly, active -transactions maintain a flag or timestamp in the public/shared part of the -transaction descriptor. Before blocking, privatizers need to let the other -transactions know that they should wake up the privatizer. - -@strong{TODO} Ho to implement the waiters? Should those flags be -per-transaction or at a central place? We want to avoid one wake/wait call -per active transactions, so we might want to use either a tree or combining -to reduce the syscall overhead, or rather spin for a long amount of time -instead of doing blocking. Also, it would be good if only the last transaction -that the privatizer waits for would do the wake-up. - -@subsection Progress guarantees -@anchor{progress-guarantees} - -Transactions that do not make progress when using the current TM method will -eventually try to execute in serial mode. Thus, the serial lock's progress -guarantees determine the progress guarantees of the whole TM. Obviously, we at -least need deadlock-freedom for the serial lock, but it would also be good to -provide starvation-freedom (informally, all threads will finish executing a -transaction eventually iff they get enough cycles). - -However, the scheduling of transactions (e.g., thread scheduling by the OS) -also affects the handling of progress guarantees by the TM. First, the TM -can only guarantee deadlock-freedom if threads do not get stopped. Likewise, -low-priority threads can starve if they do not get scheduled when other -high-priority threads get those cycles instead. - -If all threads get scheduled eventually, correct lock implementations will -provide deadlock-freedom, but might not provide starvation-freedom. We can -either enforce the latter in the TM's lock implementation, or assume that -the scheduling is sufficiently random to yield a probabilistic guarantee that -no thread will starve (because eventually, a transaction will encounter a -scheduling that will allow it to run). This can indeed work well in practice -but is not necessarily guaranteed to work (e.g., simple spin locks can be -pretty efficient). - -Because enforcing stronger progress guarantees in the TM has a higher runtime -overhead, we focus on deadlock-freedom right now and assume that the threads -will get scheduled eventually by the OS (but don't consider threads with -different priorities). We should support starvation-freedom for serial -transactions in the future. Everything beyond that is highly related to proper -contention management across all of the TM (including with TM method to -choose), and is future work. - -@strong{TODO} Handling thread priorities: We want to avoid priority inversion -but it's unclear how often that actually matters in practice. Workloads that -have threads with different priorities will likely also require lower latency -or higher throughput for high-priority threads. Therefore, it probably makes -not that much sense (except for eventual progress guarantees) to use -priority inheritance until the TM has priority-aware contention management. - - -@c --------------------------------------------------------------------- -@c GNU Free Documentation License -@c --------------------------------------------------------------------- - -@include fdl.texi - -@c --------------------------------------------------------------------- -@c Index -@c --------------------------------------------------------------------- - -@node Library Index -@unnumbered Library Index - -@printindex cp - -@bye diff --git a/contrib/gcc-5.0/libstdc++-v3/config/abi/pre/gnu.ver b/contrib/gcc-5.0/libstdc++-v3/config/abi/pre/gnu.ver index d2116fa256..7b82ce88ae 100644 --- a/contrib/gcc-5.0/libstdc++-v3/config/abi/pre/gnu.ver +++ b/contrib/gcc-5.0/libstdc++-v3/config/abi/pre/gnu.ver @@ -1709,9 +1709,9 @@ GLIBCXX_3.4.21 { # fstream functions taking ABI-tagged std::string _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4openERKNSt7__cxx1112basic_string*; - _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC1ERKNSt7__cxx1112basic_string*; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]ERKNSt7__cxx1112basic_string*; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4openERKNSt7__cxx1112basic_string*; - _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEC1ERKNSt7__cxx1112basic_string*; + _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEC[12]ERKNSt7__cxx1112basic_string*; _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EE4openERKNSt7__cxx1112basic_string*; # std::locale::name() returning new std::string diff --git a/contrib/gcc-5.0/libstdc++-v3/include/bits/atomic_base.h b/contrib/gcc-5.0/libstdc++-v3/include/bits/atomic_base.h index 8104c986b5..79769cf46d 100644 --- a/contrib/gcc-5.0/libstdc++-v3/include/bits/atomic_base.h +++ b/contrib/gcc-5.0/libstdc++-v3/include/bits/atomic_base.h @@ -240,7 +240,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: typedef _ITp __int_type; - __int_type _M_i; + static constexpr int _S_alignment = + sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp); + + alignas(_S_alignment) __int_type _M_i; public: __atomic_base() noexcept = default; diff --git a/contrib/gcc-5.0/libstdc++-v3/include/std/atomic b/contrib/gcc-5.0/libstdc++-v3/include/std/atomic index 88c8b17dbc..125e37a283 100644 --- a/contrib/gcc-5.0/libstdc++-v3/include/std/atomic +++ b/contrib/gcc-5.0/libstdc++-v3/include/std/atomic @@ -165,18 +165,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct atomic { private: - // Align 1/2/4/8/16-byte types the same as integer types of that size. - // This matches the alignment effects of the C11 _Atomic qualifier. + // Align 1/2/4/8/16-byte types to at least their size. static constexpr int _S_min_alignment - = sizeof(_Tp) == sizeof(char) ? alignof(char) - : sizeof(_Tp) == sizeof(short) ? alignof(short) - : sizeof(_Tp) == sizeof(int) ? alignof(int) - : sizeof(_Tp) == sizeof(long) ? alignof(long) - : sizeof(_Tp) == sizeof(long long) ? alignof(long long) -#ifdef _GLIBCXX_USE_INT128 - : sizeof(_Tp) == sizeof(__int128) ? alignof(__int128) -#endif - : 0; + = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || sizeof(_Tp) > 16 + ? 0 : sizeof(_Tp); static constexpr int _S_alignment = _S_min_alignment > alignof(_Tp) ? _S_min_alignment : alignof(_Tp); diff --git a/contrib/gcc-5.0/libstdc++-v3/include/std/shared_mutex b/contrib/gcc-5.0/libstdc++-v3/include/std/shared_mutex index ab1b45b87a..b72a822a57 100644 --- a/contrib/gcc-5.0/libstdc++-v3/include/std/shared_mutex +++ b/contrib/gcc-5.0/libstdc++-v3/include/std/shared_mutex @@ -57,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// shared_timed_mutex class shared_timed_mutex { -#ifdef _GLIBCXX_USE_PTHREAD_RWLOCK_T +#if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK typedef chrono::system_clock __clock_t; #ifdef PTHREAD_RWLOCK_INITIALIZER @@ -116,7 +116,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) @@ -158,7 +157,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const auto __s_atime = __s_entry + __delta; return try_lock_until(__s_atime); } -#endif void unlock() @@ -200,7 +198,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) @@ -258,7 +255,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const auto __s_atime = __s_entry + __delta; return try_lock_shared_until(__s_atime); } -#endif void unlock_shared() @@ -266,35 +262,54 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION unlock(); } -#else // ! _GLIBCXX_USE_PTHREAD_RWLOCK_T - -#if _GTHREAD_USE_MUTEX_TIMEDLOCK - struct _Mutex : mutex, __timed_mutex_impl<_Mutex> - { - template - bool - try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) - { return _M_try_lock_for(__rtime); } +#else // ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK) - template - bool - try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) - { return _M_try_lock_until(__atime); } - }; -#else - typedef mutex _Mutex; -#endif - - // Based on Howard Hinnant's reference implementation from N2406 + // Must use the same clock as condition_variable + typedef chrono::system_clock __clock_t; - _Mutex _M_mut; + // Based on Howard Hinnant's reference implementation from N2406. + + // The high bit of _M_state is the write-entered flag which is set to + // indicate a writer has taken the lock or is queuing to take the lock. + // The remaining bits are the count of reader locks. + // + // To take a reader lock, block on gate1 while the write-entered flag is + // set or the maximum number of reader locks is held, then increment the + // reader lock count. + // To release, decrement the count, then if the write-entered flag is set + // and the count is zero then signal gate2 to wake a queued writer, + // otherwise if the maximum number of reader locks was held signal gate1 + // to wake a reader. + // + // To take a writer lock, block on gate1 while the write-entered flag is + // set, then set the write-entered flag to start queueing, then block on + // gate2 while the number of reader locks is non-zero. + // To release, unset the write-entered flag and signal gate1 to wake all + // blocked readers and writers. + // + // This means that when no reader locks are held readers and writers get + // equal priority. When one or more reader locks is held a writer gets + // priority and no more reader locks can be taken while the writer is + // queued. + + // Only locked when accessing _M_state or waiting on condition variables. + mutex _M_mut; + // Used to block while write-entered is set or reader count at maximum. condition_variable _M_gate1; + // Used to block queued writers while reader count is non-zero. condition_variable _M_gate2; + // The write-entered flag and reader count. unsigned _M_state; static constexpr unsigned _S_write_entered = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1); - static constexpr unsigned _M_n_readers = ~_S_write_entered; + static constexpr unsigned _S_max_readers = ~_S_write_entered; + + // Test whether the write-entered flag is set. _M_mut must be locked. + bool _M_write_entered() const { return _M_state & _S_write_entered; } + + // The number of reader locks currently held. _M_mut must be locked. + unsigned _M_readers() const { return _M_state & _S_max_readers; } public: shared_timed_mutex() : _M_state(0) {} @@ -313,11 +328,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lock() { unique_lock __lk(_M_mut); - while (_M_state & _S_write_entered) - _M_gate1.wait(__lk); + // Wait until we can set the write-entered flag. + _M_gate1.wait(__lk, [=]{ return !_M_write_entered(); }); _M_state |= _S_write_entered; - while (_M_state & _M_n_readers) - _M_gate2.wait(__lk); + // Then wait until there are no more readers. + _M_gate2.wait(__lk, [=]{ return _M_readers() == 0; }); } bool @@ -332,41 +347,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return false; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) { - unique_lock<_Mutex> __lk(_M_mut, __rel_time); - if (__lk.owns_lock() && _M_state == 0) - { - _M_state = _S_write_entered; - return true; - } - return false; + return try_lock_until(__clock_t::now() + __rel_time); } template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { - unique_lock<_Mutex> __lk(_M_mut, __abs_time); - if (__lk.owns_lock() && _M_state == 0) + unique_lock __lk(_M_mut); + if (!_M_gate1.wait_until(__lk, __abs_time, + [=]{ return !_M_write_entered(); })) { - _M_state = _S_write_entered; - return true; + return false; } - return false; + _M_state |= _S_write_entered; + if (!_M_gate2.wait_until(__lk, __abs_time, + [=]{ return _M_readers() == 0; })) + { + _M_state ^= _S_write_entered; + // Wake all threads blocked while the write-entered flag was set. + _M_gate1.notify_all(); + return false; + } + return true; } -#endif void unlock() { - { - lock_guard<_Mutex> __lk(_M_mut); - _M_state = 0; - } + lock_guard __lk(_M_mut); + _GLIBCXX_DEBUG_ASSERT( _M_write_entered() ); + _M_state = 0; + // call notify_all() while mutex is held so that another thread can't + // lock and unlock the mutex then destroy *this before we make the call. _M_gate1.notify_all(); } @@ -376,51 +393,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lock_shared() { unique_lock __lk(_M_mut); - while ((_M_state & _S_write_entered) - || (_M_state & _M_n_readers) == _M_n_readers) - { - _M_gate1.wait(__lk); - } - unsigned __num_readers = (_M_state & _M_n_readers) + 1; - _M_state &= ~_M_n_readers; - _M_state |= __num_readers; + _M_gate1.wait(__lk, [=]{ return _M_state < _S_max_readers; }); + ++_M_state; } bool try_lock_shared() { - unique_lock<_Mutex> __lk(_M_mut, try_to_lock); - unsigned __num_readers = _M_state & _M_n_readers; - if (__lk.owns_lock() && !(_M_state & _S_write_entered) - && __num_readers != _M_n_readers) + unique_lock __lk(_M_mut, try_to_lock); + if (!__lk.owns_lock()) + return false; + if (_M_state < _S_max_readers) { - ++__num_readers; - _M_state &= ~_M_n_readers; - _M_state |= __num_readers; + ++_M_state; return true; } return false; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) { - unique_lock<_Mutex> __lk(_M_mut, __rel_time); - if (__lk.owns_lock()) - { - unsigned __num_readers = _M_state & _M_n_readers; - if (!(_M_state & _S_write_entered) - && __num_readers != _M_n_readers) - { - ++__num_readers; - _M_state &= ~_M_n_readers; - _M_state |= __num_readers; - return true; - } - } - return false; + return try_lock_shared_until(__clock_t::now() + __rel_time); } template @@ -428,42 +423,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { - unique_lock<_Mutex> __lk(_M_mut, __abs_time); - if (__lk.owns_lock()) + unique_lock __lk(_M_mut); + if (!_M_gate1.wait_until(__lk, __abs_time, + [=]{ return _M_state < _S_max_readers; })) { - unsigned __num_readers = _M_state & _M_n_readers; - if (!(_M_state & _S_write_entered) - && __num_readers != _M_n_readers) - { - ++__num_readers; - _M_state &= ~_M_n_readers; - _M_state |= __num_readers; - return true; - } + return false; } - return false; + ++_M_state; + return true; } -#endif void unlock_shared() { - lock_guard<_Mutex> __lk(_M_mut); - unsigned __num_readers = (_M_state & _M_n_readers) - 1; - _M_state &= ~_M_n_readers; - _M_state |= __num_readers; - if (_M_state & _S_write_entered) + lock_guard __lk(_M_mut); + _GLIBCXX_DEBUG_ASSERT( _M_readers() > 0 ); + auto __prev = _M_state--; + if (_M_write_entered()) { - if (__num_readers == 0) + // Wake the queued writer if there are no more readers. + if (_M_readers() == 0) _M_gate2.notify_one(); + // No need to notify gate1 because we give priority to the queued + // writer, and that writer will eventually notify gate1 after it + // clears the write-entered flag. } else { - if (__num_readers == _M_n_readers - 1) + // Wake any thread that was blocked on reader overflow. + if (__prev == _S_max_readers) _M_gate1.notify_one(); } } -#endif // ! _GLIBCXX_USE_PTHREAD_RWLOCK_T +#endif // _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK }; #endif // _GLIBCXX_HAS_GTHREADS -- 2.41.0