scc

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

commit c65ba1f014232a19cd2b4d27f1a06dc18b9c4c2d
parent ffbd94a13592c386a30ba1c8e09364c7c003cdb2
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  4 Sep 2015 19:57:05 +0200

Remove eval()

This function was added to transform comparision or logic
expressions in arithmetic expressions using ternary
operations. This transformation is needed in a z80,
but not in a amd64, and it makes difficult to apply
algebraic transformations.

Diffstat:
cc1/expr.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -284,12 +284,13 @@ pcompare(char op, Node *lp, Node *rp) static Node * compare(char op, Node *lp, Node *rp) { - lp = promote(decay(lp)); - rp = promote(decay(rp)); + lp = decay(lp); + rp = decay(rp); + switch (BTYPE(lp)) { case INT: case FLOAT: - switch (BTYPE(lp)) { + switch (BTYPE(rp)) { case INT: case FLOAT: typeconv(&lp, &rp);