Commit Graph

1415 Commits

Author SHA1 Message Date
Chris Lattner
7cf705461c add a MemoryBuffer::getOpenFile method, which turns an open
file descriptor into a MemoryBuffer (and closes the FD).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 22:20:27 +00:00
Chris Lattner
9f9bd8e4af Revert functionality doug added in r98575 that was never
documented and only used by some clang stuff I just removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 06:09:51 +00:00
Rafael Espindola
a962b40f0b Fix a use after free. Patch by Frits van Bommel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 21:14:29 +00:00
Jakob Stoklund Olesen
8dc926755f Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 04:47:19 +00:00
Jakob Stoklund Olesen
737d2816c4 Revert "Add ADT/IntervalMap.", GCC doesn't like it.
This reverts r119772.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119773 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 01:21:03 +00:00
Jakob Stoklund Olesen
8408edffcb Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119772 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 01:14:40 +00:00
Dale Johannesen
c81c7fe643 Aligned and unaligned copies of the same string
were not hashing to the same value.  Analysis
and patch by Frits van Bommel!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 00:48:58 +00:00
Dan Gohman
078d967e0a Bounds-check APInt's operator[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:14:56 +00:00
Chris Lattner
4afa12890f now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:13:01 +00:00
Daniel Dunbar
afd693cff3 report_fatal_error: Simplify a possible ambiguity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 02:48:51 +00:00
Ted Kremenek
13302ec089 Fix memory leak in StringRef::edit_distance(). 'Allocated' could be leaked on an early return.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-07 06:09:02 +00:00
Daniel Dunbar
f8254d6473 CrashRecoveryContext: Add RunSafelyOnThread helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05 07:19:09 +00:00
Mikhail Glushenkov
d66f2b74f2 Rename FindExecutable to PrependMainExecutablePath.
Makes it more clear that it is just a path manipulation function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118174 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 16:14:16 +00:00
Dan Gohman
303f350f7d Print an error as one big string instead of breaking it up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 00:24:33 +00:00
Mikhail Glushenkov
ed724fd43a Revert r118057, this is better fixed in appendSuffix itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:18:28 +00:00
Dan Gohman
d4589a3f58 Don't append a dot on platforms which don't use exe suffixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:49:48 +00:00
Mikhail Glushenkov
345b344e64 FindExecutable: remove the executability check.
This makes the behaviour of FindExecutable more consistent across platforms, but
I'm not very happy with the name...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118049 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:46 +00:00
Dan Gohman
c463316046 Fix these error messages to be less confusing. These error
messages primarily indicate errors running the viewer, not
errors with the graph file itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:03:40 +00:00
Mikhail Glushenkov
8a5ff478db Remove an unnecessary check and an unnecessary temporary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:33:04 +00:00
Douglas Gregor
5ee568ac27 Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed edit distance
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 22:13:48 +00:00
NAKAMURA Takumi
1b5de0e7ee lib/Support/raw_ostream.cpp: Fix Cygwin's build.
setmode is provided by io.h on Cygwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 01:21:55 +00:00
Daniel Dunbar
d49e2aa5b8 CrashRecoveryContext: Add missing return, so that the signal fires after we our
routine is off the stack. Otherwise we show up rather confusingly in the stack
trace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 21:55:18 +00:00
Oscar Fuentes
f0c55a9b97 Build with RTTI and exceptions disabled. Only in GCC for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-17 02:26:16 +00:00
Francois Pichet
a872a0f5f8 Always use binary mode for output stream. This is important to prevent unwanted end of line conversion on Windows. Should not affect Unix where O_BINARY is not defined. This fix /clang/test/lexer/preamble.c XFAIL on WIN32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 20:30:58 +00:00
Chris Lattner
a5bbde8efd fix a bug I introduced, no idea how this didn't repro right.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116462 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 00:30:00 +00:00
Chris Lattner
eafc5cb80d add uadd_ov/usub_ov to apint, consolidate constant folding
logic to use the new APInt methods.  Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold

which comes from "clang -ftrapv", originally brought to my attention from PR8221.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 00:05:07 +00:00
Chris Lattner
0a0a585e6b constify these methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 23:54:10 +00:00
Chris Lattner
f2ddc64c87 add a few operations for signed operations that also
return an overflow flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 23:46:33 +00:00
John Thompson
358cf1631a Unbreak cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 23:12:15 +00:00
Dan Gohman
e4f1a9b8a2 Move tool_output_file into its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 20:32:40 +00:00
Dan Gohman
644801a199 After printing "Running 'Graphviz' program... " and running the
Graphviz program, print something with a newline, to avoid leaving
the line unfinished.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115620 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 15:30:27 +00:00
Benjamin Kramer
82d96cccbc Grow BumpPtrAllocator's slab size dynamically if we allocated many slabs. This
reduces the amount of malloc calls and may reduce memory overhead.

Some numbers:
ASTContext stats, clang -cc1 -disable-free -fsyntax-only Cocoa_h.m
without dynamic growth                          |  with dynamic growth
Number of memory regions: 3158                  |  Number of memory regions: 432
Bytes used: 12333185                            |  Bytes used: 12333185
Bytes allocated: 12935168                       |  Bytes allocated: 12800000
Bytes wasted: 601983 (includes alignment, etc)  |  Bytes wasted: 466815 (includes alignment, etc)

ASTContext stats, clang -cc1 -disable-free -fsyntax-only on clang's ASTReader.cpp
without dynamic growth                          |  with dynamic growth
Number of memory regions: 10987                 |  Number of memory regions: 551
Bytes used: 42910356                            |  Bytes used: 42910356
Bytes allocated: 45002752                       |  Bytes allocated: 44711936
Bytes wasted: 2092396 (includes alignment, etc) |  Bytes wasted: 1801580 (includes alignment, etc)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115151 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 16:18:28 +00:00
Oscar Fuentes
3609eb0de2 Removed a bunch of unnecessary target_link_libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 22:39:14 +00:00
Nick Lewycky
f2d7b7c879 Make ConstantRange::makeICmpRegion handle all the edge cases properly. This
also fixes PR8250.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 18:18:36 +00:00
Benjamin Kramer
d1e1703c39 Push twines deeper into SourceMgr's error handling methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114847 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 17:42:11 +00:00
Dan Gohman
477268cd24 Delete an unused declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 16:54:49 +00:00
Dan Gohman
48fd5a79e0 Add support for viewing graphviz graphs with xdot.py.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 16:28:34 +00:00
Duncan Sands
5754a45256 Add better support for environment portion of triple. Original patch by
Cameron Esfahani, tweaked to use array_lengthof.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 08:25:48 +00:00
Duncan Sands
dd2fdd81bc Some versions of gcc still warn about "ignoring return value ... declared
with attribute warn_unused_result" here - suppress the warning harder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 08:20:49 +00:00
Nick Lewycky
f7a3c50183 Create PTX backend. Patch by Che-Liang Chiou!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 18:14:24 +00:00
Nick Lewycky
198381e542 Add completely hokey binary-and and binary-or operations to ConstantRange and
teach LazyValueInfo to use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113196 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 05:39:02 +00:00
Nick Lewycky
32cda119ef Add a new isSignWrappedSet() method to ConstantRange.
Fix zeroExtend and signExtend to support empty sets, and to return the smallest
possible result set which contains the extension of each element in their
inputs. For example zext i8 [100, 10) to i16 is now [0, 256), not i16 [100, 10)
which contains 63446 members.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113187 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 23:52:49 +00:00
Dan Gohman
776339ee27 Use the FindProgramByName fallback only with known absolute paths.
I wasn't able to convince myself that all GetMainExecutable
implementations always return absolute paths; this prevents
unexpected behavior in case they ever don't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112888 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:32:38 +00:00
John McCall
2a9a2dba4c After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>.  There are some
theoretical benefits to a N->2N+1 growth policy anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 21:55:03 +00:00
NAKAMURA Takumi
1b68af4183 llvm::FindExecutable(): Retrieve the name with suffix.exe, if available.
bugpoint uses it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 03:46:04 +00:00
Dan Gohman
d4c454317a Make tool_output_file's raw_ostream instance a member variable instead
of a base class.

This makes it possible to unregister the file from FilesToRemove when
the file is done. Also, this eliminates the need for
formatted_tool_output_file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 14:20:41 +00:00
Duncan Sands
12881e79b6 Remove a hack that tries to understand incorrect triples from the
Triple class constructor.  Only valid triples should now be used
inside LLVM - front-ends are now responsable for rejecting or
correcting invalid target triples.  The Triple::normalize method
can be used to straighten out funky triples provided by users.
Give this a whirl through the buildbots to see if I caught all
places where triples enter LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 10:57:54 +00:00
Benjamin Kramer
837bccd052 StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:25:35 +00:00
Benjamin Kramer
0043e35b82 Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 14:21:08 +00:00
Dan Gohman
365c53e328 Use Bits.data() instead of &Bits[0].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111993 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 23:16:53 +00:00