[hackers] [scc] [cc2-qbe] Remove int opeartions in float operands || Roberto E. Vargas Caballero
commit 23efed866d272c23266cd233f24c68a6c2f580b6
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Mar 9 09:15:28 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Mar 9 09:19:07 2017 +0100
[cc2-qbe] Remove int opeartions in float operands
Bitwise operations and modulo operations are defined only for
integers, and define them for floats is an error.
diff --git a/cc2/arch/qbe/arch.h b/cc2/arch/qbe/arch.h
index 1f20649..d6e6b05 100644
--- a/cc2/arch/qbe/arch.h
+++ b/cc2/arch/qbe/arch.h
_AT_@ -73,38 +73,24 @@ enum asmop {
ASADDS,
ASSUBS,
ASMULS,
- ASMODS,
ASDIVS,
- ASSHLS,
- ASSHRS,
ASLTS,
ASGTS,
ASLES,
ASGES,
ASEQS,
ASNES,
- ASBANDS,
- ASBORS,
- ASBXORS,
- ASCPLS,
ASADDD,
ASSUBD,
ASMULD,
- ASMODD,
ASDIVD,
- ASSHLD,
- ASSHRD,
ASLTD,
ASGTD,
ASLED,
ASGED,
ASEQD,
ASNED,
- ASBANDD,
- ASBORD,
- ASBXORD,
- ASCPLD,
ASEXTBW,
ASUEXTBW,
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index c42dfcb..515b40b 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -58,39 +58,25 @@ static char opasms[] = {
[OADD] = ASADDS,
[OSUB] = ASSUBS,
[OMUL] = ASMULS,
- [OMOD] = ASMODS,
[ODIV] = ASDIVS,
- [OSHL] = ASSHLS,
- [OSHR] = ASSHRS,
[OLT] = ASLTS,
[OGT] = ASGTS,
[OLE] = ASLES,
[OGE] = ASGES,
[OEQ] = ASEQS,
[ONE] = ASNES,
- [OBAND] = ASBANDS,
- [OBOR] = ASBORS,
- [OBXOR] = ASBXORS,
- [OCPL] = ASCPLS
};
static char opasmd[] = {
[OADD] = ASADDD,
[OSUB] = ASSUBD,
[OMUL] = ASMULD,
- [OMOD] = ASMODD,
[ODIV] = ASDIVD,
- [OSHL] = ASSHLD,
- [OSHR] = ASSHRD,
[OLT] = ASLTD,
[OGT] = ASGTD,
[OLE] = ASLED,
[OGE] = ASGED,
[OEQ] = ASEQD,
[ONE] = ASNED,
- [OBAND] = ASBANDD,
- [OBOR] = ASBORD,
- [OBXOR] = ASBXORD,
- [OCPL] = ASCPLD
};
extern Type int32type, uint32type, ptrtype;
_AT_@ -515,8 +501,9 @@ rhs(Node *np, Node *ret)
setlabel(phi->u.sym);
return ret;
- case OSHR:
case OMOD:
+ case OSHR:
+ assert(tp->flags & INTF);
case ODIV:
case OLT:
case OGT:
_AT_@ -528,13 +515,14 @@ rhs(Node *np, Node *ret)
*/
off = (tp->flags & SIGNF) == 0;
goto binary;
- case OADD:
- case OSUB:
- case OMUL:
case OSHL:
case OBAND:
case OBOR:
case OBXOR:
+ assert(tp->flags & INTF);
+ case OADD:
+ case OSUB:
+ case OMUL:
case OEQ:
case ONE:
off = 0;
_AT_@ -708,6 +696,7 @@ sethi(Node *np)
np->address = 11;
break;
case OCPL:
+ assert(np->type.flags & INTF);
np->op = OBXOR;
rp = constnode(NULL, ~(TUINT) 0, &np->type);
goto binary;
Received on Thu Mar 09 2017 - 09:31:45 CET
This archive was generated by hypermail 2.3.0
: Thu Mar 09 2017 - 09:36:19 CET