Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
e615474
Jesse-interface-thesis-proj: Creates a basic GET API endpoint which d…
May 7, 2025
6865c35
Jesse-interface-thesis-proj: Boogie output moved into the BASIL/out f…
May 7, 2025
f867756
Merge branch 'main' of https://github.com/UQ-PAC/BASIL into Jesse-int…
May 7, 2025
dd776b7
Jesse-interface-thesis-proj: Information added about how to run diffe…
May 8, 2025
9128874
Jesse-Interface-thesis-proj: Adds code to display two version of the …
May 25, 2025
074e62b
Adds working front-end and functional IR-IR view using typescript and…
Jul 12, 2025
856a971
Jesse-interface-thesis-proj: Adds necessary API changes for front-end…
Jul 12, 2025
2bc0670
Jesse-interface-thesis-proj: Removed index.html file written in javas…
Jul 12, 2025
ae09fab
Merge branch 'main' of https://github.com/UQ-PAC/BASIL into Jesse-int…
Jul 12, 2025
23942d6
Jesse-interface-thesis-proj: Cleaned the ApiServer and made it take a…
Jul 17, 2025
7cd17f3
Jesse-interface-thesis-proj: Adds an API_BASE-URL
Jul 17, 2025
8a1cb98
Jesse-interface-thesis-proj: Formatting fixes
Jul 17, 2025
48607c3
Jesse-interface-thesis-proj: Formatting fixes
Jul 17, 2025
1db64ad
Jesse-interface-thesis-proj: Threading deadlock issue server side solved
Jul 18, 2025
152b587
Jesse-interface-thesis-proj: Adds Sidebar option to select different …
Jul 19, 2025
25aba0a
Jesse-interface-thesis-proj: Adds more logging to the IrServiceRoutes
Jul 19, 2025
89d3a62
Jesse-interface-thesis-proj: Removes bug in IrServiceRoutes
Jul 19, 2025
5198417
Jesse-interface-thesis-proj: Adds a basic CFG viewer mode
Jul 20, 2025
3b0498f
Jesse-interface-thesis-proj: Adds the basic CFG Viewers .css file
Jul 20, 2025
ce668bb
Jesse-interface-thesis-proj: Adds more logging on server side
Jul 21, 2025
53fc5f8
Jesse-interface-thesis-proj: Displays only header info for CFGs
Jul 21, 2025
9389cee
Jesse-interface-thesis-proj: Formatting fixes for CfgViewer.tsx
Jul 21, 2025
b3a9e1b
Jesse-interface-thesis-proj: Code colour added and double tap feature…
Jul 21, 2025
2ff1de0
Merge branch 'main' of https://github.com/UQ-PAC/BASIL into Jesse-int…
Jul 21, 2025
ea1869b
Jesse-interface-thesis-proj: Adds edge colour scheme to the CFG displ…
Jul 23, 2025
3da2abd
Jesse-interface-thesis-proj: Adds JSON files required for the frontend
Jul 24, 2025
1d4bab6
Jesse-interface-thesis-proj: Colours only borders on Nodes, highlight…
Jul 25, 2025
1e29209
Jesse-interface-thesis-proj: Removed unnecessary code for selecting p…
Jul 26, 2025
77babf2
Jesse-interface-thesis-proj: Adds the IR-CFG view
Jul 27, 2025
2e98096
Jesse-interface-thesis-proj: Fixes bug causing block-size of react-fl…
Jul 28, 2025
5c9ee11
Jesse-interface-thesis-proj: Procedure select buttons appear in the m…
Jul 31, 2025
9f6e50c
Jesse-interface-thesis-proj: Adds highlighting on Procedure dropdown …
Jul 31, 2025
4bfa62c
Jesse-interface-thesis-proj: Removes d2h css changes from button.css …
Jul 31, 2025
40237e3
Jesse-interface-thesis-proj: Removes commented out code from custom-n…
Aug 1, 2025
edeb8cd
Jesse-interface-thesis-proj: Moves custom-controls to diff-viewer.css
Aug 1, 2025
97143d0
Jesse-interface-thesis-proj: Renamed files to match general conventio…
Aug 1, 2025
423ba49
Jesse-interface-thesis-proj: Removes code duplication from IrServiceR…
Aug 1, 2025
518f32f
Jesse-interface-thesis-proj: Removes code duplication from IrServiceR…
Aug 1, 2025
f1e787f
Jesse-interface-thesis-proj: Adds a customBackground to CFGs
Aug 1, 2025
e8a0875
Jesse-interface-thesis-proj: Adds a customBackground to CFGs
Aug 1, 2025
a0ea16f
Jesse-interface-thesis-proj: Adds a customBackground to CFGs
Aug 1, 2025
8fb89c8
Jesse-interface-thesis-proj: Small TODO's added
Aug 1, 2025
3ce83ac
Jesse-interface-thesis-proj: Adds button option to expand all nodes a…
Aug 1, 2025
1b22617
Jesse-interface-thesis-proj: Fixes and updates the regex commands in …
Aug 2, 2025
bd21a7b
Jesse-interface-thesis-proj: adds feature to allow Side-bar width to …
Aug 2, 2025
1a782db
Jesse-interface-thesis-proj: Adds minimise and bring back button for …
Aug 2, 2025
6f2f8a0
Jesse-interface-thesis-proj: Displays error text when no nodes or edg…
Aug 3, 2025
f854cdb
Jesse-interface-thesis-proj: Imports of svg's allowed. Uses a svg as …
Aug 4, 2025
cce3b05
Jesse-interface-thesis-proj: Adds a settings Modal that contains a no…
Aug 7, 2025
b92c144
Jesse-interface-thesis-proj: Starts applying dark and light mode to e…
Aug 8, 2025
93cfca0
Jesse-interface-thesis-proj: Adds a initial dark mode colour scheme f…
Aug 12, 2025
b87d5b2
Jesse-interface-thesis-proj: Adds final dark mode colour scheme for t…
Aug 12, 2025
b74f456
Jesse-interface-thesis-proj: Adds dark mode colour scheme for the Com…
Aug 13, 2025
03b8cf4
Jesse-interface-thesis-proj: CFG height is expandable on IR-CFG viewer
Aug 13, 2025
4c73904
Merge branch 'main' of https://github.com/UQ-PAC/BASIL into Jesse-int…
Aug 13, 2025
b34c242
Jesse-interface-thesis-proj: Procedure selection saved in App.tsx
Aug 13, 2025
466b725
Jesse-interface-thesis-proj: Adds several more epochs
Aug 13, 2025
6a06a19
Jesse-interface-thesis-proj: Cursor stays as default image in DiffCom…
Aug 22, 2025
0318b08
Jesse-interface-thesis-proj: Scala docs refactored in IrServiceRoutes…
Aug 22, 2025
aab9262
Jesse-interface-thesis-proj: Expand and collapse icon changes to a svg
Aug 22, 2025
6b6fa5d
Jesse-interface-thesis-proj: Color scheme for dark mode created
Aug 22, 2025
35544f1
Jesse-interface-thesis-proj: Color scheme for dark mode created
Aug 22, 2025
ff9e420
Jesse-interface-thesis-proj: difference between green node colour is …
Aug 22, 2025
c850d09
Jesse-interface-thesis-proj: Allows shift selection of multiple epochs
Aug 24, 2025
c9cead2
Jesse-interface-thesis-proj: Fixes bugs in IR-CFG with IR colour sche…
Aug 24, 2025
2d844da
Jesse-interface-thesis-proj: Removes TODO
Aug 24, 2025
124f89c
Jesse-interface-thesis-proj: Removes TODO
Aug 24, 2025
0753098
Jesse-interface-thesis-proj: Allow code in IR-CFG to overflow and all…
Aug 24, 2025
9654bf7
Jesse-interface-thesis-proj: Adds line numbers to the IR-CFG code view
Aug 31, 2025
64558f4
Jesse-interface-thesis-proj: Syntax highlighting remains with procedu…
Aug 31, 2025
7fcd0b9
Jesse-interface-thesis-proj: Scans folders to find files under src/te…
Sep 13, 2025
1360e08
Jesse-interface-thesis-proj: Allows reload of config files upon selec…
Sep 14, 2025
f8dfe05
Jesse-interface-thesis-proj: Removes unused imports from IrServiceRoutes
Sep 14, 2025
cef565d
Jesse-interface-thesis-proj: Condensed and cleaned ApiServer.scala file
Sep 15, 2025
c9e3ad9
Jesse-interface-thesis-proj: Adds docs onto the new routes
Sep 15, 2025
aa5f15a
Jesse-interface-thesis-proj: Removes the second generateIRAsync
Sep 18, 2025
4fba3e1
Jesse-interface-thesis-proj: Adds functionality to select a config fi…
Sep 21, 2025
18f8748
Jesse-interface-thesis-proj: Edits the modal pop-ups, uses DRY princi…
Sep 22, 2025
6602d54
Jesse-interface-thesis-proj: Sidebar collapses automatically when dra…
Sep 22, 2025
c65d9c7
Jesse-interface-thesis-proj: Adds a nicer button display for Config s…
Sep 22, 2025
3c37a69
Jesse-interface-thesis-proj: Adds warning text colour to errorModals
Sep 23, 2025
647e73a
Jesse-interface-thesis-proj: Uses Prettier to autoformat frontEnd Rea…
Sep 24, 2025
2e4481f
Jesse-interface-thesis-proj: Moves files into relative folders
Sep 25, 2025
5c5dc18
Jesse-interface-thesis-proj: Moves API calls from App.tsx into separa…
Sep 28, 2025
d006504
Jesse-interface-thesis-proj: Moves API calls from CombinedViewer.tsx …
Sep 28, 2025
b3c894e
Jesse-interface-thesis-proj: Moves API calls from CfgViewer.tsx.tsx i…
Sep 28, 2025
2602974
Jesse-interface-thesis-proj: Moves API calls from DiffViewer.tsx into…
Sep 28, 2025
a16bda8
Jesse-interface-thesis-proj: Formatting changes
Sep 28, 2025
0396a99
Jesse-interface-thesis-proj: Formatting changes
Sep 28, 2025
924f533
Jesse-interface-thesis-proj: Formatting changes for scala code (API s…
Sep 28, 2025
a3504c4
Jesse-interface-thesis-proj: useCombinedData hook added
Sep 29, 2025
ba85315
Jesse-interface-thesis-proj: ConfigurationModal added for config sele…
Oct 13, 2025
43c901e
Jesse-interface-thesis-proj: Default config file supplied, uses previ…
Oct 13, 2025
83ae99b
Jesse-interface-thesis-proj: Colour code schema changes and removal o…
Oct 16, 2025
68ee0d3
Jesse-interface-thesis-proj: Adds bottom padding onto the epoch list
Oct 19, 2025
e97efc8
Jesse-interface-thesis-proj: Formatting complete
Oct 23, 2025
223c6fc
Jesse-interface-thesis-proj: Formatting changes
Oct 26, 2025
14d53b5
Jesse-interface-thesis-proj: Updated light mode code-colour scheme
Oct 27, 2025
7b429d0
Jesse-interface-thesis-proj: Adds Development Style Guide into the ap…
Nov 3, 2025
32a5235
Jesse-interface-thesis-proj: System colouring disabled
Nov 3, 2025
203eb3f
Jesse-interface-thesis-proj: DiffViewer converted to smart hook dumb …
Nov 5, 2025
d95139d
Jesse-interface-thesis-proj: Removes System colour scheme as an optio…
Nov 13, 2025
2a3e422
Jesse-interface-thesis-proj: Toggle Buttons in dark mode never have a…
Nov 13, 2025
1c299bf
Jesse-interface-thesis-proj: useDirectory hook added to simplify App.tsx
Nov 13, 2025
a79f524
Jesse-interface-thesis-proj: useProcedures hook added to simplify App…
Nov 13, 2025
f1e4a3d
Jesse-interface-thesis-proj: useAnalysisStatus hook added to simplify…
Nov 13, 2025
9602190
Jesse-interface-thesis-proj: useEpochs hook added to simplify App.tsx
Nov 13, 2025
ebc96c9
Jesse-interface-thesis-proj: AppContext Provider added to simplify Ap…
Nov 13, 2025
9c0091e
Jesse-interface-thesis-proj: adds more to AppContext Provider to simp…
Nov 13, 2025
fedc2f4
Jesse-interface-thesis-proj: adds more to AppContext Provider to simp…
Nov 13, 2025
b214f81
Jesse-interface-thesis-proj: Prettier run + command for Prettier adde…
Nov 13, 2025
174422b
Jesse-interface-thesis-proj: PostStatus is reset to null after modal …
Nov 13, 2025
8341506
Jesse-interface-thesis-proj: Removes todos from App.css
Nov 13, 2025
f2fd6a7
Jesse-interface-thesis-proj: Removes todos from index.css
Nov 13, 2025
097c163
Jesse-interface-thesis-proj: Removes todos from frontend code
Nov 13, 2025
9f5a42e
Jesse-interface-thesis-proj: Allows scrolling code on IR-CFG view
Nov 13, 2025
bc389a3
Jesse-interface-thesis-proj: Removes ConfigScanner class
Nov 13, 2025
886ae69
Merge branch 'main' of https://github.com/UQ-PAC/BASIL into Jesse-int…
Nov 13, 2025
d9603f3
Jesse-interface-thesis-proj: md updated
Nov 13, 2025
3ee8e8d
Jesse-interface-thesis-proj: md updated
Nov 13, 2025
00ca8e1
Jesse-interface-thesis-proj: text colour changes
Nov 13, 2025
be74b19
Jesse-interface-thesis-proj: text colour changes for warnings
Nov 13, 2025
e4ae375
Jesse-interface-thesis-proj: formatting applied
Nov 13, 2025
9592afe
Jesse-interface-thesis-proj: formatting applied scala side
Nov 13, 2025
4b8f4b1
Jesse-interface-thesis-proj: removes TODOs on Scala side
Nov 13, 2025
d73df83
fix test compile and reformat
agle Nov 14, 2025
a4fac87
add back imports removed by autoformatter
agle Nov 14, 2025
28630e6
fix mainclass config
agle Nov 14, 2025
1b940be
fix apiserver imports
agle Nov 14, 2025
cd3dfc3
rename API package to avoid bug in scaladoc
agle Nov 16, 2025
6fa5ec4
doc comment
agle Nov 17, 2025
a848f52
Jesse-interface-thesis-proj: md file updates. Changes run name to ser…
Dec 9, 2025
27504c3
Jesse-interface-thesis-proj: md file updates. Modifies the title and …
Dec 9, 2025
6a0a130
Jesse-interface-thesis-proj: a free basil svg image is used as the logo
Dec 9, 2025
cee82c3
Jesse-interface-thesis-proj: Settings allows you to select the logo i…
Dec 14, 2025
f86880d
Jesse-interface-thesis-proj: Removes commit warning
Dec 14, 2025
ad79fac
Jesse-interface-thesis-proj: Adds useLogoUrl hook to refactor Header.tsx
Dec 14, 2025
cb8783a
Jesse-interface-thesis-proj: Adds useLogoSettingsForm hook to refacto…
Dec 14, 2025
48cd3e2
Jesse-interface-thesis-proj: Adds local storage saving to remember th…
Dec 14, 2025
d751c8d
Jesse-interface-thesis-proj: Moves logo related hooks under logo subd…
Dec 14, 2025
72daa65
Jesse-interface-thesis-proj: Adds modal-settings.css file
Dec 14, 2025
14824db
Jesse-interface-thesis-proj: Adds modal-settings.css file
Dec 14, 2025
7d8c020
Jesse-interface-thesis-proj: Changes host binding to 127.0.0.1 - loop…
Dec 16, 2025
b2ad294
Jesse-interface-thesis-proj: Removes graphvizWASM
Dec 16, 2025
bf5a619
Jesse-interface-thesis-proj: removed Graph Attributes from the block …
Dec 16, 2025
8f99f0a
Jesse-interface-thesis-proj: formatting applied
Dec 16, 2025
59c78e7
Jesse-interface-thesis-proj: allows configurable host and port throug…
Dec 16, 2025
c75be6d
Jesse-interface-thesis-proj: remove wildcard imports from ApiServer
Dec 16, 2025
b90ae05
Jesse-interface-thesis-proj: Defines cats-effect documentation path i…
Dec 16, 2025
8bedfca
Jesse-interface-thesis-proj: Reverts back as the last change did not …
Dec 16, 2025
9899075
Jesse-interface-thesis-proj: Adds doc external mapping for cats-effec…
Dec 16, 2025
4c26b16
Jesse-interface-thesis-proj: Reverts the commit: Adds doc external ma…
Dec 17, 2025
cc5575c
ci: exclude cats-effect ExitCode warning
katrinafyi Dec 17, 2025
55408f7
ci: fix bash syntax
katrinafyi Dec 17, 2025
8f13f20
Jesse-interface-thesis-proj: Graphs are inputted as JSON instead of D…
Feb 7, 2026
8a6d585
Jesse-interface-thesis-proj: fixes bug on expand all button
Feb 7, 2026
8b4795a
Jesse-interface-thesis-proj: removes duplication
Feb 7, 2026
da40f2e
Jesse-interface-thesis-proj: formatting
Feb 7, 2026
6417bce
Merge branch 'Jesse-interface-thesis-proj' of https://github.com/UQ-P…
Feb 7, 2026
7cfe8e1
Jesse-interface-thesis-proj: Custom node updates to reapply custom sy…
Feb 15, 2026
9a1015b
Jesse-interface-thesis-proj: CFG architectural changes, IR-IR shows p…
Feb 16, 2026
4a188f4
Jesse-interface-thesis-proj: Lag in CFGs removed. Colour of Proc butt…
Feb 18, 2026
25a2cd8
Jesse-interface-thesis-proj: Collapse fitView works and max and min z…
Feb 18, 2026
7bbcb19
Jesse-interface-thesis-proj: Removes forced open !
Feb 18, 2026
e8d1927
Jesse-interface-thesis-proj: removal of unused API endpoint getProced…
Feb 18, 2026
d684e65
Jesse-interface-thesis-proj: Formatting of backend and frontend
Feb 18, 2026
bc8e03e
remove frontend: moved to repo
agle Mar 3, 2026
69ebcfd
conditionally stash snapshots
agle Mar 3, 2026
08abec7
Merge branch 'main' of github.com:UQ-PAC/BASIL into Jesse-interface-t…
agle Mar 3, 2026
256b273
serve static from basil
agle Mar 3, 2026
9381e6f
update-docs
agle Mar 3, 2026
b29d718
fmt
agle Mar 3, 2026
d08c06e
fixes
agle Mar 3, 2026
250ff21
doc
agle Mar 4, 2026
a6adaf7
Update ApiServer.scala
katrinafyi Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Makefile text eol=lf
*.mk text eol=lf
*.md5sum text eol=lf linguist-generated

src/test/make/bap-normalise.py text eol=lf
src/test/make/bap-normalise.py text eol=lf

src/frontend/* linguist-generated
3 changes: 2 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ jobs:
with:
path: ${{ steps.allDocs.outputs.dir }}

# TODO: This excludes the ExitCode warning from decline. Remove after https://github.com/typelevel/cats-effect/issues/4532
- run: |
! grep --after-context=3 'Error\|Warning' out/scalaDocGenerated.log
! grep -v effect/shared/src/main/scala/com/monovore/decline/effect/CommandIOApp out/scalaDocGenerated.log | grep --after-context=3 'Error\|Warning'
name: check for scaladoc warnings

- id: docArgs
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ examplesold/
src/test/scala/dump/
src/test/analysis/dump/
*.gtirb
# Ignore all JSON bug a select few for frontend
*.json
!/frontend/package.json
!/frontend/package-lock.json
!/frontend/tsconfig.app.json
!/frontend/tsconfig.json
!/frontend/tsconfig.node.json
src/test/*.svg
src/test/*.md.part
src/test/summary-*.md
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "src/frontend"]
path = src/frontend
url = https://github.com/UQ-PAC/basil-gui-frontend.git
branch = static
17 changes: 14 additions & 3 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,19 @@ object `package` extends ScalaModule with BasilDocs with BasilVersion with Scala
val aslpOffline = mvn"io.github.uq-pac::lifter:0.1.0"
val javaSmt = mvn"org.sosy-lab:java-smt:5.0.0"
val javaSmtZ3 = mvn"org.sosy-lab:javasmt-solver-z3:4.14.0"

override def mvnDeps = Seq(scalactic, sourceCode, mainArgs, upickle, aslpOffline, javaSmt, javaSmtZ3)
val catsEffect = mvn"org.typelevel::cats-effect:3.5.4"
val http4sVersion = "1.0.0-M40"
val http4Dsl = mvn"org.http4s::http4s-dsl::$http4sVersion"
val http4Circe = mvn"org.http4s::http4s-circe::$http4sVersion"
val circleGeneric = mvn"io.circe::circe-generic:0.14.6"
val slf4j = mvn"org.slf4j:slf4j-simple:2.0.12"
val scalaXml = mvn"org.scala-lang.modules::scala-xml:2.1.0"
val emberServer = mvn"org.http4s::http4s-ember-server::$http4sVersion"
val log4cats = mvn"org.typelevel::log4cats-slf4j:2.6.0"
val declineEffect = mvn"com.monovore::decline-effect:2.2.0"

override def mvnDeps = Seq(scalactic, sourceCode, mainArgs, upickle, aslpOffline, javaSmt, javaSmtZ3, catsEffect, http4Dsl,
http4Circe, circleGeneric, slf4j, scalaXml, emberServer, log4cats, declineEffect)

override def repositoriesTask = Task.Anon {
super.repositoriesTask() :+ MavenRepository(
Expand All @@ -63,7 +74,7 @@ object `package` extends ScalaModule with BasilDocs with BasilVersion with Scala
)
}

override def mainClass = Some("Main")
override def mainClass = Some("basil.main.Main")

override def moduleDir = BuildCtx.workspaceRoot / "src"

Expand Down
4 changes: 3 additions & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
- [Common Development Tasks](development/readme.md) Explanation of common development tasks
- [Version numbering](development/versioning.md) Use of the version number system, including how to cut a release.
- [Profiling](development/profiling.md)
- [Decompiler User Interface](development/api-information.md) Guide to using the interface
to visualise transform passes

# Devleopment Guidelines
# Development Guidelines

- [Testing](development/testing.md)
- [Integration (system) tests](development/integration-tests.md)
Expand Down
36 changes: 36 additions & 0 deletions docs/src/development/api-information.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Transform Viewer GUI

The frontend project is stored in a separate repository: [UQ-PAC/basil-gui-frontend](https://github.com/UQ-PAC/basil-gui-frontend).
It is included here as a git submodule, to use the gui ensure this submodule is checked out:

```
git submodule init
git submodule update
```

Then run basil with the server entrypoint:

```shell
./mill runMain server.ApiServer <reguar basil args>
```

And open `http://localhost:8080` in a browser.

## Adding Additional Snapshots

Most epoch logic is placed in src/main/scala/util/RunUtils.scala or a related helper.

The collectedSnapshots arrabuffer is passed through runutils, the following can be used to wrap
a transform function so that it logs the diff (this is automatically disabled when the server is
not runnign but the transform is still applied).

```scala
logTransform[T](collectedSnapshots)("unique-transform-name", transformFunc: IRContext => T)(ctx)
```


### Naming Conventions

The epoch name (e.g., "name_of_the_new_transform") must be a unique and URI-compatible (not contain "/"),
string that accurately describes the transformation that just took place.
This name is what the front-end uses to identify and fetch the corresponding program state pair.
1 change: 1 addition & 0 deletions src/frontend
Submodule frontend added at e88ede
21 changes: 14 additions & 7 deletions src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// package scala
package basil.main

import gtirb.GTIRBReadELF
import ir.{FrontendMode, IRLoading}
Expand Down Expand Up @@ -267,15 +267,15 @@ object Main {
noDebug: Flag
)

def main(args: Array[String]): Unit = {
def configOfArgs(args: Array[String]): (Config, BASILConfig) = {
val parser = ParserForClass[Config]
val parsed = parser.constructEither(args.toSeq, autoPrintHelpAndExit = None)

val conf = parsed match {
case Right(r) => r
case Left(l) =>
println(l)
return
throw IllegalArgumentException()
}

if (conf.help.value) {
Expand All @@ -285,12 +285,12 @@ object Main {
println(" -i prog.gtirb --lifter --verify -o prog.bpl # output prog.bpl and run Boogie")
println(" -i prog.gtirb --lifter --dsa= --transform-memory # simplify and partition mem into regions")
println(" --load-directory-gtirb <dir> --interpret # interpret the program")
return
throw IllegalArgumentException()
}

if (conf.version.value) {
println(programNameVersionHeader)
return
throw IllegalArgumentException()
}

Logger.setLevel(LogLevel.INFO, false)
Expand Down Expand Up @@ -423,7 +423,7 @@ object Main {

// skip writing files if the given path is an empty string. this checks compatibility and exits.
if (relfOut.trim.isEmpty)
return
throw IllegalArgumentException()

relf match {
case Some(relf) =>
Expand All @@ -440,7 +440,7 @@ object Main {
case Some(relf) => writeToFile(relf.sorted.toScala, relfOut + "-gtsrelf.scala")
case None => Logger.warn(s"Failed to load GTIRB information, $relfOut-gtsrelf.scala not written")
}
return
throw IllegalArgumentException()
}

// patch in gtirb-as-relf if directed or if relf is omitted but we are using gtirb.
Expand Down Expand Up @@ -489,6 +489,13 @@ object Main {
memoryTransform = conf.memoryTransform.value,
assertCalleeSaved = calleeSaved
)
(conf, q)
}

def main(args: Array[String]): Unit = {
val (conf, q) =
try configOfArgs(args)
catch case _: IllegalArgumentException => return

Logger.info(programNameVersionHeader)

Expand Down
69 changes: 45 additions & 24 deletions src/main/scala/ir/transforms/SimplifyPipeline.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,65 @@ package ir.transforms

import analysis.{AnalysisManager, Interval as _, *}
import ir.*
import ir.dsl.IRToDSL
import server.IREpoch
import translating.PrettyPrinter.*
import util.RunUtils.logTransform
import util.{DebugDumpIRLogger, Logger, PerformanceTimer}

import java.io.{BufferedWriter, File, FileWriter}

def doSimplify(ctx: IRContext, dumpILToPath: Option[String] = None): Unit = {
import scala.collection.mutable.ArrayBuffer

def doSimplify(
ctx: IRContext,
dumpILToPath: Option[String] = None,
collectedSnapshots: Option[ArrayBuffer[IREpoch]] = None
): Unit = {
// writeToFile(dotBlockGraph(program, program.filter(_.isInstanceOf[Block]).map(b => b -> b.toString).toMap), s"blockgraph-before-simp.dot")
Logger.info("[!] Running Simplify")
val timer = PerformanceTimer("Simplify")
val program = ctx.program

IrreducibleLoops.transform_all_and_update(program)
logTransform(collectedSnapshots)("irreducible_loops", ctx => IrreducibleLoops.transform_all_and_update(ctx.program))(
ctx
)

for (p <- program.procedures) {
p.normaliseBlockNames()
}
logTransform(collectedSnapshots)("normalise block names", _.program.procedures.foreach(p => p.normaliseBlockNames()))(
ctx
)

ctx.program.sortProceduresRPO()

transforms.liftSVComp(ctx.program)
val beforeLiftSVComp = IRToDSL.convertProgram(ctx.program).resolve
logTransform(collectedSnapshots)("lift_svcomp", c => transforms.liftSVComp(c.program))(ctx)

dumpILToPath.foreach { s =>
DebugDumpIRLogger.writeToFile(File(s"${s}_il-before-simp.il"), pp_prog(program))
}

transforms.applyRPO(program)

// example of printing a simple analysis

transforms.removeEmptyBlocks(program)
transforms.coalesceBlocks(program)
transforms.removeEmptyBlocks(program)

// transforms.coalesceBlocksCrossBranchDependency(program)
logTransform(collectedSnapshots)(
"simplifyCFG",
c => {
transforms.removeEmptyBlocks(c.program)
transforms.coalesceBlocks(c.program)
transforms.removeEmptyBlocks(c.program)
}
)(ctx)

Logger.info("[!] Simplify :: DynamicSingleAssignment")
dumpILToPath.foreach { s =>
DebugDumpIRLogger.writeToFile(File(s"${s}_il-before-dsa.il"), pp_prog(program))
}

transforms.OnePassDSA().applyTransform(program)
logTransform(collectedSnapshots)("SSA-DSA", c => transforms.OnePassDSA().applyTransform(c.program))(ctx)

// fixme: this used to be a plain function but now we have to supply an analysis manager!
transforms.inlinePLTLaunchpad(ctx, AnalysisManager(ctx.program))
logTransform(collectedSnapshots)("inline PLT", c => transforms.inlinePLTLaunchpad(ctx, AnalysisManager(ctx.program)))(
ctx
)

transforms.removeEmptyBlocks(program)
logTransform(collectedSnapshots)("removeEmptyBlock", c => transforms.removeEmptyBlocks(c.program))(ctx)

dumpILToPath.foreach { s =>
DebugDumpIRLogger.writeToFile(File(s"${s}_il-after-dsa.il"), pp_prog(program))
Expand Down Expand Up @@ -76,12 +90,19 @@ def doSimplify(ctx: IRContext, dumpILToPath: Option[String] = None): Unit = {
// assert(program.procedures.forall(transforms.rdDSAProperty))

Logger.info("Copyprop Start")
transforms.copyPropParamFixedPoint(program, ctx.globalOffsets)

transforms.fixupGuards(program)
transforms.removeDuplicateGuard(program)

transforms.liftLinuxAssertFail(ctx)
logTransform(collectedSnapshots)(
"linear expr prop",
c => { transforms.copyPropParamFixedPoint(c.program, c.globalOffsets); c }
)(ctx)

logTransform(collectedSnapshots)(
"simplify guards",
c => {
transforms.fixupGuards(c.program)
transforms.removeDuplicateGuard(c.program)
}
)(ctx)
logTransform(collectedSnapshots)("lift linux assert", transforms.liftLinuxAssertFail)(ctx)

// assert(program.procedures.forall(transforms.rdDSAProperty))

Expand Down
Loading