mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-05 07:28:18 +00:00
Added initial support for special BYTE2() and BYTE3() unary operators giving access to specific bytes. #221
This commit is contained in:
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
@@ -1 +0,0 @@
|
||||
lda #0
|
1
src/main/fragment/mos6502-common/vbuaa=_byte2_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuaa=_byte2_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
lda {m1}+2
|
1
src/main/fragment/mos6502-common/vbuaa=_byte2_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuaa=_byte2_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
lda {m1}+2
|
1
src/main/fragment/mos6502-common/vbuaa=_byte3_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuaa=_byte3_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
lda {m1}+3
|
1
src/main/fragment/mos6502-common/vbuaa=_byte3_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuaa=_byte3_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
lda {m1}+3
|
@@ -1 +0,0 @@
|
||||
ldx #0
|
@@ -1 +0,0 @@
|
||||
ldx #0
|
@@ -1 +0,0 @@
|
||||
ldx #0
|
@@ -1 +0,0 @@
|
||||
ldx #0
|
1
src/main/fragment/mos6502-common/vbuxx=_byte2_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuxx=_byte2_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldx {m1}+2
|
1
src/main/fragment/mos6502-common/vbuxx=_byte2_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuxx=_byte2_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldx {m1}+2
|
1
src/main/fragment/mos6502-common/vbuxx=_byte3_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuxx=_byte3_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldx {m1}+3
|
1
src/main/fragment/mos6502-common/vbuxx=_byte3_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuxx=_byte3_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldx {m1}+3
|
@@ -1 +0,0 @@
|
||||
ldy #0
|
@@ -1 +0,0 @@
|
||||
ldy #0
|
@@ -1 +0,0 @@
|
||||
ldy #0
|
@@ -1 +0,0 @@
|
||||
ldy #0
|
1
src/main/fragment/mos6502-common/vbuyy=_byte2_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuyy=_byte2_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldy {m1}+2
|
1
src/main/fragment/mos6502-common/vbuyy=_byte2_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuyy=_byte2_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldy {m1}+2
|
1
src/main/fragment/mos6502-common/vbuyy=_byte3_vdsm1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuyy=_byte3_vdsm1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldy {m1}+3
|
1
src/main/fragment/mos6502-common/vbuyy=_byte3_vdum1.asm
Normal file
1
src/main/fragment/mos6502-common/vbuyy=_byte3_vdum1.asm
Normal file
@@ -0,0 +1 @@
|
||||
ldy {m1}+3
|
@@ -216,6 +216,10 @@ public class AsmFormat {
|
||||
return operator.getOperator() + "(" + getAsmConstant(program, operand, operator.getPrecedence(), codeScope) + ")";
|
||||
} else if(Operators.BYTE1.equals(operator)) {
|
||||
return operator.getOperator() + "(" + getAsmConstant(program, operand, operator.getPrecedence(), codeScope) + ")";
|
||||
} else if(Operators.BYTE2.equals(operator)) {
|
||||
return "<" + "(" + getAsmConstant(program, new ConstantBinary(operand, Operators.SHIFT_RIGHT, new ConstantInteger((long) 16)), operator.getPrecedence(), codeScope) + ")";
|
||||
} else if(Operators.BYTE3.equals(operator)) {
|
||||
return "<" + "(" + getAsmConstant(program, new ConstantBinary(operand, Operators.SHIFT_RIGHT, new ConstantInteger((long) 24)), operator.getPrecedence(), codeScope) + ")";
|
||||
} else if(Operators.INCREMENT.equals(operator)) {
|
||||
return getAsmConstant(program, new ConstantBinary(operand, Operators.PLUS, new ConstantInteger((long) 1)), outerPrecedence, codeScope);
|
||||
} else if(Operators.DECREMENT.equals(operator)) {
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.ConstantNotLiteral;
|
||||
import dk.camelot64.kickc.model.symbols.ProgramScope;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.values.ConstantInteger;
|
||||
import dk.camelot64.kickc.model.values.ConstantLiteral;
|
||||
import dk.camelot64.kickc.model.values.ConstantPointer;
|
||||
import dk.camelot64.kickc.model.values.ConstantString;
|
||||
|
||||
/** Unary get byte 2 operator byte2(x) */
|
||||
public class OperatorGetByte2 extends OperatorUnary {
|
||||
|
||||
public OperatorGetByte2(int precedence) {
|
||||
super("_byte2_", "_byte2_", precedence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstantLiteral calculateLiteral(ConstantLiteral operand, ProgramScope scope) {
|
||||
if(operand instanceof ConstantInteger) {
|
||||
ConstantInteger operandInt = (ConstantInteger) operand;
|
||||
return new ConstantInteger((operandInt.getInteger()>>16)&0xff, SymbolType.BYTE);
|
||||
} else if(operand instanceof ConstantPointer) {
|
||||
return new ConstantInteger((((ConstantPointer) operand).getLocation()>>16) & 0xff, SymbolType.BYTE);
|
||||
} else if(operand instanceof ConstantString) {
|
||||
throw ConstantNotLiteral.getException();
|
||||
}
|
||||
throw ConstantNotLiteral.getException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolType inferType(SymbolType operandType) {
|
||||
return SymbolType.BYTE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package dk.camelot64.kickc.model.operators;
|
||||
|
||||
import dk.camelot64.kickc.model.ConstantNotLiteral;
|
||||
import dk.camelot64.kickc.model.symbols.ProgramScope;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.values.ConstantInteger;
|
||||
import dk.camelot64.kickc.model.values.ConstantLiteral;
|
||||
import dk.camelot64.kickc.model.values.ConstantPointer;
|
||||
import dk.camelot64.kickc.model.values.ConstantString;
|
||||
|
||||
/** Unary get byte 3 operator byte3(x) */
|
||||
public class OperatorGetByte3 extends OperatorUnary {
|
||||
|
||||
public OperatorGetByte3(int precedence) {
|
||||
super("_byte3_", "_byte3_", precedence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstantLiteral calculateLiteral(ConstantLiteral operand, ProgramScope scope) {
|
||||
if(operand instanceof ConstantInteger) {
|
||||
ConstantInteger operandInt = (ConstantInteger) operand;
|
||||
return new ConstantInteger((operandInt.getInteger()>>24)&0xff, SymbolType.BYTE);
|
||||
} else if(operand instanceof ConstantPointer) {
|
||||
return new ConstantInteger((((ConstantPointer) operand).getLocation()>>24) & 0xff, SymbolType.BYTE);
|
||||
} else if(operand instanceof ConstantString) {
|
||||
throw ConstantNotLiteral.getException();
|
||||
}
|
||||
throw ConstantNotLiteral.getException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolType inferType(SymbolType operandType) {
|
||||
return SymbolType.BYTE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -42,8 +42,8 @@ public class Operators {
|
||||
public static final OperatorUnary HIBYTE = new OperatorGetHigh(14);
|
||||
public static final OperatorUnary BYTE0 = new OperatorGetByte0(14);
|
||||
public static final OperatorUnary BYTE1 = new OperatorGetByte1(14);
|
||||
//public static final OperatorUnary BYTE2 = new OperatorGetByte2(14);
|
||||
//public static final OperatorUnary BYTE3 = new OperatorGetByte3(14);
|
||||
public static final OperatorUnary BYTE2 = new OperatorGetByte2(14);
|
||||
public static final OperatorUnary BYTE3 = new OperatorGetByte3(14);
|
||||
public static final OperatorBinary LT = new OperatorLessThan(7);
|
||||
public static final OperatorBinary LE = new OperatorLessThanEqual(7);
|
||||
public static final OperatorBinary GT = new OperatorGreaterThan(7);
|
||||
|
@@ -37,7 +37,13 @@ public class Procedure extends Scope {
|
||||
private boolean isConstructor;
|
||||
|
||||
/** The names of all legal intrinsic procedures. */
|
||||
final public static List<String> INTRINSIC_PROCEDURES = Arrays.asList(Pass1PrintfIntrinsicRewrite.INTRINSIC_PRINTF_NAME, Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE0_NAME, Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE1_NAME );
|
||||
final public static List<String> INTRINSIC_PROCEDURES = Arrays.asList(
|
||||
Pass1PrintfIntrinsicRewrite.INTRINSIC_PRINTF_NAME,
|
||||
Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE0_NAME,
|
||||
Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE1_NAME,
|
||||
Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE2_NAME,
|
||||
Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE3_NAME
|
||||
);
|
||||
|
||||
/** The method for passing parameters and return value to the procedure. */
|
||||
public enum CallingConvention {
|
||||
|
@@ -22,6 +22,10 @@ public class Pass1ByteXIntrinsicRewrite extends Pass2SsaOptimization {
|
||||
public static final String INTRINSIC_BYTE0_NAME = "BYTE0";
|
||||
/** The byte1 procedure name. */
|
||||
public static final String INTRINSIC_BYTE1_NAME = "BYTE1";
|
||||
/** The byte2 procedure name. */
|
||||
public static final String INTRINSIC_BYTE2_NAME = "BYTE2";
|
||||
/** The byte3 procedure name. */
|
||||
public static final String INTRINSIC_BYTE3_NAME = "BYTE3";
|
||||
|
||||
public Pass1ByteXIntrinsicRewrite(Program program) {
|
||||
super(program);
|
||||
@@ -40,6 +44,10 @@ public class Pass1ByteXIntrinsicRewrite extends Pass2SsaOptimization {
|
||||
generateUnaryOperator(stmtIt, call, parameters, Operators.BYTE0);
|
||||
} else if(INTRINSIC_BYTE1_NAME.equals(call.getProcedureName())) {
|
||||
generateUnaryOperator(stmtIt, call, parameters, Operators.BYTE1);
|
||||
} else if(INTRINSIC_BYTE2_NAME.equals(call.getProcedureName())) {
|
||||
generateUnaryOperator(stmtIt, call, parameters, Operators.BYTE2);
|
||||
} else if(INTRINSIC_BYTE3_NAME.equals(call.getProcedureName())) {
|
||||
generateUnaryOperator(stmtIt, call, parameters, Operators.BYTE3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeInference;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypePointer;
|
||||
import dk.camelot64.kickc.model.values.ConstantInteger;
|
||||
import dk.camelot64.kickc.model.values.ConstantSymbolPointer;
|
||||
import dk.camelot64.kickc.model.values.ConstantValue;
|
||||
import dk.camelot64.kickc.model.values.SymbolRef;
|
||||
@@ -78,6 +80,22 @@ public class Pass2ConstantRValueConsolidation extends Pass2SsaOptimization {
|
||||
(OperatorBinary) assignment.getOperator(),
|
||||
Pass2ConstantIdentification.getConstant(assignment.getrValue2()),
|
||||
getScope());
|
||||
} else if(Operators.BYTE1.equals(assignment.getOperator()) && assignment.getrValue1() == null) {
|
||||
final SymbolType rVal2Type = SymbolTypeInference.inferType(getScope(), assignment.getrValue2());
|
||||
if(SymbolType.isInteger(rVal2Type) && rVal2Type.getSizeBytes() < 2)
|
||||
return new ConstantInteger(0l, SymbolType.BYTE);
|
||||
} else if(Operators.BYTE2.equals(assignment.getOperator()) && assignment.getrValue1() == null) {
|
||||
final SymbolType rVal2Type = SymbolTypeInference.inferType(getScope(), assignment.getrValue2());
|
||||
if(SymbolType.isInteger(rVal2Type) && rVal2Type.getSizeBytes() < 3)
|
||||
return new ConstantInteger(0l, SymbolType.BYTE);
|
||||
else if(rVal2Type instanceof SymbolTypePointer)
|
||||
return new ConstantInteger(0l, SymbolType.BYTE);
|
||||
} else if(Operators.BYTE3.equals(assignment.getOperator()) && assignment.getrValue1() == null) {
|
||||
final SymbolType rVal2Type = SymbolTypeInference.inferType(getScope(), assignment.getrValue2());
|
||||
if(SymbolType.isInteger(rVal2Type) && rVal2Type.getSizeBytes() < 4)
|
||||
return new ConstantInteger(0l, SymbolType.BYTE);
|
||||
else if(rVal2Type instanceof SymbolTypePointer)
|
||||
return new ConstantInteger(0l, SymbolType.BYTE);
|
||||
} else if(Operators.ADDRESS_OF.equals(assignment.getOperator()) && assignment.getrValue1() == null) {
|
||||
// Constant address-of variable
|
||||
if(assignment.getrValue2() instanceof SymbolRef) {
|
||||
|
@@ -44,6 +44,15 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperatorByte3() throws IOException, URISyntaxException {
|
||||
compileAndCompare("operator-byte3.c", log());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperatorByte2() throws IOException, URISyntaxException {
|
||||
compileAndCompare("operator-byte2.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperatorByte1() throws IOException, URISyntaxException {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Test operator BYTE0()
|
||||
// Test operator BYTE1()
|
||||
|
||||
void main() {
|
||||
volatile unsigned char bu = 7;
|
||||
|
24
src/test/kc/operator-byte2.c
Normal file
24
src/test/kc/operator-byte2.c
Normal file
@@ -0,0 +1,24 @@
|
||||
// Test operator BYTE2()
|
||||
|
||||
void main() {
|
||||
volatile unsigned char bu = 7;
|
||||
volatile signed char bs = 7;
|
||||
volatile unsigned int wu = 20000;
|
||||
volatile signed int ws = -177;
|
||||
volatile unsigned long du = 2000000;
|
||||
volatile signed long ds = -3777777;
|
||||
char * volatile ptr = 0x0000;
|
||||
|
||||
char * const SCREEN = 0x0400;
|
||||
char i = 0;
|
||||
SCREEN[i++] = BYTE2(17);
|
||||
SCREEN[i++] = BYTE2(377);
|
||||
SCREEN[i++] = BYTE2(377777);
|
||||
SCREEN[i++] = BYTE2(bu);
|
||||
SCREEN[i++] = BYTE2(bs);
|
||||
SCREEN[i++] = BYTE2(wu);
|
||||
SCREEN[i++] = BYTE2(ws);
|
||||
SCREEN[i++] = BYTE2(du);
|
||||
SCREEN[i++] = BYTE2(ds);
|
||||
SCREEN[i++] = BYTE2(ptr);
|
||||
}
|
24
src/test/kc/operator-byte3.c
Normal file
24
src/test/kc/operator-byte3.c
Normal file
@@ -0,0 +1,24 @@
|
||||
// Test operator BYTE3()
|
||||
|
||||
void main() {
|
||||
volatile unsigned char bu = 7;
|
||||
volatile signed char bs = 7;
|
||||
volatile unsigned int wu = 20000;
|
||||
volatile signed int ws = -177;
|
||||
volatile unsigned long du = 2000000;
|
||||
volatile signed long ds = -3777777;
|
||||
char * volatile ptr = 0x0000;
|
||||
|
||||
char * const SCREEN = 0x0400;
|
||||
char i = 0;
|
||||
SCREEN[i++] = BYTE3(17);
|
||||
SCREEN[i++] = BYTE3(377);
|
||||
SCREEN[i++] = BYTE3(333377777);
|
||||
SCREEN[i++] = BYTE3(bu);
|
||||
SCREEN[i++] = BYTE3(bs);
|
||||
SCREEN[i++] = BYTE3(wu);
|
||||
SCREEN[i++] = BYTE3(ws);
|
||||
SCREEN[i++] = BYTE3(du);
|
||||
SCREEN[i++] = BYTE3(ds);
|
||||
SCREEN[i++] = BYTE3(ptr);
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
// Test operator BYTE0()
|
||||
// Test operator BYTE1()
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte1.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
@@ -10,18 +10,11 @@
|
||||
.segment Code
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
sta.z bs
|
||||
.label wu = 2
|
||||
.label ws = 4
|
||||
.label du = 6
|
||||
.label ds = $a
|
||||
.label ptr = $e
|
||||
// wu = 20000
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
@@ -59,11 +52,9 @@ main: {
|
||||
// SCREEN[i++] = BYTE1(377)
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// BYTE1(bu)
|
||||
lda #0
|
||||
// SCREEN[i++] = BYTE1(bu)
|
||||
lda #0
|
||||
sta SCREEN+2
|
||||
// BYTE1(bs)
|
||||
// SCREEN[i++] = BYTE1(bs)
|
||||
sta SCREEN+3
|
||||
// BYTE1(wu)
|
||||
|
@@ -1,30 +1,26 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = 0
|
||||
[8] *(main::SCREEN+1) = >$179
|
||||
[9] main::$2 = > main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = > main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = > main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = > main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = > main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = > main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = > main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
[0] main::wu = $4e20
|
||||
[1] main::ws = -$b1
|
||||
[2] main::du = $1e8480
|
||||
[3] main::ds = -$39a4f1
|
||||
[4] main::ptr = (byte*) 0
|
||||
[5] *main::SCREEN = 0
|
||||
[6] *(main::SCREEN+1) = >$179
|
||||
[7] *(main::SCREEN+2) = 0
|
||||
[8] *(main::SCREEN+3) = 0
|
||||
[9] main::$4 = > main::wu
|
||||
[10] *(main::SCREEN+4) = main::$4
|
||||
[11] main::$5 = > main::ws
|
||||
[12] *(main::SCREEN+5) = main::$5
|
||||
[13] main::$6 = > main::du
|
||||
[14] *(main::SCREEN+6) = main::$6
|
||||
[15] main::$7 = > main::ds
|
||||
[16] *(main::SCREEN+7) = main::$7
|
||||
[17] main::$8 = > main::ptr
|
||||
[18] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
[19] return
|
||||
to:@return
|
||||
|
@@ -90,51 +90,57 @@ Simplifying constant pointer cast (byte*) 0
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Constant right-side identified [8] main::$0 = > $11
|
||||
Constant right-side identified [11] main::$1 = > $179
|
||||
Constant right-side identified [14] main::$2 = > main::bu
|
||||
Constant right-side identified [17] main::$3 = > main::bs
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = >$11
|
||||
Constant main::$1 = >$179
|
||||
Constant main::$2 = 0
|
||||
Constant main::$3 = 0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Simplifying constant evaluating to zero >$11 in
|
||||
Successful SSA optimization PassNSimplifyConstantZero
|
||||
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
Eliminating unused variable main::i#9 and assignment [31] main::i#9 = ++ main::i#8
|
||||
Eliminating unused variable main::bu and assignment [0] main::bu = 7
|
||||
Eliminating unused variable main::bs and assignment [1] main::bs = 7
|
||||
Eliminating unused variable main::i#9 and assignment [29] main::i#9 = ++ main::i#8
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Removing unused procedure __start
|
||||
Removing unused procedure block __start
|
||||
Removing unused procedure block __start::@1
|
||||
Removing unused procedure block __start::@return
|
||||
Successful SSA optimization PassNEliminateEmptyStart
|
||||
Constant right-side identified [8] main::i#1 = ++ main::i#0
|
||||
Constant right-side identified [6] main::i#1 = ++ main::i#0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#1 = ++main::i#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [9] main::i#2 = ++ main::i#1
|
||||
Constant right-side identified [7] main::i#2 = ++ main::i#1
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#2 = ++main::i#1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [11] main::i#3 = ++ main::i#2
|
||||
Constant right-side identified [8] main::i#3 = ++ main::i#2
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#3 = ++main::i#2
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [13] main::i#4 = ++ main::i#3
|
||||
Constant right-side identified [9] main::i#4 = ++ main::i#3
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#4 = ++main::i#3
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [15] main::i#5 = ++ main::i#4
|
||||
Constant right-side identified [11] main::i#5 = ++ main::i#4
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#5 = ++main::i#4
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [17] main::i#6 = ++ main::i#5
|
||||
Constant right-side identified [13] main::i#6 = ++ main::i#5
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#6 = ++main::i#5
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [19] main::i#7 = ++ main::i#6
|
||||
Constant right-side identified [15] main::i#7 = ++ main::i#6
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#7 = ++main::i#6
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [21] main::i#8 = ++ main::i#7
|
||||
Constant right-side identified [17] main::i#8 = ++ main::i#7
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#8 = ++main::i#7
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
@@ -149,13 +155,15 @@ Inlining constant with different constant siblings main::i#7
|
||||
Inlining constant with different constant siblings main::i#8
|
||||
Constant inlined main::i#8 = ++++++++++++++++0
|
||||
Constant inlined main::i#7 = ++++++++++++++0
|
||||
Constant inlined main::$1 = >$179
|
||||
Constant inlined main::i#4 = ++++++++0
|
||||
Constant inlined main::i#3 = ++++++0
|
||||
Constant inlined main::i#6 = ++++++++++++0
|
||||
Constant inlined main::$0 = 0
|
||||
Constant inlined main::i#5 = ++++++++++0
|
||||
Constant inlined main::$1 = >$179
|
||||
Constant inlined main::$2 = 0
|
||||
Constant inlined main::$0 = 0
|
||||
Constant inlined main::i#0 = 0
|
||||
Constant inlined main::$3 = 0
|
||||
Constant inlined main::i#2 = ++++0
|
||||
Constant inlined main::i#1 = ++0
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
@@ -196,143 +204,111 @@ FINAL CONTROL FLOW GRAPH
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = 0
|
||||
[8] *(main::SCREEN+1) = >$179
|
||||
[9] main::$2 = > main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = > main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = > main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = > main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = > main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = > main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = > main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
[0] main::wu = $4e20
|
||||
[1] main::ws = -$b1
|
||||
[2] main::du = $1e8480
|
||||
[3] main::ds = -$39a4f1
|
||||
[4] main::ptr = (byte*) 0
|
||||
[5] *main::SCREEN = 0
|
||||
[6] *(main::SCREEN+1) = >$179
|
||||
[7] *(main::SCREEN+2) = 0
|
||||
[8] *(main::SCREEN+3) = 0
|
||||
[9] main::$4 = > main::wu
|
||||
[10] *(main::SCREEN+4) = main::$4
|
||||
[11] main::$5 = > main::ws
|
||||
[12] *(main::SCREEN+5) = main::$5
|
||||
[13] main::$6 = > main::du
|
||||
[14] *(main::SCREEN+6) = main::$6
|
||||
[15] main::$7 = > main::ds
|
||||
[16] *(main::SCREEN+7) = main::$7
|
||||
[17] main::$8 = > main::ptr
|
||||
[18] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
[19] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte~ main::$2 4.0
|
||||
byte~ main::$3 4.0
|
||||
byte~ main::$4 4.0
|
||||
byte~ main::$5 4.0
|
||||
byte~ main::$6 4.0
|
||||
byte~ main::$7 4.0
|
||||
byte~ main::$8 4.0
|
||||
volatile signed byte main::bs loadstore 0.4
|
||||
volatile byte main::bu loadstore 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore 0.2857142857142857
|
||||
volatile dword main::du loadstore 0.3076923076923077
|
||||
volatile signed dword main::ds loadstore 0.3333333333333333
|
||||
volatile dword main::du loadstore 0.36363636363636365
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore 0.26666666666666666
|
||||
volatile signed word main::ws loadstore 0.3333333333333333
|
||||
volatile word main::wu loadstore 0.36363636363636365
|
||||
volatile byte* main::ptr loadstore 0.3076923076923077
|
||||
volatile signed word main::ws loadstore 0.4
|
||||
volatile word main::wu loadstore 0.4444444444444444
|
||||
|
||||
Initial phi equivalence classes
|
||||
Added variable main::bu to live range equivalence class [ main::bu ]
|
||||
Added variable main::bs to live range equivalence class [ main::bs ]
|
||||
Added variable main::wu to live range equivalence class [ main::wu ]
|
||||
Added variable main::ws to live range equivalence class [ main::ws ]
|
||||
Added variable main::du to live range equivalence class [ main::du ]
|
||||
Added variable main::ds to live range equivalence class [ main::ds ]
|
||||
Added variable main::ptr to live range equivalence class [ main::ptr ]
|
||||
Added variable main::$2 to live range equivalence class [ main::$2 ]
|
||||
Added variable main::$3 to live range equivalence class [ main::$3 ]
|
||||
Added variable main::$4 to live range equivalence class [ main::$4 ]
|
||||
Added variable main::$5 to live range equivalence class [ main::$5 ]
|
||||
Added variable main::$6 to live range equivalence class [ main::$6 ]
|
||||
Added variable main::$7 to live range equivalence class [ main::$7 ]
|
||||
Added variable main::$8 to live range equivalence class [ main::$8 ]
|
||||
Complete equivalence classes
|
||||
[ main::bu ]
|
||||
[ main::bs ]
|
||||
[ main::wu ]
|
||||
[ main::ws ]
|
||||
[ main::du ]
|
||||
[ main::ds ]
|
||||
[ main::ptr ]
|
||||
[ main::$2 ]
|
||||
[ main::$3 ]
|
||||
[ main::$4 ]
|
||||
[ main::$5 ]
|
||||
[ main::$6 ]
|
||||
[ main::$7 ]
|
||||
[ main::$8 ]
|
||||
Allocated zp[1]:2 [ main::bu ]
|
||||
Allocated zp[1]:3 [ main::bs ]
|
||||
Allocated zp[2]:4 [ main::wu ]
|
||||
Allocated zp[2]:6 [ main::ws ]
|
||||
Allocated zp[4]:8 [ main::du ]
|
||||
Allocated zp[4]:12 [ main::ds ]
|
||||
Allocated zp[2]:16 [ main::ptr ]
|
||||
Allocated zp[1]:18 [ main::$2 ]
|
||||
Allocated zp[1]:19 [ main::$3 ]
|
||||
Allocated zp[1]:20 [ main::$4 ]
|
||||
Allocated zp[1]:21 [ main::$5 ]
|
||||
Allocated zp[1]:22 [ main::$6 ]
|
||||
Allocated zp[1]:23 [ main::$7 ]
|
||||
Allocated zp[1]:24 [ main::$8 ]
|
||||
Allocated zp[2]:2 [ main::wu ]
|
||||
Allocated zp[2]:4 [ main::ws ]
|
||||
Allocated zp[4]:6 [ main::du ]
|
||||
Allocated zp[4]:10 [ main::ds ]
|
||||
Allocated zp[2]:14 [ main::ptr ]
|
||||
Allocated zp[1]:16 [ main::$4 ]
|
||||
Allocated zp[1]:17 [ main::$5 ]
|
||||
Allocated zp[1]:18 [ main::$6 ]
|
||||
Allocated zp[1]:19 [ main::$7 ]
|
||||
Allocated zp[1]:20 [ main::$8 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] main::bu = 7 [ main::bu ] ( [ main::bu ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::bs = 7 [ main::bu main::bs ] ( [ main::bu main::bs ] { } ) always clobbers reg byte a
|
||||
Statement [2] main::wu = $4e20 [ main::bu main::bs main::wu ] ( [ main::bu main::bs main::wu ] { } ) always clobbers reg byte a
|
||||
Statement [3] main::ws = -$b1 [ main::bu main::bs main::wu main::ws ] ( [ main::bu main::bs main::wu main::ws ] { } ) always clobbers reg byte a
|
||||
Statement [4] main::du = $1e8480 [ main::bu main::bs main::wu main::ws main::du ] ( [ main::bu main::bs main::wu main::ws main::du ] { } ) always clobbers reg byte a
|
||||
Statement [5] main::ds = -$39a4f1 [ main::bu main::bs main::wu main::ws main::du main::ds ] ( [ main::bu main::bs main::wu main::ws main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [6] main::ptr = (byte*) 0 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [7] *main::SCREEN = 0 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+1) = >$179 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[1]:2 [ main::bu ] : zp[1]:2 ,
|
||||
Potential registers zp[1]:3 [ main::bs ] : zp[1]:3 ,
|
||||
Potential registers zp[2]:4 [ main::wu ] : zp[2]:4 ,
|
||||
Potential registers zp[2]:6 [ main::ws ] : zp[2]:6 ,
|
||||
Potential registers zp[4]:8 [ main::du ] : zp[4]:8 ,
|
||||
Potential registers zp[4]:12 [ main::ds ] : zp[4]:12 ,
|
||||
Potential registers zp[2]:16 [ main::ptr ] : zp[2]:16 ,
|
||||
Potential registers zp[1]:18 [ main::$2 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:19 [ main::$3 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:20 [ main::$4 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:21 [ main::$5 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:22 [ main::$6 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:23 [ main::$7 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:24 [ main::$8 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y ,
|
||||
Statement [0] main::wu = $4e20 [ main::wu ] ( [ main::wu ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::ws = -$b1 [ main::wu main::ws ] ( [ main::wu main::ws ] { } ) always clobbers reg byte a
|
||||
Statement [2] main::du = $1e8480 [ main::wu main::ws main::du ] ( [ main::wu main::ws main::du ] { } ) always clobbers reg byte a
|
||||
Statement [3] main::ds = -$39a4f1 [ main::wu main::ws main::du main::ds ] ( [ main::wu main::ws main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [4] main::ptr = (byte*) 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [5] *main::SCREEN = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [6] *(main::SCREEN+1) = >$179 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [7] *(main::SCREEN+2) = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+3) = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[2]:2 [ main::wu ] : zp[2]:2 ,
|
||||
Potential registers zp[2]:4 [ main::ws ] : zp[2]:4 ,
|
||||
Potential registers zp[4]:6 [ main::du ] : zp[4]:6 ,
|
||||
Potential registers zp[4]:10 [ main::ds ] : zp[4]:10 ,
|
||||
Potential registers zp[2]:14 [ main::ptr ] : zp[2]:14 ,
|
||||
Potential registers zp[1]:16 [ main::$4 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:17 [ main::$5 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:18 [ main::$6 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:19 [ main::$7 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:20 [ main::$8 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 4: zp[1]:18 [ main::$2 ] 4: zp[1]:19 [ main::$3 ] 4: zp[1]:20 [ main::$4 ] 4: zp[1]:21 [ main::$5 ] 4: zp[1]:22 [ main::$6 ] 4: zp[1]:23 [ main::$7 ] 4: zp[1]:24 [ main::$8 ] 0.44: zp[1]:2 [ main::bu ] 0.4: zp[1]:3 [ main::bs ] 0.36: zp[2]:4 [ main::wu ] 0.33: zp[2]:6 [ main::ws ] 0.31: zp[4]:8 [ main::du ] 0.29: zp[4]:12 [ main::ds ] 0.27: zp[2]:16 [ main::ptr ]
|
||||
Uplift Scope [main] 4: zp[1]:16 [ main::$4 ] 4: zp[1]:17 [ main::$5 ] 4: zp[1]:18 [ main::$6 ] 4: zp[1]:19 [ main::$7 ] 4: zp[1]:20 [ main::$8 ] 0.44: zp[2]:2 [ main::wu ] 0.4: zp[2]:4 [ main::ws ] 0.36: zp[4]:6 [ main::du ] 0.33: zp[4]:10 [ main::ds ] 0.31: zp[2]:14 [ main::ptr ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 166 combination reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[1]:22 [ main::$6 ] zp[1]:23 [ main::$7 ] zp[1]:24 [ main::$8 ] zp[1]:2 [ main::bu ] zp[1]:3 [ main::bs ] zp[2]:4 [ main::wu ] zp[2]:6 [ main::ws ] zp[4]:8 [ main::du ] zp[4]:12 [ main::ds ] zp[2]:16 [ main::ptr ]
|
||||
Limited combination testing to 100 combinations of 16384 possible.
|
||||
Uplifting [] best 166 combination
|
||||
Attempting to uplift remaining variables inzp[1]:22 [ main::$6 ]
|
||||
Uplifting [main] best 160 combination reg byte a [ main::$6 ]
|
||||
Attempting to uplift remaining variables inzp[1]:23 [ main::$7 ]
|
||||
Uplifting [main] best 154 combination reg byte a [ main::$7 ]
|
||||
Attempting to uplift remaining variables inzp[1]:24 [ main::$8 ]
|
||||
Uplifting [main] best 148 combination reg byte a [ main::$8 ]
|
||||
Attempting to uplift remaining variables inzp[1]:2 [ main::bu ]
|
||||
Uplifting [main] best 148 combination zp[1]:2 [ main::bu ]
|
||||
Attempting to uplift remaining variables inzp[1]:3 [ main::bs ]
|
||||
Uplifting [main] best 148 combination zp[1]:3 [ main::bs ]
|
||||
Uplifting [main] best 144 combination reg byte a [ main::$4 ] reg byte a [ main::$5 ] reg byte a [ main::$6 ] reg byte a [ main::$7 ] zp[1]:20 [ main::$8 ] zp[2]:2 [ main::wu ] zp[2]:4 [ main::ws ] zp[4]:6 [ main::du ] zp[4]:10 [ main::ds ] zp[2]:14 [ main::ptr ]
|
||||
Limited combination testing to 100 combinations of 1024 possible.
|
||||
Uplifting [] best 144 combination
|
||||
Attempting to uplift remaining variables inzp[1]:20 [ main::$8 ]
|
||||
Uplifting [main] best 138 combination reg byte a [ main::$8 ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// Test operator BYTE1()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte1.prg", type="prg", segments="Program"]
|
||||
@@ -347,30 +323,22 @@ ASSEMBLER BEFORE OPTIMIZATION
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
lda #7
|
||||
sta.z bs
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
.label wu = 2
|
||||
.label ws = 4
|
||||
.label du = 6
|
||||
.label ds = $a
|
||||
.label ptr = $e
|
||||
// [0] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
// [1] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
// [2] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
@@ -379,7 +347,7 @@ main: {
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
// [3] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
@@ -388,49 +356,47 @@ main: {
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
// [4] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
lda #>0
|
||||
sta.z ptr+1
|
||||
// [7] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
// [5] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// [8] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
// [6] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// [9] main::$2 = > main::bu -- vbuaa=_byte1_vbuz1
|
||||
// [7] *(main::SCREEN+2) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+2
|
||||
// [11] main::$3 = > main::bs -- vbuaa=_byte1_vbsz1
|
||||
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+3
|
||||
// [13] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
// [9] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
lda.z wu+1
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
// [10] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// [15] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
// [11] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
lda.z ws+1
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
// [12] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// [17] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
// [13] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
lda.z du+1
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
// [14] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// [19] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
// [15] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
lda.z ds+1
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
// [16] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// [21] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
// [17] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
lda.z ptr+1
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
// [18] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [23] return
|
||||
// [19] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
@@ -438,7 +404,6 @@ main: {
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda #7
|
||||
Removing instruction lda #>0
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
@@ -448,32 +413,24 @@ Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
void main()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
volatile signed dword main::ds loadstore zp[4]:10 0.3333333333333333
|
||||
volatile dword main::du loadstore zp[4]:6 0.36363636363636365
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
volatile byte* main::ptr loadstore zp[2]:14 0.3076923076923077
|
||||
volatile signed word main::ws loadstore zp[2]:4 0.4
|
||||
volatile word main::wu loadstore zp[2]:2 0.4444444444444444
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
zp[2]:2 [ main::wu ]
|
||||
zp[2]:4 [ main::ws ]
|
||||
zp[4]:6 [ main::du ]
|
||||
zp[4]:10 [ main::ds ]
|
||||
zp[2]:14 [ main::ptr ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
@@ -482,10 +439,10 @@ reg byte a [ main::$8 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 137
|
||||
Score: 129
|
||||
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// Test operator BYTE1()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte1.prg", type="prg", segments="Program"]
|
||||
@@ -500,34 +457,25 @@ Score: 137
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
sta.z bs
|
||||
.label wu = 2
|
||||
.label ws = 4
|
||||
.label du = 6
|
||||
.label ds = $a
|
||||
.label ptr = $e
|
||||
// wu = 20000
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
// [0] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// ws = -177
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
// [1] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// du = 2000000
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
// [2] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
@@ -537,7 +485,7 @@ main: {
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// ds = -3777777
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
// [3] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
@@ -547,61 +495,57 @@ main: {
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// ptr = 0x0000
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
// [4] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
sta.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(17)
|
||||
// [7] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
// [5] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE1(377)
|
||||
// [8] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
// [6] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// BYTE1(bu)
|
||||
// [9] main::$2 = > main::bu -- vbuaa=_byte1_vbuz1
|
||||
lda #0
|
||||
// SCREEN[i++] = BYTE1(bu)
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
// [7] *(main::SCREEN+2) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+2
|
||||
// BYTE1(bs)
|
||||
// [11] main::$3 = > main::bs -- vbuaa=_byte1_vbsz1
|
||||
// SCREEN[i++] = BYTE1(bs)
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+3
|
||||
// BYTE1(wu)
|
||||
// [13] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
// [9] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
lda.z wu+1
|
||||
// SCREEN[i++] = BYTE1(wu)
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
// [10] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// BYTE1(ws)
|
||||
// [15] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
// [11] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
lda.z ws+1
|
||||
// SCREEN[i++] = BYTE1(ws)
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
// [12] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// BYTE1(du)
|
||||
// [17] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
// [13] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
lda.z du+1
|
||||
// SCREEN[i++] = BYTE1(du)
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
// [14] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// BYTE1(ds)
|
||||
// [19] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
// [15] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
lda.z ds+1
|
||||
// SCREEN[i++] = BYTE1(ds)
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
// [16] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// BYTE1(ptr)
|
||||
// [21] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
// [17] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
lda.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(ptr)
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
// [18] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// main::@return
|
||||
// }
|
||||
// [23] return
|
||||
// [19] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
@@ -1,30 +1,22 @@
|
||||
void main()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
volatile signed dword main::ds loadstore zp[4]:10 0.3333333333333333
|
||||
volatile dword main::du loadstore zp[4]:6 0.36363636363636365
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
volatile byte* main::ptr loadstore zp[2]:14 0.3076923076923077
|
||||
volatile signed word main::ws loadstore zp[2]:4 0.4
|
||||
volatile word main::wu loadstore zp[2]:2 0.4444444444444444
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
zp[2]:2 [ main::wu ]
|
||||
zp[2]:4 [ main::ws ]
|
||||
zp[4]:6 [ main::du ]
|
||||
zp[4]:10 [ main::ds ]
|
||||
zp[2]:14 [ main::ptr ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
|
63
src/test/ref/operator-byte2.asm
Normal file
63
src/test/ref/operator-byte2.asm
Normal file
@@ -0,0 +1,63 @@
|
||||
// Test operator BYTE2()
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte2.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
.segment Code
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// du = 2000000
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// ds = -3777777
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// SCREEN[i++] = BYTE2(17)
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE2(377)
|
||||
sta SCREEN+1
|
||||
// SCREEN[i++] = BYTE2(377777)
|
||||
lda #<($5c3b1>>$10)
|
||||
sta SCREEN+2
|
||||
// SCREEN[i++] = BYTE2(bu)
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// SCREEN[i++] = BYTE2(bs)
|
||||
sta SCREEN+4
|
||||
// SCREEN[i++] = BYTE2(wu)
|
||||
sta SCREEN+5
|
||||
// SCREEN[i++] = BYTE2(ws)
|
||||
sta SCREEN+6
|
||||
// BYTE2(du)
|
||||
lda.z du+2
|
||||
// SCREEN[i++] = BYTE2(du)
|
||||
sta SCREEN+7
|
||||
// BYTE2(ds)
|
||||
lda.z ds+2
|
||||
// SCREEN[i++] = BYTE2(ds)
|
||||
sta SCREEN+8
|
||||
// SCREEN[i++] = BYTE2(ptr)
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
// }
|
||||
rts
|
||||
}
|
21
src/test/ref/operator-byte2.cfg
Normal file
21
src/test/ref/operator-byte2.cfg
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::du = $1e8480
|
||||
[1] main::ds = -$39a4f1
|
||||
[2] *main::SCREEN = 0
|
||||
[3] *(main::SCREEN+1) = 0
|
||||
[4] *(main::SCREEN+2) = _byte2_$5c3b1
|
||||
[5] *(main::SCREEN+3) = 0
|
||||
[6] *(main::SCREEN+4) = 0
|
||||
[7] *(main::SCREEN+5) = 0
|
||||
[8] *(main::SCREEN+6) = 0
|
||||
[9] main::$7 = _byte2_ main::du
|
||||
[10] *(main::SCREEN+7) = main::$7
|
||||
[11] main::$8 = _byte2_ main::ds
|
||||
[12] *(main::SCREEN+8) = main::$8
|
||||
[13] *(main::SCREEN+9) = 0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[14] return
|
||||
to:@return
|
492
src/test/ref/operator-byte2.log
Normal file
492
src/test/ref/operator-byte2.log
Normal file
@@ -0,0 +1,492 @@
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
|
||||
void main()
|
||||
main: scope:[main] from __start
|
||||
main::bu = 7
|
||||
main::bs = 7
|
||||
main::wu = $4e20
|
||||
main::ws = -$b1
|
||||
main::du = $1e8480
|
||||
main::ds = -$39a4f1
|
||||
main::ptr = (byte*)0
|
||||
main::i#0 = 0
|
||||
main::$0 = _byte2_ $11
|
||||
main::SCREEN[main::i#0] = main::$0
|
||||
main::i#1 = ++ main::i#0
|
||||
main::$1 = _byte2_ $179
|
||||
main::SCREEN[main::i#1] = main::$1
|
||||
main::i#2 = ++ main::i#1
|
||||
main::$2 = _byte2_ $5c3b1
|
||||
main::SCREEN[main::i#2] = main::$2
|
||||
main::i#3 = ++ main::i#2
|
||||
main::$3 = _byte2_ main::bu
|
||||
main::SCREEN[main::i#3] = main::$3
|
||||
main::i#4 = ++ main::i#3
|
||||
main::$4 = _byte2_ main::bs
|
||||
main::SCREEN[main::i#4] = main::$4
|
||||
main::i#5 = ++ main::i#4
|
||||
main::$5 = _byte2_ main::wu
|
||||
main::SCREEN[main::i#5] = main::$5
|
||||
main::i#6 = ++ main::i#5
|
||||
main::$6 = _byte2_ main::ws
|
||||
main::SCREEN[main::i#6] = main::$6
|
||||
main::i#7 = ++ main::i#6
|
||||
main::$7 = _byte2_ main::du
|
||||
main::SCREEN[main::i#7] = main::$7
|
||||
main::i#8 = ++ main::i#7
|
||||
main::$8 = _byte2_ main::ds
|
||||
main::SCREEN[main::i#8] = main::$8
|
||||
main::i#9 = ++ main::i#8
|
||||
main::$9 = _byte2_ main::ptr
|
||||
main::SCREEN[main::i#9] = main::$9
|
||||
main::i#10 = ++ main::i#9
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
|
||||
void __start()
|
||||
__start: scope:[__start] from
|
||||
call main
|
||||
to:__start::@1
|
||||
__start::@1: scope:[__start] from __start
|
||||
to:__start::@return
|
||||
__start::@return: scope:[__start] from __start::@1
|
||||
return
|
||||
to:@return
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
void __start()
|
||||
void main()
|
||||
byte~ main::$0
|
||||
byte~ main::$1
|
||||
byte~ main::$2
|
||||
byte~ main::$3
|
||||
byte~ main::$4
|
||||
byte~ main::$5
|
||||
byte~ main::$6
|
||||
byte~ main::$7
|
||||
byte~ main::$8
|
||||
byte~ main::$9
|
||||
const nomodify byte* main::SCREEN = (byte*)$400
|
||||
volatile signed byte main::bs loadstore
|
||||
volatile byte main::bu loadstore
|
||||
volatile signed dword main::ds loadstore
|
||||
volatile dword main::du loadstore
|
||||
byte main::i
|
||||
byte main::i#0
|
||||
byte main::i#1
|
||||
byte main::i#10
|
||||
byte main::i#2
|
||||
byte main::i#3
|
||||
byte main::i#4
|
||||
byte main::i#5
|
||||
byte main::i#6
|
||||
byte main::i#7
|
||||
byte main::i#8
|
||||
byte main::i#9
|
||||
volatile byte* main::ptr loadstore
|
||||
volatile signed word main::ws loadstore
|
||||
volatile word main::wu loadstore
|
||||
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Simplifying constant pointer cast (byte*) 0
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Constant right-side identified [8] main::$0 = _byte2_ $11
|
||||
Constant right-side identified [11] main::$1 = _byte2_ $179
|
||||
Constant right-side identified [14] main::$2 = _byte2_ $5c3b1
|
||||
Constant right-side identified [17] main::$3 = _byte2_ main::bu
|
||||
Constant right-side identified [20] main::$4 = _byte2_ main::bs
|
||||
Constant right-side identified [23] main::$5 = _byte2_ main::wu
|
||||
Constant right-side identified [26] main::$6 = _byte2_ main::ws
|
||||
Constant right-side identified [35] main::$9 = _byte2_ main::ptr
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = _byte2_$11
|
||||
Constant main::$1 = _byte2_$179
|
||||
Constant main::$2 = _byte2_$5c3b1
|
||||
Constant main::$3 = 0
|
||||
Constant main::$4 = 0
|
||||
Constant main::$5 = 0
|
||||
Constant main::$6 = 0
|
||||
Constant main::$9 = 0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Simplifying constant evaluating to zero _byte2_$11 in
|
||||
Simplifying constant evaluating to zero _byte2_$179 in
|
||||
Successful SSA optimization PassNSimplifyConstantZero
|
||||
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
Eliminating unused variable main::bu and assignment [0] main::bu = 7
|
||||
Eliminating unused variable main::bs and assignment [1] main::bs = 7
|
||||
Eliminating unused variable main::wu and assignment [2] main::wu = $4e20
|
||||
Eliminating unused variable main::ws and assignment [3] main::ws = -$b1
|
||||
Eliminating unused variable main::ptr and assignment [6] main::ptr = (byte*) 0
|
||||
Eliminating unused variable main::i#10 and assignment [28] main::i#10 = ++ main::i#9
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Removing unused procedure __start
|
||||
Removing unused procedure block __start
|
||||
Removing unused procedure block __start::@1
|
||||
Removing unused procedure block __start::@return
|
||||
Successful SSA optimization PassNEliminateEmptyStart
|
||||
Constant right-side identified [3] main::i#1 = ++ main::i#0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#1 = ++main::i#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [4] main::i#2 = ++ main::i#1
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#2 = ++main::i#1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [5] main::i#3 = ++ main::i#2
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#3 = ++main::i#2
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [6] main::i#4 = ++ main::i#3
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#4 = ++main::i#3
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [7] main::i#5 = ++ main::i#4
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#5 = ++main::i#4
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [8] main::i#6 = ++ main::i#5
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#6 = ++main::i#5
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [9] main::i#7 = ++ main::i#6
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#7 = ++main::i#6
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [11] main::i#8 = ++ main::i#7
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#8 = ++main::i#7
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [13] main::i#9 = ++ main::i#8
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#9 = ++main::i#8
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Inlining constant with different constant siblings main::i#0
|
||||
Inlining constant with different constant siblings main::i#1
|
||||
Inlining constant with different constant siblings main::i#2
|
||||
Inlining constant with different constant siblings main::i#3
|
||||
Inlining constant with different constant siblings main::i#4
|
||||
Inlining constant with different constant siblings main::i#5
|
||||
Inlining constant with different constant siblings main::i#6
|
||||
Inlining constant with different constant siblings main::i#7
|
||||
Inlining constant with different constant siblings main::i#8
|
||||
Inlining constant with different constant siblings main::i#9
|
||||
Constant inlined main::i#8 = ++++++++++++++++0
|
||||
Constant inlined main::i#7 = ++++++++++++++0
|
||||
Constant inlined main::i#9 = ++++++++++++++++++0
|
||||
Constant inlined main::i#4 = ++++++++0
|
||||
Constant inlined main::i#3 = ++++++0
|
||||
Constant inlined main::i#6 = ++++++++++++0
|
||||
Constant inlined main::i#5 = ++++++++++0
|
||||
Constant inlined main::$1 = 0
|
||||
Constant inlined main::$2 = _byte2_$5c3b1
|
||||
Constant inlined main::$0 = 0
|
||||
Constant inlined main::$5 = 0
|
||||
Constant inlined main::i#0 = 0
|
||||
Constant inlined main::$6 = 0
|
||||
Constant inlined main::$3 = 0
|
||||
Constant inlined main::i#2 = ++++0
|
||||
Constant inlined main::$4 = 0
|
||||
Constant inlined main::i#1 = ++0
|
||||
Constant inlined main::$9 = 0
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
Consolidated array index constant in *(main::SCREEN+++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++++++0)
|
||||
Successful SSA optimization Pass2ConstantAdditionElimination
|
||||
Simplifying constant integer increment ++0
|
||||
Simplifying constant integer increment ++0
|
||||
Simplifying constant integer increment ++1
|
||||
Simplifying constant integer increment ++2
|
||||
Simplifying constant integer increment ++3
|
||||
Simplifying constant integer increment ++4
|
||||
Simplifying constant integer increment ++5
|
||||
Simplifying constant integer increment ++6
|
||||
Simplifying constant integer increment ++7
|
||||
Successful SSA optimization Pass2ConstantSimplification
|
||||
Simplifying constant integer increment ++1
|
||||
Simplifying constant integer increment ++2
|
||||
Simplifying constant integer increment ++3
|
||||
Simplifying constant integer increment ++4
|
||||
Simplifying constant integer increment ++5
|
||||
Simplifying constant integer increment ++6
|
||||
Simplifying constant integer increment ++7
|
||||
Simplifying constant integer increment ++8
|
||||
Successful SSA optimization Pass2ConstantSimplification
|
||||
Finalized unsigned number type (dword) $5c3b1
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
CALL GRAPH
|
||||
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::du = $1e8480
|
||||
[1] main::ds = -$39a4f1
|
||||
[2] *main::SCREEN = 0
|
||||
[3] *(main::SCREEN+1) = 0
|
||||
[4] *(main::SCREEN+2) = _byte2_$5c3b1
|
||||
[5] *(main::SCREEN+3) = 0
|
||||
[6] *(main::SCREEN+4) = 0
|
||||
[7] *(main::SCREEN+5) = 0
|
||||
[8] *(main::SCREEN+6) = 0
|
||||
[9] main::$7 = _byte2_ main::du
|
||||
[10] *(main::SCREEN+7) = main::$7
|
||||
[11] main::$8 = _byte2_ main::ds
|
||||
[12] *(main::SCREEN+8) = main::$8
|
||||
[13] *(main::SCREEN+9) = 0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[14] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte~ main::$7 4.0
|
||||
byte~ main::$8 4.0
|
||||
volatile signed dword main::ds loadstore 0.4
|
||||
volatile dword main::du loadstore 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
Initial phi equivalence classes
|
||||
Added variable main::du to live range equivalence class [ main::du ]
|
||||
Added variable main::ds to live range equivalence class [ main::ds ]
|
||||
Added variable main::$7 to live range equivalence class [ main::$7 ]
|
||||
Added variable main::$8 to live range equivalence class [ main::$8 ]
|
||||
Complete equivalence classes
|
||||
[ main::du ]
|
||||
[ main::ds ]
|
||||
[ main::$7 ]
|
||||
[ main::$8 ]
|
||||
Allocated zp[4]:2 [ main::du ]
|
||||
Allocated zp[4]:6 [ main::ds ]
|
||||
Allocated zp[1]:10 [ main::$7 ]
|
||||
Allocated zp[1]:11 [ main::$8 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] main::du = $1e8480 [ main::du ] ( [ main::du ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::ds = -$39a4f1 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [2] *main::SCREEN = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [3] *(main::SCREEN+1) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [4] *(main::SCREEN+2) = _byte2_$5c3b1 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [5] *(main::SCREEN+3) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [6] *(main::SCREEN+4) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [7] *(main::SCREEN+5) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+6) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [13] *(main::SCREEN+9) = 0 [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[4]:2 [ main::du ] : zp[4]:2 ,
|
||||
Potential registers zp[4]:6 [ main::ds ] : zp[4]:6 ,
|
||||
Potential registers zp[1]:10 [ main::$7 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:11 [ main::$8 ] : zp[1]:11 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 4: zp[1]:10 [ main::$7 ] 4: zp[1]:11 [ main::$8 ] 0.44: zp[4]:2 [ main::du ] 0.4: zp[4]:6 [ main::ds ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 111 combination reg byte a [ main::$7 ] reg byte a [ main::$8 ] zp[4]:2 [ main::du ] zp[4]:6 [ main::ds ]
|
||||
Uplifting [] best 111 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Test operator BYTE2()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte2.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// [0] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// [1] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// [2] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// [3] *(main::SCREEN+1) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+1
|
||||
// [4] *(main::SCREEN+2) = _byte2_$5c3b1 -- _deref_pbuc1=vbuc2
|
||||
lda #<($5c3b1>>$10)
|
||||
sta SCREEN+2
|
||||
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// [6] *(main::SCREEN+4) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+4
|
||||
// [7] *(main::SCREEN+5) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+5
|
||||
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+6
|
||||
// [9] main::$7 = _byte2_ main::du -- vbuaa=_byte2_vduz1
|
||||
lda.z du+2
|
||||
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// [11] main::$8 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
|
||||
lda.z ds+2
|
||||
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [14] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
Removing instruction __breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
void main()
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed dword main::ds loadstore zp[4]:6 0.4
|
||||
volatile dword main::du loadstore zp[4]:2 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
zp[4]:2 [ main::du ]
|
||||
zp[4]:6 [ main::ds ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 100
|
||||
|
||||
// File Comments
|
||||
// Test operator BYTE2()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte2.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// du = 2000000
|
||||
// [0] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// ds = -3777777
|
||||
// [1] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// SCREEN[i++] = BYTE2(17)
|
||||
// [2] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE2(377)
|
||||
// [3] *(main::SCREEN+1) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+1
|
||||
// SCREEN[i++] = BYTE2(377777)
|
||||
// [4] *(main::SCREEN+2) = _byte2_$5c3b1 -- _deref_pbuc1=vbuc2
|
||||
lda #<($5c3b1>>$10)
|
||||
sta SCREEN+2
|
||||
// SCREEN[i++] = BYTE2(bu)
|
||||
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// SCREEN[i++] = BYTE2(bs)
|
||||
// [6] *(main::SCREEN+4) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+4
|
||||
// SCREEN[i++] = BYTE2(wu)
|
||||
// [7] *(main::SCREEN+5) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+5
|
||||
// SCREEN[i++] = BYTE2(ws)
|
||||
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+6
|
||||
// BYTE2(du)
|
||||
// [9] main::$7 = _byte2_ main::du -- vbuaa=_byte2_vduz1
|
||||
lda.z du+2
|
||||
// SCREEN[i++] = BYTE2(du)
|
||||
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// BYTE2(ds)
|
||||
// [11] main::$8 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
|
||||
lda.z ds+2
|
||||
// SCREEN[i++] = BYTE2(ds)
|
||||
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// SCREEN[i++] = BYTE2(ptr)
|
||||
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
// main::@return
|
||||
// }
|
||||
// [14] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
12
src/test/ref/operator-byte2.sym
Normal file
12
src/test/ref/operator-byte2.sym
Normal file
@@ -0,0 +1,12 @@
|
||||
void main()
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed dword main::ds loadstore zp[4]:6 0.4
|
||||
volatile dword main::du loadstore zp[4]:2 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
zp[4]:2 [ main::du ]
|
||||
zp[4]:6 [ main::ds ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
63
src/test/ref/operator-byte3.asm
Normal file
63
src/test/ref/operator-byte3.asm
Normal file
@@ -0,0 +1,63 @@
|
||||
// Test operator BYTE3()
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte3.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
.segment Code
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// du = 2000000
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// ds = -3777777
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// SCREEN[i++] = BYTE3(17)
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE3(377)
|
||||
sta SCREEN+1
|
||||
// SCREEN[i++] = BYTE3(333377777)
|
||||
lda #<($13def0f1>>$18)
|
||||
sta SCREEN+2
|
||||
// SCREEN[i++] = BYTE3(bu)
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// SCREEN[i++] = BYTE3(bs)
|
||||
sta SCREEN+4
|
||||
// SCREEN[i++] = BYTE3(wu)
|
||||
sta SCREEN+5
|
||||
// SCREEN[i++] = BYTE3(ws)
|
||||
sta SCREEN+6
|
||||
// BYTE3(du)
|
||||
lda.z du+3
|
||||
// SCREEN[i++] = BYTE3(du)
|
||||
sta SCREEN+7
|
||||
// BYTE3(ds)
|
||||
lda.z ds+3
|
||||
// SCREEN[i++] = BYTE3(ds)
|
||||
sta SCREEN+8
|
||||
// SCREEN[i++] = BYTE3(ptr)
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
// }
|
||||
rts
|
||||
}
|
21
src/test/ref/operator-byte3.cfg
Normal file
21
src/test/ref/operator-byte3.cfg
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::du = $1e8480
|
||||
[1] main::ds = -$39a4f1
|
||||
[2] *main::SCREEN = 0
|
||||
[3] *(main::SCREEN+1) = 0
|
||||
[4] *(main::SCREEN+2) = _byte3_$13def0f1
|
||||
[5] *(main::SCREEN+3) = 0
|
||||
[6] *(main::SCREEN+4) = 0
|
||||
[7] *(main::SCREEN+5) = 0
|
||||
[8] *(main::SCREEN+6) = 0
|
||||
[9] main::$7 = _byte3_ main::du
|
||||
[10] *(main::SCREEN+7) = main::$7
|
||||
[11] main::$8 = _byte3_ main::ds
|
||||
[12] *(main::SCREEN+8) = main::$8
|
||||
[13] *(main::SCREEN+9) = 0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[14] return
|
||||
to:@return
|
492
src/test/ref/operator-byte3.log
Normal file
492
src/test/ref/operator-byte3.log
Normal file
@@ -0,0 +1,492 @@
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
|
||||
void main()
|
||||
main: scope:[main] from __start
|
||||
main::bu = 7
|
||||
main::bs = 7
|
||||
main::wu = $4e20
|
||||
main::ws = -$b1
|
||||
main::du = $1e8480
|
||||
main::ds = -$39a4f1
|
||||
main::ptr = (byte*)0
|
||||
main::i#0 = 0
|
||||
main::$0 = _byte3_ $11
|
||||
main::SCREEN[main::i#0] = main::$0
|
||||
main::i#1 = ++ main::i#0
|
||||
main::$1 = _byte3_ $179
|
||||
main::SCREEN[main::i#1] = main::$1
|
||||
main::i#2 = ++ main::i#1
|
||||
main::$2 = _byte3_ $13def0f1
|
||||
main::SCREEN[main::i#2] = main::$2
|
||||
main::i#3 = ++ main::i#2
|
||||
main::$3 = _byte3_ main::bu
|
||||
main::SCREEN[main::i#3] = main::$3
|
||||
main::i#4 = ++ main::i#3
|
||||
main::$4 = _byte3_ main::bs
|
||||
main::SCREEN[main::i#4] = main::$4
|
||||
main::i#5 = ++ main::i#4
|
||||
main::$5 = _byte3_ main::wu
|
||||
main::SCREEN[main::i#5] = main::$5
|
||||
main::i#6 = ++ main::i#5
|
||||
main::$6 = _byte3_ main::ws
|
||||
main::SCREEN[main::i#6] = main::$6
|
||||
main::i#7 = ++ main::i#6
|
||||
main::$7 = _byte3_ main::du
|
||||
main::SCREEN[main::i#7] = main::$7
|
||||
main::i#8 = ++ main::i#7
|
||||
main::$8 = _byte3_ main::ds
|
||||
main::SCREEN[main::i#8] = main::$8
|
||||
main::i#9 = ++ main::i#8
|
||||
main::$9 = _byte3_ main::ptr
|
||||
main::SCREEN[main::i#9] = main::$9
|
||||
main::i#10 = ++ main::i#9
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
|
||||
void __start()
|
||||
__start: scope:[__start] from
|
||||
call main
|
||||
to:__start::@1
|
||||
__start::@1: scope:[__start] from __start
|
||||
to:__start::@return
|
||||
__start::@return: scope:[__start] from __start::@1
|
||||
return
|
||||
to:@return
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
void __start()
|
||||
void main()
|
||||
byte~ main::$0
|
||||
byte~ main::$1
|
||||
byte~ main::$2
|
||||
byte~ main::$3
|
||||
byte~ main::$4
|
||||
byte~ main::$5
|
||||
byte~ main::$6
|
||||
byte~ main::$7
|
||||
byte~ main::$8
|
||||
byte~ main::$9
|
||||
const nomodify byte* main::SCREEN = (byte*)$400
|
||||
volatile signed byte main::bs loadstore
|
||||
volatile byte main::bu loadstore
|
||||
volatile signed dword main::ds loadstore
|
||||
volatile dword main::du loadstore
|
||||
byte main::i
|
||||
byte main::i#0
|
||||
byte main::i#1
|
||||
byte main::i#10
|
||||
byte main::i#2
|
||||
byte main::i#3
|
||||
byte main::i#4
|
||||
byte main::i#5
|
||||
byte main::i#6
|
||||
byte main::i#7
|
||||
byte main::i#8
|
||||
byte main::i#9
|
||||
volatile byte* main::ptr loadstore
|
||||
volatile signed word main::ws loadstore
|
||||
volatile word main::wu loadstore
|
||||
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Simplifying constant pointer cast (byte*) 0
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Constant right-side identified [8] main::$0 = _byte3_ $11
|
||||
Constant right-side identified [11] main::$1 = _byte3_ $179
|
||||
Constant right-side identified [14] main::$2 = _byte3_ $13def0f1
|
||||
Constant right-side identified [17] main::$3 = _byte3_ main::bu
|
||||
Constant right-side identified [20] main::$4 = _byte3_ main::bs
|
||||
Constant right-side identified [23] main::$5 = _byte3_ main::wu
|
||||
Constant right-side identified [26] main::$6 = _byte3_ main::ws
|
||||
Constant right-side identified [35] main::$9 = _byte3_ main::ptr
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = _byte3_$11
|
||||
Constant main::$1 = _byte3_$179
|
||||
Constant main::$2 = _byte3_$13def0f1
|
||||
Constant main::$3 = 0
|
||||
Constant main::$4 = 0
|
||||
Constant main::$5 = 0
|
||||
Constant main::$6 = 0
|
||||
Constant main::$9 = 0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Simplifying constant evaluating to zero _byte3_$11 in
|
||||
Simplifying constant evaluating to zero _byte3_$179 in
|
||||
Successful SSA optimization PassNSimplifyConstantZero
|
||||
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
Eliminating unused variable main::bu and assignment [0] main::bu = 7
|
||||
Eliminating unused variable main::bs and assignment [1] main::bs = 7
|
||||
Eliminating unused variable main::wu and assignment [2] main::wu = $4e20
|
||||
Eliminating unused variable main::ws and assignment [3] main::ws = -$b1
|
||||
Eliminating unused variable main::ptr and assignment [6] main::ptr = (byte*) 0
|
||||
Eliminating unused variable main::i#10 and assignment [28] main::i#10 = ++ main::i#9
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Removing unused procedure __start
|
||||
Removing unused procedure block __start
|
||||
Removing unused procedure block __start::@1
|
||||
Removing unused procedure block __start::@return
|
||||
Successful SSA optimization PassNEliminateEmptyStart
|
||||
Constant right-side identified [3] main::i#1 = ++ main::i#0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#1 = ++main::i#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [4] main::i#2 = ++ main::i#1
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#2 = ++main::i#1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [5] main::i#3 = ++ main::i#2
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#3 = ++main::i#2
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [6] main::i#4 = ++ main::i#3
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#4 = ++main::i#3
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [7] main::i#5 = ++ main::i#4
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#5 = ++main::i#4
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [8] main::i#6 = ++ main::i#5
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#6 = ++main::i#5
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [9] main::i#7 = ++ main::i#6
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#7 = ++main::i#6
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [11] main::i#8 = ++ main::i#7
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#8 = ++main::i#7
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [13] main::i#9 = ++ main::i#8
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#9 = ++main::i#8
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Inlining constant with different constant siblings main::i#0
|
||||
Inlining constant with different constant siblings main::i#1
|
||||
Inlining constant with different constant siblings main::i#2
|
||||
Inlining constant with different constant siblings main::i#3
|
||||
Inlining constant with different constant siblings main::i#4
|
||||
Inlining constant with different constant siblings main::i#5
|
||||
Inlining constant with different constant siblings main::i#6
|
||||
Inlining constant with different constant siblings main::i#7
|
||||
Inlining constant with different constant siblings main::i#8
|
||||
Inlining constant with different constant siblings main::i#9
|
||||
Constant inlined main::i#8 = ++++++++++++++++0
|
||||
Constant inlined main::i#7 = ++++++++++++++0
|
||||
Constant inlined main::i#9 = ++++++++++++++++++0
|
||||
Constant inlined main::i#4 = ++++++++0
|
||||
Constant inlined main::i#3 = ++++++0
|
||||
Constant inlined main::i#6 = ++++++++++++0
|
||||
Constant inlined main::i#5 = ++++++++++0
|
||||
Constant inlined main::$1 = 0
|
||||
Constant inlined main::$2 = _byte3_$13def0f1
|
||||
Constant inlined main::$0 = 0
|
||||
Constant inlined main::$5 = 0
|
||||
Constant inlined main::i#0 = 0
|
||||
Constant inlined main::$6 = 0
|
||||
Constant inlined main::$3 = 0
|
||||
Constant inlined main::i#2 = ++++0
|
||||
Constant inlined main::$4 = 0
|
||||
Constant inlined main::i#1 = ++0
|
||||
Constant inlined main::$9 = 0
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
Consolidated array index constant in *(main::SCREEN+++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++++0)
|
||||
Consolidated array index constant in *(main::SCREEN+++++++++++++++++++0)
|
||||
Successful SSA optimization Pass2ConstantAdditionElimination
|
||||
Simplifying constant integer increment ++0
|
||||
Simplifying constant integer increment ++0
|
||||
Simplifying constant integer increment ++1
|
||||
Simplifying constant integer increment ++2
|
||||
Simplifying constant integer increment ++3
|
||||
Simplifying constant integer increment ++4
|
||||
Simplifying constant integer increment ++5
|
||||
Simplifying constant integer increment ++6
|
||||
Simplifying constant integer increment ++7
|
||||
Successful SSA optimization Pass2ConstantSimplification
|
||||
Simplifying constant integer increment ++1
|
||||
Simplifying constant integer increment ++2
|
||||
Simplifying constant integer increment ++3
|
||||
Simplifying constant integer increment ++4
|
||||
Simplifying constant integer increment ++5
|
||||
Simplifying constant integer increment ++6
|
||||
Simplifying constant integer increment ++7
|
||||
Simplifying constant integer increment ++8
|
||||
Successful SSA optimization Pass2ConstantSimplification
|
||||
Finalized unsigned number type (dword) $13def0f1
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
CALL GRAPH
|
||||
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::du = $1e8480
|
||||
[1] main::ds = -$39a4f1
|
||||
[2] *main::SCREEN = 0
|
||||
[3] *(main::SCREEN+1) = 0
|
||||
[4] *(main::SCREEN+2) = _byte3_$13def0f1
|
||||
[5] *(main::SCREEN+3) = 0
|
||||
[6] *(main::SCREEN+4) = 0
|
||||
[7] *(main::SCREEN+5) = 0
|
||||
[8] *(main::SCREEN+6) = 0
|
||||
[9] main::$7 = _byte3_ main::du
|
||||
[10] *(main::SCREEN+7) = main::$7
|
||||
[11] main::$8 = _byte3_ main::ds
|
||||
[12] *(main::SCREEN+8) = main::$8
|
||||
[13] *(main::SCREEN+9) = 0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[14] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte~ main::$7 4.0
|
||||
byte~ main::$8 4.0
|
||||
volatile signed dword main::ds loadstore 0.4
|
||||
volatile dword main::du loadstore 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
Initial phi equivalence classes
|
||||
Added variable main::du to live range equivalence class [ main::du ]
|
||||
Added variable main::ds to live range equivalence class [ main::ds ]
|
||||
Added variable main::$7 to live range equivalence class [ main::$7 ]
|
||||
Added variable main::$8 to live range equivalence class [ main::$8 ]
|
||||
Complete equivalence classes
|
||||
[ main::du ]
|
||||
[ main::ds ]
|
||||
[ main::$7 ]
|
||||
[ main::$8 ]
|
||||
Allocated zp[4]:2 [ main::du ]
|
||||
Allocated zp[4]:6 [ main::ds ]
|
||||
Allocated zp[1]:10 [ main::$7 ]
|
||||
Allocated zp[1]:11 [ main::$8 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] main::du = $1e8480 [ main::du ] ( [ main::du ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::ds = -$39a4f1 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [2] *main::SCREEN = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [3] *(main::SCREEN+1) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [4] *(main::SCREEN+2) = _byte3_$13def0f1 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [5] *(main::SCREEN+3) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [6] *(main::SCREEN+4) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [7] *(main::SCREEN+5) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+6) = 0 [ main::du main::ds ] ( [ main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [13] *(main::SCREEN+9) = 0 [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[4]:2 [ main::du ] : zp[4]:2 ,
|
||||
Potential registers zp[4]:6 [ main::ds ] : zp[4]:6 ,
|
||||
Potential registers zp[1]:10 [ main::$7 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:11 [ main::$8 ] : zp[1]:11 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 4: zp[1]:10 [ main::$7 ] 4: zp[1]:11 [ main::$8 ] 0.44: zp[4]:2 [ main::du ] 0.4: zp[4]:6 [ main::ds ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 111 combination reg byte a [ main::$7 ] reg byte a [ main::$8 ] zp[4]:2 [ main::du ] zp[4]:6 [ main::ds ]
|
||||
Uplifting [] best 111 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Test operator BYTE3()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte3.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// [0] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// [1] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// [2] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// [3] *(main::SCREEN+1) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+1
|
||||
// [4] *(main::SCREEN+2) = _byte3_$13def0f1 -- _deref_pbuc1=vbuc2
|
||||
lda #<($13def0f1>>$18)
|
||||
sta SCREEN+2
|
||||
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// [6] *(main::SCREEN+4) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+4
|
||||
// [7] *(main::SCREEN+5) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+5
|
||||
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+6
|
||||
// [9] main::$7 = _byte3_ main::du -- vbuaa=_byte3_vduz1
|
||||
lda.z du+3
|
||||
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// [11] main::$8 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
|
||||
lda.z ds+3
|
||||
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [14] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Removing instruction lda #0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
Removing instruction __breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
void main()
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed dword main::ds loadstore zp[4]:6 0.4
|
||||
volatile dword main::du loadstore zp[4]:2 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
zp[4]:2 [ main::du ]
|
||||
zp[4]:6 [ main::ds ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 100
|
||||
|
||||
// File Comments
|
||||
// Test operator BYTE3()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte3.prg", type="prg", segments="Program"]
|
||||
.segmentdef Program [segments="Basic, Code, Data"]
|
||||
.segmentdef Basic [start=$0801]
|
||||
.segmentdef Code [start=$80d]
|
||||
.segmentdef Data [startAfter="Code"]
|
||||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label du = 2
|
||||
.label ds = 6
|
||||
// du = 2000000
|
||||
// [0] main::du = $1e8480 -- vduz1=vduc1
|
||||
lda #<$1e8480
|
||||
sta.z du
|
||||
lda #>$1e8480
|
||||
sta.z du+1
|
||||
lda #<$1e8480>>$10
|
||||
sta.z du+2
|
||||
lda #>$1e8480>>$10
|
||||
sta.z du+3
|
||||
// ds = -3777777
|
||||
// [1] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
lda #<-$39a4f1
|
||||
sta.z ds
|
||||
lda #>-$39a4f1
|
||||
sta.z ds+1
|
||||
lda #<-$39a4f1>>$10
|
||||
sta.z ds+2
|
||||
lda #>-$39a4f1>>$10
|
||||
sta.z ds+3
|
||||
// SCREEN[i++] = BYTE3(17)
|
||||
// [2] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE3(377)
|
||||
// [3] *(main::SCREEN+1) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+1
|
||||
// SCREEN[i++] = BYTE3(333377777)
|
||||
// [4] *(main::SCREEN+2) = _byte3_$13def0f1 -- _deref_pbuc1=vbuc2
|
||||
lda #<($13def0f1>>$18)
|
||||
sta SCREEN+2
|
||||
// SCREEN[i++] = BYTE3(bu)
|
||||
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+3
|
||||
// SCREEN[i++] = BYTE3(bs)
|
||||
// [6] *(main::SCREEN+4) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+4
|
||||
// SCREEN[i++] = BYTE3(wu)
|
||||
// [7] *(main::SCREEN+5) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+5
|
||||
// SCREEN[i++] = BYTE3(ws)
|
||||
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN+6
|
||||
// BYTE3(du)
|
||||
// [9] main::$7 = _byte3_ main::du -- vbuaa=_byte3_vduz1
|
||||
lda.z du+3
|
||||
// SCREEN[i++] = BYTE3(du)
|
||||
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// BYTE3(ds)
|
||||
// [11] main::$8 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
|
||||
lda.z ds+3
|
||||
// SCREEN[i++] = BYTE3(ds)
|
||||
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// SCREEN[i++] = BYTE3(ptr)
|
||||
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN+9
|
||||
// main::@return
|
||||
// }
|
||||
// [14] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
12
src/test/ref/operator-byte3.sym
Normal file
12
src/test/ref/operator-byte3.sym
Normal file
@@ -0,0 +1,12 @@
|
||||
void main()
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed dword main::ds loadstore zp[4]:6 0.4
|
||||
volatile dword main::du loadstore zp[4]:2 0.4444444444444444
|
||||
byte main::i
|
||||
|
||||
zp[4]:2 [ main::du ]
|
||||
zp[4]:6 [ main::ds ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
Reference in New Issue
Block a user