summaryrefslogtreecommitdiffhomepage
path: root/ir/be/TEMPLATE
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-10-19 14:41:56 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-10-19 15:25:59 +0200
commit6a01dd0a907fd6fb5be2fd4737fd3fee163731a0 (patch)
tree910de76c3c69777683ed8964b18597d389c79677 /ir/be/TEMPLATE
parent24c5a97fd02ccc5f1fb8f43f640d3bd2fe0ccc68 (diff)
be: Factor out (almost) common code in ${ARCH}_emitf() into the macro BE_EMITF().
This save quite a bit of code duplication. Also the code drifted apart in the different backends, which this macro prevents now.
Diffstat (limited to 'ir/be/TEMPLATE')
-rw-r--r--ir/be/TEMPLATE/TEMPLATE_emitter.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/ir/be/TEMPLATE/TEMPLATE_emitter.c b/ir/be/TEMPLATE/TEMPLATE_emitter.c
index 0518044..9f5a1d7 100644
--- a/ir/be/TEMPLATE/TEMPLATE_emitter.c
+++ b/ir/be/TEMPLATE/TEMPLATE_emitter.c
@@ -63,23 +63,8 @@ static void TEMPLATE_emit_cfop_target(const ir_node *node)
void TEMPLATE_emitf(const ir_node *node, const char *format, ...)
{
- va_list ap;
- va_start(ap, format);
- be_emit_char('\t');
- for (;;) {
- const char *start = format;
- while (*format != '%' && *format != '\0')
- ++format;
- be_emit_string_len(start, format-start);
- if (*format == '\0')
- break;
- ++format;
-
+ BE_EMITF(node, format, ap, false) {
switch (*format++) {
- case '%':
- be_emit_char('%');
- break;
-
case 'S': {
if (!is_digit(*format))
goto unknown;
@@ -129,20 +114,11 @@ void TEMPLATE_emitf(const ir_node *node, const char *format, ...)
break;
}
- case '\n':
- be_emit_char('\n');
- be_emit_write_line();
- be_emit_char('\t');
- break;
-
default:
unknown:
panic("unknown format conversion");
}
}
- va_end(ap);
- be_emit_finish_line_gas(node);
-
}
/**