GCC Middle and Back End API Reference
parser Class Reference
Collaboration diagram for parser:

Public Member Functions

 parser (cpp_reader *, bool gimple)
 

Data Fields

vec< simplify * > simplifiers
 
vec< predicate_id * > user_predicates
 
bool parsing_match_operand
 

Private Member Functions

const cpp_tokennext ()
 
const cpp_tokenpeek (unsigned=1)
 
const cpp_tokenpeek_ident (const char *=NULL, unsigned=1)
 
const cpp_tokenexpect (enum cpp_ttype)
 
const cpp_tokeneat_token (enum cpp_ttype)
 
const charget_string ()
 
const charget_ident ()
 
const cpp_tokeneat_ident (const char *)
 
const charget_number ()
 
unsigned get_internal_capture_id ()
 
id_baseparse_operation (unsigned char &)
 
operandparse_capture (operand *, bool)
 
operandparse_expr ()
 
c_exprparse_c_expr (cpp_ttype)
 
operandparse_op ()
 
void record_operlist (location_t, user_id *)
 
void parse_pattern ()
 
operandparse_result (operand *, predicate_id *)
 
void push_simplify (simplify::simplify_kind, vec< simplify * > &, operand *, operand *)
 
void parse_simplify (simplify::simplify_kind, vec< simplify * > &, predicate_id *, operand *)
 
void parse_for (location_t)
 
void parse_if (location_t)
 
void parse_predicates (location_t)
 
void parse_operator_list (location_t)
 
void finish_match_operand (operand *)
 

Private Attributes

cpp_readerr
 
bool gimple
 
vec< c_expr * > active_ifs
 
vec< vec< user_id * > > active_fors
 
hash_set< user_id * > * oper_lists_set
 
vec< user_id * > oper_lists
 
cid_map_tcapture_ids
 
unsigned last_id
 

Detailed Description

AST parsing.   

Constructor & Destructor Documentation

◆ parser()

parser::parser ( cpp_reader * r_,
bool gimple_ )
Main entry of the parser.  Repeatedly parse outer control structures.   

References c_expr::capture_ids, ggc_alloc(), last_id, NULL, c_expr::r, and vNULL.

Member Function Documentation

◆ eat_ident()

const cpp_token * parser::eat_ident ( const char * s)
private
Eat an identifier token with value S from R.   

References fatal_at(), ggc_alloc(), and token().

◆ eat_token()

const cpp_token * parser::eat_token ( enum cpp_ttype tk)
private
Consume the next token from R and assert it is of type TK.   

References ggc_alloc().

◆ expect()

const cpp_token * parser::expect ( enum cpp_ttype tk)
private
Read the next token from R and assert it is of type TK.   

References fatal_at(), ggc_alloc(), and token().

◆ finish_match_operand()

void parser::finish_match_operand ( operand * op)
private

◆ get_ident()

const char * parser::get_ident ( )
private
Read the next token from R and assert it is of type CPP_NAME and
return its value.   

References ggc_alloc().

◆ get_internal_capture_id()

unsigned parser::get_internal_capture_id ( )
private

◆ get_number()

const char * parser::get_number ( )
private
Read the next token from R and assert it is of type CPP_NUMBER and
return its value.   

References ggc_alloc().

◆ get_string()

const char * parser::get_string ( )
private
Read the next token from R and assert it is of type CPP_STRING and
return its value.   

References ggc_alloc().

◆ next()

const cpp_token * parser::next ( )
private
Lexing helpers.   
Read the next non-whitespace token from R.   

References ggc_alloc(), c_expr::r, and token().

◆ parse_c_expr()

c_expr * parser::parse_c_expr ( cpp_ttype start)
private
Lex native C code delimited by START recording the preprocessing tokens
for later processing.
  c_expr = ('{'|'(') <pp token>... ('}'|')')   

References c_expr::c_expr(), c_expr::capture_ids, c_expr::code, end(), fatal_at(), gcc_unreachable, get_operator(), ggc_alloc(), c_expr::nr_stmts, c_expr::r, token(), and vNULL.

◆ parse_capture()

class operand * parser::parse_capture ( operand * op,
bool require_existing )
private

◆ parse_expr()

class operand * parser::parse_expr ( )
private

◆ parse_for()

void parser::parse_for ( location_t )
private
Parsing of the outer control structures.   
Parse a for expression
 for = '(' 'for' <subst>... <pattern> ')'
 subst = <ident> '(' <ident>... ')'   

References fatal_at(), get_operator(), ggc_alloc(), id_base::hashval, i, user_id::is_oper_list, id_base::nargs, NULL, operators, user_id::substitutes, token(), vNULL, and warning_at().

◆ parse_if()

void parser::parse_if ( location_t )
private
Parse an outer if expression.
 if = '(' 'if' '(' <c-expr> ')' <pattern> ')'   

References fatal_at(), and ggc_alloc().

◆ parse_op()

class operand * parser::parse_op ( )
private
Parse an operand which is either an expression, a predicate or
a standalone capture.
  op = predicate | expr | c_expr | capture   

References expr, fatal_at(), get_operator(), ggc_alloc(), and NULL.

◆ parse_operation()

id_base * parser::parse_operation ( unsigned char & opt_grp)
private
Parse the operator ID, special-casing convert?, convert1? and
convert2?   

References fatal_at(), free(), get_operator(), ggc_alloc(), user_id::is_oper_list, and NULL.

◆ parse_operator_list()

void parser::parse_operator_list ( location_t )
private
Parse an identifier associated with a list of operators.
 oprs = '(' 'define_operator_list' <ident> <ident>... ')'   

References fatal_at(), get_operator(), ggc_alloc(), id_base::hashval, id_base::nargs, operators, and user_id::substitutes.

◆ parse_pattern()

void parser::parse_pattern ( )
private
Parse outer control structures.
 pattern = <preds>|<for>|<if>|<simplify>|<match>   

References add_predicate(), expr::append_op(), c_expr::capture_ids, expr, fatal_at(), get_operator(), ggc_alloc(), simplify::MATCH, predicate_id::matchers, id_base::nargs, NULL, expr::ops, and simplify::SIMPLIFY.

◆ parse_predicates()

void parser::parse_predicates ( location_t )
private
Parse a list of predefined predicate identifiers.
 preds = '(' 'define_predicates' <ident>... ')'   

References add_predicate(), and ggc_alloc().

◆ parse_result()

operand * parser::parse_result ( operand * result,
predicate_id * matcher )
private
Parse
  <result-op> = <op> | <if> | <with>
  <if> = '(' 'if' '(' <c-expr> ')' <result-op> ')'
  <with> = '(' 'with' '{' <c-expr> '}' <result-op> ')'
and return it.   

References fatal_at(), and ggc_alloc().

◆ parse_simplify()

void parser::parse_simplify ( simplify::simplify_kind kind,
vec< simplify * > & simplifiers,
predicate_id * matcher,
operand * result )
private
Parse
  simplify = 'simplify' <expr> <result-op>
or
  match = 'match' <ident> <expr> [<result-op>]
and fill SIMPLIFIERS with the results.   

References c_expr::capture_ids, fatal_at(), ggc_alloc(), i, operand::location, NULL, operand::OP_CAPTURE, operand::OP_EXPR, operand::type, and vNULL.

◆ peek()

const cpp_token * parser::peek ( unsigned num = 1)
private
Peek at the next non-whitespace token from R.   

References fatal_at(), ggc_alloc(), i, c_expr::r, and token().

◆ peek_ident()

const cpp_token * parser::peek_ident ( const char * id = NULL,
unsigned num = 1 )
private
Peek at the next identifier token (or return NULL if the next
token is not an identifier or equal to ID if supplied).   

References ggc_alloc(), and token().

◆ push_simplify()

void parser::push_simplify ( simplify::simplify_kind kind,
vec< simplify * > & simplifiers,
operand * match,
operand * result )
private
Create a new simplify from the current parsing state and MATCH,
MATCH_LOC, RESULT and RESULT_LOC and push it to SIMPLIFIERS.   

References c_expr::capture_ids, and last_id.

◆ record_operlist()

void parser::record_operlist ( location_t loc,
user_id * p )
private
Record an operator-list use for transparent for handling.   

References fatal_at(), and user_id::substitutes.

Field Documentation

◆ active_fors

vec<vec<user_id *> > parser::active_fors
private

◆ active_ifs

vec<c_expr *> parser::active_ifs
private

◆ capture_ids

cid_map_t* parser::capture_ids
private

◆ gimple

bool parser::gimple
private

◆ last_id

unsigned parser::last_id
private

◆ oper_lists

vec<user_id *> parser::oper_lists
private

◆ oper_lists_set

hash_set<user_id *>* parser::oper_lists_set
private

◆ parsing_match_operand

bool parser::parsing_match_operand

◆ r

cpp_reader* parser::r
private

◆ simplifiers

vec<simplify *> parser::simplifiers

Referenced by main().

◆ user_predicates

vec<predicate_id *> parser::user_predicates

Referenced by main().


The documentation for this class was generated from the following file: