Commit Graph

164 Commits

Author SHA1 Message Date
Chris Lattner
4c52392ba3 Reserve space for PHI nodes when we read them in. This provides a VERY
tasty 15% speedup on the testcase from Bill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8993 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 22:46:58 +00:00
Chris Lattner
35d2ca672b Use the version of getValue that takes the type plane instead of the type
if possible.  This provides a consistent 8.5% speedup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8991 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 22:39:30 +00:00
Chris Lattner
6fcf50338e Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8990 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:45:42 +00:00
Chris Lattner
c9456ca64c Change getConstantValue to throw an exception on error, not return null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8988 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:41:16 +00:00
Chris Lattner
9073613d0c Remove potentially N^2 algorithm from symbol table reader. No speedup
in practice though


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8985 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:30:04 +00:00
Chris Lattner
927b185c17 Major refactoring of the bytecode reader. This includes the following
changes:
  * BytecodeReader::getType(...) used to return a null pointer
    on error.  This was only checked about half the time.  Now we convert
    it to throw an exception, and delete the half that checked for error.
    This was checked in before, but psmith crashed and lost the change :(
  * insertValue no longer returns -1 on error, so callers don't need to
    check for it.
  * Substantial rewrite of InstructionReader.cpp, to use more efficient,
    simpler, data structures.  This provides another 5% speedup.  This also
    makes the code much easier to read and understand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8984 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:22:47 +00:00
Chris Lattner
3483f54367 Significantly clean up parsing of instructions. This exceptionizes and
simplifies the control flow a bit.  This provides a small (~3%) speedup,
but it's primarily a cleanup exercise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8983 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 18:25:19 +00:00
Chris Lattner
bf43ac6abf Eliminate the instruction placeholder. Simplify a bunch of code.
This results in no significant speedup, but does provide simpler code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8980 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 06:14:26 +00:00
Chris Lattner
8eb10cef39 Eliminate the old LateResolveValues data structure, replacing it with a
new, simpler, ForwardReferences data structure.  This is just the first
simple replacement, subsequent changes will improve the code more.

This simple change improves the performance of loading a file from HDF5
(contributed by Bill) from 2.36s to 1.93s, a 22% improvement.  This
presumably has to do with the fact that we only create ONE placeholder for
a particular forward referenced values, and also may be because the data
structure is much simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8979 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 06:05:40 +00:00
Chris Lattner
13eb87162a Remove a dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8978 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 05:25:34 +00:00
Chris Lattner
4ee8ef2a5d This patch substantially simplifies and cleans up handling of basic blocks
in the bytecode parser.  Before we tried to shoehorn basic blocks into the
"getValue" code path with other types of values.  For a variety of reasons
this was a bad idea, so this patch separates it out into its own data structure.

This simplifies the code, makes it fit in 80 columns, and is also much faster.
In a testcase provided by Bill, which has lots of PHI nodes, this patch speeds
up bytecode parsing from taking 6.9s to taking 2.32s.  More speedups to
follow later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8977 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 22:52:54 +00:00
Chris Lattner
6e44802ec0 Inline the postResolveValues method. It was poorly named anyway
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8976 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 21:51:46 +00:00
Chris Lattner
36392bc524 Various cleanups and simplifications. This speeds up reading a bytecode file
Bill gave me from 8.69s to 6.90s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8971 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 21:18:57 +00:00
Misha Brukman
7f58de2b99 Destroy allocated resources on exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8969 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 19:55:47 +00:00
Brian Gaeke
378b524ba0 All of our supported operating systems (so far) and FreeBSD technically
want you to include <sys/stat.h> for fstat(), struct stat, and friends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8887 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 03:30:28 +00:00
Chris Lattner
00413e3d63 Rename AbstractModuleProvider -> ModuleProvider, to match the header file name,
and because, while the class used by the interface is abstract, the actual
concept is not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8850 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:14:59 +00:00
Chris Lattner
9e460f23bb Transform two methods to return pointers directly instead of returning them
as 'by reference' arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8849 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:00:03 +00:00
Chris Lattner
51ca860bda Use V for values, not D.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8848 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:29:21 +00:00
Chris Lattner
a983359f59 Do not leak the ModuleProvider if releaseModule() throws.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8847 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:19:37 +00:00
Chris Lattner
c7b6f03501 There is no need for BytecodeParser to be an AbstractTypeUser. Instead, it
can just use PATypeHolders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8832 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 20:26:18 +00:00
Chris Lattner
b0b7c0d28c Just rethrow previous exception instead of making a new one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8718 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-26 14:44:52 +00:00
Chris Lattner
735289ccf0 Define the instance variable Buffer, not the automatic variable Buffer.
This was causing us to munmap random stuff, which is obviously bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8709 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-25 04:13:53 +00:00
Chris Lattner
4eed793d5a Fix alignment problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8707 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:34:17 +00:00
Misha Brukman
134aba6a75 Actually assign the string correctly through the std::string pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8704 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:10:47 +00:00
Misha Brukman
34ce14b019 * Eliminate BytecodeBufferReader::Length member variable
* Kill unused ALIN_PTRS #define
* Set the error string if user passed it in to be compatible with former API


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8701 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:04:02 +00:00
John Criswell
4dcbd5e9a2 Added code that ensures that we pass the beginning of the data buffer to
the parsing routines regardless of whether the buffer is re-aligned or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8693 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 21:19:11 +00:00
Misha Brukman
d554ebfcf7 Stop returning bool and pass Instruction by reference;
return std::auto_ptr and use exceptions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8684 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:17:50 +00:00
Misha Brukman
e0dd0d47cb Suggestions made by Chris:
* Instead of a #define, use inline function
* Fix the name on the #define, errr... now inline function to be more logical:
  it doesn't CHECK the alignment, it PERFORMS the alignment
* To get string name of a Type*, use getDescription(), not getName()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8683 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:15:29 +00:00
Misha Brukman
d57308a33c * Group class definitions & implementations together
* Make sure we align the buffer we're given
* Do not let exceptions propagate when the caller asks for a Module*
* Add doxygenified comments to wrapper functions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8682 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:13:28 +00:00
Misha Brukman
5c344415fa * Constantify arguments to copy function
* Stop using a #define, make it an inline if statement


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8678 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 15:09:26 +00:00
Misha Brukman
96f7877d19 Removed no longer used member variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8677 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:58:08 +00:00
Misha Brukman
464537936d Added file header comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8675 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:44:46 +00:00
Chris Lattner
23219d1dcb Update file header for renamed file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8673 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:42:00 +00:00
Misha Brukman
12c29d10bb * Cleaned up code:
- no more passing around a string pointer to set errors
  - no more returning booleans and checking for errors, we use C++ exceptions
* Broke functionality into 2 new classes, one reads from file, one from a stream
* Implemented lazy function streaming - the parser can read in a function at-a-time


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8671 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:38:23 +00:00
Misha Brukman
37f92e2568 Fixed spelling and grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8489 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 22:34:13 +00:00
Chris Lattner
da73beac20 Fix bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8410 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:43:46 +00:00
Chris Lattner
36143fc444 Add support for the unwind instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8408 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:54:55 +00:00
Chris Lattner
dba2b225c8 Read volatile loads/stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8401 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:20:14 +00:00
Chris Lattner
09bd025762 Remove a gross hack that was there to support bytecode files that are over a year old.
If you still have these suckers laying around, you have GOT to rebuild them.  geeze.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8395 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:04:16 +00:00
Chris Lattner
5bea411ad2 Fix reading of invoke instrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8365 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 18:25:29 +00:00
Chris Lattner
8e2185ea07 Whoa, we were misreading invoke instructions "normal" destinations quite badly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8363 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 05:27:58 +00:00
Chris Lattner
d256ed8954 Non-functional change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8352 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-04 23:47:07 +00:00
Chris Lattner
6c51a36371 Avoid printing meaningless numbers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8342 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-03 20:25:27 +00:00
Chris Lattner
3e80abee49 Follow the pattern of all other atu's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8340 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-03 16:01:54 +00:00
Chris Lattner
d445c6b64a Allow modules to have 'any' pointer size and endianness. Luckily, we had
some space for extra flags, so we don't need to bump the revision number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8118 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 13:47:36 +00:00
Chris Lattner
4354f564c2 Rename SwitchInst::dest_push_back -> addCase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8089 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 23:14:52 +00:00
Misha Brukman
5560c9d49c Spell `necessary' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7944 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 14:43:39 +00:00
Chris Lattner
949a362802 Remove redundant const qualifiers from cast<> expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7253 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:30:06 +00:00
Misha Brukman
bc0e998c49 The word separate' only has one e'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7173 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-14 17:20:40 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00