And I want to say that tree/gimple/rtl are compiler's data(or state),
not compiler's text(or logic), the most important thing about them is
how to access their fields.
Given the above assumption, now I doubt the necessity of accessor
macros or C++ getter/setter method.
Is "tree->code" more direct and efficient than "TREE_CODE(tree)" or
"tree->get_code()" ?
On a side note, the dragonegg plugin (which is written in C++) defines
/// isa - Return true if the given tree has the specified code.
template<enum tree_code code> bool isa(const_tree t) {
return TREE_CODE(t) == code;
}
which lets you write things like
if (isa<INTEGRAL_TYPE>(t)) ...
and so on.
While this is a bit more compact than "if (TREE_CODE(t) == INTEGRAL_TYPE",
the main advantage to my mind is that it is a standard C++ idiom that should
be natural for many C++ programmers.
Ciao, Duncan.