diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-07-21 12:07:51 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-08-25 12:40:25 +0100 |
commit | 4fe7b96c2726322191c0eadd2c1c712afb3d0299 (patch) | |
tree | 117f357a9849069359e7bf8d0ffe4ce56bdd3d57 /gcc/coverage.cc | |
parent | 8a9b94d8c3ac6c691fa49585756c0df234602d8b (diff) | |
download | gcc-4fe7b96c2726322191c0eadd2c1c712afb3d0299.zip gcc-4fe7b96c2726322191c0eadd2c1c712afb3d0299.tar.gz gcc-4fe7b96c2726322191c0eadd2c1c712afb3d0299.tar.bz2 |
Const functions need to be marked as DECL_DECLARED_CONSTEXPR_P
This signifys in the GCC generic that this is a constant function and
should be foldable in the constexpr evaluation. This also ports over the
correct eval_store_expression which updates the context tables.
CPP consteval seems pretty powerful but overall the algorithm is fairly
simple at least for simple types. When we encounter a CALL_EXPR we must
"bind" the arguments. So when we encourter a PARAM_DECL the associated
argument for this parameter is bound to this parameter in a map of
map<tree, tree> using their pointer as the key to value. So when folding
a function body every usage of the parameter decl is then updated in the
context with the apropriate value fomr the context. When we hit
assignment operations a similar context store occurs for VAR_DECLS.
While walking the tree We finally hit the RESULT_DECL with the folded
result. The complex pieces remaining are aggregate, record and union types
so that we have zero allocation required to find the result. We also need
to support walking conditionals and loop expressions which require porting
a few more functions and using the jump_target tree.
Diffstat (limited to 'gcc/coverage.cc')
0 files changed, 0 insertions, 0 deletions