mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-08 14:37:40 +00:00
Improving ssa_mem variable support.
This commit is contained in:
parent
353d45ab65
commit
bd9a403b64
@ -531,8 +531,9 @@ public class Pass4CodeGeneration {
|
||||
setCurrentSegment(variable.getDataSegment(), asm);
|
||||
// Add any comments
|
||||
generateComments(asm, variable.getComments());
|
||||
if(!mainVar.getAsmName().equals(variable.getAsmName())) {
|
||||
asm.addLabelDecl(variable.getAsmName(), AsmFormat.getAsmConstant(program, new ConstantSymbolPointer(mainVar.getRef()), 99, scopeRef));
|
||||
final String mainAsmName = AsmFormat.getAsmConstant(program, new ConstantSymbolPointer(mainVar.getRef()), 99, scopeRef);
|
||||
if(!mainAsmName.equals(variable.getAsmName())) {
|
||||
asm.addLabelDecl(variable.getAsmName(), mainAsmName);
|
||||
} else {
|
||||
// Add any alignment
|
||||
Integer declaredAlignment = variable.getMemoryAlignment();
|
||||
|
@ -1,9 +1,6 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.model.CallGraph;
|
||||
import dk.camelot64.kickc.model.LiveRangeEquivalenceClass;
|
||||
import dk.camelot64.kickc.model.LiveRangeEquivalenceClassSet;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.*;
|
||||
import dk.camelot64.kickc.model.values.ScopeRef;
|
||||
import dk.camelot64.kickc.model.values.VariableRef;
|
||||
|
||||
@ -54,6 +51,9 @@ public class Pass4MemoryCoalesceCallGraph extends Pass2Base {
|
||||
List<LiveRangeEquivalenceClass> handledECs = new ArrayList<>();
|
||||
List<LiveRangeEquivalenceClass> allECs = new ArrayList<>(liveRangeEquivalenceClassSet.getEquivalenceClasses());
|
||||
for(LiveRangeEquivalenceClass thisEC : allECs) {
|
||||
// Skip main-memory registers
|
||||
if(Registers.RegisterType.MAIN_MEM.equals(thisEC.getRegister().getType()))
|
||||
continue;
|
||||
// Find all calling scopes - since we want to avoid coalescing with variables in these
|
||||
Set<ScopeRef> allCallingScopes = new LinkedHashSet<>();
|
||||
for(ScopeRef ecScope : getEquivalenceClassScopes(thisEC)) {
|
||||
@ -62,6 +62,9 @@ public class Pass4MemoryCoalesceCallGraph extends Pass2Base {
|
||||
// Go through the already handled equivalence classes - and try to coalesce with any that does not have variables from the calling scopes
|
||||
boolean coalesced = false;
|
||||
for(LiveRangeEquivalenceClass otherEC : handledECs) {
|
||||
// Skip main-memory registers
|
||||
if(Registers.RegisterType.MAIN_MEM.equals(otherEC.getRegister().getType()))
|
||||
continue;
|
||||
// Skip if there is a scope overlap
|
||||
if(isScopeOverlap(otherEC, allCallingScopes))
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user