1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 22:12:57 +02:00
Commit Graph

937 Commits

Author SHA1 Message Date
Daniel Dunbar
ea514f5421 Change SmallString::operator{=,+=} to take a StringRef.
llvm-svn: 79729
2009-08-22 06:06:46 +00:00
Anton Korobeynikov
bb4c910976 Implement APInt <-> APFloat conversion for IEEE 128-bit floats.
This fixes PR2555

llvm-svn: 79677
2009-08-21 22:10:30 +00:00
Daniel Dunbar
446d29370f Add a fast path for setName("") on an unnamed value.
llvm-svn: 79492
2009-08-19 23:37:23 +00:00
Eli Friedman
fe70446342 Add triple parsing support for TCE.
llvm-svn: 79461
2009-08-19 20:46:03 +00:00
Daniel Dunbar
2cf5eb67b4 Switch to SmallString::str from SmallString::c_str, and remove
SmallString::c_str.

llvm-svn: 79456
2009-08-19 20:07:03 +00:00
Daniel Dunbar
cb45b94032 Add SmallString::str (which returns a StringRef); this is more efficient than
c_str().

llvm-svn: 79453
2009-08-19 19:57:55 +00:00
Daniel Dunbar
07444dd862 Remove SmallString::append_*int* methods; how many copies of int -> str
conversion code do we really need?
 - S.append_uint(N) can be replaced with 'raw_svector_ostream(S) << N' which is
   somewhat slower due to the extra set up cost, but still plenty fast
   (especially if the svector set up cost can be amortized).

llvm-svn: 79450
2009-08-19 19:28:18 +00:00
Daniel Dunbar
6812c0db35 Add SmallVector::{capacity,set_size}.
- These allow clients to make use of the extra elements in the vector which
   have already been allocated, without requiring them to be value initialized.

llvm-svn: 79433
2009-08-19 17:48:28 +00:00
Daniel Dunbar
d334c67f60 Improve Triple to recognize the OS in i386-mingw32.
llvm-svn: 79359
2009-08-18 19:26:55 +00:00
Daniel Dunbar
09f40a7871 Fix pasto in StringRef::count(char)
llvm-svn: 79356
2009-08-18 18:34:22 +00:00
Daniel Dunbar
4a9a98a5de Add StringRef::count({char,StringRef})
llvm-svn: 79354
2009-08-18 18:26:35 +00:00
Misha Brukman
0961ce48c4 Fixed spelling of MSP430.
llvm-svn: 79333
2009-08-18 13:50:28 +00:00
Daniel Dunbar
763d4d3648 Recognize xscale as an ARM arch.
- Patch by Yonggang Luo.

llvm-svn: 79315
2009-08-18 04:51:26 +00:00
Daniel Dunbar
d4a31156e7 Add Triple matching for pic16 arch and solaris OS.
- Patch by Yonggang Luo.

llvm-svn: 79314
2009-08-18 04:43:27 +00:00
Oscar Fuentes
58ce88fded Make a declaration consistent with its definition.
llvm-svn: 79220
2009-08-17 04:10:20 +00:00
Erick Tryzelaar
930c879b9e Modify APFloat to take a StringRef instead of a c string.
This also adds unit tests to APFloat that mainly tests the
string handling of APFloat, but not much else of it's api.

llvm-svn: 79210
2009-08-16 23:36:19 +00:00
Daniel Dunbar
3a5a25d5d5 Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.

llvm-svn: 78885
2009-08-13 02:33:34 +00:00
Daniel Dunbar
791bb8ce44 Add StringRef::front (with some small tweaks while I was in the area).
- Patch by Erick Tryzelaar

llvm-svn: 78883
2009-08-13 02:03:30 +00:00
Dan Gohman
bc6b14ba00 This void is implicit in C++.
llvm-svn: 78848
2009-08-12 22:10:57 +00:00
Gabor Greif
5ce04c066b catch a typo and simplify call syntax
llvm-svn: 78804
2009-08-12 09:05:11 +00:00
Chris Lattner
a6e6f5f728 add support for mingw64 target triples.
llvm-svn: 78797
2009-08-12 06:32:10 +00:00
Chris Lattner
29efb6cf1f add a couple of helpers to the Triple class for decoding
the darwin version string.  This should help consolidate
the variety of weird functions we have scattered around the
codebase that do stuff like this.

llvm-svn: 78792
2009-08-12 06:19:40 +00:00
Daniel Dunbar
f4e8af6ecc StringRef: Add find(char) and find(StringRef).
Also, regroup functions.

llvm-svn: 78712
2009-08-11 20:47:15 +00:00
Chris Lattner
e024b843cd add a simple back() method to StringRef.
llvm-svn: 78544
2009-08-10 00:44:02 +00:00
Daniel Dunbar
ff95e6d5f8 STLExtras: Add less_ptr.
llvm-svn: 78521
2009-08-09 03:36:59 +00:00
Dan Gohman
05d4015881 Use std::string() instead of std::string("").
llvm-svn: 78364
2009-08-07 01:43:45 +00:00
Daniel Dunbar
7d08944f1f Add StringRef::endswith
llvm-svn: 78197
2009-08-05 15:48:26 +00:00
Daniel Dunbar
775da1948b Pass target triple string in to TargetMachine constructor.
This is not just a matter of passing in the target triple from the module;
currently backends are making decisions based on the build and host
architecture. The goal is to migrate to making these decisions based off of the
triple (in conjunction with the feature string). Thus most clients pass in the
target triple, or the host triple if that is empty.

This has one important change in the way behavior of the JIT and llc.

For the JIT, it was previously selecting the Target based on the host
(naturally), but it was setting the target machine features based on the triple
from the module. Now it is setting the target machine features based on the
triple of the host.

For LLC, -march was previously only used to select the target, the target
machine features were initialized from the module's triple (which may have been
empty). Now the target triple is taken from the module, or the host's triple is
used if that is empty. Then the triple is adjusted to match -march.

The take away is that -march for llc is now used in conjunction with the host
triple to initialize the subtarget. If users want more deterministic behavior
from llc, they should use -mtriple, or set the triple in the input module.

llvm-svn: 77946
2009-08-03 04:03:51 +00:00
Daniel Dunbar
9bbadad09d Fix some comments referring to std::cerr.
llvm-svn: 77931
2009-08-03 01:02:24 +00:00
Daniel Dunbar
a5db9df570 Adjust comment to distinguish between target name and triple target name they
match.

llvm-svn: 77908
2009-08-02 19:41:20 +00:00
Jakob Stoklund Olesen
e7eb74ef39 Analog Devices Blackfin back-end.
Generate code for the Blackfin family of DSPs from Analog Devices:

  http://www.analog.com/en/embedded-processing-dsp/blackfin/processors/index.html
  
We aim to be compatible with the exsisting GNU toolchain found at:

  http://blackfin.uclinux.org/gf/project/toolchain
  
The back-end is experimental.

llvm-svn: 77897
2009-08-02 17:32:10 +00:00
Ted Kremenek
b29794d828 Make default ctor for ImmutableSet::iterator public.
llvm-svn: 77762
2009-08-01 01:28:23 +00:00
Dan Gohman
3d7cadb0c2 Split DenseMapInfo into a separate header file, so that it can be
included separately.

llvm-svn: 77693
2009-07-31 18:18:19 +00:00
Daniel Dunbar
298e11de31 Twine: Directly support int, long, and long long types.
- This should resolve Cygwin gcc ambiguities.

llvm-svn: 77624
2009-07-30 21:15:14 +00:00
Daniel Dunbar
edd0313a36 Twine: Use raw_ostream::write_hex, remove unused itohexstr method.
llvm-svn: 77617
2009-07-30 18:30:19 +00:00
Daniel Dunbar
3db25114f0 Remove itohexstr, which only had one user.
llvm-svn: 77613
2009-07-30 18:18:54 +00:00
Daniel Dunbar
81f704c26a Twines: Don't allow implicit conversion from integers, this is too tricky.
llvm-svn: 77605
2009-07-30 17:37:43 +00:00
Daniel Dunbar
4d8b1776b4 Twine: Provide [u]int{32,64} conversions via implicit constructors instead of
explicitly.

llvm-svn: 77576
2009-07-30 03:47:15 +00:00
Douglas Gregor
7bc7d66441 Fix a typo, and all of its copies
llvm-svn: 77489
2009-07-29 18:27:22 +00:00
Douglas Gregor
9072f2cd18 Implement PointerUnion4.
llvm-svn: 77487
2009-07-29 18:19:47 +00:00
Benjamin Kramer
cec5b84b92 MSVC build fix. Patch by Olaf Krzikalla!
llvm-svn: 77450
2009-07-29 11:21:25 +00:00
Daniel Dunbar
d13fcdaae5 Twines: Support numeric conversion directly (uitostr, etc).
- Provides static constructors for doing number to string conversions without
   using temporaries.

 - There are several ways to do this, I think given the Twine constraints this
   is the simplest one.

 - One FIXME for fast number -> hex conversion.

 - Added another comment on one last major bit of perf work Twines need, which
   is to make raw_svector_ostream more efficient.

llvm-svn: 77445
2009-07-29 07:08:44 +00:00
Chris Lattner
8e840e942e Use the RHS length instead of the LHS length. They are both the same,
but this ends up compiling code like this:

int foo(const StringRef &R) {
  return R == "food";
}

to use a constant sized memcmp instead of a variable memcmp.

llvm-svn: 77160
2009-07-26 17:46:03 +00:00
Daniel Dunbar
1c59fa86e2 Oops, forgot XCore. Sorry XCore!
llvm-svn: 77125
2009-07-26 04:52:45 +00:00
Daniel Dunbar
6b705e3a64 Update for API change.
llvm-svn: 77124
2009-07-26 04:23:03 +00:00
Daniel Dunbar
5a9d56ab90 Update Triple to use StringRef/Twine based APIs.
- This is now shorter, simpler, safer, and more efficient, what a deal.

llvm-svn: 77119
2009-07-26 03:31:47 +00:00
Daniel Dunbar
b97f9fc3f5 Add StringRef::{slice, split}, two convenient string operations which are simple
and efficient on a StringRef.

llvm-svn: 77117
2009-07-26 03:18:15 +00:00
Jeffrey Yasskin
da42799098 Add a missing ilist_node.h #include to SparseBitVector, and add a very short
test for it. The test is by no means complete, but it tests the problem I was
fixing.

llvm-svn: 77025
2009-07-25 00:33:57 +00:00
Daniel Dunbar
1df20e31e5 Move to raw_ostream.
llvm-svn: 76963
2009-07-24 09:53:24 +00:00
Daniel Dunbar
4da6a69a7c Fix constructor types
llvm-svn: 76958
2009-07-24 07:12:20 +00:00
Daniel Dunbar
6f78d7ac27 Add Twine ADT.
- Not currently used.

llvm-svn: 76956
2009-07-24 07:04:27 +00:00
Daniel Dunbar
b5adc13728 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.

llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Chris Lattner
d9b9012f9b enhance DepthFirstIterator to support more robust operations in the face
of code mutating the graph while it is being traversed.  Patch by 
Olaf Krzikalla!

llvm-svn: 76869
2009-07-23 06:30:28 +00:00
Chris Lattner
4fb5fa5156 remove a really old and dead header
llvm-svn: 76855
2009-07-23 04:59:02 +00:00
Daniel Dunbar
d247ca6f40 Define npos in a way that should make MSVC happier.
llvm-svn: 76785
2009-07-22 21:08:31 +00:00
Daniel Dunbar
338e478c65 Add missing include
llvm-svn: 76655
2009-07-21 21:33:58 +00:00
Torok Edwin
4d8202474c Add freed memory poisoning in !NDEBUG mode for DenseMap.
llvm-svn: 76597
2009-07-21 18:01:37 +00:00
Daniel Dunbar
7532049775 Move StringRef comparison operators out of class.
Also, tweak the return type of size().

llvm-svn: 76588
2009-07-21 17:25:46 +00:00
Daniel Dunbar
30c92a0aee Add StringRef::{substr, startswith}.
llvm-svn: 76559
2009-07-21 09:18:49 +00:00
Daniel Dunbar
8ab30670cc Add StringRef class, with fixes.
llvm-svn: 76543
2009-07-21 07:28:51 +00:00
Daniel Dunbar
0686bcbe91 Remove redundant qualifiers.
llvm-svn: 76357
2009-07-19 01:42:34 +00:00
Chris Lattner
32757b2838 Fix a fixme, patch by Ryan Flynn!
llvm-svn: 75716
2009-07-15 00:36:04 +00:00
Chris Lattner
adc834d034 Add NetBSD to the Triple class, patch by Krister Walfridsson!
llvm-svn: 75489
2009-07-13 20:22:23 +00:00
Dan Gohman
9a19e608d4 Add an optional optimization to FoldingSet to allow ID values to be
stored rather than recomputed on each bucket traversal.

llvm-svn: 75480
2009-07-13 18:25:44 +00:00
Ted Kremenek
ec0e24ae25 ImmutableMap/ImmutableSet: Allow caching of ImutAVLTree digests while the tree
is still mutable. My experiments show this reduces the amount of times we
compute a full tree digest by over 50% on very small cases, and potentially much
larger on others.

llvm-svn: 75207
2009-07-10 00:33:43 +00:00
Ted Kremenek
c089dcb368 ImmutableSet/ImmutableMap: Allow caching of null digests by properly using a flag to record if the digest of an ImutAVLTree has been cached.
llvm-svn: 75157
2009-07-09 18:34:41 +00:00
Douglas Gregor
71dae1f1ba Make SmallPtrSet iterators real iterators
llvm-svn: 75073
2009-07-08 23:53:54 +00:00
Chris Lattner
f480b139c8 fix a bug in post-order iterators with external storage, patch by
Olaf Krzikalla!

llvm-svn: 74933
2009-07-07 18:43:48 +00:00
Dan Gohman
148d3bb9b4 Reapply 74494, this time removing the conflicting definition of operator<<
in APIntTest.cpp.

llvm-svn: 74550
2009-06-30 20:10:56 +00:00
Bill Wendling
1121a4ce5e Temporarily revert r74494. It was causing failures in the unit tests.
llvm-svn: 74515
2009-06-30 07:05:27 +00:00
Owen Anderson
4b4ba9f06c Fix the build on Cygwin. Patch by Aaron Gray.
llvm-svn: 74510
2009-06-30 05:33:46 +00:00
Dan Gohman
f207911974 Define an operator<< for APInt to be used with std::ostream.
This will allow it to be used in unittests that use gtest's
EXPECT_EQ.

llvm-svn: 74494
2009-06-30 01:28:08 +00:00
Sebastian Redl
51473d2434 Fix three MSVC 2008 warnings that completely clutter the build output.
llvm-svn: 74430
2009-06-29 17:12:06 +00:00
Duncan Sands
efb6d3b78e Add triple for OpenBSD.
llvm-svn: 74422
2009-06-29 13:36:13 +00:00
Dan Gohman
33d2e7a491 Add a 'const' in a comment.
llvm-svn: 74389
2009-06-27 20:53:16 +00:00
Owen Anderson
736e41b957 Update for DOTGraphTraits changes.
llvm-svn: 74113
2009-06-24 20:41:17 +00:00
Owen Anderson
2d65e89f30 Use atomic operations when accessing statistics, and make the lazy initialization of statistics actually threadsafe.
llvm-svn: 74005
2009-06-23 21:19:38 +00:00
Duncan Sands
30dcb8401d Add support for AuroraUX. Patch by evocallaghan.
llvm-svn: 73766
2009-06-19 14:40:01 +00:00
Owen Anderson
3234d9d040 Owen Anderson 2009-06-15: Use a SmallPtrSet here, for speed and to match df_iterator.
Owen Anderson 2009-06-15: Remember to clear out our maps to prevent crashing.

llvm-svn: 73438
2009-06-15 22:54:48 +00:00
Torok Edwin
a2f0fd169e fix build on VC++2k8.
llvm-svn: 72736
2009-06-02 20:32:59 +00:00
Mike Stump
f39ed4d4f9 Dcoument that the opauque value used to construct QNaNs is truncated
as necessary.

llvm-svn: 72702
2009-06-01 21:02:35 +00:00
Mike Stump
72e70811c8 Add some documentation.
llvm-svn: 72622
2009-05-30 15:19:29 +00:00
Mike Stump
5447116cbb Add support for letting the client choose different flavors of NaNs. Testcase to be
added in clang.

llvm-svn: 72606
2009-05-30 03:49:43 +00:00
Daniel Dunbar
aa01cbb890 Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.

llvm-svn: 72242
2009-05-22 02:24:11 +00:00
Jay Foad
c934b656f9 Tighten up the asserts in SmallVector::operator[]().
If this causes any new assertion failures that I didn't catch in
testing, the fix is usually to change "&v[0]" to "v.data()" for some
SmallVector v.

llvm-svn: 72221
2009-05-21 19:48:58 +00:00
Jay Foad
16d48d2595 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Jay Foad
2ca356aa76 Implement new SmallVector::data() methods.
llvm-svn: 72209
2009-05-21 09:00:37 +00:00
Bill Wendling
4698f862f3 Use struct instead of class to make MCVS compile.
llvm-svn: 71600
2009-05-12 21:50:43 +00:00
Douglas Gregor
26745696ef Add terminal width detection to llvm::sys::Process. This is needed to
fix Clang PRs 4148 and 4183.

llvm-svn: 71448
2009-05-11 18:05:52 +00:00
John Mosby
366006cfd3 Shrink wrapping in PEI:
- reduces _static_ callee saved register spills
  and restores similar to Chow's original algorithm.
- iterative implementation with simple heuristic
  limits to mitigate compile time impact.
- handles placing spills/restores for multi-entry,
  multi-exit regions in the Machine CFG without
  splitting edges.
- passes test-suite in LLCBETA mode.

Added contains() method to ADT/SparseBitVector.

llvm-svn: 71438
2009-05-11 17:04:19 +00:00
Chris Lattner
5c8113fab4 add a range insertion method to SmallSet.
llvm-svn: 70817
2009-05-04 02:19:15 +00:00
Stuart Hastings
b3c08d427a Prevent looping when DenseSet is abused.
llvm-svn: 70572
2009-05-01 20:47:53 +00:00
Jay Foad
9768cabf4a Move helper functions for optimizing division by constant into the APInt
class.

llvm-svn: 70488
2009-04-30 10:15:35 +00:00
Bill Wendling
07f3cdb8ba I cast, therefore I think I know what I'm doing.
llvm-svn: 70151
2009-04-26 20:12:38 +00:00
Bill Wendling
d0a7587da5 Use uint64_t instead of unsigned.
llvm-svn: 70148
2009-04-26 19:46:41 +00:00
Chris Lattner
4685a9682f revert an incorrect patch. This causes crashes all over the place on a
64-bit build.

llvm-svn: 70147
2009-04-26 19:44:20 +00:00
Bill Wendling
2233793a0f Suppress warnings about conversion shortening 64-bit to 32-bit.
llvm-svn: 70138
2009-04-26 18:10:20 +00:00
Chris Lattner
aad8bd245f DenseMap.h needs <new> because it explicitly calls operator new/delete.
Patch by John McCall!

llvm-svn: 70068
2009-04-25 19:50:14 +00:00
Owen Anderson
dd6babaa30 Fix for PR3946, in which SmallVector could behave strangely in corner cases.
Patch by Peter Johnson.

llvm-svn: 69785
2009-04-22 07:16:54 +00:00
Douglas Gregor
d2b9d57e20 Add a static APInt::getNumWords
llvm-svn: 68977
2009-04-13 19:43:10 +00:00
Chris Lattner
8d5d3eaf95 fix a broken assertion in ilist_iterator, which caused it to crash in the
bad case instead of actually assert.  Bug pointed out by Jakob Stoklund 
Olesen!

llvm-svn: 68785
2009-04-10 15:47:17 +00:00
Chris Lattner
09cab2de98 fix overflow checks in SmallVector:
"The code was doing "if (End+NumInputs > Capacity) ...". If End is
close to 0xFFFFFFFF and NumInputs is large, it'll overflow, the
condition will come out false, and the vector won't grow to
accommodate the new elements, and the program will crash in memmove."

Patch by Jeffrey Yasskin!

llvm-svn: 68277
2009-04-02 03:06:26 +00:00
Daniel Dunbar
588d3d1fd6 Add llvm::Triple class for abstracting access to target triples.
- The code is silly, I'm just amusing myself. Rewrite to be efficient
   if you like. :)

Also, if you wish to debate the proper names of the triple components
I'm all ears.

llvm-svn: 68252
2009-04-01 21:53:23 +00:00
Misha Brukman
5f34850ba4 Fixed spelling.
llvm-svn: 68248
2009-04-01 21:33:08 +00:00
Chris Lattner
d052c5bb9b Add range insert method for DenseSet and define DenseMapInfo for chars.
Patch by Kevin Fan!

llvm-svn: 68239
2009-04-01 19:50:49 +00:00
Dan Gohman
770f4158e5 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.

llvm-svn: 68227
2009-04-01 18:45:54 +00:00
Douglas Gregor
aaa9263fc6 Allow the use of pointers to const within PointerUnion.
llvm-svn: 68159
2009-03-31 23:19:54 +00:00
Chris Lattner
dd41c286e5 add some accessors so I can play games with DenseMaps.
llvm-svn: 68145
2009-03-31 20:57:23 +00:00
Douglas Gregor
50b29cfe51 Stop guessing, start thinking, and make PointerUnion3::is actually be correct.
llvm-svn: 68126
2009-03-31 18:31:03 +00:00
Douglas Gregor
41ab75e9ef Really, really fix PointerUnion3::is
llvm-svn: 68079
2009-03-31 00:34:31 +00:00
Douglas Gregor
0beaefea25 Make PointerUnion3::get work properly
llvm-svn: 68067
2009-03-30 21:44:13 +00:00
Chris Lattner
ccc73c9327 update comment.
llvm-svn: 68060
2009-03-30 20:44:04 +00:00
Chris Lattner
a172ae1d4f add a PointerUnion3 class and generalize PointerUnion to work with
anything pointer-like, which may or may not actually be a pointer.

llvm-svn: 68056
2009-03-30 20:29:27 +00:00
Chris Lattner
2d00a451cb fix the PointerLikeTypeTraits specialization for PointerIntPair to
allow the traits to be specified as well.

llvm-svn: 68055
2009-03-30 20:28:50 +00:00
Chris Lattner
8e83bd3891 add missing space.
llvm-svn: 67995
2009-03-29 13:26:05 +00:00
Chris Lattner
be9cd842ae add some comments, add a dyn_cast method.
llvm-svn: 67992
2009-03-29 07:03:30 +00:00
Chris Lattner
f3d562df05 When forming sentinels for empty/tombstone, make sure to respect the
pointer's expected number of zero low-bits.

This should fix the breakage I introduced recently.

llvm-svn: 67990
2009-03-29 06:33:22 +00:00
Chris Lattner
696742399a add helper method.
llvm-svn: 67989
2009-03-29 06:32:46 +00:00
Chris Lattner
2c6632d760 Add a simple type-safe bit-mangling pointer union class. This allows
you to do things like:

  ///    PointerUnion<int*, float*> P;
  ///    P = (int*)0;
  ///    printf("%d %d", P.is<int*>(), P.is<float*>()); // prints "1 0"
  ///    X = P.get<int*>();     // ok.
  ///    Y = P.get<float*>();   // runtime assertion failure.
  ///    Z = P.get<double*>();  // does not compile.
  ///    P = (float*)0;
  ///    Y = P.get<float*>();   // ok.
  ///    X = P.get<int*>();     // runtime assertion failure.

llvm-svn: 67987
2009-03-29 06:06:02 +00:00
Chris Lattner
b71e26c380 Allow a specific PointerIntPair instance to use a specific Pointer trait:
some pointer instances have properties that not all of a type have.

llvm-svn: 67986
2009-03-29 06:02:20 +00:00
Chris Lattner
9dc97aa7bf Replace the PointerLikeTypeTraits::getNumLowBitsAvailable
function with a new NumLowBitsAvailable enum, which makes the
value available as an integer constant expression.

Add PointerLikeTypeTraits specializations for Instruction* and
Use** since they are only guaranteed 4-byte aligned.

Enhance PointerIntPair to know about (and enforce) the alignment
specified by PointerLikeTypeTraits.  This should allow things 
like PointerIntPair<PointerIntPair<void*, 1,bool>, 1, bool> 
because the inner one knows that 2 low bits are free.

llvm-svn: 67979
2009-03-29 04:32:37 +00:00
Chris Lattner
a78775615b rename PointerLikeTypeInto to PointerLikeTypeTraits, add trait for
# low bits free, and move to its own header.

llvm-svn: 67973
2009-03-29 00:39:30 +00:00
Chris Lattner
c512533ea0 teach SmallPtrSet that PointerIntPair is "basically a pointer".
llvm-svn: 67970
2009-03-29 00:18:42 +00:00
Chris Lattner
3fb9928af4 declare everything as class to avoid angering the VC++ gods.
llvm-svn: 67931
2009-03-28 07:48:03 +00:00
Chris Lattner
294e633d95 add a traits class for SmallPtrSet that allows us to stick things that are
"basically pointers" into it.

llvm-svn: 67930
2009-03-28 07:44:53 +00:00
Dan Gohman
88094aaaf9 Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin.
llvm-svn: 67856
2009-03-27 18:37:13 +00:00
Duncan Sands
71bb115e1c Reapply r66415, which was reverted in r66426 for
causing a bootstrap failure.  Bootstraps here on
x86-32-linux and x86-64-linux.  Requested by the
author Gabor Greif who says that a bug that might
have been causing the failure has since been fixed.

llvm-svn: 67844
2009-03-27 15:29:38 +00:00
Chris Lattner
9c7b21d369 Fix PR3860 by correcting a predicate.
llvm-svn: 67473
2009-03-22 19:22:53 +00:00
Chris Lattner
047b30aba8 add some inline methods for infix operators on sparse vectors,
tidy some df iteration stuff, patch by John Mosby!

llvm-svn: 67428
2009-03-21 05:40:09 +00:00
Daniel Dunbar
a3c65dba44 Add StringMap::lookup.
llvm-svn: 66750
2009-03-12 01:16:06 +00:00
Bill Wendling
3146293bda Revert r66415. It's causing failures during bootstrap builds:
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__muldi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:567: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__lshrdi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:421: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[5]: *** [libgcc/./_lshrdi3.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [libgcc/./_muldi3.o] Error 1
make[5]: *** [libgcc/./_negdi2.o] Error 1


--- Reverse-merging (from foreign repository) r66415 into '.':
U    include/llvm/BasicBlock.h
U    include/llvm/ADT/ilist_node.h
U    include/llvm/CodeGen/SelectionDAG.h
U    include/llvm/CodeGen/MachineFunction.h
U    include/llvm/CodeGen/MachineBasicBlock.h
U    include/llvm/Function.h

llvm-svn: 66426
2009-03-09 18:01:33 +00:00
Gabor Greif
f8122e3283 in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels
llvm-svn: 66415
2009-03-09 07:09:01 +00:00
Nick Lewycky
1a4b5fd173 Remove configurey-fu to autodetect hash_map and hash_set now that they are
no longer used in LLVM.

llvm-svn: 66406
2009-03-09 06:16:26 +00:00
Gabor Greif
9a8e64c76f Give sentinel traits the right to determine the policy where the sentinel is kept.
This should result in less indirect memory accesses, less dead writes and tighter code.

llvm-svn: 66061
2009-03-04 20:36:44 +00:00
Gabor Greif
63c1d08d66 drop support for GCC 2.x as it is hopelessly broken anyway
llvm-svn: 65864
2009-03-02 19:49:29 +00:00
Gabor Greif
5d9be2cffd make traits more flexible by splitting out node-related fragment
llvm-svn: 65690
2009-02-28 10:17:32 +00:00
Gabor Greif
078dabaf4a group friendship
llvm-svn: 65633
2009-02-27 15:46:23 +00:00
Gabor Greif
9b51fe4ab1 Introduce a new technique for merging BasicBlock with Instruction sentinel by superposition.
This looks dangerous, but isn't because the sentinel is accessed in special way only,
namely the Next and Prev fields of it, and these are guaranteed to exist.

llvm-svn: 65626
2009-02-27 08:41:37 +00:00
Ted Kremenek
d5ea51e615 Correctly implement ImmutableMap::getMaxElement() by getting the actual <key, value> pair.
llvm-svn: 65327
2009-02-23 17:28:16 +00:00
Ted Kremenek
d8c425b68d Add ImmutableMap::getMaxElement(), a method that returns the <key,value> pair in a ImmutableMap that has the highest ranked key.
llvm-svn: 65326
2009-02-23 17:27:18 +00:00
Ted Kremenek
17e17c7b44 Add version of StringsEqualNoCase that takes two null-terminated C-strings and compares up to 'len' characters. I tend to screw up string comparison functions, so anyone who is interested please review this\!
llvm-svn: 65236
2009-02-21 18:25:30 +00:00
Misha Brukman
4637ef9b4b Removed trailing whitespace.
llvm-svn: 65197
2009-02-20 22:54:36 +00:00
Misha Brukman
380e3db1b4 Fixed lint errors:
* Alphabetized #includes
* Removed trailing whitespace
* Wrapped or shortened lines over 80 chars

llvm-svn: 65181
2009-02-20 22:20:18 +00:00
Dan Gohman
30770ee7b3 Add explicit keywords.
llvm-svn: 64915
2009-02-18 16:37:45 +00:00
Ted Kremenek
53921b8722 Fix bug where APSInt::operator-- incremented instead of decremented.
llvm-svn: 64687
2009-02-16 22:39:08 +00:00
Chris Lattner
c21f591628 Add operator->, patch by Ben Laurie!
llvm-svn: 64378
2009-02-12 17:14:49 +00:00
Ted Kremenek
5a94b8568b Add method 'isSingleton()' to ImmutableSet. This returns true if the set contains exactly one element.
llvm-svn: 64359
2009-02-12 05:17:02 +00:00
Ted Kremenek
0a2860176f Add FoldingSet profile method for bools. Patch by Ben Laurie!
llvm-svn: 64324
2009-02-11 20:53:17 +00:00
Bill Wendling
a03453cace These function return 'void'. Don't have 'return' return anything.
llvm-svn: 64136
2009-02-09 12:31:26 +00:00
Dan Gohman
154fb54e7f Change several SmallPtrSetImpl members from public to protected,
to make the encapsulation more clear.

llvm-svn: 64017
2009-02-07 16:12:23 +00:00
Nick Lewycky
f273659759 Add an API for strings with possible NULLs in the middle. Refactor the other
two AddString methods to use it.

llvm-svn: 64005
2009-02-07 04:57:08 +00:00
Chris Lattner
49498bdff4 fix a pretty serious bug in StringMap where GetOrCreate(strstart,strend, z)
would not set new values to Z.

llvm-svn: 63707
2009-02-04 01:54:10 +00:00
Chris Lattner
526d29d06a Fix a bug in getMaxValue/getMinValue to pass the right signedness the
the constructed APSInt, patch suggested by Ben Laurie!

llvm-svn: 63362
2009-01-30 01:58:19 +00:00
Roman Levenstein
504ba4c98b Fix a bug in BitVector.h. All assignment operations (except the usual
assignment operator) were returning a copy of the bit vector, instead of a
reference! This old semantics probably did not meet the expectations.
With this patch, chained assignments happen to the right object.

llvm-svn: 63012
2009-01-26 11:07:20 +00:00
Bill Wendling
b7de7afd32 Get rid of warning about implicit 64-to-32 bit conversions.
llvm-svn: 62741
2009-01-22 02:10:33 +00:00
Steve Naroff
375325e8c1 Add explicit this-> (to make the VS compiler happy).
llvm-svn: 62731
2009-01-21 23:49:23 +00:00
Douglas Gregor
0a0af6b767 Fix ilist two-phase name lookup
llvm-svn: 62724
2009-01-21 22:38:44 +00:00
Dale Johannesen
a5699a1e8b Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts.  Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.

llvm-svn: 62712
2009-01-21 20:32:55 +00:00
Dale Johannesen
6854f86296 Make special cases (0 inf nan) work for frem.
Besides APFloat, this involved removing code
from two places that thought they knew the
result of frem(0., x) but were wrong.

llvm-svn: 62645
2009-01-21 00:35:19 +00:00
Dale Johannesen
c9e6e85a38 Add an IEEE remainder function, which is not
fully implemented yet and not used.  This is
mainly to clarify that APFloat::mod implements
C fmod, not remainder.

llvm-svn: 62593
2009-01-20 18:35:05 +00:00
Chris Lattner
816e00f6a0 eliminate use of uint32_t to improve compatibility with cygwin
llvm-svn: 62591
2009-01-20 18:23:14 +00:00
Chris Lattner
45a7b5ce57 improve compatibility with cygwin, patch by Jay Foad!
llvm-svn: 62535
2009-01-19 22:00:18 +00:00
Duncan Sands
ecfbe4521c Get this building with gcc-4.4.
llvm-svn: 62322
2009-01-16 15:54:57 +00:00
Chris Lattner
70d79bbe85 add a new insertAfter method, patch by Tom Jablin!
llvm-svn: 62158
2009-01-13 07:43:51 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Bill Wendling
71f808dfa2 * Don't explicitly cast "0" to "void*". This doesn't work well with specialized
StringMapEntryInitializer classes. Leave it for the compiler to figure out what
 the type is and what "0" should be transformed into.

* Un-disable the unit tests which test the StringMapEntryInitializer class.

llvm-svn: 61922
2009-01-08 08:26:46 +00:00
Misha Brukman
83a92e0e1e Remove extra blank line and space.
llvm-svn: 61916
2009-01-08 06:11:51 +00:00
Misha Brukman
4044287626 * Added unittests for StringMap
* Fixed but in StringMap::clear()
* Removed trailing whitespace

Original patch by Talin.

llvm-svn: 61914
2009-01-08 04:48:20 +00:00
Misha Brukman
c6d4c08346 * Fixed spelling of "sentinel"
* Removed trailing whitespace

llvm-svn: 61907
2009-01-08 02:21:23 +00:00
Dan Gohman
8271066844 Tidy up #includes, deleting a bunch of unnecessary #includes.
llvm-svn: 61715
2009-01-05 17:59:02 +00:00
Dan Gohman
97be71789f Add several more unimplemented operator overloads to ilist_iterator
to help catch errors.

llvm-svn: 61622
2009-01-04 03:22:42 +00:00
Nick Lewycky
35e441f7f1 Fix typo.
llvm-svn: 61554
2009-01-02 05:01:22 +00:00
Cedric Venet
b260c282bc Add explicit this-> for some member function in templated base class.
These call are probably dependent but VS with /Za don't seems to think so. We need to help him.

llvm-svn: 60978
2008-12-13 10:55:13 +00:00
Dan Gohman
c0280e8867 Move the conversion to intptr_t to a separate statement. This
avoids GCC's warning even on 64-bit hosts.

llvm-svn: 60706
2008-12-08 17:41:24 +00:00
Ted Kremenek
164f7f4a43 Use 'delete []' instead of 'delete' in OwningArray::reset().
llvm-svn: 60703
2008-12-08 17:28:11 +00:00
Dan Gohman
42bd5cffc9 Use intptr_t instead of unsigned here, which is more appropriate
in a really obscure way, but more importantly has the side effect
of avoiding a GCC warning in the case that IntType is bool.

llvm-svn: 60677
2008-12-07 21:28:00 +00:00
Chris Lattner
5a1d7ab054 add a new pop_back_val method which returns the value popped. This is
heretical from a STL standpoint, but is oh-so-useful for things that 
can't throw exceptions when copied, like, well, everything in LLVM.

llvm-svn: 60587
2008-12-05 07:11:05 +00:00
Chris Lattner
a249224590 Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently.

llvm-svn: 60446
2008-12-02 23:33:29 +00:00
Chris Lattner
0cb74d3d8e add densemap range insertion method.
llvm-svn: 60400
2008-12-02 06:08:04 +00:00
Chris Lattner
b86c76fdbb reenable array_pod_sort, this time hopefully happy on 64-bit
and big endian systems.

llvm-svn: 60371
2008-12-01 21:11:25 +00:00
Chris Lattner
d6533f8d0a don't #include <algorithm> into the llvm namespace.
llvm-svn: 60365
2008-12-01 19:45:45 +00:00
Chris Lattner
ddae8937e6 switch to std::sort until I have time to sort this out.
llvm-svn: 60354
2008-12-01 17:00:08 +00:00
Chris Lattner
ba0f3caaa7 define array_pod_sort in terms of operator< instead of my brain
damaged approximation.  This should fix it on big endian platforms
and on 64-bit.

llvm-svn: 60352
2008-12-01 16:50:01 +00:00
Chris Lattner
3ac27eff64 don't assume iterators implicitly convert to pointers.
llvm-svn: 60336
2008-12-01 06:50:46 +00:00
Chris Lattner
80d0eff786 Introduce a new array_pod_sort function and switch LSR to use it
instead of std::sort.  This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.

We should start using array_pod_sort where possible.

llvm-svn: 60335
2008-12-01 06:49:59 +00:00
Eli Friedman
401743c904 Fix bogus assertion using getSExtValue for legitimate values, like -1 in
an 128-bit-wide integer.  No testcase; the issue I ran into depends on 
local changes.

llvm-svn: 60311
2008-12-01 00:43:48 +00:00
Chris Lattner
ee7fbed62d add the rest of the comparison routines.
llvm-svn: 60303
2008-11-30 19:10:41 +00:00
Chris Lattner
8c592b282e fix indentation. std::pair is "isPod" if the first/second are both isPod.
llvm-svn: 60262
2008-11-30 00:50:20 +00:00
Torok Edwin
7f54c665a2 protect against negative values that would exceed allowed bit width
llvm-svn: 60239
2008-11-29 08:52:45 +00:00
Chris Lattner
ce03bccd7e apparently GCC doesn't believe that I understand C
precedence rules.  Pacify it.

llvm-svn: 60237
2008-11-29 08:36:39 +00:00
Duncan Sands
845f6467ba Typo fix.
llvm-svn: 60236
2008-11-29 08:03:35 +00:00
Chris Lattner
7ae87447ed Fix sentinels to use correctly 'aligned' pointers.
llvm-svn: 60229
2008-11-29 01:36:16 +00:00
Chris Lattner
070df849e9 Fix spello, add DenseMapInfo specialization for PointerIntPair.
llvm-svn: 60228
2008-11-29 01:18:05 +00:00
Chris Lattner
b41c45dbdf fix comment typo
llvm-svn: 60227
2008-11-28 23:57:26 +00:00
Chris Lattner
507e71fce3 fix a bug.
llvm-svn: 60225
2008-11-28 23:36:15 +00:00
Chris Lattner
d8b755ed95 add a generic "bitmangled pointer" class, which allows a parameterized
pointer and integer type to be used.

llvm-svn: 60224
2008-11-28 23:31:44 +00:00
Ted Kremenek
d0f8118dc1 Add typedef to StringMapEntry.
llvm-svn: 60134
2008-11-27 00:17:25 +00:00
Chris Lattner
527a103e8e add an operator= to assign to smallstring.
llvm-svn: 59715
2008-11-20 07:09:17 +00:00
Zhongxing Xu
12b52895f2 move partial template specialization to FoldingSet.h.
llvm-svn: 59434
2008-11-17 02:40:00 +00:00
Zhongxing Xu
fb7e7e8158 Fix 80-col violation.
llvm-svn: 59394
2008-11-16 04:44:41 +00:00