1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00
kickc/src/test/ref/struct-4.log

283 lines
7.6 KiB
Plaintext
Raw Normal View History

2019-05-30 20:29:04 +00:00
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
(void()) main()
2019-05-30 20:29:04 +00:00
main: scope:[main] from @1
(number~) main::$0 ← (const byte) main::y + (number) 1
(byte) main::p_x#0 ← (const byte) main::x
(byte) main::p_y#0 ← (number~) main::$0
*((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
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()
(number~) main::$0
2019-05-30 20:29:04 +00:00
(label) main::@return
(const nomodify byte*) main::SCREEN = (byte*)(number) $400
(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
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
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
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 1
2019-05-30 20:29:04 +00:00
Successful SSA optimization PassNCastSimplification
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
Inferred type updated to byte in (unumber~) main::$0 ← (const byte) main::y + (byte) 1
Alias main::p_y#0 = main::$0
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
Constant (const byte) main::p_y#0 = main::y+1
Constant (const byte) main::p_x#0 = main::x
2019-05-30 20:29:04 +00:00
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN in [2] *((const nomodify byte*) main::SCREEN + (byte) 0) ← (const byte) main::p_x#0
Successful SSA optimization PassNSimplifyExpressionWithZero
Constant inlined main::p_x#0 = (const byte) main::x
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
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
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()
(void()) main()
2019-05-30 20:29:04 +00:00
main: scope:[main] from @1
[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
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()
(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
Target platform is c64basic / MOS6502X
// File Comments
// Minimal struct - initializing using a value list
// Upstart
2019-05-30 20:29:04 +00:00
.pc = $801 "Basic"
:BasicUpstart(main)
2019-05-30 20:29:04 +00:00
.pc = $80d "Program"
// Global Constants & labels
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
2019-05-30 20:29:04 +00:00
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
2019-05-30 20:29:04 +00:00
main: {
.const x = 2
.const y = 3
.const p_y = y+1
.label SCREEN = $400
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
lda #x
sta SCREEN
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
lda #p_y
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [6] return
2019-05-30 20:29:04 +00:00
rts
}
// File Data
2019-05-30 20:29:04 +00:00
REGISTER UPLIFT POTENTIAL REGISTERS
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]
Uplift Scope [main]
2019-05-30 20:29:04 +00:00
Uplift Scope []
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
// File Comments
// Minimal struct - initializing using a value list
// Upstart
2019-05-30 20:29:04 +00:00
.pc = $801 "Basic"
:BasicUpstart(main)
2019-05-30 20:29:04 +00:00
.pc = $80d "Program"
// Global Constants & labels
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
2019-05-30 20:29:04 +00:00
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
2019-05-30 20:29:04 +00:00
main: {
.const x = 2
.const y = 3
.const p_y = y+1
.label SCREEN = $400
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
lda #x
sta SCREEN
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
lda #p_y
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [6] return
2019-05-30 20:29:04 +00:00
rts
}
// File Data
2019-05-30 20:29:04 +00:00
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
2019-05-30 20:29:04 +00:00
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___bbegin:
Removing instruction __b1:
Removing instruction __bend_from___b1:
2019-05-30 20:29:04 +00:00
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bbegin:
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
(const nomodify byte*) main::SCREEN = (byte*) 1024
(byte) main::p_x
(byte) main::p_y
(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
Score: 18
2019-05-30 20:29:04 +00:00
// File Comments
// Minimal struct - initializing using a value list
// Upstart
2019-05-30 20:29:04 +00:00
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// 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: {
.const x = 2
.const y = 3
.const p_y = y+1
.label SCREEN = $400
// SCREEN[0] = p.x
// [4] *((const nomodify byte*) main::SCREEN) ← (const byte) main::x -- _deref_pbuc1=vbuc2
lda #x
sta SCREEN
// SCREEN[1] = p.y
// [5] *((const nomodify byte*) main::SCREEN+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2
lda #p_y
sta SCREEN+1
// main::@return
// }
// [6] return
2019-05-30 20:29:04 +00:00
rts
}
// File Data
2019-05-30 20:29:04 +00:00