Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ailrst committed Aug 9, 2024
1 parent b7378b6 commit b875191
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/main/scala/ir/Program.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ class Procedure private (
}

def addBlocks(block: Block): Block = {
block.parent = this
if (!_blocks.contains(block)) {
block.parent = this
_blocks.add(block)
Expand Down
5 changes: 1 addition & 4 deletions src/main/scala/ir/transforms/ReplaceReturn.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class ReplaceReturns extends CILVisitor {
def addReturnBlocks(p: Program, toAll: Boolean = false) = {
p.procedures.foreach(p => {
val containsReturn = p.blocks.map(_.jump).find(_.isInstanceOf[Return]).isDefined
if (toAll && p.blocks.isEmpty && p.entryBlock.isEmpty && p.returnBlock.isEmpty) {
p.returnBlock = (Block(label=p.name + "_basil_return",jump=Return()))
p.entryBlock = (Block(label=p.name + "_basil_entry",jump=GoTo(p.returnBlock.get)))
} else if (p.returnBlock.isEmpty && (toAll || containsReturn)) {
if (p.returnBlock.isEmpty && (toAll || containsReturn)) {
p.returnBlock = p.addBlocks(Block(label=p.name + "_basil_return",jump=Return()))
}
})
Expand Down
4 changes: 1 addition & 3 deletions src/main/scala/util/RunUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,8 @@ object StaticAnalysis {
mmm.logRegions(memoryRegionContents)

// turn fake procedures into diamonds
transforms.addReturnBlocks(ctx.program, true) // add return to all blocks because IDE solver expects it
Logger.info("[!] Running VSA")
val vsaSolver =
ValueSetAnalysisSolver(IRProgram, globalAddresses, externalAddresses, globalOffsets, subroutines, mmm, constPropResult)
val vsaSolver = ValueSetAnalysisSolver(IRProgram, globalAddresses, externalAddresses, globalOffsets, subroutines, mmm, constPropResult)
val vsaResult: Map[CFGPosition, LiftedElement[Map[Variable | MemoryRegion, Set[Value]]]] = vsaSolver.analyze()

Logger.info("[!] Running Interprocedural Live Variables Analysis")
Expand Down

0 comments on commit b875191

Please sign in to comment.