[PATCH] Introduce bitset global attribute and bitset lowering pass.

Peter Collingbourne peter at pcc.me.uk
Thu Jan 29 18:42:39 PST 2015


Hi silvas,

This patch introduces a new mechanism that allows IR modules to co-operatively
build pointer sets corresponding to addresses within a given set of
globals. One particular use case for this is to allow a C++ program to
efficiently verify (at each call site) that a vtable pointer is in the set
of valid vtable pointers for the class or its derived classes. One way of
doing this is for a toolchain component to build, for each class, a bit set
that maps to the memory region allocated for the vtables, such that each 1
bit in the bit set maps to a valid vtable for that class, and lay out the
vtables next to each other, to minimize the total size of the bit sets.

The patch introduces a new 'bitset' global attribute, an '@llvm.bitset.test'
intrinsic and an LTO lowering pass that lays out the globals and builds the
bitsets, and documents the new feature.

Design discussion: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081285.html

http://reviews.llvm.org/D7288

Files:
  docs/BitCodeFormat.rst
  docs/LangRef.rst
  include/llvm/IR/GlobalVariable.h
  include/llvm/IR/Intrinsics.td
  include/llvm/InitializePasses.h
  include/llvm/Transforms/IPO.h
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/Globals.cpp
  lib/Object/IRObjectFile.cpp
  lib/Transforms/IPO/CMakeLists.txt
  lib/Transforms/IPO/IPO.cpp
  lib/Transforms/IPO/LowerBitSets.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  test/Feature/bitset.ll
  test/Transforms/LowerBitSets/simple.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7288.19019.patch
Type: text/x-patch
Size: 33840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150130/e9a64429/attachment.bin>


More information about the llvm-commits mailing list