scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 9fb2e758d7d98e82afc5029a29adb8fdc23f7bb0
parent 1b7566d98a33a1c01eff33a31fd4155dce0b543a
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu, 19 May 2016 13:50:01 +0200

[cc2] Remove TSIZE type

As done for cc1

Diffstat:
cc2/arch/amd64-sysv/arch.h | 1-
cc2/arch/amd64-sysv/code.c | 13+++++--------
cc2/arch/i386-sysv/arch.h | 1-
cc2/arch/i386-sysv/code.c | 13+++++--------
cc2/arch/qbe/arch.h | 1-
cc2/arch/qbe/code.c | 7+++----
cc2/arch/z80/arch.h | 1-
cc2/arch/z80/code.c | 10+++++-----
cc2/cc2.h | 6+++---
9 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/cc2/arch/amd64-sysv/arch.h b/cc2/arch/amd64-sysv/arch.h @@ -2,4 +2,3 @@ #define TINT long long #define TUINT unsigned long long #define TFLOAT double -#define TSIZE unsigned long diff --git a/cc2/arch/amd64-sysv/code.c b/cc2/arch/amd64-sysv/code.c @@ -120,11 +120,11 @@ size2asm(Type *tp) s = "\t.quad\t"; break; default: - s = "\t.space\t%llu,"; + s = "\t.space\t%lu,"; break; } } - printf(s, (unsigned long long) tp->size); + printf(s, tp->size); } @@ -158,15 +158,12 @@ label(Symbol *sym) return; case SGLOB: printf("\t.global\t%s\n", name); - if (seg == BSSSEG) { - printf("\t.comm\t%s,%llu\n", - name, - (unsigned long long) tp->size); - } + if (seg == BSSSEG) + printf("\t.comm\t%s,%lu\n", name, tp->size); break; } if (sym->type.align != 1) - printf("\t.align\t%lld\n", (long long) sym->type.align ); + printf("\t.align\t%lu\n", sym->type.align ); printf("%s:\n", name); } diff --git a/cc2/arch/i386-sysv/arch.h b/cc2/arch/i386-sysv/arch.h @@ -2,4 +2,3 @@ #define TINT long long #define TUINT unsigned long long #define TFLOAT double -#define TSIZE unsigned long diff --git a/cc2/arch/i386-sysv/code.c b/cc2/arch/i386-sysv/code.c @@ -120,11 +120,11 @@ size2asm(Type *tp) s = "\t.quad\t"; break; default: - s = "\t.space\t%llu,"; + s = "\t.space\t%lu,"; break; } } - printf(s, (unsigned long long) tp->size); + printf(s, tp->size); } void @@ -157,15 +157,12 @@ label(Symbol *sym) return; case SGLOB: printf("\t.global\t%s\n", name); - if (seg == BSSSEG) { - printf("\t.comm\t%s,%llu\n", - name, - (unsigned long long) tp->size); - } + if (seg == BSSSEG) + printf("\t.comm\t%s,%lu\n", name, tp->size); break; } if (sym->type.align != 1) - printf("\t.align\t%lld\n", (long long) sym->type.align ); + printf("\t.align\t%lud\n", sym->type.align ); printf("%s:\n", name); } diff --git a/cc2/arch/qbe/arch.h b/cc2/arch/qbe/arch.h @@ -2,7 +2,6 @@ #define TINT long long #define TUINT unsigned long long #define TFLOAT double -#define TSIZE unsigned long enum asmop { ASNOP = 0, diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c @@ -261,7 +261,7 @@ defglobal(Symbol *sym) printf("data %s = {\n", symname(sym)); if (sym->type.flags & INITF) return; - printf("\tz\t%llu\n}\n", (unsigned long long) sym->type.size); + printf("\tz\t%lu\n}\n", sym->type.size); } void @@ -289,9 +289,8 @@ alloc(Symbol *sym) { Type *tp = &sym->type; - printf("\t%s %s=\talloc%lld\t%lld\n", - symname(sym), size2asm(tp), - (long long) tp->size, (long long) tp->align); + printf("\t%s %s=\talloc%lu\t%lu\n", + symname(sym), size2asm(tp), tp->size, tp->align); } void diff --git a/cc2/arch/z80/arch.h b/cc2/arch/z80/arch.h @@ -2,4 +2,3 @@ #define TINT long long #define TUINT unsigned long long #define TFLOAT double -#define TSIZE unsigned short diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c @@ -14,7 +14,7 @@ enum segment { }; static int curseg = NOSEG; -static TSIZE offpar, offvar; +static unsigned long offpar, offvar; static void segment(int seg) @@ -147,11 +147,11 @@ size2asm(Type *tp) s = "\tDD\t"; break; default: - s = "\tDS\t%llu,"; + s = "\tDS\t%lu,"; break; } } - printf(s, (unsigned long long) tp->size); + printf(s, tp->size); } void @@ -163,7 +163,7 @@ newfun() void defpar(Symbol *sym) { - TSIZE align, size; + unsigned long align, size; if (sym->kind != SREG && sym->kind != SAUTO) return; @@ -179,7 +179,7 @@ defpar(Symbol *sym) void defvar(Symbol *sym) { - TSIZE align, size; + unsigned long align, size; if (sym->kind != SREG && sym->kind != SAUTO) return; diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -126,8 +126,8 @@ typedef struct addr Addr; typedef struct inst Inst; struct type { - TSIZE size; - TSIZE align; + unsigned long size; + unsigned long align; char flags; }; @@ -139,7 +139,7 @@ struct symbol { char *name; char kind; union { - TSIZE off; + unsigned long off; Node *stmt; Inst *inst; } u;