Commit Graph

191 Commits

Author SHA1 Message Date
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
Chris Lattner
abe83ae992 Fix a spello Misha made while fixing one of my appostrifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8510 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 00:33:20 +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
0fe56f42ab Add support for writing volatile load/stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8394 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 17:58:37 +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
Chris Lattner
987cb2c3da Remove explicit const qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7245 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 14:54:33 +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
Chris Lattner
893f025262 Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6774 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 19:22:36 +00:00
Chris Lattner
eaeaad614c Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx
"yes, invoke instructions can have just three arguments"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6736 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 13:31:10 +00:00
Chris Lattner
f69315bd79 Fix bug: Assembler/2003-05-03-BytecodeReaderProblem.llx
by emitting the type planes before any constants (which could be constant
expressions involving undefined types!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:35:38 +00:00
Chris Lattner
a2602f3dfd Do not assert fail or crash when a bytecode parse fails!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6284 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:26:48 +00:00
Chris Lattner
12e6465d89 Eliminate the uchar typedef, use unsigned char explicitly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6283 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:08:30 +00:00
Chris Lattner
8017a7575e Fix Bug: Assembler/2003-05-12-MinIntProblem.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6123 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 15:13:52 +00:00
Chris Lattner
8f77daef04 Add support for the new va_arg instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6029 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 02:44:12 +00:00
Misha Brukman
09ff1509ba Fixed 'prevalent'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5860 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 02:59:05 +00:00
Chris Lattner
76e3896881 Add support for reading and writing pointersize/endianness to and from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5839 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 18:15:10 +00:00
Chris Lattner
75f20532ec Preserve module source information in the ModuleID
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5836 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 18:02:52 +00:00
Chris Lattner
968cfd0b6e Initial support for reading standard .a files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5820 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 21:45:34 +00:00
Chris Lattner
f6099df194 Add support for reading unaligned bytecode buffers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5819 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 21:45:17 +00:00
Chris Lattner
869de25380 Fix a big bad bug I checked in yesterday :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5807 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 04:11:56 +00:00
Chris Lattner
e3869c83e7 Add support to the bytecode reader/writer for the new linkage types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5790 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 21:16:05 +00:00
Chris Lattner
4ad02e726d Add new linkage types to support a real frontend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5786 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 20:28:45 +00:00
Chris Lattner
3413d150dc * Change the order that globals and constants are processed in
* Add support for implicit zero initializers


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5750 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-19 20:57:22 +00:00
Chris Lattner
186a1f71e6 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.

Writer changes:
  - We now explictly encode versioning information in the bytecode files.
  - This allows new code to read bytecode files produced by old code, but
    new bytecode files can have enhancements such as the above.  Although this
    makes the reader a bit more complex (having to deal with old formats), the
    writer only needs to be able to produce the most recent version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5749 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-19 20:56:46 +00:00
Chris Lattner
52e20b0977 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5748 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-19 20:54:26 +00:00