Skip to content

Commit

Permalink
disable nlir
Browse files Browse the repository at this point in the history
  • Loading branch information
Dspil committed Dec 1, 2023
1 parent 9f38d64 commit 1eeff3a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/scala/viper/gobra/backend/ViperBackends.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ object ViperBackends {
if (config.z3APIMode) {
options = options ++ Vector(s"--prover=${Z3ProverAPI.name}")
}
if (config.disableNLRI) {
options = options ++ Vector(s"--disableNLRI")
}
val mceSiliconOpt = config.mceMode match {
case MCE.Disabled => "0"
case MCE.Enabled => "1"
Expand Down
21 changes: 21 additions & 0 deletions src/main/scala/viper/gobra/frontend/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@ class ScallopGobraConfig(arguments: Seq[String], isInputOptional: Boolean = fals
default = None,
noshort = true
)

val disableNLIR: ScallopOption[Boolean] = opt[Boolean](
name = "disableNLIR",
descr = "Disable non-linear integer arithmetics. Non compatible using Z3 via API or Carbon",
noshort = true,
default = Some(false)
)

lazy val packageTimeoutDuration: Duration = packageTimeout.toOption match {
case Some(d) => Duration(d)
case _ => Duration.Inf
Expand Down Expand Up @@ -770,6 +778,18 @@ class ScallopGobraConfig(arguments: Seq[String], isInputOptional: Boolean = fals
}
}

addValidation {
if (disableNLIR.toOption.contains(true)) {
if (z3APIMode.toOption.contains(true) || !isSiliconBasedBackend) {
Left("--disableNLIR is not compatible with Z3 via API or Carbon")
} else {
Right(())
}
} else {
Right(())
}
}


/** File Validation */
validateFilesExist(cutInput)
Expand Down Expand Up @@ -857,6 +877,7 @@ class ScallopGobraConfig(arguments: Seq[String], isInputOptional: Boolean = fals
parallelizeBranches = parallelizeBranches(),
conditionalizePermissions = conditionalizePermissions(),
z3APIMode = z3APIMode(),
disableNLIR = disableNLIR(),
mceMode = mceMode(),
enableLazyImports = enableLazyImports(),
noVerify = noVerify(),
Expand Down

0 comments on commit 1eeff3a

Please sign in to comment.