1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

509 Commits

Author SHA1 Message Date
Dan Gohman
1816900fd1 Add x86 isel patterns to match what would be a ZERO_EXTEND_INREG operation,
which is represented in codegen as an 'and' operation. This matches them
with movz instructions, instead of leaving them to be matched by and
instructions with an immediate field.

llvm-svn: 54147
2008-07-28 22:18:25 +00:00
Dan Gohman
9653b21dc2 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.

llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Dan Gohman
9742f7772d Rename SDOperand to SDValue.
llvm-svn: 54128
2008-07-27 21:46:04 +00:00
Dan Gohman
47c5cdbc34 Tidy SDNode::use_iterator, and complete the transition to have it
parallel its analogue, Value::value_use_iterator. The operator* method
now returns the user, rather than the use.

llvm-svn: 54127
2008-07-27 20:43:25 +00:00
Dan Gohman
2a0bc8f6e1 Rename isOnlyUseOf to isOnlyUserOf.
llvm-svn: 54124
2008-07-27 18:06:42 +00:00
Dan Gohman
bdbaf4d128 Improve comments for SDNode use-count methods. No functionality change.
llvm-svn: 54123
2008-07-27 17:44:52 +00:00
Dan Gohman
8981962672 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.

llvm-svn: 53728
2008-07-17 19:10:17 +00:00
Bill Wendling
7e2acf0dc9 Pull r53428 from Gaz into mainline:
Remove warnings about unused/shadowed variables.

llvm-svn: 53430
2008-07-10 22:57:49 +00:00
Dan Gohman
83d9009473 Add a SubclassData field to SDNode, similar to what's done
in Value, to make use of some otherwise unused space. Use this
field to shrink LoadSDNode and StoreSDNode by moving the
addressing mode and ext/trunc fields there.

llvm-svn: 53422
2008-07-10 21:44:59 +00:00
Dan Gohman
e10fc737ca Simplify hasNUsesOfValue and hasAnyUsesOfValue even more. This
makes their special-case checks of use_size() less beneficial,
so remove them. This eliminates all but one use of use_size(),
which is in AssignTopologicalOrder, which uses it only once for
each node, and so can reasonably afford to recompute it, as
this allows the UsesSize field of SDNode to be removed
altogether.

llvm-svn: 53377
2008-07-09 23:03:14 +00:00
Dan Gohman
679872b05f Move MemoryVT out of LSBaseNode into MemSDNode, allowing the
getMemOperand function to be moved into the base class as well
and made non-virtual.

llvm-svn: 53372
2008-07-09 22:08:04 +00:00
Dan Gohman
f6e651fcf2 Move the IsVolatile and SVOffset fields into the MemSDNode base
class, and store IsVolatile and Alignment in a more compact form.
This makes AtomicSDNode slightly larger, but it shrinks LoadSDNode
and StoreSDNode, which are much more common and are the largest of
the SDNode subclasses. Also, this lets the isVolatile() and
getAlignment() accessors be non-virtual.

llvm-svn: 53361
2008-07-09 21:23:02 +00:00
Dan Gohman
93e0208361 Pool-allocation for SDNodes. The pool is allocated once for each function,
and reused across SelectionDAGs.

This drastically reduces the number of calls to malloc/free made during
instruction selection, and improves memory locality.

llvm-svn: 53211
2008-07-07 23:02:41 +00:00
Dan Gohman
d787dcfa3d Fix SDNode::MorphNodeTo (a function used by by SelectNodeTo) to
properly track dead nodes that are on the original SDNode's operand
list but not the new one, and have no other uses.

llvm-svn: 53201
2008-07-07 20:57:48 +00:00
Dan Gohman
d263602463 Remove most of the uses of SDOperandPtr, usually replacing it with a
simple const SDOperand*, which is what's usually needed.

For AddNodeIDOperands, which is small, just duplicate the function to
accept an SDUse*.

For SelectionDAG::getNode - Add an overload that accepts SDUse* that
copies the operands into a temporary SDOperand array, but also has
special-case checks for 0 through 3 operands to avoid the copy in
the common cases.

llvm-svn: 53183
2008-07-07 18:26:29 +00:00
Duncan Sands
0caf597378 LegalizeTypes soft-float support for stores of a
float value.

llvm-svn: 53165
2008-07-07 00:08:12 +00:00
Dan Gohman
c8097f8c8c Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.

llvm-svn: 52943
2008-07-01 00:05:16 +00:00
Dan Gohman
6cc648891b Rename ISD::LOCATION to ISD::DBG_STOPPOINT to better reflect its
purpose, and give it a custom SDNode subclass so that it doesn't
need to have line number, column number, filename string, and
directory string, all existing as individual SDNodes to be the
operands.

This was the only user of ISD::STRING, StringSDNode, etc., so
remove those and some associated code.

This makes stop-points considerably easier to read in
-view-legalize-dags output, and reduces overhead (creating new
nodes and copying std::strings into them) on code containing
debugging information.

llvm-svn: 52924
2008-06-30 20:59:49 +00:00
Bill Wendling
36ebc296c1 Remove warnings about shadowed and unused variables.
llvm-svn: 52791
2008-06-26 18:11:45 +00:00
Duncan Sands
12c1bee452 Add support for expanding PPC 128 bit floats.
For this it is convenient to permit floats to
be used with EXTRACT_ELEMENT, so I tweaked
things to allow that.  I also added libcalls
for ppcf128 to i32 forms of FP_TO_XINT, since
they exist in libgcc and this case can certainly
occur (and does occur in the testsuite) - before
the i64 libcall was being used.  Also, the
XINT_TO_FP result seemed to be wrong when
the argument is an i128: the wrong fudge
factor was added (the i32 and i64 cases were
handled directly, but the i128 code fell
through to some generic softening code which
seemed to think it was i64 to f32!).  So I
fixed it by adding a fudge factor that I
found in my breakfast cereal.

llvm-svn: 52739
2008-06-25 20:24:48 +00:00
Dan Gohman
404964dbc0 Remove the OrigVT member from AtomicSDNode, as it is redundant with
the base SDNode's VTList.

llvm-svn: 52722
2008-06-25 16:07:49 +00:00
Mon P Wang
7d89d61387 Added MemOperands to Atomic operations since Atomics touches memory.
Added abstract class MemSDNode for any Node that have an associated MemOperand
Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and
atomic.lss => atomic.load.sub

llvm-svn: 52706
2008-06-25 08:15:39 +00:00
Dan Gohman
3ae70927cf Reorder some fields in SDNode. This avoids padding,
reducings its size from 80 to 72 on 64-bit hosts.

llvm-svn: 52584
2008-06-21 19:26:15 +00:00
Duncan Sands
57f1b4e23c Add some methods for querying the nature of a
store, like the methods for loads (and neaten
those up a bit while there).

llvm-svn: 52547
2008-06-20 18:34:30 +00:00
Andrew Lenharth
327c3e7559 add missing atomic intrinsic from gcc
llvm-svn: 52270
2008-06-14 05:48:15 +00:00
Duncan Sands
d634afe3aa Wrap MVT::ValueType in a struct to get type safety
and better control the abstraction.  Rename the type
to MVT.  To update out-of-tree patches, the main
thing to do is to rename MVT::ValueType to MVT, and
rewrite expressions like MVT::getSizeInBits(VT) in
the form VT.getSizeInBits().  Use VT.getSimpleVT()
to extract a MVT::SimpleValueType for use in switch
statements (you will get an assert failure if VT is
an extended value type - these shouldn't exist after
type legalization).
This results in a small speedup of codegen and no
new testsuite failures (x86-64 linux).

llvm-svn: 52044
2008-06-06 12:08:01 +00:00
Anton Korobeynikov
f77142326f For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h"
llvm-svn: 51687
2008-05-29 17:41:17 +00:00
Bill Wendling
1866fa680f Remove warnings about unused parameters and shadowed variables.
llvm-svn: 51266
2008-05-19 20:15:12 +00:00
Nate Begeman
11c0772a30 Add support for vicmp/vfcmp codegen, more legalize support coming.
This is necessary to unbreak the build.

llvm-svn: 50988
2008-05-12 19:40:03 +00:00
Bill Wendling
a7619e13ed Make the use of the "noinline" attribute conditional on using GCC.
llvm-svn: 50789
2008-05-07 00:00:34 +00:00
Bill Wendling
9d987912d6 Workaround for a compiler bug (see <rdar://problem/5852746>). Once that bug is
fixed, revert this patch.

llvm-svn: 50782
2008-05-06 23:30:02 +00:00
Mon P Wang
84a269e023 Added addition atomic instrinsics and, or, xor, min, and max.
llvm-svn: 50663
2008-05-05 19:05:59 +00:00
Evan Cheng
d9353009b7 Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Dale Johannesen
15969b664d Check we aren't trying to convert PPC long double.
This fixes the testsuite failure on ppcf128-4.ll.

llvm-svn: 49994
2008-04-20 18:23:46 +00:00
Dan Gohman
cfdb39da9c Remove the implicit conversion from SDOperandPtr to SDOperand*; this
may fix a build error on Visual Studio.

llvm-svn: 49876
2008-04-17 23:02:12 +00:00
Roman Levenstein
2a2a386127 Minor clean-up based on Dan's comments.
llvm-svn: 49844
2008-04-17 09:29:48 +00:00
Roman Levenstein
728d59166f Ongoing work on improving the instruction selection infrastructure:
Rename SDOperandImpl back to SDOperand.
Introduce the SDUse class that represents a use of the SDNode referred by
an SDOperand. Now it is more similar to Use/Value classes.

Patch is approved by Dan Gohman.

llvm-svn: 49795
2008-04-16 16:15:27 +00:00
Dale Johannesen
f45cadf9d2 Make 64-to-32 bit truncations explicit (prevent warnings).
All values here fit in 32 bits.

llvm-svn: 49736
2008-04-15 18:44:59 +00:00
Nicolas Geoffray
7e0110f724 Change Divided flag to Split, as suggested by Evan
llvm-svn: 49715
2008-04-15 08:08:50 +00:00
Nicolas Geoffray
ad5556e8ba Add a divided flag for the first piece of an argument divided into mulitple parts. Fixes PR1643
llvm-svn: 49611
2008-04-13 13:40:22 +00:00
Dan Gohman
15edbf989f Drop ISD::MEMSET, ISD::MEMMOVE, and ISD::MEMCPY, which are not Legal
on any current target and aren't optimized in DAGCombiner. Instead
of using intermediate nodes, expand the operations, choosing between
simple loads/stores, target-specific code, and library calls,
immediately.

Previously, the code to emit optimized code for these operations
was only used at initial SelectionDAG construction time; now it is
used at all times. This fixes some cases where rep;movs was being
used for small copies where simple loads/stores would be better.

This also cleans up code that checks for alignments less than 4;
let the targets make that decision instead of doing it in
target-independent code. This allows x86 to use rep;movs in
low-alignment cases.

Also, this fixes a bug that resulted in the use of rep;stos for
memsets of 0 with non-constant memory size when the alignment was
at least 4. It's better to use the library in this case, which
can be significantly faster when the size is large.

This also preserves more SourceValue information when memory
intrinsics are lowered into simple loads/stores.

llvm-svn: 49572
2008-04-12 04:36:06 +00:00
Dan Gohman
d7301ea935 Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.

llvm-svn: 49348
2008-04-07 19:35:22 +00:00
Roman Levenstein
b40d332929 Re-commit of the r48822, where the infinite looping problem discovered
by Dan Gohman is fixed.

llvm-svn: 49330
2008-04-07 10:06:32 +00:00
Evan Cheng
497c607fae Backing out 48222 temporarily.
llvm-svn: 49124
2008-04-03 03:13:16 +00:00
Roman Levenstein
55b8822511 Use a linked data structure for the uses lists of an SDNode, just like
LLVM Value/Use does and MachineRegisterInfo/MachineOperand does.
This allows constant time for all uses list maintenance operations.

The idea was suggested by Chris. Reviewed by Evan and Dan.
Patch is tested and approved by Dan.

On normal use-cases compilation speed is not affected. On very big basic
blocks there are compilation speedups in the range of 15-20% or even better. 

llvm-svn: 48822
2008-03-26 12:39:26 +00:00
Duncan Sands
4153fc30c9 Introduce a new node for holding call argument
flags.  This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines.  There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness.  As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.

llvm-svn: 48640
2008-03-21 09:14:45 +00:00
Duncan Sands
05eb212b2d Don't try to extract an i32 from an f64. This
getCopyToParts problem was noticed by the new
LegalizeTypes infrastructure.  In order to avoid
this kind of thing in the future I've added a
check that EXTRACT_ELEMENT is only used with
integers.  Once LegalizeTypes is up and running
most likely BUILD_PAIR and EXTRACT_ELEMENT can
be removed, in favour of using apints instead.

llvm-svn: 48294
2008-03-12 20:30:08 +00:00
Evan Cheng
59831b0358 Document an implementation detail about EXTRACT_SUBREG and INSERT_SUBREG sub-register operand.
llvm-svn: 48283
2008-03-12 07:52:15 +00:00
Evan Cheng
067ecbc341 Revert 48125, 48126, and 48130 for now to unbreak some x86-64 tests.
llvm-svn: 48167
2008-03-10 19:31:26 +00:00
Dale Johannesen
2bbe0d95cf Use uint64_t not unsigned long long.
llvm-svn: 48154
2008-03-10 17:05:01 +00:00
Christopher Lamb
32e5ce3d96 Allow insert_subreg into implicit, target-specific values.
Change insert/extract subreg instructions to be able to be used in TableGen patterns.
Use the above features to reimplement an x86-64 pseudo instruction as a pattern.

llvm-svn: 48130
2008-03-10 06:12:08 +00:00
Dale Johannesen
e6b0009792 Increase ISD::ParamFlags to 64 bits. Increase the ByValSize
field to 32 bits, thus enabling correct handling of ByVal
structs bigger than 0x1ffff.  Abstract interface a bit.
Fixes gcc.c-torture/execute/pr23135.c and 
gcc.c-torture/execute/pr28982b.c in gcc testsuite (were ICE'ing
on ppc32, quietly producing wrong code on x86-32.)

llvm-svn: 48122
2008-03-10 02:17:22 +00:00
Evan Cheng
dba1dfe962 Implement x86 support for @llvm.prefetch. It corresponds to prefetcht{0|1|2} and prefetchnta instructions.
llvm-svn: 48042
2008-03-08 00:58:38 +00:00
Dale Johannesen
8322b6fb70 Clarify that CALLSEQ_START..END may not be nested,
and add some protection against creating such.

llvm-svn: 47957
2008-03-05 19:14:03 +00:00
Evan Cheng
b5b16810ac Rename isOperand() to isOperandOf() (and other similar methods). It always confuses me.
llvm-svn: 47872
2008-03-04 00:41:45 +00:00
Duncan Sands
6a4acca399 Document that the shuffle mask may contain undef
values.

llvm-svn: 47719
2008-02-28 17:12:11 +00:00
Duncan Sands
cadfe810f3 LegalizeTypes support for INSERT_VECTOR_ELT.
llvm-svn: 47669
2008-02-27 10:18:23 +00:00
Dan Gohman
4089604796 Factor the assert for indexed loads/stores out of LoadSDNode
and StoreSDNode into LSBaseSDNode.

llvm-svn: 47570
2008-02-25 22:16:29 +00:00
Chris Lattner
a2c10fa860 add LSBaseSDNode::getOffset at Dan's request.
llvm-svn: 47558
2008-02-25 19:31:21 +00:00
Dan Gohman
4f288e3298 Add a new method to SDNode/SDOperand named getValueSizeInBits
that combines getValueType and MVT::getSizeInBits, since this
occurrs frequently.

llvm-svn: 47552
2008-02-25 19:08:02 +00:00
Chris Lattner
7d3c05df5b minor cleanups to LSBaseSDNode.
llvm-svn: 47469
2008-02-22 01:54:35 +00:00
Andrew Lenharth
b8f9871711 Better names as per Evan's request
llvm-svn: 47435
2008-02-21 16:11:38 +00:00
Andrew Lenharth
db9cd46f5d Atomic op support. If any gcc test uses __sync builtins, it might start failing on archs that haven't implemented them yet
llvm-svn: 47430
2008-02-21 06:45:13 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Evan Cheng
bb577266bf - When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type.
- X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC.

llvm-svn: 47290
2008-02-18 23:04:32 +00:00
Andrew Lenharth
c178981b85 llvm.memory.barrier, and impl for x86 and alpha
llvm-svn: 47204
2008-02-16 01:24:58 +00:00
Nate Begeman
929fd03fbe Nuke dead comment
llvm-svn: 47114
2008-02-14 07:23:11 +00:00
Dan Gohman
3e4b49b4a6 Add a doxygen comment for SrcValueSDNode, to make its purpose
clear and to clarify how it differs from MemOperandSDNode.

llvm-svn: 47015
2008-02-12 18:52:52 +00:00
Dan Gohman
861923ed06 From Chris' review: change MemOperandSDNode's constructor to pass its
argument by reference, rather than by value. 

llvm-svn: 46960
2008-02-11 18:56:50 +00:00
Dan Gohman
672d341167 Change ConstantSDNode to store an APInt instead of a uint64_t, and
begin adding some methods to use it this way.

llvm-svn: 46899
2008-02-08 22:59:30 +00:00
Dan Gohman
1f255f2db7 Avoid needlessly casting away const qualifiers.
llvm-svn: 46876
2008-02-08 03:26:46 +00:00
Dan Gohman
f00842e086 Re-apply the memory operand changes, with a fix for the static
initializer problem, a minor tweak to the way the
DAGISelEmitter finds load/store nodes, and a renaming of the
new PseudoSourceValue objects.

llvm-svn: 46827
2008-02-06 22:27:42 +00:00
Evan Cheng
352062f5f7 Typo.
llvm-svn: 46725
2008-02-04 23:10:38 +00:00
Evan Cheng
c57ec111f2 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.

llvm-svn: 46659
2008-02-02 04:07:54 +00:00
Evan Cheng
2a533e6894 Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
llvm-svn: 46623
2008-01-31 21:00:00 +00:00
Evan Cheng
705212577d Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
llvm-svn: 46609
2008-01-31 09:59:15 +00:00
Dan Gohman
3993809a0c Rename ISD::FLT_ROUNDS to ISD::FLT_ROUNDS_ to avoid conflicting
with the real FLT_ROUNDS (defined in <float.h>).

llvm-svn: 46587
2008-01-31 00:41:03 +00:00
Dan Gohman
4326d513ab Create a new class, MemOperand, for describing memory references
in the backend. Introduce a new SDNode type, MemOperandSDNode, for
holding a MemOperand in the SelectionDAG IR, and add a MemOperand
list to MachineInstr, and code to manage them. Remove the offset
field from SrcValueSDNode; uses of SrcValueSDNode that were using
it are all all using MemOperandSDNode now.

Also, begin updating some getLoad and getStore calls to use the
PseudoSourceValue objects.

Most of this was written by Florian Brander, some
reorganization and updating to TOT by me.

llvm-svn: 46585
2008-01-31 00:25:39 +00:00
Dan Gohman
13d1327796 Factor the addressing mode and the load/store VT out of LoadSDNode
and StoreSDNode into their common base class LSBaseSDNode. Member
functions getLoadedVT and getStoredVT are replaced with the common
getMemoryVT to simplify code that will handle both loads and stores.

llvm-svn: 46538
2008-01-30 00:15:11 +00:00
Chris Lattner
9c66a1b961 make isExactlyValue work for long double.
llvm-svn: 46410
2008-01-27 06:19:08 +00:00
Chris Lattner
98cd94a56d add some helper methods.
llvm-svn: 46128
2008-01-17 07:30:38 +00:00
Chris Lattner
d033200a8f * Introduce a new SelectionDAG::getIntPtrConstant method
and switch various codegen pieces and the X86 backend over
  to using it.

* Add some comments to SelectionDAGNodes.h

* Introduce a second argument to FP_ROUND, which indicates
  whether the FP_ROUND changes the value of its input. If
  not it is safe to xform things like fp_extend(fp_round(x)) -> x.

llvm-svn: 46125
2008-01-17 07:00:52 +00:00
Chris Lattner
50f1b6f9a5 Factor the ReachesChainWithoutSideEffects out of dag combiner into
a public SDOperand::reachesChainWithoutSideEffects method.  No 
functionality change.

llvm-svn: 46050
2008-01-16 05:49:24 +00:00
Anton Korobeynikov
08ea121968 For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

llvm-svn: 46001
2008-01-15 07:02:33 +00:00
Chris Lattner
433aca5066 remove some incorrect classof's.
llvm-svn: 45893
2008-01-11 23:25:16 +00:00
Scott Michel
1e9496e4d4 More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

llvm-svn: 45851
2008-01-11 02:53:15 +00:00
Nate Begeman
9b7f984bbb Update the comment on scalar to vector to be a bit more clear.
llvm-svn: 45707
2008-01-07 17:52:24 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Chris Lattner
f2aa80e0de Add a new FGETSIGN operation, which defaults to expand on all
targets.

llvm-svn: 45320
2007-12-22 20:47:56 +00:00
Evan Cheng
740c2d731f Cosmetic change.
llvm-svn: 44961
2007-12-12 23:15:59 +00:00
Dan Gohman
d460d8eab0 Fix a typo in a comment.
llvm-svn: 44235
2007-11-19 15:36:19 +00:00
Anton Korobeynikov
b6c3255d80 Implement necessary bits for flt_rounds gcc builtin.
Codegen bits and llvm-gcc support will follow.

llvm-svn: 44182
2007-11-15 23:25:33 +00:00
Duncan Sands
f37520fcff Fix comment typos.
llvm-svn: 43338
2007-10-25 12:28:12 +00:00
Rafael Espindola
d8d4372845 Add support for byval function whose argument is not 32 bit aligned.
To do this it is necessary to add a "always inline" argument to the
memcpy node. For completeness I have also added this node to memmove
and memset.  I have also added getMem* functions, because the extra
argument makes it cumbersome to use getNode and because I get confused
by it :-)

llvm-svn: 43172
2007-10-19 10:41:11 +00:00
Chris Lattner
c3a75c628d remove dead enum, make setNodeId public.
llvm-svn: 42977
2007-10-15 05:30:55 +00:00
Dan Gohman
bc5fc4f519 Add an ISD::FPOW node type.
llvm-svn: 42879
2007-10-11 23:06:37 +00:00
Evan Cheng
c6b349980a Oops. Forgot this.
llvm-svn: 42691
2007-10-06 08:09:29 +00:00
Dan Gohman
148f07390d Define target-indepenent SDNode types for multiply and divide that
produce two results.

llvm-svn: 42632
2007-10-05 14:07:56 +00:00
Duncan Sands
922a92a9e2 Fix typo in comment.
llvm-svn: 42631
2007-10-05 10:37:00 +00:00
Chris Lattner
cc315726f7 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.

llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Dan Gohman
81b5cda0aa Add a utility function to SDOperand for testing if a value is unused.
llvm-svn: 42038
2007-09-17 17:44:31 +00:00
Duncan Sands
c358890f73 Fold the adjust_trampoline intrinsic into
init_trampoline.  There is now only one
trampoline intrinsic.

llvm-svn: 41841
2007-09-11 14:10:23 +00:00
Dale Johannesen
b34e6b4898 Add mod, copysign, abs operations to APFloat.
Implement some constant folding in SelectionDAG and
DAGCombiner using APFloat.  Remove double versions
of constructor and getValue from ConstantFPSDNode.

llvm-svn: 41664
2007-08-31 23:34:27 +00:00
Dale Johannesen
e91a908971 Change LegalFPImmediates to use APFloat.
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.

llvm-svn: 41587
2007-08-30 00:23:21 +00:00
Dale Johannesen
2ceade197b Revise per review comments.
llvm-svn: 41409
2007-08-26 01:18:27 +00:00
Dale Johannesen
b52093236e Add APFloat interface to ConstantFPSDNode. Change
over uses in DAGCombiner.  Fix interfaces to work
with APFloats.

llvm-svn: 41407
2007-08-25 22:10:57 +00:00
Dale Johannesen
5c0b0ec1d6 Use APFloat internally for ConstantFPSDNode.
llvm-svn: 41372
2007-08-24 20:59:15 +00:00
Rafael Espindola
b20b9e985a propagate struct size and alignment of byval arguments to the DAG
llvm-svn: 40986
2007-08-10 14:44:42 +00:00
Evan Cheng
a06b9cf09f Do not emit copies for physical register output if it's not used.
llvm-svn: 40722
2007-08-02 05:29:38 +00:00
Duncan Sands
e8bb2c6d32 Support for trampolines, except for X86 codegen which is
still under discussion.

llvm-svn: 40549
2007-07-27 12:58:54 +00:00
Christopher Lamb
73c3cd47cc Add selection DAG nodes for subreg insert/extract. PR1350
llvm-svn: 40516
2007-07-26 07:34:40 +00:00
Anton Korobeynikov
5635277c36 Long live the exception handling!
This patch fills the last necessary bits to enable exceptions
handling in LLVM. Currently only on x86-32/linux.

In fact, this patch adds necessary intrinsics (and their lowering) which
represent really weird target-specific gcc builtins used inside unwinder.

After corresponding llvm-gcc patch will land (easy) exceptions should be
more or less workable. However, exceptions handling support should not be 
thought as 'finished': I expect many small and not so small glitches
everywhere.

llvm-svn: 39855
2007-07-14 14:06:15 +00:00
Evan Cheng
23dc96f640 Move DenseMapKeyInfo<SDOperand> from LegalizeDAG.cpp to SelectionDAGNodes.h
llvm-svn: 38484
2007-07-10 06:59:55 +00:00
Dan Gohman
dd89857d45 Fix a comment so that the element numbering match the actual element
operand numbering.

llvm-svn: 37944
2007-07-06 13:27:33 +00:00
Rafael Espindola
7b3de98989 Add the byval attribute
llvm-svn: 37940
2007-07-06 10:57:03 +00:00
Dan Gohman
c6bdcfa8c0 Add new TargetLowering code to provide the final register type that an
illegal value type will be transformed to, for code that needs the
register type after all transformations instead of just after the first
transformation.

Factor out the code that uses this information to do copy-from-regs and
copy-to-regs for various purposes into separate functions so that they
are done consistently.

llvm-svn: 37781
2007-06-28 23:29:44 +00:00
Dan Gohman
354f02e03d Generalize MVT::ValueType and associated functions to be able to represent
extended vector types. Remove the special SDNode opcodes used for pre-legalize
vector operations, and the special MVT::Vector type used with them. Adjust
lowering and legalize to work with the normal SDNode kinds instead, and to
use the normal MVT functions to work with vector types instead of using the
two special operands that the pre-legalize nodes held.

This allows pre-legalize and post-legalize DAGs, and the code that operates
on them, to be more consistent. Pre-legalize vector operators can be handled
more consistently with scalar operators. And, -view-dag-combine1-dags and
-view-legalize-dags now look prettier for vector code.

llvm-svn: 37719
2007-06-25 16:23:39 +00:00
Dan Gohman
6415b2548e Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.

llvm-svn: 37569
2007-06-13 15:12:02 +00:00
Dan Gohman
2c5d31ee81 Minor comment cleanups.
llvm-svn: 37321
2007-05-24 14:36:04 +00:00
Dan Gohman
b0fd1c9640 Correct a comment.
llvm-svn: 37058
2007-05-15 00:20:13 +00:00
Christopher Lamb
a157874a8a PR400 phase 2. Propagate attributed load/store information through DAGs.
llvm-svn: 36356
2007-04-22 23:15:30 +00:00
Lauro Ramos Venancio
3b60b9546e X86 TLS: Implement review feedback.
llvm-svn: 36318
2007-04-21 20:56:26 +00:00
Reid Spencer
81070d52da Revert Christopher Lamb's load/store alignment changes.
llvm-svn: 36309
2007-04-21 18:36:27 +00:00
Christopher Lamb
b56b6a7ad7 add support for alignment attributes on load/store instructions
llvm-svn: 36301
2007-04-21 08:16:25 +00:00
Lauro Ramos Venancio
bc32d90b46 Implement "general dynamic", "initial exec" and "local exec" TLS models for
X86 32 bits.

llvm-svn: 36283
2007-04-20 21:38:10 +00:00
Anton Korobeynikov
9bc4b792bf Implemented correct stack probing on mingw/cygwin for dynamic alloca's.
Also, fixed static case in presence of eax livin. This fixes PR331

PS: Why don't we still have push/pop instructions? :)
llvm-svn: 36195
2007-04-17 09:20:00 +00:00
Reid Spencer
5ac41f7bc9 For PR1297:
Intrinsic functions might need to be generated (if they are overloaded) so
returning a const char* is no longer possible. Change getOperationName to
return a std::string instead.

llvm-svn: 35543
2007-04-01 07:28:37 +00:00
Dan Gohman
42a3f4e16e Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.

llvm-svn: 35280
2007-03-23 18:44:11 +00:00
Anton Korobeynikov
85d6c1ebad Refactoring of formal parameter flags. Enable properly use of
zext/sext/aext stuff.

llvm-svn: 35008
2007-03-07 16:25:09 +00:00
Evan Cheng
d4fb00bb6b Add a utility function to test whether a load is unindexed.
llvm-svn: 35004
2007-03-07 08:04:41 +00:00
Chris Lattner
295b3d69b1 add a new node
llvm-svn: 34912
2007-03-04 20:40:06 +00:00
Jim Laskey
013a72ffd4 Add new instructions for handling data passed into eh landing pad.
llvm-svn: 34472
2007-02-21 22:37:22 +00:00
Reid Spencer
e7ff3305d6 For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.

llvm-svn: 34300
2007-02-15 03:39:18 +00:00
Lauro Ramos Venancio
0471446487 Add comment about original function argument alignment.
llvm-svn: 34243
2007-02-13 17:57:38 +00:00
Chris Lattner
59d7c680b5 Introduce new UnarySDNode/BinarySDNode/TernarySDNode nodes, which coallocate
their operands with the node itself.  This reduces malloc traffic for operand
lists.  This reduces isel time on kc++ from 2.6164 to 2.5570s, about 2.3%.

llvm-svn: 33878
2007-02-04 08:35:21 +00:00
Chris Lattner
22db3d9fca Add a new SDNode ctor and InitOperands method. This allows the operands for
an SDNode to be allocated as part of the node itself, instead of being a
separate new[]'d object.  Switch HandleSDNode, LoadSDNode, and StoreSDNode
to use this mechanism.  This saves one heap allocation and free for each node
of this type that is allocated.  This reduces isel time from 2.7638 to 2.6164s
on kc++, which is a 5.6% speedup.

llvm-svn: 33877
2007-02-04 08:13:53 +00:00
Chris Lattner
dcdf1edd93 eliminate the SDNode::setValueTypes method.
llvm-svn: 33876
2007-02-04 07:37:24 +00:00
Chris Lattner
2b6734a983 eliminate a bunch of duplicate ctors and helper functions.
llvm-svn: 33875
2007-02-04 07:28:00 +00:00
Chris Lattner
8bbd45cd6e move MorphNode to out of line and merge setNodeOperands into it. There is
no behavior or performance change here.

llvm-svn: 33869
2007-02-04 02:49:29 +00:00
Chris Lattner
ccd1f36346 simplify MorphNodeTo to take a VTList operand.
llvm-svn: 33868
2007-02-04 02:41:42 +00:00
Chris Lattner
7e8b8e7a68 eliminate some extraneous methods in SDNode
llvm-svn: 33867
2007-02-04 02:32:44 +00:00
Chris Lattner
f3b4a0cc95 Give each selectiondag node class a home for it's vtable and rtti info
llvm-svn: 33866
2007-02-04 02:23:32 +00:00
Nate Begeman
dc46021355 Finish off bug 680, allowing targets to custom lower frame and return
address nodes.

llvm-svn: 33636
2007-01-29 22:58:52 +00:00
Anton Korobeynikov
611d5e2eda Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.
llvm-svn: 33597
2007-01-28 13:31:35 +00:00
Jim Laskey
64f4242072 Change the MachineDebugInfo to MachineModuleInfo to better reflect usage
for debugging and exception handling.

llvm-svn: 33550
2007-01-26 21:22:28 +00:00
Jim Laskey
23ed7d2625 Make LABEL a builtin opcode.
llvm-svn: 33537
2007-01-26 14:34:52 +00:00
Evan Cheng
70700ba459 Typo.
llvm-svn: 32628
2006-12-16 06:21:55 +00:00
Evan Cheng
89ee587963 Rename ISD::MemOpAddrMode to ISD::MemIndexedMode
llvm-svn: 31595
2006-11-09 17:55:04 +00:00
Evan Cheng
047a33d3e3 Fix comments.
llvm-svn: 31414
2006-11-03 07:31:32 +00:00
Evan Cheng
b19289a84d Add isPredecessor to check whether a node is another's predecessor.
llvm-svn: 31406
2006-11-03 03:02:18 +00:00
Evan Cheng
7437ed9f30 Added a new SDNode type: BR_JT for jumptable branch.
llvm-svn: 31292
2006-10-30 07:59:36 +00:00
Jim Laskey
f5452dfa52 Editorial clean up.
llvm-svn: 31250
2006-10-28 01:34:21 +00:00
Jim Laskey
ef56bc9680 Switch over from SelectionNodeCSEMap to FoldingSet.
llvm-svn: 31240
2006-10-27 23:46:08 +00:00
Evan Cheng
d2d6b83b83 Indexed load / store changes.
llvm-svn: 31208
2006-10-26 21:52:24 +00:00
Evan Cheng
582d22a821 Split PRE_INDEXED to PRE_INC / PRE_DEC and similarly for POST_INDEXED.
llvm-svn: 31015
2006-10-17 21:12:56 +00:00
Evan Cheng
fe5bb5dbe6 Merge ISD::TRUNCSTORE to ISD::STORE. Switch to using StoreSDNode.
llvm-svn: 30945
2006-10-13 21:14:26 +00:00
Evan Cheng
9b31a4d4ed Naming consistency.
llvm-svn: 30878
2006-10-11 07:10:22 +00:00
Andrew Lenharth
4b783303e5 Jimptables working again on alpha.
As a bonus, use the GOT node instead of the AlphaISD::GOT for internal stuff.

llvm-svn: 30873
2006-10-11 04:29:42 +00:00
Evan Cheng
8090a67f40 Comments; getChain(), getBasePtr(), etc. should return a SDOperand by value.
llvm-svn: 30850
2006-10-10 01:44:58 +00:00
Evan Cheng
967d6af1d2 Merging ISD::LOAD and ISD::LOADX. Added LoadSDNode to represent load nodes.
Chain and address ptr remains as operands. SrcValue, extending mode, extending
VT (or rather loaded VT before extension) are now instance variables of
LoadSDNode.

Introduce load / store addressing modes to represent pre- and post-indexed
load and store. Also added an additional operand offset that is only used in
post-indexed mode (i.e. base ptr += offset after load/store).

Added alignment info (not yet used) and isVolatile fields.

llvm-svn: 30843
2006-10-09 20:55:20 +00:00
Evan Cheng
494e8e6971 Combine ISD::EXTLOAD, ISD::SEXTLOAD, ISD::ZEXTLOAD into ISD::LOADX. Add an
extra operand to LOADX to specify the exact value extension type.

llvm-svn: 30714
2006-10-04 00:56:09 +00:00
Andrew Lenharth
58f5a24f0c Add support for other relocation bases to jump tables, as well as custom asm directives
llvm-svn: 30593
2006-09-24 19:45:58 +00:00
Evan Cheng
b25fd42e43 The top bit is used to determine whether it's a MachineConstantPoolValue.
llvm-svn: 30324
2006-09-14 07:30:48 +00:00
Evan Cheng
499d77553a Added support for machine specific constantpool values. These are useful for
representing expressions that can only be resolved at link time, etc.

llvm-svn: 30278
2006-09-12 21:00:35 +00:00
Chris Lattner
7005757ced Implement new fpowi node
llvm-svn: 30223
2006-09-09 05:55:44 +00:00
Evan Cheng
6e08e7035f Eliminate SelectNodeTo() and getTargetNode() variants which take more than
3 SDOperand operands. They are replaced by versions which take an array
of SDOperand and the number of operands.

llvm-svn: 29905
2006-08-27 08:08:54 +00:00
Chris Lattner
c1654416d6 Change the use_list to be a smallvector instead of a vector. This reduces
isel time from 6.79s to 5.53s (22%) on kc++ with a release build on ppc.
Go smallvector! :)

llvm-svn: 29731
2006-08-16 21:01:10 +00:00
Chris Lattner
cb3adb8225 Start using SDVTList more consistently
llvm-svn: 29711
2006-08-15 19:11:05 +00:00
Chris Lattner
8e8d9a3358 Add a new getNode() method that takes a pointer to an already-intern'd list
of value-type nodes.  This avoids having to do mallocs for std::vectors of
valuetypes when a node returns more than one type.

llvm-svn: 29685
2006-08-14 23:31:51 +00:00
Chris Lattner
fe1fd00ce8 Add code to resize the CSEMap hash table. This doesn't speedup codegen of
kimwitu, but seems like a good idea from a "avoid performance cliffs" standpoint :)

llvm-svn: 29675
2006-08-14 22:19:25 +00:00
Chris Lattner
be2fc7b875 Eliminate some malloc traffic by allocating vectors on the stack. Change some
method that took std::vector<SDOperand> to take a pointer to a first operand
and #operands.

This speeds up isel on kc++ by about 3%.

llvm-svn: 29561
2006-08-08 01:09:31 +00:00
Chris Lattner
1661ffa2eb Revamp the "CSEMap" datastructure used in the SelectionDAG class. This
eliminates a bunch of std::map's in the SelectionDAG, replacing them with a
home-grown hashtable.

This is still a work in progress: not all the maps have been moved over and the
hashtable never resizes.  That said, this still speeds up llc 20% on kimwitu++
with -fast -regalloc=local using a release build.

llvm-svn: 29550
2006-08-07 23:03:03 +00:00
Evan Cheng
a8e15977aa Remove NodeDepth; Add NodeId which is a unique id per node per DAG. It can only be set by SelectionDAG.
llvm-svn: 29336
2006-07-27 06:38:21 +00:00
Chris Lattner
3415e20ae6 Add an out-of-line virtual method for the sdnode class to give it a home.
llvm-svn: 29192
2006-07-19 00:00:37 +00:00
Chris Lattner
990b00b325 Add a new sentry node type, allowing assertions to catch trivial
use-after-deleted errors.

llvm-svn: 28513
2006-05-27 00:40:15 +00:00
Evan Cheng
f53c4cc192 Change RET node to include signness information of the return values. e.g.
RET chain, value1, sign1, value2, sign2

llvm-svn: 28509
2006-05-26 23:09:09 +00:00
Evan Cheng
5d83c6ad6a CALL node change: now containing signness of each argument.
llvm-svn: 28460
2006-05-25 00:54:33 +00:00
Chris Lattner
5d949a2ad2 Add a new CALL node.
llvm-svn: 28337
2006-05-16 22:52:27 +00:00
Chris Lattner
f88654d468 Add a chain to FORMAL_ARGUMENTS.
llvm-svn: 28319
2006-05-16 06:43:59 +00:00
Nate Begeman
7ed816f900 JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.

llvm-svn: 27947
2006-04-22 18:53:45 +00:00
Reid Spencer
553050adcb Make sure both member variables are initialized in the default constructor
for SDOperand. This gets rid of numerous warnings in lib/CodeGen and
lib/Target when compiled with GCC 4.0.2

llvm-svn: 27607
2006-04-12 16:44:15 +00:00
Chris Lattner
bf69078515 new dag node
llvm-svn: 27596
2006-04-11 21:30:42 +00:00
Chris Lattner
a4a7e59c52 Add a new VSELECT node.
llvm-svn: 27541
2006-04-08 22:16:01 +00:00
Chris Lattner
99a3213376 simplify this method
llvm-svn: 27338
2006-04-02 02:28:52 +00:00
Chris Lattner
83ec289ebf Add a new node
llvm-svn: 27230
2006-03-28 19:54:11 +00:00
Chris Lattner
a0f80c3c3f Tblgen doesn't like multiple SDNode<> definitions that map to the same
enum value.  Split them into separate enums.

llvm-svn: 27199
2006-03-28 00:39:06 +00:00
Evan Cheng
4667bd17cb Change isBuildVectorAllOnesInteger to isBuildVectorAllOnes. Also check for
floating point cases.

llvm-svn: 27165
2006-03-27 06:58:47 +00:00
Evan Cheng
ef3b33b847 Add ISD::isBuildVectorAllZeros predicate
llvm-svn: 27147
2006-03-26 09:50:58 +00:00
Chris Lattner
91fe1d4b55 Add a predicate
llvm-svn: 27129
2006-03-25 22:56:35 +00:00
Chris Lattner
7c4160da23 add a new intrinsic node
llvm-svn: 27019
2006-03-24 01:03:55 +00:00
Chris Lattner
d4f04c4b6a Fix comments
llvm-svn: 26960
2006-03-22 20:09:04 +00:00
Chris Lattner
b1bc1f88c0 add a new node
llvm-svn: 26958
2006-03-22 19:56:46 +00:00
Chris Lattner
9f8cfe5ab4 add some nodes for extractelement
llvm-svn: 26927
2006-03-21 20:43:08 +00:00
Chris Lattner
0b7ec34646 add a node
llvm-svn: 26879
2006-03-19 23:42:51 +00:00
Chris Lattner
bbbf21b37b improve comments, add a new MVT::getVectorBaseType method.
llvm-svn: 26855
2006-03-19 05:26:45 +00:00
Chris Lattner
868679006d Rename ConstantVec -> BUILD_VECTOR and VConstant -> VBUILD_VECTOR. Allow
*BUILD_VECTOR to take variable inputs.

llvm-svn: 26846
2006-03-19 00:52:25 +00:00
Chris Lattner
25feee0be9 Update comments.
llvm-svn: 26839
2006-03-18 01:43:28 +00:00
Chris Lattner
da6506a1f2 add a couple of enum values
llvm-svn: 26829
2006-03-17 19:53:41 +00:00
Nate Begeman
42736d46b2 Remove BRTWOWAY*
Make the PPC backend not dependent on BRTWOWAY_CC and make the branch
selector smarter about the code it generates, fixing a case in the
readme.

llvm-svn: 26814
2006-03-17 01:40:33 +00:00
Chris Lattner
9f589d65a1 Add a copysign node
llvm-svn: 26540
2006-03-05 05:06:40 +00:00
Evan Cheng
4afe769361 Add more vector NodeTypes: VSDIV, VUDIV, VAND, VOR, and VXOR.
llvm-svn: 26504
2006-03-03 07:01:07 +00:00
Evan Cheng
4ddc3b2c54 SDOperand::isOperand should not be a forwarding. It must check *this against N's operands.
llvm-svn: 26502
2006-03-03 06:42:32 +00:00
Evan Cheng
183b913508 Added isOperand(N): true if this is an operand of N
llvm-svn: 26501
2006-03-03 06:24:54 +00:00
Chris Lattner
999aa36a04 remove the read/write port/io intrinsics.
llvm-svn: 26479
2006-03-03 00:19:58 +00:00
Evan Cheng
2cbf9d93d3 - Added VConstant as an abstract version of ConstantVec.
- All abstrct vector nodes must have # of elements and element type as their
first two operands.

llvm-svn: 26432
2006-03-01 00:51:13 +00:00
Evan Cheng
026fd6af96 Added an offset field to ConstantPoolSDNode.
llvm-svn: 26371
2006-02-25 09:54:52 +00:00
Chris Lattner
ed45ad33b7 Make the LLVM headers "-ansi -pedantic -Wno-long-long" clean.
Patch by Martin Partel!

llvm-svn: 26313
2006-02-22 16:23:43 +00:00
Nate Begeman
9c0ab71f4a kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC
and SUBE nodes that actually expose what's going on and allow for
significant simplifications in the targets.

llvm-svn: 26255
2006-02-17 05:43:56 +00:00
Chris Lattner
70865ea43f Add a comment: value is log2
llvm-svn: 26068
2006-02-09 02:10:15 +00:00
Evan Cheng
d46a7fc65a * Added SDNode::isOnlyUse().
* Fix hasNUsesOfValue(), it should be const.

llvm-svn: 25990
2006-02-05 06:29:23 +00:00
Evan Cheng
f115c17f23 Allow the specification of explicit alignments for constant pool entries.
llvm-svn: 25855
2006-01-31 22:23:14 +00:00
Chris Lattner
9cb1135f52 remove some methods
llvm-svn: 25779
2006-01-29 07:57:11 +00:00
Chris Lattner
57b2492ecc Make ConstantFP legalize into TargetConstantFP like other leaf nodes do. Allow
targets to register custom legalizers for ConstantFP in case there isn't a
fixed list of constants that can be generated.  On some architectures (ia64?)
all fp immediates are legal.

llvm-svn: 25769
2006-01-29 06:24:40 +00:00
Chris Lattner
c9fb6af71c The 'target-independent' ISD::CALL isn't. Nuke it, making way for Nate's
future work.

llvm-svn: 25720
2006-01-28 00:18:27 +00:00
Chris Lattner
6980ff5179 Add new INLINEASM node
llvm-svn: 25663
2006-01-26 22:23:45 +00:00
Nate Begeman
c29fac7fce First part of bug 680:
Remove TLI.LowerVA* and replace it with SDNodes that are lowered the same
way as everything else.

llvm-svn: 25606
2006-01-25 18:21:52 +00:00
Chris Lattner
1c40cfd488 add a method
llvm-svn: 25581
2006-01-24 05:47:05 +00:00
Andrew Lenharth
35efa9c2d9 another couple selects
llvm-svn: 25551
2006-01-23 21:51:14 +00:00
Andrew Lenharth
28a8d211f6 another selectto
llvm-svn: 25548
2006-01-23 20:59:12 +00:00
Chris Lattner
fac137d4bd add stacksave/stackrestore nodes
llvm-svn: 25270
2006-01-13 02:39:42 +00:00
Nate Begeman
cff96008ac Add bswap, rotl, and rotr nodes
Add dag combiner code to recognize rotl, rotr
Add ppc code to match rotl

Targets should add rotl/rotr patterns if they have them

llvm-svn: 25222
2006-01-11 21:21:00 +00:00
Jim Laskey
b5b63a11df Grammer correction.
llvm-svn: 25106
2006-01-05 01:53:28 +00:00
Jim Laskey
5eddaee9f3 Added initial support for DEBUG_LABEL allowing debug specific labels to be
inserted in the code.

llvm-svn: 25104
2006-01-05 01:25:28 +00:00
Jim Laskey
897ad8ddb7 Add unique id to debug location for debug label use (work in progress.)
llvm-svn: 25096
2006-01-04 15:04:11 +00:00
Chris Lattner
1d16f29ca7 improve comment: mention vectors
llvm-svn: 24971
2005-12-23 00:46:10 +00:00
Chris Lattner
77ebc833c1 add a new node
llvm-svn: 24969
2005-12-23 00:15:59 +00:00
Chris Lattner
0b240343df remove a dead node
llvm-svn: 24966
2005-12-22 21:16:35 +00:00
Jim Laskey
37957b1ad3 Added source file/line correspondence for dwarf (PowerPC only at this point.)
llvm-svn: 24748
2005-12-16 22:45:29 +00:00
Nate Begeman
6c1b8712c5 Teach the SelectionDAG ISel how to turn ConstantPacked values into
constant nodes with vector types.  Also teach the asm printer how to print
ConstantPacked constant pool entries.  This allows us to generate altivec
code such as the following, which adds a vector constantto a packed float.

LCPI1_0:  <4 x float> < float 0.0e+0, float 0.0e+0, float 0.0e+0, float 1.0e+0 >
        .space  4
        .space  4
        .space  4
        .long   1065353216      ; float 1
        .text
        .align  4
        .globl  _foo
_foo:
        lis r2, ha16(LCPI1_0)
        la r2, lo16(LCPI1_0)(r2)
        li r4, 0
        lvx v0, r4, r2
        lvx v1, r4, r3
        vaddfp v0, v1, v0
        stvx v0, r4, r3
        blr

For the llvm code:

void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, < float 0.0, float 0.0, float 0.0, float 1.0 >
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

llvm-svn: 24616
2005-12-06 06:18:55 +00:00
Evan Cheng
025dab1137 Added an index field to GlobalAddressSDNode so it can represent X+12, etc.
llvm-svn: 24523
2005-11-30 02:04:11 +00:00
Chris Lattner
f9ea6dbf66 Add support for a new STRING and LOCATION node for line number support, patch
contributed by Daniel Berlin, with a few cleanups here and there by me.

llvm-svn: 24512
2005-11-29 06:15:39 +00:00
Nate Begeman
a90bb6d9b1 Check in code to scalarize arbitrarily wide packed types for some simple
vector operations (load, add, sub, mul).

This allows us to codegen:
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

on ppc as:
_foo:
        lfs f0, 12(r3)
        lfs f1, 8(r3)
        lfs f2, 4(r3)
        lfs f3, 0(r3)
        fadds f0, f0, f0
        fadds f1, f1, f1
        fadds f2, f2, f2
        fadds f3, f3, f3
        stfs f0, 12(r3)
        stfs f1, 8(r3)
        stfs f2, 4(r3)
        stfs f3, 0(r3)
        blr

llvm-svn: 24484
2005-11-22 18:16:00 +00:00
Chris Lattner
f6ae8401db add a new node type
llvm-svn: 24436
2005-11-20 22:55:57 +00:00
Nate Begeman
7d513f65ae Teach LLVM how to scalarize packed types. Currently, this only works on
packed types with an element count of 1, although more generic support is
coming.  This allows LLVM to turn the following code:

void %foo(<1 x float> * %a) {
entry:
  %tmp1 = load <1 x float> * %a;
  %tmp2 = add <1 x float> %tmp1, %tmp1
  store <1 x float> %tmp2, <1 x float> *%a
  ret void
}

Into:

_foo:
        lfs f0, 0(r3)
        fadds f0, f0, f0
        stfs f0, 0(r3)
        blr

llvm-svn: 24416
2005-11-19 00:36:38 +00:00
Andrew Lenharth
9b036b1bdb added a chain output
llvm-svn: 24306
2005-11-11 22:48:54 +00:00
Andrew Lenharth
6600f4a1d0 Add support for a cycle counter intrinsic. As basically all processors have
this and have it in about the same form, I think this makes sense.
on X86, you do a RDTSC (64bit result, from any ring since the P5MMX)
on Alpha, you do a RDCC
on PPC, there is a sequence which may or may not work depending on how things
are setup by the OS.  Or something like that.  Maybe someone who knows PPC
can add support.  Something about the time base register.
on Sparc, you read %tick, which in some solaris versions (>=8) is readable by
userspace
on IA64 read ar.itc

So I think the ulong is justified since all of those are 64bit.
Support is slighly flaky on old chips (P5 and lower) and sometimes
depends on OS (PPC, Sparc).  But for modern OS/Hardware (aka this decade),
we should be ok.

I am still not sure what to do about lowering.  I can either see a lower to 0, to
gettimeofday (or the target os equivalent), or loudly complaining and refusing to
continue.

I am commiting an Alpha implementation.  I will add the X86 implementation if I
have to (I have use of it in the near future), but if someone who knows that
backend (and the funky multi-register results) better wants to add it, it would
take them a lot less time ;)

TODO: better lowering and legalizing, and support more platforms
llvm-svn: 24299
2005-11-11 16:45:18 +00:00
Chris Lattner
ce6f7839fe Switch the allnodes list from a vector of pointers to an ilist of nodes.
This eliminates the vector, allows constant time removal of a node from
a graph, and makes iteration over the all nodes list stable when adding
nodes to the graph.

llvm-svn: 24262
2005-11-09 23:46:43 +00:00
Chris Lattner
e1cf681dee Change the ValueList array for each node to be shared instead of individually
allocated.  Further, in the common case where a node has a single value, just
reference an element from a small array.  This is a small compile-time wi.

llvm-svn: 24250
2005-11-08 23:30:11 +00:00
Chris Lattner
12686ba20f Switch the operandlist/valuelist from being vectors to being just an array.
This saves 12 bytes from SDNode, but doesn't speed things up substantially
(our graphs apparently already fit within the cache on my g5).  In any case
this reduces memory usage.

llvm-svn: 24248
2005-11-08 22:06:23 +00:00
Andrew Lenharth
9fad56d2d2 add TargetExternalSymbol
llvm-svn: 23886
2005-10-23 03:40:17 +00:00
Chris Lattner
bc5ae03dea add a helper class
llvm-svn: 23633
2005-10-05 06:34:34 +00:00
Chris Lattner
9a2fb006e4 Add FP versions of the binary operators, keeping the int and fp worlds seperate.
llvm-svn: 23506
2005-09-28 22:29:58 +00:00
Chris Lattner
a0ac88861d Add a new ANY_EXTEND node, which operates like an extension but has undefined
top bits.

llvm-svn: 23200
2005-09-02 00:14:40 +00:00
Nate Begeman
f279937fd9 Add AssertSext, AssertZext nodes for targets that pass arguments in
registers, and the incoming values have already been zero or sign extended
from the appopriate type to the register width.

llvm-svn: 23146
2005-08-30 02:39:32 +00:00
Chris Lattner
1a17dba9d1 improve comment
llvm-svn: 23134
2005-08-29 22:48:32 +00:00
Reid Spencer
71966308fc Fix a typo.
llvm-svn: 23117
2005-08-27 19:06:05 +00:00
Chris Lattner
a31708e6b3 Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.

llvm-svn: 23081
2005-08-26 17:15:30 +00:00
Chris Lattner
70cb011425 Add support for TargetConstantPool node
llvm-svn: 23040
2005-08-25 05:02:41 +00:00
Chris Lattner
813f6ddaf8 add a new TargetFrameIndex node
llvm-svn: 23035
2005-08-25 00:43:01 +00:00
Chris Lattner
d76cf28d13 Add 5-operand version of SelectNodeTo
llvm-svn: 22950
2005-08-21 18:49:58 +00:00