Chris Lattner
df1233dfbb
stop encoding type/value pairs when the type is implied by the value.
...
This shrinks the function block of kc++ from 1055K to 906K
llvm-svn: 36816
2007-05-06 00:00:00 +00:00
Chris Lattner
6eeea5dc05
add support for BLOCKINFO records at the module level. This fixes the reader
...
issues reid noticed last night.
llvm-svn: 36785
2007-05-05 18:57:30 +00:00
Chris Lattner
b80751dca2
add an abbrev for loads. This shrinks the function block about 50K, from:
...
Block ID #12 (FUNCTION_BLOCK):
Num Instances: 2344
Total Size: 8.8434e+06b/1.10542e+06B/276356W
% of file: 35.6726
Average Size: 3772.78b/471.598B/117.899W
Tot/Avg SubBlocks: 4065/1.73422
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 128487/54.8153
% Abbrev Recs: 0
to:
Block ID #12 (FUNCTION_BLOCK):
Num Instances: 2344
Total Size: 8.44518e+06b/1.05565e+06B/263912W
% of file: 34.6203
Average Size: 3602.89b/450.362B/112.59W
Tot/Avg SubBlocks: 4065/1.73422
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 128487/54.8153
% Abbrev Recs: 22.2077
llvm-svn: 36779
2007-05-05 07:44:49 +00:00
Chris Lattner
da5e5d211b
add abbrevs for the constants tables. This shrinks it from 4.49755e6 bits
...
to 3.85972e6 bits in kc++
llvm-svn: 36778
2007-05-05 07:36:14 +00:00
Chris Lattner
ccee706345
Add abbreviations to the TYPE_BLOCK for pointers, functions, structs and arrays.
...
This shrinks the type_block of kc++ from 139901 bits to 99389 bits (0.55% to 0.39%
of the file), a 40% reduction.
This shrink the record from:
Block ID #10 (TYPE_BLOCK):
Num Instances: 1
Total Size: 139901b/17487.6B/4371.91W
% of file: 0.549306
Num Abbrevs: 0
Num Records: 3203
% Abbrev Recs: 0
to:
Block ID #10 (TYPE_BLOCK):
Num Instances: 1
Total Size: 99389b/12423.6B/3105.91W
% of file: 0.390862
Num Abbrevs: 4
Num Records: 3203
% Abbrev Recs: 99.6566
With a common histogram of:
Code Histogram:
1613 POINTER
1100 FUNCTION
255 STRUCT
224 ARRAY
5 INTEGER
2 OPAQUE
1 LABEL
1 DOUBLE
1 VOID
1 NUMENTRY
llvm-svn: 36776
2007-05-05 06:30:12 +00:00
Chris Lattner
e760d6f4c1
add a char6 abbrev for bbnames and value names. This represents each character
...
with 6 bits where possible. This shrinks kc++ from 3324164B to 3183584B. The
old VST was:
Block ID #14 (VALUE_SYMTAB):
Total Size: 1.26713e+07b/1.58391e+06B/395978W
Average Size: 5403.53b/675.442B/168.86W
% of file: 47.6484
The new one is:
Block ID #14 (VALUE_SYMTAB):
Total Size: 1.15467e+07b/1.44334e+06B/360834W
Average Size: 4923.96b/615.495B/153.874W
% of file: 45.3368
This is 11% smaller than the VST in the bytecode format.
llvm-svn: 36771
2007-05-05 01:26:50 +00:00
Chris Lattner
de05f6be35
add an abbreviation for the type symtab, this shrinks the TST from 175197 bits
...
to 103165 bits:
Old:
Block ID #13 (TYPE_SYMTAB):
Num Instances: 1
Total Size: 175197b/21899.6B/5474.91W
Average Size: 175197b/21899.6B/5474.91W
% of file: 0.657023
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 255/255
% Abbrev Recs: 0
New:
Block ID #13 (TYPE_SYMTAB):
Num Instances: 1
Total Size: 103165b/12895.6B/3223.91W
Average Size: 103165b/12895.6B/3223.91W
% of file: 0.387937
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 1/1
Tot/Avg Records: 255/255
% Abbrev Recs: 100
llvm-svn: 36769
2007-05-05 00:47:19 +00:00
Chris Lattner
982ec1eddc
Implement support for globally associating abbrevs with block IDs, which
...
relieves us from having to emit the abbrevs into each instance of the block.
This shrinks kc.bit from 3368K to 3333K, but will be a more significant win
once instructions are abbreviated.
The VST went from:
Block ID #14 (VALUE_SYMTAB):
Num Instances: 2345
Total Size: 1.29508e+07b/1.61885e+06B/404713W
Average Size: 5522.73b/690.342B/172.585W
% of file: 48.0645
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 7035/3
Tot/Avg Records: 120924/51.5667
% Abbrev Recs: 100
to:
Block ID #14 (VALUE_SYMTAB):
Num Instances: 2345
Total Size: 1.26713e+07b/1.58391e+06B/395978W
Average Size: 5403.53b/675.442B/168.86W
% of file: 47.5198
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 120924/51.5667
% Abbrev Recs: 100
because we didn't emit the same 3 abbrevs 2345 times :)
llvm-svn: 36767
2007-05-05 00:17:00 +00:00
Chris Lattner
a09879663d
allow the 8-bit abbrev to be used for either bb or other values
...
llvm-svn: 36761
2007-05-04 21:31:13 +00:00
Chris Lattner
fd1ad10e61
shave another 150K off of kc++, by using a 7-bit encoding for BB names
...
where we can. This shrinks kc++'s down to 3368K, with a VST record of:
Block ID #14 (VALUE_SYMTAB):
Num Instances: 2345
Total Size: 1.29508e+07b/1.61885e+06B/404713W
Average Size: 5522.73b/690.342B/172.585W
% of file: 48.0645
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 7035/3
Tot/Avg Records: 120924/51.5667
% Abbrev Recs: 100
Isn't it nice to be able to optimizer bc size without touching the reader? :)
llvm-svn: 36759
2007-05-04 20:58:35 +00:00
Chris Lattner
4d92598ab0
where possible, encode symtab names with 7 bits per char instead of 8. This
...
shaves 110K off kc++ to 3514K. Before:
Block ID #14 (VALUE_SYMTAB):
Num Instances: 2345
Total Size: 1.50425e+07b/1.88031e+06B/470077W
Average Size: 6414.69b/801.837B/200.459W
% of file: 51.8057
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 2345/1
Tot/Avg Records: 120924/51.5667
% Abbrev Recs: 85.1791
after:
Block ID #14 (VALUE_SYMTAB):
Num Instances: 2345
Total Size: 1.41229e+07b/1.76536e+06B/441341W
Average Size: 6022.56b/752.82B/188.205W
% of file: 50.2295
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 4690/2
Tot/Avg Records: 120924/51.5667
% Abbrev Recs: 85.1791
llvm-svn: 36758
2007-05-04 20:52:02 +00:00
Chris Lattner
2eae59f1c1
Encode all value symtab strings as arrays of 8-bit fixed width integers,
...
instead of the default inefficient encoding. This shrinks kc++ from 4134K
to 3629K
llvm-svn: 36755
2007-05-04 20:34:50 +00:00
Chris Lattner
e14cb88e56
eliminate internal length fields from record. Records already know their
...
total length
llvm-svn: 36752
2007-05-04 19:11:41 +00:00
Chris Lattner
702658c0cc
stub out creation of BLOCKINFO_BLOCK
...
llvm-svn: 36749
2007-05-04 18:26:27 +00:00
Chris Lattner
430e80d670
optimize constant layout. This fixes encoding of 181.mcf (by ensuring
...
integer structure idx's are emitted before constant expr geps) and shrinks
files slightly. For example kc++ shrinks from 4326188 to 4240128 bytes.
llvm-svn: 36742
2007-05-04 05:21:47 +00:00
Chris Lattner
a8713beddd
simple optimization for the type table
...
llvm-svn: 36741
2007-05-04 05:05:48 +00:00
Chris Lattner
beca065b1e
storeinst ctor takes isvolatile before alignment. With this, 176.gcc roundtrips
...
llvm-svn: 36738
2007-05-04 03:57:30 +00:00
Chris Lattner
485a6d8fad
fix encoding of invoke instructions. kc++ now round trips
...
llvm-svn: 36737
2007-05-04 03:52:24 +00:00
Chris Lattner
e11c6ce3bc
fix a misplaced error
...
llvm-svn: 36736
2007-05-04 03:50:29 +00:00
Chris Lattner
70f4566d8a
encode and read param attrs along with function type. WE can now roundtrip Olden/voronoi loslessly
...
llvm-svn: 36735
2007-05-04 03:41:34 +00:00
Chris Lattner
fee5a3752a
add support for reading the param attrs block
...
llvm-svn: 36731
2007-05-04 03:30:17 +00:00
Chris Lattner
fc5b619419
fix a bug encoding param attrs
...
llvm-svn: 36730
2007-05-04 03:14:09 +00:00
Chris Lattner
a68e3c7cf3
remove dead code
...
llvm-svn: 36728
2007-05-04 03:02:54 +00:00
Chris Lattner
e72bf9fda6
add writer support for param attrs
...
llvm-svn: 36724
2007-05-04 02:59:04 +00:00
Reid Spencer
dea02bd840
Allow this to compile with gcc 4.0.X
...
llvm-svn: 36723
2007-05-04 01:43:33 +00:00
Chris Lattner
874eb28ee6
pass by reference, not by value
...
llvm-svn: 36721
2007-05-04 00:45:24 +00:00
Chris Lattner
e2f98ef52d
trivial scaffolding for param attrs
...
llvm-svn: 36720
2007-05-04 00:44:52 +00:00
Chris Lattner
e4bbad630f
enumerate parameter attr lists.
...
llvm-svn: 36709
2007-05-03 22:46:43 +00:00
Chris Lattner
4704527576
Encoding calling conv info in call/invoke instrs, tree add now round trips completely
...
llvm-svn: 36707
2007-05-03 22:34:03 +00:00
Chris Lattner
c1d86cda8c
the type field for a store is the type of the pointer, not the value.
...
With this fix I can round trip treeaadd, only losing calling conv info.
llvm-svn: 36706
2007-05-03 22:21:59 +00:00
Chris Lattner
4bb39dbfde
don't bother encoding # varargs
...
llvm-svn: 36705
2007-05-03 22:19:34 +00:00
Chris Lattner
6be58c65d4
fix encoding of BB names in the symtab
...
llvm-svn: 36704
2007-05-03 22:18:21 +00:00
Chris Lattner
6ce15cb71e
bug fixes
...
llvm-svn: 36701
2007-05-03 22:09:51 +00:00
Chris Lattner
9f600c5d9d
implement the rest of the instructions
...
llvm-svn: 36699
2007-05-03 22:04:19 +00:00
Chris Lattner
c332bbaae4
add a few more instructions, getting close
...
llvm-svn: 36688
2007-05-03 18:58:09 +00:00
Chris Lattner
5285b5ea2f
add reader logic for terminator instrs.
...
llvm-svn: 36642
2007-05-02 05:46:45 +00:00
Chris Lattner
1fc27f0cdb
add reader support for a bunch of new instructions
...
llvm-svn: 36641
2007-05-02 05:16:49 +00:00
Chris Lattner
e53603e4e2
read a few instructions, fix some bugs. This is enough to be able to round
...
trip function bodies like this:
define <2 x i64> @foo(<2 x i64> %x, <2 x i64> %y) {
%tmp4 = bitcast <2 x i64> %y to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp5 = bitcast <2 x i64> %x to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp = add <8 x i16> %tmp5, %tmp4 ; <<8 x i16>> [#uses=1]
%tmp6 = bitcast <8 x i16> %tmp to <2 x i64> ; <<2 x i64>> [#uses=1]
ret <2 x i64> %tmp6
}
llvm-svn: 36640
2007-05-02 04:27:25 +00:00
Chris Lattner
9f35f9112d
use the correct code for binop instrs
...
llvm-svn: 36639
2007-05-02 04:26:36 +00:00
Chris Lattner
b811e951e9
fix build with non-buggy compilers
...
llvm-svn: 36621
2007-05-01 07:03:37 +00:00
Chris Lattner
8393055447
handle function-level forward references, read binops.
...
llvm-svn: 36620
2007-05-01 07:01:57 +00:00
Chris Lattner
85b7b40621
implement materializeModule, force deallocation of vector memory when we
...
are done with them, start implementing ParseFunctionBody
llvm-svn: 36617
2007-05-01 05:52:21 +00:00
Chris Lattner
48a8de3f4d
The stream to read from is now an ivar
...
llvm-svn: 36615
2007-05-01 05:01:34 +00:00
Chris Lattner
51ffe7ce15
implement scafolding for lazy deserialization of function bodies
...
llvm-svn: 36614
2007-05-01 04:59:48 +00:00
Chris Lattner
fb6f9407ec
write the symbol table for function bodies
...
llvm-svn: 36610
2007-05-01 02:14:57 +00:00
Chris Lattner
0a60325621
encode all of the instructions.
...
llvm-svn: 36609
2007-05-01 02:13:26 +00:00
Anton Korobeynikov
31fc4f9526
Implement visibility checking during linking. Also implement protected
...
visibility support for bitcode.
llvm-svn: 36577
2007-04-29 20:56:48 +00:00
Chris Lattner
6694f60bec
Switch the bitcode reader interface to take a MemoryBuffer instead of knowing
...
anything about disk I/O itself. This greatly simplifies its interface -
eliminating the need for the ReaderWrappers.cpp file.
This adds a new option to llvm-dis (-bitcode) which instructs it to read
the input file as bitcode. Until/unless the bytecode reader is taught to
read from MemoryBuffer, there is no way to handle stdin reading without it.
I don't plan to switch the bytecode reader over, I'd rather delete it :),
so the option will stay around temporarily.
llvm-svn: 36554
2007-04-29 07:54:31 +00:00
Chris Lattner
f0a1ebae4b
Fix this to use the right block ID
...
llvm-svn: 36550
2007-04-29 05:49:09 +00:00
Chris Lattner
87351e2a52
moved Writer.cpp -> BitcodeWriter.cpp to make it more unique in the tree.
...
llvm-svn: 36549
2007-04-29 05:31:57 +00:00
Anton Korobeynikov
daf358bbff
This is not "FIXME" anymore
...
llvm-svn: 36541
2007-04-28 14:57:59 +00:00
Chris Lattner
e6e364c198
start code for writing out instructions. Separate BB#s from normal value
...
#'s.
llvm-svn: 36472
2007-04-26 05:53:54 +00:00
Chris Lattner
7c37b01998
enumerate BB's separately from other function values.
...
llvm-svn: 36467
2007-04-26 04:42:16 +00:00
Chris Lattner
5f640b9cc9
add support for incorporating and purging functions to the value enumerator
...
llvm-svn: 36465
2007-04-26 03:50:57 +00:00
Chris Lattner
a5211c43c2
improve a comment
...
llvm-svn: 36464
2007-04-26 03:32:43 +00:00
Chris Lattner
831d420256
move some code around, fix a bug in the reader reading globalinits (which
...
I just introduced), stub out function reading, purge aggregate values from
the value table before reading functions.
llvm-svn: 36463
2007-04-26 03:27:58 +00:00
Chris Lattner
44c1707207
add bitcode alias support
...
llvm-svn: 36461
2007-04-26 02:46:40 +00:00
Chris Lattner
890683d636
ensure that every error return sets a message (and goes through Error, for
...
easy breakpointing).
Fix bugs reading constantexpr geps. We now can disassemble kc++ global
initializers.
llvm-svn: 36398
2007-04-24 18:15:21 +00:00
Chris Lattner
0ee6a3a561
fix memory leak
...
llvm-svn: 36397
2007-04-24 17:22:05 +00:00
Chris Lattner
1e16bcf7ff
implement reading and writing of constant exprs.
...
llvm-svn: 36394
2007-04-24 07:07:11 +00:00
Chris Lattner
1663ccaf13
implement support for reading aggregate constants, including handling forward
...
constant references, etc.
llvm-svn: 36391
2007-04-24 05:48:56 +00:00
Chris Lattner
08feb1e73a
add supprot for FP constants, wide integers, and fix the encoding of MININT
...
llvm-svn: 36390
2007-04-24 04:04:35 +00:00
Chris Lattner
fbc1d33b81
read basic constants: null, undef, integers <= 64bits
...
llvm-svn: 36389
2007-04-24 03:30:34 +00:00
Chris Lattner
1e50c299a8
fix off-by-one computing size for section abbrevs
...
llvm-svn: 36388
2007-04-24 03:29:47 +00:00
Chris Lattner
a272ead35a
move check to the right place :)
...
llvm-svn: 36386
2007-04-24 00:21:45 +00:00
Chris Lattner
47d131bd32
track global inits
...
llvm-svn: 36385
2007-04-24 00:18:21 +00:00
Chris Lattner
52523561d9
Emit module-level constants.
...
llvm-svn: 36384
2007-04-24 00:16:04 +00:00
Chris Lattner
ccaa448dcf
Read global symtab
...
llvm-svn: 36378
2007-04-23 21:26:05 +00:00
Chris Lattner
1e93f5b8f4
fix off-by one
...
llvm-svn: 36377
2007-04-23 21:23:41 +00:00
Chris Lattner
215e9cd3c2
write out the symtab for globals.
...
llvm-svn: 36374
2007-04-23 20:35:01 +00:00
Chris Lattner
b5491378b1
implement reading of abbrevs, and writing of abbreviated global varrs.
...
llvm-svn: 36367
2007-04-23 18:58:34 +00:00
Chris Lattner
4b00d92a09
first part of implementation of abbrevs. The writer isn't fully there yet and the
...
reader doesn't handle them at all yet.
llvm-svn: 36363
2007-04-23 16:04:05 +00:00
Chris Lattner
362b4a1c92
promote LLVMBitCodes to be a public header
...
llvm-svn: 36358
2007-04-23 01:01:37 +00:00
Jeff Cohen
33be4c78ef
Fix build problem with Gentoo 4.1.1-r3.
...
llvm-svn: 36348
2007-04-22 18:49:32 +00:00
Chris Lattner
a1b07bee6a
add llvm ir bitcode definition file
...
llvm-svn: 36337
2007-04-22 07:03:00 +00:00
Chris Lattner
20571d9c35
build the bitcode dir
...
llvm-svn: 36332
2007-04-22 06:26:05 +00:00
Chris Lattner
c1d10d67a1
Initial support for writing bitcode files. This currently only writes types,
...
the type symtab, and global/function protos, and is missing the important
size optimization, but it is a place to start.
llvm-svn: 36331
2007-04-22 06:24:45 +00:00
Chris Lattner
1314b9996d
Initial support for reading bitcode files. They currently only read types,
...
the type symtab, and global/function protos, and are missing the important
size optimization, but it is a place to start.
llvm-svn: 36330
2007-04-22 06:23:29 +00:00