Next: , Up: Match and Simplify


25.1 GIMPLE API

— GIMPLE function: tree gimple_simplify (enum tree_code, tree, tree, gimple_seq *, tree (*)(tree))
— GIMPLE function: tree gimple_simplify (enum tree_code, tree, tree, tree, gimple_seq *, tree (*)(tree))
— GIMPLE function: tree gimple_simplify (enum tree_code, tree, tree, tree, tree, gimple_seq *, tree (*)(tree))
— GIMPLE function: tree gimple_simplify (enum built_in_function, tree, tree, gimple_seq *, tree (*)(tree))
— GIMPLE function: tree gimple_simplify (enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree))
— GIMPLE function: tree gimple_simplify (enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree))

The main GIMPLE API entry to the expression simplifications mimicing that of the GENERIC fold_{unary,binary,ternary} functions.

thus providing n-ary overloads for operation or function. The additional arguments are a gimple_seq where built statements are inserted on (if NULL then simplifications requiring new statements are not performed) and a valueization hook that can be used to tie simplifications to a SSA lattice.

In addition to those APIs fold_stmt is overloaded with a valueization hook:

— bool: fold_stmt (gimple_stmt_iterator *, tree (*)(tree));

Ontop of these a fold_buildN-like API for GIMPLE is introduced:

— GIMPLE function: tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree (*valueize) (tree) = NULL);
— GIMPLE function: tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree (*valueize) (tree) = NULL);
— GIMPLE function: tree gimple_build (gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree, tree (*valueize) (tree) = NULL);
— GIMPLE function: tree gimple_build (gimple_seq *, location_t, enum built_in_function, tree, tree, tree (*valueize) (tree) = NULL);
— GIMPLE function: tree gimple_build (gimple_seq *, location_t, enum built_in_function, tree, tree, tree, tree (*valueize) (tree) = NULL);
— GIMPLE function: tree gimple_convert (gimple_seq *, location_t, tree, tree);

which is supposed to replace force_gimple_operand (fold_buildN (...), ...) and calls to fold_convert. Overloads without the location_t argument exist. Built statements are inserted on the provided sequence and simplification is performed using the optional valueization hook.