summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beasm.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-05-04 06:44:25 +0200
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>2018-05-04 22:47:07 +0200
commit9b7b69480d36584826a3621b5cf99b96bd1d08d8 (patch)
tree1543f9926074246c61c1cb851245556ce61c582a /ir/be/beasm.c
parenta157fbb763270e3b61fe90a7ade2edfbc259138d (diff)
be: Factor out parsing of register names for clobbers.
Diffstat (limited to 'ir/be/beasm.c')
-rw-r--r--ir/be/beasm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index f1e9019..c3cf3a1 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -383,3 +383,20 @@ bool be_is_valid_asm_operand_kind(ir_node const *const node, char const modifier
}
return true;
}
+
+arch_register_t const *be_parse_register_name(char const *const clobber)
+{
+ arch_register_t const *const reg = arch_find_register(clobber);
+ if (reg)
+ return reg;
+
+ be_register_name_t const *const add = ir_target.isa->additional_reg_names;
+ if (add) {
+ for (be_register_name_t const *i = add; i->name; ++i) {
+ if (streq(i->name, clobber))
+ return &ir_target.isa->registers[i->index];
+ }
+ }
+
+ return NULL;
+}