1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-29 09:29:31 +00:00

Fixed problem with erronously coalescing structs of same size/type affected by address-of. Closes #632

This commit is contained in:
jespergravgaard 2021-03-06 08:26:41 +01:00
parent 56fe16e753
commit f40050c558
49 changed files with 17622 additions and 4066 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE fda5310c5 fda532f51
//KICKC FRAGMENT CACHE fdb40b9db fdb40d86d
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ public class Compiler {
this.upliftCombinations = upliftCombinations;
}
void enableZeroPageCoalesce() {
public void enableZeroPageCoalesce() {
this.enableZeroPageCoalasce = true;
}

View File

@ -60,6 +60,7 @@ public class Pass1AddressOfHandling extends Pass2SsaOptimization {
private void updateAddressOfVariable(Variable variable, String stmtStr) {
if(variable.getType() instanceof SymbolTypeStruct) {
variable.setKind(Variable.Kind.LOAD_STORE);
variable.setVolatile(true);
getLog().append("Setting struct to load/store in variable affected by address-of " + stmtStr);
//getLog().append("Setting struct to load/store in variable affected by address-of: " + variable.toString() + " in " + stmtStr);
} else {

View File

@ -2073,6 +2073,11 @@ public class TestPrograms {
}
*/
@Test
public void testStructPtr35() throws IOException, URISyntaxException {
compileAndCompare("struct-ptr-35.c");
}
@Test
public void testStructPtr34() throws IOException, URISyntaxException {
compileAndCompare("struct-ptr-34.c");
@ -5011,6 +5016,7 @@ public class TestPrograms {
private void testFile(String fileName, Integer upliftCombinations, CompileLog compileLog) throws IOException {
System.out.println("Testing output for " + fileName);
Compiler compiler = new Compiler();
//compiler.enableZeroPageCoalesce();
compiler.setWarnFragmentMissing(true);
compiler.setAsmFragmentBaseFolder(new File("src/main/fragment/").toPath());
if(compileLog != null) {

View File

@ -32,7 +32,7 @@ SYMBOL TABLE SSA
const byte OFFSET_STRUCT_FOO_THING1 = 0
const byte OFFSET_STRUCT_FOO_THING2 = 1
void __start()
struct foo bar loadstore = { thing1: 'a', thing2: 'b' }
volatile struct foo bar loadstore = { thing1: 'a', thing2: 'b' }
void main()
byte*~ main::$0
byte*~ main::$1
@ -105,7 +105,7 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
struct foo bar loadstore = { thing1: 'a', thing2: 'b' }
volatile struct foo bar loadstore = { thing1: 'a', thing2: 'b' }
void main()
byte main::i
@ -172,7 +172,7 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const byte OFFSET_STRUCT_FOO_THING2 = 1
struct foo bar loadstore mem[2] = { thing1: 'a', thing2: 'b' }
volatile struct foo bar loadstore mem[2] = { thing1: 'a', thing2: 'b' }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct foo* main::barp = &bar

View File

@ -1,5 +1,5 @@
const byte OFFSET_STRUCT_FOO_THING2 = 1
struct foo bar loadstore mem[2] = { thing1: 'a', thing2: 'b' }
volatile struct foo bar loadstore mem[2] = { thing1: 'a', thing2: 'b' }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct foo* main::barp = &bar

View File

@ -49,7 +49,7 @@ const byte OFFSET_STRUCT_FOO_THING1 = 0
const byte OFFSET_STRUCT_FOO_THING2 = 1
const byte OFFSET_STRUCT_FOO_THING3 = 2
void __start()
struct foo bar loadstore = { thing1: 'a', thing2: 'b', thing3: "qwe" }
volatile struct foo bar loadstore = { thing1: 'a', thing2: 'b', thing3: "qwe" }
void main()
bool~ main::$0
byte*~ main::$1
@ -173,7 +173,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
struct foo bar loadstore = { thing1: 'a', thing2: 'b', thing3: "qwe" }
volatile struct foo bar loadstore = { thing1: 'a', thing2: 'b', thing3: "qwe" }
void main()
byte main::i
byte main::i#3 7.333333333333333
@ -295,7 +295,7 @@ Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
const byte OFFSET_STRUCT_FOO_THING2 = 1
const byte OFFSET_STRUCT_FOO_THING3 = 2
struct foo bar loadstore mem[14] = { thing1: 'a', thing2: 'b', thing3: "qwe" }
volatile struct foo bar loadstore mem[14] = { thing1: 'a', thing2: 'b', thing3: "qwe" }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct foo* main::barp = &bar

View File

@ -1,6 +1,6 @@
const byte OFFSET_STRUCT_FOO_THING2 = 1
const byte OFFSET_STRUCT_FOO_THING3 = 2
struct foo bar loadstore mem[14] = { thing1: 'a', thing2: 'b', thing3: "qwe" }
volatile struct foo bar loadstore mem[14] = { thing1: 'a', thing2: 'b', thing3: "qwe" }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct foo* main::barp = &bar

View File

@ -2107,7 +2107,7 @@ byte load_to_bank::return#3
void main()
byte~ main::$7
const nomodify dword main::BANK_SPRITE = $12000
struct VERA_SPRITE main::SPRITE_ATTR loadstore
volatile struct VERA_SPRITE main::SPRITE_ATTR loadstore
const nomodify dword main::VRAM_SPRITE = $10000
const byte* main::filename[7] = "SPRITE"
const byte* main::s[$2d] = "
@ -5179,7 +5179,7 @@ byte load_to_bank::device
byte* load_to_bank::filename
byte load_to_bank::return
void main()
struct VERA_SPRITE main::SPRITE_ATTR loadstore
volatile struct VERA_SPRITE main::SPRITE_ATTR loadstore
void memcpy_bank_to_vram(dword memcpy_bank_to_vram::vdest , dword memcpy_bank_to_vram::src , dword memcpy_bank_to_vram::num)
word~ memcpy_bank_to_vram::$0 202.0
byte~ memcpy_bank_to_vram::$1 202.0
@ -9668,7 +9668,7 @@ byte* load_to_bank::filename
byte load_to_bank::return
void main()
const nomodify dword main::BANK_SPRITE = $12000
struct VERA_SPRITE main::SPRITE_ATTR loadstore zp[8]:67
volatile struct VERA_SPRITE main::SPRITE_ATTR loadstore zp[8]:67
const nomodify dword main::VRAM_SPRITE = $10000
const byte* main::filename[7] = "SPRITE"
const byte* main::s[$2d] = "

View File

@ -217,7 +217,7 @@ byte* load_to_bank::filename
byte load_to_bank::return
void main()
const nomodify dword main::BANK_SPRITE = $12000
struct VERA_SPRITE main::SPRITE_ATTR loadstore zp[8]:67
volatile struct VERA_SPRITE main::SPRITE_ATTR loadstore zp[8]:67
const nomodify dword main::VRAM_SPRITE = $10000
const byte* main::filename[7] = "SPRITE"
const byte* main::s[$2d] = "

View File

@ -1,6 +1,5 @@
Resolved forward reference irq_vsync to __interrupt(rom_sys_cx16) void irq_vsync()
Setting struct to load/store in variable affected by address-of main::$6 = call memcpy_to_vram (byte)>VERA_SPRITE_ATTR main::vram_sprite_attr &SPRITE_ATTR main::$5
Setting struct to load/store in variable affected by address-of irq_vsync::$5 = call memcpy_to_vram irq_vsync::vram_sprite_attr_bank irq_vsync::vram_sprite_pos &SPRITE_ATTR+2 4
Setting inferred volatile on symbol affected by address-of: setnam::filename_len in asm { ldafilename_len ldxfilename ldyfilename+1 jsr$ffbd }
Setting inferred volatile on symbol affected by address-of: setnam::filename in asm { ldafilename_len ldxfilename ldyfilename+1 jsr$ffbd }
Setting inferred volatile on symbol affected by address-of: setlfs::device in asm { ldxdevice lda#1 ldy#0 jsr$ffba }
@ -239,7 +238,7 @@ const word* SINY[SINY_LEN] = kickasm {{ .fillword 256, 208+208*sin(i*2*PI/SINY_
const nomodify byte SINY_LEN = $fb
const byte SIZEOF_STRUCT_VERA_SPRITE = 8
const byte SIZEOF_WORD = 2
struct VERA_SPRITE SPRITE_ATTR loadstore = { ADDR: (word)<SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: (word)$140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
volatile struct VERA_SPRITE SPRITE_ATTR loadstore = { ADDR: (word)<SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: (word)$140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
const byte* SPRITE_PIXELS[$40*$40+$200] = kickasm {{ .var pic = LoadPicture("tut.png")
// palette: rgb->idx
.var palette = Hashtable()
@ -796,7 +795,7 @@ memcpy_to_vram::@2: scope:[memcpy_to_vram] from memcpy_to_vram::@1
VARIABLE REGISTER WEIGHTS
struct VERA_SPRITE SPRITE_ATTR loadstore = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
volatile struct VERA_SPRITE SPRITE_ATTR loadstore = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
void __start()
__interrupt(rom_sys_cx16) void irq_vsync()
word~ irq_vsync::$11 22.0
@ -1806,7 +1805,7 @@ const word* SINY[SINY_LEN] = kickasm {{ .fillword 256, 208+208*sin(i*2*PI/SINY_
}}
const nomodify byte SINY_LEN = $fb
const byte SIZEOF_STRUCT_VERA_SPRITE = 8
struct VERA_SPRITE SPRITE_ATTR loadstore mem[8] = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
volatile struct VERA_SPRITE SPRITE_ATTR loadstore mem[8] = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
const byte* SPRITE_PIXELS[$40*$40+$200] = kickasm {{ .var pic = LoadPicture("tut.png")
// palette: rgb->idx
.var palette = Hashtable()

View File

@ -8,7 +8,7 @@ const word* SINY[SINY_LEN] = kickasm {{ .fillword 256, 208+208*sin(i*2*PI/SINY_
}}
const nomodify byte SINY_LEN = $fb
const byte SIZEOF_STRUCT_VERA_SPRITE = 8
struct VERA_SPRITE SPRITE_ATTR loadstore mem[8] = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
volatile struct VERA_SPRITE SPRITE_ATTR loadstore mem[8] = { ADDR: <SPRITE_PIXELS_VRAM/$20|VERA_SPRITE_8BPP, X: $140-$20, Y: (word)$f0-$20, CTRL1: $c, CTRL2: $f0 }
const byte* SPRITE_PIXELS[$40*$40+$200] = kickasm {{ .var pic = LoadPicture("tut.png")
// palette: rgb->idx
.var palette = Hashtable()

View File

@ -39,11 +39,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -320,7 +317,7 @@ void* memcpy_dma4::src#1
byte memcpy_dma4::src_bank
byte memcpy_dma4::src_bank#0
byte memcpy_dma4::src_bank#1
struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0
byte~ memoryRemap::$1
@ -849,7 +846,7 @@ byte memcpy_dma4::dmaMode#0 2.0
word memcpy_dma4::num
void* memcpy_dma4::src
byte memcpy_dma4::src_bank
struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0 202.0
byte~ memoryRemap::$1 67.33333333333333
@ -1729,7 +1726,7 @@ void* memcpy_dma4::src
const void* memcpy_dma4::src#0 src = (void*)upperCodeData
byte memcpy_dma4::src_bank
const byte memcpy_dma4::src_bank#0 src_bank = 0
struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0 reg byte a 202.0
byte~ memoryRemap::$1 zp[1]:7 67.33333333333333

View File

@ -58,7 +58,7 @@ void* memcpy_dma4::src
const void* memcpy_dma4::src#0 src = (void*)upperCodeData
byte memcpy_dma4::src_bank
const byte memcpy_dma4::src_bank#0 src_bank = 0
struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0 reg byte a 202.0
byte~ memoryRemap::$1 zp[1]:7 67.33333333333333

View File

@ -4,7 +4,6 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&DMA_SCREEN_UP
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&DMA_SCREEN_UP
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -77,7 +76,7 @@ SYMBOL TABLE SSA
const nomodify byte* DEFAULT_SCREEN = (byte*)$800
const nomodify struct F018_DMAGIC* DMA = (struct F018_DMAGIC*)$d700
const nomodify byte DMA_COMMAND_COPY = 0
struct DMA_LIST_F018B DMA_SCREEN_UP loadstore = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B DMA_SCREEN_UP loadstore = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG = 0
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
@ -294,7 +293,7 @@ memoryRemap::@return: scope:[memoryRemap] from memoryRemap
VARIABLE REGISTER WEIGHTS
struct DMA_LIST_F018B DMA_SCREEN_UP loadstore = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B DMA_SCREEN_UP loadstore = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
void main()
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore 2.75
@ -529,7 +528,7 @@ FINAL SYMBOL TABLE
const nomodify byte* DEFAULT_SCREEN = (byte*) 2048
const nomodify struct F018_DMAGIC* DMA = (struct F018_DMAGIC*) 55040
const nomodify byte DMA_COMMAND_COPY = 0
struct DMA_LIST_F018B DMA_SCREEN_UP loadstore mem[12] = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B DMA_SCREEN_UP loadstore mem[12] = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1

View File

@ -1,7 +1,7 @@
const nomodify byte* DEFAULT_SCREEN = (byte*) 2048
const nomodify struct F018_DMAGIC* DMA = (struct F018_DMAGIC*) 55040
const nomodify byte DMA_COMMAND_COPY = 0
struct DMA_LIST_F018B DMA_SCREEN_UP loadstore mem[12] = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B DMA_SCREEN_UP loadstore mem[12] = { command: DMA_COMMAND_COPY, count: (word)$18*$50, src: DEFAULT_SCREEN+$50, src_bank: 0, dest: DEFAULT_SCREEN, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
const byte OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -149,7 +146,7 @@ word memcpy_dma::num#1
void* memcpy_dma::src
void* memcpy_dma::src#0
void* memcpy_dma::src#1
struct DMA_LIST_F018B memcpy_dma_command loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0
byte~ memoryRemap::$1
@ -396,7 +393,7 @@ byte memcpy_dma::dmaMode
byte memcpy_dma::dmaMode#0 2.4444444444444446
word memcpy_dma::num
void* memcpy_dma::src
struct DMA_LIST_F018B memcpy_dma_command loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore 2.75
word memoryRemap::lowerPageOffset
@ -716,7 +713,7 @@ word memcpy_dma::num
const word memcpy_dma::num#0 num = (word)$18*$50
void* memcpy_dma::src
const void* memcpy_dma::src#0 src = (void*)DEFAULT_SCREEN+$50
struct DMA_LIST_F018B memcpy_dma_command loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore zp[1]:2 2.75
word memoryRemap::lowerPageOffset

View File

@ -18,7 +18,7 @@ word memcpy_dma::num
const word memcpy_dma::num#0 num = (word)$18*$50
void* memcpy_dma::src
const void* memcpy_dma::src#0 src = (void*)DEFAULT_SCREEN+$50
struct DMA_LIST_F018B memcpy_dma_command loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore zp[1]:2 2.75
word memoryRemap::lowerPageOffset

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -163,7 +160,7 @@ void* memcpy_dma4::src#1
byte memcpy_dma4::src_bank
byte memcpy_dma4::src_bank#0
byte memcpy_dma4::src_bank#1
struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
byte~ memoryRemap::$0
byte~ memoryRemap::$1
@ -426,7 +423,7 @@ byte memcpy_dma4::dmaMode#0 2.0
word memcpy_dma4::num
void* memcpy_dma4::src
byte memcpy_dma4::src_bank
struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore 2.75
word memoryRemap::lowerPageOffset
@ -768,7 +765,7 @@ void* memcpy_dma4::src
const void* memcpy_dma4::src#0 src = (void*)DEFAULT_SCREEN+$50
byte memcpy_dma4::src_bank
const byte memcpy_dma4::src_bank#0 src_bank = 0
struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore zp[1]:2 2.75
word memoryRemap::lowerPageOffset

View File

@ -24,7 +24,7 @@ void* memcpy_dma4::src
const void* memcpy_dma4::src#0 src = (void*)DEFAULT_SCREEN+$50
byte memcpy_dma4::src_bank
const byte memcpy_dma4::src_bank#0 src_bank = 0
struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset)
volatile byte memoryRemap::aVal loadstore zp[1]:2 2.75
word memoryRemap::lowerPageOffset

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -173,7 +170,7 @@ byte memset_dma::fill#1
word memset_dma::num
word memset_dma::num#0
word memset_dma::num#1
struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4
Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f
@ -400,7 +397,7 @@ byte memset_dma::dmaMode
byte memset_dma::dmaMode#0 2.4444444444444446
byte memset_dma::fill
word memset_dma::num
struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
Initial phi equivalence classes
Added variable memoryRemap::aVal to live range equivalence class [ memoryRemap::aVal ]
@ -720,7 +717,7 @@ byte memset_dma::fill
const byte memset_dma::fill#0 fill = '*'
word memset_dma::num
const word memset_dma::num#0 num = (word)$50*$a
struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
zp[1]:2 [ memoryRemap::aVal ]
zp[1]:3 [ memoryRemap::xVal ]

View File

@ -26,7 +26,7 @@ byte memset_dma::fill
const byte memset_dma::fill#0 fill = '*'
word memset_dma::num
const word memset_dma::num#0 num = (word)$50*$a
struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
zp[1]:2 [ memoryRemap::aVal ]
zp[1]:3 [ memoryRemap::xVal ]

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }

View File

@ -28,11 +28,8 @@ Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *DMA.ADDRMSB = >&memset_dma_command
Setting struct to load/store in variable affected by address-of *DMA.ADDRLSBTRIG = <&memset_dma_command
Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
@ -471,7 +468,7 @@ byte memset_dma256::fill#1
word memset_dma256::num
word memset_dma256::num#0
word memset_dma256::num#1
struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*)0, src_bank: 0, dest: (byte*)0, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte* memset_dma_command256[] = { DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_FILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4
@ -1147,7 +1144,7 @@ byte memset_dma256::dmaMode#0 2.0
struct DMA_LIST_F018B* memset_dma256::f018b
byte memset_dma256::fill
word memset_dma256::num
struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
Initial phi equivalence classes
[ main::r#2 main::r#1 ]
@ -2147,7 +2144,7 @@ const struct DMA_LIST_F018B* memset_dma256::f018b#0 f018b = (struct DMA_LIST_F01
byte memset_dma256::fill
word memset_dma256::num
const word memset_dma256::num#0 num = (word)$2d*$19*2
struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte* memset_dma_command256[] = { DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_FILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
reg byte x [ main::r#2 main::r#1 ]

View File

@ -104,7 +104,7 @@ const struct DMA_LIST_F018B* memset_dma256::f018b#0 f018b = (struct DMA_LIST_F01
byte memset_dma256::fill
word memset_dma256::num
const word memset_dma256::num#0 num = (word)$2d*$19*2
struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
volatile struct DMA_LIST_F018B memset_dma_command loadstore mem[12] = { command: DMA_COMMAND_FILL, count: 0, src: (byte*) 0, src_bank: 0, dest: (byte*) 0, dest_bank: 0, sub_command: 0, modulo: 0 }
const byte* memset_dma_command256[] = { DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_FILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
reg byte x [ main::r#2 main::r#1 ]

View File

@ -34,7 +34,7 @@ __start::@return: scope:[__start] from __start::@1
SYMBOL TABLE SSA
const byte OFFSET_STRUCT_A_B = 0
void __start()
struct A aa loadstore = { b: 1 }
volatile struct A aa loadstore = { b: 1 }
void main()
bool~ main::$0
bool~ main::$1
@ -98,7 +98,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
struct A aa loadstore = { b: 1 }
volatile struct A aa loadstore = { b: 1 }
void main()
Initial phi equivalence classes
@ -182,7 +182,7 @@ Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
struct A aa loadstore mem[1] = { b: 1 }
volatile struct A aa loadstore mem[1] = { b: 1 }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct A* main::a = &aa

View File

@ -1,4 +1,4 @@
struct A aa loadstore mem[1] = { b: 1 }
volatile struct A aa loadstore mem[1] = { b: 1 }
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const struct A* main::a = &aa

View File

@ -39,7 +39,7 @@ byte*~ main::$0
byte*~ main::$1
byte*~ main::$2
byte*~ main::$3
struct Point main::point1 loadstore
volatile struct Point main::point1 loadstore
const struct Point* main::ptr = &main::point1
Adding number conversion cast (unumber) 0 in SCREEN[0] = *main::$0
@ -101,7 +101,7 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
void main()
struct Point main::point1 loadstore
volatile struct Point main::point1 loadstore
Initial phi equivalence classes
Added variable main::point1 to live range equivalence class [ main::point1 ]
@ -179,7 +179,7 @@ const byte OFFSET_STRUCT_POINT_Y = 1
const nomodify byte* SCREEN = (byte*) 1024
const byte SIZEOF_STRUCT_POINT = 2
void main()
struct Point main::point1 loadstore zp[2]:2
volatile struct Point main::point1 loadstore zp[2]:2
const struct Point* main::ptr = &main::point1
zp[2]:2 [ main::point1 ]

View File

@ -3,7 +3,7 @@ const byte OFFSET_STRUCT_POINT_Y = 1
const nomodify byte* SCREEN = (byte*) 1024
const byte SIZEOF_STRUCT_POINT = 2
void main()
struct Point main::point1 loadstore zp[2]:2
volatile struct Point main::point1 loadstore zp[2]:2
const struct Point* main::ptr = &main::point1
zp[2]:2 [ main::point1 ]

View File

@ -31,7 +31,7 @@ void __start()
void main()
const struct Point* main::p2 = &point2
struct Point point1 loadstore = { x: 2, y: 3 }
struct Point point2 loadstore = {}
volatile struct Point point2 loadstore = {}
Adding number conversion cast (unumber) 0 in SCREEN[0] = *((byte*)&point2+OFFSET_STRUCT_POINT_X)
Adding number conversion cast (unumber) 1 in SCREEN[1] = *((byte*)&point2+OFFSET_STRUCT_POINT_Y)
@ -76,7 +76,7 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
void main()
struct Point point1 loadstore = { x: 2, y: 3 }
struct Point point2 loadstore = {}
volatile struct Point point2 loadstore = {}
Initial phi equivalence classes
Added variable point1 to live range equivalence class [ point1 ]
@ -159,7 +159,7 @@ const byte SIZEOF_STRUCT_POINT = 2
void main()
const struct Point* main::p2 = &point2
struct Point point1 loadstore mem[2] = { x: 2, y: 3 }
struct Point point2 loadstore mem[2] = {}
volatile struct Point point2 loadstore mem[2] = {}
mem[2] [ point1 ]
mem[2] [ point2 ]

View File

@ -4,7 +4,7 @@ const byte SIZEOF_STRUCT_POINT = 2
void main()
const struct Point* main::p2 = &point2
struct Point point1 loadstore mem[2] = { x: 2, y: 3 }
struct Point point2 loadstore mem[2] = {}
volatile struct Point point2 loadstore mem[2] = {}
mem[2] [ point1 ]
mem[2] [ point2 ]

View File

@ -54,7 +54,7 @@ signed word main::return#0
signed word main::return#1
signed word main::return#2
signed word main::return#3
struct myStruct main::s loadstore
volatile struct myStruct main::s loadstore
void update(struct myStruct* update::s , word update::size)
word*~ update::$0
word*~ update::$1
@ -147,7 +147,7 @@ update::@return: scope:[update] from update
VARIABLE REGISTER WEIGHTS
signed word main()
signed word main::return
struct myStruct main::s loadstore
volatile struct myStruct main::s loadstore
void update(struct myStruct* update::s , word update::size)
struct myStruct* update::s
word update::size
@ -239,7 +239,7 @@ FINAL SYMBOL TABLE
const byte SIZEOF_STRUCT_MYSTRUCT = 4
signed word main()
signed word main::return
struct myStruct main::s loadstore zp[4]:2
volatile struct myStruct main::s loadstore zp[4]:2
void update(struct myStruct* update::s , word update::size)
struct myStruct* update::s
const struct myStruct* update::s#0 s = &main::s

View File

@ -1,7 +1,7 @@
const byte SIZEOF_STRUCT_MYSTRUCT = 4
signed word main()
signed word main::return
struct myStruct main::s loadstore zp[4]:2
volatile struct myStruct main::s loadstore zp[4]:2
void update(struct myStruct* update::s , word update::size)
struct myStruct* update::s
const struct myStruct* update::s#0 s = &main::s

View File

@ -1,5 +1,4 @@
Setting struct to load/store in variable affected by address-of COLORS
Setting struct to load/store in variable affected by address-of COLORS
CONTROL FLOW GRAPH SSA
@ -25,7 +24,7 @@ __start::@return: scope:[__start] from __start::@1
SYMBOL TABLE SSA
const nomodify byte* BG_COLOR = (byte*)(byte*)&COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
const nomodify byte* BORDER_COLOR = (byte*)(byte*)&COLORS+OFFSET_STRUCT_SCREEN_COLORS_BORDER
struct SCREEN_COLORS COLORS loadstore = {}
volatile struct SCREEN_COLORS COLORS loadstore = {}
const byte OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
const byte OFFSET_STRUCT_SCREEN_COLORS_BORDER = 0
void __start()
@ -72,7 +71,7 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
struct SCREEN_COLORS COLORS loadstore = {}
volatile struct SCREEN_COLORS COLORS loadstore = {}
void main()
Initial phi equivalence classes
@ -142,7 +141,7 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* BG_COLOR = (byte*)&COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
const nomodify byte* BORDER_COLOR = (byte*)&COLORS
struct SCREEN_COLORS COLORS loadstore mem[5] = {}
volatile struct SCREEN_COLORS COLORS loadstore mem[5] = {}
const byte OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
const byte SIZEOF_STRUCT_SCREEN_COLORS = 5
void main()

View File

@ -1,6 +1,6 @@
const nomodify byte* BG_COLOR = (byte*)&COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
const nomodify byte* BORDER_COLOR = (byte*)&COLORS
struct SCREEN_COLORS COLORS loadstore mem[5] = {}
volatile struct SCREEN_COLORS COLORS loadstore mem[5] = {}
const byte OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
const byte SIZEOF_STRUCT_SCREEN_COLORS = 5
void main()

View File

@ -100,7 +100,7 @@ byte*~ main::$2
byte*~ main::$3
byte*~ main::$4
byte*~ main::$5
struct Point main::point loadstore
volatile struct Point main::point loadstore
const struct Point* main::ptr = &main::point
void print(byte print::p_x , byte print::p_y)
struct Point print::p
@ -211,7 +211,7 @@ byte idx#12 12.0
byte idx#13 2.6
byte idx#3 16.5
void main()
struct Point main::point loadstore
volatile struct Point main::point loadstore
void print(byte print::p_x , byte print::p_y)
struct Point print::p
byte print::p_x
@ -375,7 +375,7 @@ byte idx#12 idx zp[1]:2 12.0
byte idx#13 idx zp[1]:2 2.6
byte idx#3 reg byte y 16.5
void main()
struct Point main::point loadstore zp[2]:3
volatile struct Point main::point loadstore zp[2]:3
const struct Point* main::ptr = &main::point
void print(byte print::p_x , byte print::p_y)
struct Point print::p

View File

@ -7,7 +7,7 @@ byte idx#12 idx zp[1]:2 12.0
byte idx#13 idx zp[1]:2 2.6
byte idx#3 reg byte y 16.5
void main()
struct Point main::point loadstore zp[2]:3
volatile struct Point main::point loadstore zp[2]:3
const struct Point* main::ptr = &main::point
void print(byte print::p_x , byte print::p_y)
struct Point print::p

View File

@ -131,8 +131,8 @@ byte idx#7
byte idx#8
byte idx#9
void main()
struct Person main::henriette loadstore
struct Person main::jesper loadstore
volatile struct Person main::henriette loadstore
volatile struct Person main::jesper loadstore
void print_person(struct Person* print_person::person)
byte*~ print_person::$0
byte*~ print_person::$1
@ -281,8 +281,8 @@ byte idx#3 16.5
byte idx#4 22.0
byte idx#5 101.0
void main()
struct Person main::henriette loadstore
struct Person main::jesper loadstore
volatile struct Person main::henriette loadstore
volatile struct Person main::jesper loadstore
void print_person(struct Person* print_person::person)
byte*~ print_person::$1 202.0
byte*~ print_person::$2 202.0
@ -557,8 +557,8 @@ byte idx#3 reg byte x 16.5
byte idx#4 reg byte x 22.0
byte idx#5 reg byte x 101.0
void main()
struct Person main::henriette loadstore zp[17]:25
struct Person main::jesper loadstore zp[17]:8
volatile struct Person main::henriette loadstore zp[17]:25
volatile struct Person main::jesper loadstore zp[17]:8
void print_person(struct Person* print_person::person)
byte*~ print_person::$1 zp[2]:4 202.0
byte*~ print_person::$2 zp[2]:6 202.0

View File

@ -12,8 +12,8 @@ byte idx#3 reg byte x 16.5
byte idx#4 reg byte x 22.0
byte idx#5 reg byte x 101.0
void main()
struct Person main::henriette loadstore zp[17]:25
struct Person main::jesper loadstore zp[17]:8
volatile struct Person main::henriette loadstore zp[17]:25
volatile struct Person main::jesper loadstore zp[17]:8
void print_person(struct Person* print_person::person)
byte*~ print_person::$1 zp[2]:4 202.0
byte*~ print_person::$2 zp[2]:6 202.0

View File

@ -0,0 +1,83 @@
// Commodore 64 PRG executable file
.file [name="struct-ptr-35.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)
.const OFFSET_STRUCT_TILE_COUNT = 4
.segment Code
main: {
.label SCREEN = $400
.label __1 = 4
.label tile = 4
.label i = 2
.label __4 = 4
.label __5 = 6
lda #<0
sta.z i
sta.z i+1
__b1:
// tile = TileDB[i]
lda.z i
asl
sta.z __1
lda.z i+1
rol
sta.z __1+1
lda #<TileDB
clc
adc.z __4
sta.z __4
lda #>TileDB
adc.z __4+1
sta.z __4+1
ldy #0
lda (tile),y
pha
iny
lda (tile),y
sta.z tile+1
pla
sta.z tile
// SCREEN[i] = tile->Count
clc
lda.z i
adc #<SCREEN
sta.z __5
lda.z i+1
adc #>SCREEN
sta.z __5+1
ldy #OFFSET_STRUCT_TILE_COUNT
lda (tile),y
ldy #0
sta (__5),y
// for(int i:0..1)
inc.z i
bne !+
inc.z i+1
!:
lda.z i+1
cmp #>2
bne __b1
lda.z i
cmp #<2
bne __b1
// }
rts
}
.segment Data
PlayerSprites: .fill 4*$c, 0
Enemy2Sprites: .fill 4*$c, 0
TileDB: .word S1, S2
S1: .word PlayerSprites, $14
.byte $40
.text "Sven"
.byte 0
.fill $f, 0
S2: .word Enemy2Sprites, $32
.byte $80
.text "Jesper"
.byte 0
.fill $d, 0

View File

@ -0,0 +1,18 @@
void main()
main: scope:[main] from
[0] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[1] main::i#2 = phi( main/0, main::@1/main::i#1 )
[2] main::$1 = main::i#2 << 1
[3] main::$4 = TileDB + main::$1
[4] main::tile#0 = *main::$4
[5] main::$5 = main::SCREEN + main::i#2
[6] *main::$5 = ((byte*)main::tile#0)[OFFSET_STRUCT_TILE_COUNT]
[7] main::i#1 = ++ main::i#2
[8] if(main::i#1!=2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return

View File

@ -0,0 +1,453 @@
Fixing struct type size struct Tile to 25
Fixing struct type size struct Tile to 25
Fixing struct type size struct Tile to 25
Fixing struct type size struct Tile to 25
Fixing struct type SIZE_OF struct Tile to 25
Fixing struct type SIZE_OF struct Tile to 25
Setting struct to load/store in variable affected by address-of S1
Setting struct to load/store in variable affected by address-of S2
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
main::i#0 = 0
to:main::@1
main::@1: scope:[main] from main main::@1
main::i#2 = phi( main/main::i#0, main::@1/main::i#1 )
main::$1 = main::i#2 * SIZEOF_POINTER
main::tile#0 = TileDB[main::$1]
main::$3 = (byte*)main::tile#0
main::$2 = main::$3 + OFFSET_STRUCT_TILE_COUNT
main::SCREEN[main::i#2] = *main::$2
main::i#1 = main::i#2 + rangenext(0,1)
main::$0 = main::i#1 != rangelast(0,1)
if(main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
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 dword* Enemy2Sprites[$c] = { fill( $c, 0) }
const byte OFFSET_STRUCT_TILE_COUNT = 4
const dword* PlayerSprites[$c] = { fill( $c, 0) }
volatile struct Tile S1 loadstore = { Tiles: PlayerSprites, Offset: $14, Count: $40, Name: "Sven" }
volatile struct Tile S2 loadstore = { Tiles: Enemy2Sprites, Offset: $32, Count: $80, Name: "Jesper" }
const byte SIZEOF_POINTER = 2
const struct Tile** TileDB[2] = { &S1, &S2 }
void __start()
void main()
bool~ main::$0
signed word~ main::$1
byte*~ main::$2
byte*~ main::$3
const nomodify byte* main::SCREEN = (byte*)$400
signed word main::i
signed word main::i#0
signed word main::i#1
signed word main::i#2
struct Tile* main::tile
struct Tile* main::tile#0
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition main::$0 [9] if(main::i#1!=rangelast(0,1)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [7] main::i#1 = ++ main::i#2 to ++
Resolved ranged comparison value [9] if(main::i#1!=rangelast(0,1)) goto main::@1 to 2
Converting *(pointer+n) to pointer[n] [6] main::SCREEN[main::i#2] = *main::$2 -- main::$3[OFFSET_STRUCT_TILE_COUNT]
Successful SSA optimization Pass2InlineDerefIdx
De-inlining pointer[w] to *(pointer+w) [3] main::tile#0 = TileDB[main::$1]
De-inlining pointer[w] to *(pointer+w) [6] main::SCREEN[main::i#2] = main::$3[OFFSET_STRUCT_TILE_COUNT]
Successful SSA optimization Pass2DeInlineWordDerefIdx
Eliminating unused variable main::$2 and assignment [5] main::$2 = main::$3 + OFFSET_STRUCT_TILE_COUNT
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
Adding number conversion cast (snumber) 2 in [8] if(main::i#1!=2) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized signed number type (signed byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining Noop Cast [4] main::$3 = (byte*)main::tile#0 keeping main::tile#0
Successful SSA optimization Pass2NopCastInlining
Rewriting multiplication to use shift [1] main::$1 = main::i#2 * SIZEOF_POINTER
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings main::i#0
Constant inlined main::i#0 = 0
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant SIZEOF_POINTER
Successful SSA optimization PassNEliminateUnusedVars
Finalized unsigned number type (byte) $14
Finalized unsigned number type (byte) $14
Finalized unsigned number type (byte) $c
Finalized unsigned number type (byte) $c
Finalized unsigned number type (byte) $c
Finalized unsigned number type (byte) $c
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@2(between main::@1 and main::@1)
Adding NOP phi() at start of main
CALL GRAPH
Created 1 initial phi equivalence classes
Coalesced [10] main::i#3 = main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block label main::@2
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
void main()
main: scope:[main] from
[0] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[1] main::i#2 = phi( main/0, main::@1/main::i#1 )
[2] main::$1 = main::i#2 << 1
[3] main::$4 = TileDB + main::$1
[4] main::tile#0 = *main::$4
[5] main::$5 = main::SCREEN + main::i#2
[6] *main::$5 = ((byte*)main::tile#0)[OFFSET_STRUCT_TILE_COUNT]
[7] main::i#1 = ++ main::i#2
[8] if(main::i#1!=2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return
VARIABLE REGISTER WEIGHTS
volatile struct Tile S1 loadstore = { Tiles: PlayerSprites, Offset: $14, Count: $40, Name: "Sven" }
volatile struct Tile S2 loadstore = { Tiles: Enemy2Sprites, Offset: $32, Count: $80, Name: "Jesper" }
void main()
signed word~ main::$1 22.0
struct Tile**~ main::$4 22.0
byte*~ main::$5 22.0
signed word main::i
signed word main::i#1 16.5
signed word main::i#2 7.333333333333333
struct Tile* main::tile
struct Tile* main::tile#0 5.5
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::tile#0 to live range equivalence class [ main::tile#0 ]
Added variable main::$5 to live range equivalence class [ main::$5 ]
Added variable S1 to live range equivalence class [ S1 ]
Added variable S2 to live range equivalence class [ S2 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::$1 ]
[ main::$4 ]
[ main::tile#0 ]
[ main::$5 ]
[ S1 ]
[ S2 ]
Allocated zp[2]:2 [ main::i#2 main::i#1 ]
Allocated zp[2]:4 [ main::$1 ]
Allocated zp[2]:6 [ main::$4 ]
Allocated zp[2]:8 [ main::tile#0 ]
Allocated zp[2]:10 [ main::$5 ]
Allocated mem[25] [ S1 ]
Allocated mem[25] [ S2 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [2] main::$1 = main::i#2 << 1 [ main::i#2 main::$1 ] ( [ main::i#2 main::$1 ] { } ) always clobbers reg byte a
Statement [3] main::$4 = TileDB + main::$1 [ main::i#2 main::$4 ] ( [ main::i#2 main::$4 ] { } ) always clobbers reg byte a
Statement [4] main::tile#0 = *main::$4 [ main::i#2 main::tile#0 ] ( [ main::i#2 main::tile#0 ] { } ) always clobbers reg byte a reg byte y
Statement [5] main::$5 = main::SCREEN + main::i#2 [ main::i#2 main::tile#0 main::$5 ] ( [ main::i#2 main::tile#0 main::$5 ] { } ) always clobbers reg byte a
Statement [6] *main::$5 = ((byte*)main::tile#0)[OFFSET_STRUCT_TILE_COUNT] [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a reg byte y
Statement [8] if(main::i#1!=2) goto main::@1 [ main::i#1 ] ( [ main::i#1 ] { } ) always clobbers reg byte a
Potential registers zp[2]:2 [ main::i#2 main::i#1 ] : zp[2]:2 ,
Potential registers zp[2]:4 [ main::$1 ] : zp[2]:4 ,
Potential registers zp[2]:6 [ main::$4 ] : zp[2]:6 ,
Potential registers zp[2]:8 [ main::tile#0 ] : zp[2]:8 ,
Potential registers zp[2]:10 [ main::$5 ] : zp[2]:10 ,
Potential registers mem[25] [ S1 ] : mem[25] ,
Potential registers mem[25] [ S2 ] : mem[25] ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 23.83: zp[2]:2 [ main::i#2 main::i#1 ] 22: zp[2]:4 [ main::$1 ] 22: zp[2]:6 [ main::$4 ] 22: zp[2]:10 [ main::$5 ] 5.5: zp[2]:8 [ main::tile#0 ]
Uplift Scope [Tile]
Uplift Scope [] 0: mem[25] [ S1 ] 0: mem[25] [ S2 ]
Uplifting [main] best 1356 combination zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:4 [ main::$1 ] zp[2]:6 [ main::$4 ] zp[2]:10 [ main::$5 ] zp[2]:8 [ main::tile#0 ]
Uplifting [Tile] best 1356 combination
Uplifting [] best 1356 combination mem[25] [ S1 ] mem[25] [ S2 ]
Coalescing zero page register [ zp[2]:4 [ main::$1 ] ] with [ zp[2]:6 [ main::$4 ] ] - score: 1
Coalescing zero page register [ zp[2]:4 [ main::$1 main::$4 ] ] with [ zp[2]:8 [ main::tile#0 ] ] - score: 1
Allocated (was zp[2]:10) zp[2]:6 [ main::$5 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Upstart
// Commodore 64 PRG executable file
.file [name="struct-ptr-35.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
.const OFFSET_STRUCT_TILE_COUNT = 4
.segment Code
// main
main: {
.label SCREEN = $400
.label __1 = 4
.label tile = 4
.label i = 2
.label __4 = 4
.label __5 = 6
// [1] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vwsz1=vwsc1
lda #<0
sta.z i
lda #>0
sta.z i+1
jmp __b1
// [1] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
__b1_from___b1:
// [1] phi main::i#2 = main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [2] main::$1 = main::i#2 << 1 -- vwsz1=vwsz2_rol_1
lda.z i
asl
sta.z __1
lda.z i+1
rol
sta.z __1+1
// [3] main::$4 = TileDB + main::$1 -- qssz1=qssc1_plus_vwsz1
lda #<TileDB
clc
adc.z __4
sta.z __4
lda #>TileDB
adc.z __4+1
sta.z __4+1
// [4] main::tile#0 = *main::$4 -- pssz1=_deref_qssz1
ldy #0
lda (tile),y
pha
iny
lda (tile),y
sta.z tile+1
pla
sta.z tile
// [5] main::$5 = main::SCREEN + main::i#2 -- pbuz1=pbuc1_plus_vwsz2
clc
lda.z i
adc #<SCREEN
sta.z __5
lda.z i+1
adc #>SCREEN
sta.z __5+1
// [6] *main::$5 = ((byte*)main::tile#0)[OFFSET_STRUCT_TILE_COUNT] -- _deref_pbuz1=pbuz2_derefidx_vbuc1
ldy #OFFSET_STRUCT_TILE_COUNT
lda (tile),y
ldy #0
sta (__5),y
// [7] main::i#1 = ++ main::i#2 -- vwsz1=_inc_vwsz1
inc.z i
bne !+
inc.z i+1
!:
// [8] if(main::i#1!=2) goto main::@1 -- vwsz1_neq_vwuc1_then_la1
lda.z i+1
cmp #>2
bne __b1_from___b1
lda.z i
cmp #<2
bne __b1_from___b1
jmp __breturn
// main::@return
__breturn:
// [9] return
rts
}
// File Data
.segment Data
PlayerSprites: .fill 4*$c, 0
Enemy2Sprites: .fill 4*$c, 0
TileDB: .word S1, S2
S1: .word PlayerSprites, $14
.byte $40
.text "Sven"
.byte 0
.fill $f, 0
S2: .word Enemy2Sprites, $32
.byte $80
.text "Jesper"
.byte 0
.fill $d, 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
const dword* Enemy2Sprites[$c] = { fill( $c, 0) }
const byte OFFSET_STRUCT_TILE_COUNT = 4
const dword* PlayerSprites[$c] = { fill( $c, 0) }
volatile struct Tile S1 loadstore mem[25] = { Tiles: PlayerSprites, Offset: $14, Count: $40, Name: "Sven" }
volatile struct Tile S2 loadstore mem[25] = { Tiles: Enemy2Sprites, Offset: $32, Count: $80, Name: "Jesper" }
const struct Tile** TileDB[2] = { &S1, &S2 }
void main()
signed word~ main::$1 zp[2]:4 22.0
struct Tile**~ main::$4 zp[2]:4 22.0
byte*~ main::$5 zp[2]:6 22.0
const nomodify byte* main::SCREEN = (byte*) 1024
signed word main::i
signed word main::i#1 i zp[2]:2 16.5
signed word main::i#2 i zp[2]:2 7.333333333333333
struct Tile* main::tile
struct Tile* main::tile#0 tile zp[2]:4 5.5
zp[2]:2 [ main::i#2 main::i#1 ]
zp[2]:4 [ main::$1 main::$4 main::tile#0 ]
zp[2]:6 [ main::$5 ]
mem[25] [ S1 ]
mem[25] [ S2 ]
FINAL ASSEMBLER
Score: 1316
// File Comments
// Upstart
// Commodore 64 PRG executable file
.file [name="struct-ptr-35.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
.const OFFSET_STRUCT_TILE_COUNT = 4
.segment Code
// main
main: {
.label SCREEN = $400
.label __1 = 4
.label tile = 4
.label i = 2
.label __4 = 4
.label __5 = 6
// [1] phi from main to main::@1 [phi:main->main::@1]
// [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vwsz1=vwsc1
lda #<0
sta.z i
sta.z i+1
// [1] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
// [1] phi main::i#2 = main::i#1 [phi:main::@1->main::@1#0] -- register_copy
// main::@1
__b1:
// tile = TileDB[i]
// [2] main::$1 = main::i#2 << 1 -- vwsz1=vwsz2_rol_1
lda.z i
asl
sta.z __1
lda.z i+1
rol
sta.z __1+1
// [3] main::$4 = TileDB + main::$1 -- qssz1=qssc1_plus_vwsz1
lda #<TileDB
clc
adc.z __4
sta.z __4
lda #>TileDB
adc.z __4+1
sta.z __4+1
// [4] main::tile#0 = *main::$4 -- pssz1=_deref_qssz1
ldy #0
lda (tile),y
pha
iny
lda (tile),y
sta.z tile+1
pla
sta.z tile
// SCREEN[i] = tile->Count
// [5] main::$5 = main::SCREEN + main::i#2 -- pbuz1=pbuc1_plus_vwsz2
clc
lda.z i
adc #<SCREEN
sta.z __5
lda.z i+1
adc #>SCREEN
sta.z __5+1
// [6] *main::$5 = ((byte*)main::tile#0)[OFFSET_STRUCT_TILE_COUNT] -- _deref_pbuz1=pbuz2_derefidx_vbuc1
ldy #OFFSET_STRUCT_TILE_COUNT
lda (tile),y
ldy #0
sta (__5),y
// for(int i:0..1)
// [7] main::i#1 = ++ main::i#2 -- vwsz1=_inc_vwsz1
inc.z i
bne !+
inc.z i+1
!:
// [8] if(main::i#1!=2) goto main::@1 -- vwsz1_neq_vwuc1_then_la1
lda.z i+1
cmp #>2
bne __b1
lda.z i
cmp #<2
bne __b1
// main::@return
// }
// [9] return
rts
}
// File Data
.segment Data
PlayerSprites: .fill 4*$c, 0
Enemy2Sprites: .fill 4*$c, 0
TileDB: .word S1, S2
S1: .word PlayerSprites, $14
.byte $40
.text "Sven"
.byte 0
.fill $f, 0
S2: .word Enemy2Sprites, $32
.byte $80
.text "Jesper"
.byte 0
.fill $d, 0

View File

@ -0,0 +1,22 @@
const dword* Enemy2Sprites[$c] = { fill( $c, 0) }
const byte OFFSET_STRUCT_TILE_COUNT = 4
const dword* PlayerSprites[$c] = { fill( $c, 0) }
volatile struct Tile S1 loadstore mem[25] = { Tiles: PlayerSprites, Offset: $14, Count: $40, Name: "Sven" }
volatile struct Tile S2 loadstore mem[25] = { Tiles: Enemy2Sprites, Offset: $32, Count: $80, Name: "Jesper" }
const struct Tile** TileDB[2] = { &S1, &S2 }
void main()
signed word~ main::$1 zp[2]:4 22.0
struct Tile**~ main::$4 zp[2]:4 22.0
byte*~ main::$5 zp[2]:6 22.0
const nomodify byte* main::SCREEN = (byte*) 1024
signed word main::i
signed word main::i#1 i zp[2]:2 16.5
signed word main::i#2 i zp[2]:2 7.333333333333333
struct Tile* main::tile
struct Tile* main::tile#0 tile zp[2]:4 5.5
zp[2]:2 [ main::i#2 main::i#1 ]
zp[2]:4 [ main::$1 main::$4 main::tile#0 ]
zp[2]:6 [ main::$5 ]
mem[25] [ S1 ]
mem[25] [ S2 ]