summaryrefslogtreecommitdiffhomepage
path: root/ir/common
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-01-04 20:12:21 +0100
committerMatthias Braun <matze@braunis.de>2017-02-20 04:48:18 +0100
commit1ffc842f8bb13ed098eeaf2382ba473f9e154466 (patch)
treecd4c1c9ca57400975db74b7212ac237166359704 /ir/common
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/common')
-rw-r--r--ir/common/firm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ir/common/firm.c b/ir/common/firm.c
index a4de24c..2c34dcd 100644
--- a/ir/common/firm.c
+++ b/ir/common/firm.c
@@ -32,12 +32,15 @@
#include "irtools.h"
#include "lc_opts.h"
#include "opt_init.h"
+#include "target_t.h"
#include "tv_t.h"
#include "type_t.h"
#include "version.h"
#include <stdio.h>
#include <stdio.h>
+static bool initialized;
+
/* returns the firm root */
lc_opt_entry_t *firm_opt_get_root(void)
{
@@ -47,8 +50,12 @@ lc_opt_entry_t *firm_opt_get_root(void)
return grp;
}
-void ir_init(void)
+void ir_init_library(void)
{
+ if (initialized)
+ panic("Double initialization");
+ initialized = true;
+
firm_init_flags();
init_ident();
init_edges();
@@ -89,6 +96,8 @@ void ir_finish(void)
finish_tarval();
finish_mode();
finish_ident();
+ finish_target();
+ initialized = false;
}
unsigned ir_get_version_major(void)