mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-10 10:29:36 +00:00
693 lines
26 KiB
Plaintext
693 lines
26 KiB
Plaintext
Identified constant variable (bool) bool_const_if::b
|
|
Identified constant variable (byte) bool_const_vars::a
|
|
Identified constant variable (byte) bool_const_inline::a
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
@begin: scope:[] from
|
|
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) $400
|
|
to:@4
|
|
main: scope:[main] from @4
|
|
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
|
|
bool_const_if: scope:[bool_const_if] from main
|
|
(bool) bool_const_if::b#0 ← true
|
|
if((bool) bool_const_if::b#0) goto bool_const_if::@1
|
|
to:bool_const_if::@3
|
|
bool_const_if::@1: scope:[bool_const_if] from bool_const_if
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) 't'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@3: scope:[bool_const_if] from bool_const_if
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) 'f'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@return: scope:[bool_const_if] from bool_const_if::@1 bool_const_if::@3
|
|
return
|
|
to:@return
|
|
bool_const_vars: scope:[bool_const_vars] from main::@1
|
|
(byte) bool_const_vars::a#0 ← (byte/signed byte/word/signed word/dword/signed dword) $e
|
|
(bool~) bool_const_vars::$0 ← (byte) bool_const_vars::a#0 == (byte/signed byte/word/signed word/dword/signed dword) $f
|
|
(bool~) bool_const_vars::$1 ← (byte/signed byte/word/signed word/dword/signed dword) $15 < (byte) bool_const_vars::a#0
|
|
(bool~) bool_const_vars::$2 ← ! (bool~) bool_const_vars::$1
|
|
(bool~) bool_const_vars::$3 ← (bool~) bool_const_vars::$0 || (bool~) bool_const_vars::$2
|
|
(bool) bool_const_vars::b1#0 ← (bool~) bool_const_vars::$3
|
|
(bool~) bool_const_vars::$4 ← (byte) bool_const_vars::a#0 != (byte/signed byte/word/signed word/dword/signed dword) $2c
|
|
(signed byte/signed word/signed dword~) bool_const_vars::$5 ← - (byte/signed byte/word/signed word/dword/signed dword) 8
|
|
(bool~) bool_const_vars::$6 ← (byte) bool_const_vars::a#0 >= (signed byte/signed word/signed dword~) bool_const_vars::$5
|
|
(bool~) bool_const_vars::$7 ← (bool~) bool_const_vars::$4 || (bool~) bool_const_vars::$6
|
|
(bool) bool_const_vars::b2#0 ← (bool~) bool_const_vars::$7
|
|
(bool~) bool_const_vars::$8 ← ! (bool) bool_const_vars::b2#0
|
|
(bool~) bool_const_vars::$9 ← (bool) bool_const_vars::b1#0 && (bool~) bool_const_vars::$8
|
|
(bool~) bool_const_vars::$10 ← (bool~) bool_const_vars::$9 || false
|
|
(bool) bool_const_vars::b#0 ← (bool~) bool_const_vars::$10
|
|
if((bool) bool_const_vars::b#0) goto bool_const_vars::@1
|
|
to:bool_const_vars::@3
|
|
bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 't'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@3: scope:[bool_const_vars] from bool_const_vars
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@return: scope:[bool_const_vars] from bool_const_vars::@1 bool_const_vars::@3
|
|
return
|
|
to:@return
|
|
bool_const_inline: scope:[bool_const_inline] from main::@2
|
|
(byte) bool_const_inline::a#0 ← (byte/signed byte/word/signed word/dword/signed dword) $17
|
|
(bool~) bool_const_inline::$0 ← (byte) bool_const_inline::a#0 != (byte/signed byte/word/signed word/dword/signed dword) $2c
|
|
(signed byte/signed word/signed dword~) bool_const_inline::$1 ← - (byte/signed byte/word/signed word/dword/signed dword) 8
|
|
(bool~) bool_const_inline::$2 ← (byte) bool_const_inline::a#0 >= (signed byte/signed word/signed dword~) bool_const_inline::$1
|
|
(bool~) bool_const_inline::$3 ← (byte) bool_const_inline::a#0 == (byte/signed byte/word/signed word/dword/signed dword) $f
|
|
(bool~) bool_const_inline::$4 ← (bool~) bool_const_inline::$2 && (bool~) bool_const_inline::$3
|
|
(bool~) bool_const_inline::$5 ← (bool~) bool_const_inline::$0 || (bool~) bool_const_inline::$4
|
|
(bool~) bool_const_inline::$6 ← (byte/signed byte/word/signed word/dword/signed dword) $15 < (byte) bool_const_inline::a#0
|
|
(bool~) bool_const_inline::$7 ← ! (bool~) bool_const_inline::$6
|
|
(bool~) bool_const_inline::$8 ← (bool~) bool_const_inline::$5 || (bool~) bool_const_inline::$7
|
|
if((bool~) bool_const_inline::$8) goto bool_const_inline::@1
|
|
to:bool_const_inline::@3
|
|
bool_const_inline::@1: scope:[bool_const_inline] from bool_const_inline
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@3: scope:[bool_const_inline] from bool_const_inline
|
|
*((byte*) SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 'f'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@return: scope:[bool_const_inline] from bool_const_inline::@1 bool_const_inline::@3
|
|
return
|
|
to:@return
|
|
@4: scope:[] from @begin
|
|
call main
|
|
to:@5
|
|
@5: scope:[] from @4
|
|
to:@end
|
|
@end: scope:[] from @5
|
|
|
|
SYMBOL TABLE SSA
|
|
(label) @4
|
|
(label) @5
|
|
(label) @begin
|
|
(label) @end
|
|
(byte*) SCREEN
|
|
(byte*) SCREEN#0
|
|
(void()) bool_const_if()
|
|
(label) bool_const_if::@1
|
|
(label) bool_const_if::@3
|
|
(label) bool_const_if::@return
|
|
(bool) bool_const_if::b
|
|
(bool) bool_const_if::b#0
|
|
(void()) bool_const_inline()
|
|
(bool~) bool_const_inline::$0
|
|
(signed byte/signed word/signed dword~) 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
|
|
(bool~) bool_const_inline::$8
|
|
(label) bool_const_inline::@1
|
|
(label) bool_const_inline::@3
|
|
(label) bool_const_inline::@return
|
|
(byte) bool_const_inline::a
|
|
(byte) bool_const_inline::a#0
|
|
(void()) bool_const_vars()
|
|
(bool~) bool_const_vars::$0
|
|
(bool~) bool_const_vars::$1
|
|
(bool~) bool_const_vars::$10
|
|
(bool~) bool_const_vars::$2
|
|
(bool~) bool_const_vars::$3
|
|
(bool~) bool_const_vars::$4
|
|
(signed byte/signed word/signed dword~) bool_const_vars::$5
|
|
(bool~) bool_const_vars::$6
|
|
(bool~) bool_const_vars::$7
|
|
(bool~) bool_const_vars::$8
|
|
(bool~) bool_const_vars::$9
|
|
(label) bool_const_vars::@1
|
|
(label) bool_const_vars::@3
|
|
(label) bool_const_vars::@return
|
|
(byte) bool_const_vars::a
|
|
(byte) bool_const_vars::a#0
|
|
(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()
|
|
(label) main::@1
|
|
(label) main::@2
|
|
(label) main::@3
|
|
(label) main::@return
|
|
|
|
Culled Empty Block (label) main::@3
|
|
Culled Empty Block (label) @5
|
|
Successful SSA optimization Pass2CullEmptyBlocks
|
|
Inversing boolean not [13] (bool~) bool_const_vars::$2 ← (byte/signed byte/word/signed word/dword/signed dword) $15 >= (byte) bool_const_vars::a#0 from [12] (bool~) bool_const_vars::$1 ← (byte/signed byte/word/signed word/dword/signed dword) $15 < (byte) bool_const_vars::a#0
|
|
Inversing boolean not [37] (bool~) bool_const_inline::$7 ← (byte/signed byte/word/signed word/dword/signed dword) $15 >= (byte) bool_const_inline::a#0 from [36] (bool~) bool_const_inline::$6 ← (byte/signed byte/word/signed word/dword/signed dword) $15 < (byte) bool_const_inline::a#0
|
|
Successful SSA optimization Pass2UnaryNotSimplification
|
|
Alias (bool) bool_const_vars::b1#0 = (bool~) bool_const_vars::$3
|
|
Alias (bool) bool_const_vars::b2#0 = (bool~) bool_const_vars::$7
|
|
Alias (bool) bool_const_vars::b#0 = (bool~) bool_const_vars::$10
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Rewriting || if()-condition to two if()s [23] (bool) bool_const_vars::b#0 ← (bool~) bool_const_vars::$9 || false
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting && if()-condition to two if()s [22] (bool~) bool_const_vars::$9 ← (bool) bool_const_vars::b1#0 && (bool~) bool_const_vars::$8
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting || if()-condition to two if()s [14] (bool) bool_const_vars::b1#0 ← (bool~) bool_const_vars::$0 || (bool~) bool_const_vars::$2
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting || if()-condition to two if()s [38] (bool~) bool_const_inline::$8 ← (bool~) bool_const_inline::$5 || (bool~) bool_const_inline::$7
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting || if()-condition to two if()s [35] (bool~) bool_const_inline::$5 ← (bool~) bool_const_inline::$0 || (bool~) bool_const_inline::$4
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting ! if()-condition to reversed if() [21] (bool~) bool_const_vars::$8 ← ! (bool) bool_const_vars::b2#0
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting || if()-condition to two if()s [19] (bool) bool_const_vars::b2#0 ← (bool~) bool_const_vars::$4 || (bool~) bool_const_vars::$6
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Rewriting && if()-condition to two if()s [34] (bool~) bool_const_inline::$4 ← (bool~) bool_const_inline::$2 && (bool~) bool_const_inline::$3
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Constant (const byte*) SCREEN#0 = ((byte*))$400
|
|
Constant (const bool) bool_const_if::b#0 = true
|
|
Constant (const byte) bool_const_vars::a#0 = $e
|
|
Constant (const signed byte/signed word/signed dword) bool_const_vars::$5 = -8
|
|
Constant (const byte) bool_const_inline::a#0 = $17
|
|
Constant (const signed byte/signed word/signed dword) bool_const_inline::$1 = -8
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant (const bool) bool_const_vars::$0 = bool_const_vars::a#0==$f
|
|
Constant (const bool) bool_const_vars::$2 = $15>=bool_const_vars::a#0
|
|
Constant (const bool) bool_const_vars::$4 = bool_const_vars::a#0!=$2c
|
|
Constant (const bool) bool_const_vars::$6 = bool_const_vars::a#0>=bool_const_vars::$5
|
|
Constant (const bool) bool_const_inline::$0 = bool_const_inline::a#0!=$2c
|
|
Constant (const bool) bool_const_inline::$2 = bool_const_inline::a#0>=bool_const_inline::$1
|
|
Constant (const bool) bool_const_inline::$3 = bool_const_inline::a#0==$f
|
|
Constant (const bool) bool_const_inline::$7 = $15>=bool_const_inline::a#0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Consolidated array index constant in *(SCREEN#0+0)
|
|
Consolidated array index constant in *(SCREEN#0+0)
|
|
Consolidated array index constant in *(SCREEN#0+1)
|
|
Consolidated array index constant in *(SCREEN#0+1)
|
|
Consolidated array index constant in *(SCREEN#0+2)
|
|
Consolidated array index constant in *(SCREEN#0+2)
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
if() condition always true - replacing block destination [4] if((const bool) bool_const_if::b#0) goto bool_const_if::@1
|
|
if() condition always false - eliminating [8] if((const bool) bool_const_vars::$0) goto bool_const_vars::@6
|
|
if() condition always true - replacing block destination [12] if((const bool) bool_const_inline::$0) goto bool_const_inline::@1
|
|
if() condition always false - eliminating [17] if(false) goto bool_const_vars::@1
|
|
if() condition always true - replacing block destination [18] if((const bool) bool_const_vars::$4) goto bool_const_vars::@5
|
|
if() condition always true - replacing block destination [19] if((const bool) bool_const_vars::$2) goto bool_const_vars::@6
|
|
if() condition always false - eliminating [20] if((const bool) bool_const_inline::$7) goto bool_const_inline::@1
|
|
if() condition always true - replacing block destination [21] if((const bool) bool_const_inline::$2) goto bool_const_inline::@7
|
|
if() condition always true - replacing block destination [22] if((const bool) bool_const_vars::$6) goto bool_const_vars::@5
|
|
if() condition always false - eliminating [23] if((const bool) bool_const_inline::$3) goto bool_const_inline::@1
|
|
Successful SSA optimization Pass2ConstantIfs
|
|
Eliminating unused constant (const bool) bool_const_if::b#0
|
|
Eliminating unused constant (const bool) bool_const_vars::$0
|
|
Eliminating unused constant (const bool) bool_const_vars::$2
|
|
Eliminating unused constant (const bool) bool_const_vars::$4
|
|
Eliminating unused constant (const bool) bool_const_vars::$6
|
|
Eliminating unused constant (const bool) bool_const_inline::$0
|
|
Eliminating unused constant (const bool) bool_const_inline::$2
|
|
Eliminating unused constant (const bool) bool_const_inline::$3
|
|
Eliminating unused constant (const bool) bool_const_inline::$7
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
Eliminating unused constant (const byte) bool_const_vars::a#0
|
|
Eliminating unused constant (const signed byte/signed word/signed dword) bool_const_vars::$5
|
|
Eliminating unused constant (const byte) bool_const_inline::a#0
|
|
Eliminating unused constant (const signed byte/signed word/signed dword) bool_const_inline::$1
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
Removing unused block bool_const_if::@3
|
|
Removing unused block bool_const_vars::@1
|
|
Removing unused block bool_const_inline::@3
|
|
Removing unused block bool_const_inline::@5
|
|
Removing unused block bool_const_inline::@6
|
|
Removing unused block bool_const_vars::@8
|
|
Removing unused block bool_const_inline::@7
|
|
Successful SSA optimization Pass2EliminateUnusedBlocks
|
|
Culled Empty Block (label) bool_const_vars::@5
|
|
Culled Empty Block (label) bool_const_vars::@6
|
|
Culled Empty Block (label) bool_const_vars::@7
|
|
Successful SSA optimization Pass2CullEmptyBlocks
|
|
Simplifying constant plus zero SCREEN#0+0
|
|
Adding NOP phi() at start of @begin
|
|
Adding NOP phi() at start of @4
|
|
Adding NOP phi() at start of @end
|
|
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_inline
|
|
Adding NOP phi() at start of bool_const_vars
|
|
Adding NOP phi() at start of bool_const_if
|
|
CALL GRAPH
|
|
Calls in [] to main:2
|
|
Calls in [main] to bool_const_if:5 bool_const_vars:7 bool_const_inline:9
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
Renumbering block @4 to @1
|
|
Renumbering block bool_const_vars::@3 to bool_const_vars::@1
|
|
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
|
|
Adding NOP phi() at start of main::@1
|
|
Adding NOP phi() at start of main::@2
|
|
Adding NOP phi() at start of bool_const_inline
|
|
Adding NOP phi() at start of bool_const_vars
|
|
Adding NOP phi() at start of bool_const_if
|
|
|
|
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()
|
|
main: scope:[main] from @1
|
|
[4] phi()
|
|
[5] call bool_const_if
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
[6] phi()
|
|
[7] call bool_const_vars
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@1
|
|
[8] phi()
|
|
[9] call bool_const_inline
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@2
|
|
[10] return
|
|
to:@return
|
|
bool_const_inline: scope:[bool_const_inline] from main::@2
|
|
[11] phi()
|
|
to:bool_const_inline::@1
|
|
bool_const_inline::@1: scope:[bool_const_inline] from bool_const_inline
|
|
[12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't'
|
|
to:bool_const_inline::@return
|
|
bool_const_inline::@return: scope:[bool_const_inline] from bool_const_inline::@1
|
|
[13] return
|
|
to:@return
|
|
bool_const_vars: scope:[bool_const_vars] from main::@1
|
|
[14] phi()
|
|
to:bool_const_vars::@1
|
|
bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars
|
|
[15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f'
|
|
to:bool_const_vars::@return
|
|
bool_const_vars::@return: scope:[bool_const_vars] from bool_const_vars::@1
|
|
[16] return
|
|
to:@return
|
|
bool_const_if: scope:[bool_const_if] from main
|
|
[17] phi()
|
|
to:bool_const_if::@1
|
|
bool_const_if::@1: scope:[bool_const_if] from bool_const_if
|
|
[18] *((const byte*) SCREEN#0) ← (byte) 't'
|
|
to:bool_const_if::@return
|
|
bool_const_if::@return: scope:[bool_const_if] from bool_const_if::@1
|
|
[19] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
(byte*) SCREEN
|
|
(void()) bool_const_if()
|
|
(bool) bool_const_if::b
|
|
(void()) bool_const_inline()
|
|
(byte) bool_const_inline::a
|
|
(void()) bool_const_vars()
|
|
(byte) bool_const_vars::a
|
|
(bool) bool_const_vars::b
|
|
(bool) bool_const_vars::b1
|
|
(bool) bool_const_vars::b2
|
|
(void()) main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
|
|
INITIAL ASM
|
|
//SEG0 File Comments
|
|
// A Minimal test of boolean constants.
|
|
//SEG1 Basic Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(bbegin)
|
|
.pc = $80d "Program"
|
|
//SEG2 Global Constants & labels
|
|
.label SCREEN = $400
|
|
//SEG3 @begin
|
|
bbegin:
|
|
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
|
b1_from_bbegin:
|
|
jmp b1
|
|
//SEG5 @1
|
|
b1:
|
|
//SEG6 [2] call main
|
|
//SEG7 [4] phi from @1 to main [phi:@1->main]
|
|
main_from_b1:
|
|
jsr main
|
|
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
|
|
bend_from_b1:
|
|
jmp bend
|
|
//SEG9 @end
|
|
bend:
|
|
//SEG10 main
|
|
main: {
|
|
//SEG11 [5] call bool_const_if
|
|
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
|
|
bool_const_if_from_main:
|
|
jsr bool_const_if
|
|
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
|
|
b1_from_main:
|
|
jmp b1
|
|
//SEG14 main::@1
|
|
b1:
|
|
//SEG15 [7] call bool_const_vars
|
|
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
|
|
bool_const_vars_from_b1:
|
|
jsr bool_const_vars
|
|
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
|
|
b2_from_b1:
|
|
jmp b2
|
|
//SEG18 main::@2
|
|
b2:
|
|
//SEG19 [9] call bool_const_inline
|
|
//SEG20 [11] 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
|
|
//SEG21 main::@return
|
|
breturn:
|
|
//SEG22 [10] return
|
|
rts
|
|
}
|
|
//SEG23 bool_const_inline
|
|
// A constant boolean inside an if()
|
|
bool_const_inline: {
|
|
jmp b1
|
|
//SEG24 bool_const_inline::@1
|
|
b1:
|
|
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN+2
|
|
jmp breturn
|
|
//SEG26 bool_const_inline::@return
|
|
breturn:
|
|
//SEG27 [13] return
|
|
rts
|
|
}
|
|
//SEG28 bool_const_vars
|
|
// A bunch of constant boolean vars (used in an if)
|
|
bool_const_vars: {
|
|
jmp b1
|
|
//SEG29 bool_const_vars::@1
|
|
b1:
|
|
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
|
|
lda #'f'
|
|
sta SCREEN+1
|
|
jmp breturn
|
|
//SEG31 bool_const_vars::@return
|
|
breturn:
|
|
//SEG32 [16] return
|
|
rts
|
|
}
|
|
//SEG33 bool_const_if
|
|
// A constant boolean inside an if()
|
|
bool_const_if: {
|
|
jmp b1
|
|
//SEG34 bool_const_if::@1
|
|
b1:
|
|
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN
|
|
jmp breturn
|
|
//SEG36 bool_const_if::@return
|
|
breturn:
|
|
//SEG37 [19] return
|
|
rts
|
|
}
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' [ ] ( main:2::bool_const_inline:9 [ ] ) always clobbers reg byte a
|
|
Statement [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' [ ] ( main:2::bool_const_vars:7 [ ] ) always clobbers reg byte a
|
|
Statement [18] *((const byte*) SCREEN#0) ← (byte) 't' [ ] ( main:2::bool_const_if: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 180 combination
|
|
Uplifting [bool_const_if] best 180 combination
|
|
Uplifting [bool_const_vars] best 180 combination
|
|
Uplifting [bool_const_inline] best 180 combination
|
|
Uplifting [] best 180 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
//SEG0 File Comments
|
|
// A Minimal test of boolean constants.
|
|
//SEG1 Basic Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(bbegin)
|
|
.pc = $80d "Program"
|
|
//SEG2 Global Constants & labels
|
|
.label SCREEN = $400
|
|
//SEG3 @begin
|
|
bbegin:
|
|
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
|
b1_from_bbegin:
|
|
jmp b1
|
|
//SEG5 @1
|
|
b1:
|
|
//SEG6 [2] call main
|
|
//SEG7 [4] phi from @1 to main [phi:@1->main]
|
|
main_from_b1:
|
|
jsr main
|
|
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
|
|
bend_from_b1:
|
|
jmp bend
|
|
//SEG9 @end
|
|
bend:
|
|
//SEG10 main
|
|
main: {
|
|
//SEG11 [5] call bool_const_if
|
|
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
|
|
bool_const_if_from_main:
|
|
jsr bool_const_if
|
|
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
|
|
b1_from_main:
|
|
jmp b1
|
|
//SEG14 main::@1
|
|
b1:
|
|
//SEG15 [7] call bool_const_vars
|
|
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
|
|
bool_const_vars_from_b1:
|
|
jsr bool_const_vars
|
|
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
|
|
b2_from_b1:
|
|
jmp b2
|
|
//SEG18 main::@2
|
|
b2:
|
|
//SEG19 [9] call bool_const_inline
|
|
//SEG20 [11] 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
|
|
//SEG21 main::@return
|
|
breturn:
|
|
//SEG22 [10] return
|
|
rts
|
|
}
|
|
//SEG23 bool_const_inline
|
|
// A constant boolean inside an if()
|
|
bool_const_inline: {
|
|
jmp b1
|
|
//SEG24 bool_const_inline::@1
|
|
b1:
|
|
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN+2
|
|
jmp breturn
|
|
//SEG26 bool_const_inline::@return
|
|
breturn:
|
|
//SEG27 [13] return
|
|
rts
|
|
}
|
|
//SEG28 bool_const_vars
|
|
// A bunch of constant boolean vars (used in an if)
|
|
bool_const_vars: {
|
|
jmp b1
|
|
//SEG29 bool_const_vars::@1
|
|
b1:
|
|
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
|
|
lda #'f'
|
|
sta SCREEN+1
|
|
jmp breturn
|
|
//SEG31 bool_const_vars::@return
|
|
breturn:
|
|
//SEG32 [16] return
|
|
rts
|
|
}
|
|
//SEG33 bool_const_if
|
|
// A constant boolean inside an if()
|
|
bool_const_if: {
|
|
jmp b1
|
|
//SEG34 bool_const_if::@1
|
|
b1:
|
|
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN
|
|
jmp breturn
|
|
//SEG36 bool_const_if::@return
|
|
breturn:
|
|
//SEG37 [19] return
|
|
rts
|
|
}
|
|
|
|
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 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_bbegin:
|
|
Removing instruction b1:
|
|
Removing instruction main_from_b1:
|
|
Removing instruction bend_from_b1:
|
|
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 bend:
|
|
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
|
|
Updating BasicUpstart to call main directly
|
|
Removing instruction jsr main
|
|
Succesful ASM optimization Pass5SkipBegin
|
|
Removing instruction bbegin:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
(label) @1
|
|
(label) @begin
|
|
(label) @end
|
|
(byte*) SCREEN
|
|
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
|
|
(void()) bool_const_if()
|
|
(label) bool_const_if::@1
|
|
(label) bool_const_if::@return
|
|
(bool) bool_const_if::b
|
|
(void()) bool_const_inline()
|
|
(label) bool_const_inline::@1
|
|
(label) bool_const_inline::@return
|
|
(byte) bool_const_inline::a
|
|
(void()) bool_const_vars()
|
|
(label) bool_const_vars::@1
|
|
(label) bool_const_vars::@return
|
|
(byte) bool_const_vars::a
|
|
(bool) bool_const_vars::b
|
|
(bool) bool_const_vars::b1
|
|
(bool) bool_const_vars::b2
|
|
(void()) main()
|
|
(label) main::@1
|
|
(label) main::@2
|
|
(label) main::@return
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 60
|
|
|
|
//SEG0 File Comments
|
|
// A Minimal test of boolean constants.
|
|
//SEG1 Basic Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(main)
|
|
.pc = $80d "Program"
|
|
//SEG2 Global Constants & labels
|
|
.label SCREEN = $400
|
|
//SEG3 @begin
|
|
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
|
//SEG5 @1
|
|
//SEG6 [2] call main
|
|
//SEG7 [4] phi from @1 to main [phi:@1->main]
|
|
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
|
|
//SEG9 @end
|
|
//SEG10 main
|
|
main: {
|
|
//SEG11 [5] call bool_const_if
|
|
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
|
|
jsr bool_const_if
|
|
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
|
|
//SEG14 main::@1
|
|
//SEG15 [7] call bool_const_vars
|
|
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
|
|
jsr bool_const_vars
|
|
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
|
|
//SEG18 main::@2
|
|
//SEG19 [9] call bool_const_inline
|
|
//SEG20 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
|
|
jsr bool_const_inline
|
|
//SEG21 main::@return
|
|
//SEG22 [10] return
|
|
rts
|
|
}
|
|
//SEG23 bool_const_inline
|
|
// A constant boolean inside an if()
|
|
bool_const_inline: {
|
|
//SEG24 bool_const_inline::@1
|
|
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN+2
|
|
//SEG26 bool_const_inline::@return
|
|
//SEG27 [13] return
|
|
rts
|
|
}
|
|
//SEG28 bool_const_vars
|
|
// A bunch of constant boolean vars (used in an if)
|
|
bool_const_vars: {
|
|
//SEG29 bool_const_vars::@1
|
|
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
|
|
lda #'f'
|
|
sta SCREEN+1
|
|
//SEG31 bool_const_vars::@return
|
|
//SEG32 [16] return
|
|
rts
|
|
}
|
|
//SEG33 bool_const_if
|
|
// A constant boolean inside an if()
|
|
bool_const_if: {
|
|
//SEG34 bool_const_if::@1
|
|
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
|
|
lda #'t'
|
|
sta SCREEN
|
|
//SEG36 bool_const_if::@return
|
|
//SEG37 [19] return
|
|
rts
|
|
}
|
|
|