projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sparc: implement float->unsigned conversions
[libfirm]
/
ir
/
be
/
beemitter.c
diff --git
a/ir/be/beemitter.c
b/ir/be/beemitter.c
index
3de970a
..
9b2d6a0
100644
(file)
--- a/
ir/be/beemitter.c
+++ b/
ir/be/beemitter.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-22,25
+22,22
@@
* @brief Interface for assembler output.
* @author Matthias Braun
* @date 12.03.2007
* @brief Interface for assembler output.
* @author Matthias Braun
* @date 12.03.2007
- * @version $Id$
*/
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
-#endif
#include "beemitter.h"
#include "beemitter.h"
+#include "irnode_t.h"
#include "irprintf.h"
#include "ident.h"
#include "tv.h"
#include "irprintf.h"
#include "ident.h"
#include "tv.h"
+#include "dbginfo.h"
FILE *emit_file;
struct obstack emit_obst;
FILE *emit_file;
struct obstack emit_obst;
-int emit_linelength;
void be_emit_init(FILE *file)
{
emit_file = file;
void be_emit_init(FILE *file)
{
emit_file = file;
- emit_linelength = 0;
obstack_init(&emit_obst);
}
obstack_init(&emit_obst);
}
@@
-57,7
+54,7
@@
void be_emit_ident(ident *id)
be_emit_string_len(str, len);
}
be_emit_string_len(str, len);
}
-void be_emit_tarval(tarval *tv)
+void be_emit_tarval(
ir_
tarval *tv)
{
char buf[64];
{
char buf[64];
@@
-84,19
+81,20
@@
void be_emit_irprintf(const char *fmt, ...)
void be_emit_write_line(void)
{
void be_emit_write_line(void)
{
- char *finished_line = obstack_finish(&emit_obst);
+ size_t len = obstack_object_size(&emit_obst);
+ char *line = (char*)obstack_finish(&emit_obst);
- fwrite(finished_line, emit_linelength, 1, emit_file);
- emit_linelength = 0;
- obstack_free(&emit_obst, finished_line);
+ fwrite(line, 1, len, emit_file);
+ obstack_free(&emit_obst, line);
}
void be_emit_pad_comment(void)
{
}
void be_emit_pad_comment(void)
{
- while(emit_linelength <= 30) {
- be_emit_char(' ');
- }
- be_emit_cstring(" ");
+ size_t len = obstack_object_size(&emit_obst);
+ if (len > 30)
+ len = 30;
+ /* 34 spaces */
+ be_emit_string_len(" ", 34 - len);
}
void be_emit_finish_line_gas(const ir_node *node)
}
void be_emit_finish_line_gas(const ir_node *node)
@@
-105,7
+103,7
@@
void be_emit_finish_line_gas(const ir_node *node)
const char *sourcefile;
unsigned lineno;
const char *sourcefile;
unsigned lineno;
- if(node == NULL) {
+ if
(node == NULL) {
be_emit_char('\n');
be_emit_write_line();
return;
be_emit_char('\n');
be_emit_write_line();
return;
@@
-116,8
+114,8
@@
void be_emit_finish_line_gas(const ir_node *node)
be_emit_irprintf("%+F ", node);
dbg = get_irn_dbg_info(node);
be_emit_irprintf("%+F ", node);
dbg = get_irn_dbg_info(node);
- sourcefile =
be
_retrieve_dbg_info(dbg, &lineno);
- if(sourcefile != NULL) {
+ sourcefile =
ir
_retrieve_dbg_info(dbg, &lineno);
+ if
(sourcefile != NULL) {
be_emit_string(sourcefile);
be_emit_irprintf(":%u", lineno);
}
be_emit_string(sourcefile);
be_emit_irprintf(":%u", lineno);
}