Chris Lattner
3ff64cf568
add support for new linkage types
...
llvm-svn: 9228
2003-10-18 06:30:21 +00:00
Chris Lattner
3f700e8e47
* 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
Misha Brukman
54c766e934
Add separator between different types of readers.
...
llvm-svn: 9183
2003-10-16 21:19:54 +00:00
Chris Lattner
2bdaaa4e08
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
0ad8f7bb8f
Minor cleanups
...
llvm-svn: 9079
2003-10-13 14:57:53 +00:00
Chris Lattner
8f34f82f84
Avoid calling getTypeSlot more
...
llvm-svn: 9077
2003-10-13 14:34:59 +00:00
Chris Lattner
09abbd2da6
This is a header file, thus it needs a -*-C++-*-
...
llvm-svn: 9072
2003-10-13 04:22:07 +00:00
Chris Lattner
b6c8569f05
Regularize header file comments
...
llvm-svn: 9071
2003-10-13 03:32:08 +00:00
Chris Lattner
c7042b310c
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
3fd3ddbd2d
Another 10% performance improvement by not using replaceAllUsesWith
...
llvm-svn: 8994
2003-10-09 23:10:14 +00:00
Chris Lattner
b8883ea999
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
7467b5ff4e
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
85f5b18995
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
36f2dcd3d5
Change getConstantValue to throw an exception on error, not return null
...
llvm-svn: 8988
2003-10-09 20:41:16 +00:00
Chris Lattner
c0abb16551
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
8f99fbb02c
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
4eb71c8940
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
c527ed77b8
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
6f7b5bd63f
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
3b7b192b6a
Remove a dead method
...
llvm-svn: 8978
2003-10-09 05:25:34 +00:00
Chris Lattner
55e1c2edfb
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
c920c81739
Inline the postResolveValues method. It was poorly named anyway
...
llvm-svn: 8976
2003-10-08 21:51:46 +00:00
Chris Lattner
a7d6d16c13
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
7b758ed3b5
Destroy allocated resources on exception.
...
llvm-svn: 8969
2003-10-08 19:55:47 +00:00
Brian Gaeke
7bd96d6b90
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
def80d731a
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
7a9db7a722
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
0e866f36a0
Use V for values, not D.
...
llvm-svn: 8848
2003-10-04 19:29:21 +00:00
Chris Lattner
2b8c4bf029
Do not leak the ModuleProvider if releaseModule() throws.
...
llvm-svn: 8847
2003-10-04 19:19:37 +00:00
Chris Lattner
62331c44ab
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
ae8b7c1a56
Just rethrow previous exception instead of making a new one
...
llvm-svn: 8718
2003-09-26 14:44:52 +00:00
Chris Lattner
222df3cfc5
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
6d9f1022d5
Fix alignment problem
...
llvm-svn: 8707
2003-09-24 22:34:17 +00:00
Misha Brukman
08e8d47b1e
Actually assign the string correctly through the std::string pointer.
...
llvm-svn: 8704
2003-09-24 22:10:47 +00:00
Misha Brukman
c16b33f803
* 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
92b65ebb52
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
12fd3ebd72
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
055804accd
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
fbb96c627b
* 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
63749f4126
* 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
e05ffcca52
Removed no longer used member variable.
...
llvm-svn: 8677
2003-09-22 23:58:08 +00:00
Misha Brukman
c68b0950aa
Added file header comment.
...
llvm-svn: 8675
2003-09-22 23:44:46 +00:00
Chris Lattner
b98aa0e0fb
Update file header for renamed file
...
llvm-svn: 8673
2003-09-22 23:42:00 +00:00
Misha Brukman
41f2a38c92
* 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
Misha Brukman
629711a7c3
Fixed spelling and grammar.
...
llvm-svn: 8489
2003-09-11 22:34:13 +00:00
Chris Lattner
d75fa85cc1
Fix bug
...
llvm-svn: 8410
2003-09-08 19:43:46 +00:00
Chris Lattner
4ad8720f91
Add support for the unwind instruction
...
llvm-svn: 8408
2003-09-08 18:54:55 +00:00
Chris Lattner
049cadf854
Read volatile loads/stores
...
llvm-svn: 8401
2003-09-08 18:20:14 +00:00
Chris Lattner
cd6bbd3823
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.
llvm-svn: 8395
2003-09-08 18:04:16 +00:00
Chris Lattner
a70297a209
Fix reading of invoke instrs
...
llvm-svn: 8365
2003-09-05 18:25:29 +00:00
Chris Lattner
1bb427b0a7
Whoa, we were misreading invoke instructions "normal" destinations quite badly.
...
llvm-svn: 8363
2003-09-05 05:27:58 +00:00
Chris Lattner
4caa92eca5
Non-functional change
...
llvm-svn: 8352
2003-09-04 23:47:07 +00:00
Chris Lattner
0b78090518
Avoid printing meaningless numbers
...
llvm-svn: 8342
2003-09-03 20:25:27 +00:00
Chris Lattner
4e722bde53
Follow the pattern of all other atu's
...
llvm-svn: 8340
2003-09-03 16:01:54 +00:00
Chris Lattner
03980a2b30
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.
llvm-svn: 8118
2003-08-24 13:47:36 +00:00
Chris Lattner
f35db86ae4
Rename SwitchInst::dest_push_back -> addCase
...
llvm-svn: 8089
2003-08-23 23:14:52 +00:00
Misha Brukman
56f7db4178
Spell `necessary' correctly.
...
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
1351c304dc
Remove redundant const qualifiers from cast<> expressions
...
llvm-svn: 7253
2003-07-23 15:30:06 +00:00
Misha Brukman
5de3e14206
The word separate' only has one
e'.
...
llvm-svn: 7173
2003-07-14 17:20:40 +00:00
John Criswell
258dfc0319
Merged in autoconf branch. This provides configuration via the autoconf
...
system.
llvm-svn: 7014
2003-06-30 21:59:07 +00:00
Chris Lattner
75e1e892a6
Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
...
llvm-svn: 6774
2003-06-18 19:22:36 +00:00
Chris Lattner
23450e834e
Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx
...
"yes, invoke instructions can have just three arguments"
llvm-svn: 6736
2003-06-17 13:31:10 +00:00
Chris Lattner
f354fef44b
Do not assert fail or crash when a bytecode parse fails!
...
llvm-svn: 6284
2003-05-22 18:26:48 +00:00
Chris Lattner
bb4bd699e0
Eliminate the uchar typedef, use unsigned char explicitly
...
llvm-svn: 6283
2003-05-22 18:08:30 +00:00
Chris Lattner
a8490da0eb
Fix Bug: Assembler/2003-05-12-MinIntProblem.llx
...
llvm-svn: 6123
2003-05-12 15:13:52 +00:00
Chris Lattner
e1faff42f4
Add support for the new va_arg instruction
...
llvm-svn: 6029
2003-05-08 02:44:12 +00:00
Misha Brukman
c881f68151
Fixed 'prevalent'.
...
llvm-svn: 5860
2003-04-23 02:59:05 +00:00
Chris Lattner
08a79481cd
Add support for reading and writing pointersize/endianness to and from bytecode
...
llvm-svn: 5839
2003-04-22 18:15:10 +00:00
Chris Lattner
3327cb03d4
Preserve module source information in the ModuleID
...
llvm-svn: 5836
2003-04-22 18:02:52 +00:00
Chris Lattner
c1da4513e0
Initial support for reading standard .a files
...
llvm-svn: 5820
2003-04-19 21:45:34 +00:00
Chris Lattner
8b1c27945b
Add support for reading unaligned bytecode buffers
...
llvm-svn: 5819
2003-04-19 21:45:17 +00:00
Chris Lattner
8453f87c9c
Fix a big bad bug I checked in yesterday :(
...
llvm-svn: 5807
2003-04-18 04:11:56 +00:00
Chris Lattner
545bebf00c
Add support to the bytecode reader/writer for the new linkage types
...
llvm-svn: 5790
2003-04-16 21:16:05 +00:00
Chris Lattner
fa4f750f3e
Add new linkage types to support a real frontend
...
llvm-svn: 5786
2003-04-16 20:28:45 +00:00
Chris Lattner
dd194d3844
* Bug fixes:
...
- Fix problems where the constant table would not get updated when
resolving constants causes other constants to change.
Changes to the V2 bytecode format
- Null values are implicitly encoded instead of explicitly, this makes
things more compact!
- More compactly represent ConstantPointerRefs
- Bytecode files are represented as:
Header|GlobalTypes|GlobalVars/Function Protos|Constants|Functions|SymTab
instead of
Header|GlobalTypes|Constants|GlobalVars/Function Protos|Functions|SymTab
which makes a lot of things simpler.
Changes to the reader:
- Function loading code is much simpler. We now no longer make function
PlaceHolderHelper objects to be replaced with real functions.
llvm-svn: 5748
2003-03-19 20:54:26 +00:00
Chris Lattner
1bb2b2b8c9
Infrastructure for more compact bytecode files and REAL support for versioning
...
llvm-svn: 5716
2003-03-06 17:55:45 +00:00
Chris Lattner
70b5574318
s/Method/Function in variable and method names
...
llvm-svn: 5715
2003-03-06 17:18:14 +00:00
Chris Lattner
66c7c883d3
Continue simplifying error handling, s/method/function
...
llvm-svn: 5714
2003-03-06 17:15:19 +00:00
Chris Lattner
5210697f31
Cleanup error handling constructs
...
llvm-svn: 5713
2003-03-06 17:03:28 +00:00
Chris Lattner
84c6e94784
Pull common code out
...
llvm-svn: 5712
2003-03-06 16:50:32 +00:00
Chris Lattner
f9b71aab86
Use the std namespace explicitly
...
llvm-svn: 5708
2003-03-06 16:32:25 +00:00
Chris Lattner
b5027095e5
- Eliminated the deferred symbol table stuff in Module & Function, it really
...
wasn't an optimization and it was causing lots of bugs.
llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Chris Lattner
dd74dc44b6
- Fix a really nasty bug in the bytecode reader that caused it to fail
...
reading bytecode files with > 255 types in them, but only when optimization
is enabled. This was caused by GCC shrinking an enum to a single byte
instead of a whole word.
llvm-svn: 4266
2002-10-23 00:51:54 +00:00
Chris Lattner
a2c2d8af59
Wow, for some reason, when reading bytecode from stdin, we were only reading
...
4 bytes at a time. Change this to read blocks of 4k
llvm-svn: 4265
2002-10-22 23:55:24 +00:00
Chris Lattner
33988dc76d
There is no way to guarantee that constants are not forward referenced.
...
Handle forward referenced constants in a general way. This fixes bug:
Assembler/2002-10-13-ConstantEncodingProblem.llx and allows the SPEC
197.parser benchmark to be built
llvm-svn: 4161
2002-10-14 03:33:02 +00:00
Chris Lattner
82f54dca49
- Change Function's so that their argument list is populated when they are
...
constructed. Before, external functions would have an empty argument list,
now a Function ALWAYS has a populated argument list.
llvm-svn: 4149
2002-10-13 20:57:00 +00:00
Chris Lattner
fdf2ca9468
- Rename Instruction::First*Op to *OpsBegin, and Num*Ops to *OpsEnd to
...
reflect the fact that it's a range being defined.
llvm-svn: 4147
2002-10-13 19:39:16 +00:00
Anand Shukla
da24f223d3
Changed uchar to unsigned char in function ParseBytecodeBuffer, because seemingly it affects opt in uncertain ways :)
...
llvm-svn: 3866
2002-09-20 20:57:54 +00:00
Chris Lattner
547be87c13
Change the MallocInst & AllocaInst ctors to take the allocated type, not the
...
pointer type returned.
llvm-svn: 3711
2002-09-13 22:28:50 +00:00
Chris Lattner
20b85d96e4
Eliminated the MemAccessInst class, folding contents into GEP class.
...
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Chris Lattner
969c616d51
Load & StoreInst no longer derive from MemAccessInst, so we don't have
...
to handle indexing anymore
llvm-svn: 3485
2002-08-22 22:49:05 +00:00
Chris Lattner
65c79aaf22
Emit an obnoxious warning message for bytecode that includes load/store
...
instructions that use indexing. Convert them transparently into a pair
of instructions.
llvm-svn: 3431
2002-08-21 22:55:27 +00:00
Chris Lattner
ebf7d3b8ff
Fix bug: test/Regression/Assembler/2002-08-19-BytecodeReader.llx
...
llvm-svn: 3384
2002-08-19 16:48:21 +00:00
Chris Lattner
8cc9a599b5
Turn off a debugging optimization that just slows bytecode reading down
...
llvm-svn: 3377
2002-08-18 00:38:32 +00:00
Chris Lattner
31188e9d7b
Fix stupid oversight of missing #include.
...
llvm-svn: 3367
2002-08-17 22:02:41 +00:00
Chris Lattner
f3d49adf85
- Finally nailed: test/Regression/Assembler/2002-08-16-ConstExprInlined.llx
...
- ParseConstantPool was resolving reference to value using the function
slot # instead of the global slot #.
- Bytecode reader changes:
- Remove the failure<> template from Bytecode Reader
- Remove extraneous #includes
- s/method/function/ a bit
- Eliminate the fwdRefs class that just added abstraction where it was not
needed, making things more complex.
- Use a vector instead of a list for function signatures.
llvm-svn: 3366
2002-08-17 22:01:27 +00:00
Chris Lattner
6a9d88347a
Remove support for Not ConstantExpr. This simplifies the unary case to only
...
have to support the cast instruction, so the function is renamed to getCast.
llvm-svn: 3328
2002-08-14 18:24:09 +00:00
Chris Lattner
12b9a2a7e6
Cleanup ConstantExpr handling:
...
* Correctly delete TypeHandles in AsmParser. In addition to not leaking
memory, this prevents a bug that could have occurred when a type got
resolved that the constexpr was using
* Check for errors in the AsmParser instead of hitting assertion failures
deep in the code
* Simplify the interface to the ConstantExpr class, removing unneccesary
parameters to the ::get* methods.
* Rename the 'getelementptr' version of ConstantExpr::get to
ConstantExpr::getGetElementPtr
llvm-svn: 3160
2002-07-30 18:54:22 +00:00
Chris Lattner
469e4fc557
Break line to fit 80 columns
...
llvm-svn: 3083
2002-07-25 15:40:04 +00:00
Chris Lattner
24bcbdd155
*** empty log message ***
...
llvm-svn: 3002
2002-07-23 17:52:38 +00:00