X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbeemitter.h;h=d44dfd39736b85ce289fa1ce4e685b07741c7e74;hb=1b4cac3471b02b63e9656cd8c876f067766fe482;hp=06b60e695dc500a0691a80b2c601bc29f182e1fd;hpb=3654c4bea0fb78519945a6fcc053efcccf15258f;p=libfirm diff --git a/ir/be/beemitter.h b/ir/be/beemitter.h index 06b60e695..d44dfd397 100644 --- a/ir/be/beemitter.h +++ b/ir/be/beemitter.h @@ -22,7 +22,6 @@ * @brief Interface for assembler output. * @author Matthias Braun * @date 12.03.2007 - * @version $Id$ * * This is a framework for emitting data (usually the final assembly code) */ @@ -34,43 +33,37 @@ #include "firm_types.h" #include "obst.h" #include "be.h" +#include "irop_t.h" /* don't use the following vars directly, they're only here for the inlines */ extern FILE *emit_file; extern struct obstack emit_obst; -extern int emit_linelength; /** * Emit a character to the (assembler) output. - * - * @param env the emitter environment */ -static INLINE void be_emit_char(char c) +static inline void be_emit_char(char c) { obstack_1grow(&emit_obst, c); - emit_linelength++; } /** * Emit a string to the (assembler) output. * - * @param env the emitter environment * @param str the string * @param l the length of the given string */ -static INLINE void be_emit_string_len(const char *str, size_t l) +static inline void be_emit_string_len(const char *str, size_t l) { obstack_grow(&emit_obst, str, l); - emit_linelength += l; } /** * Emit a null-terminated string to the (assembler) output. * - * @param env the emitter environment * @param str the null-terminated string */ -static INLINE void be_emit_string(const char *str) +static inline void be_emit_string(const char *str) { size_t len = strlen(str); be_emit_string_len(str, len); @@ -79,47 +72,26 @@ static INLINE void be_emit_string(const char *str) /** * Emit a C string-constant to the (assembler) output. * - * @param env the emitter environment * @param str the null-terminated string constant */ #define be_emit_cstring(str) \ - do { be_emit_string_len(str, sizeof(str)-1); } while(0) + be_emit_string_len(str, sizeof(str) - 1) /** * Initializes an emitter environment. * - * @param env the (uninitialized) emitter environment * @param F a file handle where the emitted file is written to. */ void be_emit_init(FILE *F); /** * Destroys the given emitter environment. - * - * @param env the emitter environment */ void be_emit_exit(void); -/** - * Emit an ident to the (assembler) output. - * - * @param env the emitter environment - * @param id the ident to be emitted - */ -void be_emit_ident(ident *id); - -/** - * Emit a firm tarval. - * - * @param env the emitter environment - * @param tv the tarval to be emitted - */ -void be_emit_tarval(tarval *tv); - /** * Emit the output of an ir_printf. * - * @param env the emitter environment * @param fmt the ir_printf format */ void be_emit_irprintf(const char *fmt, ...); @@ -127,15 +99,12 @@ void be_emit_irprintf(const char *fmt, ...); /** * Emit the output of an ir_vprintf. * - * @param env the emitter environment * @param fmt the ir_printf format */ void be_emit_irvprintf(const char *fmt, va_list args); /** * Flush the line in the current line buffer to the emitter file. - * - * @param env the emitter environment */ void be_emit_write_line(void); @@ -143,16 +112,30 @@ void be_emit_write_line(void); * Flush the line in the current line buffer to the emitter file and * appends a gas-style comment with the node number and writes the line * - * @param env the emitter environment * @param node the node to get the debug info from */ void be_emit_finish_line_gas(const ir_node *node); /** * Emit spaces until the comment position is reached. - * - * @param env the emitter environment */ void be_emit_pad_comment(void); +/** + * The type of a emitter function. + */ +typedef void emit_func(ir_node const *node); + +static inline void be_set_emitter(ir_op *const op, emit_func *const func) +{ + set_generic_function_ptr(op, func); +} + +void be_emit_nothing(ir_node const *node); + +/** + * Emit code for a node. + */ +void be_emit_node(ir_node const *node); + #endif