ref: 6951768c2d14176b68ab6b514ff2b0684df6d045
parent: 359e72e4eb64218746f39b969a6a75b4d83ff9c7
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Sep 16 09:55:13 EDT 2016
[cc2] Add FLOATF flag In some situations is better to check against float instead of checking against integers.
--- a/cc2/arch/amd64-sysv/types.c
+++ b/cc2/arch/amd64-sysv/types.c
@@ -64,16 +64,19 @@
};
Type float32type = {
+ .flags = FLOATF,
.size = 4,
.align = 4
};
Type float64type = {
+ .flags = FLOATF,
.size = 8,
.align = 8
};
Type float80type = {
+ .flags = FLOATF,
.size = 16,
.align = 16
};
--- a/cc2/arch/i386-sysv/types.c
+++ b/cc2/arch/i386-sysv/types.c
@@ -64,16 +64,19 @@
};
Type float32type = {
+ .flags = FLOATF,
.size = 4,
.align = 4
};
Type float64type = {
+ .flags = FLOATF,
.size = 8,
.align = 4
};
Type float80type = {
+ .flags = FLOATF,
.size = 12,
.align = 4
};
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -121,10 +121,10 @@
op = ASLDH;
break;
case 4:
- op = (tp->flags & INTF) ? ASLDW : ASLDS;
+ op = (tp->flags & FLOATF) ? ASLDS : ASLDW;
break;
case 8:
- op = (tp->flags & INTF) ? ASLDL : ASLDD;
+ op = (tp->flags & FLOATF) ? ASLDD : ASLDL;
break;
default:
*new = *np;
@@ -267,10 +267,10 @@
op = ASSTH;
break;
case 4:
- op = (tp->flags & INTF) ? ASSTW : ASSTS;
+ op = (tp->flags & FLOATF) ? ASSTS : ASSTW;
break;
case 8:
- op = (tp->flags & INTF) ? ASSTL : ASSTD;
+ op = (tp->flags & FLOATF) ? ASSTD : ASSTL;
break;
default:
abort();
@@ -480,10 +480,10 @@
}
switch (tp->size) {
case 4:
- tbl = (tp->flags & INTF) ? opasmw : opasms;
+ tbl = (tp->flags & FLOATF) ? opasms : opasmw;
break;
case 8:
- tbl = (tp->flags & INTF) ? opasml : opasmd;
+ tbl = (tp->flags & FLOATF) ? opasmd : opasml;
break;
default:
abort();
--- a/cc2/arch/qbe/types.c
+++ b/cc2/arch/qbe/types.c
@@ -64,16 +64,19 @@
};
Type float32type = {
+ .flags = FLOATF,
.size = 4,
.align = 4
};
Type float64type = {
+ .flags = FLOATF,
.size = 8,
.align = 8
};
Type float80type = {
+ .flags = FLOATF,
.size = 16,
.align = 16
};
--- a/cc2/arch/z80/types.c
+++ b/cc2/arch/z80/types.c
@@ -64,16 +64,19 @@
};
Type float32type = {
+ .flags = FLOATF,
.size = 4,
.align = 1
};
Type float64type = {
+ .flags = FLOATF,
.size = 4,
.align = 1
};
Type float80type = {
+ .flags = FLOATF,
.size = 4,
.align = 1
};
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -5,9 +5,10 @@
};
enum tflags {
- SIGNF = 1,
- INTF = 2,
- STRF = 8,
+ SIGNF = 1,
+ INTF = 2,
+ FLOATF = 4,
+ STRF = 8,
UNIONF = 16,
FUNF = 32,
PARF = 64,