1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-04-03 23:31:52 +00:00

Added BYTE0/1/2/3 support in ilist initializers. #221

This commit is contained in:
jespergravgaard 2021-04-05 02:02:30 +02:00
parent 299671109b
commit 9443fd5c46
34 changed files with 20424 additions and 463 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE f3ad13084 f3ad14fda
//KICKC FRAGMENT CACHE e05113a8a e05115a22
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE f3ad13084 f3ad14fda
//KICKC FRAGMENT CACHE e05113a8a e05115a22
//FRAGMENT _deref_pbuc1=vbuc2
lda #{c2}
sta {c1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE f3ad13084 f3ad14fda
//KICKC FRAGMENT CACHE e05113a8a e05115a22
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE f3ad13084 f3ad14fda
//KICKC FRAGMENT CACHE e05113a8a e05115a22
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
inc {c1}
//FRAGMENT isr_hardware_all_entry

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE f3ad13084 f3ad14fda
//KICKC FRAGMENT CACHE e05113a8a e05115a22
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

View File

@ -219,7 +219,7 @@ public class AsmFormat {
} 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) + ")";
return ">" + "(" + getAsmConstant(program, new ConstantBinary(operand, Operators.SHIFT_RIGHT, new ConstantInteger((long) 16)), 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)) {

View File

@ -2378,22 +2378,35 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
} else {
parameters = new ArrayList<>();
}
Variable tmpVar = addIntermediateVar();
SymbolVariableRef tmpVarRef = tmpVar.getRef();
String procedureName;
RValue result;
if(ctx.expr() instanceof KickCParser.ExprIdContext) {
procedureName = ctx.expr().getText();
addStatement(new StatementCall((LValue) tmpVarRef, procedureName, parameters, new StatementSource(ctx), ensureUnusedComments(getCommentsSymbol(ctx))));
// Handle the special BYTE0/1/2/3 calls
if(Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE0_NAME.equals(procedureName) && parameters.size()==1) {
result = addExprUnary(ctx, Operators.BYTE0, parameters.get(0));
} else if(Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE1_NAME.equals(procedureName) && parameters.size()==1) {
result = addExprUnary(ctx, Operators.BYTE1, parameters.get(0));
} else if(Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE2_NAME.equals(procedureName) && parameters.size()==1) {
result = addExprUnary(ctx, Operators.BYTE2, parameters.get(0));
} else if(Pass1ByteXIntrinsicRewrite.INTRINSIC_BYTE3_NAME.equals(procedureName) && parameters.size()==1) {
result = addExprUnary(ctx, Operators.BYTE3, parameters.get(0));
} else {
// A normal named call
result = addIntermediateVar().getRef();
addStatement(new StatementCall((LValue) result, procedureName, parameters, new StatementSource(ctx), ensureUnusedComments(getCommentsSymbol(ctx))));
}
} else {
RValue procedurePointer = (RValue) this.visit(ctx.expr());
addStatement(new StatementCallPointer((LValue) tmpVarRef, procedurePointer, parameters, new StatementSource(ctx), ensureUnusedComments(getCommentsSymbol(ctx))));
result = addIntermediateVar().getRef();
addStatement(new StatementCallPointer((LValue) result, procedurePointer, parameters, new StatementSource(ctx), ensureUnusedComments(getCommentsSymbol(ctx))));
consumeExpr(procedurePointer);
}
for(RValue parameter : parameters) {
consumeExpr(parameter);
}
return tmpVarRef;
return result;
}
@Override
@ -2506,6 +2519,10 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
RValue child = (RValue) this.visit(ctx.expr());
String op = ((TerminalNode) ctx.getChild(0)).getSymbol().getText();
Operator operator = Operators.getUnary(op);
return addExprUnary(ctx, operator, child);
}
private RValue addExprUnary(ParserRuleContext ctx, Operator operator, RValue child) {
// Special handling of negative literal number
if(operator.equals(Operators.ADDRESS_OF)) {
ConstantValue constantAddressOf = constantifyAddressOf(child, new StatementSource(ctx));

View File

@ -44,9 +44,14 @@ public class TestPrograms {
public TestPrograms() {
}
@Test
public void testOperatorByte0Iintializer() throws IOException, URISyntaxException {
compileAndCompare("operator-byte0-initializer.c");
}
@Test
public void testOperatorByte3() throws IOException, URISyntaxException {
compileAndCompare("operator-byte3.c", log());
compileAndCompare("operator-byte3.c");
}
@Test

View File

@ -5,18 +5,10 @@
#include <mega65-dma.h>
#include <6502.h>
// Get the 0th byte of a double value
#define BYTE0(d) <(<(d))
// Get the 1th byte of a double value
#define BYTE1(d) >(<(d))
// Get the 2th byte of a double value
#define BYTE2(d) <(>(d))
// Get the 3th byte of a double value
#define BYTE3(d) >(>(d))
// Get the low byte from a word/int
#define LOBYTE(w) <(w)
#define LOBYTE(w) BYTE0(w)
// Get the high byte from a word/int
#define HIBYTE(w) >(w)
#define HIBYTE(w) BYTE1(w)
// Poke a byte value into memory
#define POKE(addr,val) *((char*)(addr)) = val

View File

@ -6,18 +6,10 @@
#include <mega65-dma.h>
#include <6502.h>
// Get the 0th byte of a double value
#define BYTE0(d) <(<(d))
// Get the 1th byte of a double value
#define BYTE1(d) >(<(d))
// Get the 2th byte of a double value
#define BYTE2(d) <(>(d))
// Get the 3th byte of a double value
#define BYTE3(d) >(>(d))
// Get the low byte from a word/int
#define LOBYTE(w) <(w)
#define LOBYTE(w) BYTE0(w)
// Get the high byte from a word/int
#define HIBYTE(w) >(w)
#define HIBYTE(w) BYTE1(w)
// Poke a byte value into memory
#define POKE(addr,val) *((char*)(addr)) = val

View File

@ -0,0 +1,19 @@
// Test operator BYTE0() / BYTE1() in initializers
char VALS[] = {
BYTE0(123123123),
BYTE1(123123123),
BYTE2(123123123),
BYTE3(123123123)
};
void main() {
char * const SCREEN = 0x0400;
char i = 0;
SCREEN[i++] = VALS[0];
SCREEN[i++] = VALS[1];
SCREEN[i++] = VALS[2];
SCREEN[i++] = VALS[3];
}

View File

@ -23,7 +23,7 @@ fn1: {
rts
}
main: {
.label __1 = 3
.label __0 = 3
.label i = 2
lda #0
sta.z i
@ -34,10 +34,10 @@ main: {
lda.z i
jsr getfn
// (*getfn(++i))()
jsr bi___1
jsr bi___0
jmp __b2
bi___1:
jmp (__1)
bi___0:
jmp (__0)
}
// getfn(byte register(A) b)
getfn: {

View File

@ -29,8 +29,8 @@ main::@2: scope:[main] from main::@1
[9] getfn::return#0 = getfn::return#3
to:main::@3
main::@3: scope:[main] from main::@2
[10] main::$1 = getfn::return#0
[11] call *main::$1
[10] main::$0 = getfn::return#0
[11] call *main::$0
to:main::@1
void()* getfn(byte getfn::b)

View File

@ -21,8 +21,8 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2
main::i#4 = phi( main::@2/main::i#1 )
getfn::return#4 = phi( main::@2/getfn::return#0 )
main::$1 = getfn::return#4
call *main::$1
main::$0 = getfn::return#4
call *main::$0
to:main::@1
main::@return: scope:[main] from main::@1
return
@ -93,7 +93,7 @@ void()* getfn::return#3
void()* getfn::return#4
void()* getfn::return#5
void main()
void()*~ main::$1
void()*~ main::$0
byte main::i
byte main::i#0
byte main::i#1
@ -188,8 +188,8 @@ main::@2: scope:[main] from main::@1
[9] getfn::return#0 = getfn::return#3
to:main::@3
main::@3: scope:[main] from main::@2
[10] main::$1 = getfn::return#0
[11] call *main::$1
[10] main::$0 = getfn::return#0
[11] call *main::$0
to:main::@1
void()* getfn(byte getfn::b)
@ -217,7 +217,7 @@ void()* getfn::return
void()* getfn::return#0 22.0
void()* getfn::return#3 3.6666666666666665
void main()
void()*~ main::$1 11.0
void()*~ main::$0 11.0
byte main::i
byte main::i#1 5.5
byte main::i#2 22.0
@ -227,54 +227,54 @@ Initial phi equivalence classes
[ getfn::return#3 ]
Added variable getfn::b#0 to live range equivalence class [ getfn::b#0 ]
Added variable getfn::return#0 to live range equivalence class [ getfn::return#0 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable getfn::$0 to live range equivalence class [ getfn::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ getfn::return#3 ]
[ getfn::b#0 ]
[ getfn::return#0 ]
[ main::$1 ]
[ main::$0 ]
[ getfn::$0 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[2]:3 [ getfn::return#3 ]
Allocated zp[1]:5 [ getfn::b#0 ]
Allocated zp[2]:6 [ getfn::return#0 ]
Allocated zp[2]:8 [ main::$1 ]
Allocated zp[2]:8 [ main::$0 ]
Allocated zp[1]:10 [ getfn::$0 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] getfn::return#0 = getfn::return#3 [ main::i#1 getfn::return#0 ] ( [ main::i#1 getfn::return#0 ] { { getfn::b#0 = main::i#1 } { getfn::return#0 = getfn::return#3 } } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [10] main::$1 = getfn::return#0 [ main::i#1 main::$1 ] ( [ main::i#1 main::$1 ] { } ) always clobbers reg byte a
Statement [11] call *main::$1 [ main::i#1 ] ( [ main::i#1 ] { } ) always clobbers reg byte a reg byte x reg byte y
Statement [10] main::$0 = getfn::return#0 [ main::i#1 main::$0 ] ( [ main::i#1 main::$0 ] { } ) always clobbers reg byte a
Statement [11] call *main::$0 [ main::i#1 ] ( [ main::i#1 ] { } ) always clobbers reg byte a reg byte x reg byte y
Removing always clobbered register reg byte x as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [9] getfn::return#0 = getfn::return#3 [ main::i#1 getfn::return#0 ] ( [ main::i#1 getfn::return#0 ] { { getfn::b#0 = main::i#1 } { getfn::return#0 = getfn::return#3 } } ) always clobbers reg byte a
Statement [10] main::$1 = getfn::return#0 [ main::i#1 main::$1 ] ( [ main::i#1 main::$1 ] { } ) always clobbers reg byte a
Statement [11] call *main::$1 [ main::i#1 ] ( [ main::i#1 ] { } ) always clobbers reg byte a reg byte x reg byte y
Statement [10] main::$0 = getfn::return#0 [ main::i#1 main::$0 ] ( [ main::i#1 main::$0 ] { } ) always clobbers reg byte a
Statement [11] call *main::$0 [ main::i#1 ] ( [ main::i#1 ] { } ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 ,
Potential registers zp[2]:3 [ getfn::return#3 ] : zp[2]:3 ,
Potential registers zp[1]:5 [ getfn::b#0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[2]:6 [ getfn::return#0 ] : zp[2]:6 ,
Potential registers zp[2]:8 [ main::$1 ] : zp[2]:8 ,
Potential registers zp[2]:8 [ main::$0 ] : zp[2]:8 ,
Potential registers zp[1]:10 [ getfn::$0 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [getfn] 202: zp[1]:10 [ getfn::$0 ] 112: zp[1]:5 [ getfn::b#0 ] 22: zp[2]:6 [ getfn::return#0 ] 3.67: zp[2]:3 [ getfn::return#3 ]
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 11: zp[2]:8 [ main::$1 ]
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 11: zp[2]:8 [ main::$0 ]
Uplift Scope [fn1]
Uplift Scope [fn2]
Uplift Scope []
Uplifting [getfn] best 731 combination reg byte a [ getfn::$0 ] reg byte a [ getfn::b#0 ] zp[2]:6 [ getfn::return#0 ] zp[2]:3 [ getfn::return#3 ]
Uplifting [main] best 731 combination zp[1]:2 [ main::i#2 main::i#1 ] zp[2]:8 [ main::$1 ]
Uplifting [main] best 731 combination zp[1]:2 [ main::i#2 main::i#1 ] zp[2]:8 [ main::$0 ]
Uplifting [fn1] best 731 combination
Uplifting [fn2] best 731 combination
Uplifting [] best 731 combination
Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ]
Uplifting [main] best 731 combination zp[1]:2 [ main::i#2 main::i#1 ]
Coalescing zero page register [ zp[2]:3 [ getfn::return#3 ] ] with [ zp[2]:6 [ getfn::return#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:3 [ getfn::return#3 getfn::return#0 ] ] with [ zp[2]:8 [ main::$1 ] ] - score: 1
Coalescing zero page register [ zp[2]:3 [ getfn::return#3 getfn::return#0 ] ] with [ zp[2]:8 [ main::$0 ] ] - score: 1
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -314,7 +314,7 @@ fn1: {
}
// main
main: {
.label __1 = 3
.label __0 = 3
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
@ -337,15 +337,15 @@ main: {
jmp __b3
// main::@3
__b3:
// [10] main::$1 = getfn::return#0
// [11] call *main::$1
jsr bi___1
// [10] main::$0 = getfn::return#0
// [11] call *main::$0
jsr bi___0
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
__b1_from___b3:
// [5] phi main::i#2 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp __b1
bi___1:
jmp (__1)
bi___0:
jmp (__0)
}
// getfn
// getfn(byte register(A) b)
@ -424,13 +424,13 @@ void()* getfn::return
void()* getfn::return#0 return zp[2]:3 22.0
void()* getfn::return#3 return zp[2]:3 3.6666666666666665
void main()
void()*~ main::$1 zp[2]:3 11.0
void()*~ main::$0 zp[2]:3 11.0
byte main::i
byte main::i#1 i zp[1]:2 5.5
byte main::i#2 i zp[1]:2 22.0
zp[1]:2 [ main::i#2 main::i#1 ]
zp[2]:3 [ getfn::return#3 getfn::return#0 main::$1 ]
zp[2]:3 [ getfn::return#3 getfn::return#0 main::$0 ]
reg byte a [ getfn::b#0 ]
reg byte a [ getfn::$0 ]
@ -475,7 +475,7 @@ fn1: {
}
// main
main: {
.label __1 = 3
.label __0 = 3
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
@ -494,15 +494,15 @@ main: {
jsr getfn
// [9] getfn::return#0 = getfn::return#3
// main::@3
// [10] main::$1 = getfn::return#0
// [10] main::$0 = getfn::return#0
// (*getfn(++i))()
// [11] call *main::$1
jsr bi___1
// [11] call *main::$0
jsr bi___0
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi main::i#2 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp __b2
bi___1:
jmp (__1)
bi___0:
jmp (__0)
}
// getfn
// getfn(byte register(A) b)

View File

@ -10,12 +10,12 @@ void()* getfn::return
void()* getfn::return#0 return zp[2]:3 22.0
void()* getfn::return#3 return zp[2]:3 3.6666666666666665
void main()
void()*~ main::$1 zp[2]:3 11.0
void()*~ main::$0 zp[2]:3 11.0
byte main::i
byte main::i#1 i zp[1]:2 5.5
byte main::i#2 i zp[1]:2 22.0
zp[1]:2 [ main::i#2 main::i#1 ]
zp[2]:3 [ getfn::return#3 getfn::return#0 main::$1 ]
zp[2]:3 [ getfn::return#3 getfn::return#0 main::$0 ]
reg byte a [ getfn::b#0 ]
reg byte a [ getfn::$0 ]

View File

@ -20,8 +20,8 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2
main::i#4 = phi( main::@2/main::i#1 )
getfn::return#3 = phi( main::@2/getfn::return#0 )
main::$1 = getfn::return#3
call *main::$1
main::$0 = getfn::return#3
call *main::$0
to:main::@1
main::@return: scope:[main] from main::@1
return
@ -69,7 +69,7 @@ void()* getfn::return#2
void()* getfn::return#3
void()* getfn::return#4
void main()
void()*~ main::$1
void()*~ main::$0
byte main::i
byte main::i#0
byte main::i#1
@ -89,14 +89,14 @@ Constant getfn::return#1 = &fn1
Successful SSA optimization Pass2ConstantIdentification
Constant getfn::return#0 = getfn::return#1
Successful SSA optimization Pass2ConstantIdentification
Constant main::$1 = getfn::return#0
Constant main::$0 = getfn::return#0
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function [8] call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
if() condition always true - replacing block destination [2] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable getfn::b#0 and assignment [2] getfn::b#0 = main::i#1
Eliminating unused constant main::$1
Eliminating unused constant main::$0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant getfn::return#0
Successful SSA optimization PassNEliminateUnusedVars

View File

@ -0,0 +1,29 @@
// Test operator BYTE0() / BYTE1() in initializers
// Commodore 64 PRG executable file
.file [name="operator-byte0-initializer.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
// SCREEN[i++] = VALS[0]
lda VALS
sta SCREEN
// SCREEN[i++] = VALS[1]
lda VALS+1
sta SCREEN+1
// SCREEN[i++] = VALS[2]
lda VALS+2
sta SCREEN+2
// SCREEN[i++] = VALS[3]
lda VALS+3
sta SCREEN+3
// }
rts
}
.segment Data
VALS: .byte <($756b5b3), >($756b5b3), <($756b5b3>>$10), >($756b5b3>>$10)

View File

@ -0,0 +1,11 @@
void main()
main: scope:[main] from
[0] *main::SCREEN = *VALS
[1] *(main::SCREEN+1) = *(VALS+1)
[2] *(main::SCREEN+2) = *(VALS+2)
[3] *(main::SCREEN+3) = *(VALS+3)
to:main::@return
main::@return: scope:[main] from main
[4] return
to:@return

View File

@ -0,0 +1,244 @@
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
main::i#0 = 0
main::SCREEN[main::i#0] = VALS[0]
main::i#1 = ++ main::i#0
main::SCREEN[main::i#1] = VALS[1]
main::i#2 = ++ main::i#1
main::SCREEN[main::i#2] = VALS[2]
main::i#3 = ++ main::i#2
main::SCREEN[main::i#3] = VALS[3]
main::i#4 = ++ main::i#3
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
const byte* VALS[] = { <$756b5b3, >$756b5b3, _byte2_$756b5b3, _byte3_$756b5b3 }
void __start()
void main()
const nomodify byte* main::SCREEN = (byte*)$400
byte main::i
byte main::i#0
byte main::i#1
byte main::i#2
byte main::i#3
byte main::i#4
Adding number conversion cast (unumber) 0 in main::SCREEN[main::i#0] = VALS[0]
Adding number conversion cast (unumber) 1 in main::SCREEN[main::i#1] = VALS[1]
Adding number conversion cast (unumber) 2 in main::SCREEN[main::i#2] = VALS[2]
Adding number conversion cast (unumber) 3 in main::SCREEN[main::i#3] = VALS[3]
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero VALS in [1] main::SCREEN[main::i#0] = VALS[0]
Simplifying expression containing zero main::SCREEN in [1] main::SCREEN[main::i#0] = *VALS
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::i#4 and assignment [7] main::i#4 = ++ main::i#3
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 [1] 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 [2] 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 [3] main::i#3 = ++ main::i#2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::i#3 = ++main::i#2
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
Constant inlined main::i#0 = 0
Constant inlined main::i#2 = ++++0
Constant inlined main::i#1 = ++0
Constant inlined main::i#3 = ++++++0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(VALS+1)
Consolidated array index constant in *(main::SCREEN+++0)
Consolidated array index constant in *(VALS+2)
Consolidated array index constant in *(main::SCREEN+++++0)
Consolidated array index constant in *(VALS+3)
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
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Successful SSA optimization Pass2ConstantSimplification
Finalized unsigned number type (dword) $756b5b3
Finalized unsigned number type (dword) $756b5b3
Finalized unsigned number type (dword) $756b5b3
Finalized unsigned number type (dword) $756b5b3
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::SCREEN = *VALS
[1] *(main::SCREEN+1) = *(VALS+1)
[2] *(main::SCREEN+2) = *(VALS+2)
[3] *(main::SCREEN+3) = *(VALS+3)
to:main::@return
main::@return: scope:[main] from main
[4] return
to:@return
VARIABLE REGISTER WEIGHTS
void main()
byte main::i
Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *main::SCREEN = *VALS [ ] ( [ ] { } ) always clobbers reg byte a
Statement [1] *(main::SCREEN+1) = *(VALS+1) [ ] ( [ ] { } ) always clobbers reg byte a
Statement [2] *(main::SCREEN+2) = *(VALS+2) [ ] ( [ ] { } ) always clobbers reg byte a
Statement [3] *(main::SCREEN+3) = *(VALS+3) [ ] ( [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 41 combination
Uplifting [] best 41 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test operator BYTE0() / BYTE1() in initializers
// Upstart
// Commodore 64 PRG executable file
.file [name="operator-byte0-initializer.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
// [0] *main::SCREEN = *VALS -- _deref_pbuc1=_deref_pbuc2
lda VALS
sta SCREEN
// [1] *(main::SCREEN+1) = *(VALS+1) -- _deref_pbuc1=_deref_pbuc2
lda VALS+1
sta SCREEN+1
// [2] *(main::SCREEN+2) = *(VALS+2) -- _deref_pbuc1=_deref_pbuc2
lda VALS+2
sta SCREEN+2
// [3] *(main::SCREEN+3) = *(VALS+3) -- _deref_pbuc1=_deref_pbuc2
lda VALS+3
sta SCREEN+3
jmp __breturn
// main::@return
__breturn:
// [4] return
rts
}
// File Data
.segment Data
VALS: .byte <($756b5b3), >($756b5b3), <($756b5b3>>$10), >($756b5b3>>$10)
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const byte* VALS[] = { <$756b5b3, >$756b5b3, _byte2_$756b5b3, _byte3_$756b5b3 }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
byte main::i
FINAL ASSEMBLER
Score: 38
// File Comments
// Test operator BYTE0() / BYTE1() in initializers
// Upstart
// Commodore 64 PRG executable file
.file [name="operator-byte0-initializer.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
// SCREEN[i++] = VALS[0]
// [0] *main::SCREEN = *VALS -- _deref_pbuc1=_deref_pbuc2
lda VALS
sta SCREEN
// SCREEN[i++] = VALS[1]
// [1] *(main::SCREEN+1) = *(VALS+1) -- _deref_pbuc1=_deref_pbuc2
lda VALS+1
sta SCREEN+1
// SCREEN[i++] = VALS[2]
// [2] *(main::SCREEN+2) = *(VALS+2) -- _deref_pbuc1=_deref_pbuc2
lda VALS+2
sta SCREEN+2
// SCREEN[i++] = VALS[3]
// [3] *(main::SCREEN+3) = *(VALS+3) -- _deref_pbuc1=_deref_pbuc2
lda VALS+3
sta SCREEN+3
// main::@return
// }
// [4] return
rts
}
// File Data
.segment Data
VALS: .byte <($756b5b3), >($756b5b3), <($756b5b3>>$10), >($756b5b3>>$10)

View File

@ -0,0 +1,5 @@
const byte* VALS[] = { <$756b5b3, >$756b5b3, _byte2_$756b5b3, _byte3_$756b5b3 }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
byte main::i

View File

@ -10,20 +10,20 @@ main: scope:[main] from
[6] main::ptr = (byte*) 0
[7] *main::SCREEN = <$11
[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
[9] main::$0 = < main::bu
[10] *(main::SCREEN+2) = main::$0
[11] main::$1 = < main::bs
[12] *(main::SCREEN+3) = main::$1
[13] main::$2 = < main::wu
[14] *(main::SCREEN+4) = main::$2
[15] main::$3 = < main::ws
[16] *(main::SCREEN+5) = main::$3
[17] main::$4 = < main::du
[18] *(main::SCREEN+6) = main::$4
[19] main::$5 = < main::ds
[20] *(main::SCREEN+7) = main::$5
[21] main::$6 = < main::ptr
[22] *(main::SCREEN+8) = main::$6
to:main::@return
main::@return: scope:[main] from main
[23] return

View File

@ -11,32 +11,30 @@ main: scope:[main] from __start
main::ds = -$39a4f1
main::ptr = (byte*)0
main::i#0 = 0
main::$0 = < $11
main::SCREEN[main::i#0] = main::$0
main::SCREEN[main::i#0] = <$11
main::i#1 = ++ main::i#0
main::$1 = < $179
main::SCREEN[main::i#1] = main::$1
main::SCREEN[main::i#1] = <$179
main::i#2 = ++ main::i#1
main::$2 = < main::bu
main::SCREEN[main::i#2] = main::$2
main::$0 = < main::bu
main::SCREEN[main::i#2] = main::$0
main::i#3 = ++ main::i#2
main::$3 = < main::bs
main::SCREEN[main::i#3] = main::$3
main::$1 = < main::bs
main::SCREEN[main::i#3] = main::$1
main::i#4 = ++ main::i#3
main::$4 = < main::wu
main::SCREEN[main::i#4] = main::$4
main::$2 = < main::wu
main::SCREEN[main::i#4] = main::$2
main::i#5 = ++ main::i#4
main::$5 = < main::ws
main::SCREEN[main::i#5] = main::$5
main::$3 = < main::ws
main::SCREEN[main::i#5] = main::$3
main::i#6 = ++ main::i#5
main::$6 = < main::du
main::SCREEN[main::i#6] = main::$6
main::$4 = < main::du
main::SCREEN[main::i#6] = main::$4
main::i#7 = ++ main::i#6
main::$7 = < main::ds
main::SCREEN[main::i#7] = main::$7
main::$5 = < main::ds
main::SCREEN[main::i#7] = main::$5
main::i#8 = ++ main::i#7
main::$8 = < main::ptr
main::SCREEN[main::i#8] = main::$8
main::$6 = < main::ptr
main::SCREEN[main::i#8] = main::$6
main::i#9 = ++ main::i#8
to:main::@return
main::@return: scope:[main] from main
@ -63,8 +61,6 @@ byte~ main::$3
byte~ main::$4
byte~ main::$5
byte~ main::$6
byte~ main::$7
byte~ main::$8
const nomodify byte* main::SCREEN = (byte*)$400
volatile signed byte main::bs loadstore
volatile byte main::bu loadstore
@ -88,14 +84,9 @@ 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 = < $11
Constant right-side identified [11] main::$1 = < $179
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::i#0 = 0
Constant main::$0 = <$11
Constant main::$1 = <$179
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
Simplifying expression containing zero main::SCREEN in [8] main::SCREEN[main::i#0] = <$11
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::i#9 and assignment [31] main::i#9 = ++ main::i#8
Successful SSA optimization PassNEliminateUnusedVars
@ -147,11 +138,9 @@ 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 = <$11
Constant inlined main::i#5 = ++++++++++0
Constant inlined main::i#0 = 0
Constant inlined main::i#2 = ++++0
@ -204,20 +193,20 @@ main: scope:[main] from
[6] main::ptr = (byte*) 0
[7] *main::SCREEN = <$11
[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
[9] main::$0 = < main::bu
[10] *(main::SCREEN+2) = main::$0
[11] main::$1 = < main::bs
[12] *(main::SCREEN+3) = main::$1
[13] main::$2 = < main::wu
[14] *(main::SCREEN+4) = main::$2
[15] main::$3 = < main::ws
[16] *(main::SCREEN+5) = main::$3
[17] main::$4 = < main::du
[18] *(main::SCREEN+6) = main::$4
[19] main::$5 = < main::ds
[20] *(main::SCREEN+7) = main::$5
[21] main::$6 = < main::ptr
[22] *(main::SCREEN+8) = main::$6
to:main::@return
main::@return: scope:[main] from main
[23] return
@ -226,13 +215,13 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
void main()
byte~ main::$0 4.0
byte~ main::$1 4.0
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
@ -250,13 +239,13 @@ 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::$0 to live range equivalence class [ main::$0 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
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 ]
@ -265,13 +254,13 @@ Complete equivalence classes
[ main::du ]
[ main::ds ]
[ main::ptr ]
[ main::$0 ]
[ main::$1 ]
[ 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 ]
@ -279,13 +268,13 @@ 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[1]:18 [ main::$0 ]
Allocated zp[1]:19 [ main::$1 ]
Allocated zp[1]:20 [ main::$2 ]
Allocated zp[1]:21 [ main::$3 ]
Allocated zp[1]:22 [ main::$4 ]
Allocated zp[1]:23 [ main::$5 ]
Allocated zp[1]:24 [ main::$6 ]
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
@ -296,8 +285,8 @@ Statement [5] main::ds = -$39a4f1 [ main::bu main::bs main::wu main::ws main::du
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 = <$11 [ 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
Statement [9] main::$2 = < main::bu [ main::bs main::wu main::ws main::du main::ds main::ptr main::$2 ] ( [ main::bs main::wu main::ws main::du main::ds main::ptr main::$2 ] { } ) always clobbers reg byte a
Statement [11] main::$3 = < main::bs [ main::wu main::ws main::du main::ds main::ptr main::$3 ] ( [ main::wu main::ws main::du main::ds main::ptr main::$3 ] { } ) always clobbers reg byte a
Statement [9] main::$0 = < main::bu [ main::bs main::wu main::ws main::du main::ds main::ptr main::$0 ] ( [ main::bs main::wu main::ws main::du main::ds main::ptr main::$0 ] { } ) always clobbers reg byte a
Statement [11] main::$1 = < main::bs [ main::wu main::ws main::du main::ds main::ptr main::$1 ] ( [ main::wu main::ws main::du main::ds main::ptr main::$1 ] { } ) 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 ,
@ -305,27 +294,27 @@ 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 ,
Potential registers zp[1]:18 [ main::$0 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:19 [ main::$1 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:20 [ main::$2 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:21 [ main::$3 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:22 [ main::$4 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:23 [ main::$5 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:24 [ main::$6 ] : zp[1]:24 , 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]:18 [ main::$0 ] 4: zp[1]:19 [ main::$1 ] 4: zp[1]:20 [ main::$2 ] 4: zp[1]:21 [ main::$3 ] 4: zp[1]:22 [ main::$4 ] 4: zp[1]:23 [ main::$5 ] 4: zp[1]:24 [ main::$6 ] 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 []
Uplifting [main] best 168 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 ]
Uplifting [main] best 168 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] zp[1]:22 [ main::$4 ] zp[1]:23 [ main::$5 ] zp[1]:24 [ main::$6 ] 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 168 combination
Attempting to uplift remaining variables inzp[1]:22 [ main::$6 ]
Uplifting [main] best 162 combination reg byte a [ main::$6 ]
Attempting to uplift remaining variables inzp[1]:23 [ main::$7 ]
Uplifting [main] best 156 combination reg byte a [ main::$7 ]
Attempting to uplift remaining variables inzp[1]:24 [ main::$8 ]
Uplifting [main] best 150 combination reg byte a [ main::$8 ]
Attempting to uplift remaining variables inzp[1]:22 [ main::$4 ]
Uplifting [main] best 162 combination reg byte a [ main::$4 ]
Attempting to uplift remaining variables inzp[1]:23 [ main::$5 ]
Uplifting [main] best 156 combination reg byte a [ main::$5 ]
Attempting to uplift remaining variables inzp[1]:24 [ main::$6 ]
Uplifting [main] best 150 combination reg byte a [ main::$6 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::bu ]
Uplifting [main] best 150 combination zp[1]:2 [ main::bu ]
Attempting to uplift remaining variables inzp[1]:3 [ main::bs ]
@ -400,33 +389,33 @@ main: {
// [8] *(main::SCREEN+1) = <$179 -- _deref_pbuc1=vbuc2
lda #<($179)
sta SCREEN+1
// [9] main::$2 = < main::bu -- vbuaa=_byte0_vbuz1
// [9] main::$0 = < main::bu -- vbuaa=_byte0_vbuz1
lda.z bu
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+2) = main::$0 -- _deref_pbuc1=vbuaa
sta SCREEN+2
// [11] main::$3 = < main::bs -- vbuaa=_byte0_vbsz1
// [11] main::$1 = < main::bs -- vbuaa=_byte0_vbsz1
lda.z bs
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+3) = main::$1 -- _deref_pbuc1=vbuaa
sta SCREEN+3
// [13] main::$4 = < main::wu -- vbuaa=_byte0_vwuz1
// [13] main::$2 = < main::wu -- vbuaa=_byte0_vwuz1
lda.z wu
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
// [14] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
sta SCREEN+4
// [15] main::$5 = < main::ws -- vbuaa=_byte0_vwsz1
// [15] main::$3 = < main::ws -- vbuaa=_byte0_vwsz1
lda.z ws
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
// [16] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
sta SCREEN+5
// [17] main::$6 = < main::du -- vbuaa=_byte0_vduz1
// [17] main::$4 = < main::du -- vbuaa=_byte0_vduz1
lda.z du
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
// [18] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+6
// [19] main::$7 = < main::ds -- vbuaa=_byte0_vdsz1
// [19] main::$5 = < main::ds -- vbuaa=_byte0_vdsz1
lda.z ds
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [20] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// [21] main::$8 = < main::ptr -- vbuaa=_byte0_pbuz1
// [21] main::$6 = < main::ptr -- vbuaa=_byte0_pbuz1
lda.z ptr
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [22] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
sta SCREEN+8
jmp __breturn
// main::@return
@ -447,13 +436,13 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
void main()
byte~ main::$0 reg byte a 4.0
byte~ main::$1 reg byte a 4.0
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
@ -471,13 +460,13 @@ zp[2]:6 [ main::ws ]
zp[4]:8 [ main::du ]
zp[4]:12 [ main::ds ]
zp[2]:16 [ main::ptr ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
reg byte a [ main::$6 ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
FINAL ASSEMBLER
@ -559,46 +548,46 @@ main: {
lda #<($179)
sta SCREEN+1
// BYTE0(bu)
// [9] main::$2 = < main::bu -- vbuaa=_byte0_vbuz1
// [9] main::$0 = < main::bu -- vbuaa=_byte0_vbuz1
lda.z bu
// SCREEN[i++] = BYTE0(bu)
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+2) = main::$0 -- _deref_pbuc1=vbuaa
sta SCREEN+2
// BYTE0(bs)
// [11] main::$3 = < main::bs -- vbuaa=_byte0_vbsz1
// [11] main::$1 = < main::bs -- vbuaa=_byte0_vbsz1
lda.z bs
// SCREEN[i++] = BYTE0(bs)
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+3) = main::$1 -- _deref_pbuc1=vbuaa
sta SCREEN+3
// BYTE0(wu)
// [13] main::$4 = < main::wu -- vbuaa=_byte0_vwuz1
// [13] main::$2 = < main::wu -- vbuaa=_byte0_vwuz1
lda.z wu
// SCREEN[i++] = BYTE0(wu)
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
// [14] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
sta SCREEN+4
// BYTE0(ws)
// [15] main::$5 = < main::ws -- vbuaa=_byte0_vwsz1
// [15] main::$3 = < main::ws -- vbuaa=_byte0_vwsz1
lda.z ws
// SCREEN[i++] = BYTE0(ws)
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
// [16] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
sta SCREEN+5
// BYTE0(du)
// [17] main::$6 = < main::du -- vbuaa=_byte0_vduz1
// [17] main::$4 = < main::du -- vbuaa=_byte0_vduz1
lda.z du
// SCREEN[i++] = BYTE0(du)
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
// [18] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+6
// BYTE0(ds)
// [19] main::$7 = < main::ds -- vbuaa=_byte0_vdsz1
// [19] main::$5 = < main::ds -- vbuaa=_byte0_vdsz1
lda.z ds
// SCREEN[i++] = BYTE0(ds)
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [20] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// BYTE0(ptr)
// [21] main::$8 = < main::ptr -- vbuaa=_byte0_pbuz1
// [21] main::$6 = < main::ptr -- vbuaa=_byte0_pbuz1
lda.z ptr
// SCREEN[i++] = BYTE0(ptr)
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [22] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// main::@return
// }

View File

@ -1,11 +1,11 @@
void main()
byte~ main::$0 reg byte a 4.0
byte~ main::$1 reg byte a 4.0
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
@ -23,10 +23,10 @@ zp[2]:6 [ main::ws ]
zp[4]:8 [ main::du ]
zp[4]:12 [ main::ds ]
zp[2]:16 [ main::ptr ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
reg byte a [ main::$6 ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]

View File

@ -10,16 +10,16 @@ main: scope:[main] from
[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
[9] main::$2 = > main::wu
[10] *(main::SCREEN+4) = main::$2
[11] main::$3 = > main::ws
[12] *(main::SCREEN+5) = main::$3
[13] main::$4 = > main::du
[14] *(main::SCREEN+6) = main::$4
[15] main::$5 = > main::ds
[16] *(main::SCREEN+7) = main::$5
[17] main::$6 = > main::ptr
[18] *(main::SCREEN+8) = main::$6
to:main::@return
main::@return: scope:[main] from main
[19] return

View File

@ -11,32 +11,30 @@ main: scope:[main] from __start
main::ds = -$39a4f1
main::ptr = (byte*)0
main::i#0 = 0
main::$0 = > $11
main::SCREEN[main::i#0] = main::$0
main::SCREEN[main::i#0] = >$11
main::i#1 = ++ main::i#0
main::$1 = > $179
main::SCREEN[main::i#1] = main::$1
main::SCREEN[main::i#1] = >$179
main::i#2 = ++ main::i#1
main::$2 = > main::bu
main::SCREEN[main::i#2] = main::$2
main::$0 = > main::bu
main::SCREEN[main::i#2] = main::$0
main::i#3 = ++ main::i#2
main::$3 = > main::bs
main::SCREEN[main::i#3] = main::$3
main::$1 = > main::bs
main::SCREEN[main::i#3] = main::$1
main::i#4 = ++ main::i#3
main::$4 = > main::wu
main::SCREEN[main::i#4] = main::$4
main::$2 = > main::wu
main::SCREEN[main::i#4] = main::$2
main::i#5 = ++ main::i#4
main::$5 = > main::ws
main::SCREEN[main::i#5] = main::$5
main::$3 = > main::ws
main::SCREEN[main::i#5] = main::$3
main::i#6 = ++ main::i#5
main::$6 = > main::du
main::SCREEN[main::i#6] = main::$6
main::$4 = > main::du
main::SCREEN[main::i#6] = main::$4
main::i#7 = ++ main::i#6
main::$7 = > main::ds
main::SCREEN[main::i#7] = main::$7
main::$5 = > main::ds
main::SCREEN[main::i#7] = main::$5
main::i#8 = ++ main::i#7
main::$8 = > main::ptr
main::SCREEN[main::i#8] = main::$8
main::$6 = > main::ptr
main::SCREEN[main::i#8] = main::$6
main::i#9 = ++ main::i#8
to:main::@return
main::@return: scope:[main] from main
@ -63,8 +61,6 @@ byte~ main::$3
byte~ main::$4
byte~ main::$5
byte~ main::$6
byte~ main::$7
byte~ main::$8
const nomodify byte* main::SCREEN = (byte*)$400
volatile signed byte main::bs loadstore
volatile byte main::bu loadstore
@ -88,20 +84,16 @@ 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 = > $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
Constant right-side identified [12] main::$0 = > main::bu
Constant right-side identified [15] main::$1 = > 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
Constant main::$0 = 0
Constant main::$1 = 0
Successful SSA optimization Pass2ConstantIdentification
Simplifying constant evaluating to zero >$11 in
Simplifying constant evaluating to zero >$11 in [8] main::SCREEN[main::i#0] = >$11
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
Simplifying expression containing zero main::SCREEN in [8] main::SCREEN[main::i#0] = 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
@ -155,15 +147,13 @@ 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 = 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 = >$179
Constant inlined main::$2 = 0
Constant inlined main::$0 = 0
Constant inlined main::i#5 = ++++++++++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
@ -213,16 +203,16 @@ main: scope:[main] from
[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
[9] main::$2 = > main::wu
[10] *(main::SCREEN+4) = main::$2
[11] main::$3 = > main::ws
[12] *(main::SCREEN+5) = main::$3
[13] main::$4 = > main::du
[14] *(main::SCREEN+6) = main::$4
[15] main::$5 = > main::ds
[16] *(main::SCREEN+7) = main::$5
[17] main::$6 = > main::ptr
[18] *(main::SCREEN+8) = main::$6
to:main::@return
main::@return: scope:[main] from main
[19] return
@ -231,11 +221,11 @@ main::@return: scope:[main] from main
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 dword main::ds loadstore 0.3333333333333333
volatile dword main::du loadstore 0.36363636363636365
byte main::i
@ -249,32 +239,32 @@ 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::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[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 ]
Allocated zp[1]:16 [ main::$2 ]
Allocated zp[1]:17 [ main::$3 ]
Allocated zp[1]:18 [ main::$4 ]
Allocated zp[1]:19 [ main::$5 ]
Allocated zp[1]:20 [ main::$6 ]
REGISTER UPLIFT POTENTIAL REGISTERS
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
@ -290,21 +280,21 @@ 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 ,
Potential registers zp[1]:16 [ main::$2 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:17 [ main::$3 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:18 [ main::$4 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:19 [ main::$5 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:20 [ main::$6 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
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 [main] 4: zp[1]:16 [ main::$2 ] 4: zp[1]:17 [ main::$3 ] 4: zp[1]:18 [ main::$4 ] 4: zp[1]:19 [ main::$5 ] 4: zp[1]:20 [ main::$6 ] 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 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 ]
Uplifting [main] best 144 combination reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[1]:20 [ main::$6 ] 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 ]
Attempting to uplift remaining variables inzp[1]:20 [ main::$6 ]
Uplifting [main] best 138 combination reg byte a [ main::$6 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -373,25 +363,25 @@ main: {
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
lda #0
sta SCREEN+3
// [9] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
// [9] main::$2 = > main::wu -- vbuaa=_byte1_vwuz1
lda.z wu+1
// [10] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
sta SCREEN+4
// [11] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
// [11] main::$3 = > main::ws -- vbuaa=_byte1_vwsz1
lda.z ws+1
// [12] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
sta SCREEN+5
// [13] main::$6 = > main::du -- vbuaa=_byte1_vduz1
// [13] main::$4 = > main::du -- vbuaa=_byte1_vduz1
lda.z du+1
// [14] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
// [14] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+6
// [15] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
// [15] main::$5 = > main::ds -- vbuaa=_byte1_vdsz1
lda.z ds+1
// [16] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [16] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// [17] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
// [17] main::$6 = > main::ptr -- vbuaa=_byte1_pbuz1
lda.z ptr+1
// [18] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [18] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
sta SCREEN+8
jmp __breturn
// main::@return
@ -413,11 +403,11 @@ 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 dword main::ds loadstore zp[4]:10 0.3333333333333333
volatile dword main::du loadstore zp[4]:6 0.36363636363636365
@ -431,11 +421,11 @@ zp[2]:4 [ main::ws ]
zp[4]:6 [ main::du ]
zp[4]:10 [ main::ds ]
zp[2]:14 [ main::ptr ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
reg byte a [ main::$6 ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
FINAL ASSEMBLER
@ -514,34 +504,34 @@ main: {
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
sta SCREEN+3
// BYTE1(wu)
// [9] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
// [9] main::$2 = > main::wu -- vbuaa=_byte1_vwuz1
lda.z wu+1
// SCREEN[i++] = BYTE1(wu)
// [10] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
sta SCREEN+4
// BYTE1(ws)
// [11] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
// [11] main::$3 = > main::ws -- vbuaa=_byte1_vwsz1
lda.z ws+1
// SCREEN[i++] = BYTE1(ws)
// [12] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
sta SCREEN+5
// BYTE1(du)
// [13] main::$6 = > main::du -- vbuaa=_byte1_vduz1
// [13] main::$4 = > main::du -- vbuaa=_byte1_vduz1
lda.z du+1
// SCREEN[i++] = BYTE1(du)
// [14] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
// [14] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+6
// BYTE1(ds)
// [15] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
// [15] main::$5 = > main::ds -- vbuaa=_byte1_vdsz1
lda.z ds+1
// SCREEN[i++] = BYTE1(ds)
// [16] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [16] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// BYTE1(ptr)
// [17] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
// [17] main::$6 = > main::ptr -- vbuaa=_byte1_pbuz1
lda.z ptr+1
// SCREEN[i++] = BYTE1(ptr)
// [18] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [18] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// main::@return
// }

View File

@ -1,9 +1,9 @@
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 dword main::ds loadstore zp[4]:10 0.3333333333333333
volatile dword main::du loadstore zp[4]:6 0.36363636363636365
@ -17,8 +17,8 @@ zp[2]:4 [ main::ws ]
zp[4]:6 [ main::du ]
zp[4]:10 [ main::ds ]
zp[2]:14 [ main::ptr ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
reg byte a [ main::$6 ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]

View File

@ -10,10 +10,10 @@ main: scope:[main] from
[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
[9] main::$4 = _byte2_ main::du
[10] *(main::SCREEN+7) = main::$4
[11] main::$5 = _byte2_ main::ds
[12] *(main::SCREEN+8) = main::$5
[13] *(main::SCREEN+9) = 0
to:main::@return
main::@return: scope:[main] from main

View File

@ -11,35 +11,32 @@ main: scope:[main] from __start
main::ds = -$39a4f1
main::ptr = (byte*)0
main::i#0 = 0
main::$0 = _byte2_ $11
main::SCREEN[main::i#0] = main::$0
main::SCREEN[main::i#0] = _byte2_$11
main::i#1 = ++ main::i#0
main::$1 = _byte2_ $179
main::SCREEN[main::i#1] = main::$1
main::SCREEN[main::i#1] = _byte2_$179
main::i#2 = ++ main::i#1
main::$2 = _byte2_ $5c3b1
main::SCREEN[main::i#2] = main::$2
main::SCREEN[main::i#2] = _byte2_$5c3b1
main::i#3 = ++ main::i#2
main::$3 = _byte2_ main::bu
main::SCREEN[main::i#3] = main::$3
main::$0 = _byte2_ main::bu
main::SCREEN[main::i#3] = main::$0
main::i#4 = ++ main::i#3
main::$4 = _byte2_ main::bs
main::SCREEN[main::i#4] = main::$4
main::$1 = _byte2_ main::bs
main::SCREEN[main::i#4] = main::$1
main::i#5 = ++ main::i#4
main::$5 = _byte2_ main::wu
main::SCREEN[main::i#5] = main::$5
main::$2 = _byte2_ main::wu
main::SCREEN[main::i#5] = main::$2
main::i#6 = ++ main::i#5
main::$6 = _byte2_ main::ws
main::SCREEN[main::i#6] = main::$6
main::$3 = _byte2_ main::ws
main::SCREEN[main::i#6] = main::$3
main::i#7 = ++ main::i#6
main::$7 = _byte2_ main::du
main::SCREEN[main::i#7] = main::$7
main::$4 = _byte2_ main::du
main::SCREEN[main::i#7] = main::$4
main::i#8 = ++ main::i#7
main::$8 = _byte2_ main::ds
main::SCREEN[main::i#8] = main::$8
main::$5 = _byte2_ main::ds
main::SCREEN[main::i#8] = main::$5
main::i#9 = ++ main::i#8
main::$9 = _byte2_ main::ptr
main::SCREEN[main::i#9] = main::$9
main::$6 = _byte2_ main::ptr
main::SCREEN[main::i#9] = main::$6
main::i#10 = ++ main::i#9
to:main::@return
main::@return: scope:[main] from main
@ -66,9 +63,6 @@ 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
@ -93,29 +87,23 @@ 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
Constant right-side identified [14] main::$0 = _byte2_ main::bu
Constant right-side identified [17] main::$1 = _byte2_ main::bs
Constant right-side identified [20] main::$2 = _byte2_ main::wu
Constant right-side identified [23] main::$3 = _byte2_ main::ws
Constant right-side identified [32] main::$6 = _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::$0 = 0
Constant main::$1 = 0
Constant main::$2 = 0
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
Simplifying constant evaluating to zero _byte2_$11 in [8] main::SCREEN[main::i#0] = _byte2_$11
Simplifying constant evaluating to zero _byte2_$179 in [10] main::SCREEN[main::i#1] = _byte2_$179
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
Simplifying expression containing zero main::SCREEN in [8] main::SCREEN[main::i#0] = 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
@ -183,16 +171,13 @@ 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::$2 = 0
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)
@ -243,10 +228,10 @@ main: scope:[main] from
[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
[9] main::$4 = _byte2_ main::du
[10] *(main::SCREEN+7) = main::$4
[11] main::$5 = _byte2_ main::ds
[12] *(main::SCREEN+8) = main::$5
[13] *(main::SCREEN+9) = 0
to:main::@return
main::@return: scope:[main] from main
@ -256,8 +241,8 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
void main()
byte~ main::$7 4.0
byte~ main::$8 4.0
byte~ main::$4 4.0
byte~ main::$5 4.0
volatile signed dword main::ds loadstore 0.4
volatile dword main::du loadstore 0.4444444444444444
byte main::i
@ -265,17 +250,17 @@ 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 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$5 to live range equivalence class [ main::$5 ]
Complete equivalence classes
[ main::du ]
[ main::ds ]
[ main::$7 ]
[ main::$8 ]
[ main::$4 ]
[ main::$5 ]
Allocated zp[4]:2 [ main::du ]
Allocated zp[4]:6 [ main::ds ]
Allocated zp[1]:10 [ main::$7 ]
Allocated zp[1]:11 [ main::$8 ]
Allocated zp[1]:10 [ main::$4 ]
Allocated zp[1]:11 [ main::$5 ]
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
@ -289,14 +274,14 @@ Statement [8] *(main::SCREEN+6) = 0 [ main::du main::ds ] ( [ main::du main::ds
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 ,
Potential registers zp[1]:10 [ main::$4 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:11 [ main::$5 ] : 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 [main] 4: zp[1]:10 [ main::$4 ] 4: zp[1]:11 [ main::$5 ] 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 [main] best 111 combination reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[4]:2 [ main::du ] zp[4]:6 [ main::ds ]
Uplifting [] best 111 combination
ASSEMBLER BEFORE OPTIMIZATION
@ -357,13 +342,13 @@ main: {
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
lda #0
sta SCREEN+6
// [9] main::$7 = _byte2_ main::du -- vbuaa=_byte2_vduz1
// [9] main::$4 = _byte2_ main::du -- vbuaa=_byte2_vduz1
lda.z du+2
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+7) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// [11] main::$8 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
// [11] main::$5 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
lda.z ds+2
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+8) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
lda #0
@ -389,8 +374,8 @@ 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
byte~ main::$4 reg byte a 4.0
byte~ main::$5 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
@ -398,8 +383,8 @@ byte main::i
zp[4]:2 [ main::du ]
zp[4]:6 [ main::ds ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
FINAL ASSEMBLER
@ -468,16 +453,16 @@ main: {
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
sta SCREEN+6
// BYTE2(du)
// [9] main::$7 = _byte2_ main::du -- vbuaa=_byte2_vduz1
// [9] main::$4 = _byte2_ main::du -- vbuaa=_byte2_vduz1
lda.z du+2
// SCREEN[i++] = BYTE2(du)
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+7) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// BYTE2(ds)
// [11] main::$8 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
// [11] main::$5 = _byte2_ main::ds -- vbuaa=_byte2_vdsz1
lda.z ds+2
// SCREEN[i++] = BYTE2(ds)
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+8) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// SCREEN[i++] = BYTE2(ptr)
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2

View File

@ -1,6 +1,6 @@
void main()
byte~ main::$7 reg byte a 4.0
byte~ main::$8 reg byte a 4.0
byte~ main::$4 reg byte a 4.0
byte~ main::$5 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
@ -8,5 +8,5 @@ byte main::i
zp[4]:2 [ main::du ]
zp[4]:6 [ main::ds ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]

View File

@ -36,7 +36,7 @@ main: {
// SCREEN[i++] = BYTE3(377)
sta SCREEN+1
// SCREEN[i++] = BYTE3(333377777)
lda #<($13def0f1>>$18)
lda #>($13def0f1>>$10)
sta SCREEN+2
// SCREEN[i++] = BYTE3(bu)
lda #0

View File

@ -10,10 +10,10 @@ main: scope:[main] from
[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
[9] main::$4 = _byte3_ main::du
[10] *(main::SCREEN+7) = main::$4
[11] main::$5 = _byte3_ main::ds
[12] *(main::SCREEN+8) = main::$5
[13] *(main::SCREEN+9) = 0
to:main::@return
main::@return: scope:[main] from main

View File

@ -11,35 +11,32 @@ main: scope:[main] from __start
main::ds = -$39a4f1
main::ptr = (byte*)0
main::i#0 = 0
main::$0 = _byte3_ $11
main::SCREEN[main::i#0] = main::$0
main::SCREEN[main::i#0] = _byte3_$11
main::i#1 = ++ main::i#0
main::$1 = _byte3_ $179
main::SCREEN[main::i#1] = main::$1
main::SCREEN[main::i#1] = _byte3_$179
main::i#2 = ++ main::i#1
main::$2 = _byte3_ $13def0f1
main::SCREEN[main::i#2] = main::$2
main::SCREEN[main::i#2] = _byte3_$13def0f1
main::i#3 = ++ main::i#2
main::$3 = _byte3_ main::bu
main::SCREEN[main::i#3] = main::$3
main::$0 = _byte3_ main::bu
main::SCREEN[main::i#3] = main::$0
main::i#4 = ++ main::i#3
main::$4 = _byte3_ main::bs
main::SCREEN[main::i#4] = main::$4
main::$1 = _byte3_ main::bs
main::SCREEN[main::i#4] = main::$1
main::i#5 = ++ main::i#4
main::$5 = _byte3_ main::wu
main::SCREEN[main::i#5] = main::$5
main::$2 = _byte3_ main::wu
main::SCREEN[main::i#5] = main::$2
main::i#6 = ++ main::i#5
main::$6 = _byte3_ main::ws
main::SCREEN[main::i#6] = main::$6
main::$3 = _byte3_ main::ws
main::SCREEN[main::i#6] = main::$3
main::i#7 = ++ main::i#6
main::$7 = _byte3_ main::du
main::SCREEN[main::i#7] = main::$7
main::$4 = _byte3_ main::du
main::SCREEN[main::i#7] = main::$4
main::i#8 = ++ main::i#7
main::$8 = _byte3_ main::ds
main::SCREEN[main::i#8] = main::$8
main::$5 = _byte3_ main::ds
main::SCREEN[main::i#8] = main::$5
main::i#9 = ++ main::i#8
main::$9 = _byte3_ main::ptr
main::SCREEN[main::i#9] = main::$9
main::$6 = _byte3_ main::ptr
main::SCREEN[main::i#9] = main::$6
main::i#10 = ++ main::i#9
to:main::@return
main::@return: scope:[main] from main
@ -66,9 +63,6 @@ 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
@ -93,29 +87,23 @@ 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
Constant right-side identified [14] main::$0 = _byte3_ main::bu
Constant right-side identified [17] main::$1 = _byte3_ main::bs
Constant right-side identified [20] main::$2 = _byte3_ main::wu
Constant right-side identified [23] main::$3 = _byte3_ main::ws
Constant right-side identified [32] main::$6 = _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::$0 = 0
Constant main::$1 = 0
Constant main::$2 = 0
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
Simplifying constant evaluating to zero _byte3_$11 in [8] main::SCREEN[main::i#0] = _byte3_$11
Simplifying constant evaluating to zero _byte3_$179 in [10] main::SCREEN[main::i#1] = _byte3_$179
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
Simplifying expression containing zero main::SCREEN in [8] main::SCREEN[main::i#0] = 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
@ -183,16 +171,13 @@ 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::$2 = 0
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)
@ -243,10 +228,10 @@ main: scope:[main] from
[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
[9] main::$4 = _byte3_ main::du
[10] *(main::SCREEN+7) = main::$4
[11] main::$5 = _byte3_ main::ds
[12] *(main::SCREEN+8) = main::$5
[13] *(main::SCREEN+9) = 0
to:main::@return
main::@return: scope:[main] from main
@ -256,8 +241,8 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
void main()
byte~ main::$7 4.0
byte~ main::$8 4.0
byte~ main::$4 4.0
byte~ main::$5 4.0
volatile signed dword main::ds loadstore 0.4
volatile dword main::du loadstore 0.4444444444444444
byte main::i
@ -265,17 +250,17 @@ 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 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$5 to live range equivalence class [ main::$5 ]
Complete equivalence classes
[ main::du ]
[ main::ds ]
[ main::$7 ]
[ main::$8 ]
[ main::$4 ]
[ main::$5 ]
Allocated zp[4]:2 [ main::du ]
Allocated zp[4]:6 [ main::ds ]
Allocated zp[1]:10 [ main::$7 ]
Allocated zp[1]:11 [ main::$8 ]
Allocated zp[1]:10 [ main::$4 ]
Allocated zp[1]:11 [ main::$5 ]
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
@ -289,14 +274,14 @@ Statement [8] *(main::SCREEN+6) = 0 [ main::du main::ds ] ( [ main::du main::ds
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 ,
Potential registers zp[1]:10 [ main::$4 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:11 [ main::$5 ] : 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 [main] 4: zp[1]:10 [ main::$4 ] 4: zp[1]:11 [ main::$5 ] 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 [main] best 111 combination reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[4]:2 [ main::du ] zp[4]:6 [ main::ds ]
Uplifting [] best 111 combination
ASSEMBLER BEFORE OPTIMIZATION
@ -343,7 +328,7 @@ main: {
lda #0
sta SCREEN+1
// [4] *(main::SCREEN+2) = _byte3_$13def0f1 -- _deref_pbuc1=vbuc2
lda #<($13def0f1>>$18)
lda #>($13def0f1>>$10)
sta SCREEN+2
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
lda #0
@ -357,13 +342,13 @@ main: {
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
lda #0
sta SCREEN+6
// [9] main::$7 = _byte3_ main::du -- vbuaa=_byte3_vduz1
// [9] main::$4 = _byte3_ main::du -- vbuaa=_byte3_vduz1
lda.z du+3
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+7) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// [11] main::$8 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
// [11] main::$5 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
lda.z ds+3
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+8) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2
lda #0
@ -389,8 +374,8 @@ 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
byte~ main::$4 reg byte a 4.0
byte~ main::$5 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
@ -398,8 +383,8 @@ byte main::i
zp[4]:2 [ main::du ]
zp[4]:6 [ main::ds ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
FINAL ASSEMBLER
@ -452,7 +437,7 @@ main: {
sta SCREEN+1
// SCREEN[i++] = BYTE3(333377777)
// [4] *(main::SCREEN+2) = _byte3_$13def0f1 -- _deref_pbuc1=vbuc2
lda #<($13def0f1>>$18)
lda #>($13def0f1>>$10)
sta SCREEN+2
// SCREEN[i++] = BYTE3(bu)
// [5] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
@ -468,16 +453,16 @@ main: {
// [8] *(main::SCREEN+6) = 0 -- _deref_pbuc1=vbuc2
sta SCREEN+6
// BYTE3(du)
// [9] main::$7 = _byte3_ main::du -- vbuaa=_byte3_vduz1
// [9] main::$4 = _byte3_ main::du -- vbuaa=_byte3_vduz1
lda.z du+3
// SCREEN[i++] = BYTE3(du)
// [10] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
// [10] *(main::SCREEN+7) = main::$4 -- _deref_pbuc1=vbuaa
sta SCREEN+7
// BYTE3(ds)
// [11] main::$8 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
// [11] main::$5 = _byte3_ main::ds -- vbuaa=_byte3_vdsz1
lda.z ds+3
// SCREEN[i++] = BYTE3(ds)
// [12] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
// [12] *(main::SCREEN+8) = main::$5 -- _deref_pbuc1=vbuaa
sta SCREEN+8
// SCREEN[i++] = BYTE3(ptr)
// [13] *(main::SCREEN+9) = 0 -- _deref_pbuc1=vbuc2

View File

@ -1,6 +1,6 @@
void main()
byte~ main::$7 reg byte a 4.0
byte~ main::$8 reg byte a 4.0
byte~ main::$4 reg byte a 4.0
byte~ main::$5 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
@ -8,5 +8,5 @@ byte main::i
zp[4]:2 [ main::du ]
zp[4]:6 [ main::ds ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]