GCC Middle and Back End API Reference
genextract.cc File Reference
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
Include dependency graph for genextract.cc:

Data Structures

struct  extraction
 
struct  code_ptr
 
class  accum_extract
 

Macros

#define UPPER_OFFSET   ('A' - ('z' - 'a' + 1))
 

Typedefs

typedef char * locstr
 

Functions

static void walk_rtx (md_rtx_info *, rtx, class accum_extract *)
 
static void push_pathstr_operand (int operand, bool is_vector, class accum_extract *acc)
 
static void gen_insn (md_rtx_info *info)
 
static void VEC_safe_set_locstr (md_rtx_info *info, vec< locstr > *vp, unsigned int ix, char *str)
 
static char * VEC_char_to_string (const vec< char > &v)
 
static void print_path (const char *path)
 
static void print_header (void)
 
int main (int argc, const char **argv)
 

Variables

static struct extractionextractions
 
static struct code_ptrpeepholes
 

Macro Definition Documentation

◆ UPPER_OFFSET

#define UPPER_OFFSET   ('A' - ('z' - 'a' + 1))

Referenced by print_path(), and push_pathstr_operand().

Typedef Documentation

◆ locstr

typedef char* locstr
Generate code from machine description to extract operands from insn as rtl. Copyright (C) 1987-2025 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/>.
This structure contains all the information needed to describe one set of extractions methods. Each method may be used by more than one pattern if the operands are in the same place. The string for each operand describes that path to the operand and contains `0' through `9' when going into an expression and `a' through `z' then 'A' through to 'Z' when going into a vector. We assume here that only the first operand of an rtl expression is a vector. genrecog.cc makes the same assumption (and uses the same representation) and it is currently true.

Function Documentation

◆ gen_insn()

◆ main()

◆ print_header()

static void print_header ( void )
static

Referenced by main().

◆ print_path()

static void print_path ( const char * path)
static
Given a PATH, representing a path down the instruction's pattern from the root to a certain point, output code to evaluate to the rtx at that point.

References gcc_unreachable, i, path, and UPPER_OFFSET.

Referenced by diagnostic_text_output_format::after_diagnostic(), and main().

◆ push_pathstr_operand()

static void push_pathstr_operand ( int operand,
bool is_vector,
class accum_extract * acc )
static
Convert integer OPERAND into a character - either into [a-zA-Z] for vector operands or [0-9] for integer operands - and push onto the end of the path in ACC.

References accum_extract::pathstr, and UPPER_OFFSET.

Referenced by gen_insn(), and walk_rtx().

◆ VEC_char_to_string()

static char * VEC_char_to_string ( const vec< char > & v)
static
Another helper subroutine of walk_rtx: given a vec<char>, convert it to a NUL-terminated string in malloc memory.

Referenced by walk_rtx().

◆ VEC_safe_set_locstr()

static void VEC_safe_set_locstr ( md_rtx_info * info,
vec< locstr > * vp,
unsigned int ix,
char * str )
static
Helper subroutine of walk_rtx: given a vec<locstr>, an index, and a string, insert the string at the index, which should either already exist and be NULL, or not yet exist within the vector. In the latter case the vector is enlarged as appropriate. INFO describes the containing define_* expression.

References have_error, md_rtx_info::loc, message_at(), and NULL.

Referenced by walk_rtx().

◆ walk_rtx()

Variable Documentation

◆ extractions

struct extraction* extractions
static
All extractions needed for this machine description.

Referenced by gen_insn(), and main().

◆ peepholes

struct code_ptr* peepholes
static
All insn codes for old-style peepholes.

Referenced by main().