|
GCC Middle and Back End API Reference
|

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_token * | next () |
| const cpp_token * | peek (unsigned=1) |
| const cpp_token * | peek_ident (const char *=NULL, unsigned=1) |
| const cpp_token * | expect (enum cpp_ttype) |
| const cpp_token * | eat_token (enum cpp_ttype) |
| const char * | get_string () |
| const char * | get_ident () |
| const cpp_token * | eat_ident (const char *) |
| const char * | get_number () |
| unsigned | get_internal_capture_id () |
| id_base * | parse_operation (unsigned char &) |
| operand * | parse_capture (operand *, bool) |
| operand * | parse_expr () |
| c_expr * | parse_c_expr (cpp_ttype) |
| void | parse_c_with_ids (vec< c_code_id * > *) |
| operand * | parse_op () |
| void | record_operlist (location_t, user_id *) |
| void | parse_pattern () |
| operand * | parse_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_reader * | r |
| 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_t * | capture_ids |
| unsigned | last_id |
AST parsing.
| parser::parser | ( | cpp_reader * | r_, |
| bool | gimple_ ) |
Main entry of the parser. Repeatedly parse outer control structures.
parser's ctor.
References active_fors, active_ifs, capture_ids, gimple, last_id, next(), NULL, oper_lists, oper_lists_set, parse_pattern(), parsing_match_operand, r, simplifiers, user_predicates, and vNULL.
Referenced by text_art::styled_string::styled_string().
|
private |
Eat an identifier token with value S from R.
References fatal_at(), get_ident(), and peek().
Referenced by parse_result().
|
private |
Consume the next token from R and assert it is of type TK.
References expect().
Referenced by parse_c_expr(), parse_c_with_ids(), parse_capture(), parse_expr(), parse_for(), parse_op(), parse_operation(), parse_pattern(), and parse_result().
|
private |
Read the next token from R and assert it is of type TK.
References fatal_at(), and next().
Referenced by eat_token(), get_ident(), get_number(), get_string(), parse_c_with_ids(), and parse_for().
|
private |
Finish up OP which is a match operand.
References capture::capture(), capture_ids, hash_map< KeyId, Value, Traits >::elements(), fatal_at(), get_internal_capture_id(), i, operand::location, NULL, walk_captures(), capture::what, and capture::where.
Referenced by parse_simplify().
|
private |
Read the next token from R and assert it is of type CPP_NAME and return its value.
References expect().
Referenced by eat_ident(), parse_c_with_ids(), parse_capture(), parse_expr(), parse_for(), parse_op(), parse_operation(), parse_operator_list(), parse_pattern(), and parse_predicates().
|
private |
Return a capture ID that can be used internally.
References capture_ids, hash_map< KeyId, Value, Traits >::elements(), fatal(), and hash_map< KeyId, Value, Traits >::get_or_insert().
Referenced by finish_match_operand(), and parse_expr().
|
private |
Read the next token from R and assert it is of type CPP_NUMBER and return its value.
References expect().
Referenced by parse_capture().
|
private |
Read the next token from R and assert it is of type CPP_STRING and return its value.
References expect().
|
private |
Lexing helpers.
Read the next non-whitespace token from R.
References r.
Referenced by expect(), parse_c_expr(), and parser().
|
private |
Lex native C code delimited by START recording the preprocessing tokens
for later processing.
c_expr = ('{'|'(') <pp token>... ('}'|')')
References c_expr::c_expr(), capture_ids, c_expr::code, eat_token(), end(), fatal_at(), gcc_unreachable, get_operator(), next(), c_expr::nr_stmts, r, and vNULL.
Referenced by parse_if(), parse_op(), and parse_result().
References c_code_id::c_code_id(), dyn_cast(), eat_token(), expect(), fatal_at(), gcc_unreachable, get_ident(), get_operator(), id_base::hashval, i, c_expr::ids, is_a(), c_code_id::m_cmp, c_code_id::m_code_only, c_code_id::m_fn_only, NULL, null_id, operators, peek(), peek_ident(), and c_code_id::possible_values.
Referenced by parse_result().
Parse a capture. capture = '@'<number>
References capture::capture(), capture_ids, eat_token(), hash_map< KeyId, Value, Traits >::elements(), fatal_at(), get_ident(), get_number(), hash_map< KeyId, Value, Traits >::get_or_insert(), NULL, parsing_match_operand, and peek().
Referenced by parse_expr(), parse_op(), and parse_pattern().
|
private |
Parse an expression
expr = '(' <operation>[capture][flag][type] <operand>... ')'
References capture::capture(), commutative_op(), eat_token(), expr::expr, fatal_at(), get_ident(), get_internal_capture_id(), NULL, parse_capture(), parse_op(), parse_operation(), parsing_match_operand, and peek().
Referenced by parse_op(), and parse_result().
|
private |
Parsing of the outer control structures.
Parse a for expression
for = '(' 'for' <subst>... <pattern> ')'
subst = <ident> '(' <ident>... ')'
References active_fors, dyn_cast(), eat_token(), expect(), fatal_at(), get_ident(), get_operator(), id_base::hashval, i, user_id::is_oper_list, id_base::nargs, NULL, operators, parse_pattern(), peek(), peek_ident(), user_id::substitutes, user_id::user_id(), vNULL, and warning_at().
Referenced by parse_pattern().
|
private |
Parse an outer if expression.
if = '(' 'if' '(' <c-expr> ')' <pattern> ')'
References active_ifs, fatal_at(), parse_c_expr(), parse_pattern(), and peek().
Referenced by parse_pattern().
|
private |
Parse an operand which is either an expression, a predicate or a standalone capture. op = predicate | expr | c_expr | capture
References dyn_cast(), eat_token(), expr::expr, fatal_at(), get_ident(), get_operator(), NULL, parse_c_expr(), parse_capture(), parse_expr(), parsing_match_operand, peek(), and predicate::predicate().
Referenced by parse_expr(), parse_result(), and parse_simplify().
|
private |
Parse the operator ID, special-casing convert?, convert1? and convert2?
References active_fors, dyn_cast(), eat_token(), fatal_at(), free(), get_ident(), get_operator(), user_id::is_oper_list, NULL, parsing_match_operand, peek(), and record_operlist().
Referenced by parse_expr().
|
private |
Parse an identifier associated with a list of operators.
oprs = '(' 'define_operator_list' <ident> <ident>... ')'
References dyn_cast(), fatal_at(), get_ident(), get_operator(), id_base::hashval, id_base::nargs, operators, peek(), peek_ident(), user_id::substitutes, and user_id::user_id().
Referenced by parse_pattern().
|
private |
Parse outer control structures. pattern = <preds>|<for>|<if>|<simplify>|<match>
References active_fors, active_ifs, add_predicate(), capture_ids, dyn_cast(), eat_token(), expr::expr, fatal_at(), get_ident(), get_operator(), simplify::MATCH, predicate_id::matchers, id_base::nargs, NULL, parse_capture(), parse_for(), parse_if(), parse_operator_list(), parse_predicates(), parse_simplify(), peek(), simplifiers, simplify::SIMPLIFY, and user_predicates.
Referenced by parse_for(), parse_if(), and parser().
|
private |
Parse a list of predefined predicate identifiers.
preds = '(' 'define_predicates' <ident>... ')'
References add_predicate(), get_ident(), and peek().
Referenced by parse_pattern().
|
private |
Parse
<result-op> = <op> | <if> | <with>
<if> = '(' 'if' '(' <c-expr> ')' <result-op> ')'
<with> = '(' 'with' '{' <c-expr> '}' <result-op> ')'
and return it.
References as_a(), if_expr::cond, eat_ident(), eat_token(), if_expr::falseexpr, fatal_at(), if_expr::if_expr(), with_expr::m_ids, c_expr::nr_stmts, operators, parse_c_expr(), parse_c_with_ids(), parse_expr(), parse_op(), parse_result(), peek(), peek_ident(), with_expr::subexpr, if_expr::trueexpr, with_expr::with, and with_expr::with_expr().
Referenced by parse_result(), and parse_simplify().
|
private |
Parse simplify = 'simplify' <expr> <result-op> or match = 'match' <ident> <expr> [<result-op>] and fill SIMPLIFIERS with the results.
References active_ifs, as_a(), capture_ids, if_expr::cond, fatal_at(), finish_match_operand(), i, if_expr::if_expr(), is_a(), operand::location, NULL, operand::OP_CAPTURE, operand::OP_EXPR, oper_lists, oper_lists_set, parse_op(), parse_result(), parsing_match_operand, peek(), push_simplify(), simplifiers, if_expr::trueexpr, operand::type, and vNULL.
Referenced by parse_pattern().
|
private |
Peek at the next non-whitespace token from R.
References fatal_at(), i, and r.
Referenced by eat_ident(), parse_c_with_ids(), parse_capture(), parse_expr(), parse_for(), parse_if(), parse_op(), parse_operation(), parse_operator_list(), parse_pattern(), parse_predicates(), parse_result(), parse_simplify(), and peek_ident().
|
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 peek().
Referenced by parse_c_with_ids(), parse_for(), parse_operator_list(), and parse_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 active_fors, capture_ids, last_id, oper_lists, and simplifiers.
Referenced by parse_simplify().
|
private |
Record an operator-list use for transparent for handling.
References fatal_at(), oper_lists, oper_lists_set, and user_id::substitutes.
Referenced by parse_operation().
Referenced by parse_for(), parse_operation(), parse_pattern(), parser(), and push_simplify().
Referenced by parse_if(), parse_pattern(), parse_simplify(), and parser().
|
private |
Referenced by finish_match_operand(), get_internal_capture_id(), parse_c_expr(), parse_capture(), parse_pattern(), parse_simplify(), parser(), and push_simplify().
|
private |
Referenced by parser(), and push_simplify().
Referenced by parse_simplify(), parser(), push_simplify(), and record_operlist().
Referenced by parse_simplify(), parser(), and record_operlist().
| bool parser::parsing_match_operand |
Referenced by parse_capture(), parse_expr(), parse_op(), parse_operation(), parse_simplify(), and parser().
|
private |
Referenced by next(), parse_c_expr(), parser(), and peek().
Referenced by main(), parse_pattern(), parse_simplify(), parser(), and push_simplify().
| vec<predicate_id *> parser::user_predicates |
Referenced by main(), parse_pattern(), and parser().