summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beemitter.h
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2007-03-19 18:05:21 +0100
committerMatthias Braun <matze@braunis.de>2007-03-19 18:05:21 +0100
commit8535fe8732b0acf822be252812a7158ce5b8134a (patch)
tree7c90501572493f3bbcf2fd56183a135c5a99e5b2 /ir/be/beemitter.h
parentded8c3995ddca132ef312a6fdeeba7eae2e42c43 (diff)
The big committ:
- Replace limit callback in register requirements with a simple bitset - Fix backends, generators and the rest of the code for the change register requirements structure - Eliminated the custom register_requirement structures in the backend, they are pointless now, use the normal arch_register_req_t - Fix TEMPLATE backend - Extract emitter framework from ia32 and provide generic header/code for it - Port TEMPLATE backend to new emitter - Extract gas specific emit stuff (declarations, sections) from ia32 backend and provide it as generic header/code. Make TEMPLATE backend use that - Remove several FIRM_DBG_REGISTERs from functions which are called very often. Before we had millions of string hashtable lookups because of that. The prefered way is to have 1 static debug module per file and initialize it in the module constructor. No passing around in environment structs and in no case should you dynamically register it in single functions.
Diffstat (limited to 'ir/be/beemitter.h')
-rw-r--r--ir/be/beemitter.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/ir/be/beemitter.h b/ir/be/beemitter.h
new file mode 100644
index 0000000..1864ffd
--- /dev/null
+++ b/ir/be/beemitter.h
@@ -0,0 +1,58 @@
+/*
+ * Author: Matthias Braun
+ * Date: 12.03.2007
+ * Copyright: (c) Universitaet Karlsruhe
+ * License: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+#ifndef BESPILLMORGAN_H_
+#define BESPILLMORGAN_H_
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "obst.h"
+#include "ident.h"
+#include "irnode.h"
+#include "be.h"
+
+/* framework for emitting data (usually the final assembly code) */
+
+typedef struct be_emit_env_t {
+ FILE *F;
+ struct obstack obst;
+ int linelength;
+} be_emit_env_t;
+
+static INLINE void be_emit_char(be_emit_env_t *env, char c)
+{
+ obstack_1grow(&env->obst, c);
+ env->linelength++;
+}
+
+static INLINE void be_emit_string_len(be_emit_env_t *env, const char *str,
+ size_t l)
+{
+ obstack_grow(&env->obst, str, l);
+ env->linelength += l;
+}
+
+static INLINE void be_emit_string(be_emit_env_t *env, const char *str)
+{
+ size_t len = strlen(str);
+ be_emit_string_len(env, str, len);
+}
+
+#define be_emit_cstring(env,x) { be_emit_string_len(env, x, sizeof(x)-1); }
+
+void be_emit_init_env(be_emit_env_t *env, FILE *F);
+void be_emit_destroy_env(be_emit_env_t *env);
+
+void be_emit_ident(be_emit_env_t *env, ident *id);
+void be_emit_irprintf(be_emit_env_t *env, const char *fmt, ...);
+void be_emit_irvprintf(be_emit_env_t *env, const char *fmt, va_list args);
+void be_emit_write_line(be_emit_env_t *env);
+
+/* appends a gas-style comment with the node number and writes the line */
+void be_emit_finish_line_gas(be_emit_env_t *env, const ir_node *node);
+void be_emit_pad_comment(be_emit_env_t *env);
+
+#endif