-/* See if DECL has an RTL that is indirect via a pseudo-register or a
- memory location and replace it with an indirect reference if so.
- This improves the debugger's ability to display the value. */
-
-void
-adjust_decl_rtl (decl)
- tree decl;
-{
- tree new_type;
-
- /* If this decl is already indirect, don't do anything. This should
- mean that the decl cannot be indirect, but there's no point in
- adding an abort to check that. */
- if (TREE_CODE (decl) != CONST_DECL
- && ! DECL_BY_REF_P (decl)
- && (GET_CODE (DECL_RTL (decl)) == MEM
- && (GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
- || (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG
- && (REGNO (XEXP (DECL_RTL (decl), 0))
- > LAST_VIRTUAL_REGISTER))))
- /* We can't do this if the reference type's mode is not the same
- as the current mode, which means this may not work on mixed 32/64
- bit systems. */
- && (new_type = build_reference_type (TREE_TYPE (decl))) != 0
- && TYPE_MODE (new_type) == GET_MODE (XEXP (DECL_RTL (decl), 0))
- /* If this is a PARM_DECL, we can only do it if DECL_INCOMING_RTL
- is also an indirect and of the same mode and if the object is
- readonly, the latter condition because we don't want to upset the
- handling of CICO_LIST. */
- && (TREE_CODE (decl) != PARM_DECL
- || (GET_CODE (DECL_INCOMING_RTL (decl)) == MEM
- && (TYPE_MODE (new_type)
- == GET_MODE (XEXP (DECL_INCOMING_RTL (decl), 0)))
- && TREE_READONLY (decl))))
- {
- new_type
- = build_qualified_type (new_type,
- (TYPE_QUALS (new_type) | TYPE_QUAL_CONST));
-
- DECL_POINTS_TO_READONLY_P (decl) = TREE_READONLY (decl);
- DECL_BY_REF_P (decl) = 1;
- SET_DECL_RTL (decl, XEXP (DECL_RTL (decl), 0));
- TREE_TYPE (decl) = new_type;
- DECL_MODE (decl) = TYPE_MODE (new_type);
- DECL_ALIGN (decl) = TYPE_ALIGN (new_type);
- DECL_SIZE (decl) = TYPE_SIZE (new_type);
-
- if (TREE_CODE (decl) == PARM_DECL)
- DECL_INCOMING_RTL (decl) = XEXP (DECL_INCOMING_RTL (decl), 0);
-
- /* If DECL_INITIAL was set, it should be updated to show that
- the decl is initialized to the address of that thing.
- Otherwise, just set it to the address of this decl.
- It needs to be set so that GCC does not think the decl is
- unused. */
- DECL_INITIAL (decl)
- = build1 (ADDR_EXPR, new_type,
- DECL_INITIAL (decl) != 0 ? DECL_INITIAL (decl) : decl);
- }
-}
-\f
-/* Record the current code position in GNAT_NODE. */
-
-void
-record_code_position (gnat_node)
- Node_Id gnat_node;
-{
- if (global_bindings_p ())
- {
- /* Make a dummy entry so multiple things at the same location don't
- end up in the same place. */
- add_pending_elaborations (NULL_TREE, NULL_TREE);
- save_gnu_tree (gnat_node, get_elaboration_location (), 1);
- }
- else
- /* Always emit another insn in case marking the last insn
- addressable needs some fixups and also for above reason. */
- save_gnu_tree (gnat_node,
- build (RTL_EXPR, void_type_node, NULL_TREE,
- (tree) emit_note (NOTE_INSN_DELETED)),
- 1);
-}
-
-/* Insert the code for GNAT_NODE at the position saved for that node. */
-
-void
-insert_code_for (gnat_node)
- Node_Id gnat_node;
-{
- if (global_bindings_p ())
- {
- push_pending_elaborations ();
- gnat_to_code (gnat_node);
- Check_Elaboration_Code_Allowed (gnat_node);
- insert_elaboration_list (get_gnu_tree (gnat_node));
- pop_pending_elaborations ();
- }
- else
- {
- rtx insns;
-
- do_pending_stack_adjust ();
- start_sequence ();
- mark_all_temps_used ();
- gnat_to_code (gnat_node);
- do_pending_stack_adjust ();
- insns = get_insns ();
- end_sequence ();
- emit_insn_after (insns, RTL_EXPR_RTL (get_gnu_tree (gnat_node)));
- }
-}
-