Skip to content
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

Basic support for opaque pointers #104

Merged
merged 2 commits into from
Apr 3, 2023
Merged

Basic support for opaque pointers #104

merged 2 commits into from
Apr 3, 2023

Conversation

RyanGlScott
Copy link
Collaborator

This is a collection of two patches that make it possible for llvm-pretty to handle opaque pointers and pretty-print them correctly when used in a call instruction, the latter of which was prompted by GaloisInc/llvm-pretty-bc-parser#189 (comment).

This is likely not everything that we will need to handle everything opaque pointer–related, but it is a good starting point. See #102 for the long-term goal of robustly supporting opaque pointers.

This adds basic support for representing and pretty-printing opaque `ptr`
types, which were introduced in LLVM 13 as part of a longer-term plan to stop
using non-opaque pointer types (e.g., `i8*`). See
https://llvm.org/docs/OpaquePointers.html for further details.

The next step in `llvm-pretty` is to make sure that all of the instructions
that involve pointers in some way (e.g., `call`) have all the information that
they need to work with opaque pointers. I will be addressing this in subsequent
commits.

This is one step towards #102.
Previously, the code in `ppCallSym` assumed that the function type stored in a
`call` instruction was a pointer type, but this should actually be a raw
function type. See the discussion at
GaloisInc/llvm-pretty-bc-parser#189 (comment)
for more on this.  We now assume the convention of raw function types in `call`
instructions, as well as the related `callbr` and `invoke` instructions.

This addresses one part of #102.
Copy link
Collaborator

@langston-barrett langston-barrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the docs!

Copy link
Collaborator

@elliottt elliottt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, +1 on the docs!

@RyanGlScott RyanGlScott merged commit b13493f into master Apr 3, 2023
@RyanGlScott RyanGlScott deleted the opaque-pointers branch April 3, 2023 12:20
RyanGlScott added a commit to GaloisInc/crucible that referenced this pull request Apr 3, 2023
There are a handful of places in `crucible-llvm` where we assume that the
`Call` and `CallBr` instructions have pointer types. As noted in
GaloisInc/llvm-pretty-bc-parser#189, however, this is subtly incorrect. This
patch:

* Bumps the `llvm-pretty-bc-parser` submodule to bring in the changes from
  GaloisInc/llvm-pretty-bc-parser#207, which corrects this mistake.
* Bumps the `llvm-pretty` submodule to be in tandem with
  `llvm-pretty-bc-parser`. Note that because this brings in the changes from
  GaloisInc/llvm-pretty#104, I opted to explicitly disallow LLVM's opaque
  pointers in `crucible-llvm` for now, but this is something that will likely
  change in subsequent patches.
* Changes the parts of `crucible-llvm` that match on pointer types to no longer
  do so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants