Commit Graph

213 Commits

Author SHA1 Message Date
John Criswell 4436c49787 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner b94550e537 Change the Opcode enum for PHI nodes from "Instruction::PHINode" to "Instruction::PHI" to be more consistent with the other instructions.
llvm-svn: 9269
2003-10-19 21:34:28 +00:00
Chris Lattner eb6cfaef4b Fix warning
llvm-svn: 9236
2003-10-18 19:48:10 +00:00
Chris Lattner dc83293a38 add support for new linkage types
llvm-svn: 9228
2003-10-18 06:30:21 +00:00
Chris Lattner 9d57347490 Updated to emit the final 1.0 bytecode format. This supports weak linkage,
more efficient encoding of varargs calls, and the new varargs intrinsics.

llvm-svn: 9221
2003-10-18 05:54:48 +00:00
Chris Lattner 7c6c539296 * New revised variable argument handling support
* More dense bytecode encoding for varargs calls (like printf)
* Eliminated the extremely old bytecode format.  rev #0 is now 1.0

llvm-svn: 9220
2003-10-18 05:54:18 +00:00
Alkis Evlogimenos 8faf8d93d5 Eliminate some extraneous code in SlotCalculator::insertVal().
Rename SlotCalculator::getValSlot() to SlotCalculator::getSlot(),
       SlotCalculator::insertValue() to SlotCalculator::getOrCreateSlot(),
       SlotCalculator::insertVal() to SlotCalculator::insertValue(), and
       SlotCalculator::doInsertVal() to SlotCalculator::doInsertValue().

llvm-svn: 9190
2003-10-17 02:02:40 +00:00
Misha Brukman 0659ddc455 Add separator between different types of readers.
llvm-svn: 9183
2003-10-16 21:19:54 +00:00
Chris Lattner 2d05c60bac Add support for 'weak' linkage.
For now, we translate linkonce into weak linkage in the bytecode format because
we don't have enough bits to represent it.  We will rev the bytecode version
soon anyways, so this will be fixed in the near future.

llvm-svn: 9170
2003-10-16 18:28:50 +00:00
Chris Lattner aa78cc9e5d Minor cleanups
llvm-svn: 9079
2003-10-13 14:57:53 +00:00
Chris Lattner a785563692 Avoid calling getTypeSlot more
llvm-svn: 9077
2003-10-13 14:34:59 +00:00
Chris Lattner f0bf7cb739 This is a header file, thus it needs a -*-C++-*-
llvm-svn: 9072
2003-10-13 04:22:07 +00:00
Chris Lattner 44d2c3514a Regularize header file comments
llvm-svn: 9071
2003-10-13 03:32:08 +00:00
Chris Lattner fdf472a83a Ok, the "fix" for this is to do a real associative container. Symbol tables
are ordered by name, not by slot, so the previous solution wasn't any good.
On a large testcase, this reduces time to parse from 2.17s to 1.58s.

llvm-svn: 9002
2003-10-10 05:43:47 +00:00
Chris Lattner 1434d68164 Another 10% performance improvement by not using replaceAllUsesWith
llvm-svn: 8994
2003-10-09 23:10:14 +00:00
Chris Lattner 2ec9de30cd Reserve space for PHI nodes when we read them in. This provides a VERY
tasty 15% speedup on the testcase from Bill.

llvm-svn: 8993
2003-10-09 22:46:58 +00:00
Chris Lattner 5255bed8bc Use the version of getValue that takes the type plane instead of the type
if possible.  This provides a consistent 8.5% speedup.

llvm-svn: 8991
2003-10-09 22:39:30 +00:00
Chris Lattner 819ce2dca1 Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace

llvm-svn: 8990
2003-10-09 20:45:42 +00:00
Chris Lattner 1ae8a48a62 Change getConstantValue to throw an exception on error, not return null
llvm-svn: 8988
2003-10-09 20:41:16 +00:00
Chris Lattner a89c91020c Remove potentially N^2 algorithm from symbol table reader. No speedup
in practice though

llvm-svn: 8985
2003-10-09 20:30:04 +00:00
Chris Lattner e7691a4520 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.

llvm-svn: 8984
2003-10-09 20:22:47 +00:00
Chris Lattner bd26abdc95 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.

llvm-svn: 8983
2003-10-09 18:25:19 +00:00
Chris Lattner 1e8addf890 Eliminate the instruction placeholder. Simplify a bunch of code.
This results in no significant speedup, but does provide simpler code

llvm-svn: 8980
2003-10-09 06:14:26 +00:00
Chris Lattner 42dce1e365 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.

llvm-svn: 8979
2003-10-09 06:05:40 +00:00
Chris Lattner a9c297c8ea Remove a dead method
llvm-svn: 8978
2003-10-09 05:25:34 +00:00
Chris Lattner abf6412c09 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.

llvm-svn: 8977
2003-10-08 22:52:54 +00:00
Chris Lattner f29c7b1a3f Inline the postResolveValues method. It was poorly named anyway
llvm-svn: 8976
2003-10-08 21:51:46 +00:00
Chris Lattner 85555779de Various cleanups and simplifications. This speeds up reading a bytecode file
Bill gave me from 8.69s to 6.90s.

llvm-svn: 8971
2003-10-08 21:18:57 +00:00
Misha Brukman b5c59fa16d Destroy allocated resources on exception.
llvm-svn: 8969
2003-10-08 19:55:47 +00:00
Brian Gaeke 82f64531f6 All of our supported operating systems (so far) and FreeBSD technically
want you to include <sys/stat.h> for fstat(), struct stat, and friends.

llvm-svn: 8887
2003-10-06 03:30:28 +00:00
Chris Lattner cc593fb6c6 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.

llvm-svn: 8850
2003-10-04 20:14:59 +00:00
Chris Lattner 069d6493c9 Transform two methods to return pointers directly instead of returning them
as 'by reference' arguments.

llvm-svn: 8849
2003-10-04 20:00:03 +00:00
Chris Lattner 4318c4b549 Use V for values, not D.
llvm-svn: 8848
2003-10-04 19:29:21 +00:00
Chris Lattner a0d15e4d9e Do not leak the ModuleProvider if releaseModule() throws.
llvm-svn: 8847
2003-10-04 19:19:37 +00:00
Chris Lattner c7caffab32 There is no need for BytecodeParser to be an AbstractTypeUser. Instead, it
can just use PATypeHolders

llvm-svn: 8832
2003-10-02 20:26:18 +00:00
Chris Lattner 4437995826 Just rethrow previous exception instead of making a new one
llvm-svn: 8718
2003-09-26 14:44:52 +00:00
Chris Lattner 1e9402d93d Define the instance variable Buffer, not the automatic variable Buffer.
This was causing us to munmap random stuff, which is obviously bad.

llvm-svn: 8709
2003-09-25 04:13:53 +00:00
Chris Lattner ce6feda799 Fix alignment problem
llvm-svn: 8707
2003-09-24 22:34:17 +00:00
Misha Brukman 86c8a485d0 Actually assign the string correctly through the std::string pointer.
llvm-svn: 8704
2003-09-24 22:10:47 +00:00
Misha Brukman c3634809e6 * 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

llvm-svn: 8701
2003-09-24 22:04:02 +00:00
John Criswell 89f4dcf5bc 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.

llvm-svn: 8693
2003-09-23 21:19:11 +00:00
Misha Brukman 1a74cffdec Stop returning bool and pass Instruction by reference;
return std::auto_ptr and use exceptions

llvm-svn: 8684
2003-09-23 16:17:50 +00:00
Misha Brukman 0c0a882bc3 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()

llvm-svn: 8683
2003-09-23 16:15:29 +00:00
Misha Brukman 301f7dfa19 * 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

llvm-svn: 8682
2003-09-23 16:13:28 +00:00
Misha Brukman 715fe875bb * Constantify arguments to copy function
* Stop using a #define, make it an inline if statement

llvm-svn: 8678
2003-09-23 15:09:26 +00:00
Misha Brukman 3e18bc1518 Removed no longer used member variable.
llvm-svn: 8677
2003-09-22 23:58:08 +00:00
Misha Brukman bafce80ba4 Added file header comment.
llvm-svn: 8675
2003-09-22 23:44:46 +00:00
Chris Lattner df60fe04ab Update file header for renamed file
llvm-svn: 8673
2003-09-22 23:42:00 +00:00
Misha Brukman 6e9a3517f2 * 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

llvm-svn: 8671
2003-09-22 23:38:23 +00:00