[PATCH] [opaque pointer type] Bitcode support for explicit type parameter on GEP.

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Feb 18 14:55:02 PST 2015

> On 2015-Feb-18, at 13:48, David Blaikie <dblaikie at gmail.com> wrote:
> Hi chandlerc, dexonsmith, grosbach, resistor,
> Like http://reviews.llvm.org/D7655, add bitcode support including backwards
> compatibility, for an explicit type parameter to GEP.
> At the suggestion of Duncan I tried coalescing the two older bitcodes into a
> single new bitcode, though I did hit a wrinkle: I couldn't figure out how to
> create an explicit abbreviation for a record with a variable number of
> arguments (the indicies to the gep). This means the discriminator between
> inbounds and non-inbounds gep is a full variable-length field I believe? Is my
> understanding correct? Is there a way to create such an abbreviation?

You can add such an abbreviation by making Array the second last
element, and making the last element the type in the array.
Documented here:


Examples in-tree: `METADATA_NAME` and `TYPE_CODE_FUNCTION`.

> Should I
> just use two bitcodes as before?

Regardless of the above, I'm interested in others' opinions on this
(whether two records vs. one record with a discriminator is better).
I've been preferring the single-record approach myself, purely on
the principle that it's easier to upgrade in the future by adding
bits to the discriminator (rather than creating "brand new records").

> http://reviews.llvm.org/D7736
> Files:
>  include/llvm/Bitcode/LLVMBitCodes.h
>  include/llvm/IR/Instructions.h
>  lib/Bitcode/Reader/BitcodeReader.cpp
>  lib/Bitcode/Writer/BitcodeWriter.cpp
>  test/Bitcode/function-encoding-rel-operands.ll
>  tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> <D7736.20218.patch>

More information about the llvm-commits mailing list