1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-09 18:29:36 +00:00
kickc/src/test/ref/function-pointer-noarg-call.log
2019-04-20 22:12:56 +02:00

277 lines
6.4 KiB
Plaintext

Resolved forward reference fn1 to (void()) fn1()
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@2
main: scope:[main] from @2
(void()*~) main::$0 ← & (void()) fn1()
(void()*) main::f#0 ← (void()*~) main::$0
call *((void()*) main::f#0)
to:main::@return
main::@return: scope:[main] from main
return
to:@return
fn1: scope:[fn1] from
(byte*) fn1::BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) $d020
*((byte*) fn1::BORDERCOL#0) ← ++ *((byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
return
to:@return
@2: scope:[] from @begin
call main
to:@3
@3: scope:[] from @2
to:@end
@end: scope:[] from @3
SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(void()) fn1()
(label) fn1::@return
(byte*) fn1::BORDERCOL
(byte*) fn1::BORDERCOL#0
(void()) main()
(void()*~) main::$0
(label) main::@return
(void()*) main::f
(void()*) main::f#0
Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Alias (void()*) main::f#0 = (void()*~) main::$0
Successful SSA optimization Pass2AliasElimination
Constant (const void()*) main::f#0 = &fn1
Constant (const byte*) fn1::BORDERCOL#0 = ((byte*))$d020
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Adding NOP phi() at start of @begin
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 fn1:5
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Renumbering block @2 to @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
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 fn1
to:main::@return
main::@return: scope:[main] from main
[6] return
to:@return
fn1: scope:[fn1] from main
[7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[8] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) fn1()
(byte*) fn1::BORDERCOL
(void()) main()
(void()*) main::f
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 File Comments
// Tests creating, assigning and calling pointers to non-args no-return functions
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//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 fn1
jsr fn1
jmp breturn
//SEG12 main::@return
breturn:
//SEG13 [6] return
rts
}
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG16 fn1::@return
breturn:
//SEG17 [8] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope [fn1]
Uplift Scope []
Uplifting [main] best 42 combination
Uplifting [fn1] best 42 combination
Uplifting [] best 42 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Tests creating, assigning and calling pointers to non-args no-return functions
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//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 fn1
jsr fn1
jmp breturn
//SEG12 main::@return
breturn:
//SEG13 [6] return
rts
}
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG16 fn1::@return
breturn:
//SEG17 [8] return
rts
}
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
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 bend:
Removing instruction breturn:
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
(void()) fn1()
(label) fn1::@return
(byte*) fn1::BORDERCOL
(const byte*) fn1::BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) $d020
(void()) main()
(label) main::@return
(void()*) main::f
FINAL ASSEMBLER
Score: 24
//SEG0 File Comments
// Tests creating, assigning and calling pointers to non-args no-return functions
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//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 fn1
jsr fn1
//SEG12 main::@return
//SEG13 [6] return
rts
}
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG16 fn1::@return
//SEG17 [8] return
rts
}