Commit Graph

708 Commits

Author SHA1 Message Date
Gabor Greif
724441e64a Fix an assertion abort on sparc. malloc(0) is allowed to
return NULL.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42871 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 19:40:35 +00:00
Neil Booth
ccf596a53e convertFromInteger, as originally written, expected sign-extended
input.  APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input.  Make this
assumption explicit in the function name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 11:45:55 +00:00
Dale Johannesen
88216af3ea Constant fold int-to-long-double conversions;
use APFloat for int-to-float/double; use
round-to-nearest for these (implementation-defined,
seems to match gcc).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42484 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 18:19:03 +00:00
Dale Johannesen
910993e8dc Change APFloat::convertFromInteger to take the incoming
bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers.  Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42210 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 22:09:37 +00:00
Chris Lattner
27725bf13f #ifdef out unsafe tracing code, which fixes PR1689
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 18:30:39 +00:00
Dale Johannesen
1abac0d725 Implement x86 long double in jit (not really
complete, but common cases work)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42043 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:44:13 +00:00
Dale Johannesen
43421b3dd7 Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 18:13:44 +00:00
Chris Lattner
9132a2b818 rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41309 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:15:32 +00:00
Chris Lattner
17f218e001 move assertion into mutex guard, a partial fix for PR1606.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 20:08:16 +00:00
Reid Spencer
ba28cb91c9 Fix a comment typo noticed by Sandro Magi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41018 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 15:57:56 +00:00
Chris Lattner
79e038a16d eliminate redundant conditions from the signless types conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40927 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 16:19:57 +00:00
David Greene
52eec54820 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 03:43:44 +00:00
Anton Korobeynikov
42346f58d8 Add a comment: don't expect from external function resolver in interpreter
things, it wasn't designed to handle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40608 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 23:03:25 +00:00
Anton Korobeynikov
3b30a6e92d Add detection of __dso_handle presence during configure. Use this information in the
JITer (short path is added for darwin). This is needed to properly JIT llvm-gcc-4.2-built
binaries, since cxa_atexit is enabled by default on much more targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40600 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 20:02:02 +00:00
Dan Gohman
f452207d20 More explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 14:51:59 +00:00
Chuck Rose III
936baaa5ae VStudio compiler errors and placing Function*->ExFunc map under 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
2007-07-27 18:26:35 +00:00
Reid Spencer
087b72d1bc Hush a noisy warning from GCC 4.2 about overflow during conversion by using
the type "unsigned" instead of uintptr_t for a 1-bit structure field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40066 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 21:05:30 +00:00
Gabor Greif
e510b3af3a fix typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38453 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 12:00:59 +00:00
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
Evan Cheng
9da60f92d9 (For Chris): Fix failure where we rejected compiling stubs when lazy compilation is disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37825 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-30 00:10:37 +00:00
Anton Korobeynikov
fb45086027 Add comments to fallsthrough cases. Also, this fixes PR1492
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 19:20:49 +00:00
Anton Korobeynikov
499d8f0c3b Check arguments & return types of main(). Abort in case of no match.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 19:17:35 +00:00
Reid Spencer
e770787be1 For PR1486:
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
2007-06-01 22:23:29 +00:00
Zhou Sheng
849c5b4537 Compute the correct word number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37322 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 15:03:18 +00:00
Reid Spencer
cc442cabf6 On Linux platforms and at optimization levels -O1 and above, llvm-gcc can
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
2007-05-19 01:36:17 +00:00
Reid Spencer
09d8c9278e Print integer values as both decimal and hexadecimal for convenience
of verifying result values when debugging.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37156 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 06:47:54 +00:00
Reid Spencer
52811bdbf0 Avoid a "loss of precision" error in gcc 4.1.3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37105 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-16 16:39:29 +00:00
Reid Spencer
951418b7e9 Implement printing of instruction result values when debug info is turned
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
2007-05-16 02:05:13 +00:00
Reid Spencer
e4b4394b2f Bitcast all the bits of a floating point value, not just one. The zero
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
2007-05-04 03:37:38 +00:00
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
Andrew Lenharth
a9ebd2b91f fix build on amd64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33367 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 20:17:59 +00:00
Anton Korobeynikov
8cd4c3e653 Adding disassembler interface and external hook to udis86 library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 17:25:17 +00:00
Reid Spencer
8205972a5a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33335 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 18:01:32 +00:00
Reid Spencer
65367b26bf Use the new maskToBitWidth function to ensure that the results of
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
2007-01-18 02:12:51 +00:00
Reid Spencer
90935f608d Add an inline helper function that masks a GenericValue to a specified
bit width.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 02:12:10 +00:00
Reid Spencer
547dcf2467 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 01:32:46 +00:00
Reid Spencer
23e28836ed 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33318 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 01:25:42 +00:00
Reid Spencer
f89aec655f Make sure we truncate stored values to their bit width.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33317 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 01:24:02 +00:00
Chris Lattner
42a7551725 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! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Chris Lattner
0ee69bbd33 eliminate calls to Type::isInteger, preferring isIntegral instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33222 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:03:16 +00:00
Reid Spencer
a54b7cbd45 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 07:05:14 +00:00
Reid Spencer
579dca12c2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Reid Spencer
e49661bdf5 For PR950:
Convert signed integer types to signless ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32787 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 05:51:36 +00:00
Reid Spencer
e4d87aa2de For PR950:
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
2006-12-23 06:05:41 +00:00
Chris Lattner
cecf56b069 elimiante Statistic static ctors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32702 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:56:53 +00:00
Chris Lattner
36343735cb remove static ctors from Statistic objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32700 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:43:32 +00:00
Chris Lattner
c1f400ccdd Fix PR1057 (compilation on macos 10.3), patch by Scott Michel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32644 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-17 21:04:02 +00:00
Jim Laskey
b92767afd4 Simplify the fetching of relocation mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32588 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-14 22:53:42 +00:00
Jim Laskey
acd80ac7bb 1. Tidy up jump table info.
2. Allow the jit to handle PIC relocable jump tables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32581 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-14 19:17:33 +00:00