Commit Graph

15099 Commits

Author SHA1 Message Date
Bill Wendling
99cb622041 Use pointers to the MCAsmInfo and MCRegInfo.
Someone may want to do something crazy, like replace these objects if they
change or something.

No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184175 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 07:20:20 +00:00
Bill Wendling
4ca0ddaefa Simplify some of the code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184172 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 06:07:26 +00:00
Andrew Trick
71b9d94d6b MI-Sched: handle ReadAdvance latencies as used by Swift.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:18 +00:00
Andrew Trick
a626f5072e Give RegMax higher priority.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184133 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:13 +00:00
Andrew Trick
f8e6d31341 Remove compareRPDelta.
A complex, expensive heuristic with little value in the current design.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184132 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:11 +00:00
Andrew Trick
e0f6046241 MI Sched: fix a typo in RegPressure heuristics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184131 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:09 +00:00
Andrew Trick
07023fef3a MI-Sched: Remove another heuristic that is sensitive to queue order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184130 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:07 +00:00
Andrew Trick
e52d502f04 MI-Sched: Track multiple candidates with the same priority level.
This eliminates the MultiPressure scheduling "reason". It was
sensitive to queue order. We don't like being sensitive to queue
order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184129 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 21:45:05 +00:00
Bill Wendling
d10fa8b1ca Directly access objects which may change during compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 20:41:25 +00:00
Benjamin Kramer
4eed756153 Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.
The main advantages here are way better heuristics, taking into account not
just loop depth but also __builtin_expect and other static heuristics and will
eventually learn how to use profile info. Most of the work in this patch is
pushing the MachineBlockFrequencyInfo analysis into the right places.

This is good for a 5% speedup on zlib's deflate (x86_64), there were some very
unfortunate spilling decisions in its hottest loop in longest_match(). Other
benchmarks I tried were mostly neutral.

This changes register allocation in subtle ways, update the tests for it.
2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction
it looked for was gone already (but the FileCheck pattern picked up unrelated
stuff).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 19:00:36 +00:00
David Blaikie
0187e7a9ba DebugInfo: remove target-specific Frame Index handling for DBG_VALUE MachineInstrs
Frame index handling is now target-agnostic, so delete the target hooks
for creation & asm printing of target-specific addressing in DBG_VALUEs
and any related functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184067 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-16 20:34:27 +00:00
David Blaikie
6d9dbd5526 Debug Info: Simplify Frame Index handling in DBG_VALUE Machine Instructions
Rather than using the full power of target-specific addressing modes in
DBG_VALUEs with Frame Indicies, simply use Frame Index + Offset. This
reduces the complexity of debug info handling down to two
representations of values (reg+offset and frame index+offset) rather
than three or four.

Ideally we could ensure that frame indicies had been eliminated by the
time we reached an assembly or dwarf generation, but I haven't spent the
time to figure out where the FIs are leaking through into that & whether
there's a good place to convert them. Some FI+offset=>reg+offset
conversion is done (see PrologEpilogInserter, for example) which is
necessary for some SelectionDAG assumptions about registers, I believe,
but it might be possible to make this a more thorough conversion &
ensure there are no remaining FIs no matter how instruction selection
is performed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-16 20:34:15 +00:00
David Blaikie
f14b44c71b DebugInfo: print DBG_VALUE MachineInstrs with [] for deref and drop the offset when it's zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 15:52:58 +00:00
Andrew Trick
aaaae51647 Missing NDEBUGs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184039 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 05:46:47 +00:00
Andrew Trick
fa989e7d43 MI-Sched: heuristics using the new latency and machine model.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184038 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 05:39:19 +00:00
Andrew Trick
b86a0cdb67 Machine Model: Add MicroOpBufferSize and resource BufferSize.
Replace the ill-defined MinLatency and ILPWindow properties with
with straightforward buffer sizes:
MCSchedMode::MicroOpBufferSize
MCProcResourceDesc::BufferSize

These can be used to more precisely model instruction execution if desired.

Disabled some misched tests temporarily. They'll be reenabled in a few commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184032 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:49:57 +00:00
Andrew Trick
bacb24975d MI-Sched: Rename IssueCount to CurrMOps.
"Counts" refer to scaled resource counts within a region. CurrMOps is
simply the number of micro-ops to be issue in the current cycle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184031 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:49:49 +00:00
Andrew Trick
63a8d824b0 MI-Sched: Remove the temporary EnableCopyConstrain flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184030 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:49:46 +00:00
Andrew Trick
2c465a3551 MI-Sched: added tracking of dependent latency for better heuristics.
Heuristics compare the critical path in the scheduled code, called
ExpectedLatency, with the latency of instructions remaining to be
scheduled. There are two ways to look at remaining latency:

(1) Dependent latency includes the latency between unscheduled and
scheduled instructions.

(2) Independent latency is simply the height (bottom-up) or depth
(top-down) of instructions currently in the ready Q.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184029 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:49:44 +00:00
Andrew Trick
eda39a9d69 MI-Sched: DEBUG: print critical resource.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184028 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:49:42 +00:00
Stephen Lin
7e6d620336 SelectionDAG: slightly refactor DAGCombiner::visitSELECT_CC to avoid redudant checks...
This doesn't really effect performance due to all the relevant calls being transparent but is clearer. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184027 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 04:03:33 +00:00
David Blaikie
702ff96ff3 Debug Info: Don't print the display name and colon prefix for DEBUG_VALUE comments if the display name is empty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184026 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-15 00:33:47 +00:00
Matt Arsenault
b05e4778f0 Introduce getSelect usage and use more getSelectCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184012 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 22:04:37 +00:00
Stephen Lin
a553bede23 SelectionDAG: minor fix to order of operands in comments to match the code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184008 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 21:33:58 +00:00
Tim Northover
89dbe97442 Mark rematerialized super/sub registers as dead.
When we're rematerializing into a not-quite-right register we already add the
real definition as an imp-def, but we should also be marking the "official"
register as dead, since nothing else is going to use it as a result of this
remat.

Not doing this can affect pressure tracking.

rdar://problem/14158833

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184002 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 20:22:21 +00:00
Stephen Lin
38103d1012 SelectionDAG: Fix incorrect condition checks in some cases of folding FADD/FMUL combinations; also improve accuracy of comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183993 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 18:17:35 +00:00
Derek Schuff
8a0d41e1a6 Make PrologEpilogInserter save/restore all callee saved registers
in functions which call __builtin_unwind_init()

__builtin_unwind_init() is an undocumented gcc intrinsic which has this effect,
and is used in libgcc_eh.

Goes part of the way toward fixing PR8541.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 16:15:29 +00:00
Jakub Staszak
38084db681 Move #include from .h to .cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183960 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 00:00:13 +00:00
Dan Gohman
e5682816b7 Print ConstantPool entries initialized to Values with WriteAsOperand instead of
operator<< so that functions are printed as just their name instead of as their
entire definition, which is excessively verbose in this context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183871 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 22:19:19 +00:00
Eric Christopher
1d1862958c Formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183807 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 23:41:38 +00:00
Eric Christopher
f0aefa858c Remove a few fixmes, the only work we're doing is getting the string
to return and this is done all over.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183704 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-10 22:24:10 +00:00
Eric Christopher
0fbaa37873 Fix up comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183703 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-10 22:24:07 +00:00
Eric Christopher
175a7809c8 Remove unused function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183698 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-10 21:59:28 +00:00
Eric Christopher
d32d7a541a IndentCount is only used within NDEBUG code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183695 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-10 20:58:53 +00:00
David Majnemer
a2f8d37fb7 TargetLowering: Clean up method description comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-08 23:51:45 +00:00
Quentin Colombet
c0cc28301a Reapply r183552. This time, use a standard type for the option to avoid template
instantiation issue with non-standard type.

Add a backend option to warn on a given stack size limit.
Option: -mllvm -warn-stack-size=<limit>
Output (if limit is exceeded):
warning: Stack size limit exceeded (<actual size>) in <functionName>.

The longer term plan is to hook that to a clang warning.
PR:4072
<rdar://problem/13987214>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-08 00:07:54 +00:00
Quentin Colombet
95f24fbe4c Revert commits related to stack warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183579 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 22:14:50 +00:00
Quentin Colombet
9a6b9bffa5 Add a backend option to warn on a given stack size limit.
Option: -mllvm -warn-stack-size=<limit>
Output (if limit is exceeded):
warning: Stack size limit exceeded (<actual size>) in <functionName>.

The longer term plan is to hook that to a clang warning.
PR:4072
<rdar://problem/13987214>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183552 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 20:18:12 +00:00
Quentin Colombet
fcca6c690c Teach AsmPrinter how to print odd constants.
Fix an assertion when the compiler encounters big constants whose bit width is
not a multiple of 64-bits.
Although clang would never generate something like this, the backend should be
able to handle any legal IR.

<rdar://problem/13363576>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 18:36:03 +00:00
Rafael Espindola
62ed8d3e35 Support OpenBSD's native frame protection conventions.
OpenBSD's stack smashing protection differs slightly from other
platforms:

  1. The smash handler function is "__stack_smash_handler(const char
     *funcname)" instead of "__stack_chk_fail(void)".

  2. There's a hidden "long __guard_local" object that gets linked
     into each executable and DSO.

Patch by Matthew Dempsky.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183533 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 16:35:57 +00:00
Duncan Sands
f4a66d2005 Correct wrong register in this example, pointed out by Baoshan Pang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183495 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 08:30:55 +00:00
David Blaikie
babfebb4e8 Fix break in r183446 - helps to increment the iterator in a loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183454 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 22:28:26 +00:00
David Blaikie
b20fdff6fe Debug Info: simplify parameter ordering preservation
Seems we emit the parameter ordering number (spuriously named 'arg
number') in the debug info, so there's no need to search through the
variable list to figure out the parameter ordering. This implementation
does 'always' do the work, even in non-optimized debug info (the
previous implementation checked the existence of the 'variables' list on
the subprogram which is only present in optimized builds).

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183446 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 21:04:51 +00:00
Bill Wendling
6a2e7ac0b6 Cache the TargetLowering info object as a pointer.
Caching it as a pointer allows us to reset it if the TargetMachine object
changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183361 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 00:43:09 +00:00
Bill Wendling
384ceb8446 Don't cache the TargetLoweringInfo object inside of the FunctionLowering object.
The TargetLoweringInfo object is owned by the TargetMachine. In the future, the
TargetMachine object may change, which may also change the TargetLoweringInfo
object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183356 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 00:11:39 +00:00
Bill Wendling
08368387a4 Add space to assert message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183346 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05 23:13:26 +00:00
David Blaikie
032d62487c PR15662: Optimized debug info produces out of order function parameters
When a function is inlined we lazily construct the variables
representing the function's parameters. After that, we add any remaining
unused parameters.

If the function doesn't use all the parameters, or uses them out of
order, then the DWARF would produce them in that order, producing a
parameter order that doesn't match the source.

This fix causes us to always keep the arg variables at the start of the
variable list & in the original order from the source.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183297 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05 05:39:59 +00:00
Shuxin Yang
45c7544339 Fix a defect in code-layout pass, improving Benchmarks/Olden/em3d/em3d by about 30%
(4.58s vs 3.2s on an oldish Mac Tower). 

  The corresponding src is excerpted bellow. The lopp accounts for about 90% of execution time.
  --------------------
    cat -n test-suite/MultiSource/Benchmarks/Olden/em3d/make_graph.c
     90 
     91         for (k=0; k<j; k++)
     92           if (other_node == cur_node->to_nodes[k]) break;

  The defective layout is sketched bellow, where the two branches need to swap.
  ------------------------------------------------------------------------
      L:
         ...
      if (cond) goto out-of-loop
      goto L

  While this code sequence is defective, I don't understand why it incurs 1/3 of 
execution time. CPU-event-profiling indicates the poor laoyout dose not increase
in br-misprediction; it dosen't increase stall cycle at all, and it dosen't 
prevent the CPU detect the loop (i.e. Loop-Stream-Detector seems to be working fine
as well)... 

   The root cause of the problem is that the layout pass calls AnalyzeBranch() 
with basic-block which is not updated to reflect its current layout.

rdar://13966341


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183174 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04 01:00:57 +00:00
Benjamin Kramer
7c2b4be2a7 Move getRealLinkageName to a common place and remove all the duplicates of it.
Also simplify code a bit while there. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183076 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-01 17:51:14 +00:00
Eric Christopher
813419ed5a Const-ify some printing and dumping code for DIEValues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183057 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:50:40 +00:00