Commit Graph

12217 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen f047ff4fe1 Delete BlockInfo::LiveThrough. It wasn't used any more.
llvm-svn: 136735
2011-08-02 22:37:20 +00:00
Jakob Stoklund Olesen d2a7d1ed97 Extend the SpillPlacement interface with two new features.
The PrefBoth constraint is used for blocks that ideally want a live-in
value both on the stack and in a register. This would be used by a block
that has a use before interference forces a spill.

Secondly, add the ChangesValue flag to BlockConstraint. This tells
SpillPlacement if a live-in value on the stack can be reused as a
live-out stack value for free. If the block redefines the virtual
register, a spill would be required for that.

This extra information will be used by SpillPlacement to more accurately
calculate spill costs when a value can exist both on the stack and in a
register.

The simplest example is a basic block that reads the virtual register,
but doesn't change its value. Spilling around such a block requires a
reload, but no spill in the block.

The spiller already knows this, but the spill placer doesn't. That can
sometimes lead to suboptimal regions.

llvm-svn: 136731
2011-08-02 21:53:03 +00:00
Eli Friedman 04c5025cd5 Don't create a ridiculous EXTRACT_ELEMENT. PR10563.
The testcase looks extremely fragile, so I'm adding an assertion which should catch any cases like this.

llvm-svn: 136711
2011-08-02 18:38:35 +00:00
Jay Foad 8dfee5f6bf Remove an unnecessary cast.
llvm-svn: 136609
2011-08-01 12:27:15 +00:00
Bill Wendling f891bf8b30 Add the 'resume' instruction for the new EH rewrite.
This adds the 'resume' instruction class, IR parsing, and bitcode reading and
writing. The 'resume' instruction resumes propagation of an existing (in-flight)
exception whose unwinding was interrupted with a 'landingpad' instruction (to be
added later).

llvm-svn: 136589
2011-07-31 06:30:59 +00:00
Jakob Stoklund Olesen 163e7a73f1 Time the emission of debug values.
llvm-svn: 136584
2011-07-31 03:53:42 +00:00
Jakob Stoklund Olesen eb5ea833ed Revert r136528 "Enable compact region splitting by default."
While this generally helped x86-64, there was some large regressions
for i386.

llvm-svn: 136571
2011-07-30 17:19:14 +00:00
Bill Wendling ad088e6724 Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.

llvm-svn: 136556
2011-07-30 05:42:50 +00:00
Jakob Stoklund Olesen 5670f850c6 Revert "Don't check liveness of unallocatable registers."
The ARM target depends on CPSR liveness being tracked after register
allocation.

llvm-svn: 136548
2011-07-30 00:57:25 +00:00
Jakob Stoklund Olesen 95cc5440e9 Don't check liveness of unallocatable registers.
This includes registers like EFLAGS and ST0-ST7. We don't check for
liveness issues in the verifier and scavenger because registers will
never be allocated from these classes.

While in SSA form, we do care about the liveness of unallocatable
unreserved registers. Liveness of EFLAGS and ST0 neds to be correct for
MachineDCE and MachineSinking.

llvm-svn: 136541
2011-07-29 23:36:21 +00:00
Jakob Stoklund Olesen 9dd184151b Check for multiple defs in the machine code verifier.
llvm-svn: 136535
2011-07-29 23:02:48 +00:00
Jakob Stoklund Olesen 9760f04ef9 Add an isSSA() flag to MachineRegisterInfo.
This flag is true from isel to register allocation when the machine
function is required to be in SSA form.  The TwoAddressInstructionPass
and PHIElimination passes clear the flag.

The SSA flag wil be used by the machine code verifier to check for SSA
form, and eventually an assertion can enforce it in +Asserts builds.
This will catch the common target error of creating machine code with
multiple defs of a virtual register.

llvm-svn: 136532
2011-07-29 22:51:22 +00:00
Jakub Staszak 0480a8fbbb Do not lose branch weights when lowering SwitchInst.
llvm-svn: 136529
2011-07-29 22:25:21 +00:00
Jakob Stoklund Olesen b5c2d3210c Enable compact region splitting by default.
This helps generate better code in functions with high register
pressure.

llvm-svn: 136528
2011-07-29 22:10:27 +00:00
Jakub Staszak 539db98987 Remove unneeded const_cast.
llvm-svn: 136506
2011-07-29 20:05:36 +00:00
Nick Lewycky 019d255d3e Fix a lot of typos, improve (but not necessarily fix) grammaros and reflow some
lines. No functionality change.

llvm-svn: 136458
2011-07-29 03:49:23 +00:00
Eli Friedman adec587d5c Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to be
working on x86 (at least for trivial testcases); other architectures will
need more work so that they actually emit the appropriate instructions for
orderings stricter than 'monotonic'. (As far as I can tell, the ARM, PPC,
Mips, and Alpha backends need such changes.)

llvm-svn: 136457
2011-07-29 03:05:32 +00:00
Bill Wendling 7eadbeaf62 Use the pointer type size.
With this, we can now compile a simple EH program.

llvm-svn: 136446
2011-07-29 01:15:29 +00:00
Bill Wendling 6a8cac735a And now something that compiles...
llvm-svn: 136445
2011-07-29 01:11:33 +00:00
Bill Wendling 4b0a365beb Make sure to sext or trunc the result from the register.
llvm-svn: 136444
2011-07-29 01:11:14 +00:00
Chandler Carruth 9d7feab3e0 Rewrite the CMake build to use explicit dependencies between libraries,
specified in the same file that the library itself is created. This is
more idiomatic for CMake builds, and also allows us to correctly specify
dependencies that are missed due to bugs in the GenLibDeps perl script,
or change from compiler to compiler. On Linux, this returns CMake to
a place where it can relably rebuild several targets of LLVM.

I have tried not to change the dependencies from the ones in the current
auto-generated file. The only places I've really diverged are in places
where I was seeing link failures, and added a dependency. The goal of
this patch is not to start changing the dependencies, merely to move
them into the correct location, and an explicit form that we can control
and change when necessary.

This also removes a serialization point in the build because we don't
have to scan all the libraries before we begin building various tools.
We no longer have a step of the build that regenerates a file inside the
source tree. A few other associated cleanups fall out of this.

This isn't really finished yet though. After talking to dgregor he urged
switching to a single CMake macro to construct libraries with both
sources and dependencies in the arguments. Migrating from the two macros
to that style will be a follow-up patch.

Also, llvm-config is still generated with GenLibDeps.pl, which means it
still has slightly buggy dependencies. The internal CMake
'llvm-config-like' macro uses the correct explicitly specified
dependencies however. A future patch will switch llvm-config generation
(when using CMake) to be based on these deps as well.

This may well break Windows. I'm getting a machine set up now to dig
into any failures there. If anyone can chime in with problems they see
or ideas of how to solve them for Windows, much appreciated.

llvm-svn: 136433
2011-07-29 00:14:25 +00:00
Bill Wendling 3cc87682e1 Visit the landingpad instruction.
This generates the correct SDNodes for the landingpad instruction. It makes an
assumption that the result of the landingpad instruction has at least two
values. And that the first value is a pointer to the exception object and the
second value is the "selector."

llvm-svn: 136430
2011-07-28 23:44:58 +00:00
Bill Wendling 7fa7fe6b58 Add the AddLandingPadInfo function.
AddLandingPadInfo takes a landingpad instruction and grabs all of the
information from it that it needs for EH table generation.

llvm-svn: 136429
2011-07-28 23:42:57 +00:00
Eli Friedman c9a551ebed LangRef and basic memory-representation/reading/writing for 'cmpxchg' and
'atomicrmw' instructions, which allow representing all the current atomic
rmw intrinsics.

The allowed operands for these instructions are heavily restricted at the
moment; we can probably loosen it a bit, but supporting general
first-class types (where it makes sense) might get a bit complicated,
given how SelectionDAG works.

As an initial cut, these operations do not support specifying an alignment,
but it would be possible to add if we think it's useful. Specifying an
alignment lower than the natural alignment would be essentially
impossible to support on anything other than x86, but specifying a greater
alignment would be possible.  I can't think of any useful optimizations which
would use that information, but maybe someone else has ideas.

Optimizer/codegen support coming soon.

llvm-svn: 136404
2011-07-28 21:48:00 +00:00
Jakob Stoklund Olesen b16081ce8c Handle REG_SEQUENCE with implicitly defined operands.
Code like that would only be produced by bugpoint, but we should still
handle it correctly.

When a register is defined by a REG_SEQUENCE of undefs, the register
itself is undef. Previously, we would create a register with uses but no
defs.

Fixes part of PR10520.

llvm-svn: 136401
2011-07-28 21:38:51 +00:00
Bill Wendling f8d95bc4c6 Use ArrayRef instead of requiring an std::vector.
llvm-svn: 136396
2011-07-28 21:25:33 +00:00
Bill Wendling 4f027233d2 The personality function should be a Function* and not just a Value*.
llvm-svn: 136392
2011-07-28 21:14:13 +00:00
Jakob Stoklund Olesen cad845f4c0 Reverse order of RS_Split live ranges under -compact-regions.
There are two conflicting strategies in play:

- Under high register pressure, we want to assign large live ranges
  first. Smaller live ranges are easier to place afterwards.

- Live range splitting is guided by interference, so splitting should be
  deferred until interference is as realistic as possible.

With the recent changes to the live range stages, and with compact
regions enabled, it is less traumatic to split a live range too early.
If some of the split products were too big, they can often be split
again.

By reversing the RS_Split order, we get this queue order:

1. Normal live ranges, large to small.
2. RS_Split live ranges, large to small.

The large-to-small order improves RAGreedy's puzzle solving skills under
high register pressure. It may cause a bit more iterated splitting, but
we handle that better now.

With this change, -compact-regions is mostly an improvement on SPEC.

llvm-svn: 136388
2011-07-28 20:48:23 +00:00
Bill Wendling 7b563cde19 Initial code to convert ResumeInsts into calls to _Unwind_Resume.
This should be the only code necessary for DWARF EH prepare.

llvm-svn: 136387
2011-07-28 20:48:05 +00:00
Nadav Rotem 9708aef2dc CR fix: The ANY_EXTEND can be removed because the input and putput type must be
identical.

llvm-svn: 136355
2011-07-28 14:38:46 +00:00
Eli Friedman 26a484852e Code generation for 'fence' instruction.
llvm-svn: 136283
2011-07-27 22:21:52 +00:00
Jakub Staszak da3df4302a Use BlockFrequency instead of uint32_t in BlockFrequencyInfo.
llvm-svn: 136278
2011-07-27 22:05:51 +00:00
Devang Patel 53dc616170 Remove outdated FIXME comment.
llvm-svn: 136275
2011-07-27 22:00:01 +00:00
Bill Wendling 6c923bb8d9 Merge the contents from exception-handling-rewrite to the mainline.
This adds the new instructions 'landingpad' and 'resume'.

llvm-svn: 136253
2011-07-27 20:18:04 +00:00
Jeffrey Yasskin 6381c0100b Explicitly cast narrowing conversions inside {}s that will become errors in
C++0x.

llvm-svn: 136211
2011-07-27 06:22:51 +00:00
Dan Gohman 456b1edd0d Revert r136156, which broke several buildbots.
llvm-svn: 136206
2011-07-27 01:10:27 +00:00
Devang Patel f098ce2757 It is quiet possible that inlined function body is split into multiple chunks of consequtive instructions. But, there is not any way to describe this in .debug_inline accelerator table used by gdb. However, describe non contiguous ranges of inlined function body appropriately using AT_range of DW_TAG_inlined_subroutine debug info entry.
llvm-svn: 136196
2011-07-27 00:34:13 +00:00
Jakob Stoklund Olesen dab4b9a4b2 Add support for multi-way live range splitting.
When splitting global live ranges, it is now possible to split for
multiple destination intervals at once. Previously, we only had the main
and stack intervals.

Each edge bundle is assigned to a split candidate, and splitAroundRegion
will insert copies between the candidate intervals and the stack
interval as needed.

The multi-way splitting is used to split around compact regions when
enabled with -compact-regions. The best candidate register still gets
all the bundles it wants, but everything outside the main interval is
first split around compact regions before we create single-block
intervals.

Compact region splitting still causes some regressions, so it is not
enabled by default.

llvm-svn: 136186
2011-07-26 23:41:46 +00:00
Jakob Stoklund Olesen b1459dbc25 Print out the MBB live-in registers.
llvm-svn: 136178
2011-07-26 23:12:08 +00:00
Jakob Stoklund Olesen c3bcb02154 Eliminate copies of undefined values during coalescing.
These copies would coalesce easily, but the resulting value would be
defined by a deleted instruction. Now we also remove the undefined value
number from the destination register.

This fixes PR10503.

llvm-svn: 136174
2011-07-26 23:00:24 +00:00
Dan Gohman 9eb62cd159 Delete unnecessarily cautious LastCALLSEQ code.
llvm-svn: 136156
2011-07-26 22:00:59 +00:00
Eli Friedman 06b8b571b2 Add obvious missing case to switch. PR10497.
llvm-svn: 136130
2011-07-26 20:38:49 +00:00
Devang Patel 613958c82c While extracting lexical scopes from machine instruction stream, work on one machine basic block at a time.
llvm-svn: 136106
2011-07-26 18:09:53 +00:00
Duncan Sands 3ac1836540 SrcDef is only written and never read. Remove it.
llvm-svn: 136080
2011-07-26 15:05:06 +00:00
Jakob Stoklund Olesen 5387bd340b Revert to RA_Assign when a virtreg separates into components.
When dead code elimination deletes a PHI value, the virtual register may
split into multiple connected components. In that case, revert each
component to the RS_Assign stage.

The new components are guaranteed to be smaller (the original value
numbers are distributed among the components), so this will always be
making progress. The components are now allowed to evict other live
ranges or be split again.

llvm-svn: 136034
2011-07-26 00:54:56 +00:00
Evan Cheng 3a79225b4c Rename createCodeEmitter to createMCCodeEmitter; createObjectStreamer to createMCObjectStreamer.
llvm-svn: 136031
2011-07-26 00:42:34 +00:00
Evan Cheng 1142444565 Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser.
llvm-svn: 136027
2011-07-26 00:24:13 +00:00
Evan Cheng 5928e69d20 Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.
llvm-svn: 136010
2011-07-25 23:24:55 +00:00
Eli Friedman fee02c6c13 Initial implementation of 'fence' instruction, the new C++0x-style replacement for llvm.memory.barrier.
This is just a LangRef entry and reading/writing/memory representation; optimizer+codegen support coming soon.

llvm-svn: 136009
2011-07-25 23:16:38 +00:00
Eli Friedman cbd3ba91b7 Make sure this DAGCombine actually returns an UNDEF of the correct type; PR10476.
llvm-svn: 135993
2011-07-25 22:25:42 +00:00