summaryrefslogtreecommitdiff
path: root/gcc/debug.h
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2018-07-31 21:19:13 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2018-07-31 21:19:13 +0000
commitfa6fd7b7afece6e0cfe197c9419ea3346d3c60b2 (patch)
treef227c6802b9656b6bc7d3b3f090e9b9d78f1bb4b /gcc/debug.h
parente540ccc0e281a6e30c14e55b39334db27e55b3bf (diff)
Introduce instance discriminators
With -gnateS, the Ada compiler sets itself up to output discriminators for different instantiations of generics, but the middle and back ends have lacked support for that. This patch introduces the missing bits, translating the GNAT-internal representation of the per-file instance map to an instance_table that maps decls to instance discriminators. From: Alexandre Oliva <oliva@adacore.com>, Olivier Hainque <hainque@adacore.com> for gcc/ChangeLog * debug.h (decl_to_instance_map_t): New type. (decl_to_instance_map): Declare. (maybe_create_decl_to_instance_map): New inline function. * final.c (bb_discriminator, last_bb_discriminator): New statics, to track basic block discriminators. (final_start_function_1): Initialize them. (final_scan_insn_1): On NOTE_INSN_BASIC_BLOCK, track bb_discriminator. (decl_to_instance_map): New variable. (map_decl_to_instance, maybe_set_discriminator): New functions. (notice_source_line): Set discriminator. for gcc/ada/ChangeLog * trans.c: Include debug.h. (file_map): New static variable. (gigi): Set it. Create decl_to_instance_map when needed. (Subprogram_Body_to_gnu): Pass gnu_subprog_decl to... (Sloc_to_locus): ... this. Add decl parm, map it to instance. * gigi.h (Sloc_to_locus): Adjust declaration. for gcc/testsuite/ChangeLog * gnat.dg/dinst.adb: New. * gnat.dg/dinst_pkg.ads, gnat.dg/dinst_pkg.adb: New. Co-Authored-By: Olivier Hainque <hainque@adacore.com> From-SVN: r263182
Diffstat (limited to 'gcc/debug.h')
-rw-r--r--gcc/debug.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/debug.h b/gcc/debug.h
index 126e56e8c8d..3f78d060225 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -256,4 +256,19 @@ extern bool dwarf2out_default_as_locview_support (void);
extern const struct gcc_debug_hooks *
dump_go_spec_init (const char *, const struct gcc_debug_hooks *);
+/* Instance discriminator mapping table. See final.c. */
+typedef hash_map<const_tree, int> decl_to_instance_map_t;
+extern decl_to_instance_map_t *decl_to_instance_map;
+
+/* Allocate decl_to_instance_map with COUNT slots to begin wtih, if it
+ * hasn't been allocated yet. */
+
+static inline decl_to_instance_map_t *
+maybe_create_decl_to_instance_map (int count = 13)
+{
+ if (!decl_to_instance_map)
+ decl_to_instance_map = new decl_to_instance_map_t (count);
+ return decl_to_instance_map;
+}
+
#endif /* !GCC_DEBUG_H */