X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=uebersetzerbau-ss10.git;a=blobdiff_plain;f=gesamt_arm%2Fchelper.c;fp=gesamt_arm%2Fchelper.c;h=20e81bffd435e389df1e2487f43d2c33b5d75bf5;hp=ee419220f21d8918c7b4aab2ff93cf049473020d;hb=701d0d1c1b9437a32499d2644d1c73920e816dff;hpb=b9ffbf367b39d7786ca493cc0b755e43e084b0e0 diff --git a/gesamt_arm/chelper.c b/gesamt_arm/chelper.c index ee41922..20e81bf 100644 --- a/gesamt_arm/chelper.c +++ b/gesamt_arm/chelper.c @@ -8,6 +8,7 @@ #define DDCHELP #endif +/* TODO */ #define REGLEN 5 static char *regsppc[] = {"r10", "r11", "r12", "r13", "r14"}; @@ -50,20 +51,19 @@ void move(char *src, char *dst) { if(src == (char*) NULL) return; if(strcmp(src,dst) != 0) { - printf("\tmov %s,%s\n", dst, src); + printf("\tmov %s, %s\n", dst, src); } } void moveimm(long imm, char *dst) { + static int constlbl = 1; if((imm > 65536-1) || (imm < -65536)) { - /* high word */ - printf("\tlis %s,%d@ha\n", dst, imm); - /* low word */ - printf("\taddi %s,%s,%d@l\n", dst, dst, imm); + printf("\t.align 2\n\t.CONSTLBL%i\n\t.word %i\n", constlbl++); + printf("\tldr %s, .CONSTLBL%i\n", dst, constlbl); } else { /* just low word */ - printf("\tli %s,%d@l\n", dst, imm); + printf("\t%s %s, #%d\n", imm >= 0 ? "mov" : "mvn", dst, imm >= 0 ? imm : (-1 * imm) - 1); } } @@ -90,7 +90,7 @@ char *reg_64to8l(char *s) } char *param_reg(int num) -{ +{ /* TODO */ char *regs[] = {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9"}; return regs[num]; }