Commit Graph

115 Commits

Author SHA1 Message Date
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
Ben Selfridge
a478fd77b6 feature/asl: arm semantics compiling 2020-03-24 16:38:20 -07:00
Ben Selfridge
99cb01bf0e feature/asl: translate gpr_get UF 2020-03-19 16:49:10 -07:00
Ben Selfridge
fde33aac81 feature/asl added support for undefined and init functions 2020-03-19 14:45:43 -07:00
Ben Selfridge
5d40475232 feature/asl: translateFunction allows functions to call other functions 2020-03-18 15:46:57 -07:00
Ben Selfridge
deb6d2b161 feature/asl: lifted endianness out of macaw-semmc TH 2020-03-09 16:07:07 -07:00
Tristan Ravitch
c825332f39
Update/ghc 8.8 (#112)
Updates for GHC 8.8

The two main classes of update are related to MonadFail and type alias expansion.

The MonadFail updates introduce explicit MonadFail instances and backward-compatible `fail` implementations under `Monad` for older GHC versions.

The type alias expansion rules changed in GHC 8.8 in a way that breaks the `Simple Lens` idiom; instead, we have to use `Lens'`.  Lens started supporting this alias in version 3.8, which was released in 2013.

This change includes necessary submodule updates, as well as the update for the split of what4 into its own repository.
2020-03-03 13:28:26 -08:00
Tristan Ravitch
e3aaf47a50
Tr/update submodules (#105)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-25 12:25:38 -08:00
Tristan Ravitch
d119a9ed5a
Update submodules (#104)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-17 16:17:30 -08:00
Tristan Ravitch
62eb2deb1f Update macaw-semmc to work with crucible changes
The improved string support in Crucible adds a parameter to string reprs; this
change accommodates that.  Earlier changes added the necessary support in the
rest of macaw.
2019-12-02 18:42:46 -08:00
Tristan Ravitch
b44e8c480f Update the semmc submodule
This brings it up to master.  The submodule has some improvements to synthesis,
but they changed some APIs.
2019-11-21 20:42:05 -08:00
Andrew Kent
587aa7ea6b
Update crux/crucible code to use float mode reprs; bump submodules 2019-11-05 15:23:51 -08:00