mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-19 00:29:29 +00:00
Now replacing in both control flow graph and symbol table per default.
This commit is contained in:
parent
f17422a564
commit
81e214cee3
@ -35,7 +35,7 @@ public class CompileLog {
|
||||
/**
|
||||
* Should the log be output to System.out while being built
|
||||
*/
|
||||
private boolean sysOut = false;
|
||||
private boolean sysOut = true;
|
||||
|
||||
public CompileLog() {
|
||||
this.log = new StringBuilder();
|
||||
|
@ -48,12 +48,10 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
|
||||
|
||||
// Perform alias replacement within the constant values inside the aliases
|
||||
replaceInValues(inline);
|
||||
// Replace all usages of the constants in the control flow graph
|
||||
// Replace all usages of the constants in the control flow graph or symbol table
|
||||
replaceVariables(inline);
|
||||
// Remove from symbol table
|
||||
deleteSymbols(inline.keySet());
|
||||
// Replace all usages of the constants in constant definitions inside the symbol table
|
||||
replaceInSymbolTable(inline);
|
||||
|
||||
for(ConstantRef constantRef : inline.keySet()) {
|
||||
getLog().append("Constant inlined " + constantRef.toString() + " = " + inline.get(constantRef).toString(getProgram()));
|
||||
@ -84,15 +82,6 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace any alias within the constant defintions inside the symbol table
|
||||
*
|
||||
* @param inline The replacements to make
|
||||
*/
|
||||
private void replaceInSymbolTable(Map<ConstantRef, ConstantValue> inline) {
|
||||
ProgramValueIterator.execute(getScope(), new AliasReplacer(inline));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all unnamed constants $1 = VIC+$20
|
||||
*
|
||||
|
@ -41,12 +41,12 @@ public abstract class Pass2SsaOptimization extends Pass1Base {
|
||||
public abstract boolean step();
|
||||
|
||||
/**
|
||||
* Replace all usages of variables in statements with aliases.
|
||||
* Replace all usages of variables in statements (or symbol table) with aliases.
|
||||
*
|
||||
* @param aliases Variables that have alias values.
|
||||
*/
|
||||
public void replaceVariables(final Map<? extends SymbolRef, ? extends RValue> aliases) {
|
||||
ProgramValueIterator.execute(getGraph(), new AliasReplacer(aliases));
|
||||
ProgramValueIterator.execute(getProgram(), new AliasReplacer(aliases));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1030,8 +1030,8 @@ Loop head: prepare::@1 tails: prepare::@1 blocks: prepare::@1 depth: 1
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(byte*) RASTER
|
||||
(byte*) SCREEN
|
||||
(byte[$0]) buffer1
|
||||
(byte[$1]) buffer2
|
||||
(byte[16*16]) buffer1
|
||||
(byte[16*16]) buffer2
|
||||
(void()) flip()
|
||||
(byte) flip::c
|
||||
(byte) flip::c#1 1501.5
|
||||
@ -1823,9 +1823,9 @@ FINAL SYMBOL TABLE
|
||||
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
|
||||
(byte[$0]) buffer1
|
||||
(byte[16*16]) buffer1
|
||||
(const byte[16*16]) buffer1#0 buffer1 = { fill( 16*16, 0) }
|
||||
(byte[$1]) buffer2
|
||||
(byte[16*16]) buffer2
|
||||
(const byte[16*16]) buffer2#0 buffer2 = { fill( 16*16, 0) }
|
||||
(void()) flip()
|
||||
(label) flip::@1
|
||||
|
@ -5,9 +5,9 @@
|
||||
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
|
||||
(byte[$0]) buffer1
|
||||
(byte[16*16]) buffer1
|
||||
(const byte[16*16]) buffer1#0 buffer1 = { fill( 16*16, 0) }
|
||||
(byte[$1]) buffer2
|
||||
(byte[16*16]) buffer2
|
||||
(const byte[16*16]) buffer2#0 buffer2 = { fill( 16*16, 0) }
|
||||
(void()) flip()
|
||||
(label) flip::@1
|
||||
|
Loading…
Reference in New Issue
Block a user