From bc0b78bde2a8d46a0fb61b32b3fc591b1ae16cd4 Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 6 May 2014 13:24:47 +0800 Subject: ... --- mips.c | 8 ++++++++ ssa.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mips.c b/mips.c index e7719f8..6dce7f5 100644 --- a/mips.c +++ b/mips.c @@ -519,6 +519,14 @@ void mips_generate(void) { int rd = i->dest->reg; int j; memset(used_reg, 0, sizeof used_reg); + /* NOTE: bad hack */ + if (i->src1->kind == IMMF && !strcmp(i->src1->info.str, "__print_string")) + { + printf( "\tlw $a0, 0($sp)\n" + "\tli $2, 4\n" + "\tsyscall\n"); + break; + } if (rt->type == CSTRUCT || rt->type == CUNION) used_reg[30] = 1; /* save $fp */ for (p = defs; p; p = p->next) diff --git a/ssa.c b/ssa.c index 6325315..ab77be8 100644 --- a/ssa.c +++ b/ssa.c @@ -152,7 +152,7 @@ void cfg_add_edge(CBlock_t from, CBlock_t to) { } void dtree_add_edge(CBlock_t from, CBlock_t to) { -/* printf("%d d-> %d\n", from->id, to->id); */ + fprintf(stderr, "%d d-> %d\n", from->id, to->id); int id = from->id; CEdge *e = NEW(CEdge); e->to = to; -- cgit v1.2.3-70-g09d2