summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SDCCsymt.c5
-rw-r--r--src/SDCCval.c11
-rw-r--r--src/stm8/peep.c2
-rw-r--r--src/z80/gen.c30
4 files changed, 31 insertions, 17 deletions
diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c
index 71543b73a..440a84d4c 100644
--- a/src/SDCCsymt.c
+++ b/src/SDCCsymt.c
@@ -641,6 +641,8 @@ checkTypeSanity (sym_link *etype, const char *name)
if ((SPEC_NOUN (etype) == V_BITINT ||
SPEC_NOUN (etype) == V_BOOL ||
+ SPEC_NOUN (etype) == V_BIT ||
+ SPEC_NOUN (etype) == V_SBIT ||
SPEC_NOUN (etype) == V_CHAR ||
SPEC_NOUN (etype) == V_FLOAT ||
SPEC_NOUN (etype) == V_FIXED16X16 ||
@@ -653,7 +655,8 @@ checkTypeSanity (sym_link *etype, const char *name)
if ((SPEC_NOUN (etype) == V_BOOL ||
SPEC_NOUN (etype) == V_FLOAT ||
SPEC_NOUN (etype) == V_FIXED16X16 ||
- SPEC_NOUN (etype) == V_DOUBLE || SPEC_NOUN (etype) == V_VOID) && (etype->select.s.b_signed || SPEC_USIGN (etype)))
+ SPEC_NOUN (etype) == V_DOUBLE || SPEC_NOUN (etype) == V_VOID) && (etype->select.s.b_signed || SPEC_USIGN (etype)) ||
+ (SPEC_NOUN (etype) == V_BIT || SPEC_NOUN (etype) == V_SBIT) && etype->select.s.b_signed)
{ // signed or unsigned for float double or void
werror (E_SIGNED_OR_UNSIGNED_INVALID, noun, name);
}
diff --git a/src/SDCCval.c b/src/SDCCval.c
index f2210d308..76f1d31b0 100644
--- a/src/SDCCval.c
+++ b/src/SDCCval.c
@@ -763,6 +763,7 @@ checkConstantRange (sym_link *var, sym_link *lit, int op, bool exchangeLeftRight
#if 0
printf("checkConstantRange\n");
+ printf(" op = %d\n", op);
printf(" varBits = %d\n", varBits);
printf(" ulitVal = 0x%016lx\n", ulitVal);
printf(" signExtMask = 0x%016lx\n", signExtMask);
@@ -859,7 +860,7 @@ checkConstantRange (sym_link *var, sym_link *lit, int op, bool exchangeLeftRight
TYPE_TARGET_ULONGLONG minValP, maxValP, minValM, maxValM;
TYPE_TARGET_ULONGLONG opBitsMask = reBits >= sizeof(opBitsMask)*8 ? ~0ull : ((1ull << reBits)-1);
- if (IS_BOOL (var))
+ if (IS_BOOLEAN (var))
{
minValP = 0;
maxValP = 1;
@@ -974,7 +975,7 @@ checkConstantRange (sym_link *var, sym_link *lit, int op, bool exchangeLeftRight
/* signed operation */
TYPE_TARGET_LONGLONG minVal, maxVal;
- if (IS_BOOL (var))
+ if (IS_BOOLEAN (var))
{
minVal = 0;
maxVal = 1;
@@ -994,6 +995,12 @@ checkConstantRange (sym_link *var, sym_link *lit, int op, bool exchangeLeftRight
maxVal = ~(signExtMask | signMask);
}
+#if 0
+ printf(" litVal = %lld\n", litVal);
+ printf(" maxVal = %lld\n", maxVal);
+ printf(" minVal = %lld\n", minVal);
+#endif
+
switch (op)
{
case EQ_OP: /* var == lit */
diff --git a/src/stm8/peep.c b/src/stm8/peep.c
index 0bc8debcf..9e69e907f 100644
--- a/src/stm8/peep.c
+++ b/src/stm8/peep.c
@@ -366,7 +366,7 @@ stm8instructionSize(lineNode *pl)
int i = 0;
wassert (op1start);
- if(!strcmp(op1start, "a") || !strcmp(op1start, "(x)"))
+ if(!STRCASECMP(op1start, "a") || !STRCASECMP(op1start, "(x)"))
return(1);
if(!strcmp(op1start, "(y)"))
return(2);
diff --git a/src/z80/gen.c b/src/z80/gen.c
index 10d69dfca..36d63ab29 100644
--- a/src/z80/gen.c
+++ b/src/z80/gen.c
@@ -7938,7 +7938,8 @@ setupToPreserveCarry (asmop *result, asmop *left, asmop *right)
}
else if (couldDestroyCarry (result))
{
- shiftIntoPair (PAIR_HL, result);
+ if (!requiresHL (left))
+ shiftIntoPair (PAIR_HL, result);
}
}
}
@@ -8331,7 +8332,7 @@ genPlus (iCode * ic)
if (couldDestroyCarry (IC_RESULT (ic)->aop) &&
(IC_RESULT (ic)->aop == leftop || IC_RESULT (ic)->aop == rightop))
shiftIntoPair (PAIR_HL, IC_RESULT (ic)->aop);
- else if (couldDestroyCarry (rightop))
+ else if (couldDestroyCarry (rightop) && !requiresHL (leftop))
shiftIntoPair (PAIR_HL, rightop);
}
@@ -8479,12 +8480,13 @@ genPlus (iCode * ic)
i += 2;
}
else if (!maskedword && (!premoved || i) && !started && i == size - 2 && aopInReg (ic->result->aop, i, HL_IDX) &&
- aopInReg (rightop, i, C_IDX) && isRegDead (B_IDX, ic))
+ aopInReg (rightop, i, C_IDX) && isRegDead (B_IDX, ic) && leftop->regs[B_IDX] <= i + 1 &&
+ !((aopInReg (rightop, i + 1, H_IDX) || aopInReg (rightop, i + 1, L_IDX)) && leftop->regs[B_IDX] >= i))
{
if (aopInReg (rightop, i + 1, H_IDX) || aopInReg (rightop, i + 1, L_IDX))
{
- cheapMove (ASMOP_B, 0, ic->right->aop, i + 1, true);
- genMove_o (ASMOP_HL, 0, ic->left->aop, i, 2, false, true, de_dead, false, !started);
+ cheapMove (ASMOP_B, 0, rightop, i + 1, true);
+ genMove_o (ASMOP_HL, 0, leftop, i, 2, false, true, de_dead, false, !started);
}
else
{
@@ -8497,12 +8499,13 @@ genPlus (iCode * ic)
i += 2;
}
else if (!maskedword && (!premoved || i) && !started && i == size - 2 && aopInReg (IC_RESULT (ic)->aop, i, HL_IDX) &&
- aopInReg (rightop, i, E_IDX) && isRegDead (D_IDX, ic))
+ aopInReg (rightop, i, E_IDX) && isRegDead (D_IDX, ic) && leftop->regs[D_IDX] <= i + 1 &&
+ !((aopInReg (rightop, i + 1, H_IDX) || aopInReg (rightop, i + 1, L_IDX)) && leftop->regs[D_IDX] >= i))
{
if (aopInReg (rightop, i + 1, H_IDX) || aopInReg (rightop, i + 1, L_IDX))
{
- cheapMove (ASMOP_D, 0, IC_RIGHT (ic)->aop, i + 1, true);
- genMove_o (ASMOP_HL, 0, ic->left->aop, i, 2, false, true, de_dead, false, true);
+ cheapMove (ASMOP_D, 0, rightop, i + 1, true);
+ genMove_o (ASMOP_HL, 0, leftop, i, 2, false, true, de_dead, false, true);
}
else
{
@@ -8515,17 +8518,18 @@ genPlus (iCode * ic)
i += 2;
}
else if (!maskedword && (!premoved || i) && !started && i == size - 2 && aopInReg (IC_RESULT (ic)->aop, i, HL_IDX) &&
- aopInReg (leftop, i, E_IDX) && isRegDead (D_IDX, ic))
+ aopInReg (leftop, i, E_IDX) && isRegDead (D_IDX, ic) && rightop->regs[D_IDX] <= i + 1 &&
+ !((aopInReg (leftop, i + 1, H_IDX) || aopInReg (leftop, i + 1, L_IDX)) && rightop->regs[D_IDX] >= i))
{
if (aopInReg (leftop, i + 1, H_IDX) || aopInReg (leftop, i + 1, L_IDX))
{
- cheapMove (ASMOP_D, 0, IC_LEFT (ic)->aop, i + 1, true);
- fetchPairLong (PAIR_HL, IC_RIGHT (ic)->aop, 0, i);
+ cheapMove (ASMOP_D, 0, leftop, i + 1, true);
+ fetchPairLong (PAIR_HL, rightop, 0, i);
}
else
{
- fetchPairLong (PAIR_HL, IC_RIGHT (ic)->aop, 0, i);
- cheapMove (ASMOP_D, 0, IC_LEFT (ic)->aop, i + 1, true);
+ fetchPairLong (PAIR_HL, rightop, 0, i);
+ cheapMove (ASMOP_D, 0, leftop, i + 1, true);
}
emit3w (A_ADD, ASMOP_HL, ASMOP_DE);
started = true;