Skip to content

Commit 4f19885

Browse files
committed
Replaced labels with stack locations
1 parent 1f64348 commit 4f19885

6 files changed

Lines changed: 159 additions & 57 deletions

File tree

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/deep/decaf/low/amd64/CFGToLow.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package deep.decaf.low.amd64
33
import deep.decaf.low.*
44
import java.lang.IllegalStateException
55

6-
fun methodCFGToLow(name: String, cfg: CFG, blockCountStart: Int = 0) {
6+
fun methodCFGToLow(name: String, cfg: CFG, blockCountStart: Int = 0, info: AsmProgramInfo) {
77
val blocks = mutableListOf<Block>()
88
var stackSize = 0
99
var blockCounts = blockCountStart
@@ -16,7 +16,7 @@ fun methodCFGToLow(name: String, cfg: CFG, blockCountStart: Int = 0) {
1616
when (node) {
1717
is RegularNode -> {
1818
for (statement in node.statements) {
19-
block.instructions.addAll(irStatementToLow(statement))
19+
block.instructions.addAll(irStatementToLow(statement, info))
2020
}
2121
if (node.next != null) {
2222
convert(node.next!!, block)
@@ -33,7 +33,7 @@ fun methodCFGToLow(name: String, cfg: CFG, blockCountStart: Int = 0) {
3333
}
3434
}
3535
is ConditionalNode -> {
36-
val instructions = irExprToLow(node.condition)
36+
val instructions = irExprToLow(node.condition, info)
3737
val res = (instructions.last() as MoveInstruction).dest
3838
blockCounts++
3939
val newLabel = "BLOCK$blockCounts"

0 commit comments

Comments
 (0)