path: root/ir/ir
diff options
authorMatthias Braun <>2017-01-04 20:12:21 +0100
committerMatthias Braun <>2017-02-20 04:48:18 +0100
commit1ffc842f8bb13ed098eeaf2382ba473f9e154466 (patch)
treecd4c1c9ca57400975db74b7212ac237166359704 /ir/ir
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/ir')
3 files changed, 5 insertions, 3 deletions
diff --git a/ir/ir/irarch.c b/ir/ir/irarch.c
index 8dd60fd..38f1dfa 100644
--- a/ir/ir/irarch.c
+++ b/ir/ir/irarch.c
@@ -15,7 +15,6 @@
#include "irarch.h"
-#include "be.h"
#include "dbginfo_t.h"
#include "ircons.h"
#include "ircons_t.h"
diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c
index 9f7a654..6a6d47f 100644
--- a/ir/ir/irgraph.c
+++ b/ir/ir/irgraph.c
@@ -141,6 +141,9 @@ static ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
ir_graph *new_ir_graph(ir_entity *ent, int n_loc)
+ /* We cannot create graphs before setting mode_P. */
+ assert(mode_P != NULL && "mode_P is not set (target not initialized?)");
ir_graph *res = new_r_ir_graph(ent, n_loc);
ir_node *const start = new_r_Start(res);
diff --git a/ir/ir/irmode.c b/ir/ir/irmode.c
index dfe0280..8f315ec 100644
--- a/ir/ir/irmode.c
+++ b/ir/ir/irmode.c
@@ -162,8 +162,8 @@ ir_mode *new_reference_mode(const char *name, unsigned bit_size,
/* Construct offset mode if none is set yet. */
if (res->offset_mode == NULL) {
- char buf[64];
- snprintf(buf, sizeof(buf), "%s_i", name);
+ char buf[16];
+ snprintf(buf, sizeof(buf), "I%u", bit_size);
ir_mode *offset_mode = new_int_mode(buf, bit_size, 1, modulo_shift);
res->offset_mode = offset_mode;