2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
@begin: scope:[] from
|
|
|
|
to:@1
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2019-05-30 20:29:04 +00:00
|
|
|
main: scope:[main] from @1
|
2019-11-03 16:05:55 +00:00
|
|
|
(number~) main::$0 ← (const byte) main::y + (number) 1
|
|
|
|
(byte) main::p_x#0 ← (const byte) main::x
|
2020-01-01 17:27:53 +00:00
|
|
|
(byte) main::p_y#0 ← (number~) main::$0
|
2020-03-29 19:00:25 +00:00
|
|
|
*((const nomodify byte*) main::SCREEN + (number) 0) ← (byte) main::p_x#0
|
|
|
|
*((const nomodify byte*) main::SCREEN + (number) 1) ← (byte) main::p_y#0
|
2019-05-30 20:29:04 +00:00
|
|
|
to:main::@return
|
2019-06-09 08:47:33 +00:00
|
|
|
main::@return: scope:[main] from main
|
2019-05-30 20:29:04 +00:00
|
|
|
return
|
|
|
|
to:@return
|
|
|
|
@1: scope:[] from @begin
|
|
|
|
call main
|
|
|
|
to:@2
|
|
|
|
@2: scope:[] from @1
|
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @2
|
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
|
|
|
(label) @1
|
|
|
|
(label) @2
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-05-30 20:29:04 +00:00
|
|
|
(void()) main()
|
2019-06-09 08:47:33 +00:00
|
|
|
(number~) main::$0
|
2019-05-30 20:29:04 +00:00
|
|
|
(label) main::@return
|
2020-03-29 19:00:25 +00:00
|
|
|
(const nomodify byte*) main::SCREEN = (byte*)(number) $400
|
2019-06-09 08:47:33 +00:00
|
|
|
(byte) main::p_x
|
|
|
|
(byte) main::p_x#0
|
|
|
|
(byte) main::p_y
|
|
|
|
(byte) main::p_y#0
|
2019-11-03 19:11:06 +00:00
|
|
|
(const byte) main::x = (byte) 2
|
|
|
|
(const byte) main::y = (byte) 3
|
2019-05-30 20:29:04 +00:00
|
|
|
|
2019-11-03 16:05:55 +00:00
|
|
|
Adding number conversion cast (unumber) 1 in (number~) main::$0 ← (const byte) main::y + (number) 1
|
|
|
|
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← (const byte) main::y + (unumber)(number) 1
|
2020-03-29 19:00:25 +00:00
|
|
|
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) main::SCREEN + (number) 0) ← (byte) main::p_x#0
|
|
|
|
Adding number conversion cast (unumber) 1 in *((const nomodify byte*) main::SCREEN + (number) 1) ← (byte) main::p_y#0
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
2019-11-03 16:05:55 +00:00
|
|
|
Simplifying constant integer cast 1
|
2019-06-09 08:47:33 +00:00
|
|
|
Simplifying constant integer cast 0
|
|
|
|
Simplifying constant integer cast 1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNCastSimplification
|
2019-06-09 08:47:33 +00:00
|
|
|
Finalized unsigned number type (byte) 1
|
2019-05-30 20:29:04 +00:00
|
|
|
Finalized unsigned number type (byte) 0
|
|
|
|
Finalized unsigned number type (byte) 1
|
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2019-11-03 16:05:55 +00:00
|
|
|
Inferred type updated to byte in (unumber~) main::$0 ← (const byte) main::y + (byte) 1
|
2020-03-22 21:26:39 +00:00
|
|
|
Alias main::p_y#0 = main::$0
|
2020-01-01 17:27:53 +00:00
|
|
|
Successful SSA optimization Pass2AliasElimination
|
|
|
|
Constant right-side identified [0] (byte) main::p_y#0 ← (const byte) main::y + (byte) 1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
2020-01-01 17:27:53 +00:00
|
|
|
Constant (const byte) main::p_y#0 = main::y+1
|
2019-11-03 16:05:55 +00:00
|
|
|
Constant (const byte) main::p_x#0 = main::x
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2020-03-29 19:00:25 +00:00
|
|
|
Simplifying expression containing zero main::SCREEN in [2] *((const nomodify byte*) main::SCREEN + (byte) 0) ← (const byte) main::p_x#0
|
2019-11-03 16:05:55 +00:00
|
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
|
|
Constant inlined main::p_x#0 = (const byte) main::x
|
|
|
|
Successful SSA optimization Pass2ConstantInlining
|
2019-09-29 18:57:23 +00:00
|
|
|
Consolidated array index constant in *(main::SCREEN+1)
|
2019-06-09 08:47:33 +00:00
|
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
2019-05-30 20:29:04 +00:00
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
|
|
|
Adding NOP phi() at start of @2
|
|
|
|
Adding NOP phi() at start of @end
|
|
|
|
CALL GRAPH
|
|
|
|
Calls in [] to main:2
|
|
|
|
|
2019-06-09 08:47:33 +00:00
|
|
|
Created 0 initial phi equivalence classes
|
|
|
|
Coalesced down to 0 phi equivalence classes
|
2019-05-30 20:29:04 +00:00
|
|
|
Culled Empty Block (label) @2
|
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
|
|
|
Adding NOP phi() at start of @end
|
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
@begin: scope:[] from
|
|
|
|
[0] phi()
|
|
|
|
to:@1
|
|
|
|
@1: scope:[] from @begin
|
|
|
|
[1] phi()
|
|
|
|
[2] call main
|
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @1
|
|
|
|
[3] phi()
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2019-05-30 20:29:04 +00:00
|
|
|
main: scope:[main] from @1
|
2020-03-29 19:00:25 +00:00
|
|
|
[4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x
|
|
|
|
[5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0
|
2019-05-30 20:29:04 +00:00
|
|
|
to:main::@return
|
2019-06-09 08:47:33 +00:00
|
|
|
main::@return: scope:[main] from main
|
|
|
|
[6] return
|
2019-05-30 20:29:04 +00:00
|
|
|
to:@return
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-05-30 20:29:04 +00:00
|
|
|
(void()) main()
|
2019-06-09 08:47:33 +00:00
|
|
|
(byte) main::p_x
|
|
|
|
(byte) main::p_y
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
Initial phi equivalence classes
|
|
|
|
Complete equivalence classes
|
|
|
|
|
|
|
|
INITIAL ASM
|
2019-09-08 00:29:17 +00:00
|
|
|
Target platform is c64basic / MOS6502X
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-09 08:47:33 +00:00
|
|
|
// Minimal struct - initializing using a value list
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-05-30 20:29:04 +00:00
|
|
|
.pc = $801 "Basic"
|
2020-05-11 00:36:37 +00:00
|
|
|
:BasicUpstart(main)
|
2019-05-30 20:29:04 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
2019-05-30 20:29:04 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2019-05-30 20:29:04 +00:00
|
|
|
main: {
|
2019-06-09 08:47:33 +00:00
|
|
|
.const x = 2
|
|
|
|
.const y = 3
|
|
|
|
.const p_y = y+1
|
2020-04-30 20:15:59 +00:00
|
|
|
.label SCREEN = $400
|
2020-03-29 19:00:25 +00:00
|
|
|
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #x
|
|
|
|
sta SCREEN
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #p_y
|
|
|
|
sta SCREEN+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [6] return
|
2019-05-30 20:29:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
2020-03-29 19:00:25 +00:00
|
|
|
Statement [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x [ ] ( main:2 [ ] { } ) always clobbers reg byte a
|
|
|
|
Statement [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 [ ] ( main:2 [ ] { } ) always clobbers reg byte a
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
|
|
Uplift Scope [Point]
|
2019-06-09 08:47:33 +00:00
|
|
|
Uplift Scope [main]
|
2019-05-30 20:29:04 +00:00
|
|
|
Uplift Scope []
|
|
|
|
|
2019-06-09 08:47:33 +00:00
|
|
|
Uplifting [Point] best 33 combination
|
|
|
|
Uplifting [main] best 33 combination
|
|
|
|
Uplifting [] best 33 combination
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-09 08:47:33 +00:00
|
|
|
// Minimal struct - initializing using a value list
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-05-30 20:29:04 +00:00
|
|
|
.pc = $801 "Basic"
|
2020-05-11 00:36:37 +00:00
|
|
|
:BasicUpstart(main)
|
2019-05-30 20:29:04 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
2019-05-30 20:29:04 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2019-05-30 20:29:04 +00:00
|
|
|
main: {
|
2019-06-09 08:47:33 +00:00
|
|
|
.const x = 2
|
|
|
|
.const y = 3
|
|
|
|
.const p_y = y+1
|
2020-04-30 20:15:59 +00:00
|
|
|
.label SCREEN = $400
|
2020-03-29 19:00:25 +00:00
|
|
|
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #x
|
|
|
|
sta SCREEN
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #p_y
|
|
|
|
sta SCREEN+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [6] return
|
2019-05-30 20:29:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __bend
|
|
|
|
Removing instruction jmp __breturn
|
2019-05-30 20:29:04 +00:00
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __b1_from___bbegin:
|
2020-03-03 07:58:31 +00:00
|
|
|
Removing instruction __b1:
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __bend_from___b1:
|
2019-05-30 20:29:04 +00:00
|
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
2020-05-11 00:36:37 +00:00
|
|
|
Removing instruction __bbegin:
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __bend:
|
|
|
|
Removing instruction __breturn:
|
2019-05-30 20:29:04 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
Removing instruction jsr main
|
|
|
|
Succesful ASM optimization Pass5SkipBegin
|
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
|
|
|
(label) @1
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-05-30 20:29:04 +00:00
|
|
|
(void()) main()
|
|
|
|
(label) main::@return
|
2020-03-29 19:00:25 +00:00
|
|
|
(const nomodify byte*) main::SCREEN = (byte*) 1024
|
2019-06-09 08:47:33 +00:00
|
|
|
(byte) main::p_x
|
|
|
|
(byte) main::p_y
|
2019-09-29 20:36:00 +00:00
|
|
|
(const byte) main::p_y#0 p_y = (const byte) main::y+(byte) 1
|
2019-11-03 19:11:06 +00:00
|
|
|
(const byte) main::x = (byte) 2
|
|
|
|
(const byte) main::y = (byte) 3
|
2019-05-30 20:29:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
2019-06-09 08:47:33 +00:00
|
|
|
Score: 18
|
2019-05-30 20:29:04 +00:00
|
|
|
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-09 08:47:33 +00:00
|
|
|
// Minimal struct - initializing using a value list
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-05-30 20:29:04 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
|
|
// @1
|
|
|
|
// [2] call main
|
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
|
|
// @end
|
|
|
|
// main
|
2019-05-30 20:29:04 +00:00
|
|
|
main: {
|
2019-06-09 08:47:33 +00:00
|
|
|
.const x = 2
|
|
|
|
.const y = 3
|
|
|
|
.const p_y = y+1
|
2020-04-30 20:15:59 +00:00
|
|
|
.label SCREEN = $400
|
2019-07-08 14:43:09 +00:00
|
|
|
// SCREEN[0] = p.x
|
2020-03-29 19:00:25 +00:00
|
|
|
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #x
|
|
|
|
sta SCREEN
|
2019-07-08 14:43:09 +00:00
|
|
|
// SCREEN[1] = p.y
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
|
2019-06-09 08:47:33 +00:00
|
|
|
lda #p_y
|
|
|
|
sta SCREEN+1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
|
|
|
// }
|
|
|
|
// [6] return
|
2019-05-30 20:29:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-05-30 20:29:04 +00:00
|
|
|
|