Confusing GIMPLE statement and operand traversal documentation
Documentation for GIMPLE statement and operand traversals contains type mismatches and unclear return value mappings.
Johann Lay points out discrepancies in the GCC documentation for GIMPLE statement and operand traversals. Specifically, the function signatures in the online documentation do not match those defined in gimple-walk.h, and the return types and their mappings between different traversal functions are unclear, causing confusion for developers.
- proposer
Identifies several inconsistencies between the GCC online documentation and the `gimple-walk.h` header file regarding GIMPLE traversal function signatures and return types.
“has: tree walk_gimple_op (gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi) but according to gimple-walk.h, the 1st arg is of type gimple*.”
- other
Suggests that the documentation may be outdated due to a specific commit that renamed structures and removed types.
“Looks like the documentation was not updated after r6-3402-g355fe0884b8097 which changed the name of the struct from gimple_statement_base to gimple and then removed t”
In Details
This discussion concerns the documentation for GIMPLE's traversal functions, specifically walk_gimple_op and walk_gimple_seq. The issue lies in discrepancies between the documented function signatures (types of arguments and return values) and the actual definitions in gimple-walk.h, potentially due to recent code changes affecting GIMPLE data structures.
- GIMPLE
- An intermediate representation used by GCC. It is a three-address code form designed to be easier to optimize than the earlier GENERIC representation.
- Statement and operand traversals
- Refers to functions within GCC that systematically visit and process GIMPLE statements and their constituent operands, typically for optimization or analysis passes.
- tree
- In GCC, 'tree' is a generic term for the internal data structure used to represent code during compilation, encompassing both GENERIC and GIMPLE forms.
- gimple*
- A pointer to a GIMPLE structure, representing a GIMPLE statement or related data.
- walk_tree_fn
- A callback function type used in GCC's tree traversal utilities. It is invoked for each node visited during a traversal.
- gimple-walk.h
- A header file within the GCC source code that defines functions and data structures for traversing GIMPLE code.