1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-27 04:49:27 +00:00

Updated test data.

This commit is contained in:
jespergravgaard 2020-11-22 22:30:24 +01:00
parent 2479fc08db
commit 3be0b5d2d4
18 changed files with 300 additions and 30 deletions

View File

@ -22,8 +22,8 @@ Eliminating unused variable with no statement print::$5
Eliminating unused variable with no statement print::$8
Eliminating unused variable with no statement print::$9
Converting PHI-variable modified inside __stackcall procedure queen() to load/store count
Calling convention STACK_CALL adding prepare/execute/finalize for call queen 1
Calling convention STACK_CALL adding prepare/execute/finalize for call queen queen::$4
Calling convention __stackcall adding prepare/execute/finalize for call queen 1
Calling convention __stackcall adding prepare/execute/finalize for call queen queen::$4
Calling convention STACK_CALL replacing param(queen::row) with stackidx(byte,queen::OFFSET_STACK_ROW)
Calling convention STACK_CALL adding stack push stackpush(byte) = 1
Calling convention STACK_CALL adding stack push stackpush(byte) = queen::$4

View File

@ -1,4 +1,4 @@
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention STACK_CALL replacing param(plus::a) with stackidx(byte,plus::OFFSET_STACK_A)
Calling convention STACK_CALL replacing param(plus::b) with stackidx(byte,plus::OFFSET_STACK_B)
Calling convention STACK_CALL adding stack return stackidx(byte,plus::OFFSET_STACK_RETURN) = plus::return

View File

@ -1,4 +1,4 @@
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention STACK_CALL replacing param(plus::a) with stackidx(byte,plus::OFFSET_STACK_A)
Calling convention STACK_CALL replacing param(plus::b) with stackidx(byte,plus::OFFSET_STACK_B)
Calling convention STACK_CALL adding stack return stackidx(byte,plus::OFFSET_STACK_RETURN) = plus::return

View File

@ -1,9 +1,9 @@
Inlined call call __init
Eliminating unused variable with no statement main::$1
Converting PHI-variable modified inside __stackcall procedure main() to load/store idx
Calling convention STACK_CALL adding prepare/execute/finalize for { main::$1_x, main::$1_y } = call get main::i
Calling convention STACK_CALL adding prepare/execute/finalize for call print main::p_x main::p_y
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for { main::$1_x, main::$1_y } = call get main::i
Calling convention __stackcall adding prepare/execute/finalize for call print main::p_x main::p_y
Calling convention __stackcall adding prepare/execute/finalize for call main
Calling convention STACK_CALL replacing param(get::i) with stackidx(byte,get::OFFSET_STACK_I)
Calling convention STACK_CALL replacing param(print::p_x) with stackidx(byte,print::OFFSET_STACK_P_X)
Calling convention STACK_CALL replacing param(print::p_y) with stackidx(byte,print::OFFSET_STACK_P_Y)

View File

@ -3,9 +3,9 @@ Eliminating unused variable with no statement main::$1
Eliminating unused variable with no statement main::$1_p1
Eliminating unused variable with no statement main::$1_p2
Converting PHI-variable modified inside __stackcall procedure main() to load/store idx
Calling convention STACK_CALL adding prepare/execute/finalize for { { main::$1_p1_x, main::$1_p1_y }, { main::$1_p2_x, main::$1_p2_y } } = call get main::i
Calling convention STACK_CALL adding prepare/execute/finalize for call print main::v_p1_x main::v_p1_y main::v_p2_x main::v_p2_y
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for { { main::$1_p1_x, main::$1_p1_y }, { main::$1_p2_x, main::$1_p2_y } } = call get main::i
Calling convention __stackcall adding prepare/execute/finalize for call print main::v_p1_x main::v_p1_y main::v_p2_x main::v_p2_y
Calling convention __stackcall adding prepare/execute/finalize for call main
Calling convention STACK_CALL replacing param(get::i) with stackidx(byte,get::OFFSET_STACK_I)
Calling convention STACK_CALL replacing param(print::v_p1_x) with stackidx(byte,print::OFFSET_STACK_V_P1_X)
Calling convention STACK_CALL replacing param(print::v_p1_y) with stackidx(byte,print::OFFSET_STACK_V_P1_Y)

View File

@ -1,8 +1,8 @@
Inlined call call __init
Converting PHI-variable modified inside __stackcall procedure main() to load/store idx
Calling convention STACK_CALL adding prepare/execute/finalize for call print main::str 1
Calling convention STACK_CALL adding prepare/execute/finalize for call print main::str1 2
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for call print main::str 1
Calling convention __stackcall adding prepare/execute/finalize for call print main::str1 2
Calling convention __stackcall adding prepare/execute/finalize for call main
Calling convention STACK_CALL replacing param(print::str) with stackidx(byte*,print::OFFSET_STACK_STR)
Calling convention STACK_CALL replacing param(print::spacing) with stackidx(byte,print::OFFSET_STACK_SPACING)
Calling convention STACK_CALL adding stack push stackpush(byte*) = main::str

View File

@ -1,5 +1,5 @@
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call pow2 6
Calling convention STACK_CALL adding prepare/execute/finalize for pow2::$2 = call pow2 pow2::$1
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call pow2 6
Calling convention __stackcall adding prepare/execute/finalize for pow2::$2 = call pow2 pow2::$1
Calling convention STACK_CALL replacing param(pow2::n) with stackidx(byte,pow2::OFFSET_STACK_N)
Calling convention STACK_CALL adding stack return stackidx(byte,pow2::OFFSET_STACK_RETURN) = pow2::return
Calling convention STACK_CALL adding stack pull main::$0 = stackpull(byte)

View File

@ -1,4 +1,4 @@
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call plus $1234 $2345
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call plus $1234 $2345
Calling convention STACK_CALL replacing param(plus::a) with stackidx(word,plus::OFFSET_STACK_A)
Calling convention STACK_CALL replacing param(plus::b) with stackidx(word,plus::OFFSET_STACK_B)
Calling convention STACK_CALL adding stack return stackidx(word,plus::OFFSET_STACK_RETURN) = plus::return

View File

@ -1,4 +1,4 @@
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call plus '0' 7
Calling convention STACK_CALL replacing param(plus::a) with stackidx(word,plus::OFFSET_STACK_A)
Calling convention STACK_CALL replacing param(plus::b) with stackidx(word,plus::OFFSET_STACK_B)
Calling convention STACK_CALL adding stack return stackidx(word,plus::OFFSET_STACK_RETURN) = plus::return

View File

@ -1,6 +1,6 @@
Inlined call call __init
Converting PHI-variable modified inside __stackcall procedure plus() to load/store i
Calling convention STACK_CALL adding prepare/execute/finalize for main::$1 = call plus '0' main::v
Calling convention __stackcall adding prepare/execute/finalize for main::$1 = call plus '0' main::v
Calling convention STACK_CALL replacing param(plus::a) with stackidx(byte,plus::OFFSET_STACK_A)
Calling convention STACK_CALL replacing param(plus::b) with stackidx(byte,plus::OFFSET_STACK_B)
Calling convention STACK_CALL adding stack return stackidx(byte,plus::OFFSET_STACK_RETURN) = plus::return

View File

@ -1,7 +1,7 @@
Inlined call call __init
Converting PHI-variable modified inside __stackcall procedure next() to load/store current
Calling convention STACK_CALL adding prepare/execute/finalize for main::$0 = call next
Calling convention STACK_CALL adding prepare/execute/finalize for main::$1 = call next
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call next
Calling convention __stackcall adding prepare/execute/finalize for main::$1 = call next
Calling convention STACK_CALL adding stack return stackidx(signed word,next::OFFSET_STACK_RETURN) = next::return
Calling convention STACK_CALL adding stack pull main::$0 = stackpull(signed word)
Calling convention STACK_CALL adding stack pull main::$1 = stackpull(signed word)

View File

@ -1,5 +1,5 @@
Calling convention STACK_CALL adding prepare/execute/finalize for call printline
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for call printline
Calling convention __stackcall adding prepare/execute/finalize for call main
CONTROL FLOW GRAPH SSA

View File

@ -1,7 +1,7 @@
Inlined call call __init
Converting PHI-variable modified inside __stackcall procedure main() to load/store val
Calling convention STACK_CALL adding prepare/execute/finalize for call printline
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for call printline
Calling convention __stackcall adding prepare/execute/finalize for call main
CONTROL FLOW GRAPH SSA

View File

@ -1,11 +1,11 @@
Inlined call call __init
Converting PHI-variable modified inside __stackcall procedure main() to load/store val
Calling convention STACK_CALL adding prepare/execute/finalize for call pval
Calling convention STACK_CALL adding prepare/execute/finalize for call printother
Calling convention STACK_CALL adding prepare/execute/finalize for call ival
Calling convention STACK_CALL adding prepare/execute/finalize for call printval
Calling convention STACK_CALL adding prepare/execute/finalize for call incval
Calling convention STACK_CALL adding prepare/execute/finalize for call main
Calling convention __stackcall adding prepare/execute/finalize for call pval
Calling convention __stackcall adding prepare/execute/finalize for call printother
Calling convention __stackcall adding prepare/execute/finalize for call ival
Calling convention __stackcall adding prepare/execute/finalize for call printval
Calling convention __stackcall adding prepare/execute/finalize for call incval
Calling convention __stackcall adding prepare/execute/finalize for call main
CONTROL FLOW GRAPH SSA

View File

@ -0,0 +1,26 @@
// Test __varcall calling convention
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label BGCOL = $d021
// setbg(byte zp(2) col)
setbg: {
.label col = 2
// *BGCOL = col
lda.z col
sta BGCOL
// }
rts
}
main: {
// setbg(0)
lda #0
sta.z setbg.col
jsr setbg
// setbg(0x0b)
lda #$b
sta.z setbg.col
jsr setbg
// }
rts
}

View File

@ -0,0 +1,19 @@
__varcall void setbg(byte setbg::col)
setbg: scope:[setbg] from
[0] *BGCOL = setbg::col
to:setbg::@return
setbg::@return: scope:[setbg] from setbg
[1] return
to:@return
void main()
main: scope:[main] from
[2] setbg::col = 0
[3] callexecute setbg
[4] setbg::col = $b
[5] callexecute setbg
to:main::@return
main::@return: scope:[main] from main
[6] return
to:@return

219
src/test/ref/varcall-1.log Normal file
View File

@ -0,0 +1,219 @@
Calling convention __varcall adding prepare/execute/finalize for call setbg 0
Calling convention __varcall adding prepare/execute/finalize for call setbg $b
Converting parameter in __varcall procedure to load/store setbg::col
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
setbg::col = 0
callexecute setbg
setbg::col = $b
callexecute setbg
to:main::@return
main::@return: scope:[main] from main
return
to:@return
__varcall void setbg(byte setbg::col)
setbg: scope:[setbg] from
*BGCOL = setbg::col
to:setbg::@return
setbg::@return: scope:[setbg] from setbg
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
const nomodify byte* BGCOL = (byte*)$d021
void __start()
void main()
__varcall void setbg(byte setbg::col)
byte setbg::col loadstore
Adding number conversion cast (unumber) 0 in setbg::col = 0
Adding number conversion cast (unumber) $b in setbg::col = $b
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast setbg::col = (unumber)0
Inlining cast setbg::col = (unumber)$b
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53281
Simplifying constant integer cast 0
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type 0
Finalized unsigned number type $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
CALL GRAPH
Calls in [main] to setbg:3 setbg:5
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
FINAL CONTROL FLOW GRAPH
__varcall void setbg(byte setbg::col)
setbg: scope:[setbg] from
[0] *BGCOL = setbg::col
to:setbg::@return
setbg::@return: scope:[setbg] from setbg
[1] return
to:@return
void main()
main: scope:[main] from
[2] setbg::col = 0
[3] callexecute setbg
[4] setbg::col = $b
[5] callexecute setbg
to:main::@return
main::@return: scope:[main] from main
[6] return
to:@return
VARIABLE REGISTER WEIGHTS
void main()
__varcall void setbg(byte setbg::col)
byte setbg::col loadstore 7.5
Initial phi equivalence classes
Added variable setbg::col to live range equivalence class [ setbg::col ]
Complete equivalence classes
[ setbg::col ]
Allocated zp[1]:2 [ setbg::col ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *BGCOL = setbg::col [ ] ( setbg:3 [ ] { } setbg:5 [ ] { } ) always clobbers reg byte a
Statement [2] setbg::col = 0 [ setbg::col ] ( [ setbg::col ] { } ) always clobbers reg byte a
Statement [4] setbg::col = $b [ setbg::col ] ( [ setbg::col ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ setbg::col ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [setbg] 7.5: zp[1]:2 [ setbg::col ]
Uplift Scope [main]
Uplift Scope []
Uplifting [setbg] best 47 combination zp[1]:2 [ setbg::col ]
Uplifting [main] best 47 combination
Uplifting [] best 47 combination
Attempting to uplift remaining variables inzp[1]:2 [ setbg::col ]
Uplifting [setbg] best 47 combination zp[1]:2 [ setbg::col ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test __varcall calling convention
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label BGCOL = $d021
// setbg
// setbg(byte zp(2) col)
setbg: {
.label col = 2
// [0] *BGCOL = setbg::col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
jmp __breturn
// setbg::@return
__breturn:
// [1] return
rts
}
// main
main: {
// [2] setbg::col = 0 -- vbuz1=vbuc1
lda #0
sta.z setbg.col
// [3] callexecute setbg -- jsr
jsr setbg
// [4] setbg::col = $b -- vbuz1=vbuc1
lda #$b
sta.z setbg.col
// [5] callexecute setbg -- jsr
jsr setbg
jmp __breturn
// main::@return
__breturn:
// [6] return
rts
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* BGCOL = (byte*) 53281
void main()
__varcall void setbg(byte setbg::col)
byte setbg::col loadstore zp[1]:2 7.5
zp[1]:2 [ setbg::col ]
FINAL ASSEMBLER
Score: 41
// File Comments
// Test __varcall calling convention
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label BGCOL = $d021
// setbg
// setbg(byte zp(2) col)
setbg: {
.label col = 2
// *BGCOL = col
// [0] *BGCOL = setbg::col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// setbg::@return
// }
// [1] return
rts
}
// main
main: {
// setbg(0)
// [2] setbg::col = 0 -- vbuz1=vbuc1
lda #0
sta.z setbg.col
// [3] callexecute setbg -- jsr
jsr setbg
// setbg(0x0b)
// [4] setbg::col = $b -- vbuz1=vbuc1
lda #$b
sta.z setbg.col
// [5] callexecute setbg -- jsr
jsr setbg
// main::@return
// }
// [6] return
rts
}
// File Data

View File

@ -0,0 +1,6 @@
const nomodify byte* BGCOL = (byte*) 53281
void main()
__varcall void setbg(byte setbg::col)
byte setbg::col loadstore zp[1]:2 7.5
zp[1]:2 [ setbg::col ]