GCC Middle and Back End API Reference
read-rtl-function.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "tree.h"
#include "diagnostic.h"
#include "read-md.h"
#include "rtl.h"
#include "cfghooks.h"
#include "stringpool.h"
#include "function.h"
#include "tree-cfg.h"
#include "cfg.h"
#include "basic-block.h"
#include "cfgrtl.h"
#include "memmodel.h"
#include "emit-rtl.h"
#include "cgraph.h"
#include "tree-pass.h"
#include "toplev.h"
#include "varasm.h"
#include "read-rtl-function.h"
#include "selftest.h"
#include "selftest-rtl.h"
#include "regs.h"
#include "function-abi.h"
#include "cfg-flags.def"
Include dependency graph for read-rtl-function.cc:

Data Structures

class  deferred_edge
 
class  function_reader
 
struct  function_reader::uid_hash
 
class  fixup
 
class  operand_fixup
 
class  fixup_insn_uid
 
class  fixup_note_insn_basic_block
 
class  fixup_expr
 

Macros

#define DEF_EDGE_FLAG(NAME, IDX)
 

Functions

static const char * get_operand_name (rtx insn, int operand_idx)
 
static void strip_trailing_whitespace (char *desc)
 
static int parse_note_insn_name (const char *string)
 
static int lookup_reg_by_dump_name (const char *name)
 
static tree find_param_by_name (tree fndecl, const char *name)
 
static int parse_edge_flag_token (const char *tok)
 
static int parse_edge_flags (char *str)
 
static rtx lookup_global_register (int regno)
 
static void ensure_regno (int regno)
 
static rtx consolidate_reg (rtx x)
 
bool read_rtl_function_body (const char *path)
 
bool read_rtl_function_body_from_file_range (location_t start_loc, location_t end_loc)
 

Macro Definition Documentation

◆ DEF_EDGE_FLAG

#define DEF_EDGE_FLAG ( NAME,
IDX )
Value:
do { \
if (strcmp (tok, #NAME) == 0) \
return EDGE_##NAME; \
} while (0);
@ NAME
Definition tree-ssa-pre.cc:242

Function Documentation

◆ consolidate_reg()

static rtx consolidate_reg ( rtx x)
static
Helper function for consolidate_singletons, for handling REG instances.
Given REG instance X of some regno, return the singleton rtx for that
regno, if it exists, or X.   

References ensure_regno(), gcc_assert, GET_CODE, GET_MODE, lookup_global_register(), NULL, REGNO, and regno_reg_rtx.

Referenced by function_reader::consolidate_singletons().

◆ ensure_regno()

static void ensure_regno ( int regno)
static
Ensure that the backend can cope with a REG with regno REGNO.
Normally REG instances are created by gen_reg_rtx which updates
regno_reg_rtx, growing it as necessary.
The REG instances created from the dumpfile weren't created this
way, so we need to manually update regno_reg_rtx.   

References crtl, emit(), gcc_assert, and reg_rtx_no.

Referenced by consolidate_reg().

◆ find_param_by_name()

static tree find_param_by_name ( tree fndecl,
const char * name )
static
Look within the params of FNDECL for a param named NAME.
Return NULL_TREE if one isn't found.   

References DECL_ARGUMENTS, DECL_NAME, id_equal(), NULL_TREE, and TREE_CHAIN.

Referenced by function_reader::parse_mem_expr(), and function_reader::parse_param().

◆ get_operand_name()

static const char * get_operand_name ( rtx insn,
int operand_idx )
static
Return a textual description of the operand of INSN with
index OPERAND_IDX.   

References gcc_assert, is_a(), and NULL.

Referenced by fixup_insn_uid::apply().

◆ lookup_global_register()

◆ lookup_reg_by_dump_name()

static int lookup_reg_by_dump_name ( const char * name)
static

◆ parse_edge_flag_token()

static int parse_edge_flag_token ( const char * tok)
static
Subroutine of parse_edge_flags.
Parse TOK, a token such as "FALLTHRU", converting to the flag value.
Issue an error if the token is unrecognized.   
Flags on basic blocks and edges.
   Copyright (C) 2012-2024 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 file defines flags that may appear on basic blocks or on
edges.  Source files define DEF_BASIC_BLOCK_FLAG or DEF_EDGE_FLAG
appropriately before including this file.   
Masks for edge.flags.

The format of this file is: DEF_EDGE_FLAG(NAME, IDX, STRING).
NAME is the name of the edge flag.  A flag EDGE_#NAME will be
created and the name is used in dump_edge_info.
IDX is a sequence number that is used to determine the value
of the flag, which is 1 << IDX).   
'Straight line' flow.  In GIMPLE and in cfglayout mode, all normal
edges are fallthru edges.  In cfgrtl mode, this flag really means
that control flow falls through to the next basic block in the line.   
Strange flow, like a computed jump or exception handling.  Usually
this means that the edge cannot be split.   
Edge out of a basic block that ends with a CALL_INSN with abnormal
exit, like an exception or a non-local goto.
ABNORMAL_CALL edges also have ABNORMAL set.
This flag is only used for the RTL CFG.   
Exception edge.  Exception handling edges represent possible control
transfers from a trapping instruction to an exception handler.
EH edges also have ABNORMAL set for the RTL CFG.   
Never merge blocks via this edge.  This is used for exception handling,
to prevent merging away edges to the post-landing-pad basic block.
This flag is only used for the RTL CFG.   
Not a real edge.  This is used to connect parts of the CFG that do
not halt, such as infinite loops and noreturn functions, to the
EXIT_BLOCK, so that traversing of the reverse CFG is possible.   
A back edge, marked in a depth-first search of the CFG.  Back edges
are hints that this edge may be part of a loop in the CFG.   
Edge in a part of the CFG that is an irreducible loop.   
Edge taken when controlling predicate is nonzero.
This is only used for the GIMPLE CFG.   
Edge taken when controlling predicate is zero.
This is only used for the GIMPLE CFG.   
Edge is executable.  This is only used in GIMPLE SSA-CCP and VRP.
This is only used for the GIMPLE CFG.   
Edge crosses between hot and cold sections, when we do partitioning.
This flag is only used for the RTL CFG.   
Edge from a sibcall CALL_INSN to exit.
SIBCALL edges also have ABNORMAL set.
This flag is only used for the RTL CFG.   
Candidate for straight line flow.  Only used in bb-reorder.cc.
This flag is only used for the RTL CFG.   
Exit of a loop.  This is only used in ifcvt.cc.
This flag is only used for the RTL CFG.   
Uninstrumented edge out of a GIMPLE_TRANSACTION statement.   
Abort (over) edge out of a GIMPLE_TRANSACTION statement.   
An edge we should ignore.  It should be entirely local to
passes.  ie, it is never set on any edge upon the completion
of any pass.   

References error().

Referenced by parse_edge_flags().

◆ parse_edge_flags()

static int parse_edge_flags ( char * str)
static
Subroutine of function_reader::parse_edge.
Parse STR and convert to a flag value (or issue an error).
The parser uses strtok and hence modifiers STR in-place.   

References NULL, and parse_edge_flag_token().

Referenced by function_reader::parse_edge().

◆ parse_note_insn_name()

static int parse_note_insn_name ( const char * string)
static
Return the numeric value n for GET_NOTE_INSN_NAME (n) for STRING,
or fail if STRING isn't recognized.   

References fatal_with_file_and_line(), GET_NOTE_INSN_NAME, i, and NOTE_INSN_MAX.

Referenced by function_reader::read_rtx_operand_inL().

◆ read_rtl_function_body()

bool read_rtl_function_body ( const char * path)
Run the RTL dump parser, parsing a dump located at PATH.
Return true iff the file was successfully parsed.   

References crtl, default_function_abi, init_emit(), init_varasm_status(), initialize_rtl(), and md_reader::read_file().

◆ read_rtl_function_body_from_file_range()

bool read_rtl_function_body_from_file_range ( location_t start_loc,
location_t end_loc )
Run the RTL dump parser on the range of lines between START_LOC and
END_LOC (including those lines).   

References function_abi::base_abi(), cfun, crtl, error_at(), expand_location(), fndecl_abi(), init_emit(), init_varasm_status(), initialize_rtl(), and md_reader::read_file_fragment().

◆ strip_trailing_whitespace()

static void strip_trailing_whitespace ( char * desc)
static
Strip trailing whitespace from DESC.   

Referenced by function_reader::read_rtx_operand_r().