mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-03 07:29:37 +00:00
566 lines
20 KiB
Plaintext
566 lines
20 KiB
Plaintext
Eliminating unused variable with no statement bool_const_vars::$3
|
|
Eliminating unused variable with no statement bool_const_vars::$6
|
|
Eliminating unused variable with no statement bool_const_vars::$9
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
call bool_const_if
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
call bool_const_vars
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@1
|
|
call bool_const_inline
|
|
to:main::@3
|
|
main::@3: scope:[main] from main::@2
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@3
|
|
return
|
|
to:@return
|
|
|
|
void bool_const_if()
|
|
bool_const_if: scope:[bool_const_if] from main
|
|
if(bool_const_if::b) goto bool_const_if::@1
|
|
to:bool_const_if::@2
|
|
bool_const_if::@1: scope:[bool_const_if] from bool_const_if
|
|
SCREEN[0] = 't'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@2: scope:[bool_const_if] from bool_const_if
|
|
SCREEN[0] = 'f'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@return: scope:[bool_const_if] from bool_const_if::@1 bool_const_if::@2
|
|
return
|
|
to:@return
|
|
|
|
void bool_const_vars()
|
|
bool_const_vars: scope:[bool_const_vars] from main::@1
|
|
bool_const_vars::$0 = bool_const_vars::a == $f
|
|
bool_const_vars::$1 = $15 < bool_const_vars::a
|
|
bool_const_vars::$2 = ! bool_const_vars::$1
|
|
bool_const_vars::b1#0 = bool_const_vars::$0 || bool_const_vars::$2
|
|
bool_const_vars::$4 = bool_const_vars::a != $2c
|
|
bool_const_vars::$5 = bool_const_vars::a >= -8
|
|
bool_const_vars::b2#0 = bool_const_vars::$4 || bool_const_vars::$5
|
|
bool_const_vars::$7 = ! bool_const_vars::b2#0
|
|
bool_const_vars::$8 = bool_const_vars::b1#0 && bool_const_vars::$7
|
|
bool_const_vars::b#0 = bool_const_vars::$8 || false
|
|
if(bool_const_vars::b#0) goto bool_const_vars::@1
|
|
to:bool_const_vars::@2
|
|
bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars
|
|
SCREEN[1] = 't'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@2: scope:[bool_const_vars] from bool_const_vars
|
|
SCREEN[1] = 'f'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@return: scope:[bool_const_vars] from bool_const_vars::@1 bool_const_vars::@2
|
|
return
|
|
to:@return
|
|
|
|
void bool_const_inline()
|
|
bool_const_inline: scope:[bool_const_inline] from main::@2
|
|
bool_const_inline::$0 = bool_const_inline::a != $2c
|
|
bool_const_inline::$1 = bool_const_inline::a >= -8
|
|
bool_const_inline::$2 = bool_const_inline::a == $f
|
|
bool_const_inline::$3 = bool_const_inline::$1 && bool_const_inline::$2
|
|
bool_const_inline::$4 = bool_const_inline::$0 || bool_const_inline::$3
|
|
bool_const_inline::$5 = $15 < bool_const_inline::a
|
|
bool_const_inline::$6 = ! bool_const_inline::$5
|
|
bool_const_inline::$7 = bool_const_inline::$4 || bool_const_inline::$6
|
|
if(bool_const_inline::$7) goto bool_const_inline::@1
|
|
to:bool_const_inline::@2
|
|
bool_const_inline::@1: scope:[bool_const_inline] from bool_const_inline
|
|
SCREEN[2] = 't'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@2: scope:[bool_const_inline] from bool_const_inline
|
|
SCREEN[2] = 'f'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@return: scope:[bool_const_inline] from bool_const_inline::@1 bool_const_inline::@2
|
|
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
|
|
__constant char * const SCREEN = (char *)$400
|
|
void __start()
|
|
void bool_const_if()
|
|
__constant bool bool_const_if::b = true
|
|
void bool_const_inline()
|
|
bool bool_const_inline::$0
|
|
bool bool_const_inline::$1
|
|
bool bool_const_inline::$2
|
|
bool bool_const_inline::$3
|
|
bool bool_const_inline::$4
|
|
bool bool_const_inline::$5
|
|
bool bool_const_inline::$6
|
|
bool bool_const_inline::$7
|
|
__constant char bool_const_inline::a = $17
|
|
void bool_const_vars()
|
|
bool bool_const_vars::$0
|
|
bool bool_const_vars::$1
|
|
bool bool_const_vars::$2
|
|
bool bool_const_vars::$4
|
|
bool bool_const_vars::$5
|
|
bool bool_const_vars::$7
|
|
bool bool_const_vars::$8
|
|
__constant char bool_const_vars::a = $e
|
|
bool bool_const_vars::b
|
|
bool bool_const_vars::b#0
|
|
bool bool_const_vars::b1
|
|
bool bool_const_vars::b1#0
|
|
bool bool_const_vars::b2
|
|
bool bool_const_vars::b2#0
|
|
void main()
|
|
|
|
Adding number conversion cast (unumber) 0 in SCREEN[0] = 't'
|
|
Adding number conversion cast (unumber) 0 in SCREEN[0] = 'f'
|
|
Adding number conversion cast (unumber) $f in bool_const_vars::$0 = bool_const_vars::a == $f
|
|
Adding number conversion cast (unumber) $15 in bool_const_vars::$1 = $15 < bool_const_vars::a
|
|
Adding number conversion cast (unumber) $2c in bool_const_vars::$4 = bool_const_vars::a != $2c
|
|
Adding number conversion cast (unumber) -8 in bool_const_vars::$5 = bool_const_vars::a >= -8
|
|
Adding number conversion cast (unumber) 1 in SCREEN[1] = 't'
|
|
Adding number conversion cast (unumber) 1 in SCREEN[1] = 'f'
|
|
Adding number conversion cast (unumber) $2c in bool_const_inline::$0 = bool_const_inline::a != $2c
|
|
Adding number conversion cast (unumber) -8 in bool_const_inline::$1 = bool_const_inline::a >= -8
|
|
Adding number conversion cast (unumber) $f in bool_const_inline::$2 = bool_const_inline::a == $f
|
|
Adding number conversion cast (unumber) $15 in bool_const_inline::$5 = $15 < bool_const_inline::a
|
|
Adding number conversion cast (unumber) 2 in SCREEN[2] = 't'
|
|
Adding number conversion cast (unumber) 2 in SCREEN[2] = 'f'
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant pointer cast (char *) 1024
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast $f
|
|
Simplifying constant integer cast $15
|
|
Simplifying constant integer cast $2c
|
|
Simplifying constant integer cast -8
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast $2c
|
|
Simplifying constant integer cast -8
|
|
Simplifying constant integer cast $f
|
|
Simplifying constant integer cast $15
|
|
Simplifying constant integer cast 2
|
|
Simplifying constant integer cast 2
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (char) 0
|
|
Finalized unsigned number type (char) 0
|
|
Finalized unsigned number type (char) $f
|
|
Finalized unsigned number type (char) $15
|
|
Finalized unsigned number type (char) $2c
|
|
Finalized unsigned number type (char) -8
|
|
Finalized unsigned number type (char) 1
|
|
Finalized unsigned number type (char) 1
|
|
Finalized unsigned number type (char) $2c
|
|
Finalized unsigned number type (char) -8
|
|
Finalized unsigned number type (char) $f
|
|
Finalized unsigned number type (char) $15
|
|
Finalized unsigned number type (char) 2
|
|
Finalized unsigned number type (char) 2
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inversing boolean not [10] bool_const_vars::$2 = $15 >= bool_const_vars::a from [9] bool_const_vars::$1 = $15 < bool_const_vars::a
|
|
Inversing boolean not [28] bool_const_inline::$6 = $15 >= bool_const_inline::a from [27] bool_const_inline::$5 = $15 < bool_const_inline::a
|
|
Successful SSA optimization Pass2UnaryNotSimplification
|
|
Rewriting || if()-condition to two if()s [16] bool_const_vars::b#0 = bool_const_vars::$8 || false
|
|
Rewriting && if()-condition to two if()s [15] bool_const_vars::$8 = bool_const_vars::b1#0 && bool_const_vars::$7
|
|
Rewriting || if()-condition to two if()s [10] bool_const_vars::b1#0 = bool_const_vars::$0 || bool_const_vars::$2
|
|
Rewriting || if()-condition to two if()s [27] bool_const_inline::$7 = bool_const_inline::$4 || bool_const_inline::$6
|
|
Rewriting || if()-condition to two if()s [25] bool_const_inline::$4 = bool_const_inline::$0 || bool_const_inline::$3
|
|
Rewriting ! if()-condition to reversed if() [14] bool_const_vars::$7 = ! bool_const_vars::b2#0
|
|
Rewriting || if()-condition to two if()s [13] bool_const_vars::b2#0 = bool_const_vars::$4 || bool_const_vars::$5
|
|
Rewriting && if()-condition to two if()s [24] bool_const_inline::$3 = bool_const_inline::$1 && bool_const_inline::$2
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Constant right-side identified [8] bool_const_vars::$0 = bool_const_vars::a == $f
|
|
Constant right-side identified [9] bool_const_vars::$2 = $15 >= bool_const_vars::a
|
|
Constant right-side identified [11] bool_const_vars::$4 = bool_const_vars::a != $2c
|
|
Constant right-side identified [12] bool_const_vars::$5 = bool_const_vars::a >= -8
|
|
Constant right-side identified [21] bool_const_inline::$0 = bool_const_inline::a != $2c
|
|
Constant right-side identified [22] bool_const_inline::$1 = bool_const_inline::a >= -8
|
|
Constant right-side identified [23] bool_const_inline::$2 = bool_const_inline::a == $f
|
|
Constant right-side identified [26] bool_const_inline::$6 = $15 >= bool_const_inline::a
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant bool_const_vars::$0 = bool_const_vars::a==$f
|
|
Constant bool_const_vars::$2 = $15>=bool_const_vars::a
|
|
Constant bool_const_vars::$4 = bool_const_vars::a!=$2c
|
|
Constant bool_const_vars::$5 = bool_const_vars::a>=-8
|
|
Constant bool_const_inline::$0 = bool_const_inline::a!=$2c
|
|
Constant bool_const_inline::$1 = bool_const_inline::a>=-8
|
|
Constant bool_const_inline::$2 = bool_const_inline::a==$f
|
|
Constant bool_const_inline::$6 = $15>=bool_const_inline::a
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
if() condition always true - replacing block destination [4] if(bool_const_if::b) goto bool_const_if::@1
|
|
if() condition always false - eliminating [17] if(bool_const_vars::$0) goto bool_const_vars::@4
|
|
if() condition always true - replacing block destination [28] if(bool_const_inline::$0) goto bool_const_inline::@1
|
|
if() condition always false - eliminating if(false) goto bool_const_vars::@1
|
|
if() condition always true - replacing block destination if(bool_const_vars::$4) goto bool_const_vars::@3
|
|
if() condition always true - replacing block destination if(bool_const_vars::$2) goto bool_const_vars::@4
|
|
if() condition always false - eliminating if(bool_const_inline::$6) goto bool_const_inline::@1
|
|
if() condition always true - replacing block destination if(bool_const_inline::$1) goto bool_const_inline::@5
|
|
if() condition always true - replacing block destination if(bool_const_vars::$5) goto bool_const_vars::@3
|
|
if() condition always false - eliminating if(bool_const_inline::$2) goto bool_const_inline::@1
|
|
Successful SSA optimization Pass2ConstantIfs
|
|
Simplifying expression containing zero SCREEN in [5] SCREEN[0] = 't'
|
|
Simplifying expression containing zero SCREEN in [6] SCREEN[0] = 'f'
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
Removing unused block bool_const_if::@2
|
|
Removing unused block bool_const_vars::@1
|
|
Removing unused block bool_const_inline::@2
|
|
Removing unused block bool_const_inline::@3
|
|
Removing unused block bool_const_inline::@4
|
|
Removing unused block bool_const_vars::@6
|
|
Removing unused block bool_const_inline::@5
|
|
Successful SSA optimization Pass2EliminateUnusedBlocks
|
|
Eliminating unused constant bool_const_if::b
|
|
Eliminating unused constant bool_const_vars::$0
|
|
Eliminating unused constant bool_const_vars::$2
|
|
Eliminating unused constant bool_const_vars::$4
|
|
Eliminating unused constant bool_const_vars::$5
|
|
Eliminating unused constant bool_const_inline::$0
|
|
Eliminating unused constant bool_const_inline::$1
|
|
Eliminating unused constant bool_const_inline::$2
|
|
Eliminating unused constant bool_const_inline::$6
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
Eliminating unused constant bool_const_vars::a
|
|
Eliminating unused constant bool_const_inline::a
|
|
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
|
|
Consolidated array index constant in *(SCREEN+1)
|
|
Consolidated array index constant in *(SCREEN+2)
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of main::@1
|
|
Adding NOP phi() at start of main::@2
|
|
Adding NOP phi() at start of main::@3
|
|
Adding NOP phi() at start of bool_const_if
|
|
Adding NOP phi() at start of bool_const_vars
|
|
Adding NOP phi() at start of bool_const_vars::@5
|
|
Adding NOP phi() at start of bool_const_vars::@4
|
|
Adding NOP phi() at start of bool_const_vars::@3
|
|
Adding NOP phi() at start of bool_const_inline
|
|
CALL GRAPH
|
|
Calls in [main] to bool_const_if:1 bool_const_vars:3 bool_const_inline:5
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
Culled Empty Block label main::@3
|
|
Culled Empty Block label bool_const_vars::@5
|
|
Culled Empty Block label bool_const_vars::@4
|
|
Culled Empty Block label bool_const_vars::@3
|
|
Renumbering block bool_const_vars::@2 to bool_const_vars::@1
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of main::@1
|
|
Adding NOP phi() at start of main::@2
|
|
Adding NOP phi() at start of bool_const_if
|
|
Adding NOP phi() at start of bool_const_vars
|
|
Adding NOP phi() at start of bool_const_inline
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
[0] phi()
|
|
[1] call bool_const_if
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
[2] phi()
|
|
[3] call bool_const_vars
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@1
|
|
[4] phi()
|
|
[5] call bool_const_inline
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@2
|
|
[6] return
|
|
to:@return
|
|
|
|
void bool_const_if()
|
|
bool_const_if: scope:[bool_const_if] from main
|
|
[7] phi()
|
|
to:bool_const_if::@1
|
|
bool_const_if::@1: scope:[bool_const_if] from bool_const_if
|
|
[8] *SCREEN = 't'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@return: scope:[bool_const_if] from bool_const_if::@1
|
|
[9] return
|
|
to:@return
|
|
|
|
void bool_const_vars()
|
|
bool_const_vars: scope:[bool_const_vars] from main::@1
|
|
[10] phi()
|
|
to:bool_const_vars::@1
|
|
bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars
|
|
[11] *(SCREEN+1) = 'f'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@return: scope:[bool_const_vars] from bool_const_vars::@1
|
|
[12] return
|
|
to:@return
|
|
|
|
void bool_const_inline()
|
|
bool_const_inline: scope:[bool_const_inline] from main::@2
|
|
[13] phi()
|
|
to:bool_const_inline::@1
|
|
bool_const_inline::@1: scope:[bool_const_inline] from bool_const_inline
|
|
[14] *(SCREEN+2) = 't'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@return: scope:[bool_const_inline] from bool_const_inline::@1
|
|
[15] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void bool_const_if()
|
|
void bool_const_inline()
|
|
void bool_const_vars()
|
|
bool bool_const_vars::b
|
|
bool bool_const_vars::b1
|
|
bool bool_const_vars::b2
|
|
void main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [8] *SCREEN = 't' [ ] ( bool_const_if:1 [ ] { } ) always clobbers reg byte a
|
|
Statement [11] *(SCREEN+1) = 'f' [ ] ( bool_const_vars:3 [ ] { } ) always clobbers reg byte a
|
|
Statement [14] *(SCREEN+2) = 't' [ ] ( bool_const_inline:5 [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope [bool_const_if]
|
|
Uplift Scope [bool_const_vars]
|
|
Uplift Scope [bool_const_inline]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 168 combination
|
|
Uplifting [bool_const_if] best 168 combination
|
|
Uplifting [bool_const_vars] best 168 combination
|
|
Uplifting [bool_const_inline] best 168 combination
|
|
Uplifting [] best 168 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// A Minimal test of boolean constants.
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="bool-const.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// [1] call bool_const_if
|
|
// [7] phi from main to bool_const_if [phi:main->bool_const_if]
|
|
bool_const_if_from_main:
|
|
jsr bool_const_if
|
|
// [2] phi from main to main::@1 [phi:main->main::@1]
|
|
__b1_from_main:
|
|
jmp __b1
|
|
// main::@1
|
|
__b1:
|
|
// [3] call bool_const_vars
|
|
// [10] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
|
|
bool_const_vars_from___b1:
|
|
jsr bool_const_vars
|
|
// [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
|
|
__b2_from___b1:
|
|
jmp __b2
|
|
// main::@2
|
|
__b2:
|
|
// [5] call bool_const_inline
|
|
// [13] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
|
|
bool_const_inline_from___b2:
|
|
jsr bool_const_inline
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [6] return
|
|
rts
|
|
}
|
|
// bool_const_if
|
|
// A constant boolean inside an if()
|
|
bool_const_if: {
|
|
jmp __b1
|
|
// bool_const_if::@1
|
|
__b1:
|
|
// [8] *SCREEN = 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN
|
|
jmp __breturn
|
|
// bool_const_if::@return
|
|
__breturn:
|
|
// [9] return
|
|
rts
|
|
}
|
|
// bool_const_vars
|
|
// A bunch of constant boolean vars (used in an if)
|
|
bool_const_vars: {
|
|
jmp __b1
|
|
// bool_const_vars::@1
|
|
__b1:
|
|
// [11] *(SCREEN+1) = 'f' -- _deref_pbuc1=vbuc2
|
|
lda #'f'
|
|
sta SCREEN+1
|
|
jmp __breturn
|
|
// bool_const_vars::@return
|
|
__breturn:
|
|
// [12] return
|
|
rts
|
|
}
|
|
// bool_const_inline
|
|
// A constant boolean inside an if()
|
|
bool_const_inline: {
|
|
jmp __b1
|
|
// bool_const_inline::@1
|
|
__b1:
|
|
// [14] *(SCREEN+2) = 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN+2
|
|
jmp __breturn
|
|
// bool_const_inline::@return
|
|
__breturn:
|
|
// [15] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __b1_from_main:
|
|
Removing instruction bool_const_vars_from___b1:
|
|
Removing instruction __b2_from___b1:
|
|
Removing instruction bool_const_inline_from___b2:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction bool_const_if_from_main:
|
|
Removing instruction __b1:
|
|
Removing instruction __b2:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b1:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b1:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b1:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
__constant char * const SCREEN = (char *) 1024
|
|
void bool_const_if()
|
|
void bool_const_inline()
|
|
void bool_const_vars()
|
|
bool bool_const_vars::b
|
|
bool bool_const_vars::b1
|
|
bool bool_const_vars::b2
|
|
void main()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 60
|
|
|
|
// File Comments
|
|
// A Minimal test of boolean constants.
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="bool-const.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// bool_const_if()
|
|
// [1] call bool_const_if
|
|
// [7] phi from main to bool_const_if [phi:main->bool_const_if]
|
|
jsr bool_const_if
|
|
// [2] phi from main to main::@1 [phi:main->main::@1]
|
|
// main::@1
|
|
// bool_const_vars()
|
|
// [3] call bool_const_vars
|
|
// [10] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
|
|
jsr bool_const_vars
|
|
// [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
|
|
// main::@2
|
|
// bool_const_inline()
|
|
// [5] call bool_const_inline
|
|
// [13] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
|
|
jsr bool_const_inline
|
|
// main::@return
|
|
// }
|
|
// [6] return
|
|
rts
|
|
}
|
|
// bool_const_if
|
|
// A constant boolean inside an if()
|
|
bool_const_if: {
|
|
// bool_const_if::@1
|
|
// SCREEN[0] = 't'
|
|
// [8] *SCREEN = 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN
|
|
// bool_const_if::@return
|
|
// }
|
|
// [9] return
|
|
rts
|
|
}
|
|
// bool_const_vars
|
|
// A bunch of constant boolean vars (used in an if)
|
|
bool_const_vars: {
|
|
// bool_const_vars::@1
|
|
// SCREEN[1] = 'f'
|
|
// [11] *(SCREEN+1) = 'f' -- _deref_pbuc1=vbuc2
|
|
lda #'f'
|
|
sta SCREEN+1
|
|
// bool_const_vars::@return
|
|
// }
|
|
// [12] return
|
|
rts
|
|
}
|
|
// bool_const_inline
|
|
// A constant boolean inside an if()
|
|
bool_const_inline: {
|
|
// bool_const_inline::@1
|
|
// SCREEN[2] = 't'
|
|
// [14] *(SCREEN+2) = 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN+2
|
|
// bool_const_inline::@return
|
|
// }
|
|
// [15] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|