Skip to content

Commit

Permalink
fix order
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Nov 12, 2024
1 parent 572efa6 commit e6d7a38
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import hu.bme.mit.theta.core.type.anytype.Dereference
import hu.bme.mit.theta.core.type.anytype.Exprs.Dereference
import hu.bme.mit.theta.core.type.anytype.RefExpr
import hu.bme.mit.theta.core.type.anytype.Reference
import hu.bme.mit.theta.core.type.arraytype.ArrayType
import hu.bme.mit.theta.core.utils.TypeUtils.cast
import hu.bme.mit.theta.frontend.ParseContext
import hu.bme.mit.theta.frontend.transformation.model.types.complex.CComplexType
Expand Down Expand Up @@ -147,7 +148,15 @@ class ReferenceElimination(val parseContext: ParseContext) : ProcedurePass {
val initEdges = builder.initLoc.outgoingEdges
val newInitEdges =
initEdges.map {
it.withLabel(SequenceLabel(initLabels + it.label.getFlatLabels(), it.label.metadata))
val labels = it.label.getFlatLabels()
val sizeInit =
labels.find {
it is StmtLabel &&
it.stmt is AssignStmt<*> &&
it.stmt.varDecl.let { it.name == "__theta_ptr_size" && it.type is ArrayType<*, *> }
}
val newLabelOrder = listOfNotNull(sizeInit) + initLabels + labels.filter { it != sizeInit }
it.withLabel(SequenceLabel(newLabelOrder, it.label.metadata))
}
initEdges.forEach(builder::removeEdge)
newInitEdges.forEach(builder::addEdge)
Expand Down

0 comments on commit e6d7a38

Please sign in to comment.