Commit Graph

487 Commits

Author SHA1 Message Date
Zhou Sheng
b04973edfa Fix some buges:
1. Make getMinValue() returns the right value.
2. Fix the ByteSwap() crash problem.
3. Make Postfix increment work correctly.
4. Fix some bugs in LogBase2, Hi/LoBits and UDiv.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34304 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 06:36:31 +00:00
Reid Spencer
879dfe1c9c Use brute-force algorithm for to_string. It doesn't have to be efficient
at this point, it just needs to work so we can test things reliably.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34262 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-14 02:52:25 +00:00
Reid Spencer
db3faa64ee Make some minor improvements to APInt:
1. Make all the operators use uppercase
2. Rename APIntRoundToDouble method just RoundToDouble, the APInt is
   redundant.
3. Turn the class on for compilation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34253 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 22:41:58 +00:00
Zhou Sheng
d93f00c35d 1. Make APInt::shl work correctly and more efficiently.
2. Add functions to support the numberical conversion between APInt and
   double/float.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34201 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-12 20:02:55 +00:00
Chris Lattner
44dcd01cb3 Add support for removing elements out of StringMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 20:58:00 +00:00
Chris Lattner
b5bb9f5b5c Replace the ugly FindValue method with STL-like find methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34183 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 19:49:41 +00:00
Chris Lattner
360cac8fef remove support for stringmap visitors now that iterators exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34180 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 08:22:15 +00:00
Chris Lattner
a86559ec42 add support for iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34179 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 08:20:35 +00:00
Nick Lewycky
3e051647c0 Fix comments to match names of functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34173 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 00:58:49 +00:00
Zhou Sheng
ff4304f824 Eliminates friend function declaration inside APInt, instead, adds public
methods as those global function's internal implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34083 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-09 07:48:24 +00:00
Chris Lattner
bb28a81ba3 Rename CStringMap -> StringMap, since it now supports nul characters in the
strings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34064 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-08 19:20:57 +00:00
Chris Lattner
ee182422ff Allow cstringmap to contain strings with nul characters in them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34062 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-08 19:08:37 +00:00
Zhou Sheng
a05eaa658e Switched this file on accidently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34054 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-08 16:45:48 +00:00
Zhou Sheng
0b706b18bd As Chris and Reid suggested, remove "isSigned" field from APInt, instead,
add some signed/unsigned arithmetic operation functions into APInt.h to
handle the signed/unsigned issue. These functions will be defined inside a
namespace "APIntOps" which is inside llvm namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34053 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-08 14:35:19 +00:00
Zhou Sheng
a3832fd46a As Chris suggested, fixed some problems. (This is the first part)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 06:14:53 +00:00
Chris Lattner
e237cf934f do not let the table fill up with tombstones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 01:11:25 +00:00
Zhou Sheng
353815dc19 As Reid suggested, fixed some problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33955 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 06:04:53 +00:00
Chris Lattner
6ad4c148cf Disable this for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33953 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 05:38:37 +00:00
Zhou Sheng
fd43dcfc57 Add a class APInt to represent arbitrary precision constant integral values.
It is a functional replacement for common case integer type like "unsigned",
"uint64_t", but also allows non-byte-width integer type and large integer
value types such as 3-bits, 15-bits, or more than 64-bits of precision. For
more details, see pr1043.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33951 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-06 03:00:16 +00:00
Chris Lattner
7ef856dfad Fix a bug in smallptrset::erase: in the small case, return true if the
element was in the set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33931 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:10:31 +00:00
Chris Lattner
e4116f8553 Encode small integers more densely in foldingset, avoiding overflowing the SmallVector as often.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 01:48:10 +00:00
Chris Lattner
0de4439ad1 improve comments, add an assertion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33750 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 05:33:21 +00:00
Devang Patel
aed293dfba Add PrintVersionMessage() that tools can use to print version number
without exiting program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 01:43:37 +00:00
Reid Spencer
9e693eb499 Add some debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33718 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 21:27:38 +00:00
Chris Lattner
b85210f508 minor cleanups. Fix off-by-one in accounting the number of nodes when the
table grows.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33698 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 06:04:41 +00:00
Chris Lattner
3cab071f6f reformat comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33675 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:16:22 +00:00
Chris Lattner
0b930852cf implement SmallPtrSet::erase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33581 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 07:59:10 +00:00
Chris Lattner
24757decb8 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33578 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 07:18:32 +00:00
Chris Lattner
c95dc987e9 Add a new SmallSet ADT specialized for pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-27 07:10:46 +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
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
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
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
b2f3e703bc Update code to eliminate calls to isInteger, calling isIntegral instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33220 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 01:58:56 +00:00
Chris Lattner
0762705087 Fix correlated exprs regressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33214 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 01:02:34 +00:00
Chris Lattner
05b30d840a remove unneeded special cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33127 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 18:23:49 +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
ca7ad8942a Fix a bug in an assert that would never trigger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33005 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-08 05:34:39 +00:00
Reid Spencer
e7ca042730 Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33003 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-08 01:26:33 +00:00
Chris Lattner
41a4429f65 wow, the link was already broken :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32963 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 23:20:51 +00:00
Chris Lattner
38742b9603 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32962 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 23:19:38 +00:00
Bill Wendling
fcf17a3096 The previous implementation of LLVM Streams wasn't removing symbols. This
one should.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32845 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-03 22:37:27 +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
0a3615246f eliminate constructor from Statistic class. It is now impossible to get a
static constructor for them :).   Transition complete.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32710 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 23:17:40 +00:00
Chris Lattner
ecb2768758 Refactor statistic a big and introduce a horrible-but-necessary macro
(STATISTIC), which allows us to define statistics that don't introduce
static ctors into the .o files.  I'm migrating code over to use this
incrementally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32687 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 21:27:47 +00:00
Bill Wendling
5c7e326585 Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-17 05:15:13 +00:00
Reid Spencer
d977d8651a Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 23:36:14 +00:00
Chris Lattner
975f05852d Change the implementation of statistic to not need destructors at all.
Instead, the stat info is printed when llvm_shutdown() is called.
These also don't need static ctors, but getting rid of them is uglier:
still investigating.  This reduces the number of static dtors in llvm from
~1400 to ~750.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32372 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-08 20:00:42 +00:00