summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaximilian Stemmer-Grabow <mail@mxsg.de>2021-06-10 14:23:08 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-12-02 12:57:28 +0100
commitc013ae3cb0d313f4a985ef6554c788f8ce8d08d3 (patch)
tree4d4c1839442d2b4281151226430e0dbd375f94ea
parent8903925fa0a12a85a9ab452b9ae8dd36cf849104 (diff)
Add incomplete method to check number of value uses for nodes
-rw-r--r--ir/be/riscv/riscv_compression.c17
-rw-r--r--ir/be/riscv/riscv_compression.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/ir/be/riscv/riscv_compression.c b/ir/be/riscv/riscv_compression.c
index 1829c1c..4704d7f 100644
--- a/ir/be/riscv/riscv_compression.c
+++ b/ir/be/riscv/riscv_compression.c
@@ -11,6 +11,8 @@
#include "bearch.h"
#include "becopyopt_t.h"
#include "benode.h"
+#include "irprintf.h"
+#include "iredges.h"
#include "riscv_nodes_attr.h"
#include "gen_riscv_new_nodes.h"
@@ -176,6 +178,21 @@ int riscv_get_op_compression_requirements(ir_node const *const node)
return (int)requirement;
}
+int riscv_get_use_count(const ir_node *node)
+{
+ // We are using the out edges, so verify they are correct
+ assure_irg_properties(node->irg, IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES);
+
+ int count = 0;
+
+ foreach_out_edge(node, edge) {
+ // ir_node *const use = get_edge_src_irn(edge);
+ count++;
+ }
+
+ return count;
+}
+
static bool riscv_register_is_compressible(const arch_register_t *const reg)
{
// Guard against unset registers
diff --git a/ir/be/riscv/riscv_compression.h b/ir/be/riscv/riscv_compression.h
index 342f9c1..b1bb74b 100644
--- a/ir/be/riscv/riscv_compression.h
+++ b/ir/be/riscv/riscv_compression.h
@@ -15,6 +15,7 @@
#include "firm_types.h"
int riscv_get_op_compression_requirements(ir_node const *node);
+int riscv_get_use_count(const ir_node *node);
bool riscv_is_compressible(const ir_node *node);
#endif