From b875191022487ab11b21a52d02b238faea729bcf Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Fri, 9 Aug 2024 17:28:46 +1000 Subject: [PATCH] fixes --- src/main/scala/ir/Program.scala | 1 - src/main/scala/ir/transforms/ReplaceReturn.scala | 5 +---- src/main/scala/util/RunUtils.scala | 4 +--- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/scala/ir/Program.scala b/src/main/scala/ir/Program.scala index 060f93215..936949774 100644 --- a/src/main/scala/ir/Program.scala +++ b/src/main/scala/ir/Program.scala @@ -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) diff --git a/src/main/scala/ir/transforms/ReplaceReturn.scala b/src/main/scala/ir/transforms/ReplaceReturn.scala index 43d498cb5..da6af4c1d 100644 --- a/src/main/scala/ir/transforms/ReplaceReturn.scala +++ b/src/main/scala/ir/transforms/ReplaceReturn.scala @@ -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())) } }) diff --git a/src/main/scala/util/RunUtils.scala b/src/main/scala/util/RunUtils.scala index 31acf66bf..d007bb298 100644 --- a/src/main/scala/util/RunUtils.scala +++ b/src/main/scala/util/RunUtils.scala @@ -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")