Commit Graph

1734 Commits

Author SHA1 Message Date
Dan Gohman
62c939d7d5 Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.

Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 05:21:24 +00:00
Dan Gohman
41474baac8 Add a sanity-check to tablegen to catch the case where isSimpleLoad
is set but mayLoad is not set. Fix all the problems this turned up.

Change code to not use isSimpleLoad instead of mayLoad unless it
really wants isSimpleLoad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 02:30:17 +00:00
Mikhail Glushenkov
ad746beb64 Support multiple compilation graph definitions. Not terribly useful, but makes the code more generic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60199 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:13:47 +00:00
Mikhail Glushenkov
739c720e66 Add 'hidden' and 'really_hidden' option properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:13:25 +00:00
Evan Cheng
884c70c912 On x86 favors folding short immediate into some arithmetic operations (e.g. add, and, xor, etc.) because materializing an immediate in a register is expensive in turns of code size.
e.g.
movl 4(%esp), %eax
addl $4, %eax

is 2 bytes shorter than

movl $4, %eax
addl 4(%esp), %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:49:46 +00:00
Mikhail Glushenkov
3acc921b26 Small fix: the error message was incorrect in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 10:55:45 +00:00
Bill Wendling
ce5ac1606f Copy the tblgen utility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 00:11:57 +00:00
Mikhail Glushenkov
35fde15059 Support dependencies between plugins by priority-sorting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 17:30:25 +00:00
Mikhail Glushenkov
fa2707709d Filter ToolPropertiesList to exclude all Tools not mentioned in the compilation graph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59448 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 17:29:42 +00:00
Mikhail Glushenkov
010887765a Add a layer of indirection to make plugins more flexible.
Use strings instead of TableGen defs in the compilation graph
definition. Makes it easier for the plugins to modify an existing graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59447 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 17:29:18 +00:00
Bill Wendling
023422a6eb Fix to record comparator to make it work for return values > 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 12:03:00 +00:00
Bill Wendling
20072af3b0 Put comma in correct place for call to StructType::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 10:18:35 +00:00
Bill Wendling
cdcc3e6e12 Modify the intrinsics pattern to separate out the "return" types from the
"parameter" types. An intrinsic can now return a multiple return values like
this:

  def add_with_overflow : Intrinsic<[llvm_i32_ty, llvm_i1_ty],
                                    [LLVMMatchType<0>, LLVMMatchType<0>]>;



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 09:08:33 +00:00
Oscar Fuentes
e40db4a2f3 Tell GenLibDeps.pl to inspect .so and .dylib shared files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 20:39:06 +00:00
Mikhail Glushenkov
6766572dcb Check the return value of std::getenv.
When constructing std::strings from C strings, we should check the input
value to be not NULL so that the std::string constructor does not
segfault.
Fixes #3047.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59131 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 12:41:18 +00:00
Mikhail Glushenkov
262d248833 Add a bit of lazy evaluation to PopulateCompilationGraph().
Only the tools that are mentioned in the compilation graph definition
are now inserted by PopulateCompilationGraph(). This should cut down
plugin loading time a little.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 00:05:17 +00:00
Mikhail Glushenkov
aa4774caaa Some cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 00:04:46 +00:00
Mikhail Glushenkov
c389e944cd Allow $CALL and $ENV in command names. Fixes #3025.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 19:43:32 +00:00
Anton Korobeynikov
760a5724c6 Properly escape dashes in TableGen's LLVMC2 emitter.
Patch by Patrick Walton!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58901 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 10:16:21 +00:00
Dan Gohman
212e6983eb Make tablegen print out a nice error message for a const char*
exception, like it does for a std::string exception.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07 21:01:13 +00:00
Dan Gohman
28c04dab38 Use an assert to check that SelectCode isn't called on
nodes that are already selected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 18:30:52 +00:00
Dan Gohman
8be6bbe5bf Eliminate the ISel priority queue, which used the topological order for a
priority function. Instead, just iterate over the AllNodes list, which is
already in topological order. This eliminates a fair amount of bookkeeping,
and speeds up the isel phase by about 15% on many testcases.

The impact on most targets is that AddToISelQueue calls can be simply removed.

In the x86 target, there are two additional notable changes.

The rule-bending AND+SHIFT optimization in MatchAddress that creates new
pre-isel nodes during isel is now a little more verbose, but more robust.
Instead of either creating an invalid DAG or creating an invalid topological
sort, as it has historically done, it can now just insert the new nodes into
the node list at a position where they will be consistent with the topological
ordering.

Also, the address-matching code has logic that checked to see if a node was
"already selected". However, when a node is selected, it has all its uses
taken away via ReplaceAllUsesWith or equivalent, so it won't recieve any
further visits from MatchAddress. This code is now removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 04:14:16 +00:00
Dan Gohman
da71cf0ce9 Give tablegen's Type a destructor, to suppress spurious
"Type has virtual functions but non-virtual destructor"
warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 18:09:07 +00:00
Dan Gohman
38bb2f8d09 Add some asserts to verify MVT invariant assumptions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 16:03:56 +00:00
Dan Gohman
3a5797d946 Change how extended types are represented in MVTs. Instead of fiddling
bits, use a union of a SimpleValueType enum and a regular Type*.

This increases the size of MVT on 64-bit hosts from 32 bits to 64 bits.
In most cases, this doesn't add significant overhead. There are places
in codegen that use arrays of MVTs, so these are now larger, but
they're small in common cases.

This eliminates restrictions on the size of integer types and vector
types that can be represented in codegen. As the included testcase
demonstrates, it's now possible to codegen very large add operations.
There are still some complications with using very large types. PR2880
is still open so they can't be used as return values on normal targets,
there are no libcalls defined for very large integers so operations
like multiply and divide aren't supported.

This also introduces a minimal tablgen Type library, capable of
handling IntegerType and VectorType. This will allow parts of
TableGen that don't depend on using SimpleValueType values to handle
arbitrary integer and vector types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 17:56:27 +00:00
Dan Gohman
c6e224196b Spell DISABLE_ASSERTIONS correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 01:08:03 +00:00
Bill Wendling
e649778b55 - Fix SUBVERSION string to handle x.x.x version number formats.
- Add VERBOSE=1 flag.
- Specify the LLVM_SUBMIT_VERSION when doing the "make install".
  The libLTO.dylib relies upon this flag during that time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 23:31:24 +00:00
David Greene
8ad4c00c00 Have TableGen emit setSubgraphColor calls under control of a -gen-debug
flag.  Then in a debugger developers can set breakpoints at these calls
to see waht is about to be selected and what the resulting subgraph
looks like.  This really helps when debugging instruction selection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 21:56:29 +00:00
Cedric Venet
7caa2d0ffc Remove tabs from my previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 19:21:35 +00:00
Matthijs Kooijman
677fbfa450 Remove redundant word in tblgen error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58250 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 15:59:43 +00:00
Cedric Venet
3bff2df61c Add a default constructor to AsmWriterOperand to make VS2008sp1 happy. (AsmWriterOperand is used in a std::pair, and VS need to generate the default constructor of this pair).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 15:40:44 +00:00
Argyrios Kyrtzidis
bb9d18c7d5 Unbreak LLVM on the MSVC compiler:
-Bring in int64_t for TableGen/Record.h and TableGen/TGLexer.h
-Define strtoull

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 09:54:13 +00:00
Evan Cheng
b89be6150a Add RCBarriers to TargetInstrDesc. It's a list of register classes the given instruction can "clobber". For example, on x86 the call instruction can modify all of the XMM and fp stack registers.
TableGen has been taught to generate the lists from instruction definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57722 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 21:00:09 +00:00
Dan Gohman
b2a1432507 Use INT64_C to emit constant values, to avoid problems with
constants that don't fit in an int. This fixes
"this decimal constant is unsigned only in ISO C90"
warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 04:40:39 +00:00
Dan Gohman
63f97201dc Fun x86 encoding tricks: when adding an immediate value of 128,
use a SUB instruction instead of an ADD, because -128 can be
encoded in an 8-bit signed immediate field, while +128 can't be.
This avoids the need for a 32-bit immediate field in this case.

A similar optimization applies to 64-bit adds with 0x80000000,
with the 32-bit signed immediate field.

To support this, teach tablegen how to handle 64-bit constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 01:33:43 +00:00
Dan Gohman
0540e17788 Add support for having multiple predicates on a TreePatternNode.
This will allow predicates to be composed, which will allow the
predicate definitions to become less redundant, and eventually
will allow DAGISelEmitter.cpp to emit less redundant code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:17:21 +00:00
Duncan Sands
4520dd2b7b Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 07:23:46 +00:00
Devang Patel
e93f5db6e5 Set UNIVERSAL_ARCH value.
Fixes build failure when target is i386.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57211 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 21:24:48 +00:00
Chris Lattner
1cfa0776c3 Fix shift overflow bug that would occur when a field was a full 32-bits
in tblgen.  This is PR2827, thanks to Waldemar Knorr for tracking this
down.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 18:31:58 +00:00
Chris Lattner
8d59af356f Make GenLibDeps.pl more robust in the face of broken piping problems.
Patch by Kenneth Boyd!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:03:46 +00:00
Dale Johannesen
48c1bc2ace Handle some 64-bit atomics on x86-32, some of the time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 18:53:47 +00:00
Dan Gohman
5ec9efd61b Move the primary fast-isel top-level comments to FastISel.cpp, where
they'll be a little more visible. Also, update and reword them a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:48:29 +00:00
Dan Gohman
31bd42bc63 Move the code that handles DAGISel error conditions into
helper functions instead of duplicating it inline each time
it is needed. This eliminates a few hundred or so copies
of this code in each target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 23:53:14 +00:00
Dan Gohman
7810bfed55 Rename ConstantSDNode's getSignExtended to getSExtValue, for
consistancy with ConstantInt, and re-implement it in terms
of ConstantInt's getSExtValue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:54:37 +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
Mikhail Glushenkov
4a1a77c1c9 Move llvmc2 header files under include/llvm/CompilerDriver
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 20:50:40 +00:00
Mikhail Glushenkov
c82ce4a8a7 Plugin support for llvmc2 (a-la opt).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 20:49:34 +00:00
Mikhail Glushenkov
0737651452 Make comments a little bit more clear.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 20:48:22 +00:00
Mikhail Glushenkov
11a353a206 Get rid of GlobalLanguageMap. Global state is evil.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 20:47:46 +00:00
Mikhail Glushenkov
fdee954623 Add a (forward_as) option property
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 20:46:19 +00:00