Deserializer.
There were issues with Visual C++ barfing when instantiating
SerializeTrait<T> when "T" was an abstract class AND
SerializeTrait<T>::ReadVal was *never* called:
template <typename T>
struct SerializeTrait {
<SNIP>
static inline T ReadVal(Deserializer& D) { T::ReadVal(D); }
<SNIP>
};
Visual C++ would complain about "T" being an abstract class, even
though ReadVal was never instantiated (although one of the other
member functions were).
Removing this from the trait is not a big deal. It was used hardly
ever, and users who want "read-by-value" deserialization can simply
call the appropriate methods directly instead of relying on
trait-based-dispatch. The trait dispatch for
serialization/deserialization is simply sugar in many cases (like this
one).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43624 91177308-0d34-0410-b5e6-96231b3b80d8
flag in the **key** of the backpatch map, as opposed to the mapped
value which contains either the final pointer, or a pointer to a chain
of pointers that need to be backpatched. The bit flag was moved to
the key because we were erroneously assuming that the backpatched
pointers would be at an alignment of >= 2 bytes, which obviously
doesn't work for character strings. Now we just steal the bit from the key.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43595 91177308-0d34-0410-b5e6-96231b3b80d8
just like pointers, except that they cannot be backpatched. This
means that references are essentially non-owning pointers where the
referred object must be deserialized prior to the reference being
deserialized. Because of the nature of references, this ordering of
objects is always possible.
Fixed a bug in backpatching code (returning the backpatched pointer
would accidentally include a bit flag).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43570 91177308-0d34-0410-b5e6-96231b3b80d8
eager backpatching instead of waithing until all objects have been
deserialized. This allows us to reduce the memory footprint needed
for backpatching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43422 91177308-0d34-0410-b5e6-96231b3b80d8
No compile-time support for constant operations yet,
just format transformations. Make readers and
writers work. Split constants into 2 doubles in
Legalize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42865 91177308-0d34-0410-b5e6-96231b3b80d8
- The naming prefix is LLVM.
- All types are represented using opaque references.
- Functions are not named LLVM{Type}{Method}; the names became
unreadable goop. Instead, they are named LLVM{ImperativeSentence}.
- Where an attribute only appears once in the class hierarchy (e.g.,
linkage only applies to values; parameter types only apply to
function types), the class is omitted from identifiers for
brevity. Tastes like methods.
- Strings are C strings or string/length tuples on a case-by-case
basis.
- APIs which give the caller ownership of an object are not mapped
(removeFromParent, certain constructor overloads). This keeps
keep memory management as simple as possible.
For each library with bindings:
llvm-c/<LIB>.h - Declares the bindings.
lib/<LIB>/<LIB>.cpp - Implements the bindings.
So just link with the library of your choice and use the C header
instead of the C++ one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42077 91177308-0d34-0410-b5e6-96231b3b80d8
access to bits). Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling
(untested, probably does not work).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
to handle values bigger than double. If we assume host==target and host
long double works correctly, this is not too bad, but we don't want to
have that limitation longterm. I could implement accepting double
constants as long double or something like that, which would lead to
incorrect codegen with no errors; the more I think about that the worse
it seems. Rather than do such a hack that would be backed out later,
I'm settling for giving reasonable error messages, for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40974 91177308-0d34-0410-b5e6-96231b3b80d8
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40807 91177308-0d34-0410-b5e6-96231b3b80d8
pr1146 in llvm 2.1 without ugly code to emulate old behavior. This should
be merged into the 2.0 release branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36928 91177308-0d34-0410-b5e6-96231b3b80d8
block from:
Block ID #11 (CONSTANTS_BLOCK):
Num Instances: 1722
Total Size: 3.85976e+06b/482470B/120617W
% of file: 16.7609
Average Size: 2241.44b/280.18B/70.045W
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 1/0.00058072
Tot/Avg Records: 26423/15.3444
% Abbrev Recs: 69.1746
to:
Block ID #11 (CONSTANTS_BLOCK):
Num Instances: 1724
Total Size: 2.62406e+06b/328008B/82001.9W
% of file: 12.041
Average Size: 1522.08b/190.26B/47.5649W
Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 2/0.00116009
Tot/Avg Records: 26280/15.2436
% Abbrev Recs: 68.9992
This shrinks kc++ from 2815788 to 2724088 bytes, which means the bitcode
file is now smaller than the bytecode file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36820 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36776 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36771 91177308-0d34-0410-b5e6-96231b3b80d8
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 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36767 91177308-0d34-0410-b5e6-96231b3b80d8
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? :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36759 91177308-0d34-0410-b5e6-96231b3b80d8
integer structure idx's are emitted before constant expr geps) and shrinks
files slightly. For example kc++ shrinks from 4326188 to 4240128 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36742 91177308-0d34-0410-b5e6-96231b3b80d8
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
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36640 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36554 91177308-0d34-0410-b5e6-96231b3b80d8
I just introduced), stub out function reading, purge aggregate values from
the value table before reading functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36463 91177308-0d34-0410-b5e6-96231b3b80d8
easy breakpointing).
Fix bugs reading constantexpr geps. We now can disassemble kc++ global
initializers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36398 91177308-0d34-0410-b5e6-96231b3b80d8
the type symtab, and global/function protos, and is missing the important
size optimization, but it is a place to start.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36331 91177308-0d34-0410-b5e6-96231b3b80d8
the type symtab, and global/function protos, and are missing the important
size optimization, but it is a place to start.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36330 91177308-0d34-0410-b5e6-96231b3b80d8