Commit Graph

27970 Commits

Author SHA1 Message Date
Owen Anderson
0b2a153968 LoopIndexSplit needs to inform the loop pass manager of the instructions it is
deleting, not just the basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 01:04:19 +00:00
Dale Johannesen
ec65a7d89b Do not force asm's to be chained if they don't touch
memory and aren't volatile.  This was interfering with
good scheduling.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 00:56:56 +00:00
Evan Cheng
87d696a4d2 Fix PR3934 part 2. findOnlyInterestingUse() was not setting IsCopy and IsDstPhys which are returned by value and used by callee. This happened to work on the earlier test cases because of a logic error in the caller side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 00:32:25 +00:00
Daniel Dunbar
4cbb173d6c Make these errors more noticable in build logs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 22:26:09 +00:00
Bob Wilson
b1303d05a8 Change SelectionDAG type legalization to allow BUILD_VECTOR operands to be
promoted to legal types without changing the type of the vector.  This is
following a suggestion from Duncan
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/019923.html).
The transformation that used to be done during type legalization is now
postponed to DAG legalization.  This allows the BUILD_VECTORs to be optimized
and potentially handled specially by target-specific code.

It turns out that this is also consistent with an optimization done by the
DAG combiner: a BUILD_VECTOR and INSERT_VECTOR_ELT may be combined by
replacing one of the BUILD_VECTOR operands with the newly inserted element;
but INSERT_VECTOR_ELT allows its scalar operand to be larger than the
element type, with any extra high bits being implicitly truncated.  The
result is a BUILD_VECTOR where one of the operands has a type larger the
the vector element type.

Any code that operates on BUILD_VECTORs may now need to be aware of the
potential type discrepancy between the vector element type and the
BUILD_VECTOR operands.  This patch updates all of the places that I could
find to handle that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 22:05:19 +00:00
Dan Gohman
88c7af096b Rename COPY_TO_SUBCLASS to COPY_TO_REGCLASS, and generalize
it accordingly. Thanks to Jakob Stoklund Olesen for pointing
out how this might be useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 21:06:25 +00:00
Bob Wilson
26cbf9eb99 Refactor some code in SelectionDAGLegalize::ExpandBUILD_VECTOR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 20:20:30 +00:00
Evan Cheng
3005ed6048 PR3934: Fix a bogus two-address pass assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 20:04:24 +00:00
Devang Patel
48c7fa21a3 Right now, Debugging information to encode scopes (DW_TAG_lexical_block) relies on DBG_LABEL. Unfortunately this intefers with the quality of optimized code.
This patch updates dwarf writer to encode scoping information in DWARF only in FastISel mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 18:13:16 +00:00
Devang Patel
0f7fef3872 Reapply 68847.
Now debug_inlined section is covered by TAI->doesDwarfUsesInlineInfoSection(), which is false by default.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 17:02:03 +00:00
Dan Gohman
21e3dfbc86 Implement x86 h-register extract support.
- Add patterns for h-register extract, which avoids a shift and mask,
   and in some cases a temporary register.
 - Add address-mode matching for turning (X>>(8-n))&(255<<n), where
   n is a valid address-mode scale value, into an h-register extract
   and a scaled-offset address.
 - Replace X86's MOV32to32_ and related instructions with the new
   target-independent COPY_TO_SUBREG instruction.

On x86-64 there are complicated constraints on h registers, and
CodeGen doesn't currently provide a high-level way to express all of them,
so they are handled with a bunch of special code. This code currently only
supports extracts where the result is used by a zero-extend or a store,
though these are fairly common.

These transformations are not always beneficial; since there are only
4 h registers, they sometimes require extra move instructions, and
this sometimes increases register pressure because it can force out
values that would otherwise be in one of those registers. However,
this appears to be relatively uncommon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 16:09:41 +00:00
Dan Gohman
f8c7394781 Add a new TargetInstrInfo MachineInstr opcode, COPY_TO_SUBCLASS.
This will be used to replace things like X86's MOV32to32_.

Enhance ScheduleDAGSDNodesEmit to be more flexible and robust
in the presense of subregister superclasses and subclasses. It
can now cope with the definition of a virtual register being in
a subclass of a use.

Re-introduce the code for recording register superreg classes and
subreg classes. This is needed because when subreg extracts and
inserts get coalesced away, the virtual registers are left in
the correct subclass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:38:05 +00:00
Dan Gohman
8433df36fb Remove x86's special-case handling for ISD::TRUNCATE and
ISD::SIGN_EXTEND_INREG. Tablegen-generated code can handle
these cases, and the scheduling issues observed earlier
appear to be resolved now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:29:31 +00:00
Dan Gohman
3cf9b3e455 Fix copy+pastos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:28:29 +00:00
Dan Gohman
70f2f65aac Don't abort on an aliasing physical register that does not have
a live interval. This is needed for some upcoming subreg changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:22:29 +00:00
Dan Gohman
9a77a92859 When assigning a physical register to a MachineOperand, set
the subreg field to 0, since the subreg field is only used
for virtual register subregs. This doesn't change
current functionality; it just eliminates bogus noise from
debug output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:21:32 +00:00
Dan Gohman
ee30047386 List the l registers before h registers, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:18:42 +00:00
Dan Gohman
6ed0e20eb2 Add an assertion to verify that a copy was actually emitted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:16:56 +00:00
Dan Gohman
3cd0aa3260 Use X86::SUBREG_8BIT instead of hard-coding the equivalent constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:14:03 +00:00
Dan Gohman
04d19f0241 Add a comment about MOVSX64rr8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:13:28 +00:00
Dan Gohman
8cc632f705 Fix another hard-coded constant to use X86AddrNumOperands.
This unbreaks the JIT on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:04:25 +00:00
Rafael Espindola
7ff5bff45e X86-64 TLS support for local exec and initial exec.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 13:02:49 +00:00
Sanjiv Gupta
12f23a86e2 While passing arg of types larger than char only one byte at lower end was getting passed. We couldn't catch this as we did not have tests that were passing an int value larger than 256.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 09:38:38 +00:00
Nick Lewycky
55f64dbb39 Fix warning in .ll parser, detect and reject available_externally on function
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 07:02:02 +00:00
Chris Lattner
266c7bbbbc Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:44:34 +00:00
Chris Lattner
2c71b8f64f eliminate unneeded parens.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:38:23 +00:00
Nick Lewycky
93f70fc291 Link against libffi if available, fall back to "no external calls from
interpreter mode" when it's not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 04:26:06 +00:00
Chris Lattner
b7253150ab fix PR3965:SIGINT handler not restored after calling ParseAST(),
patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:33:13 +00:00
Rafael Espindola
b215776fa1 In X86DAGToDAGISel::MatchWrapper, if base or index are set, avoid matching
only if symbolic addresses are RIP relatives.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:00:38 +00:00
Rafael Espindola
49a168daae refactor some code into X86DAGToDAGISel::MatchWrapper
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 21:55:03 +00:00
Chris Lattner
5db4cdfc56 "There was a typo in my previous patch which leads to miscompilation of
strncat :(

strncat(foo, "bar", 99)
would be optimized to
memcpy(foo+strlen(foo), "bar", 100, 1)
instead of
memcpy(foo+strlen(foo), "bar", 4, 1)"

Patch by Benjamin Kramer!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68905 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 18:22:33 +00:00
Chris Lattner
8d57b778b5 fix a cross-block fastisel crash handling overflow intrinsics.
See comment for details.  This fixes rdar://6772169


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:51:14 +00:00
Chris Lattner
36e3946ac2 make UpdateValueMap handle the possiblity that we could be
copying into the right register, avoiding a copy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:46:30 +00:00
Chris Lattner
c5040ab606 optimize FastISel::UpdateValueMap to avoid duplicate map lookups,
and make it return the assigned register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:45:01 +00:00
Chris Lattner
a9a42259ed simplify code by using IntrinsicInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:36:01 +00:00
Chris Lattner
0461c0a8f5 Add new TargetInstrDesc::hasImplicitUseOfPhysReg and
hasImplicitDefOfPhysReg methods.  Use them to remove a 
look in X86 fast isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:26:51 +00:00
Chris Lattner
f5b6bc7f0e add some optimizations for strncpy/strncat and factor some
code.  Patch by Benjamin Kramer!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 05:06:39 +00:00
Dan Gohman
c6fa3ff0bd Revert r68847. It breaks the build on non-Darwin targets, with this message
from the assembler:

Error: unknown pseudo-op: `.debug_inlined'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 15:57:04 +00:00
Devang Patel
2057532679 Keep track of inlined functions and their locations. This information is collected when nested llvm.dbg.func.start intrinsics are seen. (Right now, inliner removes nested llvm.dbg.func.start intrinisics during inlining.)
Create debug_inlined dwarf section using these information. This info is used by gdb, at least on Darwin, to enable better experience debugging inlined functions. See DwarfWriter.cpp for more information on structure of debug_inlined section.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 00:16:47 +00:00
Devang Patel
03f0a2fba0 DebugLabelFolder ruthlessly deletes redundant labels. However, sometimes the redundant labels is referenced by debug info somewhere else. This patch provies a way so that dwarf writer can mark labels as used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:58:59 +00:00
Bob Wilson
ec15bbfd2f Clean up a bunch of whitespace issues and fix a comment typo.
No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:48:47 +00:00
Chris Lattner
296185c264 fix two problems with machine sinking:
1. Sinking would crash when the first instruction of a block was
   sunk due to iterator problems.
2. Instructions could be sunk to their current block, causing an
   infinite loop.

This fixes PR3968


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 16:38:36 +00:00
Dan Gohman
0355862f71 Now that register classes have names, include the name in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 15:59:38 +00:00
Sanjiv Gupta
a3613be963 Added code to handle spilling and reloading of FSRs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 15:10:14 +00:00
Rafael Espindola
dbcfb3080a Don't fold a load if the other operand is a TLS address.
With this we generate

movl    %gs:0, %eax
leal    i@NTPOFF(%eax), %eax

instead of

movl    $i@NTPOFF, %eax
addl    %gs:0, %eax



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68778 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 10:09:34 +00:00
Chris Lattner
3584a47588 Add a new Type::getPointerTo method, which is shorthand for
llvm::PointerType::get().  Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 06:42:02 +00:00
Chris Lattner
c2406f2341 a few fixes to "addrspace(256) is reference offset of GS segment register".
It turns out that there are still several problems with this, will file a bugzilla.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68749 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:16:23 +00:00
Bill Wendling
7d16e85bfc Pass in the std::string parameter instead of returning it by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:12:49 +00:00
Bill Wendling
a6f02fbb75 Constify getter methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:00:25 +00:00
Dan Gohman
fc1665793e Remove the obsolete SelectionDAG::getNodeValueTypes and simplify
code that uses it by using SelectionDAG::getVTList instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 23:54:40 +00:00