summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaximilian Stemmer-Grabow <mail@mxsg.de>2021-05-28 16:09:50 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-12-02 12:57:28 +0100
commit2d38dcf780dc5902f15687781953a256cab64517 (patch)
tree62fe8e622034bdc5dead39b46422ff43415c2034
parent86622597e2358dd6301fed79c9a0366ac288555f (diff)
Add compressibility information to nodes before emitting them
This uses the `backend_info_t` note field which can be included in the assembly output alongside source location information.
-rw-r--r--ir/be/riscv/riscv_emitter.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/ir/be/riscv/riscv_emitter.c b/ir/be/riscv/riscv_emitter.c
index 8951797..a1d0026 100644
--- a/ir/be/riscv/riscv_emitter.c
+++ b/ir/be/riscv/riscv_emitter.c
@@ -19,6 +19,7 @@
#include "gen_riscv_regalloc_if.h"
#include "riscv_nodes_attr.h"
#include "riscv_bearch_t.h"
+#include "riscv_compression.h"
#include "util.h"
static void emit_immediate_val(char const *const prefix, ir_entity *const ent, int32_t const val)
@@ -332,10 +333,29 @@ static void riscv_register_emitters(void)
be_set_emitter(op_riscv_switch, emit_riscv_switch);
}
-static void riscv_gen_block(ir_node *const block)
+static void riscv_add_compressibility_info(ir_graph *const irg, ir_node *const node)
+{
+ struct backend_info_t *be_info = be_get_info(node);
+
+ bool compressible = riscv_is_compressible(node);
+ const char* note = compressible ? "compr=true" : "compr=false";
+
+ if (be_info) {
+ be_info_set_note(irg, node, note);
+ }
+}
+
+static void riscv_gen_block(ir_graph *const irg, ir_node *const block)
{
be_gas_begin_block(block);
+
sched_foreach(block, node) {
+ // @Todo Move this to a more appropriate place
+ // Also, this should not need the graph as a parameter otherwise
+ // Set compressibility information for every block
+ riscv_add_compressibility_info(irg, node);
+
+ // Actually emit the node
be_emit_node(node);
}
}
@@ -353,7 +373,7 @@ void riscv_emit_function(ir_graph *const irg)
be_emit_init_cf_links(blk_sched);
for (size_t i = 0, n_blocks = ARR_LEN(blk_sched); i != n_blocks; ++i) {
- riscv_gen_block(blk_sched[i]);
+ riscv_gen_block(irg, blk_sched[i]);
}
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);