From 3b3b1bf054263d450caa281efa9a77036b087717 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 11 Apr 2016 16:35:19 -0400 Subject: [PATCH 63/91] FIXME: automatically fake locals etc --- gcc/rtl/rtl-frontend.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gcc/rtl/rtl-frontend.c b/gcc/rtl/rtl-frontend.c index 4faf949..bf0a7ab 100644 --- a/gcc/rtl/rtl-frontend.c +++ b/gcc/rtl/rtl-frontend.c @@ -333,7 +333,7 @@ class function_reader : public rtx_reader int m_max_bb_idx; rtx_insn *m_first_insn; deferred_locations m_deferred_locations; - auto_vec m_params; + auto_vec m_fake_scope; }; static const char * @@ -430,13 +430,24 @@ function_reader::parse_mem_expr (const char *desc) return DECL_RESULT (fndecl); } + /* FIXME: use a hash rather than linear search. */ int i; tree t; - FOR_EACH_VEC_ELT (m_params, i, t) + FOR_EACH_VEC_ELT (m_fake_scope, i, t) if (0 == strcmp (desc, IDENTIFIER_POINTER (DECL_NAME (t)))) return t; - return NULL_TREE; + /* Not found? Create it. + This allows mimicing of real data but avoids having to specify + e.g. names of locals, params etc. + Though this way we don't know if we have a PARM_DECL vs a VAR_DECL, + and we don't know the types. Fake it by making everything be + a VAR_DECL of "int" type. */ + t = build_decl (UNKNOWN_LOCATION, VAR_DECL, + get_identifier (desc), + integer_type_node); + m_fake_scope.safe_push (t); + return t; } void @@ -567,14 +578,6 @@ function_reader::create_function () allocate_struct_function (fndecl, false); /* This sets cfun. */ - /* What about params? */ - m_params.safe_push (build_decl (UNKNOWN_LOCATION, PARM_DECL, - get_identifier ("i"), int_type)); - m_params.safe_push (build_decl (UNKNOWN_LOCATION, PARM_DECL, - get_identifier ("j"), int_type)); - m_params.safe_push (build_decl (UNKNOWN_LOCATION, PARM_DECL, - get_identifier ("k"), int_type)); - //struct function *fn = ; // DECL_STRUCT_FUNCTION (node->decl); //push_cfun (fn); -- 1.8.5.3