Commit Graph

783 Commits

Author SHA1 Message Date
Cedric Venet
a3f343f4cd Updating VC++ project.
Adding one include file and correct one declaration from class to struct in order to make llvm compile on VC2005.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 11:56:40 +00:00
Chris Lattner
78a2812538 Add raw_stream adaptors that write into an std::string and SmallVector/SmallString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:43:04 +00:00
Chris Lattner
944fac71e0 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:09 +00:00
Chris Lattner
42f77ab95a add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 20:34:06 +00:00
Chris Lattner
097af7fc8f add a simple mechanism for formatted output. This gives raw_ostream's
all the power and risk of fprintf format strings.  Use them like this:

  OS << format("%10.4f", 42.0) << "\n" << format("%x", 42) << '\n';



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:23:10 +00:00
Dan Gohman
535de1a8c1 Add a clear() method to FoldingSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 00:42:16 +00:00
Chris Lattner
969a46a948 improve support for systems that need unistd.h to get STDOUT_FILENO.
Patch contributed by Bjorn Reese!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 15:45:00 +00:00
Owen Anderson
fd2a05332a Fix write() when the string being written is larger than the buffer. This broke various ObjC testcases
with very long symbol names.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 22:39:33 +00:00
Owen Anderson
66b17ba0d2 Move non-trivial methods out of line to avoid code-size bloat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 20:58:52 +00:00
Owen Anderson
cb37188323 Use raw_ostream throughout the AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 00:14:44 +00:00
Chris Lattner
98f8ccfad0 Move the fast-path (<=i64) cases of various APInt methods inline
and the slow-path cases out of line.  This speeds up instcombine
a bit in real world cases.  Patch contributed by m-s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 17:02:31 +00:00
Dan Gohman
eace52f12d It's not necessary to check if a value is null before delete[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 14:55:37 +00:00
Argyrios Kyrtzidis
b68dc369e0 Get raw_ostream.cpp to compile on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 09:25:21 +00:00
Chris Lattner
fad86b003a Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:19:36 +00:00
Chris Lattner
9f17eb0b79 remove a dead APInt ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 04:58:58 +00:00
Chris Lattner
07f51f788e add support for a cout/cerr analog (outs()/errs()) as well as
a simple adaptor class to give raw output capabilities to 
something that wants to write to an ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 04:13:37 +00:00
Chris Lattner
c52b128e1a opening "-" automatically yields stdout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 03:53:23 +00:00
Chris Lattner
d497df5cf5 rename OutputData to 'write' to match ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 01:46:05 +00:00
Chris Lattner
60d3962624 add a new raw_ostream class which is an extremely high performance ostream that
can *only* output data (no seeking, reading, etc).  This is adapted from the
clang "-E outputter", and is roughly 10% faster than stdio on darwin and 30%
(or more) faster than std::ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 01:35:29 +00:00
Dan Gohman
ee4bd9a5b4 Avoid repeatedly reallocating the FoldingSetNodeID when searching
through multiple nodes in a bucket.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 17:40:22 +00:00
Dan Gohman
430b8a22e2 Fix several const-correctness issues, resolving some -Wcast-qual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 14:45:15 +00:00
Dan Gohman
fed90b6d09 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 21:51:04 +00:00
Wojciech Matyjewicz
de0f2382e4 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 15:55:14 +00:00
Dan Gohman
5e84368b26 Reapply 53476 and 53480, with a fix so that it properly updates
the BB member to the current basic block after emitting
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 18:19:29 +00:00
Evan Cheng
b5eec33dcd Back out 53476 and 53480 for now. Somehow they cause llc to miscompile 179.art.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:38:51 +00:00
Dan Gohman
dbe2a5a269 Add support for putting NamedRegionTimers in TimerGroups, and
use a timer group for the timers in SelectionDAGISel. Also,
Split scheduling out from emitting, to give each their own
timer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 21:54:34 +00:00
Dan Gohman
c418bf3dd5 Use find instead of lower_bound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:58:19 +00:00
Dan Gohman
e14d81deeb Add some basic Pool-allocation infrastructure. This adds a Recycler class,
for handling bookkeeping for deleted objects, as well as the alist class
template, for keeping lists of objects allocated from Recyclers, and some
related utilities.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 22:58:06 +00:00
Owen Anderson
72e61b8501 Add a version of AddString that takes a const char* so we can avoid extraneous
conversions to std::string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 23:49:59 +00:00
Dan Gohman
153d28a414 Append to the ActiveTimers std::vector before looking at the timer instead
of after, so that any reallocation it does doesn't get counted for the pass
being timed.  This probably doesn't account for a timing discrepancy I was
looking into, but I'm fixing it anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:07:07 +00:00
Wojciech Matyjewicz
300c6c5167 First step to fix PR2088. Implement routine to compute the
multiplicative inverse of a given number. Modify udivrem to allow input and 
output pairs of arguments to overlap. Patch is based on the work by Chandler
Carruth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52638 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 19:39:50 +00:00
Dan Gohman
95df6b3603 Avoid creating a redundant zero APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:03:12 +00:00
Ted Kremenek
8d6a58c5d5 Consistently set "Buckets[NumBuckets] = reinterpret_cast<void*>(-1)" throughout FoldingSet.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 19:12:43 +00:00
Zhou Sheng
bfde7d6b9e As comments said, for negative value, the arithmetic
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51999 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 13:27:38 +00:00
Matthijs Kooijman
33540adca5 Give a proper error message when a command line option is defined more than
once (ie, at two different places in the source, not two times on the
commandline).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 13:26:11 +00:00
Bill Wendling
eecfa369eb Remove more iostream header includes. Needed to implement a "FlushStream"
function to flush a specified std::ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:46:33 +00:00
Dan Gohman
7edd009efe Tidy up whitespace in ConstantRange::print output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 20:29:07 +00:00
Dale Johannesen
386f3e9d50 Don't assume underlying APInt type is limited
to 64 bits.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 22:53:25 +00:00
Dale Johannesen
6a33cc12eb Remove undefined behavior in hex string->APFloat
conversion.  Try 0x1.0000a4p+0f.  Neil, please review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51132 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 22:05:31 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Dan Gohman
7c2e4f2fc5 Make firstEightPowers const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 16:38:14 +00:00
Dan Gohman
84b7df43fb Remove uses of llvm/System/IncludeFile.h that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:32:53 +00:00
Evan Cheng
34cd4a484e Fix more -Wshorten-64-to-32 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:30:58 +00:00
Evan Cheng
48e8c80e17 Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 21:15:08 +00:00
Gabor Greif
8811080a65 fcntl.h is pretty standard on unix (without the sys/)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 08:53:22 +00:00
Dan Gohman
3e2dda63d0 Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 20:25:15 +00:00
Ted Kremenek
c9715624fa Bug fix in BumpPtrAllocator: don't assume that all objects have the same alignment. "Bump" of the pointer for the next allocated object to be of the specified alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 17:58:07 +00:00
Mikhail Glushenkov
beb4d8293d Add support for response files to the CommandLine library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 16:44:25 +00:00
Dan Gohman
3c02aca238 Make these variables static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 23:15:23 +00:00
Dale Johannesen
79f82f9fd5 Check that APFloat::convert is not trying to target
ppc long double, which doesn't work.

This may break some stuff temporarily, but I want to
avoid the propagation of code that assumes this works.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 01:34:03 +00:00