GaloisInc / llvm-pretty

An llvm pretty printer inspired by the haskell llvm binding
Other
28 stars 15 forks source link

Support structs with bitfields in `Text.LLVM.DebugUtils` #90

Closed RyanGlScott closed 2 years ago

RyanGlScott commented 2 years ago

LLVM bitcode doesn't directly record information about bitfields, but its debug information does record this information. Knowing about bitfields is important for certain applications—see, for example, GaloisInc/saw-script#1461. This changes Text.LLVM.DebugUtils such that if any of the fields in a struct have bitfields, it will record this information in the new BitfieldInfo data type.

This requires a backwards-incompatible change to the type of the Structure data constructor. In case we need to add additional fields to Structure in the future, I converted Structure's fields into a record data type, which makes it slightly easier to extend. I also did the same thing to Union for consistency (although this is not strictly necessary).