aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine/Interpreter
Commit message (Collapse)AuthorAgeFilesLines
* #ifdef out unsafe tracing code, which fixes PR1689Chris Lattner2007-09-211-15/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42205 91177308-0d34-0410-b5e6-96231b3b80d8
* rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()Chris Lattner2007-08-231-2/+3
| | | | | | | | Add an APSInt::toString() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41309 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment: don't expect from external function resolver in interpreterAnton Korobeynikov2007-07-301-0/+5
| | | | | | | things, it wasn't designed to handle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40608 91177308-0d34-0410-b5e6-96231b3b80d8
* More explicit keywords.Dan Gohman2007-07-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40589 91177308-0d34-0410-b5e6-96231b3b80d8
* VStudio compiler errors and placing Function*->ExFunc map under ↵Chuck Rose III2007-07-271-4/+5
| | | | | | | | | | | | | ManagedStatic control. This commit fixes two things. One is a pair of VStudio compiler errors stemming from variables which defined within the for loop statement and also within the body of the for loop. I fixed these by renaming one of the two variables. Additionally, I've made the Function*->ExFunc map in ExternalFunctions.cpp a ManagedStatic object, so that cleanup will be done on llvm_shutdown. In repeated uses of the interpreter, where the same Function* address may get used for completely differnet functions, this was causing a crash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40558 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1486:Reid Spencer2007-06-012-2/+2
| | | | | | | | Avoid overwriting the APInt instance with 0 bytes which causes the bitwidth to be set to 0 (illegal) producing a subsequent assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37391 91177308-0d34-0410-b5e6-96231b3b80d8
* On Linux platforms and at optimization levels -O1 and above, llvm-gcc canReid Spencer2007-05-191-3/+14
| | | | | | | | turn "putchar" calls into _IO_putc calls which is a lower-level interface. This patch allows these calls to be executed by lli in interpreter mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37254 91177308-0d34-0410-b5e6-96231b3b80d8
* Print integer values as both decimal and hexadecimal for convenienceReid Spencer2007-05-171-1/+1
| | | | | | | of verifying result values when debugging. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37156 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid a "loss of precision" error in gcc 4.1.3.Reid Spencer2007-05-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37105 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37095 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36733 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36482 91177308-0d34-0410-b5e6-96231b3b80d8
* We only need one putchar which gives it a shot at getting matched by itsReid Spencer2007-04-211-17/+4
| | | | | | | users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36305 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate use of Instruction::getPrev(). Patch by Gabor Greif in 2005.Chris Lattner2007-04-171-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36198 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36174 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1293:Reid Spencer2007-03-301-49/+67
| | | | | | | | | | | * Rename the FunctionType* parameter from M to FT on all the functions. * Implement a fix for PR1293 by just asserting that library functions that must return pointers should have pointer typed results. This just makes sure that we don't attempt to use an uninitialized integer or something later on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35508 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use std::hex.Bill Wendling2007-03-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35038 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use a cast. It causes an error on some platforms.Bill Wendling2007-03-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35037 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34955 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34954 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34951 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust and simplify external function processing now that GenericValue hasReid Spencer2007-03-061-33/+41
| | | | | | | a single integer field of type APInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34950 91177308-0d34-0410-b5e6-96231b3b80d8
* APInt's are no longer allocated on the heap because they are directReid Spencer2007-03-061-12/+0
| | | | | | | | members of GenericValue. Consequently the code to clean them up isn't needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34948 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the insufficient code in Interpreter::create that computed theReid Spencer2007-03-061-12/+0
| | | | | | | | | Target DataLayout incorrectly. For now, we'll trust that the module has got the correct DataLayout. In the future, this needs to be changed to tell the TargetData to be "current host". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34947 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary #include.Reid Spencer2007-03-031-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34889 91177308-0d34-0410-b5e6-96231b3b80d8
* Deal with error handling better.Reid Spencer2007-03-032-8/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34887 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34884 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34877 91177308-0d34-0410-b5e6-96231b3b80d8
* 1. Have the ExecutionContext keep track of the APInt's allocated andReid Spencer2007-03-031-11/+13
| | | | | | | | ensure they are cleaned up when the stack frame exits. 2. Move a function to the Execution.cpp file where it belongs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34876 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34267 91177308-0d34-0410-b5e6-96231b3b80d8
* Privatize StructLayout::MemberOffsets, adding an accessorChris Lattner2007-02-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34156 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1188:Reid Spencer2007-02-082-2/+2
| | | | | | | | | Compute BitMask correctly. Patch by Leo (wenwenti@hotmail.com). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34026 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes to support making the shift instructions be true BinaryOperators.Reid Spencer2007-02-022-6/+7
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoidReid Spencer2007-01-301-2/+2
| | | | | | | confusion with external linkage types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tabs.Reid Spencer2007-01-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33620 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement use of new IntrinsicLowering interface.Reid Spencer2007-01-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33619 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR761:Reid Spencer2007-01-261-12/+11
| | | | | | | | The Module::setEndianness and Module::setPointerSize methods have been removed. Instead you can get/set the DataLayout. Adjust thise accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33530 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR970:Reid Spencer2007-01-211-1/+1
| | | | | | | | Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33403 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement bit-accurate sext instruction.Reid Spencer2007-01-201-10/+14
| | | | | | | This patch fixes test/Integer/2007-01-17-TruncSext.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33394 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new maskToBitWidth function to ensure that the results ofReid Spencer2007-01-181-10/+15
| | | | | | | computations do not overflow the intended bit width. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33326 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an inline helper function that masks a GenericValue to a specifiedReid Spencer2007-01-181-0/+12
| | | | | | | bit width. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33325 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33321 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33318 91177308-0d34-0410-b5e6-96231b3b80d8
* 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! :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate calls to Type::isInteger, preferring isIntegral instead.Chris Lattner2007-01-151-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33222 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1064:Reid Spencer2007-01-123-385/+731
| | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename BoolTy as Int1Ty. Patch by Sheng Zhou.Reid Spencer2007-01-112-27/+27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR950:Reid Spencer2006-12-312-369/+253
| | | | | | | Convert signed integer types to signless ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32787 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR950:Reid Spencer2006-12-232-112/+331
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8