1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-29 09:29:31 +00:00
kickc/src/test/ref/struct-30.log
2020-03-29 21:00:25 +02:00

325 lines
11 KiB
Plaintext

Fixing struct type size struct Point to 4
Fixing struct type SIZE_OF struct Point to 4
Fixing struct type SIZE_OF struct Point to 4
Created struct value member variable (byte) main::point1_x
Created struct value member variable (const byte*) main::point1_initials
Converted struct value to member variables (struct Point) main::point1
Unwinding value copy (struct Point) main::point1 ← { x: (byte) 2, initials: (byte*) "jg" }
Adding value simple copy (byte) main::point1_x ← (byte) 2
Adding value bulk copy *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3)
Replacing struct member reference (struct Point) main::point1.x with member unwinding reference (byte) main::point1_x
Replacing struct member reference (struct Point) main::point1.initials with member unwinding reference (const byte*) main::point1_initials
Replacing struct member reference (struct Point) main::point1.initials with member unwinding reference (const byte*) main::point1_initials
Identified constant variable (byte) main::point1_x
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
(void()) main()
main: scope:[main] from @1
*((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3)
*((const nomodify byte*) SCREEN + (number) 0) ← (const byte) main::point1_x
*((const nomodify byte*) SCREEN + (number) 1) ← *((const byte*) main::point1_initials + (number) 0)
*((const nomodify byte*) SCREEN + (number) 2) ← *((const byte*) main::point1_initials + (number) 1)
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(const byte*) $0[(number) 3] = (byte*) "jg"
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte*) Point::initials[(number) 3] = { fill( 3, 0) }
(byte) Point::x
(const nomodify byte*) SCREEN = (byte*)(number) $400
(void()) main()
(label) main::@return
(const byte*) main::point1_initials[(number) 3] = { fill( 3, 0) }
(const byte) main::point1_x = (byte) 2
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) SCREEN + (number) 0) ← (const byte) main::point1_x
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) SCREEN + (number) 1) ← *((const byte*) main::point1_initials + (number) 0)
Adding number conversion cast (unumber) 1 in *((const nomodify byte*) SCREEN + (number) 1) ← *((const byte*) main::point1_initials + (unumber)(number) 0)
Adding number conversion cast (unumber) 1 in *((const nomodify byte*) SCREEN + (number) 2) ← *((const byte*) main::point1_initials + (number) 1)
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) SCREEN + (number) 2) ← *((const byte*) main::point1_initials + (unumber)(number) 1)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero SCREEN in [1] *((const nomodify byte*) SCREEN + (byte) 0) ← (const byte) main::point1_x
Simplifying expression containing zero main::point1_initials in [2] *((const nomodify byte*) SCREEN + (byte) 1) ← *((const byte*) main::point1_initials + (byte) 0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Consolidated array index constant in *(SCREEN+1)
Consolidated array index constant in *(main::point1_initials+1)
Consolidated array index constant in *(SCREEN+2)
Successful SSA optimization Pass2ConstantAdditionElimination
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
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()
main: scope:[main] from @1
[4] *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3)
[5] *((const nomodify byte*) SCREEN) ← (const byte) main::point1_x
[6] *((const nomodify byte*) SCREEN+(byte) 1) ← *((const byte*) main::point1_initials)
[7] *((const nomodify byte*) SCREEN+(byte) 2) ← *((const byte*) main::point1_initials+(byte) 1)
to:main::@return
main::@return: scope:[main] from main
[8] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) Point::x
(void()) main()
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Minimal struct with MemberUnwind behavior - array member and local initializer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.const point1_x = 2
// [4] *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3) -- _deref_pbuc1=_deref_pptc2_memcpy_vbuc3
ldy #3
!:
lda __0-1,y
sta point1_initials-1,y
dey
bne !-
// [5] *((const nomodify byte*) SCREEN) ← (const byte) main::point1_x -- _deref_pbuc1=vbuc2
lda #point1_x
sta SCREEN
// [6] *((const nomodify byte*) SCREEN+(byte) 1) ← *((const byte*) main::point1_initials) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials
sta SCREEN+1
// [7] *((const nomodify byte*) SCREEN+(byte) 2) ← *((const byte*) main::point1_initials+(byte) 1) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials+1
sta SCREEN+2
jmp __breturn
// main::@return
__breturn:
// [8] return
rts
point1_initials: .fill 3, 0
}
// File Data
__0: .text "jg"
.byte 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3) [ ] ( main:2 [ ] { } ) always clobbers reg byte a reg byte y
Statement [5] *((const nomodify byte*) SCREEN) ← (const byte) main::point1_x [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [6] *((const nomodify byte*) SCREEN+(byte) 1) ← *((const byte*) main::point1_initials) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [7] *((const nomodify byte*) SCREEN+(byte) 2) ← *((const byte*) main::point1_initials+(byte) 1) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [Point]
Uplift Scope [main]
Uplift Scope []
Uplifting [Point] best 59 combination
Uplifting [main] best 59 combination
Uplifting [] best 59 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Minimal struct with MemberUnwind behavior - array member and local initializer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.const point1_x = 2
// [4] *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3) -- _deref_pbuc1=_deref_pptc2_memcpy_vbuc3
ldy #3
!:
lda __0-1,y
sta point1_initials-1,y
dey
bne !-
// [5] *((const nomodify byte*) SCREEN) ← (const byte) main::point1_x -- _deref_pbuc1=vbuc2
lda #point1_x
sta SCREEN
// [6] *((const nomodify byte*) SCREEN+(byte) 1) ← *((const byte*) main::point1_initials) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials
sta SCREEN+1
// [7] *((const nomodify byte*) SCREEN+(byte) 2) ← *((const byte*) main::point1_initials+(byte) 1) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials+1
sta SCREEN+2
jmp __breturn
// main::@return
__breturn:
// [8] return
rts
point1_initials: .fill 3, 0
}
// File Data
__0: .text "jg"
.byte 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___bbegin:
Removing instruction __b1:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(const byte*) $0[(number) 3] = (byte*) "jg"
(label) @1
(label) @begin
(label) @end
(const byte*) Point::initials[(number) 3] = { fill( 3, 0) }
(byte) Point::x
(const nomodify byte*) SCREEN = (byte*) 1024
(void()) main()
(label) main::@return
(const byte*) main::point1_initials[(number) 3] = { fill( 3, 0) }
(const byte) main::point1_x = (byte) 2
FINAL ASSEMBLER
Score: 44
// File Comments
// Minimal struct with MemberUnwind behavior - array member and local initializer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @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
main: {
.const point1_x = 2
// point1 = { 2, "jg" }
// [4] *((const byte*) main::point1_initials) ← memcpy(*(&(const byte*) $0), byte, (number) 3) -- _deref_pbuc1=_deref_pptc2_memcpy_vbuc3
ldy #3
!:
lda __0-1,y
sta point1_initials-1,y
dey
bne !-
// SCREEN[0] = point1.x
// [5] *((const nomodify byte*) SCREEN) ← (const byte) main::point1_x -- _deref_pbuc1=vbuc2
lda #point1_x
sta SCREEN
// SCREEN[1] = point1.initials[0]
// [6] *((const nomodify byte*) SCREEN+(byte) 1) ← *((const byte*) main::point1_initials) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials
sta SCREEN+1
// SCREEN[2] = point1.initials[1]
// [7] *((const nomodify byte*) SCREEN+(byte) 2) ← *((const byte*) main::point1_initials+(byte) 1) -- _deref_pbuc1=_deref_pbuc2
lda point1_initials+1
sta SCREEN+2
// main::@return
// }
// [8] return
rts
point1_initials: .fill 3, 0
}
// File Data
__0: .text "jg"
.byte 0