mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-19 12:37:54 +00:00
Added kickasm support for expressions specifying bytes & cycles.
This commit is contained in:
parent
6475f70192
commit
c272b93872
src
main/java/dk/camelot64/kickc
model
parser
passes
test/java/dk/camelot64/kickc/test
@ -224,6 +224,50 @@ public abstract class ProgramValue {
|
||||
|
||||
}
|
||||
|
||||
/** Bytes inside inline kickasm code. */
|
||||
public static class KickAsmBytes extends ProgramValue {
|
||||
|
||||
private StatementKickAsm statementKickAsm;
|
||||
|
||||
KickAsmBytes(StatementKickAsm statementKickAsm) {
|
||||
super();
|
||||
this.statementKickAsm = statementKickAsm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RValue get() {
|
||||
return statementKickAsm.getBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(RValue value) {
|
||||
statementKickAsm.setBytes(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Cycles inside inline kickasm code. */
|
||||
public static class KickAsmCycles extends ProgramValue {
|
||||
|
||||
private StatementKickAsm statementKickAsm;
|
||||
|
||||
KickAsmCycles(StatementKickAsm statementKickAsm) {
|
||||
super();
|
||||
this.statementKickAsm = statementKickAsm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RValue get() {
|
||||
return statementKickAsm.getCycles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(RValue value) {
|
||||
statementKickAsm.setCycles(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* LValue as part of an assignment statement (or a call).
|
||||
*/
|
||||
|
@ -125,6 +125,14 @@ public class ProgramValueIterator {
|
||||
if(location!=null) {
|
||||
execute(new ProgramValue.KickAsmLocation(statementKickAsm), handler, statement, statementsIt, block);
|
||||
}
|
||||
RValue bytes = statementKickAsm.getLocation();
|
||||
if(bytes!=null) {
|
||||
execute(new ProgramValue.KickAsmBytes(statementKickAsm), handler, statement, statementsIt, block);
|
||||
}
|
||||
RValue cycles = statementKickAsm.getLocation();
|
||||
if(cycles!=null) {
|
||||
execute(new ProgramValue.KickAsmCycles(statementKickAsm), handler, statement, statementsIt, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,17 +11,17 @@ public class StatementKickAsm extends StatementBase {
|
||||
|
||||
/** The absolute address to generate the kick-assembler code at. If null it is generated inline. */
|
||||
private RValue location;
|
||||
/** The number of bytes generated by the kickassembler code. */
|
||||
private Long bytes;
|
||||
/** The number of cycles used by the generated kickassembler code. */
|
||||
private Long cycles;
|
||||
/** The number of bytes generated by the kick-assembler code. */
|
||||
private RValue bytes;
|
||||
/** The number of cycles used by the generated kick-assembler code. */
|
||||
private RValue cycles;
|
||||
|
||||
public StatementKickAsm(String kickAsmCode, StatementSource source) {
|
||||
super(null, source);
|
||||
this.kickAsmCode = kickAsmCode;
|
||||
}
|
||||
|
||||
public StatementKickAsm(String kickAsmCode, RValue location, Long bytes, Long cycles, StatementSource source) {
|
||||
public StatementKickAsm(String kickAsmCode, RValue location, RValue bytes, RValue cycles, StatementSource source) {
|
||||
super(null, source);
|
||||
this.kickAsmCode = kickAsmCode;
|
||||
this.location = location;
|
||||
@ -56,19 +56,19 @@ public class StatementKickAsm extends StatementBase {
|
||||
return kickAsmCode;
|
||||
}
|
||||
|
||||
public void setBytes(Long bytes) {
|
||||
public void setBytes(RValue bytes) {
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public Long getBytes() {
|
||||
public RValue getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public void setCycles(Long cycles) {
|
||||
public void setCycles(RValue cycles) {
|
||||
this.cycles = cycles;
|
||||
}
|
||||
|
||||
public Long getCycles() {
|
||||
public RValue getCycles() {
|
||||
return cycles;
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ kasmDirective
|
||||
: 'resource' STRING #kasmDirectiveResource
|
||||
| 'clobber' STRING #kasmDirectiveClobber
|
||||
| 'param' NAME ':' expr #kasmDirectiveTransfer
|
||||
| 'bytes' NUMBER #kasmDirectiveBytes
|
||||
| 'cycles' NUMBER #kasmDirectiveCycles
|
||||
| 'bytes' expr #kasmDirectiveBytes
|
||||
| 'cycles' expr #kasmDirectiveCycles
|
||||
| 'pc' ( 'inline' | expr ) #kasmDirectiveAddress
|
||||
;
|
||||
|
||||
|
@ -803,7 +803,9 @@ public class KickCParser extends Parser {
|
||||
}
|
||||
}
|
||||
public static class KasmDirectiveCyclesContext extends KasmDirectiveContext {
|
||||
public TerminalNode NUMBER() { return getToken(KickCParser.NUMBER, 0); }
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public KasmDirectiveCyclesContext(KasmDirectiveContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
@ -820,7 +822,9 @@ public class KickCParser extends Parser {
|
||||
}
|
||||
}
|
||||
public static class KasmDirectiveBytesContext extends KasmDirectiveContext {
|
||||
public TerminalNode NUMBER() { return getToken(KickCParser.NUMBER, 0); }
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public KasmDirectiveBytesContext(KasmDirectiveContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
@ -958,7 +962,7 @@ public class KickCParser extends Parser {
|
||||
setState(152);
|
||||
match(T__13);
|
||||
setState(153);
|
||||
match(NUMBER);
|
||||
expr(0);
|
||||
}
|
||||
break;
|
||||
case T__14:
|
||||
@ -968,7 +972,7 @@ public class KickCParser extends Parser {
|
||||
setState(154);
|
||||
match(T__14);
|
||||
setState(155);
|
||||
match(NUMBER);
|
||||
expr(0);
|
||||
}
|
||||
break;
|
||||
case T__15:
|
||||
@ -4203,8 +4207,8 @@ public class KickCParser extends Parser {
|
||||
"\3\2\2\2\u008e\u0090\3\2\2\2\u008f\u008d\3\2\2\2\u0090\u0091\7\7\2\2\u0091"+
|
||||
"\25\3\2\2\2\u0092\u0093\7\f\2\2\u0093\u00a4\7H\2\2\u0094\u0095\7\r\2\2"+
|
||||
"\u0095\u00a4\7H\2\2\u0096\u0097\7\16\2\2\u0097\u0098\7T\2\2\u0098\u0099"+
|
||||
"\7\17\2\2\u0099\u00a4\5(\25\2\u009a\u009b\7\20\2\2\u009b\u00a4\7K\2\2"+
|
||||
"\u009c\u009d\7\21\2\2\u009d\u00a4\7K\2\2\u009e\u00a1\7\22\2\2\u009f\u00a2"+
|
||||
"\7\17\2\2\u0099\u00a4\5(\25\2\u009a\u009b\7\20\2\2\u009b\u00a4\5(\25\2"+
|
||||
"\u009c\u009d\7\21\2\2\u009d\u00a4\5(\25\2\u009e\u00a1\7\22\2\2\u009f\u00a2"+
|
||||
"\7\23\2\2\u00a0\u00a2\5(\25\2\u00a1\u009f\3\2\2\2\u00a1\u00a0\3\2\2\2"+
|
||||
"\u00a2\u00a4\3\2\2\2\u00a3\u0092\3\2\2\2\u00a3\u0094\3\2\2\2\u00a3\u0096"+
|
||||
"\3\2\2\2\u00a3\u009a\3\2\2\2\u00a3\u009c\3\2\2\2\u00a3\u009e\3\2\2\2\u00a4"+
|
||||
|
@ -154,7 +154,6 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
if(m.find()) {
|
||||
String kickAsmCode = m.group(1).replaceAll("\r", "");
|
||||
StatementKickAsm statementKickAsm = new StatementKickAsm(kickAsmCode, new StatementSource(ctx));
|
||||
sequence.addStatement(statementKickAsm);
|
||||
if(ctx.kasmDirectives() != null) {
|
||||
List<KasmDirective> kasmDirectives = this.visitKasmDirectives(ctx.kasmDirectives());
|
||||
for(KasmDirective kasmDirective : kasmDirectives) {
|
||||
@ -167,6 +166,7 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
}
|
||||
}
|
||||
}
|
||||
sequence.addStatement(statementKickAsm);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -215,41 +215,49 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
/** KickAssembler directive specifying the number of bytes for generated code/data. */
|
||||
public static class KasmDirectiveBytes implements KasmDirective {
|
||||
/** bytes for the KickAssembler-code. */
|
||||
private long bytes;
|
||||
private RValue bytes;
|
||||
|
||||
public KasmDirectiveBytes(long bytes) {
|
||||
public KasmDirectiveBytes(RValue bytes) {
|
||||
this.bytes= bytes;
|
||||
}
|
||||
|
||||
public long getBytes() {
|
||||
public RValue getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KasmDirective visitKasmDirectiveBytes(KickCParser.KasmDirectiveBytesContext ctx) {
|
||||
Number bytes = NumberParser.parseLiteral(ctx.NUMBER().getText());
|
||||
return new KasmDirectiveBytes(bytes.longValue());
|
||||
if(ctx.expr()!=null) {
|
||||
RValue bytes = (RValue) this.visit(ctx.expr());
|
||||
return new KasmDirectiveBytes(bytes);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** KickAssembler directive specifying the number of cycles for generated code/data. */
|
||||
public static class KasmDirectiveCycles implements KasmDirective {
|
||||
/** cycles for the KickAssembler-code. */
|
||||
private long cycles;
|
||||
private RValue cycles;
|
||||
|
||||
public KasmDirectiveCycles(long cycles) {
|
||||
public KasmDirectiveCycles(RValue cycles) {
|
||||
this.cycles= cycles;
|
||||
}
|
||||
|
||||
public long getCycles() {
|
||||
public RValue getCycles() {
|
||||
return cycles;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KasmDirective visitKasmDirectiveCycles(KickCParser.KasmDirectiveCyclesContext ctx) {
|
||||
Number cycles = NumberParser.parseLiteral(ctx.NUMBER().getText());
|
||||
return new KasmDirectiveCycles(cycles.longValue());
|
||||
if(ctx.expr()!=null) {
|
||||
RValue cycles = (RValue) this.visit(ctx.expr());
|
||||
return new KasmDirectiveCycles(cycles);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,10 +25,16 @@ public class Pass3AssertConstants extends Pass2SsaAssertion {
|
||||
for(Statement statement : block.getStatements()) {
|
||||
if(statement instanceof StatementKickAsm) {
|
||||
RValue location = ((StatementKickAsm) statement).getLocation();
|
||||
if(location != null) {
|
||||
if(!(location instanceof ConstantValue)) {
|
||||
throw new CompileError("Error! KickAssembler location is not constant " + location.toString(), statement);
|
||||
}
|
||||
if(location != null && !(location instanceof ConstantValue)) {
|
||||
throw new CompileError("Error! KickAssembler location is not constant " + location.toString(), statement);
|
||||
}
|
||||
RValue bytes = ((StatementKickAsm) statement).getBytes();
|
||||
if(bytes != null && !(bytes instanceof ConstantValue)) {
|
||||
throw new CompileError("Error! KickAssembler bytes is not constant " + bytes.toString(), statement);
|
||||
}
|
||||
RValue cycles = ((StatementKickAsm) statement).getCycles();
|
||||
if(cycles!= null && !(cycles instanceof ConstantValue)) {
|
||||
throw new CompileError("Error! KickAssembler cycles is not constant " + cycles.toString(), statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import dk.camelot64.kickc.asm.*;
|
||||
import dk.camelot64.kickc.fragment.*;
|
||||
import dk.camelot64.kickc.model.*;
|
||||
import dk.camelot64.kickc.model.operators.Operators;
|
||||
import dk.camelot64.kickc.model.values.*;
|
||||
import dk.camelot64.kickc.model.statements.*;
|
||||
import dk.camelot64.kickc.model.symbols.ConstantVar;
|
||||
import dk.camelot64.kickc.model.symbols.ProgramScope;
|
||||
@ -13,6 +12,7 @@ import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeArray;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypePointer;
|
||||
import dk.camelot64.kickc.model.values.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -109,9 +109,10 @@ public class Pass4CodeGeneration {
|
||||
if(statement instanceof StatementKickAsm) {
|
||||
StatementKickAsm statementKasm = (StatementKickAsm) statement;
|
||||
if(statementKasm.getLocation() != null) {
|
||||
asm.addLine(new AsmSetPc("Inline", AsmFormat.getAsmConstant(program, (ConstantValue) statementKasm.getLocation(), 99, ScopeRef.ROOT)));
|
||||
asm.addInlinedKickAsm(statementKasm.getKickAsmCode(), statementKasm.getBytes(), statementKasm.getCycles());
|
||||
}
|
||||
String asmLocation = AsmFormat.getAsmConstant(program, (ConstantValue) statementKasm.getLocation(), 99, ScopeRef.ROOT);
|
||||
asm.addLine(new AsmSetPc("Inline", asmLocation));
|
||||
addKickAsm(asm, statementKasm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -440,7 +441,7 @@ public class Pass4CodeGeneration {
|
||||
} else if(statement instanceof StatementKickAsm) {
|
||||
StatementKickAsm statementKasm = (StatementKickAsm) statement;
|
||||
if(statementKasm.getLocation() == null) {
|
||||
asm.addInlinedKickAsm(statementKasm.getKickAsmCode(), statementKasm.getBytes(), statementKasm.getCycles());
|
||||
addKickAsm(asm, statementKasm);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Statement not supported " + statement);
|
||||
@ -448,6 +449,22 @@ public class Pass4CodeGeneration {
|
||||
}
|
||||
}
|
||||
|
||||
private void addKickAsm(AsmProgram asm, StatementKickAsm statementKasm) {
|
||||
Long asmBytes = null;
|
||||
if(statementKasm.getBytes() != null) {
|
||||
ConstantValue kasmBytes = (ConstantValue) statementKasm.getBytes();
|
||||
ConstantLiteral kasmBytesLiteral = kasmBytes.calculateLiteral(getScope());
|
||||
asmBytes = ((ConstantInteger) kasmBytesLiteral).getInteger();
|
||||
}
|
||||
Long asmCycles = null;
|
||||
if(statementKasm.getCycles() != null) {
|
||||
ConstantValue kasmCycles = (ConstantValue) statementKasm.getCycles();
|
||||
ConstantLiteral kasmCyclesLiteral = kasmCycles.calculateLiteral(getScope());
|
||||
asmCycles = ((ConstantInteger) kasmCyclesLiteral).getInteger();
|
||||
}
|
||||
asm.addInlinedKickAsm(statementKasm.getKickAsmCode(), asmBytes, asmCycles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate all block entry points (phi transitions) which have not already been generated.
|
||||
*
|
||||
|
@ -4,7 +4,7 @@ import "memory.kc"
|
||||
|
||||
byte* SCREEN = $400;
|
||||
byte* LOGO = $2000;
|
||||
kickasm(resource "logo.png", pc LOGO, bytes $780) {{
|
||||
kickasm(resource "logo.png", pc LOGO, bytes 6*40*8) {{
|
||||
logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
|
@ -3,7 +3,7 @@ import "c64.kc"
|
||||
byte* SCREEN = $400;
|
||||
byte* LOGO = $2000;
|
||||
|
||||
kickasm(resource "logo.png", pc LOGO ) {{
|
||||
kickasm(resource "logo.png", pc LOGO, bytes 6*40*8 ) {{
|
||||
logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
|
@ -5,7 +5,7 @@ import "memory.kc"
|
||||
|
||||
byte* SCREEN = $400;
|
||||
byte* LOGO = $2000;
|
||||
kickasm(resource "logo.png", pc LOGO, bytes $780) {{
|
||||
kickasm(resource "logo.png", pc LOGO, bytes 6*40*8) {{
|
||||
logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -629,6 +629,8 @@ Adding pre/post-modifier (byte) render_logo::screen_idx ← ++ (byte) render_log
|
||||
Adding pre/post-modifier (byte) render_logo::logo_idx ← ++ (byte) render_logo::logo_idx
|
||||
Adding pre/post-modifier (byte) render_logo::screen_idx ← ++ (byte) render_logo::screen_idx
|
||||
SYMBOLS
|
||||
(byte/word/signed word/dword/signed dword~) $0
|
||||
(byte/signed word/word/dword/signed dword~) $1
|
||||
(label) @1
|
||||
(label) @10
|
||||
(label) @11
|
||||
@ -2298,6 +2300,8 @@ fill::@return: scope:[fill] from fill::@2
|
||||
@24: scope:[] from @23
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) LOGO ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte/signed word/word/dword/signed dword~) $1 ← (byte/word/signed word/dword/signed dword~) $0 * (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
kickasm(location (byte*) LOGO) {{ logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -3233,6 +3237,8 @@ fill::@return: scope:[fill] from fill::@1
|
||||
(word) rem16u#31 ← phi( @16/(word) rem16u#32 )
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) LOGO#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte/signed word/word/dword/signed dword~) $1 ← (byte/word/signed word/dword/signed dword~) $0 * (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
kickasm(location (byte*) LOGO#0) {{ logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -3598,6 +3604,8 @@ render_logo::@return: scope:[render_logo] from render_logo::@12 render_logo::@5
|
||||
@end: scope:[] from @28
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(byte/word/signed word/dword/signed dword~) $0
|
||||
(byte/signed word/word/dword/signed dword~) $1
|
||||
(label) @16
|
||||
(label) @24
|
||||
(label) @25
|
||||
@ -4914,6 +4922,7 @@ Constant (const byte) mulu16_sel::select#3 = 0
|
||||
Constant (const byte) mulu16_sel::select#4 = 0
|
||||
Constant (const byte*) SCREEN#0 = ((byte*))1024
|
||||
Constant (const byte*) LOGO#0 = ((byte*))8192
|
||||
Constant (const byte/word/signed word/dword/signed dword) $0 = 6*40
|
||||
Constant (const word) XSIN_SIZE#0 = 512
|
||||
Constant (const word) fill::size#0 = 1000
|
||||
Constant (const word) fill::size#1 = 1000
|
||||
@ -4958,6 +4967,7 @@ Constant (const byte/word/signed word/dword/signed dword) render_logo::$71 = 40*
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
Constant (const signed word) sin16s_gen2::ampl#0 = sin16s_gen2::max#0-sin16s_gen2::min#0
|
||||
Constant (const dword) div32u16u::dividend#0 = PI2_u4f28#0
|
||||
Constant (const word/signed word/dword/signed dword) $1 = $0*8
|
||||
Constant (const signed word[XSIN_SIZE#0]) xsin#0 = { fill( XSIN_SIZE#0, 0) }
|
||||
Constant (const byte*) main::toD0181_screen#0 = SCREEN#0
|
||||
Constant (const byte*) main::toD0181_gfx#0 = LOGO#0
|
||||
@ -5346,6 +5356,8 @@ Constant inlined render_logo::$9 = (const byte*) SCREEN#0+(byte/signed byte/word
|
||||
Constant inlined render_logo::$72 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
Constant inlined render_logo::$71 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
Constant inlined sin16s_gen2::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Constant inlined $0 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
Constant inlined $1 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Constant inlined mul16u::b#0 = ((word))(const signed word) sin16s_gen2::ampl#0
|
||||
Constant inlined mul16s::b#0 = (const signed word) sin16s_gen2::ampl#0
|
||||
Constant inlined main::toD0181_$1#0 = ((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383
|
||||
|
@ -4,7 +4,7 @@ import "c64.kc"
|
||||
byte* SCREEN = $400;
|
||||
byte* LOGO = $2000;
|
||||
|
||||
kickasm(resource "logo.png", pc LOGO ) {{
|
||||
kickasm(resource "logo.png", pc LOGO, bytes 6*40*8 ) {{
|
||||
logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -157,6 +157,8 @@ Added resource src/test/java/dk/camelot64/kickc/test/kc/logo.png
|
||||
Adding pre/post-modifier *((var) main::$10) ← ++ *((var) main::$10)
|
||||
Adding pre/post-modifier (byte*) fill::addr ← ++ (byte*) fill::addr
|
||||
SYMBOLS
|
||||
(byte/word/signed word/dword/signed dword~) $0
|
||||
(byte/signed word/word/dword/signed dword~) $1
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
@ -445,6 +447,8 @@ vicSelectGfxBank::@return: scope:[vicSelectGfxBank] from vicSelectGfxBank
|
||||
@3: scope:[] from @2
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) LOGO ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte/signed word/word/dword/signed dword~) $1 ← (byte/word/signed word/dword/signed dword~) $0 * (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
kickasm(location (byte*) LOGO) {{ logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -581,8 +585,8 @@ Eliminating unused variable (byte) LIGHT_BLUE and assignment [63] (byte) LIGHT_B
|
||||
Eliminating unused variable (byte) LIGHT_GREY and assignment [64] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
Eliminating unused variable - keeping the call (void~) main::$3
|
||||
Eliminating unused variable - keeping the call (void~) main::$6
|
||||
Eliminating unused variable (byte*~) main::$8 and assignment [100] (byte*~) main::$8 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 999
|
||||
Eliminating unused variable (byte*~) main::$9 and assignment [101] (byte*~) main::$9 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 999
|
||||
Eliminating unused variable (byte*~) main::$8 and assignment [102] (byte*~) main::$8 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 999
|
||||
Eliminating unused variable (byte*~) main::$9 and assignment [103] (byte*~) main::$9 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 999
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
Removing empty block main::toD0181_@1
|
||||
@ -617,6 +621,8 @@ CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
@3: scope:[] from @begin
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) LOGO#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte/signed word/word/dword/signed dword~) $1 ← (byte/word/signed word/dword/signed dword~) $0 * (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
kickasm(location (byte*) LOGO#0) {{ logo:
|
||||
.var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
|
||||
.for (var y=0; y<6 ; y++)
|
||||
@ -732,6 +738,8 @@ fill::@return: scope:[fill] from fill::@1
|
||||
@end: scope:[] from @6
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(byte/word/signed word/dword/signed dword~) $0
|
||||
(byte/signed word/word/dword/signed dword~) $1
|
||||
(label) @3
|
||||
(label) @5
|
||||
(label) @6
|
||||
@ -920,10 +928,12 @@ Constant (const byte) WHITE#0 = 1
|
||||
Constant (const byte) DARK_GREY#0 = 11
|
||||
Constant (const byte*) SCREEN#0 = ((byte*))1024
|
||||
Constant (const byte*) LOGO#0 = ((byte*))8192
|
||||
Constant (const byte/word/signed word/dword/signed dword) $0 = 6*40
|
||||
Constant (const word) fill::size#0 = 40*25
|
||||
Constant (const word) fill::size#1 = 40*25
|
||||
Constant (const byte) main::ch#0 = 0
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
Constant (const word/signed word/dword/signed dword) $1 = $0*8
|
||||
Constant (const byte*) main::toD0181_screen#0 = SCREEN#0
|
||||
Constant (const byte*) main::toD0181_gfx#0 = LOGO#0
|
||||
Constant (const byte) main::$1 = VIC_MCM#0|VIC_CSEL#0
|
||||
@ -975,6 +985,8 @@ Constant inlined fill::size#1 = (byte/signed byte/word/signed word/dword/signed
|
||||
Constant inlined main::toD0181_$0#0 = ((word))(const byte*) SCREEN#0
|
||||
Constant inlined fill::size#0 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
Constant inlined main::toD0181_$1#0 = ((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383
|
||||
Constant inlined $0 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
Constant inlined $1 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Constant inlined main::$10 = (const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999
|
||||
Constant inlined main::toD0181_$6#0 = >((word))(const byte*) LOGO#0>>(byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Constant inlined main::toD0181_$7#0 = >((word))(const byte*) LOGO#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
|
Loading…
x
Reference in New Issue
Block a user