summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* don't assert and die on out of range (undefined) shifts. This fixesChris Lattner2009-01-161-4/+16
| | | | | | PR3334. llvm-svn: 62352
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-2/+2
| | | | | | suggested by Chris. llvm-svn: 62099
* Large mechanical patch.Devang Patel2008-09-251-2/+2
| | | | | | | | | | | | | | | s/ParamAttr/Attribute/g s/PAList/AttrList/g s/FnAttributeWithIndex/AttributeWithIndex/g s/FnAttr/Attribute/g This sets the stage - to implement function notes as function attributes and - to distinguish between function attributes and return value attributes. This requires corresponding changes in llvm-gcc and clang. llvm-svn: 56622
* s/ParameterAttributes/Attributes/gDevang Patel2008-09-231-1/+0
| | | | llvm-svn: 56513
* Add a new hidden option to the interpreter to cause it to printChris Lattner2008-07-081-0/+8
| | | | | | | out every volatile load and store. This is useful for tracking down insane volatile memory bugs. llvm-svn: 53241
* fix warnings with assertions disabled.Chris Lattner2008-04-061-21/+6
| | | | llvm-svn: 49285
* Update gcc 4.3 warnings fix patch with recent head changesAnton Korobeynikov2008-02-201-11/+12
| | | | llvm-svn: 47368
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-1/+2
| | | | | | annoying warnings. llvm-svn: 47367
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Add some convenience methods for querying attributes, andDuncan Sands2007-11-281-12/+9
| | | | | | use them. llvm-svn: 44403
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* Fix an assertion abort on sparc. malloc(0) is allowed toGabor Greif2007-10-111-1/+3
| | | | | | return NULL. llvm-svn: 42871
* #ifdef out unsafe tracing code, which fixes PR1689Chris Lattner2007-09-211-15/+17
| | | | llvm-svn: 42205
* rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()Chris Lattner2007-08-231-2/+3
| | | | | | Add an APSInt::toString() method. llvm-svn: 41309
* For PR1486:Reid Spencer2007-06-011-1/+1
| | | | | | | Avoid overwriting the APInt instance with 0 bytes which causes the bitwidth to be set to 0 (illegal) producing a subsequent assert. llvm-svn: 37391
* Print integer values as both decimal and hexadecimal for convenienceReid Spencer2007-05-171-1/+1
| | | | | | of verifying result values when debugging. llvm-svn: 37156
* Avoid a "loss of precision" error in gcc 4.1.3.Reid Spencer2007-05-161-1/+1
| | | | llvm-svn: 37105
* Implement printing of instruction result values when debug info is turnedReid Spencer2007-05-161-0/+21
| | | | | | | on. This helps to speed up the debugging time by showing computational results as the program executes. llvm-svn: 37095
* Bitcast all the bits of a floating point value, not just one. The zeroReid Spencer2007-05-041-0/+2
| | | | | | | | extension is needed because the constructor for the Destination value causes the APInt to have a bit width of 1. Patch by Guoling Han. llvm-svn: 36733
* 1. Don't swap byte order in scanf. It isn't necessary and leads toReid Spencer2007-04-261-1/+1
| | | | | | | | incorrect results (canonicalization was dropped several commits ago). 2. Add support for fscanf. 3. Suppress a warning about cast to pointer from non-pointer-sized integer. llvm-svn: 36482
* eliminate use of Instruction::getPrev(). Patch by Gabor Greif in 2005.Chris Lattner2007-04-171-3/+6
| | | | llvm-svn: 36198
* Implement @sext and @zext parameter attribute handling properly instead ofReid Spencer2007-04-161-11/+20
| | | | | | | forcing every small argument of every function regardless of attributes or calling convention to be expanded. llvm-svn: 36174
* Don't use std::hex.Bill Wendling2007-03-081-1/+1
| | | | llvm-svn: 35038
* Don't use a cast. It causes an error on some platforms.Bill Wendling2007-03-081-1/+1
| | | | llvm-svn: 35037
* Fix some thinko's in the last patch. PtrSize has to be in bits and weReid Spencer2007-03-061-2/+2
| | | | | | might need to zext not just trunc the value. llvm-svn: 34955
* Fix a bug in IntToPtr. Truncating to 64-bits only works if the integerReid Spencer2007-03-061-1/+5
| | | | | | is larger. Adjust so that it truncates to pointer width, only if necessary. llvm-svn: 34954
* Radically simplify execution. This patch gets rid of all the specialReid Spencer2007-03-061-636/+128
| | | | | | | | handling for integer of various sizes. GenericValue now has just a single integer field of type APInt. We use its facilities directly in the execution of all instructions. llvm-svn: 34951
* Complete the APIntification of the interpreter. All asserts for > 64 bitsReid Spencer2007-03-031-118/+209
| | | | | | | have been removed and dealt with. The interpreter should now be able to execute any LLVM program using any bit width. llvm-svn: 34884
* Implement APInt support for the binary operators.Reid Spencer2007-03-031-254/+240
| | | | | | | Move the getConstantExpr function towards the end of the file so we don't need a dozen forward declarations. llvm-svn: 34877
* From Dan Gohman:Chris Lattner2007-02-141-1/+1
| | | | | | | | | | While preparing http://llvm.org/PR1198 I noticed several asserts protecting unprepared code from i128 types that weren't actually failing when they should because they were written as assert("foo") instead of something like assert(0 && "foo"). This patch fixes all the cases that a quick grep found. llvm-svn: 34267
* Privatize StructLayout::MemberOffsets, adding an accessorChris Lattner2007-02-101-1/+1
| | | | llvm-svn: 34156
* For PR1188:Reid Spencer2007-02-081-1/+1
| | | | | | | | Compute BitMask correctly. Patch by Leo (wenwenti@hotmail.com). llvm-svn: 34026
* Changes to support making the shift instructions be true BinaryOperators.Reid Spencer2007-02-021-3/+3
| | | | | | | | | | | | This feature is needed in order to support shifts of more than 255 bits on large integer types. This changes the syntax for llvm assembly to make shl, ashr and lshr instructions look like a binary operator: shl i32 %X, 1 instead of shl i32 %X, i8 1 Additionally, this should help a few passes perform additional optimizations. llvm-svn: 33776
* For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoidReid Spencer2007-01-301-2/+2
| | | | | | confusion with external linkage types. llvm-svn: 33663
* For PR970:Reid Spencer2007-01-211-1/+1
| | | | | | | Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! llvm-svn: 33415
* Implement the signed icmp instructions properly. To do this we introduceReid Spencer2007-01-201-17/+27
| | | | | | | | a small inline function to sign extend a uint64_t value based on its type's bitwidth. This function is then used in both executeSExtInst and the various executeICMP_S** functions. llvm-svn: 33403
* Implement bit-accurate sext instruction.Reid Spencer2007-01-201-10/+14
| | | | | | This patch fixes test/Integer/2007-01-17-TruncSext.ll llvm-svn: 33394
* Use the new maskToBitWidth function to ensure that the results ofReid Spencer2007-01-181-10/+15
| | | | | | computations do not overflow the intended bit width. llvm-svn: 33326
* Make shl instruction mask its result to the correct bitsize. This isReid Spencer2007-01-181-5/+10
| | | | | | | sufficient to get llvm-test/SingleSource/UnitTests/Integer/general-test.ll working with lli in interpreter mode. llvm-svn: 33321
* Two changes:Reid Spencer2007-01-181-18/+17
| | | | | | | | | 1. Fix logic for executeGEP. Only 32-bit and 64-bit integer types are acceptable as indices. 2. Ensure that all integer cast operations truncate their result to the integer size of the operand. llvm-svn: 33318
* rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.Chris Lattner2007-01-151-6/+6
| | | | | | | | | rename Type::getIntegralTypeMask to Type::getIntegerTypeMask. This makes naming much more consistent. For example, there are now no longer any instances of IntegerType that are not considered isInteger! :) llvm-svn: 33225
* eliminate calls to Type::isInteger, preferring isIntegral instead.Chris Lattner2007-01-151-4/+4
| | | | llvm-svn: 33222
* For PR1064:Reid Spencer2007-01-121-379/+686
| | | | | | | | | | | | | | | | | | | | | | | Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. llvm-svn: 33113
* Rename BoolTy as Int1Ty. Patch by Sheng Zhou.Reid Spencer2007-01-111-26/+26
| | | | llvm-svn: 33076
* For PR950:Reid Spencer2006-12-311-319/+207
| | | | | | Convert signed integer types to signless ones. llvm-svn: 32787
* For PR950:Reid Spencer2006-12-231-112/+329
| | | | | | | | This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. llvm-svn: 32751
* elimiante Statistic static ctorsChris Lattner2006-12-191-5/+2
| | | | llvm-svn: 32702
* Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, areBill Wendling2006-12-071-29/+28
| | | | | | now cerr, cout, and NullStream resp. llvm-svn: 32298
* Detemplatize the Statistic class. The only type it is instantiated withChris Lattner2006-12-061-1/+1
| | | | | | is 'unsigned'. llvm-svn: 32279
* Unbreak VC++ build.Jeff Cohen2006-12-021-0/+1
| | | | llvm-svn: 32113
OpenPOWER on IntegriCloud