Commit Graph

10937 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
e7fbdcdfc6 Don't attempt trivial coalescing for sub-register copies.
Patch by Krister Wombell!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 05:45:24 +00:00
Rafael Espindola
195a0ce484 Change some methods in MCDwarf.cpp to be able to handle an arbitrary
MCStreamer instead of just MCObjectStreamer. Address changes cannot
be as efficient as we have to use DW_LNE_set_addres, but at least
most of the logic is shared.

This will be used so that, with CodeGen still using EmitDwarfLocDirective,
llvm-gcc is able to produce debug_line sections without needing an
assembler that supports .loc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119777 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 02:26:16 +00:00
Anton Korobeynikov
d9e3385ced Move getInitialFrameState() to TargetFrameInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 23:25:52 +00:00
Anton Korobeynikov
d0c3817669 Move hasFP() and few related hooks to TargetFrameInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 21:19:35 +00:00
Duncan Sands
b9064bb964 Fix thinko: we must turn select(anyext, sext) into sext(select)
not anyext(select).  Spotted by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 21:16:28 +00:00
Duncan Sands
dcfd3a798f The DAGCombiner was threading select over pairs of extending loads even
if the extension types were not the same.  The result was that if you
fed a select with sext and zext loads, as in the testcase, then it
would get turned into a zext (or sext) of the select, which is wrong
in the cases when it should have been an sext (resp. zext).  Reported
and diagnosed by Sebastien Deldon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119728 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 20:05:18 +00:00
Dan Gohman
bd77d399c4 Oops, missed this file when remaing ExpandPseudos to ExpandISelPseudos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 18:48:28 +00:00
Dan Gohman
8ec9d62380 Rename ExpandPseudos to ExpandISelPseudos to help clarify its role.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 18:45:06 +00:00
Dan Gohman
4229c62dcf Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119712 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:44:17 +00:00
Dan Gohman
409d64a764 ExpandPseudos doesn't have any dependencies, so it can use the
simple form of INITIALIZE_PASS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:14:05 +00:00
Rafael Espindola
5c0556341e Change CodeGen to use .loc directives. This produces a lot more readable output
and testing is easier.  A good example is the unknown-location.ll test that
now can just look for ".loc 1 0 0".  We also don't use a DW_LNE_set_address for
every address change anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 02:04:25 +00:00
Dale Johannesen
b4ac2858da Do not throw away alignment when generating the DAG for
memset; we may need it to decide between MOVAPS and MOVUPS
later.  Adjust a test that was looking for wrong code.
PR 3866 / 8675131.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 01:35:23 +00:00
John Thompson
7730318000 Bug 8621 fix - pointer cast stripped from inline asm constraint argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 23:58:47 +00:00
Evan Cheng
c4af4638df Remove ARM isel hacks that fold large immediates into a pair of add, sub, and,
and xor. The 32-bit move immediates can be hoisted out of loops by machine
LICM but the isel hacks were preventing them.

Instead, let peephole optimization pass recognize registers that are defined by
immediates and the ARM target hook will fold the immediates in.

Other changes include 1) do not fold and / xor into cmp to isel TST / TEQ
instructions if there are multiple uses. This happens when the 'and' is live
out, machine sink would have sinked the computation and that ends up pessimizing
code. The peephole pass would recognize situations where the 'and' can be
toggled to define CPSR and eliminate the comparison anyway.

2) Move peephole pass to after machine LICM, sink, and CSE to avoid blocking
important optimizations.

rdar://8663787, rdar://8241368


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:13:28 +00:00
Chris Lattner
ce1b9ad539 With the newly simplified SourceMgr interfaces and the generalized
SrcMgrDiagHandler, we can improve clang diagnostics for inline asm:
instead of reporting them on a source line of the original line,
we can report it on the correct line wherever the string literal came
from. For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119488 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:20:42 +00:00
Chris Lattner
4afa12890f now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:13:01 +00:00
Chris Lattner
6e30c6a1d3 rearrange how the handler in SourceMgr is installed, eliminating the use of
the cookie argument to setDiagHandler


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:03:32 +00:00
Chris Lattner
a38941d458 refactor the interface to EmitInlineAsm a bit, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:53:40 +00:00
Eric Christopher
113a06cff4 Only avoid the check if we're the last operand before the variable
operands in a variadic instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:55:36 +00:00
Dan Gohman
76043670d5 Fix grammaro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:27:00 +00:00
Evan Cheng
61f1a97e61 Add ExpandPseudos.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:20:36 +00:00
Dan Gohman
668ac2fdae Split pseudo-instruction expansion into a separate pass, to make it
easier to debug, and to avoid complications when the CFG changes
in the middle of the instruction selection process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:02:37 +00:00
Jakob Stoklund Olesen
f4840c07f8 Fix emergency spilling in LiveIntervals::spillPhysRegAroundRegDefsUses.
Always spill the full representative register at any point where any subregister
is live.

This fixes PR8620 which caused the old logic to get confused and not spill
anything at all.

The fundamental problem here is that the coalescer is too aggressive about
physical register coalescing. It sometimes makes it impossible to allocate
registers without these emergency spills.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 19:55:14 +00:00
Jakob Stoklund Olesen
fd900a2c07 Print out the register class of the current interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 19:55:12 +00:00
Eric Christopher
800e57313e Make the verifier a little quieter on instructions that it's probably
(and likely) wrong about anyhow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 01:58:21 +00:00
Jakob Stoklund Olesen
b55e91e087 Remember to resize SpillSlotToUsesMap when allocating an emergency spill slot.
Use amazing new function call technology instead of writing identical code in
multiple places.

This fixes PR8604.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 00:41:01 +00:00
Jakob Stoklund Olesen
7c2e4a8715 Fix PR8612 in the standard spiller, take two.
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.

Except when it is an early clobber tied to a use operand. Then it starts at the
def slot like a standard def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 00:40:59 +00:00
Jakob Stoklund Olesen
bea0b6a049 Revert "Fix PR8612 in the standard spiller as well."
This reverts r119183 which borke the buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 21:51:51 +00:00
Evan Cheng
eb96a2f6c0 Code clean up. The peephole pass should be the one updating the instruction
iterator, not TII->OptimizeCompareInstr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 21:20:45 +00:00
Jakob Stoklund Olesen
a284aa1657 Fix PR8612 in the standard spiller as well.
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 20:55:53 +00:00
Jakob Stoklund Olesen
68257e61eb When spilling a register defined by an early clobber, make sure that the new
live ranges for the spill register are also defined at the use slot instead of
the normal def slot.

This fixes PR8612 for the inline spiller. A use was being allocated to the same
register as a spilled early clobber def.

This problem exists in all the spillers. A fix for the standard spiller is
forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 20:55:49 +00:00
Anton Korobeynikov
3346491223 First step of huge frame-related refactoring: move emit{Prologue,Epilogue} out of TargetRegisterInfo to TargetFrameInfo, which is definitely much better suitable place
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 00:06:54 +00:00
Chris Lattner
142b531e02 move the pic base symbol stuff up to MachineFunction
since it is trivial and will be shared between ppc and x86.
This substantially simplifies the X86 backend also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14 22:48:15 +00:00
Devang Patel
522ad74e4b Remove DW_AT_start_scope support. It is incomplete and superseeded by location entries support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118940 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 23:20:42 +00:00
Andrew Trick
f06202f8e8 typo (4th checkin for one fix)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 18:36:03 +00:00
Andrew Trick
de91f3c5eb Fixes PR8287: SD scheduling time. The fix is a failsafe that prevents
catastrophic compilation time in the event of unreasonable LLVM
IR. Code quality is a separate issue--someone upstream needs to do a
better job of reducing to llvm.memcpy. If the situation can be reproduced with
any supported frontend, then it will be a separate bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 17:50:46 +00:00
Chris Lattner
a29aae7aca tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 17:24:29 +00:00
Lang Hames
5e77f4b1d2 Fix some style issues in PBQP. Patch by David Blaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 05:47:21 +00:00
Dan Gohman
fca0b106f7 Add a FIXME comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 18:08:43 +00:00
Andrew Trick
8a83d54528 Check TRI->getReservedRegs because other allocators do it. Even though
it makes no sense for allocation_order iterators to visit reserved regs.
The inline spiller depends on AliasAnalysis.
Manage the Query state to avoid uninitialized or stale results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 17:46:29 +00:00
Dan Gohman
efb8a9d0c2 Remove the memmove->memcpy optimization from CodeGen. MemCpyOpt does this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 16:24:49 +00:00
Jakob Stoklund Olesen
a05f60b241 Delete SplittingSpiller. It was not being used by anyone, and it is being
superceded by SplitKit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:52:44 +00:00
Jakob Stoklund Olesen
1e8e72d72a Insert two blank SlotIndexes between basic blocks instead of just one.
This is the first small step towards using closed intervals for liveness instead
of the half-open intervals we're using now.

We want to be able to distinguish between a SlotIndex that represents a variable
being live-out of a basic block, and an index representing a variable live-in to
its successor.

That requires two separate indexes between blocks. One for live-outs and one for
live-ins.

With this change, getMBBEndIdx(MBB).getPrevSlot() becomes stable so it stays
greater than any instructions inserted at the end of MBB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:19:20 +00:00
Jakob Stoklund Olesen
b5f327b30f No need to add liveness that's already there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 23:56:00 +00:00
Jakob Stoklund Olesen
e93198af07 Hook up AliasAnalysis in InlineSpiller. This is used for rematerializing
constant loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 23:55:56 +00:00
Devang Patel
62367045a4 Take care of special characters while creating named MDNode name to hold function specific local variable's info.
This fixes radar 8653152. I am checking in testcase as a separate check-in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 22:19:21 +00:00
Jakob Stoklund Olesen
cfa7134a9c Basic rematerialization during splitting.
Whenever splitting wants to insert a copy, it checks if the value can be
rematerialized cheaply instead.

Missing features:
- Delete instructions when all uses have been rematerialized.
- Truncate live ranges to the remaining uses after rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 19:31:50 +00:00
Andrew Trick
f4baeaf848 RABasic is nearly functionally complete. There are a few remaining
benchmarks hitting an assertion.
Adds LiveIntervalUnion::collectInterferingVRegs.
Fixes "late spilling" by checking for any unspillable live vregs among
all physReg aliases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 19:18:47 +00:00
Jakob Stoklund Olesen
b80e973c95 Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 01:05:12 +00:00
Rafael Espindola
34be396a12 Fixed version of 118639 with an extra assert to catch similar problems
earlier. Implicit bool -> int conversions are evil!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 23:42:07 +00:00