12 static char *regs64[] = {"rax", "r10", "r11", "r9"};
13 static char *regs8l[] = {"al", "r10b", "r11b", "r9b"};
15 void func_header(char *s)
17 printf("\t.globl %1$s\n\t.type %1$s, @function\n%1$s:\n", s);
20 void func_footer(void)
25 void move(char *src, char *dst)
28 printf("//wtf, src ist null\n");
31 printf("//wtf, dst ist null\n");
33 if(strcmp(src,dst) != 0) {
34 printf("\tmovq %%%s, %%%s\n", src, dst);
38 void moveimm(long imm, char *dst)
41 sprintf(buf, "$%d", imm);
42 printf("\tmovq %s, %%%s\n", buf, dst);
50 char *next_reg(char *s, short skip, int params)
53 if (s != (char*) NULL) {
54 while(strcmp(s, regs64[i]) != 0) {
63 fprintf(stderr, "next_reg(): %s (bei %i parameter)\n", regs64[i], params);
66 if(REGLEN - params <= i) {
67 fprintf(stderr, "next_reg(): register \"%s\" in dem sich ein parameter befindet wird als temporaeres register verwendet(params: %i, i: %i)\n", regs64[i], params, i);
68 /* TODO: exit hier? */
76 char *reg_64to8l(char *s)
79 if (s != (char*) NULL) {
80 while(strcmp(s, regs64[i]) != 0) {
85 fprintf(stderr, "reg_64to8l(): sollte nicht passieren\n");
90 char *param_reg(int num)
92 char *regs[] = {"rdi", "rsi", "rdx", "rcx", "r8", "r9"};