codea: nicht wirklich was aufregendes, aber ein paar simple testfaelle gehen schon
[uebersetzerbau-ss10.git] / codea / chelper.c
index 8f9185c251899e17c32d1e3f75e7ac713235d73f..bb0f7005ea1ccd5ac72f56087485889a8e04c9a2 100644 (file)
@@ -3,6 +3,10 @@
 #include "chelper.h"
 #include "tree.h"
 
+#if 1
+#define DDCHELP
+#endif
+
 void func_header(char *s)
 {
        printf("\t.globl %1$s\n\t.type %1$s, @function\n%1$s:\n", s);
@@ -25,7 +29,7 @@ char *next_reg(char *s, short skip)
        char *regs[] = {"rax", "r10", "r11", "r9", "r8", "rcx", "rdx", "rsi", "rdi"};
        int i=0;
        if (s != (char*) NULL) {
-               for(; i < 9;) {
+               while(i < 9) {
                        if(!strcmp(s, regs[i++])) {
                                break;
                        }
@@ -34,12 +38,16 @@ char *next_reg(char *s, short skip)
        if(skip) {
                i++;
        }
+#ifdef DDCHELP
+       fprintf(stderr, "next_reg(): %s\n", regs[i]);
+#endif
+
        return regs[i];
 }
 
 char *param_reg(int num)
 {
        char *regs[] = {"rdi", "rsi", "rdx", "rcx", "r8", "r9"};
-       return regs[num-1];
+       return regs[num];
 }