Commit Graph

853 Commits

Author SHA1 Message Date
Chris Lattner
7859313bae simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25791 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 20:01:35 +00:00
Andrew Lenharth
8e51773bb7 it is nice not to chop off bits for those blessed with lots of bits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25766 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 05:22:37 +00:00
Andrew Lenharth
2cba57cb09 make the casts actually cast to the variable type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25765 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 05:17:22 +00:00
Andrew Lenharth
5c6bdf71d4 start of the 64bit safety cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25764 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 05:07:04 +00:00
Chris Lattner
24e00a4ac1 Emit series of conditionals with &&, emitting stuff like this:
if (N1.getOpcode() == ISD::LOAD &&
        N1.hasOneUse() &&
        !CodeGenMap.count(N1.getValue(0)) &&
        !CodeGenMap.count(N1.getValue(1))) {

instead of this:

    if (N1.getOpcode() == ISD::LOAD) {
      if (N1.hasOneUse()) {
        if (!CodeGenMap.count(N1.getValue(0))) {
          if (!CodeGenMap.count(N1.getValue(1))) {


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25763 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 04:41:05 +00:00
Chris Lattner
8bc7472a0c Factor matching code that is common between patterns. This works around
GCC not jump-threading across this common code, and produces far nicer
output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25762 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 04:25:26 +00:00
Chris Lattner
2bd4dd7668 Split out code generation from analysis from emission
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25759 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 02:57:39 +00:00
Chris Lattner
355408bcb7 move some code around, no change in the generated code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25758 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 02:43:35 +00:00
Chris Lattner
67a202bc42 now that we have control over emission of the code, emit the code using nested
"if" statements (indenting it appropriately, of course) instead of using goto's.

This inverts the logic for all of the if statements, which makes things simpler
to understand in addition to making the generated code easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25757 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-28 20:43:52 +00:00
Chris Lattner
8a0604b523 Change PatternCodeEmitter to emit code into a buffer instead of emitting it
directly to the output file.  This makes things simple because the code doesn't
have to worry about indentation or the case when there is no goto.  It also
allows us to indent the code better without touching everything :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25756 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-28 20:31:24 +00:00
Reid Spencer
24200d63fd Make long warnings wrap and have less indent so other portions of the page
are not skewed out of view.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25753 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-28 19:44:48 +00:00
Chris Lattner
488580c1ed Fit to 80 columns, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25752 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-28 19:06:51 +00:00
Jeff Cohen
9b0ffca478 Teach tablegen to generate code that is VC++ warning-free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25709 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 22:22:28 +00:00
Evan Cheng
c15d18c501 (store (op (load ...)), ...)
If store's chain operand is load, then use load's chain operand instead. If
it isn't (likely a TokenFactor), then do not allow the folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25708 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 22:13:45 +00:00
Evan Cheng
19c9550744 Subtarget feature can now set any variable to any value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25678 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 08:09:42 +00:00
Chris Lattner
0cfcc1e807 Use printInlineAsm to, well, print inline asm's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25677 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 02:10:50 +00:00
Chris Lattner
aa77d77a43 PHI and INLINEASM are now builtin instructions provided by Target.td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25673 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 01:45:06 +00:00
Chris Lattner
f52e2618f3 If we want to emit things in enum order, use getInstructionsByEnumValue to
get the order, don't compute it ourselves.

Don't emit stuff like (14<<0), emit 14 instead.

Don't attempt to get target properties for builtin instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25672 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 01:44:09 +00:00
Chris Lattner
387e4bdf00 There is at least a 'noitinerary' itinerary now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25671 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 01:41:55 +00:00
Chris Lattner
188454ae2b Don't emit JIT code for these instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25669 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-27 01:39:38 +00:00
Chris Lattner
fabcb7abc5 Teach the dag selectors to select InlineAsm nodes.
Aren't we happy the pattern selectors are almost all gone?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25666 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-26 23:08:55 +00:00
Evan Cheng
1feeeecf4c Another folding problem: if a node r/w chain or flag, don't fold it if it
has already been selected. The number of use check is not strong enough since
a node can be replaced with newly created target node. e.g. If the original
node has two uses, when it is selected for one of the uses it is replaced with
another. Each node now has a single use but isel still should not fold it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25651 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-26 19:13:45 +00:00
Evan Cheng
8eab3608de Add a FIXME comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25635 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-26 02:13:31 +00:00
Evan Cheng
545977371a Incoming (and optional) flag bugs. They may be embedded inside a inner node of
a pattern. Also, nodes which take incoming flag should not be folded if it has
more than one use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25627 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-26 00:22:25 +00:00
Evan Cheng
9789aaad63 Fix an optional in flag bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25590 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-24 20:46:50 +00:00
Evan Cheng
18667c4545 Optional InFlag was not being included in node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25588 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-24 20:07:38 +00:00
Evan Cheng
76356d9594 Prevent folding of a node with multiple uses if the node already folds a load!
Here is an example where the load ended up being done twice:

%A = global uint 0

uint %test(uint %B, ubyte %C) {
	%tmp = load uint *%A;
	%X = shl uint %tmp, ubyte %C
	%Cv = sub ubyte 32, %C
	%Y = shr uint %B, ubyte %Cv
	%Z = or uint %Y, %X
	store uint %Z, uint* %A
	ret uint %Z
}

==>

	subl $4, %esp
	movl %ebx, (%esp)
	movl 8(%esp), %edx
	movl A, %eax
	movb 12(%esp), %bl
	movb %bl, %cl
	shldl %cl, %edx, %eax
	movb %bl, %cl
	shldl %cl, %edx, A
	movl (%esp), %ebx
	addl $4, %esp
	ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25471 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-20 01:11:03 +00:00
Chris Lattner
485a350bed Don't include generated lexer .cpp files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25466 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 22:01:51 +00:00
Evan Cheng
823b752d75 Bug fix. Flag operand number may be calculated incorrectly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25465 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 21:57:10 +00:00
Evan Cheng
7419de89fb Use pattern information to determine whether the use expects this
instruction to produce a result. e.g MUL8m, the instruction does not
produce a explicit result. However it produces an implicit result in
AL which would be copied to a temp. The root operator of the matching
pattern is a mul so the use would expect it to produce a result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25458 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 10:12:58 +00:00
Evan Cheng
b4ad33c4ae Prevent unnecessary CopyToReg when the same HW register appears in two spots
in the pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25437 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 01:55:45 +00:00
Chris Lattner
09fb7d4dad fix a broken comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25411 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 21:31:18 +00:00
John Criswell
d788124317 Regenerated the Lex and Yacc output files on Linux. It seems that our
Linux machines don't like the source code generated on MacOS X for some
reason.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25394 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 17:01:34 +00:00
Evan Cheng
57c517d30c Emit a type matching check for ComplexPatterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25392 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 07:36:41 +00:00
Evan Cheng
37e9005db3 Type inferencing bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25337 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-15 10:04:45 +00:00
Evan Cheng
f805c2ed7f Allow transformation from GlobalAddress to TargetGlobalAddress and
ExternalSymbol to TargetExternalSymbol.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25252 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-12 19:35:54 +00:00
Evan Cheng
bb48e33bcd GlobalAddress -> TargetGlobalAddress; ExternalSymbol -> TargetExternalSymbol
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25245 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-12 07:54:57 +00:00
Evan Cheng
b2c6d4957a Some minor fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25227 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-11 22:16:13 +00:00
Chris Lattner
8020a5233c Always select target registers to themselves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25218 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-11 19:52:27 +00:00
Chris Lattner
7893f13ad6 Emit an error instead of an assertion if trying to do bogus things in result patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25194 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-11 01:33:49 +00:00
Robert Bocchino
b52ee7f5ff Added support for the extractelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25181 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-10 19:05:34 +00:00
Evan Cheng
51fecc80f7 * Remove instruction fields hasInFlag / hasOutFlag and added SNDPInFlag and
SNDPOutFlag to DAG nodes. These properties do not belong to target specific
instructions.
* Added DAG node property SNDPOptInFlag. It's same as SNDPInFlag except it's
optional. Used by ret / call, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25154 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-09 18:27:06 +00:00
Evan Cheng
4a7c284b35 Pattern complexity calculation fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25133 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-06 22:19:44 +00:00
Evan Cheng
e1050d616b Tweak pattern complexity calc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25122 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-06 02:30:23 +00:00
Evan Cheng
1cf6db2d3b Bug fix wrt chain operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25115 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-06 00:41:12 +00:00
Jeff Cohen
60e9187a90 Replace fix with one less disruptive to the original code.
Also note that GCC 4.1 also correctly flags the syntax error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25076 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-04 03:23:30 +00:00
Jeff Cohen
f356d70ec3 Tblgen was generating syntactically illegal C++ code like:
SDOperand Tmp0,Tmp1,Tmp2,Tmp3,;

GCC has a bug (24907) in which is fails to catch this, but VC++ correctly
notes its illegality, so tblgen must be taught to only generate legal C++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25075 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-04 03:15:19 +00:00
Chris Lattner
11966a0179 Remove obsolete comment, make things look a bit nicer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25070 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-04 00:32:01 +00:00
Chris Lattner
602f692461 reduce stack usage of the recursive SelectCode function by out-lining each
case of the switch statement into its own method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25069 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-04 00:25:00 +00:00
Chris Lattner
4e3c8e516f Remove my previous ugly hack that tries to reduce the stack space usage
of SelectCode to make way for a better solution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25068 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-03 22:55:16 +00:00