summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/CMachine.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-18 17:19:20 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-18 17:19:20 +0000
commit5d0bbb19cc133753cebda7099e46d4b2084336c6 (patch)
tree649e0b361bab4c2400fc684f7b18cf2da670525b /compiler_and_linker/unsorted/CMachine.c
parenta231f5dbb93c60da240a027f2afd8a4797069541 (diff)
downloadMWCC-5d0bbb19cc133753cebda7099e46d4b2084336c6.tar.gz
MWCC-5d0bbb19cc133753cebda7099e46d4b2084336c6.zip
rename TypeMethod and the struct type enums
Diffstat (limited to 'compiler_and_linker/unsorted/CMachine.c')
-rw-r--r--compiler_and_linker/unsorted/CMachine.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/compiler_and_linker/unsorted/CMachine.c b/compiler_and_linker/unsorted/CMachine.c
index 9eebdfe..c62faf5 100644
--- a/compiler_and_linker/unsorted/CMachine.c
+++ b/compiler_and_linker/unsorted/CMachine.c
@@ -95,23 +95,23 @@ static StructMember stVF_float2 = {&stVF_float3, (Type *) &stfloat, NULL, 8, 0};
static StructMember stVF_float1 = {&stVF_float2, (Type *) &stfloat, NULL, 4, 0};
static StructMember stVF_float0 = {&stVF_float1, (Type *) &stfloat, NULL, 0, 0};
-TypeStruct stvectorunsignedchar = {TYPESTRUCT, 16, NULL, &stVUC_unsignedchar0, STRUCT_TYPE_4, 16};
-TypeStruct stvectorsignedchar = {TYPESTRUCT, 16, NULL, &stVSC_signedchar0, STRUCT_TYPE_5, 16};
-TypeStruct stvectorboolchar = {TYPESTRUCT, 16, NULL, &stVSC_signedchar0, STRUCT_TYPE_6, 16};
+TypeStruct stvectorunsignedchar = {TYPESTRUCT, 16, NULL, &stVUC_unsignedchar0, STRUCT_VECTOR_UCHAR, 16};
+TypeStruct stvectorsignedchar = {TYPESTRUCT, 16, NULL, &stVSC_signedchar0, STRUCT_VECTOR_SCHAR, 16};
+TypeStruct stvectorboolchar = {TYPESTRUCT, 16, NULL, &stVSC_signedchar0, STRUCT_VECTOR_BCHAR, 16};
-TypeStruct stvectorunsignedshort = {TYPESTRUCT, 16, NULL, &stVUS_unsignedshort0, STRUCT_TYPE_7, 16};
-TypeStruct stvectorsignedshort = {TYPESTRUCT, 16, NULL, &stVSS_signedshort0, STRUCT_TYPE_8, 16};
-TypeStruct stvectorboolshort = {TYPESTRUCT, 16, NULL, &stVSS_signedshort0, STRUCT_TYPE_9, 16};
+TypeStruct stvectorunsignedshort = {TYPESTRUCT, 16, NULL, &stVUS_unsignedshort0, STRUCT_VECTOR_USHORT, 16};
+TypeStruct stvectorsignedshort = {TYPESTRUCT, 16, NULL, &stVSS_signedshort0, STRUCT_VECTOR_SSHORT, 16};
+TypeStruct stvectorboolshort = {TYPESTRUCT, 16, NULL, &stVSS_signedshort0, STRUCT_VECTOR_BSHORT, 16};
-TypeStruct stvectorunsignedlong = {TYPESTRUCT, 16, NULL, &stVUL_unsignedlong0, STRUCT_TYPE_A, 16};
-TypeStruct stvectorsignedlong = {TYPESTRUCT, 16, NULL, &stVSL_signedlong0, STRUCT_TYPE_B, 16};
-TypeStruct stvectorboollong = {TYPESTRUCT, 16, NULL, &stVSL_signedlong0, STRUCT_TYPE_C, 16};
+TypeStruct stvectorunsignedlong = {TYPESTRUCT, 16, NULL, &stVUL_unsignedlong0, STRUCT_VECTOR_UINT, 16};
+TypeStruct stvectorsignedlong = {TYPESTRUCT, 16, NULL, &stVSL_signedlong0, STRUCT_VECTOR_SINT, 16};
+TypeStruct stvectorboollong = {TYPESTRUCT, 16, NULL, &stVSL_signedlong0, STRUCT_VECTOR_BINT, 16};
-TypeStruct stvectorfloat = {TYPESTRUCT, 16, NULL, &stVF_float0, STRUCT_TYPE_D, 16};
+TypeStruct stvectorfloat = {TYPESTRUCT, 16, NULL, &stVF_float0, STRUCT_VECTOR_FLOAT, 16};
-TypeStruct stvectorpixel = {TYPESTRUCT, 16, NULL, &stVUS_unsignedshort0, STRUCT_TYPE_E, 16};
+TypeStruct stvectorpixel = {TYPESTRUCT, 16, NULL, &stVUS_unsignedshort0, STRUCT_VECTOR_PIXEL, 16};
-TypeStruct stvector = {TYPESTRUCT, 16, NULL, NULL, STRUCT_TYPE_A, 16};
+TypeStruct stvector = {TYPESTRUCT, 16, NULL, NULL, STRUCT_VECTOR_UINT, 16};
static SInt32 cmach_structoffset;
static UInt8 cmach_structalign;
@@ -217,7 +217,7 @@ SInt32 CMach_AllocationAlignment(Type *type, UInt32 qual) {
align = anotheralign;
if (copts.optimizationlevel > 0) {
- if (type->type == TYPEARRAY || (type->type == TYPESTRUCT && (TYPE_STRUCT(type)->stype < STRUCT_TYPE_4 || TYPE_STRUCT(type)->stype > STRUCT_TYPE_E)) || type->type == TYPECLASS || (type->type == TYPEMEMBERPOINTER && (UInt32) type->size == 12)) {
+ if (type->type == TYPEARRAY || (type->type == TYPESTRUCT && (TYPE_STRUCT(type)->stype < STRUCT_VECTOR_UCHAR || TYPE_STRUCT(type)->stype > STRUCT_VECTOR_PIXEL)) || type->type == TYPECLASS || (type->type == TYPEMEMBERPOINTER && (UInt32) type->size == 12)) {
return (copts.min_struct_alignment > align) ? copts.min_struct_alignment : align;
}
}
@@ -581,29 +581,29 @@ void CMach_InitVectorMem(Type *type, MWVector128 val, void *mem, Boolean flag) {
switch (type->type) {
case TYPESTRUCT:
switch (TYPE_STRUCT(type)->stype) {
- case STRUCT_TYPE_4:
- case STRUCT_TYPE_5:
- case STRUCT_TYPE_6:
+ case STRUCT_VECTOR_UCHAR:
+ case STRUCT_VECTOR_SCHAR:
+ case STRUCT_VECTOR_BCHAR:
for (i = 0; i < 16; i++)
uc[i] = val.uc[i];
memcpy(mem, uc, 16);
break;
- case STRUCT_TYPE_7:
- case STRUCT_TYPE_8:
- case STRUCT_TYPE_9:
- case STRUCT_TYPE_E:
+ case STRUCT_VECTOR_USHORT:
+ case STRUCT_VECTOR_SSHORT:
+ case STRUCT_VECTOR_BSHORT:
+ case STRUCT_VECTOR_PIXEL:
for (i = 0; i < 8; i++)
us[i] = val.us[i];
memcpy(mem, us, 16);
break;
- case STRUCT_TYPE_A:
- case STRUCT_TYPE_B:
- case STRUCT_TYPE_C:
+ case STRUCT_VECTOR_UINT:
+ case STRUCT_VECTOR_SINT:
+ case STRUCT_VECTOR_BINT:
for (i = 0; i < 4; i++)
ul[i] = val.ul[i];
memcpy(mem, ul, 16);
break;
- case STRUCT_TYPE_D:
+ case STRUCT_VECTOR_FLOAT:
for (i = 0; i < 4; i++)
f[i] = val.f[i];
memcpy(mem, f, 16);
@@ -841,7 +841,7 @@ static SInt16 CMach_GetQualifiedStructAlign(const TypeStruct *tstruct, Boolean f
SInt32 align;
Boolean isFirst;
- if (tstruct->stype >= STRUCT_TYPE_4 && tstruct->stype <= STRUCT_TYPE_E)
+ if (tstruct->stype >= STRUCT_VECTOR_UCHAR && tstruct->stype <= STRUCT_VECTOR_PIXEL)
return 16;
switch (copts.structalignment) {
@@ -1030,7 +1030,7 @@ static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag) {
Boolean isWin;
SInt16 align;
- if (type->type == TYPESTRUCT && TYPE_STRUCT(type)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(type)->stype <= STRUCT_TYPE_E)
+ if (type->type == TYPESTRUCT && TYPE_STRUCT(type)->stype >= STRUCT_VECTOR_UCHAR && TYPE_STRUCT(type)->stype <= STRUCT_VECTOR_PIXEL)
return 16;
switch (copts.structalignment) {
@@ -1295,7 +1295,7 @@ static Boolean CMach_IsTrivialClass(TypeClass *tclass) {
UInt8 CMach_GetFunctionResultClass(TypeFunc *tfunc) {
switch (tfunc->functype->type) {
case TYPESTRUCT:
- if (tfunc->functype->type == TYPESTRUCT && TYPE_STRUCT(tfunc->functype)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(tfunc->functype)->stype <= STRUCT_TYPE_E)
+ if (tfunc->functype->type == TYPESTRUCT && TYPE_STRUCT(tfunc->functype)->stype >= STRUCT_VECTOR_UCHAR && TYPE_STRUCT(tfunc->functype)->stype <= STRUCT_VECTOR_PIXEL)
return 0;
case TYPECLASS:
case TYPEMEMBERPOINTER:
@@ -1308,7 +1308,7 @@ UInt8 CMach_GetFunctionResultClass(TypeFunc *tfunc) {
Boolean CMach_PassResultInHiddenArg(Type *type) {
switch (type->type) {
case TYPESTRUCT:
- if (TYPE_STRUCT(type)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(type)->stype <= STRUCT_TYPE_E)
+ if (TYPE_STRUCT(type)->stype >= STRUCT_VECTOR_UCHAR && TYPE_STRUCT(type)->stype <= STRUCT_VECTOR_PIXEL)
return 0;
else
return 1;