Commit Graph

801 Commits

Author SHA1 Message Date
Chris Lattner
5c5f5a2ec2 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!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 15:47:17 +00:00
Chris Lattner
d0dfbe096d 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!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 03:06:26 +00:00
Daniel Dunbar
23e97b05da 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:53:23 +00:00
Misha Brukman
b035842c34 Fixed spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:33:08 +00:00
Chris Lattner
dd255a6247 Add range insert method for DenseSet and define DenseMapInfo for chars.
Patch by Kevin Fan!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 19:50:49 +00:00
Dan Gohman
de551f91d8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 18:45:54 +00:00
Douglas Gregor
41222823db Allow the use of pointers to const within PointerUnion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 23:19:54 +00:00
Chris Lattner
bdd376ccb2 add some accessors so I can play games with DenseMaps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:57:23 +00:00
Douglas Gregor
da84b25b13 Stop guessing, start thinking, and make PointerUnion3::is actually be correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:31:03 +00:00
Douglas Gregor
a7425d7fde Really, really fix PointerUnion3::is
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 00:34:31 +00:00
Douglas Gregor
2048cdb08e Make PointerUnion3::get work properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 21:44:13 +00:00
Chris Lattner
f54229192c update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:44:04 +00:00
Chris Lattner
e8bc475668 add a PointerUnion3 class and generalize PointerUnion to work with
anything pointer-like, which may or may not actually be a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:29:27 +00:00
Chris Lattner
c6a4b6b78b fix the PointerLikeTypeTraits specialization for PointerIntPair to
allow the traits to be specified as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:28:50 +00:00
Chris Lattner
54e01d06db add missing space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67995 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 13:26:05 +00:00
Chris Lattner
3a9fe06bfe add some comments, add a dyn_cast method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 07:03:30 +00:00
Chris Lattner
f341a47d10 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:33:22 +00:00
Chris Lattner
ba315c1ee7 add helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:32:46 +00:00
Chris Lattner
2491e4657d 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:06:02 +00:00
Chris Lattner
540db8bcb8 Allow a specific PointerIntPair instance to use a specific Pointer trait:
some pointer instances have properties that not all of a type have.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:02:20 +00:00
Chris Lattner
e30173ac33 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 04:32:37 +00:00
Chris Lattner
8ee1b5e916 rename PointerLikeTypeInto to PointerLikeTypeTraits, add trait for
# low bits free, and move to its own header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:39:30 +00:00
Chris Lattner
4d4177b9b3 teach SmallPtrSet that PointerIntPair is "basically a pointer".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:18:42 +00:00
Chris Lattner
1717f3af08 declare everything as class to avoid angering the VC++ gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 07:48:03 +00:00
Chris Lattner
6de6030718 add a traits class for SmallPtrSet that allows us to stick things that are
"basically pointers" into it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 07:44:53 +00:00
Dan Gohman
9c01f2dd0b Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 18:37:13 +00:00
Duncan Sands
76d3838454 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 15:29:38 +00:00
Chris Lattner
dae2206390 Fix PR3860 by correcting a predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 19:22:53 +00:00
Chris Lattner
3ee87b6f9d add some inline methods for infix operators on sparse vectors,
tidy some df iteration stuff, patch by John Mosby!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21 05:40:09 +00:00
Daniel Dunbar
e889d837a4 Add StringMap::lookup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:16:06 +00:00
Bill Wendling
9aaa0796ad 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 18:01:33 +00:00
Gabor Greif
5c3e7b1718 in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 07:09:01 +00:00
Nick Lewycky
59fad7d933 Remove configurey-fu to autodetect hash_map and hash_set now that they are
no longer used in LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 06:16:26 +00:00
Gabor Greif
c23b8719ef 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 20:36:44 +00:00
Gabor Greif
83b5752747 drop support for GCC 2.x as it is hopelessly broken anyway
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 19:49:29 +00:00
Gabor Greif
b141e397d5 make traits more flexible by splitting out node-related fragment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 10:17:32 +00:00
Gabor Greif
a05764c4fb group friendship
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 15:46:23 +00:00
Gabor Greif
0a0e68a7ea 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65626 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 08:41:37 +00:00
Ted Kremenek
638b8b446e Correctly implement ImmutableMap::getMaxElement() by getting the actual <key, value> pair.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23 17:28:16 +00:00
Ted Kremenek
1c7a666fce Add ImmutableMap::getMaxElement(), a method that returns the <key,value> pair in a ImmutableMap that has the highest ranked key.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23 17:27:18 +00:00
Ted Kremenek
07bf7efa0a 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\!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-21 18:25:30 +00:00
Misha Brukman
085a9ebbc7 Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 22:54:36 +00:00
Misha Brukman
a2769a33c9 Fixed lint errors:
* Alphabetized #includes
* Removed trailing whitespace
* Wrapped or shortened lines over 80 chars


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 22:20:18 +00:00
Dan Gohman
38deef9ce5 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 16:37:45 +00:00
Ted Kremenek
3c172a2959 Fix bug where APSInt::operator-- incremented instead of decremented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 22:39:08 +00:00
Chris Lattner
5b22efa614 Add operator->, patch by Ben Laurie!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64378 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 17:14:49 +00:00
Ted Kremenek
da5eb71550 Add method 'isSingleton()' to ImmutableSet. This returns true if the set contains exactly one element.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 05:17:02 +00:00
Ted Kremenek
8bb332d45d Add FoldingSet profile method for bools. Patch by Ben Laurie!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 20:53:17 +00:00
Bill Wendling
af9b6b264f These function return 'void'. Don't have 'return' return anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 12:31:26 +00:00
Dan Gohman
5471a00977 Change several SmallPtrSetImpl members from public to protected,
to make the encapsulation more clear.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 16:12:23 +00:00