summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Turn a use of intptr_t into a reinterpret_cast<uint64_t> instead to getReid Spencer2004-08-041-1/+2
| | | | | | rid of compilation warnings on some platforms. llvm-svn: 15512
* Make getGlobalTableValue not use getTypeSlot, this speeds up the bc readerChris Lattner2004-08-041-23/+28
| | | | | | by 5% on eon llvm-svn: 15452
* Do not do a linear std::find to reconstruct information we had, but later threwChris Lattner2004-08-031-17/+10
| | | | | | away. This speeds up by .bc reader by 30% in a profile build on 252.eon. llvm-svn: 15450
* Simplify code and silence warningChris Lattner2004-07-271-6/+4
| | | | llvm-svn: 15255
* Fix a serious bug in the double constant reader. In particular, becauseChris Lattner2004-07-251-1/+2
| | | | | | | | (At[3] << 24) is an int type and it is being coerced to uint64_t, it was getting sign extended, causing us to get FFFFFFFFxxxxxxxx constants all of the time. llvm-svn: 15224
* Always write FP values correctly.Reid Spencer2004-07-251-35/+21
| | | | | | | Adjust for new Module.h interface for dependent libraries. Excise unused backwards compatibility flag. llvm-svn: 15220
* bug 263:Reid Spencer2004-07-251-28/+136
| | | | | | | | | | | | | | | | - encode/decode target triple and dependent libraries bug 401: - fix encoding/decoding of FP values to be little-endian only bug 402: - initial (compatible) cut at 24-bit types instead of 32-bit - reduce size of block headers by 50% Other: - cleanup Writer by consolidating to one compilation unit, rem. other files - use a std::vector instead of std::deque so the buffer can be allocated in multiples of 64KByte chunks rather than in multiples of some smaller (default) number. llvm-svn: 15210
* bug 122:Reid Spencer2004-07-181-9/+5
| | | | | | | - Replace ConstantPointerRef usage with GlobalValue usage - Correct isa<Constant> for GlobalValue subclass llvm-svn: 14939
* Actually set the endian/pointersize flags on the module being read in!Brian Gaeke2004-07-141-0/+3
| | | | llvm-svn: 14826
* Fix warning on SparcV9, where sizeof (int) != sizeof (void *).Brian Gaeke2004-07-131-1/+1
| | | | llvm-svn: 14786
* Various cleanups:Reid Spencer2004-07-111-153/+193
| | | | | | | | | | | | | | | | - Remove tabs - Standardize use of space around ( and ). - Consolidate the ConstantPlaceHolder class - Rename two methods to be more meaningful (ParseType, ParseTypes) - Correct indentation of blocks - Add documentation - Convert input dependent asserts to error(...) so it throws instead. Provide placeholder implementations of read_float and read_double that still read in platform-specific endianess. When I figure out how to do this without knowing the endianess of the platform, it will get implemented correctly. llvm-svn: 14765
* Error Handling Cleanup:Reid Spencer2004-07-091-121/+127
| | | | | | | | | | - get rid of PARSE_ERROR macro - add error(std::string) function - use error(std::string) for all errors - make input dependent asserts call error(std::string) instead - ensure asserts are only for logic bugs, not input discrepancies. llvm-svn: 14729
* Fix a backwards compatibility bug found by Tanya. In version 1.2, theReid Spencer2004-07-091-0/+5
| | | | | | | | | global type plane starts with a length and the TypeTyID value to identify the type plane has having type definitions. This doesn't happen in 1.3 because the types are read from a known position in the file. However, the TypeTyID must be read in (and ignored) if its a 1.2 bytecode file. llvm-svn: 14728
* Finalize bytecode dumping. The "handleFinish" method was getting calledReid Spencer2004-07-051-6/+13
| | | | | | | | too soon so the function data was not getting dumped (it was generated after the call handleFinish). Also cleaned up the output format for proper indentation. llvm-svn: 14627
* - Don't use macros to call the BytecodeHandlerReid Spencer2004-07-041-278/+434
| | | | | | | | | | | - Don't use PARSE_ERROR macro unnecessarily (for simple strings) - Add comments before each function - Convert for bug 122 (Type != Value) - Handle new value range on Type::PrimitiveTypeId enumeration by augmenting the reader with a new read_typeid method and sanitizeTypeId method. - Remove BytecodeHandler's default method implementations to header file. llvm-svn: 14604
* MAJOR REWRITE.Reid Spencer2004-06-291-326/+1355
| | | | | | | | | | | | | | | | | | - stop passing Buf/BufEnd to every function (now member vars) - internalize things that used to be in a header file that no one else included/needed. - Remove defunct BCR_TRACE lines - Standardize error handling with the PARSE_ERROR macro. - Integrate ConstantReader.cpp and InstructionReader.cpp and reorgnize the definition order so that gcc has a chance at optimizing this module - Standardize case and style of method names. - Eliminate unneeded header files - Prepare for Type != Value (bug122) change by splitting Types into their own data structures. - Implement the BytecodeHandler interface calls. - Provide default implementation of BytecodeHandler interface. llvm-svn: 14494
* Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()Chris Lattner2004-06-171-2/+2
| | | | llvm-svn: 14201
* Implement support for a new LLVM 1.3 bytecode format, which uses uint'sChris Lattner2004-04-051-3/+8
| | | | | | | to index into structure types and allows arbitrary 32- and 64-bit integer types to index into sequential types. llvm-svn: 12651
* Remove a bunch of cruft that was used to be backwards compatible with the lastChris Lattner2004-04-031-26/+5
| | | | | | | prerelease format for LLVM bytecode files. Now we only are compatible with LLVM 1.0+. llvm-svn: 12643
* Make error message a bit nicer.Chris Lattner2004-03-291-1/+1
| | | | | | Contributed by Reid Spencer llvm-svn: 12523
* Start using the new and improve interface to FunctionType argumentsChris Lattner2004-02-091-12/+9
| | | | llvm-svn: 11224
* Fix bogus warning and simplify codeChris Lattner2004-01-201-11/+5
| | | | llvm-svn: 10924
* Bugfixes for dealing with partially compactified functionsChris Lattner2004-01-201-6/+19
| | | | llvm-svn: 10920
* Save another 30K from 176.gcc by encoding the compaction table a bit moreChris Lattner2004-01-181-4/+17
| | | | | | intelligently. llvm-svn: 10918
* Add support for reading bytecode files with compactiontables for bytecode files.Chris Lattner2004-01-181-30/+129
| | | | | | | | This shrinks the bytecode file for 176.gcc by about 200K (10%), and 254.gap by about 167K, a 25% reduction. There is still a lot of room for improvement in the encoding of the compaction table. llvm-svn: 10914
* Bytecode format for LLVM 1.2 no longer explicitly encodes zeros in primitiveChris Lattner2004-01-171-8/+14
| | | | | | | type planes. This saves about 5k on 176.gcc, and is needed for a subsequent patch of mine I'm working on. llvm-svn: 10908
* Allow bytecode files to refer directly to global values as constants, insteadChris Lattner2004-01-151-2/+6
| | | | | | | | of forcing them to go through ConstantPointerRef's. This allows bytecode files to mirror .ll files, allows more efficient encoding, and makes it easier to eventually eliminate CPR's. llvm-svn: 10883
* Fix PR73Chris Lattner2004-01-151-1/+10
| | | | llvm-svn: 10875
* Change all of the bytecode reader primitives to throw exceptions instead ofChris Lattner2004-01-151-37/+18
| | | | | | | | | | returning error codes. Because they don't return an error code, they can return the value read, which simplifies the code and makes the reader more efficient (yaay!). Also eliminate the special case code for little endian machines. llvm-svn: 10871
* Version 1.2 now supports encoding strings as a special case, to avoid havingChris Lattner2004-01-141-2/+5
| | | | | | to emit all of those sbyte constants. llvm-svn: 10863
* Remove support for the pre-1.0 bytecode version #1. This will becomeChris Lattner2004-01-141-59/+34
| | | | | | the bytecode revision generated by LLVM 1.2. llvm-svn: 10848
* remove some useless #includesChris Lattner2003-12-301-9/+0
| | | | llvm-svn: 10654
* Emit & read more compressed bytecode by not emitting a bytecodeblock forChris Lattner2003-12-011-1/+41
| | | | | | | | | | | | | | | | | | | each basic block in function. Instead, just emit a stream of instructions, chopping up basic blocks based on when we find terminator instructions. This saves a fairly substantial chunk of bytecode space. In stripped, sample cases, for example, we get this reduction in size: 197.parser: 163036 -> 137180: 18.8% reduction 254.gap : 844936 -> 689392: 22.6% 255.vortex: 621724 -> 528444: 17.7% ... Not bad for something this simple. :) Note that this doesn't require a new bytecode version number at all, though version 1.1 should not need to support the old format. llvm-svn: 10280
* * Finegrainify namespacificationChris Lattner2003-11-191-59/+34
| | | | | | | | | | | | | * Strength reduce several data structures which were left over from the "bad old days" * Minor efficiency improvements * Major efficiency improvement: In BytecodeParser::insertValue, do not allocate a new ValueTab entry just because some value exists with a large type. This dramatically reduces the number of allocations/deallocations performed by the bytecode reader, and speeds up parsing of Kimwitu++ from 34s to 17s. This is to help address PR127 llvm-svn: 10085
* Minor speedup to do less linear time searches of information we already have.Chris Lattner2003-11-191-2/+3
| | | | | | speeds up disassembly of kc++ by .6s llvm-svn: 10079
* Put all LLVM code into the llvm namespace, as per bug 109.Brian Gaeke2003-11-111-0/+4
| | | | llvm-svn: 9903
* Added LLVM project notice to the top of every C++ source file.John Criswell2003-10-201-0/+7
| | | | | | Header files will be on the way. llvm-svn: 9298
* Fix warningChris Lattner2003-10-181-0/+1
| | | | llvm-svn: 9236
* add support for new linkage typesChris Lattner2003-10-181-4/+14
| | | | llvm-svn: 9228
* * New revised variable argument handling supportChris Lattner2003-10-181-33/+30
| | | | | | | * More dense bytecode encoding for varargs calls (like printf) * Eliminated the extremely old bytecode format. rev #0 is now 1.0 llvm-svn: 9220
* Add support for 'weak' linkage.Chris Lattner2003-10-161-2/+12
| | | | | | | | 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
* Minor cleanupsChris Lattner2003-10-131-2/+2
| | | | llvm-svn: 9079
* Avoid calling getTypeSlot moreChris Lattner2003-10-131-3/+7
| | | | llvm-svn: 9077
* Ok, the "fix" for this is to do a real associative container. Symbol tablesChris Lattner2003-10-101-15/+11
| | | | | | | 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
* Another 10% performance improvement by not using replaceAllUsesWithChris Lattner2003-10-091-13/+20
| | | | llvm-svn: 8994
* Use the version of getValue that takes the type plane instead of the typeChris Lattner2003-10-091-1/+2
| | | | | | if possible. This provides a consistent 8.5% speedup. llvm-svn: 8991
* Pass a vector around to reduce dynamic allocationChris Lattner2003-10-091-1/+2
| | | | | | Throw the RawInst class in an anon namespace llvm-svn: 8990
* Change getConstantValue to throw an exception on error, not return nullChris Lattner2003-10-091-1/+4
| | | | llvm-svn: 8988
* Remove potentially N^2 algorithm from symbol table reader. No speedupChris Lattner2003-10-091-5/+13
| | | | | | in practice though llvm-svn: 8985
* Major refactoring of the bytecode reader. This includes the followingChris Lattner2003-10-091-31/+18
| | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud