summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaximilian Stemmer-Grabow <mail@mxsg.de>2021-05-26 11:02:49 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-12-02 12:57:28 +0100
commit2b067ecb799e4ba6ce72a971ade5039e456e57e4 (patch)
treed1eeb7e792389d588f760ba7d3e3f751097af038
parent0996d33d39672cf87d76fa6be94cd6ae17eb035e (diff)
Allow notes to be added to nodes by the backend for debugging purposes
These notes are stored in the `backend_info_t` struct which contains backend-specific information like register requirements and architecture-specific flags as well as schedule information.
-rw-r--r--ir/be/beinfo.c15
-rw-r--r--ir/be/beinfo.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/ir/be/beinfo.c b/ir/be/beinfo.c
index 8f81e76..be23eba 100644
--- a/ir/be/beinfo.c
+++ b/ir/be/beinfo.c
@@ -117,6 +117,21 @@ int attrs_equal_be_node(const ir_node *node1, const ir_node *node2)
return true;
}
+void be_info_set_note(ir_graph *irg, const ir_node *node, const char* note)
+{
+ if(is_Proj(node)) return;
+
+ struct obstack *obst = be_get_be_obst(irg);
+ size_t len = strlen(note) + 1;
+
+ char *backend_note = (char*)obstack_alloc(obst, len);
+ memcpy(backend_note, note, len);
+
+ backend_info_t *info = be_get_info(node);
+ info->note = backend_note;
+}
+
+
static void init_walker(ir_node *node, void *data)
{
ir_graph *irg = get_irn_irg(node);
diff --git a/ir/be/beinfo.h b/ir/be/beinfo.h
index c0b9111..e66b8cc 100644
--- a/ir/be/beinfo.h
+++ b/ir/be/beinfo.h
@@ -38,6 +38,10 @@ struct backend_info_t {
const arch_register_req_t **in_reqs;
reg_out_info_t *out_infos;
arch_irn_flags_t flags;
+
+ /** A text note for the node that can be set by the backend for debugging */
+ char *note;
+
#ifndef NDEBUG
char const *orig_node;
#endif
@@ -58,4 +62,6 @@ void be_info_init_irn(ir_node *node, arch_irn_flags_t flags, arch_register_req_t
int attrs_equal_be_node(const ir_node *node1, const ir_node *node2);
+void be_info_set_note(ir_graph *irg, const ir_node *node1, const char *note);
+
#endif