mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-10 10:31:27 +00:00
New type system fixes pointer to pointer casts. Closes #166
This commit is contained in:
parent
7a4d3fff47
commit
9ad3879e52
@ -331,6 +331,11 @@ public class TestPrograms {
|
||||
compileAndCompare("sandbox");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointerCast4() throws IOException, URISyntaxException {
|
||||
compileAndCompare("pointer-cast-4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointerCast3() throws IOException, URISyntaxException {
|
||||
compileAndCompare("pointer-cast-3");
|
||||
|
9
src/test/kc/pointer-cast-4.kc
Normal file
9
src/test/kc/pointer-cast-4.kc
Normal file
@ -0,0 +1,9 @@
|
||||
// Tests casting pointer types to other pointer types does not produce any ASM code
|
||||
|
||||
void main() {
|
||||
byte* bscreen = 0x0400;
|
||||
for(byte i: 0..2) {
|
||||
word* wscreen = (word*)bscreen;
|
||||
wscreen[i] = (word)i;
|
||||
}
|
||||
}
|
26
src/test/ref/pointer-cast-4.asm
Normal file
26
src/test/ref/pointer-cast-4.asm
Normal file
@ -0,0 +1,26 @@
|
||||
// Tests casting pointer types to other pointer types does not produce any ASM code
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
main: {
|
||||
.label bscreen = $400
|
||||
.label wscreen = bscreen
|
||||
.label _1 = 2
|
||||
ldx #0
|
||||
b1:
|
||||
txa
|
||||
sta _1
|
||||
lda #0
|
||||
sta _1+1
|
||||
txa
|
||||
asl
|
||||
tay
|
||||
lda _1
|
||||
sta wscreen,y
|
||||
lda _1+1
|
||||
sta wscreen+1,y
|
||||
inx
|
||||
cpx #3
|
||||
bne b1
|
||||
rts
|
||||
}
|
23
src/test/ref/pointer-cast-4.cfg
Normal file
23
src/test/ref/pointer-cast-4.cfg
Normal file
@ -0,0 +1,23 @@
|
||||
@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()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
|
||||
[6] (word~) main::$1 ← (word)(byte) main::i#2
|
||||
[7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1
|
||||
[8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1
|
||||
[9] (byte) main::i#1 ← ++ (byte) main::i#2
|
||||
[10] if((byte) main::i#1!=(byte) 3) goto main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[11] return
|
||||
to:@return
|
411
src/test/ref/pointer-cast-4.log
Normal file
411
src/test/ref/pointer-cast-4.log
Normal file
@ -0,0 +1,411 @@
|
||||
Fixing pointer array-indexing *((word*) main::wscreen + (byte) main::i)
|
||||
Adding pointer type conversion cast (byte*) main::bscreen in (byte*) main::bscreen ← (number) $400
|
||||
Identified constant variable (byte*) main::bscreen
|
||||
Culled Empty Block (label) main::@2
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) main::bscreen#0 ← ((byte*)) (number) $400
|
||||
(byte) main::i#0 ← (byte) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
(word*~) main::$0 ← ((word*)) (byte*) main::bscreen#0
|
||||
(word*) main::wscreen#0 ← (word*~) main::$0
|
||||
(word~) main::$1 ← ((word)) (byte) main::i#2
|
||||
(byte~) main::$3 ← (byte) main::i#2 * (const byte) SIZEOF_WORD
|
||||
*((word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1
|
||||
(byte) main::i#1 ← (byte) main::i#2 + rangenext(0,2)
|
||||
(bool~) main::$2 ← (byte) main::i#1 != rangelast(0,2)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
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
|
||||
(const byte) SIZEOF_WORD = (byte) 2
|
||||
(void()) main()
|
||||
(word*~) main::$0
|
||||
(word~) main::$1
|
||||
(bool~) main::$2
|
||||
(byte~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@return
|
||||
(byte*) main::bscreen
|
||||
(byte*) main::bscreen#0
|
||||
(byte) main::i
|
||||
(byte) main::i#0
|
||||
(byte) main::i#1
|
||||
(byte) main::i#2
|
||||
(word*) main::wscreen
|
||||
(word*) main::wscreen#0
|
||||
|
||||
Inlining cast (byte*) main::bscreen#0 ← (byte*)(number) $400
|
||||
Inlining cast (word*~) main::$0 ← (word*)(byte*) main::bscreen#0
|
||||
Inlining cast (word~) main::$1 ← (word)(byte) main::i#2
|
||||
Successful SSA optimization Pass2InlineCast
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Alias (word*) main::wscreen#0 = (word*~) main::$0
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Simple Condition (bool~) main::$2 [10] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
|
||||
Successful SSA optimization Pass2ConditionalJumpSimplification
|
||||
Constant (const byte*) main::bscreen#0 = (byte*) 1024
|
||||
Constant (const byte) main::i#0 = 0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant value identified (word*)main::bscreen#0 in [3] (word*) main::wscreen#0 ← (word*)(const byte*) main::bscreen#0
|
||||
Successful SSA optimization Pass2ConstantValues
|
||||
Resolved ranged next value [8] main::i#1 ← ++ main::i#2 to ++
|
||||
Resolved ranged comparison value [10] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
|
||||
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
|
||||
Successful SSA optimization PassNAddNumberTypeConversions
|
||||
Simplifying constant integer cast 3
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Finalized unsigned number type (byte) 3
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
Constant (const word*) main::wscreen#0 = (word*)main::bscreen#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Rewriting multiplication to use shift [2] (byte~) main::$3 ← (byte) main::i#2 * (const byte) SIZEOF_WORD
|
||||
Successful SSA optimization Pass2MultiplyToShiftRewriting
|
||||
Inlining constant with var siblings (const byte) main::i#0
|
||||
Constant inlined main::i#0 = (byte) 0
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
Eliminating unused constant (const byte) SIZEOF_WORD
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Added new block during phi lifting main::@3(between main::@1 and main::@1)
|
||||
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
|
||||
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [13] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
Culled Empty Block (label) @2
|
||||
Culled Empty Block (label) main::@3
|
||||
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()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
|
||||
[6] (word~) main::$1 ← (word)(byte) main::i#2
|
||||
[7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1
|
||||
[8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1
|
||||
[9] (byte) main::i#1 ← ++ (byte) main::i#2
|
||||
[10] if((byte) main::i#1!=(byte) 3) goto main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[11] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(void()) main()
|
||||
(word~) main::$1 11.0
|
||||
(byte~) main::$3 22.0
|
||||
(byte*) main::bscreen
|
||||
(byte) main::i
|
||||
(byte) main::i#1 16.5
|
||||
(byte) main::i#2 8.25
|
||||
(word*) main::wscreen
|
||||
|
||||
Initial phi equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
Added variable main::$1 to zero page equivalence class [ main::$1 ]
|
||||
Added variable main::$3 to zero page equivalence class [ main::$3 ]
|
||||
Complete equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
[ main::$1 ]
|
||||
[ main::$3 ]
|
||||
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
|
||||
Allocated zp ZP_WORD:3 [ main::$1 ]
|
||||
Allocated zp ZP_BYTE:5 [ main::$3 ]
|
||||
|
||||
INITIAL ASM
|
||||
//SEG0 File Comments
|
||||
// Tests casting pointer types to other pointer types does not produce any ASM code
|
||||
//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: {
|
||||
.label bscreen = $400
|
||||
.label wscreen = bscreen
|
||||
.label _1 = 3
|
||||
.label _3 = 5
|
||||
.label i = 2
|
||||
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
b1_from_main:
|
||||
//SEG12 [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
|
||||
lda #0
|
||||
sta i
|
||||
jmp b1
|
||||
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
||||
b1_from_b1:
|
||||
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
|
||||
jmp b1
|
||||
//SEG15 main::@1
|
||||
b1:
|
||||
//SEG16 [6] (word~) main::$1 ← (word)(byte) main::i#2 -- vwuz1=_word_vbuz2
|
||||
lda i
|
||||
sta _1
|
||||
lda #0
|
||||
sta _1+1
|
||||
//SEG17 [7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
|
||||
lda i
|
||||
asl
|
||||
sta _3
|
||||
//SEG18 [8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1 -- pwuc1_derefidx_vbuz1=vwuz2
|
||||
ldy _3
|
||||
lda _1
|
||||
sta wscreen,y
|
||||
lda _1+1
|
||||
sta wscreen+1,y
|
||||
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
|
||||
inc i
|
||||
//SEG20 [10] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #3
|
||||
cmp i
|
||||
bne b1_from_b1
|
||||
jmp breturn
|
||||
//SEG21 main::@return
|
||||
breturn:
|
||||
//SEG22 [11] return
|
||||
rts
|
||||
}
|
||||
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [6] (word~) main::$1 ← (word)(byte) main::i#2 [ main::i#2 main::$1 ] ( main:2 [ main::i#2 main::$1 ] ) always clobbers reg byte a
|
||||
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
|
||||
Statement [7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$1 main::$3 ] ( main:2 [ main::i#2 main::$1 main::$3 ] ) always clobbers reg byte a
|
||||
Statement [8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
|
||||
Statement [6] (word~) main::$1 ← (word)(byte) main::i#2 [ main::i#2 main::$1 ] ( main:2 [ main::i#2 main::$1 ] ) always clobbers reg byte a
|
||||
Statement [7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$1 main::$3 ] ( main:2 [ main::i#2 main::$1 main::$3 ] ) always clobbers reg byte a
|
||||
Statement [8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
|
||||
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
|
||||
Potential registers zp ZP_WORD:3 [ main::$1 ] : zp ZP_WORD:3 ,
|
||||
Potential registers zp ZP_BYTE:5 [ main::$3 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 24.75: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:5 [ main::$3 ] 11: zp ZP_WORD:3 [ main::$1 ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 513 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$3 ] zp ZP_WORD:3 [ main::$1 ]
|
||||
Uplifting [] best 513 combination
|
||||
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::$1 ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
//SEG0 File Comments
|
||||
// Tests casting pointer types to other pointer types does not produce any ASM code
|
||||
//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: {
|
||||
.label bscreen = $400
|
||||
.label wscreen = bscreen
|
||||
.label _1 = 2
|
||||
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
b1_from_main:
|
||||
//SEG12 [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
|
||||
ldx #0
|
||||
jmp b1
|
||||
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
||||
b1_from_b1:
|
||||
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
|
||||
jmp b1
|
||||
//SEG15 main::@1
|
||||
b1:
|
||||
//SEG16 [6] (word~) main::$1 ← (word)(byte) main::i#2 -- vwuz1=_word_vbuxx
|
||||
txa
|
||||
sta _1
|
||||
lda #0
|
||||
sta _1+1
|
||||
//SEG17 [7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
|
||||
txa
|
||||
asl
|
||||
//SEG18 [8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1 -- pwuc1_derefidx_vbuaa=vwuz1
|
||||
tay
|
||||
lda _1
|
||||
sta wscreen,y
|
||||
lda _1+1
|
||||
sta wscreen+1,y
|
||||
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
//SEG20 [10] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #3
|
||||
bne b1_from_b1
|
||||
jmp breturn
|
||||
//SEG21 main::@return
|
||||
breturn:
|
||||
//SEG22 [11] return
|
||||
rts
|
||||
}
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Replacing label b1_from_b1 with b1
|
||||
Removing instruction b1_from_bbegin:
|
||||
Removing instruction b1:
|
||||
Removing instruction main_from_b1:
|
||||
Removing instruction bend_from_b1:
|
||||
Removing instruction b1_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction bend:
|
||||
Removing instruction b1_from_main:
|
||||
Removing instruction breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Updating BasicUpstart to call main directly
|
||||
Removing instruction jsr main
|
||||
Succesful ASM optimization Pass5SkipBegin
|
||||
Removing instruction jmp b1
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction bbegin:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(word~) main::$1 $1 zp ZP_WORD:2 11.0
|
||||
(byte~) main::$3 reg byte a 22.0
|
||||
(label) main::@1
|
||||
(label) main::@return
|
||||
(byte*) main::bscreen
|
||||
(const byte*) main::bscreen#0 bscreen = (byte*) 1024
|
||||
(byte) main::i
|
||||
(byte) main::i#1 reg byte x 16.5
|
||||
(byte) main::i#2 reg byte x 8.25
|
||||
(word*) main::wscreen
|
||||
(const word*) main::wscreen#0 wscreen = (word*)(const byte*) main::bscreen#0
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp ZP_WORD:2 [ main::$1 ]
|
||||
reg byte a [ main::$3 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 411
|
||||
|
||||
//SEG0 File Comments
|
||||
// Tests casting pointer types to other pointer types does not produce any ASM code
|
||||
//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: {
|
||||
.label bscreen = $400
|
||||
.label wscreen = bscreen
|
||||
.label _1 = 2
|
||||
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
//SEG12 [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
|
||||
ldx #0
|
||||
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
||||
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
|
||||
//SEG15 main::@1
|
||||
b1:
|
||||
//SEG16 [6] (word~) main::$1 ← (word)(byte) main::i#2 -- vwuz1=_word_vbuxx
|
||||
txa
|
||||
sta _1
|
||||
lda #0
|
||||
sta _1+1
|
||||
//SEG17 [7] (byte~) main::$3 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
|
||||
txa
|
||||
asl
|
||||
//SEG18 [8] *((const word*) main::wscreen#0 + (byte~) main::$3) ← (word~) main::$1 -- pwuc1_derefidx_vbuaa=vwuz1
|
||||
tay
|
||||
lda _1
|
||||
sta wscreen,y
|
||||
lda _1+1
|
||||
sta wscreen+1,y
|
||||
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
//SEG20 [10] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #3
|
||||
bne b1
|
||||
//SEG21 main::@return
|
||||
//SEG22 [11] return
|
||||
rts
|
||||
}
|
||||
|
1
src/test/ref/pointer-cast-4.sym
Normal file
1
src/test/ref/pointer-cast-4.sym
Normal file
@ -0,0 +1 @@
|
||||
program
|
Loading…
x
Reference in New Issue
Block a user