commit 28e3b95fd0357a08de74aba65d7dbdfa5dd43695
parent 59d709537fae349d525e215d568bf6184fb5af73
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 28 Dec 2024 12:07:42 +0100
cc2: Change left/right nodes naming
The name rp is used now for range pointer and it collides with
rp for right pointer. As we were not consistent because we used
rp/lp sometimes for double pointers and r/l for normal pointers
and r/l is the naming used in cc1 it makes more sense to use r/l.
Diffstat:
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/cmd/scc-cc/cc2/qbe/cgen.c b/src/cmd/scc-cc/cc2/qbe/cgen.c
@@ -139,19 +139,19 @@ static unsigned char i2f_conv[4][4][2] = {
static Node *
complex(Node *np)
{
- Node *lp = np->left, *rp = np->right;
+ Node *l = np->left, *r = np->right;
if (np->address > 10)
return np;
- if (lp)
- np->complex = lp->complex;
- if (rp) {
- int d = np->complex - rp->complex;
+ if (l)
+ np->complex = l->complex;
+ if (r) {
+ int d = np->complex - r->complex;
if (d == 0)
++np->complex;
else if (d < 0)
- np->complex = rp->complex;
+ np->complex = r->complex;
}
if (np->complex == 0)
++np->complex;
@@ -162,15 +162,15 @@ complex(Node *np)
static Node *
sethi(Node *np)
{
- Node *lp, *rp;
+ Node *l, *r;
if (!np)
return np;
np->complex = 0;
np->address = 0;
- lp = np->left;
- rp = np->right;
+ l = np->left;
+ r = np->right;
switch (np->op) {
case OAUTO:
@@ -180,21 +180,21 @@ sethi(Node *np)
np->address = 11;
break;
case OASSIG:
- assert(lp->op != OCAST);
+ assert(l->op != OCAST);
goto binary;
case OCPL:
assert(np->type.flags & INTF);
np->op = OBXOR;
- rp = constnode(NULL, ~(TUINT) 0, &np->type);
+ r = constnode(NULL, ~(TUINT) 0, &np->type);
goto binary;
default:
binary:
- lp = sethi(lp);
- rp = sethi(rp);
+ l = sethi(l);
+ r = sethi(r);
break;
}
- np->left = lp;
- np->right = rp;
+ np->left = l;
+ np->right = r;
return complex(np);
}
@@ -547,9 +547,9 @@ assignop(Type *tp)
}
static void
-rhs_rhs(Node **lp, Node **rp)
+rhs_rhs(Node **lpp, Node **rpp)
{
- Node *l = *lp, *r = *rp;
+ Node *l = *lpp, *r = *rpp;
if (l->complex >= r->complex) {
l = rhs(l);
@@ -559,13 +559,13 @@ rhs_rhs(Node **lp, Node **rp)
l = rhs(l);
}
- *lp = l, *rp = r;
+ *lpp = l, *rpp = r;
}
static void
-lhs_rhs(Node **lp, Node **rp)
+lhs_rhs(Node **lpp, Node **rpp)
{
- Node *l = *lp, *r = *rp;
+ Node *l = *lpp, *r = *rpp;
if (l->complex >= r->complex) {
l = lhs(l);
@@ -575,7 +575,7 @@ lhs_rhs(Node **lp, Node **rp)
l = lhs(l);
}
- *lp = l, *rp = r;
+ *lpp = l, *rpp = r;
}
static Node *
diff --git a/src/cmd/scc-cc/cc2/z80-scc/cgen.c b/src/cmd/scc-cc/cc2/z80-scc/cgen.c
@@ -570,15 +570,15 @@ cgen(Node *np)
static Node *
sethi(Node *np)
{
- Node *lp, *rp;
+ Node *l, *r;
if (!np)
return np;
np->complex = 0;
np->address = 0;
- lp = np->left;
- rp = np->right;
+ l = np->left;
+ r = np->right;
switch (np->op) {
case OAUTO:
np->address = 11;
@@ -593,22 +593,22 @@ sethi(Node *np)
np->address = 20;
break;
default:
- sethi(lp);
- sethi(rp);
+ sethi(l);
+ sethi(r);
break;
}
if (np->address > 10)
return np;
- if (lp)
- np->complex = lp->complex;
- if (rp) {
- int d = np->complex - rp->complex;
+ if (l)
+ np->complex = l->complex;
+ if (r) {
+ int d = np->complex - r->complex;
if (d == 0)
++np->complex;
else if (d < 0)
- np->complex = rp->complex;
+ np->complex = r->complex;
}
if (np->complex == 0)
++np->complex;