Commit Graph

617 Commits

Author SHA1 Message Date
Anton Korobeynikov 666d23d4e6 Implement PR1240
llvm-svn: 34959
2007-03-06 05:32:48 +00:00
Reid Spencer 4e42790c43 1. Make StoreValueToMemory a little more efficient by not requiring caller
to make a copy of the GenericValue.
2. Fix a copy & paste bug in StoreValueToMemory where 64-bit values were
   truncated to 32

llvm-svn: 34958
2007-03-06 05:03:16 +00:00
Reid Spencer 1efc4aaf84 Fix some thinko's in the last patch. PtrSize has to be in bits and we
might need to zext not just trunc the value.

llvm-svn: 34955
2007-03-06 03:46:41 +00:00
Reid Spencer 10dbc1e896 Fix a bug in IntToPtr. Truncating to 64-bits only works if the integer
is larger. Adjust so that it truncates to pointer width, only if necessary.

llvm-svn: 34954
2007-03-06 03:41:50 +00:00
Reid Spencer c764c55745 Simplify code as a result of the change in GenericValue to have a single
integer field of type APInt instead of different sized integer fields.

llvm-svn: 34952
2007-03-06 03:11:31 +00:00
Reid Spencer 40015aad5a Radically simplify execution. This patch gets rid of all the special
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
2007-03-06 03:09:31 +00:00
Reid Spencer c45e10474a Adjust and simplify external function processing now that GenericValue has
a single integer field of type APInt.

llvm-svn: 34950
2007-03-06 03:08:12 +00:00
Reid Spencer 7f68713eb8 APInt's are no longer allocated on the heap because they are direct
members of GenericValue. Consequently the code to clean them up isn't
needed.

llvm-svn: 34948
2007-03-06 03:06:48 +00:00
Reid Spencer 2d89fa84bc Remove the insufficient code in Interpreter::create that computed the
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".

llvm-svn: 34947
2007-03-06 03:05:57 +00:00
Reid Spencer 87aa65f40e Simplify things significantly because GenericValue now has a single integer
field, of type APInt, instead of multiple integer fields. Also, get rid of
the special endianness code in StoreValueToMemory and LoadValueToMemory.
ExecutionEngine is always used to execute on the host platform so this is
now unnecessary.

llvm-svn: 34946
2007-03-06 03:04:04 +00:00
Reid Spencer 04a1829559 Remove unnecessary #include.
llvm-svn: 34889
2007-03-03 18:29:16 +00:00
Reid Spencer 603682ad1d Deal with error handling better.
llvm-svn: 34887
2007-03-03 18:19:18 +00:00
Reid Spencer ec8c51c1b1 Complete the APIntification of the interpreter. All asserts for > 64 bits
have been removed and dealt with. The interpreter should now be able to
execute any LLVM program using any bit width.

llvm-svn: 34884
2007-03-03 08:38:04 +00:00
Reid Spencer 00919f5769 Avoid memory leakage by having caller construct the APInt for the
destination value of LoadValueFromMemory.

llvm-svn: 34883
2007-03-03 08:36:29 +00:00
Reid Spencer 54c6e84c83 Implement APInt support for the binary operators.
Move the getConstantExpr function towards the end of the file so we don't
need a dozen forward declarations.

llvm-svn: 34877
2007-03-03 06:22:22 +00:00
Reid Spencer 72aafa1d49 1. Have the ExecutionContext keep track of the APInt's allocated and
ensure they are cleaned up when the stack frame exits.
2. Move a function to the Execution.cpp file where it belongs.

llvm-svn: 34876
2007-03-03 06:19:55 +00:00
Reid Spencer 815f8dd225 Implement loading and storing of APInt values from memory.
llvm-svn: 34874
2007-03-03 06:18:03 +00:00
Chris Lattner 05858a9e32 Fix PR1216 by cleaning up the ownership of JITResolver.
llvm-svn: 34552
2007-02-24 02:57:03 +00:00
Reid Spencer d84d35ba70 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Chris Lattner 4da5e17cfc From Dan Gohman:
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
2007-02-14 06:20:04 +00:00
Chris Lattner 945e437c65 Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.

llvm-svn: 34266
2007-02-14 05:52:17 +00:00
Chris Lattner 6ea07f178c eliminate vector-related allocations
llvm-svn: 34223
2007-02-13 06:01:22 +00:00
Chris Lattner c44bd78a2e eliminate use of TargetData::getIndexedOffset that takes a vector
llvm-svn: 34163
2007-02-10 20:35:22 +00:00
Chris Lattner c473d8e431 Privatize StructLayout::MemberOffsets, adding an accessor
llvm-svn: 34156
2007-02-10 19:55:17 +00:00
Reid Spencer 0690d442ab For PR1188:
Compute BitMask correctly.

Patch by Leo (wenwenti@hotmail.com).

llvm-svn: 34026
2007-02-08 00:29:31 +00:00
Reid Spencer 1241d6d5ab For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)

llvm-svn: 33922
2007-02-05 21:19:13 +00:00
Reid Spencer 2341c22ec7 Changes to support making the shift instructions be true BinaryOperators.
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
2007-02-02 02:16:23 +00:00
Reid Spencer 5301e7c605 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Reid Spencer 42b2c08e3a Remove tabs.
llvm-svn: 33620
2007-01-29 17:55:50 +00:00
Reid Spencer 1e960cd4fd Implement use of new IntrinsicLowering interface.
llvm-svn: 33619
2007-01-29 17:51:02 +00:00
Reid Spencer 3ac38e99b9 For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.

llvm-svn: 33530
2007-01-26 08:11:39 +00:00
Anton Korobeynikov a41d9eca96 Moved disassembler to libSystem
llvm-svn: 33461
2007-01-23 10:26:08 +00:00
Reid Spencer 2eadb5310d For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!

llvm-svn: 33415
2007-01-21 00:29:26 +00:00
Chris Lattner 50ee0e40e5 Teach TargetData to handle 'preferred' alignment for each target, and use
these alignment amounts to align scalars when we can.  Patch by Scott Michel!

llvm-svn: 33409
2007-01-20 22:35:55 +00:00
Chris Lattner 7476fa4456 DOUT still evaluates side effects, even though it doesn't print. This means
that disassembleBuffer will be called even if NDEBUG, but the result will
be ignored.

llvm-svn: 33408
2007-01-20 20:51:43 +00:00
Reid Spencer fff2797349 Implement the signed icmp instructions properly. To do this we introduce
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
2007-01-20 20:12:29 +00:00
Reid Spencer 3615cdf957 Implement bit-accurate sext instruction.
This patch fixes test/Integer/2007-01-17-TruncSext.ll

llvm-svn: 33394
2007-01-20 08:32:52 +00:00
Reid Spencer a94d394ad2 For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.

llvm-svn: 33370
2007-01-19 21:13:56 +00:00
Andrew Lenharth e082e2ac7f fix build on amd64
llvm-svn: 33367
2007-01-19 20:17:59 +00:00
Anton Korobeynikov 3e956974b3 Adding disassembler interface and external hook to udis86 library.
llvm-svn: 33358
2007-01-19 17:25:17 +00:00
Reid Spencer 726b68bc6e Fix a regression in the last patch. When constructing a BitMask, be careful
not to overflow 64-bits and end up with a 0 mask. This caused i64 values to
always be stored as 0 with lots of consequential damage to nightly test.

llvm-svn: 33335
2007-01-18 18:01:32 +00:00
Reid Spencer f854f95a17 Use the new maskToBitWidth function to ensure that the results of
computations do not overflow the intended bit width.

llvm-svn: 33326
2007-01-18 02:12:51 +00:00
Reid Spencer 10fe0e0d48 Add an inline helper function that masks a GenericValue to a specified
bit width.

llvm-svn: 33325
2007-01-18 02:12:10 +00:00
Reid Spencer 300e7fcb55 Make shl instruction mask its result to the correct bitsize. This is
sufficient to get llvm-test/SingleSource/UnitTests/Integer/general-test.ll
working with lli in interpreter mode.

llvm-svn: 33321
2007-01-18 01:32:46 +00:00
Reid Spencer fab44b682e Two changes:
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
2007-01-18 01:25:42 +00:00
Reid Spencer 01f7e06d8f Make sure we truncate stored values to their bit width.
llvm-svn: 33317
2007-01-18 01:24:02 +00:00
Chris Lattner 03c4953cdd rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
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
2007-01-15 02:27:26 +00:00
Chris Lattner c69c6c4db2 eliminate calls to Type::isInteger, preferring isIntegral instead.
llvm-svn: 33222
2007-01-15 02:03:16 +00:00
Reid Spencer 7a9c62baa6 For PR1064:
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
2007-01-12 07:05:14 +00:00
Reid Spencer cddc9dfe97 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.

llvm-svn: 33110
2007-01-12 04:24:46 +00:00