GCC Middle and Back End API Reference
recog.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  operand_alternative
struct  recog_data_d
struct  insn_gen_fn
struct  insn_operand_data
struct  insn_data_d

Macros

#define MAX_RECOG_ALTERNATIVES   30
#define memory_address_p(mode, addr)   memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
#define strict_memory_address_p(mode, addr)   strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
#define offsettable_address_p(strict, mode, addr)
#define INSN_OUTPUT_FORMAT_NONE   0 /* abort */
#define INSN_OUTPUT_FORMAT_SINGLE   1 /* const char * */
#define INSN_OUTPUT_FORMAT_MULTI   2 /* const char * const * */
#define INSN_OUTPUT_FORMAT_FUNCTION   3 /* const char * (*)(...) */

Typedefs

typedef int(* insn_operand_predicate_fn )(rtx, enum machine_mode)
typedef const char *(* insn_output_fn )(rtx *, rtx)

Enumerations

enum  op_type { OP_IN, OP_OUT, OP_INOUT }

Functions

void init_recog (void)
void init_recog_no_volatile (void)
int check_asm_operands (rtx)
int asm_operand_ok (rtx, const char *, const char **)
bool validate_change (rtx, rtx *, rtx, bool)
bool validate_unshare_change (rtx, rtx *, rtx, bool)
bool canonicalize_change_group (rtx insn, rtx x)
int insn_invalid_p (rtx, bool)
int verify_changes (int)
void confirm_change_group (void)
int apply_change_group (void)
int num_validated_changes (void)
void cancel_changes (int)
int constrain_operands (int)
int constrain_operands_cached (int)
int memory_address_addr_space_p (enum machine_mode, rtx, addr_space_t)
int strict_memory_address_addr_space_p (enum machine_mode, rtx, addr_space_t)
int validate_replace_rtx_subexp (rtx, rtx, rtx, rtx *)
int validate_replace_rtx (rtx, rtx, rtx)
int validate_replace_rtx_part (rtx, rtx, rtx *, rtx)
int validate_replace_rtx_part_nosimplify (rtx, rtx, rtx *, rtx)
void validate_replace_rtx_group (rtx, rtx, rtx)
void validate_replace_src_group (rtx, rtx, rtx)
bool validate_simplify_insn (rtx insn)
int num_changes_pending (void)
bool reg_fits_class_p (const_rtx, reg_class_t, int, enum machine_mode)
int offsettable_memref_p (rtx)
int offsettable_nonstrict_memref_p (rtx)
int offsettable_address_addr_space_p (int, enum machine_mode, rtx, addr_space_t)
bool mode_dependent_address_p (rtx, addr_space_t)
int recog (rtx, rtx, int *)
static int recog_memoized (rtx insn)
void add_clobbers (rtx, int)
int added_clobbers_hard_reg_p (int)
void insn_extract (rtx)
void extract_insn (rtx)
void extract_constrain_insn_cached (rtx)
void extract_insn_cached (rtx)
void preprocess_constraints (void)
rtx peep2_next_insn (int)
int peep2_regno_dead_p (int, int)
int peep2_reg_dead_p (int, rtx)
rtx peephole2_insns (rtx, rtx, int *)
int store_data_bypass_p (rtx, rtx)
int if_test_bypass_p (rtx, rtx)
static int recog_memoized ()
static const char * skip_alternative ()

Variables

int volatile_ok
int which_alternative
struct recog_data_d recog_data
struct operand_alternative recog_op_alt [MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES]
struct insn_data_d insn_data []
int peep2_current_count

Macro Definition Documentation

#define INSN_OUTPUT_FORMAT_FUNCTION   3 /* const char * (*)(...) */
#define INSN_OUTPUT_FORMAT_MULTI   2 /* const char * const * */
#define INSN_OUTPUT_FORMAT_NONE   0 /* abort */

Legal values for insn_data.output_format. Indicate what type of data is stored in insn_data.output.

#define INSN_OUTPUT_FORMAT_SINGLE   1 /* const char * */
#define MAX_RECOG_ALTERNATIVES   30

Declarations for interface to insn recognizer and insn-output.c. Copyright (C) 1987-2013 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/. Random number that should be large enough for all purposes.

#define memory_address_p (   mode,
  addr 
)    memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
#define offsettable_address_p (   strict,
  mode,
  addr 
)
Value:
#define strict_memory_address_p (   mode,
  addr 
)    strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)

Typedef Documentation

typedef int(* insn_operand_predicate_fn)(rtx, enum machine_mode)

A table defined in insn-output.c that give information about each insn-code value.

typedef const char*(* insn_output_fn)(rtx *, rtx)

Enumeration Type Documentation

enum op_type

Types of operands.

Enumerator:
OP_IN 
OP_OUT 
OP_INOUT 

Function Documentation

void add_clobbers ( rtx  ,
int   
)

Referenced by insn_invalid_p().

int added_clobbers_hard_reg_p ( int  )

Referenced by insn_invalid_p().

int apply_change_group ( void  )

Apply a group of changes previously issued with `validate_change'. If all changes are valid, call confirm_change_group and return 1, otherwise, call cancel_changes and return 0.

Referenced by find_comparison_args(), find_invariants_to_move(), and redirect_exp_1().

int asm_operand_ok ( rtx  ,
const char *  ,
const char **   
)
void cancel_changes ( int  )
bool canonicalize_change_group ( rtx  insn,
rtx  x 
)
int check_asm_operands ( rtx  )
void confirm_change_group ( void  )

A group of changes has previously been issued with validate_change and verified with verify_changes. Call df_insn_rescan for each of the insn changed and clear num_changes.

Avoid unnecessary rescanning when multiple changes to same instruction are made.

References confirm_change_group().

Referenced by confirm_change_group(), and redirect_jump_1().

int constrain_operands ( int  )
int constrain_operands_cached ( int  )
void extract_constrain_insn_cached ( rtx  )
void extract_insn ( rtx  )
void extract_insn_cached ( rtx  )
int if_test_bypass_p ( rtx  ,
rtx   
)
void init_recog ( void  )

References extract_asm_operands(), and NULL_RTX.

Referenced by profile_function().

void init_recog_no_volatile ( void  )

Initialize data used by the function `recog'. This must be called once in the compilation of a function before any insn recognition may be done in the function.

References volatile_ok.

void insn_extract ( rtx  )
int insn_invalid_p ( rtx  ,
bool   
)
int memory_address_addr_space_p ( enum machine_mode  mode,
rtx  addr,
addr_space_t  as 
)

Return 1 if ADDR is a valid memory address for mode MODE in address space AS.

Referenced by determine_common_wider_type(), gen_lowpart_if_possible(), get_computation(), num_changes_pending(), and reload_combine_closest_single_use().

bool mode_dependent_address_p ( rtx  ,
addr_space_t   
)
int num_changes_pending ( void  )

Return number of changes made and not validated yet.

References GET_MODE, MEM_ADDR_SPACE, memory_address_addr_space_p(), and XEXP.

int num_validated_changes ( void  )

Return the number of changes so far in the current group.

References GET_CODE, swap_commutative_operands_p(), SWAPPABLE_OPERANDS_P, and XEXP.

int offsettable_address_addr_space_p ( int  strictp,
enum machine_mode  mode,
rtx  y,
addr_space_t  as 
)

Return 1 if Y is a memory address which contains no side effects and would remain valid for address space AS after the addition of a positive integer less than the size of that mode.

We assume that the original address is valid and do not check it. We do check that it is valid for narrower modes.

If STRICTP is nonzero, we require a strictly valid address, for the sake of use in reload.c.

 Adjusting an offsettable address involves changing to a narrower mode.
 Make sure that's OK.   
 ??? How much offset does an offsettable BLKmode reference need?
 Clearly that depends on the situation in which it's being used.
 However, the current situation in which we test 0xffffffff is
 less than ideal.  Caveat user.   
 If the expression contains a constant term,
 see if it remains valid when max possible offset is added.   
     Use QImode because an odd displacement may be automatically invalid
     for any wider mode.  But it should be valid for a single byte.   
     In any case, restore old contents of memory.   
 The offset added here is chosen as the maximum offset that
 any instruction could need to add when operating on something
 of the specified mode.  We assume that if Y and Y+c are
 valid addresses then so is Y+d for all 0<d<c.  adjust_address will
 go inside a LO_SUM here, so we do so as well.   
 Use QImode because an odd displacement may be automatically invalid
 for any wider mode.  But it should be valid for a single byte.   

References constrain_operands(), and which_alternative.

int offsettable_memref_p ( rtx  )
int offsettable_nonstrict_memref_p ( rtx  )
rtx peep2_next_insn ( int  )
int peep2_reg_dead_p ( int  ,
rtx   
)
int peep2_regno_dead_p ( int  ,
int   
)
rtx peephole2_insns ( rtx  ,
rtx  ,
int *   
)
void preprocess_constraints ( void  )

After calling extract_insn, you can use this function to extract some information from the constraint strings into a more usable form. The collected data is stored in recog_op_alt.

These don't say anything we care about.

Referenced by process_bb_node_lives().

int recog ( rtx  ,
rtx  ,
int *   
)
static int recog_memoized ( rtx  insn)
inlinestatic

Referenced by noce_emit_store_flag().

static int recog_memoized ( )
inlinestatic

Try recognizing the instruction INSN, and return the code number that results. Remember the code so that repeated calls do not need to spend the time for actual rerecognition.

This function is the normal interface to instruction recognition. The automatically-generated function `recog' is normally called through this one.

bool reg_fits_class_p ( const_rtx  operand,
reg_class_t  cl,
int  offset,
enum machine_mode  mode 
)

Return true iff OPERAND (assumed to be a REG rtx) is a hard reg in class CLASS when its regno is offset by OFFSET and changed to mode MODE. If REG occupies multiple hard regs, all of them must be in CLASS.

Regno must not be a pseudo register. Offset may be negative.

References peep2_current_count.

Referenced by constrain_operands().

static const char* skip_alternative ( )
inlinestatic

Skip chars until the next ',' or the end of the string. This is useful to skip alternatives in a constraint string.

References recog_data_d::constraints, recog_data_d::is_operator, recog_data_d::operand, and recog_data_d::operand_loc.

Referenced by constrain_operands_cached().

int store_data_bypass_p ( rtx  ,
rtx   
)
int strict_memory_address_addr_space_p ( enum machine_mode  mode,
rtx  addr,
addr_space_t  as 
)

Return 1 if ADDR is a valid memory address for mode MODE in address space AS, and check that each pseudo reg has the proper kind of hard reg.

References operands_match_p(), and XVECEXP.

Referenced by subreg_lowpart_offset().

bool validate_change ( rtx  ,
rtx ,
rtx  ,
bool   
)
int validate_replace_rtx ( rtx  ,
rtx  ,
rtx   
)
void validate_replace_rtx_group ( rtx  ,
rtx  ,
rtx   
)
int validate_replace_rtx_part ( rtx  ,
rtx  ,
rtx ,
rtx   
)
int validate_replace_rtx_part_nosimplify ( rtx  from,
rtx  to,
rtx where,
rtx  insn 
)

Same as above, but do not simplify rtx afterwards.

int validate_replace_rtx_subexp ( rtx  ,
rtx  ,
rtx  ,
rtx  
)
void validate_replace_src_group ( rtx  ,
rtx  ,
rtx   
)
bool validate_simplify_insn ( rtx  insn)
bool validate_unshare_change ( rtx  ,
rtx ,
rtx  ,
bool   
)
int verify_changes ( int  )

Variable Documentation

int peep2_current_count

Referenced by reg_fits_class_p().

struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES]

Contains a vector of operand_alternative structures for every operand. Set up by preprocess_constraints.

Referenced by build_def_use(), copyprop_hardreg_forward_1(), extract_constrain_insn_cached(), and extract_insn_cached().

int volatile_ok

Nonzero means volatile operands are recognized.

Nonzero means allow operands to be volatile. This should be 0 if you are generating rtl, such as if you are calling the functions in optabs.c and expmed.c (most of the time). This should be 1 if all valid insns need to be recognized, such as in reginfo.c and final.c and reload.c.

init_recog and init_recog_no_volatile are responsible for setting this.

Referenced by block_move_libcall_safe_for_call_parm(), and init_recog_no_volatile().

int which_alternative

Set by constrain_operands to the number of the alternative that matched.

On return from `constrain_operands', indicate which alternative was satisfied.

Referenced by check_asm_operands(), lra_update_insn_recog_data(), and offsettable_address_addr_space_p().