Commit Graph

629 Commits

Author SHA1 Message Date
Reid Spencer
6bc6333a10 1. Don't swap byte order in scanf. It isn't necessary and leads to
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
2007-04-26 18:19:35 +00:00
Reid Spencer
b3b0727032 We only need one putchar which gives it a shot at getting matched by its
users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36305 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-21 17:11:45 +00:00
Chris Lattner
108ec4b1ca avoid mutating a global in an accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36289 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 22:57:20 +00:00
Chris Lattner
f7e968a2a2 fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36288 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 22:40:40 +00:00
Chris Lattner
2c639add5f rename JIT::state -> JIT::jitstate to avoid shadowing ExecutionEngine::state
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36286 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 22:40:05 +00:00
Chris Lattner
b8e237bb86 eliminate use of Instruction::getPrev(). Patch by Gabor Greif in 2005.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36198 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-17 17:38:28 +00:00
Reid Spencer
4ccf462b99 Implement @sext and @zext parameter attribute handling properly instead of
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
2007-04-16 21:50:40 +00:00
Reid Spencer
97e0c22330 For PR1293:
* 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
2007-03-30 16:41:50 +00:00
Jeff Cohen
2b7d7b57ae Unbreak C++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35067 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 17:57:00 +00:00
Bill Wendling
47992ea4be Don't use std::hex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 23:37:24 +00:00
Bill Wendling
3bae2e97d9 Don't use a cast. It causes an error on some platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35037 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 23:26:50 +00:00
Reid Spencer
bce30f1887 Fix all of last night's JIT failures in Prolangs-C++ by finishing the
implementation of getConstantValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34988 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 22:23:15 +00:00
Anton Korobeynikov
c6551ffdd5 Implement PR1240
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34959 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 05:32:48 +00:00
Reid Spencer
415c1f7438 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34958 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 05:03:16 +00:00
Reid Spencer
5763105121 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34955 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:46:41 +00:00
Reid Spencer
7553c34135 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:41:50 +00:00
Reid Spencer
38f6a15df6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:11:31 +00:00
Reid Spencer
f9536330d6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34951 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:09:31 +00:00
Reid Spencer
bfcd5992d8 Adjust and simplify external function processing now that GenericValue has
a single integer field of type APInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34950 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:08:12 +00:00
Reid Spencer
d08050bd1e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34948 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:06:48 +00:00
Reid Spencer
deca08d93d 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".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34947 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:05:57 +00:00
Reid Spencer
8fb0f190a9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34946 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:04:04 +00:00
Reid Spencer
b90fc7ed21 Remove unnecessary #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34889 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 18:29:16 +00:00
Reid Spencer
d4c0e62413 Deal with error handling better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34887 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 18:19:18 +00:00
Reid Spencer
e0929364e8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 08:38:04 +00:00
Reid Spencer
f0f09a96f3 Avoid memory leakage by having caller construct the APInt for the
destination value of LoadValueFromMemory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34883 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 08:36:29 +00:00
Reid Spencer
e1aa066216 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 06:22:22 +00:00
Reid Spencer
dea7ef1f17 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34876 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 06:19:55 +00:00
Reid Spencer
93a2875456 Implement loading and storing of APInt values from memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34874 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 06:18:03 +00:00
Chris Lattner
e748401b18 Fix PR1216 by cleaning up the ownership of JITResolver.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34552 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-24 02:57:03 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Chris Lattner
64f150fa92 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34267 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-14 06:20:04 +00:00
Chris Lattner
d2b7cec527 Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34266 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-14 05:52:17 +00:00
Chris Lattner
990b849abc eliminate vector-related allocations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34223 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 06:01:22 +00:00
Chris Lattner
829621c59e eliminate use of TargetData::getIndexedOffset that takes a vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34163 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-10 20:35:22 +00:00
Chris Lattner
b1919e2f08 Privatize StructLayout::MemberOffsets, adding an accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34156 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-10 19:55:17 +00:00
Reid Spencer
23cbb1c78a For PR1188:
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
2007-02-08 00:29:31 +00:00
Reid Spencer
688b0490e2 For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:19:13 +00:00
Reid Spencer
832254e1c2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 02:16:23 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Reid Spencer
73a27c894f Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 17:55:50 +00:00
Reid Spencer
519e239b1f Implement use of new IntrinsicLowering interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33619 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 17:51:02 +00:00
Reid Spencer
26f238589f For PR761:
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
2007-01-26 08:11:39 +00:00
Anton Korobeynikov
fd58e6e2ec Moved disassembler to libSystem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-23 10:26:08 +00:00
Reid Spencer
24d6da5fed For PR970:
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
2007-01-21 00:29:26 +00:00
Chris Lattner
58092e35a3 Teach TargetData to handle 'preferred' alignment for each target, and use
these alignment amounts to align scalars when we can.  Patch by Scott Michel!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33409 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-20 22:35:55 +00:00
Chris Lattner
c5633c235e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-20 20:51:43 +00:00
Reid Spencer
a42c7fd0ca 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-20 20:12:29 +00:00
Reid Spencer
c00a43092e Implement bit-accurate sext instruction.
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
2007-01-20 08:32:52 +00:00
Reid Spencer
c10305743c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00