GCC Middle and Back End API Reference
genoutput.c File Reference

Data Structures

struct  operand_data
struct  data
struct  constraint_data


static int n_occurrences (int, const char *)
static const char * strip_whitespace (const char *)
static void output_prologue (void)
static void output_operand_data (void)
static void output_insn_data (void)
static void output_get_insn_name (void)
static void scan_operands (struct data *, rtx, int, int)
static int compare_operands (struct operand_data *, struct operand_data *)
static void place_operands (struct data *)
static void process_template (struct data *, const char *)
static void validate_insn_alternatives (struct data *)
static void validate_insn_operands (struct data *)
static void gen_insn (rtx, int)
static void gen_peephole (rtx, int)
static void gen_expand (rtx, int)
static void gen_split (rtx, int)
static int mdep_constraint_len (const char *, int, int)
static void note_constraint (rtx, int)
static void check_constraint_len (void)
static int constraint_len (const char *, int)
static int compare_operands ()
static void place_operands ()
static void process_template ()
static void validate_insn_alternatives ()
static void validate_insn_operands ()
static void validate_optab_operands ()
static void gen_insn ()
static void gen_peephole ()
static void gen_expand ()
static void gen_split ()
static void init_insn_for_nothing ()
int main (int, char **)
int main ()
static int n_occurrences ()
static const char * strip_whitespace ()
static void note_constraint ()
static int mdep_constraint_len ()
static int constraint_len ()


static int next_code_number
static int next_index_number
static int next_operand_number = 1
static struct operand_data null_operand
static struct operand_dataodata = &null_operand
static struct operand_data ** odata_end = &null_operand.next
static struct data nothing
static struct dataidata = &nothing
static struct data ** idata_end = &nothing.next
static const char indep_constraints [] = ",=+%*?!#&<>EFVXgimnoprs"
static struct constraint_dataconstraints_by_letter_table [1<< CHAR_BIT]

Function Documentation

static void check_constraint_len ( )
   Verify that DEFAULT_CONSTRAINT_LEN is used properly and not
   tampered with.  This isn't bullet-proof, but it should catch
   most genuine mistakes.  
static int compare_operands ( struct operand_data ,
struct operand_data  

Referenced by place_operands().

static int compare_operands ( )
   Compare two operands for content equality.  
static int constraint_len ( const char *  ,
static int constraint_len ( )
     Check that we still match defaults.h .  First we do a generation-time
     check that fails if the value is not the expected one...  
     And now a compile-time check that should give a diagnostic if the
     definition doesn't exactly match.  
     Now re-define DEFAULT_CONSTRAINT_LEN so that we can verify it is
     being used.  
     And set it back.  
static void gen_expand ( rtx  ,
static void gen_expand ( )
   Process a define_expand just read.  Assign its code number,
   only for the purposes of `insn_gen_function'.  
     Build up the list in the same order as the insns are seen
     in the machine description.  
     Scan the operands to get the specified predicates and modes,
     since expand_binop needs to know them.  
static void gen_insn ( rtx  ,
static void gen_insn ( )
   Look at a define_insn just read.  Assign its code number.  Record
   on idata the template and the number of arguments.  If the insn has
   a hairy output action, output a function for now.  
     Build up the list in the same order as the insns are seen
     in the machine description.  
static void gen_peephole ( rtx  ,
static void gen_peephole ( )
   Look at a define_peephole just read.  Assign its code number.
   Record on idata the template and the number of arguments.
   If the insn has a hairy output action, output it now.  
     Build up the list in the same order as the insns are seen
     in the machine description.  
     Get the number of operands by scanning all the patterns of the
     peephole optimizer.  But ignore all the rest of the information
     thus obtained.  
static void gen_split ( rtx  ,
static void gen_split ( )
   Process a define_split just read.  Assign its code number,
   only for reasons of consistency and to simplify genrecog.  
     Build up the list in the same order as the insns are seen
     in the machine description.  
     Get the number of operands by scanning all the patterns of the
     split patterns.  But ignore all the rest of the information thus

References data::filename, memset(), data::name, and nothing.

static void init_insn_for_nothing ( )
int main ( int  ,
char **   
int main ( )
     Read the machine description.  
static int mdep_constraint_len ( const char *  ,
int  ,
static int mdep_constraint_len ( )
   Return the length of the constraint name beginning at position S
   of an operand constraint string, or issue an error message if there
   is no such constraint.  Does not expect to be called for generic
static int n_occurrences ( int  ,
const char *   
static int n_occurrences ( )
   Return the number of occurrences of character C in string S or
   -1 if S is the null string.  

References error_with_line(), indep_constraints, data::name, and strlen().

static void note_constraint ( rtx  ,
static void note_constraint ( )
   Record just enough information about a constraint to allow checking
   of operand constraint strings above, in validate_insn_alternatives.
   Does not validate most properties of the constraint itself; does
   enforce no duplicate names, no overlap with MI constraints, and no
   prefixes.  EXP is the define_*constraint form, LINENO the line number
   reported by the reader.  
     The 'm' constraint is special here since that constraint letter
     can be overridden by the back end by defining the
         This causes slot to end up pointing to the
         next_this_letter field of the last constraint with a name
         of equal or greater length than the new constraint; hence
         the new constraint will be inserted after all previous
         constraints with names of the same length.  
static void output_get_insn_name ( void  )
static void output_insn_data ( void  )
                       Preserve two consecutive \n's or \r's, but treat \r\n
                       as a single newline.  
static void output_operand_data ( void  )
static void output_prologue ( void  )
static void place_operands ( struct data )
static void place_operands ( )
   Scan the list of operands we've already committed to output and either
   find a subsequence that is the same, or allocate a new one at the end.  
     Brute force substring search.  
     Either partial match at the end of the list, or no match.  In either
     case, we tack on what operands are remaining to the end of the list.  

References compare_operands(), data::n_operands, operand_data::next, and data::operand.

static void process_template ( struct data ,
const char *   
static void process_template ( )
   Process an assembler template from a define_insn or a define_peephole.
   It is either the assembler code template, a list of assembler code
   templates, or C code to generate the assembler code template.  
     Templates starting with * contain straight code to be run.  
     If the assembler code template starts with a @ it is a newline-separated
     list of assembler code templates, one for each alternative.  
                 The usual action will end with a return.
                 If there is neither break or return at the end, this is
                 assumed to be intentional; this allows to have multiple
                 consecutive alternatives share some code.  

References data::code_number, error_with_line(), data::lineno, message_with_line(), data::n_alternatives, data::output_format, and data::template_code.

static void scan_operands ( struct data d,
rtx  part,
int  this_address_p,
int  this_strict_low 
   Stores the operand data into `d->operand[i]'.

   THIS_ADDRESS_P is nonzero if the containing rtx was an ADDRESS.
   THIS_STRICT_LOW is nonzero if the containing rtx was a STRICT_LOW_PART.  
static const char* strip_whitespace ( const char *  )
static const char* strip_whitespace ( )
   Remove whitespace in `s' by moving up characters until the end.
   Return a new string.  
static void validate_insn_alternatives ( struct data )
static void validate_insn_alternatives ( )
   Check insn D for consistency in number of constraint alternatives.  
     Make sure all the operands have the same number of alternatives
     in their constraints.  Let N be that number.  
     Record the insn's overall number of alternatives.  
static void validate_insn_operands ( struct data )
static void validate_insn_operands ( )
   Verify that there are no gaps in operand numbers for INSNs.  

References data::code_number, data::index_number, next_code_number, and next_index_number.

static void validate_optab_operands ( )
     Miscellaneous tests.  

Variable Documentation

struct constraint_data* constraints_by_letter_table[1<< CHAR_BIT]
struct data* idata = &nothing
   This variable points to the first link in the insn chain.  
struct data** idata_end = &nothing.next
   This variable points to the end of the insn chain.  This is where
   everything relevant from the machien description is appended to.  
const char indep_constraints[] = ",=+%*?!#&<>EFVXgimnoprs"
   This is a complete list (unlike the one in genpreds.c) of constraint
   letters and modifiers with machine-independent meaning.  The only
   omission is digits, as these are handled specially.  

Referenced by n_occurrences().

int next_code_number
   insns in the machine description are assigned sequential code numbers
   that are used by insn-recog.c (produced by genrecog) to communicate
   to insn-output.c (produced by this program).  

Referenced by validate_insn_operands().

int next_index_number
   This counts all definitions in the md file,
   for the sake of error messages.  

Referenced by validate_insn_operands().

int next_operand_number = 1
   This counts all operands used in the md file.  The first is null.  
struct data nothing
   A dummy insn, for CODE_FOR_nothing.  

Referenced by gen_split().

struct operand_data null_operand
Initial value:
0, 0, "", "", VOIDmode, 0, 0, 0, 0, 0
   Begin with a null operand at index 0.  
struct operand_data* odata = &null_operand
struct operand_data** odata_end = &null_operand.next