|
@ -48,8 +48,7 @@ export const generateSSA_Copy = (alloc: RegAlloc, ssa: AbsInsnCopy): Array |
|
|
case LocType.REGISTER: |
|
|
case LocType.REGISTER: |
|
|
if (isA(ssa.dest) && typeof ssa.source !== 'number' && ssa.source.type === LocType.VARIABLE) { |
|
|
if (isA(ssa.dest) && typeof ssa.source !== 'number' && ssa.source.type === LocType.VARIABLE) { |
|
|
output.push(`LD A, (${ssa.source.name})`) |
|
|
output.push(`LD A, (${ssa.source.name})`) |
|
|
|
|
|
|
|
|
// TODO: Remove check with peephole optimizer
|
|
|
|
|
|
|
|
|
// TODO: Remove check later with peephole optimizer
|
|
|
} else if (source !== ssa.dest.name) { |
|
|
} else if (source !== ssa.dest.name) { |
|
|
output.push(`LD ${ssa.dest.name}, ${source}`) |
|
|
output.push(`LD ${ssa.dest.name}, ${source}`) |
|
|
} |
|
|
} |
|
@ -57,8 +56,7 @@ export const generateSSA_Copy = (alloc: RegAlloc, ssa: AbsInsnCopy): Array |
|
|
|
|
|
|
|
|
case LocType.VARIABLE: |
|
|
case LocType.VARIABLE: |
|
|
if (source !== R8.A) { |
|
|
if (source !== R8.A) { |
|
|
console.log(source, ssa) |
|
|
|
|
|
throw new Error("unsupported") |
|
|
|
|
|
|
|
|
throw new Error(`can only deref address into A (had ${source})`) |
|
|
} |
|
|
} |
|
|
output.push(`LD (${ssa.dest.name}), A`) |
|
|
output.push(`LD (${ssa.dest.name}), A`) |
|
|
break |
|
|
break |
|
|