path: root/ir/be/beasm.c
diff options
authorMatthias Braun <>2017-01-04 20:12:21 +0100
committerMatthias Braun <>2017-02-20 04:48:18 +0100
commit1ffc842f8bb13ed098eeaf2382ba473f9e154466 (patch)
treecd4c1c9ca57400975db74b7212ac237166359704 /ir/be/beasm.c
parent845e655dac11bc5eba82b9fc6d36a6f4fec23eb6 (diff)
Rework target initialization and query
- Moves machine triple handling code form cparser into libfirm - Create new APIs to set the target and query information about it - Move backend_params into the new target API - Backends initialize ir_target instead of backend_params now - Add new API to get information about the target platform: - Mangle a name for the target platform (and remove compilerlib mangling callback) - Can query size and alignment of basic C types for the platform - Move some constant target information into arch_isa_if_t (we move it to target_info_t later when we realize it needs to be dynamic) - Redo backend initialization. Examples: Simple case: Initialize for host: ir_init(); Complex case: cross-compile to sparc with PIC enabled: ir_init_library(); ir_target_set("sparc-leon-linux-gnu"); ir_target_option("pic"); ir_target_init();
Diffstat (limited to 'ir/be/beasm.c')
1 files changed, 5 insertions, 3 deletions
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index 97e0083..4bed154 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -13,6 +13,7 @@
#include "betranshlp.h"
#include "ident_t.h"
#include "panic.h"
+#include "target_t.h"
#include "util.h"
#include "xmalloc.h"
#include <ctype.h>
@@ -246,7 +247,7 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
* FIXME: need to do this per register class...
size_t const orig_n_outs = ARR_LEN(out_reqs);
- uint8_t add_pressure[isa_if->n_register_classes];
+ uint8_t add_pressure[ir_target.isa->n_register_classes];
memset(add_pressure, 0, sizeof(add_pressure));
if (orig_n_outs < orig_n_ins) {
bitset_t *const used_ins = bitset_alloca(orig_n_ins);
@@ -281,10 +282,11 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
ident *const text = get_ASM_text(node);
arch_register_req_t const **const dup_in_reqs = DUP_ARR_D(arch_register_req_t const*, obst, in_reqs);
ir_node *const new_node = be_new_Asm(dbgi, block, n_ins, in, dup_in_reqs, n_outs, text, operands);
- for (unsigned i = 0, n = isa_if->n_register_classes; i < n; ++i) {
+ for (unsigned i = 0, n = ir_target.isa->n_register_classes; i < n; ++i) {
if (add_pressure[i] == 0)
- arch_register_class_t const *const cls = &isa_if->register_classes[i];
+ arch_register_class_t const *const cls
+ = &ir_target.isa->register_classes[i];
arch_set_additional_pressure(new_node, cls, add_pressure[i]);