Only copy the x87 state once per block.
[libfirm] / ir / be / ia32 / ia32_emitter.h
index d6a3236..4f45fee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
  * @file
  * @brief       This file implements the ia32 node emitter.
  * @author      Christian Wuerdig, Matthias Braun
- * @version     $Id$
  */
 #ifndef FIRM_BE_IA32_IA32_EMITTER_H
 #define FIRM_BE_IA32_IA32_EMITTER_H
 
 #include "irnode.h"
 
-#include "../bearch.h"
-#include "../beemitter.h"
+#include "bearch.h"
 
 #include "bearch_ia32_t.h"
 
-typedef struct ia32_emit_env_t  ia32_emit_env_t;
-
-struct ia32_emit_env_t {
-       be_emit_env_t         *emit;
-       const arch_env_t      *arch_env;
-       const ia32_code_gen_t *cg;
-       ia32_isa_t            *isa;
-};
-
-void ia32_emit_source_register(ia32_emit_env_t *env, const ir_node *node, int pos);
-void ia32_emit_dest_register(ia32_emit_env_t *env, const ir_node *node, int pos);
-void ia32_emit_x87_name(ia32_emit_env_t *env, const ir_node *node, int pos);
-void ia32_emit_immediate(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_mode_suffix(ia32_emit_env_t *env, const ir_mode *mode);
-void ia32_emit_x87_mode_suffix(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_xmm_mode_suffix(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_xmm_mode_suffix_s(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_extend_suffix(ia32_emit_env_t *env, const ir_mode *mode);
-void ia32_emit_binop(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_unop(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_am(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_adr(ia32_emit_env_t *env, const ir_node *node);
-void ia32_emit_x87_binop(ia32_emit_env_t *env, const ir_node *node);
+/**
+ * fmt  parameter               output
+ * ---- ----------------------  ---------------------------------------------
+ * %%                           %
+ * %AF  <node>                  address mode or x87 register
+ * %AM  <node>                  address mode of the node
+ * %AR  arch_register_t const*  address mode of the node or register
+ * %ASx <node>                  address mode of the node or source register x
+ * %B   <node>                  operands for binary operation
+ * %Dx  <node>                  destination register x
+ * %Fx  <node>                  x87 register x
+ * %FM  <node>                  x87 mode suffix
+ * %FX  <node>                  SSE mode suffix
+ * %I   <node>                  immediate of the node
+ * %L   <node>                  control flow target of the node
+ * %M   <node>                  mode suffix of the node
+ * %Px  <node>                  condition code
+ * %PX  int                     condition code
+ * %R   arch_register_t const*  register
+ * %Sx  <node>                  source register x
+ * %s   char const*             string
+ * %u   unsigned int            unsigned int
+ * %d   signed int              signed int
+ *
+ * x starts at 0
+ * # modifier for %ASx, %D, %R, and %S uses ls mode of node to alter register width
+ * # modifier for %M for extend suffix
+ * * modifier does not prefix immediates with $, but AM with *
+ * l modifier for %lu and %ld
+ * > modifier to output high 8bit register (ah, bh)
+ * < modifier to output low 8bit register (al, bl)
+ */
+void ia32_emitf(ir_node const *node, char const *fmt, ...);
 
-void ia32_gen_routine(ia32_code_gen_t *cg, ir_graph *irg);
+void ia32_gen_routine(ir_graph *irg);
+void ia32_gen_binary_routine(ir_graph *irg);
 
-#endif /* FIRM_BE_IA32_IA32_EMITTER_H */
+/** Initializes the Emitter. */
+void ia32_init_emitter(void);
+#endif