GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "predict.h"
#include "memmodel.h"
#include "tm_p.h"
#include "optabs.h"
#include "emit-rtl.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "dojump.h"
#include "explow.h"
#include "expr.h"
#include "langhooks.h"
#include "gt-dojump.h"
Variables | |
static rtx | and_reg |
static rtx | and_test |
static rtx | shift_test |
void clear_pending_stack_adjust | ( | void | ) |
When exiting from function, if safe, clear out any pending stack adjust so the adjustment won't get done. Note, if the current function calls alloca, then it must have a frame pointer regardless of the value of flag_omit_frame_pointer.
References cfun, discard_pending_stack_adjust(), and EXIT_IGNORE_STACK.
Referenced by expand_function_end(), expand_naked_return(), and expand_null_return_1().
void discard_pending_stack_adjust | ( | void | ) |
Discard any pending stack adjustment. This avoid relying on the RTL optimizers to remove useless adjustments when we know the stack pointer value is dead.
References pending_stack_adjust, and stack_pointer_delta.
Referenced by clear_pending_stack_adjust(), and emit_stack_restore().
|
static |
Generate code for a comparison expression EXP (including code to compute the values to be compared) and a conditional jump to IF_FALSE_LABEL and/or IF_TRUE_LABEL. One of the labels can be NULL_RTX, in which case the generated code will drop through. SIGNED_CODE should be the rtx operation for this comparison for signed data; UNSIGNED_CODE, likewise for use if data is unsigned. We force a stack adjustment unless there are currently things pushed on the stack that aren't yet used.
References do_compare_rtx_and_jump(), emit_insn(), expand_normal(), expr_size(), FUNC_OR_METHOD_TYPE_P, gen_reg_rtx(), GET_MODE_BITSIZE(), NULL_RTX, POINTER_TYPE_P, SCALAR_INT_TYPE_MODE, targetm, TREE_CODE, TREE_TYPE, type(), TYPE_MODE, and TYPE_UNSIGNED.
Referenced by do_jump_1().
void do_compare_rtx_and_jump | ( | rtx | op0, |
rtx | op1, | ||
enum rtx_code | code, | ||
int | unsignedp, | ||
machine_mode | mode, | ||
rtx | size, | ||
rtx_code_label * | if_false_label, | ||
rtx_code_label * | if_true_label, | ||
profile_probability | prob ) |
Like do_compare_and_jump but expects the values to compare as two rtx's. The decision as to signed or unsigned comparison must be made by the caller. If MODE is BLKmode, SIZE is an RTX giving the size of the objects being compared.
References do_compare_rtx_and_jump(), and NULL.
Referenced by add_test(), compare_and_jump_seq(), do_cmp_and_jump(), do_compare_and_jump(), do_compare_rtx_and_jump(), do_compare_rtx_and_jump(), do_jump(), do_jump_by_parts_equality_rtx(), do_jump_by_parts_greater_rtx(), do_jump_by_parts_zero_rtx(), do_jump_if_equal(), emit_store_flag_force(), expand_abs(), expand_addsub_overflow(), expand_arith_overflow_result_store(), expand_builtin_strub_leave(), expand_builtin_strub_update(), expand_doubleword_shift(), expand_expr_real_2(), expand_mul_overflow(), expand_neg_overflow(), expand_ubsan_result_store(), expand_vector_ubsan_overflow(), compare_by_pieces_d::finish_mode(), compare_by_pieces_d::generate(), and rtl_lv_add_condition_to_bb().
void do_compare_rtx_and_jump | ( | rtx | op0, |
rtx | op1, | ||
enum rtx_code | code, | ||
int | unsignedp, | ||
tree | val, | ||
machine_mode | mode, | ||
rtx | size, | ||
rtx_code_label * | if_false_label, | ||
rtx_code_label * | if_true_label, | ||
profile_probability | prob ) |
Like do_compare_and_jump but expects the values to compare as two rtx's. The decision as to signed or unsigned comparison must be made by the caller. If MODE is BLKmode, SIZE is an RTX giving the size of the objects being compared.
References profile_probability::apply_scale(), can_compare_p(), ccp_jump, CONST0_RTX, const0_rtx, CONSTANT_P, do_compare_rtx_and_jump(), do_jump_by_parts_equality_rtx(), do_jump_by_parts_greater_rtx(), do_pending_stack_adjust(), emit_cmp_and_jump_insns(), emit_jump(), emit_label(), profile_probability::even(), expand_binop(), FLOAT_MODE_P, gcc_assert, gcc_unreachable, GEN_INT, gen_label_rtx(), GET_CODE, GET_MODE, GET_MODE_PRECISION(), profile_probability::guessed_always(), have_insn_for(), HONOR_NANS(), HONOR_SNANS(), HOST_WIDE_INT_1U, profile_probability::invert(), is_int_mode(), NULL, NULL_RTX, OPTAB_WIDEN, reverse_condition(), reverse_condition_maybe_unordered(), rtx_equal_p(), SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, simplify_relational_operation(), profile_probability::split(), split_comparison(), swap_commutative_operands_p(), swap_condition(), poly_int< N, C >::to_constant(), TREE_TYPE, TYPE_VECTOR_SUBPARTS(), unknown_optab, unsigned_condition(), VECTOR_BOOLEAN_TYPE_P, and XEXP.
|
static |
Generate code to evaluate EXP and jump to IF_FALSE_LABEL if the result is zero, or IF_TRUE_LABEL if the result is one. Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero, meaning fall through in that case. do_jump always does any pending stack adjust except when it does not actually perform a jump. An example where there is no jump is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null. PROB is probability of jump to if_true_label.
References build2(), build_int_cstu(), CASE_CONVERT, compare_tree_int(), CONST0_RTX, CONVERT_EXPR_P, copy_to_reg(), do_compare_rtx_and_jump(), do_jump(), do_jump_1(), do_pending_stack_adjust(), emit_jump(), emit_label(), error_mark_node, exp(), expand_normal(), fold_convert, gcc_unreachable, gen_label_rtx(), GET_CODE, GET_MODE, have_insn_for(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, i, int_mode_for_size(), integer_onep(), integer_zerop(), profile_probability::invert(), NULL, NULL_RTX, optimize_insn_for_speed_p(), prefer_and_bit_test(), REG_P, SCALAR_INT_TYPE_MODE, shift, SUBREG_PROMOTED_VAR_P, TREE_CODE, tree_floor_log2(), TREE_INT_CST_LOW, TREE_OPERAND, TREE_SIDE_EFFECTS, TREE_TYPE, type(), lang_hooks_for_types::type_for_mode, TYPE_MODE, TYPE_PRECISION, TYPE_UNSIGNED, lang_hooks::types, profile_probability::uninitialized(), and XEXP.
Referenced by do_jump(), do_jump_1(), jumpif(), and jumpifnot().
|
static |
Subroutine of do_jump, dealing with exploded comparisons of the type OP0 CODE OP1 . IF_FALSE_LABEL and IF_TRUE_LABEL like in do_jump. PROB is probability of jump to if_true_label.
References can_compare_p(), ccp_jump, do_compare_and_jump(), do_jump(), do_jump_by_parts_equality(), do_jump_by_parts_greater(), do_pending_stack_adjust(), emit_label(), profile_probability::even(), gcc_assert, gcc_unreachable, gen_label_rtx(), GET_MODE_CLASS, profile_probability::initialized_p(), integer_zerop(), profile_probability::invert(), is_int_mode(), NULL, profile_probability::split(), TREE_TYPE, TYPE_MODE, and profile_probability::uninitialized().
Referenced by do_jump(), jumpif_1(), and jumpifnot_1().
|
static |
Given an EQ_EXPR expression EXP for values too wide to be compared with one insn, test the comparison and jump to the appropriate label. MODE is the mode of the two operands.
References do_jump_by_parts_equality_rtx(), and expand_normal().
Referenced by do_jump_1().
|
static |
Test for the equality of two RTX expressions OP0 and OP1 in mode MODE, where MODE is an integer mode too wide to be compared with one insn. Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL_RTX to indicate drop through.
References const0_rtx, do_compare_rtx_and_jump(), do_jump_by_parts_zero_rtx(), emit_jump(), emit_label(), gen_label_rtx(), GET_MODE_SIZE(), i, NULL, NULL_RTX, operand_subword_force(), and word_mode.
Referenced by do_compare_rtx_and_jump(), and do_jump_by_parts_equality().
|
static |
Given a comparison expression EXP for values too wide to be compared with one insn, test the comparison and jump to the appropriate label. The code of EXP is ignored; we always test GT if SWAP is 0, and LT if SWAP is 1. MODE is the mode of the two operands.
References do_jump_by_parts_greater_rtx(), expand_normal(), TREE_TYPE, and TYPE_UNSIGNED.
Referenced by do_jump_1().
|
static |
Compare OP0 with OP1, word at a time, in mode MODE. UNSIGNEDP says to do unsigned comparison. Jump to IF_TRUE_LABEL if OP0 is greater, IF_FALSE_LABEL otherwise.
References const0_rtx, do_compare_rtx_and_jump(), emit_jump(), emit_label(), gen_label_rtx(), GET_MODE_SIZE(), i, profile_probability::invert(), NULL, NULL_RTX, operand_subword_force(), and word_mode.
Referenced by do_compare_rtx_and_jump(), and do_jump_by_parts_greater().
|
static |
Jump according to whether OP0 is 0. We assume that OP0 has an integer mode, MODE, that is too wide for the available compare insns. Either Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL to indicate drop through.
References const0_rtx, do_compare_rtx_and_jump(), emit_jump(), emit_label(), emit_move_insn(), expand_binop(), gen_label_rtx(), gen_reg_rtx(), GET_MODE_SIZE(), i, NULL, NULL_RTX, operand_subword_force(), OPTAB_WIDEN, and word_mode.
Referenced by do_jump_by_parts_equality_rtx().
void do_pending_stack_adjust | ( | void | ) |
Pop any previously-pushed arguments that have not been popped yet.
References adjust_stack(), gen_int_mode(), inhibit_defer_pop, and pending_stack_adjust.
Referenced by allocate_dynamic_stack_space(), asan_emit_allocas_unpoison(), asan_emit_stack_protection(), do_compare_rtx_and_jump(), do_jump(), do_jump_1(), emit_block_cmp_via_loop(), emit_block_move_via_loop(), emit_block_move_via_oriented_loop(), emit_conditional_add(), emit_conditional_move(), emit_jump(), emit_partition_copy(), emit_stack_save(), emit_store_flag_1(), expand_addsub_overflow(), expand_asm_stmt(), expand_builtin_apply(), expand_call(), expand_case(), expand_computed_goto(), expand_expr_divmod(), expand_expr_real_1(), expand_expr_real_2(), expand_fix(), expand_float(), expand_function_end(), expand_gimple_basic_block(), expand_gimple_tailcall(), expand_label(), expand_mul_overflow(), expand_naked_return(), expand_neg_overflow(), expand_null_return_1(), expand_POPCOUNT(), expand_sjlj_dispatch_table(), expand_SPACESHIP(), expand_vector_ubsan_overflow(), gen_cond_trap(), hwasan_emit_untag_frame(), insert_value_copy_on_edge(), maybe_optimize_mod_cmp(), maybe_optimize_pow2p_mod_cmp(), store_constructor(), store_expr(), store_one_arg(), try_casesi(), and try_tablejump().
void init_pending_stack_adjust | ( | void | ) |
At the start of a function, record that we have no previously-pushed arguments waiting to be popped.
References pending_stack_adjust.
void jumpif | ( | tree | exp, |
rtx_code_label * | label, | ||
profile_probability | prob ) |
Generate code to evaluate EXP and jump to LABEL if the value is nonzero. PROB is probability of jump to LABEL.
References do_jump(), exp(), and NULL.
Referenced by expand_expr_real_1(), and store_constructor().
void jumpif_1 | ( | enum tree_code | code, |
tree | op0, | ||
tree | op1, | ||
rtx_code_label * | label, | ||
profile_probability | prob ) |
Similar to jumpif but dealing with exploded comparisons of the type OP0 CODE OP1 . LABEL and PROB are like in jumpif.
References do_jump_1(), and NULL.
Referenced by expand_gimple_cond().
void jumpifnot | ( | tree | exp, |
rtx_code_label * | label, | ||
profile_probability | prob ) |
Generate code to evaluate EXP and jump to LABEL if the value is zero. PROB is probability of jump to LABEL.
References do_jump(), exp(), profile_probability::invert(), and NULL.
Referenced by expand_expr_real_1(), expand_expr_real_2(), and store_expr().
void jumpifnot_1 | ( | enum tree_code | code, |
tree | op0, | ||
tree | op1, | ||
rtx_code_label * | label, | ||
profile_probability | prob ) |
Similar to jumpifnot but dealing with exploded comparisons of the type OP0 CODE OP1 . LABEL and PROB are like in jumpifnot.
References do_jump_1(), profile_probability::invert(), and NULL.
Referenced by expand_expr_real_2(), and expand_gimple_cond().
|
static |
Convert tree expression to rtl instructions, for GNU compiler. Copyright (C) 1988-2024 Free Software Foundation, Inc. This file is part of GCC. GCC 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, or (at your option) any later version. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Include expr.h after insn-config.h so we get HAVE_conditional_move.
Compare the relative costs of "(X & (1 << BITNUM))" and "(X >> BITNUM) & 1", where X is an arbitrary register of mode MODE. Return true if the former is preferred.
References and_reg, and_test, const1_rtx, GEN_INT, gen_rtx_REG(), GET_MODE_PRECISION(), immed_wide_int_const(), LAST_VIRTUAL_REGISTER, NULL, optimize_insn_for_speed_p(), PUT_MODE(), rtx_cost(), wi::set_bit_in_zero(), shift_test, and XEXP.
Referenced by do_jump().
void restore_pending_stack_adjust | ( | saved_pending_stack_adjust * | save | ) |
Restore the saved pending_stack_adjust/stack_pointer_delta.
References inhibit_defer_pop, pending_stack_adjust, stack_pointer_delta, saved_pending_stack_adjust::x_pending_stack_adjust, and saved_pending_stack_adjust::x_stack_pointer_delta.
Referenced by emit_conditional_move(), and expand_call().
void save_pending_stack_adjust | ( | saved_pending_stack_adjust * | save | ) |
Remember pending_stack_adjust/stack_pointer_delta. To be used around code that may call do_pending_stack_adjust (), but the generated code could be discarded e.g. using delete_insns_since.
References pending_stack_adjust, stack_pointer_delta, saved_pending_stack_adjust::x_pending_stack_adjust, and saved_pending_stack_adjust::x_stack_pointer_delta.
Referenced by emit_conditional_move(), and expand_call().
bool split_comparison | ( | enum rtx_code | code, |
machine_mode | mode, | ||
enum rtx_code * | code1, | ||
enum rtx_code * | code2 ) |
Split a comparison into two others, the second of which has the other "orderedness". The first is always ORDERED or UNORDERED if MODE does not honor NaNs (which means that it can be skipped in that case; see do_compare_rtx_and_jump). The two conditions are written in *CODE1 and *CODE2. Return true if the conditions must be ANDed, false if they must be ORed.
References gcc_unreachable, and HONOR_NANS().
Referenced by do_compare_rtx_and_jump(), and emit_store_flag().
|
static |
Used internally by prefer_and_bit_test.
Referenced by prefer_and_bit_test().
|
static |
Referenced by prefer_and_bit_test().
|
static |
Referenced by prefer_and_bit_test().