Commit Graph

711 Commits

Author SHA1 Message Date
Chris Lattner
16062ca93a add a write method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:45:06 +00:00
Chris Lattner
a236c89ee3 add a new m_Specific pattern that matches only if we have a specific Value*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:38:30 +00:00
Chris Lattner
67abc10616 add a new template for matching a select between two constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59391 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:33:10 +00:00
Nick Lewycky
ac44d25bdd Clean up some strange whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 20:32:33 +00:00
Daniel Dunbar
0d9eb9b491 Add Binary flag to raw_fd_ostream constructor.
Document raw_fd_ostream's treatment of "-".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 05:01:07 +00:00
Anton Korobeynikov
476527a19d Symbol visibility is unsupported on cygwin too.
Patch by Jay Foad!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 18:05:01 +00:00
Dan Gohman
1975d03183 Canonicalize sext(i1) to i1?-1:0, and update various instcombine
optimizations accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58457 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 20:40:10 +00:00
Bill Wendling
a872aae731 Revert r58411. The user needs to #define this when using the JITMemoryManager.h header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 01:22:58 +00:00
Bill Wendling
fb309cb2d6 Revert part of r58048. It was breaking on SnowLeopard claiming that
"__STDC_CONSTANT_MACROS" needs to be #defined first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 00:11:55 +00:00
Dan Gohman
5a9a4bf7f2 Fix the name of the include guard to match the filename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:52:46 +00:00
Oscar Fuentes
cd6213233e CMake: Sync'ed DataTypes.h.cmake with DataTypes.h.in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58131 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 03:25:11 +00:00
Ted Kremenek
43d1f02b54 Added raw_fd_ostream::close().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:49:09 +00:00
Steve Naroff
93fbe75a94 Changes to make the Windows build work...
- Add a file to the VC++ project.
- Make sure the clang driver links against the Transforms library.
- Incorporate changes from patch by Dan Gohman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:28:23 +00:00
Argyrios Kyrtzidis
39ac2cbcd8 Introduce INT64_C macro and unbreak LLVM on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 17:20:39 +00:00
Daniel Dunbar
48534b31d8 Clear raw_fd_ostream error string on success and explain behavior in
documentation.

Add C++ header marker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 19:53:10 +00:00
Daniel Dunbar
76dba94dfa Rename IRBuilder::IsNonNull -> IsNotNull in response to feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56953 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:05:03 +00:00
Daniel Dunbar
7a3ec1e148 Add IRBuilder::{CreateIsNull, CreateIsNonNull} helper methods.
- I'm open to the idea that these could have better names. I think
   these read better than CreateEQNull and CreateNENull.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56757 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 23:22:55 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Devang Patel
eaf42abab6 s/ParameterAttributes/Attributes/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:03:40 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Nuno Lopes
5b8dbf839b plug memleak: destroy internal buffer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 12:06:08 +00:00
Evan Cheng
1505cdbcea Add DebugInfoBuilder. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 06:51:14 +00:00
Ted Kremenek
4ac67ef47a Grammar fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 16:41:15 +00:00
Ted Kremenek
3d4866e683 Added "str()" method to raw_string_ostream.
str() mirrors the same method in std::ostringstream.
str() flushes the buffered stream contents to string and returns a reference to the string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55370 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 16:34:01 +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
b2560526d5 Split format() out to its own file, add support for formatting
up to three values in one call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:48:00 +00:00
Chris Lattner
0958ab0fd1 conditionalize this to work on windows, untested but it should work
according to the intarnetz


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:27:03 +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
Nicolas Geoffray
f46dc79ac5 Also overload for char, since the "char" type depends on the host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 08:44:47 +00:00
Owen Anderson
1f83b02c62 Overload for both signed and unsigned char.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55171 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 07:42:25 +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
89a1a85913 Implement operator<< in terms of basic types rather than [u]int*_t, which is better for portability. There might be some way to factor this all with metaprogramming magic, but I'm not sure how offhand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 06:20:47 +00:00
Eli Friedman
afc802dc7d Remove size_t operator; this unbreaks the build on Linux. Committing on
the suggestion of resistor.

If this breaks some other platform, please go ahead and back this out.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 04:28:31 +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
071acf4279 add raw_ostream method for emitting an unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54972 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 04:23:02 +00:00
Gordon Henriksen
8715367182 Don't require Registry specializations to define random static variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54902 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 19:08:34 +00:00
Cedric Venet
94fb5f2a70 Make it compile on VC2005:
- update VC projects.
- Add an overload to llvm::Stream for <<, since std::hex and std::dec have type std::ios_base& (*)(std::ios_base&) in VC++. (templating the function don't work, due to ambiguities)
- add ../ on several include in X86/AsmPrinter/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:24:26 +00:00
Nick Lewycky
b6c8a4098f Fix build on GCC 4.3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 06:40:16 +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
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
66a6b8be97 remove accidental comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 01:35:54 +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
Duncan Sands
9d8658a129 Rename this, in case people think that NullFolder
has something to do with folding null values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 08:56:48 +00:00
Duncan Sands
fe24bd3a89 Add a NullFolder class that doesn't fold constants.
This may be used as the second IRBuilder template
parameter, the idea being that people learning LLVM
may find it helpful (several people asked on IRC
if it was possible to turn off constant folding
because it made it hard for them to see what was
going on).  Compiles, but otherwise completely
untested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 20:39:27 +00:00
Duncan Sands
20df07ba22 Point people to ConstantExpr and ConstantFolding,
in case they get the wrong idea.  Fit in 80 columns.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 09:43:15 +00:00
Duncan Sands
1e7f7865eb Make it possible to use different constant
folding policies with IRBuilder.  The default,
provided by ConstantFolder, is to do minimal
folding like now: what ConstantExpr provides.
An alternative is to use TargetFolder, which
uses target information to fold constants more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 15:29:30 +00:00
Duncan Sands
1d85163ec2 Unbreak the llvm-gcc build: recent changes to
IRBuilder are not expecting null names.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54581 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 15:14:59 +00:00
Chris Lattner
1378c1dd22 Make 'Insert' set the name for Loads, instead of passing the name into the
LoadInst ctor, which causes std::string thrashing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 06:26:23 +00:00
Eric Christopher
7a61d701c0 Have IRBuilder take a template argument on whether or not to preserve
names. This can save a lot of allocations if you aren't going to be
looking at the output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 19:39:37 +00:00