-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support LLVM 15 and 16, opaque pointers #1878
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The previous implementation of `translateLLVMGEP` was needlessly complicated, as it required the pointer argument to have a very particular shape to its type. But there's no good reason for this requirement, as the only thing that `translateLLVMGEP` _really_ needs to check for is that all of the index arguments are `0` (so that no pointer offset needs to be computed). I have simplified the implementation of `translateLLVMGEP` to reflect this and expanded its Haddocks accordingly. A secondary benefit of this change is that we no longer match on `PtrTo` in `translateLLVMGEP`, which will make it easier to support opaque pointers in an upcoming commit. Fixes #1875.
This commit bumps the `llvm-pretty` submodule to bring in a commit from GaloisInc/llvm-pretty#110 that adds additional fields to `ConstGEP` to represent the basis type and expression to use for offset calculations. This also bumps the `llvm-pretty-bc-parser` and `crucible` submodule to bring in corresponding changes from GaloisInc/llvm-pretty-bc-parser#221 and GaloisInc/crucible#1085, respectively. This change affects one use site in `heapster-saw`, which is easily adapted.
RyanGlScott
commented
Jun 1, 2023
This patch adds support for LLVM 15 and 16 by adding support for opaque pointers, which are described in https://llvm.org/docs/OpaquePointers.html. I have also added a test case involving LLVM bitcode using opaque pointers to kick the tires and ensure that the basics work as expected. For the most part, this is a straightforward process, as most uses of pointer types in SAW already do not care about pointee types. There are some exceptions, however: * The `typeOfSetupValue` function, as well as several places that use this function, scrutinize pointee types of pointers, which would appear to fly in the face of opaque pointers. I attempt to explain in #1876 which this is actually OK for now (although a bit awkward). * The `llvm_boilerplate`/skeleton machinery does not support opaque pointers at all. See #1877. * The `llvm_fresh_expanded_val` command does not support opaque pointers at all. See #1879. This patch also bumps the following submodules to bring in support for opaque pointers: * `llvm-pretty`: GaloisInc/llvm-pretty#110 * `llvm-pretty-bc-parser`: GaloisInc/llvm-pretty-bc-parser#221 * `crucible`: GaloisInc/crucible#1085 This also bumps the `what4` submodule to bring in the changes from GaloisInc/what4#234. This isn't necessary to support opaque pointers, but it _is_ necessary to support a build plan involving `tasty-sugar-2.2.*`, which `llvm-pretty-bc-parser`'s test suite now requires.
See #1877 for further discussion.
See #1879 for further discussion.
kquick
approved these changes
Jun 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, and thank you for the clear documentation on the potential future issues.
This way, users who encounter them in the wild will be more strongly encouraged to report it on the issue tracker.
RyanGlScott
added
the
PR: ready to merge
Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run
label
Jun 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
PR: ready to merge
Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support for LLVM 15 and 16 by adding support for opaque pointers, which are described in https://llvm.org/docs/OpaquePointers.html. I have also added a test case involving LLVM bitcode using opaque pointers to kick the tires and ensure that the basics work as expected.
For the most part, this is a straightforward process, as most uses of pointer types in SAW already do not care about pointee types. There are some exceptions, however:
typeOfSetupValue
function, as well as several places that use this function, scrutinize pointee types of pointers, which would appear to fly in the face of opaque pointers. I attempt to explain in Consider using a different type thanMemType
intypeOfSetupValue
#1876 which this is actually OK for now (although a bit awkward).llvm_boilerplate
/skeleton machinery does not support opaque pointers at all. See Support opaque pointers inllvm_boilerplate
/function skeletons #1877.llvm_fresh_expanded_val
command does not support opaque pointers at all. See Support opaque pointers inllvm_fresh_expanded_val
#1879.This patch also bumps the following submodules to bring in support for opaque pointers:
llvm-pretty
: More complete support for opaque pointers (required for LLVM 15+) llvm-pretty#110llvm-pretty-bc-parser
: More complete support for opaque pointers (required for LLVM 15+) llvm-pretty-bc-parser#221crucible
: More complete support for opaque pointers (required for LLVM 15+) crucible#1085This also bumps the
what4
submodule to bring in the changes from GaloisInc/what4#234. This isn't necessary to support opaque pointers, but it is necessary to support a build plan involvingtasty-sugar-2.2.*
, whichllvm-pretty-bc-parser
's test suite now requires.