llvm-6502/lib/Transforms/IPO
Peter Collingbourne 27821d7200 LowerBitSets: Use byte arrays instead of bit sets to represent in-memory bit sets.
By loading from indexed offsets into a byte array and applying a mask, a
program can test bits from the bit set with a relatively short instruction
sequence. For example, suppose we have 15 bit sets to lay out:

A (16 bits), B (15 bits), C (14 bits), D (13 bits), E (12 bits),
F (11 bits), G (10 bits), H (9 bits), I (7 bits), J (6 bits), K (5 bits),
L (4 bits), M (3 bits), N (2 bits), O (1 bit)

These bits can be laid out in a 16-byte array like this:

      Byte Offset
    0123456789ABCDEF
Bit
  7 HHHHHHHHHIIIIIII
  6 GGGGGGGGGGJJJJJJ
  5 FFFFFFFFFFFKKKKK
  4 EEEEEEEEEEEELLLL
  3 DDDDDDDDDDDDDMMM
  2 CCCCCCCCCCCCCCNN
  1 BBBBBBBBBBBBBBBO
  0 AAAAAAAAAAAAAAAA

For example, to test bit X of A, we evaluate ((bits[X] & 1) != 0), or to
test bit X of I, we evaluate ((bits[9 + X] & 0x80) != 0). This can be done
in 1-2 machine instructions on x86, or 4-6 instructions on ARM.

This uses the LPT multiprocessor scheduling algorithm to lay out the bits
efficiently.

Saves ~450KB of instructions in a recent build of Chromium.

Differential Revision: http://reviews.llvm.org/D7954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231043 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 00:49:28 +00:00
..
ArgumentPromotion.cpp Convert push_back loops into append calls. 2015-02-28 13:20:15 +00:00
BarrierNoopPass.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 09:10:37 +00:00
CMakeLists.txt Introduce bitset metadata format and bitset lowering pass. 2015-02-20 20:30:47 +00:00
ConstantMerge.cpp Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
DeadArgumentElimination.cpp DeadArgElim: aggregate Return assessment properly. 2015-02-11 23:13:11 +00:00
ExtractGV.cpp Reformat partially, where I touched for whitespace changes. 2014-10-28 11:54:52 +00:00
FunctionAttrs.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
GlobalDCE.cpp Prologue support 2014-12-03 02:08:38 +00:00
GlobalOpt.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
InlineAlways.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
Inliner.cpp Transforms: Canonicalize access to function attributes, NFC 2015-02-14 01:11:29 +00:00
InlineSimple.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
Internalize.cpp Use range based for loops to avoid needing to re-mention SmallPtrSet size. 2014-08-24 23:23:06 +00:00
IPConstantPropagation.cpp [C++] Use 'nullptr'. Transforms edition. 2014-04-25 05:29:35 +00:00
IPO.cpp Introduce bitset metadata format and bitset lowering pass. 2015-02-20 20:30:47 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00
LoopExtractor.cpp [PM] Lift the analyses into the interface for 2015-01-19 03:03:39 +00:00
LowerBitSets.cpp LowerBitSets: Use byte arrays instead of bit sets to represent in-memory bit sets. 2015-03-03 00:49:28 +00:00
Makefile
MergeFunctions.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
PartialInlining.cpp Add range adapters predecessors() and successors() for BBs 2015-02-04 19:14:57 +00:00
PassManagerBuilder.cpp Introduce bitset metadata format and bitset lowering pass. 2015-02-20 20:30:47 +00:00
PruneEH.cpp Don't promote asynch EH invokes of nounwind functions to calls 2015-02-11 01:23:16 +00:00
StripDeadPrototypes.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
StripSymbols.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00