mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-10-21 17:24:39 +00:00
556 lines
18 KiB
Plaintext
556 lines
18 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
@begin: scope:[] from
|
|
to:@1
|
|
|
|
(void()) main()
|
|
main: scope:[main] from @1
|
|
(byte*) first::msg#0 ← (const byte*) msg1
|
|
call first
|
|
(byte*) first::return#0 ← (byte*) first::return#3
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
(byte*) first::return#4 ← phi( main/(byte*) first::return#0 )
|
|
(byte*~) main::$0 ← (byte*) first::return#4
|
|
(byte*~) main::$1 ← (byte*~) main::$0 + (number) 0
|
|
*((const nomodify byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$1)
|
|
(byte*) first::msg#1 ← (const byte*) msg2
|
|
call first
|
|
(byte*) first::return#1 ← (byte*) first::return#3
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@1
|
|
(byte*) first::return#5 ← phi( main::@1/(byte*) first::return#1 )
|
|
(byte*~) main::$2 ← (byte*) first::return#5
|
|
(byte*~) main::$3 ← (byte*~) main::$2 + (number) 0
|
|
*((const nomodify byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$3)
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@2
|
|
return
|
|
to:@return
|
|
|
|
(byte*()) first((byte*) first::msg)
|
|
first: scope:[first] from main main::@1
|
|
(byte*) first::msg#2 ← phi( main/(byte*) first::msg#0 main::@1/(byte*) first::msg#1 )
|
|
(byte*~) first::$0 ← (byte*) first::msg#2 + (number) 0
|
|
(byte*) first::return#2 ← (byte*)(byte*~) first::$0
|
|
to:first::@return
|
|
first::@return: scope:[first] from first
|
|
(byte*) first::return#6 ← phi( first/(byte*) first::return#2 )
|
|
(byte*) first::return#3 ← (byte*) first::return#6
|
|
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
|
|
(byte*()) first((byte*) first::msg)
|
|
(byte*~) first::$0
|
|
(label) first::@return
|
|
(byte*) first::msg
|
|
(byte*) first::msg#0
|
|
(byte*) first::msg#1
|
|
(byte*) first::msg#2
|
|
(byte*) first::return
|
|
(byte*) first::return#0
|
|
(byte*) first::return#1
|
|
(byte*) first::return#2
|
|
(byte*) first::return#3
|
|
(byte*) first::return#4
|
|
(byte*) first::return#5
|
|
(byte*) first::return#6
|
|
(void()) main()
|
|
(byte*~) main::$0
|
|
(byte*~) main::$1
|
|
(byte*~) main::$2
|
|
(byte*~) main::$3
|
|
(label) main::@1
|
|
(label) main::@2
|
|
(label) main::@return
|
|
(const nomodify byte*) main::SCREEN = (byte*)(number) $400
|
|
(const byte*) msg1[] = (byte*) "hello world!"
|
|
(const byte*) msg2[] = (byte*) "goodbye sky?"
|
|
|
|
Adding number conversion cast (unumber) 0 in (byte*~) main::$1 ← (byte*~) main::$0 + (number) 0
|
|
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$1)
|
|
Adding number conversion cast (unumber) 0 in (byte*~) main::$3 ← (byte*~) main::$2 + (number) 0
|
|
Adding number conversion cast (unumber) 1 in *((const nomodify byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$3)
|
|
Adding number conversion cast (unumber) 0 in (byte*~) first::$0 ← (byte*) first::msg#2 + (number) 0
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast (byte*~) first::$0
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 1
|
|
Finalized unsigned number type (byte) 0
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Alias first::return#0 = first::return#4
|
|
Alias first::return#1 = first::return#5
|
|
Alias first::return#2 = first::$0 first::return#6 first::return#3
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Constant (const byte*) first::msg#0 = msg1
|
|
Constant (const byte*) first::msg#1 = msg2
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Converting *(pointer+n) to pointer[n] [5] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*~) main::$1) -- *(main::$0 + 0)
|
|
Converting *(pointer+n) to pointer[n] [11] *((const nomodify byte*) main::SCREEN + (byte) 1) ← *((byte*~) main::$3) -- *(main::$2 + 0)
|
|
Successful SSA optimization Pass2InlineDerefIdx
|
|
Simplifying expression containing zero main::$0 in [4] (byte*~) main::$1 ← (byte*~) main::$0 + (byte) 0
|
|
Simplifying expression containing zero main::$0 in [5] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*~) main::$0 + (byte) 0)
|
|
Simplifying expression containing zero main::SCREEN in [5] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*~) main::$0)
|
|
Simplifying expression containing zero main::$2 in [10] (byte*~) main::$3 ← (byte*~) main::$2 + (byte) 0
|
|
Simplifying expression containing zero main::$2 in [11] *((const nomodify byte*) main::SCREEN + (byte) 1) ← *((byte*~) main::$2 + (byte) 0)
|
|
Simplifying expression containing zero first::msg#2 in [14] (byte*) first::return#2 ← (byte*) first::msg#2 + (byte) 0
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
Eliminating unused variable (byte*~) main::$1 and assignment [3] (byte*~) main::$1 ← (byte*~) main::$0
|
|
Eliminating unused variable (byte*~) main::$3 and assignment [8] (byte*~) main::$3 ← (byte*~) main::$2
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
Alias first::return#2 = first::msg#2
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Constant inlined first::msg#0 = (const byte*) msg1
|
|
Constant inlined first::msg#1 = (const byte*) msg2
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Consolidated array index constant in *(main::SCREEN+1)
|
|
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
|
|
Adding NOP phi() at start of main
|
|
CALL GRAPH
|
|
Calls in [] to main:2
|
|
Calls in [main] to first:6 first:10
|
|
|
|
Created 1 initial phi equivalence classes
|
|
Coalesced down to 1 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
|
|
Adding NOP phi() at start of main
|
|
|
|
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] phi()
|
|
[5] call first
|
|
[6] (byte*) first::return#0 ← (byte*) first::return#2
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
[7] (byte*~) main::$0 ← (byte*) first::return#0
|
|
[8] *((const nomodify byte*) main::SCREEN) ← *((byte*~) main::$0)
|
|
[9] call first
|
|
[10] (byte*) first::return#1 ← (byte*) first::return#2
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@1
|
|
[11] (byte*~) main::$2 ← (byte*) first::return#1
|
|
[12] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*~) main::$2)
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@2
|
|
[13] return
|
|
to:@return
|
|
|
|
(byte*()) first((byte*) first::msg)
|
|
first: scope:[first] from main main::@1
|
|
[14] (byte*) first::return#2 ← phi( main/(const byte*) msg1 main::@1/(const byte*) msg2 )
|
|
to:first::@return
|
|
first::@return: scope:[first] from first
|
|
[15] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
(byte*()) first((byte*) first::msg)
|
|
(byte*) first::msg
|
|
(byte*) first::return
|
|
(byte*) first::return#0 22.0
|
|
(byte*) first::return#1 22.0
|
|
(byte*) first::return#2 5.5
|
|
(void()) main()
|
|
(byte*~) main::$0 22.0
|
|
(byte*~) main::$2 22.0
|
|
|
|
Initial phi equivalence classes
|
|
[ first::return#2 ]
|
|
Added variable first::return#0 to live range equivalence class [ first::return#0 ]
|
|
Added variable main::$0 to live range equivalence class [ main::$0 ]
|
|
Added variable first::return#1 to live range equivalence class [ first::return#1 ]
|
|
Added variable main::$2 to live range equivalence class [ main::$2 ]
|
|
Complete equivalence classes
|
|
[ first::return#2 ]
|
|
[ first::return#0 ]
|
|
[ main::$0 ]
|
|
[ first::return#1 ]
|
|
[ main::$2 ]
|
|
Allocated zp[2]:2 [ first::return#2 ]
|
|
Allocated zp[2]:4 [ first::return#0 ]
|
|
Allocated zp[2]:6 [ main::$0 ]
|
|
Allocated zp[2]:8 [ first::return#1 ]
|
|
Allocated zp[2]:10 [ main::$2 ]
|
|
|
|
INITIAL ASM
|
|
Target platform is c64basic / MOS6502X
|
|
// File Comments
|
|
// Tests pointer plus 0 elimination
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(main)
|
|
.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
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
main_from___b1:
|
|
jsr main
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
__bend_from___b1:
|
|
jmp __bend
|
|
// @end
|
|
__bend:
|
|
// main
|
|
main: {
|
|
.label SCREEN = $400
|
|
.label __0 = 6
|
|
.label __2 = $a
|
|
// [5] call first
|
|
// [14] phi from main to first [phi:main->first]
|
|
first_from_main:
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg1 [phi:main->first#0] -- pbuz1=pbuc1
|
|
lda #<msg1
|
|
sta.z first.return_2
|
|
lda #>msg1
|
|
sta.z first.return_2+1
|
|
jsr first
|
|
// [6] (byte*) first::return#0 ← (byte*) first::return#2 -- pbuz1=pbuz2
|
|
lda.z first.return_2
|
|
sta.z first.return
|
|
lda.z first.return_2+1
|
|
sta.z first.return+1
|
|
jmp __b1
|
|
// main::@1
|
|
__b1:
|
|
// [7] (byte*~) main::$0 ← (byte*) first::return#0 -- pbuz1=pbuz2
|
|
lda.z first.return
|
|
sta.z __0
|
|
lda.z first.return+1
|
|
sta.z __0+1
|
|
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*~) main::$0) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__0),y
|
|
sta SCREEN
|
|
// [9] call first
|
|
// [14] phi from main::@1 to first [phi:main::@1->first]
|
|
first_from___b1:
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg2 [phi:main::@1->first#0] -- pbuz1=pbuc1
|
|
lda #<msg2
|
|
sta.z first.return_2
|
|
lda #>msg2
|
|
sta.z first.return_2+1
|
|
jsr first
|
|
// [10] (byte*) first::return#1 ← (byte*) first::return#2 -- pbuz1=pbuz2
|
|
lda.z first.return_2
|
|
sta.z first.return_1
|
|
lda.z first.return_2+1
|
|
sta.z first.return_1+1
|
|
jmp __b2
|
|
// main::@2
|
|
__b2:
|
|
// [11] (byte*~) main::$2 ← (byte*) first::return#1 -- pbuz1=pbuz2
|
|
lda.z first.return_1
|
|
sta.z __2
|
|
lda.z first.return_1+1
|
|
sta.z __2+1
|
|
// [12] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*~) main::$2) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__2),y
|
|
sta SCREEN+1
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [13] return
|
|
rts
|
|
}
|
|
// first
|
|
first: {
|
|
.label return = 4
|
|
.label return_1 = 8
|
|
.label return_2 = 2
|
|
jmp __breturn
|
|
// first::@return
|
|
__breturn:
|
|
// [15] return
|
|
rts
|
|
}
|
|
// File Data
|
|
msg1: .text "hello world!"
|
|
.byte 0
|
|
msg2: .text "goodbye sky?"
|
|
.byte 0
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [6] (byte*) first::return#0 ← (byte*) first::return#2 [ first::return#0 ] ( main:2 [ first::return#0 ] { { first::return#0 = first::return#2 } } ) always clobbers reg byte a
|
|
Statement [7] (byte*~) main::$0 ← (byte*) first::return#0 [ main::$0 ] ( main:2 [ main::$0 ] { { first::return#1 = first::return#2 } } ) always clobbers reg byte a
|
|
Statement [8] *((const nomodify byte*) main::SCREEN) ← *((byte*~) main::$0) [ ] ( main:2 [ ] { { first::return#1 = first::return#2 } } ) always clobbers reg byte a reg byte y
|
|
Statement [10] (byte*) first::return#1 ← (byte*) first::return#2 [ first::return#1 ] ( main:2 [ first::return#1 ] { { first::return#1 = first::return#2 } } ) always clobbers reg byte a
|
|
Statement [11] (byte*~) main::$2 ← (byte*) first::return#1 [ main::$2 ] ( main:2 [ main::$2 ] { } ) always clobbers reg byte a
|
|
Statement [12] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*~) main::$2) [ ] ( main:2 [ ] { } ) always clobbers reg byte a reg byte y
|
|
Potential registers zp[2]:2 [ first::return#2 ] : zp[2]:2 ,
|
|
Potential registers zp[2]:4 [ first::return#0 ] : zp[2]:4 ,
|
|
Potential registers zp[2]:6 [ main::$0 ] : zp[2]:6 ,
|
|
Potential registers zp[2]:8 [ first::return#1 ] : zp[2]:8 ,
|
|
Potential registers zp[2]:10 [ main::$2 ] : zp[2]:10 ,
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [first] 22: zp[2]:4 [ first::return#0 ] 22: zp[2]:8 [ first::return#1 ] 5.5: zp[2]:2 [ first::return#2 ]
|
|
Uplift Scope [main] 22: zp[2]:6 [ main::$0 ] 22: zp[2]:10 [ main::$2 ]
|
|
Uplift Scope []
|
|
|
|
Uplifting [first] best 165 combination zp[2]:4 [ first::return#0 ] zp[2]:8 [ first::return#1 ] zp[2]:2 [ first::return#2 ]
|
|
Uplifting [main] best 165 combination zp[2]:6 [ main::$0 ] zp[2]:10 [ main::$2 ]
|
|
Uplifting [] best 165 combination
|
|
Coalescing zero page register [ zp[2]:2 [ first::return#2 ] ] with [ zp[2]:4 [ first::return#0 ] ] - score: 1
|
|
Coalescing zero page register [ zp[2]:2 [ first::return#2 first::return#0 ] ] with [ zp[2]:8 [ first::return#1 ] ] - score: 1
|
|
Coalescing zero page register [ zp[2]:2 [ first::return#2 first::return#0 first::return#1 ] ] with [ zp[2]:6 [ main::$0 ] ] - score: 1
|
|
Coalescing zero page register [ zp[2]:2 [ first::return#2 first::return#0 first::return#1 main::$0 ] ] with [ zp[2]:10 [ main::$2 ] ] - score: 1
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Tests pointer plus 0 elimination
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(main)
|
|
.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
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
main_from___b1:
|
|
jsr main
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
__bend_from___b1:
|
|
jmp __bend
|
|
// @end
|
|
__bend:
|
|
// main
|
|
main: {
|
|
.label SCREEN = $400
|
|
.label __0 = 2
|
|
.label __2 = 2
|
|
// [5] call first
|
|
// [14] phi from main to first [phi:main->first]
|
|
first_from_main:
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg1 [phi:main->first#0] -- pbuz1=pbuc1
|
|
lda #<msg1
|
|
sta.z first.return
|
|
lda #>msg1
|
|
sta.z first.return+1
|
|
jsr first
|
|
// [6] (byte*) first::return#0 ← (byte*) first::return#2
|
|
jmp __b1
|
|
// main::@1
|
|
__b1:
|
|
// [7] (byte*~) main::$0 ← (byte*) first::return#0
|
|
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*~) main::$0) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__0),y
|
|
sta SCREEN
|
|
// [9] call first
|
|
// [14] phi from main::@1 to first [phi:main::@1->first]
|
|
first_from___b1:
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg2 [phi:main::@1->first#0] -- pbuz1=pbuc1
|
|
lda #<msg2
|
|
sta.z first.return
|
|
lda #>msg2
|
|
sta.z first.return+1
|
|
jsr first
|
|
// [10] (byte*) first::return#1 ← (byte*) first::return#2
|
|
jmp __b2
|
|
// main::@2
|
|
__b2:
|
|
// [11] (byte*~) main::$2 ← (byte*) first::return#1
|
|
// [12] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*~) main::$2) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__2),y
|
|
sta SCREEN+1
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [13] return
|
|
rts
|
|
}
|
|
// first
|
|
first: {
|
|
.label return = 2
|
|
jmp __breturn
|
|
// first::@return
|
|
__breturn:
|
|
// [15] return
|
|
rts
|
|
}
|
|
// File Data
|
|
msg1: .text "hello world!"
|
|
.byte 0
|
|
msg2: .text "goodbye sky?"
|
|
.byte 0
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __bend
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __b1_from___bbegin:
|
|
Removing instruction __b1:
|
|
Removing instruction main_from___b1:
|
|
Removing instruction __bend_from___b1:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction __bbegin:
|
|
Removing instruction __bend:
|
|
Removing instruction first_from_main:
|
|
Removing instruction __b1:
|
|
Removing instruction first_from___b1:
|
|
Removing instruction __b2:
|
|
Removing instruction __breturn:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
Removing instruction jsr main
|
|
Succesful ASM optimization Pass5SkipBegin
|
|
|
|
FINAL SYMBOL TABLE
|
|
(label) @1
|
|
(label) @begin
|
|
(label) @end
|
|
(byte*()) first((byte*) first::msg)
|
|
(label) first::@return
|
|
(byte*) first::msg
|
|
(byte*) first::return
|
|
(byte*) first::return#0 return zp[2]:2 22.0
|
|
(byte*) first::return#1 return zp[2]:2 22.0
|
|
(byte*) first::return#2 return zp[2]:2 5.5
|
|
(void()) main()
|
|
(byte*~) main::$0 zp[2]:2 22.0
|
|
(byte*~) main::$2 zp[2]:2 22.0
|
|
(label) main::@1
|
|
(label) main::@2
|
|
(label) main::@return
|
|
(const nomodify byte*) main::SCREEN = (byte*) 1024
|
|
(const byte*) msg1[] = (byte*) "hello world!"
|
|
(const byte*) msg2[] = (byte*) "goodbye sky?"
|
|
|
|
zp[2]:2 [ first::return#2 first::return#0 first::return#1 main::$0 main::$2 ]
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 66
|
|
|
|
// File Comments
|
|
// Tests pointer plus 0 elimination
|
|
// Upstart
|
|
.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
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
// @end
|
|
// main
|
|
main: {
|
|
.label SCREEN = $400
|
|
.label __0 = 2
|
|
.label __2 = 2
|
|
// first(msg1)
|
|
// [5] call first
|
|
// [14] phi from main to first [phi:main->first]
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg1 [phi:main->first#0] -- pbuz1=pbuc1
|
|
lda #<msg1
|
|
sta.z first.return
|
|
lda #>msg1
|
|
sta.z first.return+1
|
|
jsr first
|
|
// first(msg1)
|
|
// [6] (byte*) first::return#0 ← (byte*) first::return#2
|
|
// main::@1
|
|
// [7] (byte*~) main::$0 ← (byte*) first::return#0
|
|
// SCREEN[0] = *(first(msg1)+0)
|
|
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*~) main::$0) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__0),y
|
|
sta SCREEN
|
|
// first(msg2)
|
|
// [9] call first
|
|
// [14] phi from main::@1 to first [phi:main::@1->first]
|
|
// [14] phi (byte*) first::return#2 = (const byte*) msg2 [phi:main::@1->first#0] -- pbuz1=pbuc1
|
|
lda #<msg2
|
|
sta.z first.return
|
|
lda #>msg2
|
|
sta.z first.return+1
|
|
jsr first
|
|
// first(msg2)
|
|
// [10] (byte*) first::return#1 ← (byte*) first::return#2
|
|
// main::@2
|
|
// [11] (byte*~) main::$2 ← (byte*) first::return#1
|
|
// SCREEN[1] = *(first(msg2)+0)
|
|
// [12] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*~) main::$2) -- _deref_pbuc1=_deref_pbuz1
|
|
ldy #0
|
|
lda (__2),y
|
|
sta SCREEN+1
|
|
// main::@return
|
|
// }
|
|
// [13] return
|
|
rts
|
|
}
|
|
// first
|
|
first: {
|
|
.label return = 2
|
|
// first::@return
|
|
// [15] return
|
|
rts
|
|
}
|
|
// File Data
|
|
msg1: .text "hello world!"
|
|
.byte 0
|
|
msg2: .text "goodbye sky?"
|
|
.byte 0
|
|
|