Commit Graph

126 Commits

Author SHA1 Message Date
Ryan Scott
4db0341e0a Bump submodules to allow building with what4-1.6.*
This bumps the `what4` submodule to the 1.6.* version series and updates the
`.cabal` files in the `macaw` repo accordingly.

Bumping the `what4` submodule also requires bringing in corresponding changes
in the `crucible`, `llvm-pretty`, and `llvm-pretty-bc-parser` submodules, so I
have done that as well.
2024-06-13 04:25:12 -04:00
Valentin Robert
d2f7028e2d favor ArchAddrWidth and ArchSegmentOff type synonyms 2023-12-11 09:53:53 -05:00
Ryan Scott
c3c5330f7f Don't use deprecated TypeInType extension
As of GHC 8.6, `TypeInType` is simply an alias for `DataKinds` + `PolyKinds`.
And as of GHC 9.6, `TypeInType` is deprecated. Let's just remove our uses of
`TypeInType` to avoid deprecation warnings.
2023-08-21 08:16:10 -04:00
Ryan Scott
984f7cb368 Support building with GHC 9.6
This patch contains a handful of tweaks needed to make the libraries in the
`macaw` repo build with GHC 9.6:

* GHC 9.6 bundles `mtl-2.3.*`, which no longer re-exports `Control.Monad`,
  `Control.Monad.Trans`, and similar modules from `mtl`-related modules. To
  accommodate this, various imports have been made more explicit.
* I have disambiguated a use of `Data.Parameterized.NatRepr.withKnownNat` in
  `macaw-aarch32` to avoid clashing with a newly exported function of the same
  name in `GHC.TypeNats`.
* I have bumped various upper version bounds on `doctest`,
  `optparse-applicative`, and `what4` to allow building these libraries with
  GHC 9.6.
* I have bumped the following submodules to bring in GHC 9.6–related changes:
  * `asl-translator`: GaloisInc/asl-translator#53
  * `crucible`: GaloisInc/crucible#1102
  * `dwarf`: GaloisInc/dwarf#6
  * `elf-edit`: GaloisInc/elf-edit#38
  * `flexdis86`: GaloisInc/flexdis86#54
  * `grift`: GaloisInc/grift#9
  * `llvm-pretty`: elliottt/llvm-pretty#112
  * `llvm-pretty-bc-parser`: GaloisInc/llvm-pretty-bc-parser#225
  * `semmc`: GaloisInc/semmc#80
  * `what4`: GaloisInc/what4#235
2023-08-21 08:16:10 -04:00
Ryan Scott
2ce038c086 Whitespace only 2023-08-21 08:16:10 -04:00
Ryan Scott
7e346081a5 Fix -Wtype-equality-requires-operators warnings
GHC 9.4 adds `-Wtype-equality-requires-operators` to `-Wall`, which warns about
certain uses of type equalities that are not forward-compatible with planned
changes in GHC. See [this
section](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.4?version_id=b60e52482a666d25638d59cd7e86851ddf971dc1#-is-now-a-type-operator)
of the GHC 9.4 Migration Guide. These warnings are easily fixed by enabling the
`TypeOperators` extension.
2023-04-18 15:17:23 -04:00
Ryan Scott
e55add0b51 Support building with GHC 9.4
This contains a variety of tweaks needed to make the libraries in the
`macaw` repo build with GHC 9.4:

* `ST` no longer has a `MonadFail` instance. See
  [this section](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.4?version_id=b60e52482a666d25638d59cd7e86851ddf971dc1#st-is-no-longer-an-instance-of-monadfail)
  of the GHC 9.4 Migration Guide. To adapt to this change, I had to change some
  uses of `fail` to `panic`, and I also had to avoid some partial pattern
  matches in `do`-notation to avoid incurring `MonadFail (ST s)` constraints.
* GHC 9.4 is pickier about undecidable superclass checking. As such, I needed to
  explicitly enable `UndecidableSuperClasses` in a handful of places.
* The following submodule changes were brought in to support building with
  GHC 9.4:
  * `asl-translator`: GaloisInc/asl-translator#51
  * `bv-sized`: GaloisInc/bv-sized#27
  * `bv-sized-float`: GaloisInc/bv-sized-float#4
  * `crucible`: GaloisInc/crucible#1073

    (This also requires bumping the `llvm-pretty`, `llvm-pretty-bc-parser`,
    and `what4` submodules as a side effect)
  * `dismantle`: GaloisInc/dismantle#40
  * `grift`: GaloisInc/grift#8
  * `macaw-loader`: GaloisInc/macaw-loader#17
  * `semmc`: GaloisInc/semmc#79
2023-04-18 15:17:23 -04:00
Ryan Scott
e6a3fb0b87 Bump what4 submodule to version 1.4
The only other changes required are (1) deleting an unused dependency on
`what4-serialize`, and (2) raising upper version bounds on `what4`.

This brings in submodule changes from the following:

* GaloisInc/asl-translator#48, which performed a similar `what4` adaptation.
* GaloisInc/semmc#78, which performed a similar `what4` adaptation.
* GaloisIns/crucible#1068, which ensures that everything can build against
  `tasty-sugar >= 2.0` (the version of the library that `what4-1.4` depends on).
2023-03-21 16:05:53 -04:00
Ryan Scott
6237d615c3 Fix -Wnoncanonical-monad-instances warnings
GHC 9.2 adds `-Wnoncanonical-monad-instances` to `-Wall`, which warns whenever
one has explicit implementations of `return` or `(>>)` that aren't simply
`return = pure` or `(>>) = (*>)`. Since these are the default
implementations of `return` and `(>>)` since `base-4.11`, the simplest
way to fix the warnings is to simply remove all explicit definitions of
`return` and `(>>)` and rely on the defaults, which this patch accomplishes.
2022-05-31 15:50:48 -04:00
Ryan Scott
c9cbb4c7fc Support building with GHC 9.2
This contains various tweaks needed to make the packages in the `macaw` repo
build with GHC 9.2:

* In `template-haskell-2.18.*`, the type of `ConP` gained an additional field
  (see [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2?version_id=7e2ce63ba042c1934654c4316dc02028d8d3dd31#template-haskell-218)).
  As a result, I needed to use some CPP in `macaw-semmc:Data.Macaw.SemMC.TH` to
  make the two uses of `ConP` compile. To minimize the amount of CPP that I
  needed, I factored out this logic into a `conPCompat` function.
* The following submodules were bumped to bring in changes needed to support
  building with GHC 9.2:
  * `asl-translator`: GaloisInc/asl-translator#45
  * `dismantle`: travitch/dismantle#39
  * `dwarf`: GaloisInc/dwarf#5
  * `elf-edit`: GaloisInc/elf-edit#32
  * `flexdis86`: GaloisInc/flexdis86#39
  * `grift`: GaloisInc/grift#6
  * `semmc`: GaloisInc/semmc#75
2022-05-31 15:50:48 -04:00
Tristan Ravitch
54f8793145
Submodule updates (#291)
The primary changes are version bounds to let everything build against the
latest what4 release (1.3)
2022-05-24 18:45:23 -07:00
Rob Dockins
465a84ee49 Update with changes flowing from GaloicInc/crucible#945.
This mostly deals with the splitting of the old `sym` type into
two: one for dealing with expression creation, and a new simulator
backend type for dealing with control-flow and assertions.
2022-01-24 16:24:07 -08:00
Ryan Scott
ce10bc9243 Drop support for GHC 8.6
This allows us to remove gobs of CPP as a consequence.
2022-01-10 16:40:23 -05:00
Ryan Scott
2f2ba118bd macaw-semmc: Avoid arithmetic overflow from negative shift amounts
While pre-9.0 versions of GHC would silently turn negative right shifts into
left shifts, GHC 9.0 will throw an `arithmetic overflow` exception instead.
This patch makes this behavior explicit in `macaw-semmc` to allow the code to
work on GHC 9.0.

Fixes #212.
2022-01-10 16:40:23 -05:00
Ryan Scott
049096c506 Support building with GHC 9.0
This contains a variety of fixes needed to make the packages in the `macaw`
repo compile with GHC 9.0:

* GHC 9.0 implements simplified subsumption (see
  [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#simplified-subsumption)).
  In most cases, adapting to this is a matter of manually eta expanding
  definitions, such as in `base:Data.Macaw.Analysis.RegisterUse`. In the case
  of `macaw-x86-symbolic:Data.Macaw.X86.Crucible`, the type signature of
  `evalExt` had to be made more specific to adapt to the loss of contravariance
  when typechecking `(->)`.
* GHC's constraint solver now solves constraints in each top-level group
  sooner (see
  [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#the-order-of-th-splices-is-more-important)).
  This affects `macaw-aarch32` and `macaw-symbolic`, as they separate top-level
  groups with `$(return [])` Template Haskell splices. The previous locations
  of these splices made it so that the TH-generated instances in that package
  were not available to any code before the splice, resulting in type errors
  when compiled with GHC 9.0.

  To overcome this, I rearranged the TH-generated instances so that they appear
  before the top-level groups that make use of them.
* GHC 9.0 now enables `-Wstar-is-type` in `-Wall`, so this patch replaces some
  uses of `*` with `Data.Kind.Type`. `Data.Kind` requires the use of GHC 8.0 or
  later, so this patch also updates thes lower bounds on `base` to `>= 4.9` in
  the appropriate `.cabal` files. (I'm fairly certain that this requirement was
  already present implicity, but better to be explicit about it.)
* The `asl-translator`, `crucible`, and `semmc` submodules were updated to
  allow them to build with GHC 9.0. The `llvm-pretty` and
  `llvm-pretty-bc-parser` submodules were also bumped to accommodate unrelated
  changes in `crucible` that were brought in.
* The upper version bounds on `doctest` in `macaw-symbolic`'s test suite were
  raised to allow it to build with GHC 9.0.
2022-01-10 16:40:23 -05:00
Tristan Ravitch
10ef849895 Warning cleanup 2021-07-15 21:22:57 -07:00
Tristan Ravitch
df839de678 Update submodules
This commit adapts to recent changes in crucible and raises the version bounds
to admit newer versions of what4.
2021-07-15 21:22:30 -07:00
robdockins
a58f1e25dd
Update to follow changes in What4. Nat is no longer a base type (#190)
Nat is no longer a what4 base type, so we have to adapt various APIs to accommodate that. The template haskell in macaw-semmc is updated to remove Nat cases. Changes to the `SymFn` type required removing a type parameter.

This commit also adds macaw-refinement to CI (which requires installing SMT solvers); that code had to be updated due to the what4 changes.


Co-authored-by: Tristan Ravitch <tristan@galois.com>
2021-02-19 15:44:56 -08:00
Brian Huffman
2a620d41de Switch from ansi-wl-pprint to the prettyprinter package.
This patch relies on the following submodule updates:
- GaloisInc/what4#77
- GaloisInc/elf-edit#20
- GaloisInc/crucible#586
- GaloisInc/asl-translator#28

This patch updates the following packages:
- macaw-base
- macaw-symbolic
- macaw-x86
- macaw-x86-symbolic
- macaw-aarch32
- macaw-ppc
- macaw-semmc
- macaw-refinement
2020-12-02 11:38:19 -08:00
Daniel Matichuk
75d998f719 aarch32: avoid symbolic addresses
this changes the write action model to instead index
writes based on the macaw term representing the address
to be written
2020-08-05 16:53:27 -07:00
Daniel Matichuk
f1d3bb61da delete dead code 2020-07-31 00:31:29 -07:00
Daniel Matichuk
f53ea84cd9 module import cleanup 2020-07-28 11:57:07 -07:00
Daniel Matichuk
6e54d1488b avoid redundant let-bindings 2020-07-28 11:57:07 -07:00
Daniel Matichuk
468c329fa1 use compilation-friendly boolean and bitvector ops 2020-07-28 11:57:07 -07:00
Daniel Matichuk
3e03ec11ab allow for arch-specific type translation 2020-07-28 11:57:07 -07:00
Daniel Matichuk
dcd5339b5a allow for manual bind pattern 2020-07-28 11:57:07 -07:00
Daniel Matichuk
98a429b7e0 avoid using applicative binds for eager values 2020-07-28 11:57:07 -07:00
Daniel Matichuk
62dd08f5a1 add more cases for simplifying boolean Muxes 2020-07-28 11:57:07 -07:00
Kevin Quick
5b93b1fa00
[macaw-semmc] updates for app-refactor what4 changes
See https://github.com/GaloisInc/what4/pull/55
2020-07-16 23:08:58 -07:00
Ben Selfridge
039b8497fc
updates what4, crucible, etc. (#146)
* update to bv-sized branch of what4 and other things

* removed parameterized-utils submodule completely

* Updates submodules

* Fixes macaw-symbolic w.r.t. crucible-llvm changes

Co-authored-by: Ben Selfridge <ben@000548-benselfridge.local>
2020-06-16 16:49:55 -07:00
Tristan Ravitch
89fc5a73f7
Tr/full arm intrinsics (#137)
Improve the TH codegen for macaw-semmc

This change lazily translates as much as possible.  It also generates somewhat more compact code. This change also finishes implementing primitives for the aarch32 backend.  Complementing the aarch32 changes, the macaw-semmc interface has been modified to allow macaw-aarch32 to avoid a redundant serialize-deserialize round.

Co-authored-by: Kevin Quick <kquick@galois.com>
2020-05-26 09:24:45 -07:00
Kevin Quick
4d5345339a
Fix haddocks for macaw-semmc.
Commented out guard statements look like haddocks and confuse haddock.
2020-04-14 15:53:45 +00:00
Tristan Ravitch
a824fc4051
Tr/warning cleanups (#127)
Warning and style cleanups in macaw-semmc and macaw-aarch32
2020-04-14 00:07:15 -07:00
Tristan Ravitch
958aeaa3ed Remove the nested mux match rule from macaw core
We can now do enough rewriting in the ARM backend that it isn't needed.  This
adds extra ARM rewriting rules and a term cache to make matching easier.
2020-04-08 19:46:32 -07:00
Tristan Ravitch
d865811701 In ARM, read the current register value from a snapshot
We were reading partially updated values that were committed to the register
state out-of-order, yielding some bad results.

This commit takes a snapshot of the register state before executing each
instruction and only reads register values from the snapshot.
2020-04-08 11:54:28 -07:00
Tristan Ravitch
b0683c06a9 Poke the ARM simplifier into working
The generic simplifier needed a case to handle xor.

The more specific simplifier needed a case to coalesce adjacent additions.
2020-04-08 02:23:47 -07:00
Tristan Ravitch
997e435a0c WIP Debugging rewriting rules
They fire sometimes and definitely clean up the IR, but they are missing a few
key cases still
2020-04-08 00:04:51 -07:00
Daniel Matichuk
464835403e import fixup 2020-04-06 20:53:06 -07:00
Tristan Ravitch
5e5c90c993 Updates to the simplifier and call recognition 2020-04-06 17:56:22 -07:00
Ben Selfridge
b79561914e Merge branch 'feature/asl' of https://github.com/GaloisInc/macaw into feature/asl 2020-04-04 19:17:07 -07:00
Daniel Matichuk
31901ff4d7 translate memory writes via function calls 2020-04-04 18:58:54 -07:00
Ben Selfridge
094f4be22e Merge branch 'feature/asl' of https://github.com/GaloisInc/macaw into feature/asl 2020-04-04 11:26:43 -07:00
Daniel Matichuk
6716c663a2 initial attempt at handling stateful branches 2020-04-04 03:13:03 -07:00
Daniel Matichuk
5dab9c5209 Merge remote-tracking branch 'origin/master' into feature/asl 2020-04-03 23:38:19 -07:00
Ben Selfridge
5bd55bb7ad feature/asl: fixed build by using expected return type for init_gpr 2020-04-03 22:09:20 -07:00
Ben Selfridge
8afc18dc62 feature/asl: BROKEN BUILD -- updated asl-translator, need to fix 2020-04-03 18:33:31 -07:00
Ben Selfridge
050625300e feature/asl: passing test-just-exit-a32 2020-04-01 20:57:22 -07:00
Ben Selfridge
7e78fbcf25 feature/asl: fixed syntax error and removed integers 2020-03-29 10:21:09 -07:00
Ben Selfridge
9bceb3a06c feature/asl: updating to new semmc 2020-03-26 10:01:10 -07:00
Ben Selfridge
f80dde767d feature/asl: memory and register writes 2020-03-25 14:27:22 -07:00