~mcf/cproc

cbff9bf03861b8d63f598d3370c82a96511a754c — Michael Forney 1 year, 7 months ago 3be6638
Shorten some names with 'long'
4 files changed, 31 insertions(+), 31 deletions(-)

M cc.h
M decl.c
M expr.c
M type.c
M cc.h => cc.h +3 -3
@@ 198,10 198,10 @@ struct type {
				BASICINT,
				BASICENUM,
				BASICLONG,
				BASICLONGLONG,
				BASICLLONG,
				BASICFLOAT,
				BASICDOUBLE,
				BASICLONGDOUBLE,
				BASICLDOUBLE,
			} kind;
			_Bool issigned, iscomplex;
		} basic;


@@ 416,7 416,7 @@ extern struct type typeshort, typeushort;
extern struct type typeint, typeuint;
extern struct type typelong, typeulong;
extern struct type typellong, typeullong;
extern struct type typefloat, typedouble, typelongdouble;
extern struct type typefloat, typedouble, typeldouble;
extern struct type typevalist, typevalistptr;

/* decl */

M decl.c => decl.c +15 -15
@@ 380,36 380,36 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
	}
done:
	switch ((int)ts) {
	case SPECNONE:                                               break;
	case SPECCHAR:                          t = &typechar;       break;
	case SPECSIGNED|SPECCHAR:               t = &typeschar;      break;
	case SPECUNSIGNED|SPECCHAR:             t = &typeuchar;      break;
	case SPECNONE:                                            break;
	case SPECCHAR:                          t = &typechar;    break;
	case SPECSIGNED|SPECCHAR:               t = &typeschar;   break;
	case SPECUNSIGNED|SPECCHAR:             t = &typeuchar;   break;
	case SPECSHORT:
	case SPECSHORT|SPECINT:
	case SPECSIGNED|SPECSHORT:
	case SPECSIGNED|SPECSHORT|SPECINT:      t = &typeshort;      break;
	case SPECSIGNED|SPECSHORT|SPECINT:      t = &typeshort;   break;
	case SPECUNSIGNED|SPECSHORT:
	case SPECUNSIGNED|SPECSHORT|SPECINT:    t = &typeushort;     break;
	case SPECUNSIGNED|SPECSHORT|SPECINT:    t = &typeushort;  break;
	case SPECINT:
	case SPECSIGNED:
	case SPECSIGNED|SPECINT:                t = &typeint;        break;
	case SPECSIGNED|SPECINT:                t = &typeint;     break;
	case SPECUNSIGNED:
	case SPECUNSIGNED|SPECINT:              t = &typeuint;       break;
	case SPECUNSIGNED|SPECINT:              t = &typeuint;    break;
	case SPECLONG:
	case SPECLONG|SPECINT:
	case SPECSIGNED|SPECLONG:
	case SPECSIGNED|SPECLONG|SPECINT:       t = &typelong;       break;
	case SPECSIGNED|SPECLONG|SPECINT:       t = &typelong;    break;
	case SPECUNSIGNED|SPECLONG:
	case SPECUNSIGNED|SPECLONG|SPECINT:     t = &typeulong;      break;
	case SPECUNSIGNED|SPECLONG|SPECINT:     t = &typeulong;   break;
	case SPECLONGLONG:
	case SPECLONGLONG|SPECINT:
	case SPECSIGNED|SPECLONGLONG:
	case SPECSIGNED|SPECLONGLONG|SPECINT:   t = &typellong;      break;
	case SPECSIGNED|SPECLONGLONG|SPECINT:   t = &typellong;   break;
	case SPECUNSIGNED|SPECLONGLONG:
	case SPECUNSIGNED|SPECLONGLONG|SPECINT: t = &typeullong;     break;
	case SPECFLOAT:                         t = &typefloat;      break;
	case SPECDOUBLE:                        t = &typedouble;     break;
	case SPECLONG|SPECDOUBLE:               t = &typelongdouble; break;
	case SPECUNSIGNED|SPECLONGLONG|SPECINT: t = &typeullong;  break;
	case SPECFLOAT:                         t = &typefloat;   break;
	case SPECDOUBLE:                        t = &typedouble;  break;
	case SPECLONG|SPECDOUBLE:               t = &typeldouble; break;
	default:
		error(&tok.loc, "invalid combination of type specifiers");
	}

M expr.c => expr.c +1 -1
@@ 371,7 371,7 @@ primaryexpr(struct scope *s)
			else if (tolower(end[0]) == 'f' && !end[1])
				e->type = &typefloat;
			else if (tolower(end[0]) == 'l' && !end[1])
				e->type = &typelongdouble;
				e->type = &typeldouble;
			else
				error(&tok.loc, "invalid floating constant suffix '%s'", *end);
		} else {

M type.c => type.c +12 -12
@@ 21,13 21,13 @@ struct type typeuint       = {.kind = TYPEBASIC, .size = 4, .align = 4, .repr = 
struct type typelong       = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLONG, .issigned = 1}};
struct type typeulong      = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLONG}};

struct type typellong      = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLONGLONG, .issigned = 1}};
struct type typeullong     = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLONGLONG}};
struct type typellong      = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLLONG, .issigned = 1}};
struct type typeullong     = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &i64, .basic = {.kind = BASICLLONG}};

struct type typebool       = {.kind = TYPEBASIC, .size = 1, .align = 1, .repr = &i8, .basic = {.kind = BASICBOOL}};
struct type typefloat      = {.kind = TYPEBASIC, .size = 4, .align = 4, .repr = &f32, .basic = {.kind = BASICFLOAT}};
struct type typedouble     = {.kind = TYPEBASIC, .size = 8, .align = 8, .repr = &f64, .basic = {.kind = BASICDOUBLE}};
struct type typelongdouble = {.kind = TYPEBASIC, .size = 16, .align = 16, .basic = {.kind = BASICLONGDOUBLE}};  // XXX: not supported by qbe
struct type typeldouble    = {.kind = TYPEBASIC, .size = 16, .align = 16, .basic = {.kind = BASICLDOUBLE}};  // XXX: not supported by qbe

static struct type typevaliststruct = {.kind = TYPESTRUCT, .size = 24, .align = 8};
struct type typevalist = {.kind = TYPEARRAY, .size = 24, .align = 8, .array = {1}, .base = &typevaliststruct};


@@ 94,7 94,7 @@ typeprop(struct type *t)
		switch (t->basic.kind) {
		case BASICFLOAT:
		case BASICDOUBLE:
		case BASICLONGDOUBLE:
		case BASICLDOUBLE:
			p |= PROPFLOAT;
			break;
		case BASICCHAR:


@@ 132,13 132,13 @@ typerank(struct type *t)
{
	assert(typeprop(t) & PROPINT);
	switch (t->basic.kind) {
	case BASICBOOL:     return 1;
	case BASICCHAR:     return 2;
	case BASICSHORT:    return 3;
	case BASICBOOL:  return 1;
	case BASICCHAR:  return 2;
	case BASICSHORT: return 3;
	case BASICENUM:
	case BASICINT:      return 4;
	case BASICLONG:     return 5;
	case BASICLONGLONG: return 6;
	case BASICINT:   return 4;
	case BASICLONG:  return 5;
	case BASICLLONG: return 6;
	default:
		fatal("internal error; unhandled integer type");
	}


@@ 240,8 240,8 @@ typecommonreal(struct type *t1, struct type *t2)
	assert(t1->kind == TYPEBASIC && t2->kind == TYPEBASIC);
	if (t1 == t2)
		return t1;
	if (t1 == &typelongdouble || t2 == &typelongdouble)
		return &typelongdouble;
	if (t1 == &typeldouble || t2 == &typeldouble)
		return &typeldouble;
	if (t1 == &typedouble || t2 == &typedouble)
		return &typedouble;
	if (t1 == &typefloat || t2 == &typefloat)