1369 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
6b032c682c Add missing files to r277143
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277144 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 13:59:55 +00:00
Krzysztof Parzyszek
4f328be3df [Hexagon] Implement DFA based hazard recognizer
The post register allocator scheduler can generate poor schedules
because the scoreboard hazard recognizer is unable to identify
hazards for Hexagon precisely. Instead, Hexagon should use a DFA
based hazard recognizer.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 13:59:09 +00:00
Simon Pilgrim
bf172ec934 Fixed MSVC out of range shift warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 10:03:39 +00:00
Krzysztof Parzyszek
1c394fcb96 Fix build breaks after r277028
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 20:25:21 +00:00
Krzysztof Parzyszek
5559171657 [Hexagon] Implement MI-level constant propagation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277028 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 20:01:59 +00:00
Krzysztof Parzyszek
18fcd7fd21 [Hexagon] Insert CFI instructions before throwing calls
Normally, CFI instructions should be inserted after allocframe, but
if allocframe is in the same packet with a call, the CFI instructions
should be inserted before that packet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 19:13:46 +00:00
Matthias Braun
f79c57a412 MachineFunction: Return reference for getFrameInfo(); NFC
getFrameInfo() never returns nullptr so we should use a reference
instead of a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277017 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 18:40:00 +00:00
Krzysztof Parzyszek
ca740c1356 [Hexagon] Find speculative loop preheader in hardware loop generation
Before adding a new preheader block, check if there is a candidate block
where the loop setup could be placed speculatively. This will be off by
default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 21:20:54 +00:00
Krzysztof Parzyszek
47fb8653da [Hexagon] Add option to bisect spill slot optimization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276917 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 20:58:43 +00:00
Krzysztof Parzyszek
6d5ee09dd7 [Hexagon] Do not optimize volatile stack spill slots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 20:50:42 +00:00
Krzysztof Parzyszek
81494d624d [Hexagon] Handle extended versions of restore routines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276903 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 18:47:25 +00:00
Krzysztof Parzyszek
f2ff85c3c2 [Hexagon] Add saved callee-saved registers as live-in in non-wrapped blocks
The callee-saved registers that are saved in a function are not pristine,
and so they can be defined and used. In case of shrink-wrapping though,
there are blocks that are outside of the save/restore range, and in those
blocks the saved registers must be treated as pristine. To avoid any uses
of these registers, add them as live-in in all those blocks.
This was already done for blocks reaching function exits after restore,
add code that does the same for blocks reached from the function entry
before save.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276886 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 16:26:39 +00:00
Krzysztof Parzyszek
43492b2a7a [Hexagon] Post-increment loads/stores enhancements
- Generate vector post-increment stores more aggressively.
- Predicate post-increment and vector stores in early if-conversion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276800 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 20:30:30 +00:00
Krzysztof Parzyszek
a628d047d1 [Hexagon] Gracefully handle reg class mismatch in HexagonLoopReschedule
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 19:17:13 +00:00
Krzysztof Parzyszek
aa3e2e6820 [Hexagon] Rerun bit tracker on new instructions in RIE
Consider this case:
  vreg1 = A2_zxth vreg0   (1)
  ...
  vreg2 = A2_zxth vreg1   (2)

Redundant instruction elimination could delete the instruction (1)
because the user (2) only cares about the low 16 bits. Then it could
delete (2) because the input is already zero-extended. The problem
is that the properties allowing each individual instruction to be
deleted depend on the existence of the other instruction, so either
one can be deleted, but not both.
The existing check for this situation in RIE was insufficient. The
fix is to update all dependent cells when an instruction is removed
(replaced via COPY) in RIE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 19:08:45 +00:00
Krzysztof Parzyszek
17a42256ee [Hexagon] Bitwise operations for insert/extract word not simplified
Change the bit simplifier to generate REG_SEQUENCE instructions in
addition to COPY, which will handle cases of word insert/extract.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 18:30:11 +00:00
Krzysztof Parzyszek
b450d54a80 [Hexagon] Add support for proper handling of H and L constraints
H -> High part of reg pair.
L -> Low part of reg pair.

Patch by Sundeep Kushwaha.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276773 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 17:31:02 +00:00
Krzysztof Parzyszek
c4320ab2d8 [Hexagon] Update store offset when not packetizing it with allocframe
When the packetizer wants to put a store to a stack slot in the same
packet with an allocframe, it updates the store offset to reflect the
value of SP before it is updated by allocframe. If the store cannot
be packetized with the allocframe after all, the offset needs to be
updated back to the previous value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 14:24:46 +00:00
Joel Jones
8a39975ebd MC] Provide an MCTargetOptions to implementors of MCAsmBackendCtorTy, NFC
Some targets, notably AArch64 for ILP32, have different relocation encodings
based upon the ABI. This is an enabling change, so a future patch can use the
ABIName from MCTargetOptions to chose which relocations to use. Tested using
check-llvm.

The corresponding change to clang is in: http://reviews.llvm.org/D16538

Patch by: Joel Jones

Differential Revision: https://reviews.llvm.org/D16213


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:18:28 +00:00
Krzysztof Parzyszek
94d45176f8 [Hexagon] Add target feature to generate long calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 14:42:11 +00:00
Krzysztof Parzyszek
6a2251e914 [Hexagon] Make HexagonCodeGen depend on Scalar
Hexagon backend uses LoopDataPrefetch pass that is defined in Scalar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 17:23:46 +00:00
Krzysztof Parzyszek
09986069b9 [RDF] Make the graph construction/use less expensive
- FuncNode::findBlock traverses the function every time. Avoid using it,
  and keep a cache of block addresses in DataFlowGraph instead.
- The operator[] in the map of definition stacks was very slow. Replace
  the map with unordered_map.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 16:09:47 +00:00
Krzysztof Parzyszek
262370bdcc [Hexagon] Use loop data prefetch on Hexagon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 14:22:43 +00:00
Krzysztof Parzyszek
44217e1169 [Hexagon] Handle returning small structures by value
This is not compliant with the official ABI, but allows experimentation
with calling conventions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275825 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:36:46 +00:00
Krzysztof Parzyszek
b3b8a5a691 [Hexagon] Revert r275822: mistake in commit message
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275824 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:34:49 +00:00
Krzysztof Parzyszek
4cb51c5c01 [Hexagon] Handle returning small structures by value
This is compliant with the official ABI, but allows experimentation with
calling conventions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:30:41 +00:00
Krzysztof Parzyszek
2cdac8994e [Hexagon] Misc changes to HexagonMachineScheduler, NFC
- Remove duplicated code.
- Convert loop to range-for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 16:15:15 +00:00
Krzysztof Parzyszek
a7c00b136c [Hexagon] Enable .cur formation in MISched for Hexagon V60
Schedule a load and its use in the same packet in MISched. Previously,
isResourceAvailable was returning false for dependences in the same
packet, which prevented MISched from packetizing a load and its use in
the same packet for v60.

Patch by Ikhlas Ajbar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275804 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 16:05:27 +00:00
Krzysztof Parzyszek
c47bedaa1b [Hexagon] Add verbose debugging mode to Hexagon MI Scheduler
Patch by Sergei Larin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275799 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 15:47:25 +00:00
Krzysztof Parzyszek
56af121d06 [Hexagon] Use timing class info as tie-breaker in machine scheduler
Patch by Sirish Pande.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 15:17:10 +00:00
Krzysztof Parzyszek
98b655feba [Hexagon] HexagonMachineScheduler should account for resources
The machine scheduler needs to account for available resources
more accurately in order to avoid scheduling an instruction that
forces a new packet to be created.

This occurs in two ways: First, an instruction without an available
resource may have a large priority due to other metrics and be
scheduled when there are other instructions with available resources.
Second, an instruction with a non-zero latency may become available
prematurely. In both these cases, we attempt change the priority
in order to allow a better instruction to be scheduled.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 14:52:13 +00:00
Krzysztof Parzyszek
9547556e81 [Hexagon] Fix zero latency instructions with multiple predecessors
An instruction may have multiple predecessors that are candidates
for using .cur. However, only one of them can use .cur in the
packet. When this case occurs, we need to make sure that only
one of the dependences gets a 0 latency value.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275790 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 14:23:10 +00:00
Krzysztof Parzyszek
1b5d21e1e4 [Hexagon] Handle instruction latency for 0 or 2 cycles
The Hexagon schedulers need to handle instructions with a latency
of 0 or 2 more accurately. The problem, in v60, is that a dependence
between two instructions with a 2 cycle latency can use a .cur version
of the source to achieve a 0 cycle latency when the use is in the
same packet. Any othe use, must be at least 2 packets later, or a
stall occurs. In other words, the compiler does not want to schedule
the dependent instructions 1 cycle later.

To achieve this, the latency adjustment code allows only a single
dependence to have a zero latency. All other instructions have the
other value, which is typically 2 cycles. We use a heuristic to
determine which instruction gets the 0 latency.

The Hexagon machine scheduler was also changed to increase the cost
associated with 0 latency dependences than can be scheduled in the
same packet.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 21:34:02 +00:00
Krzysztof Parzyszek
866d448f64 [Hexagon] Make MI scheduler check for stalls in previous packet on v60
Patch by Ikhlas Ajbar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 20:16:03 +00:00
Krzysztof Parzyszek
d5ecd00014 [Hexagon] Replace postprocessDAG with a more elaborate DAG mutation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 19:09:37 +00:00
Justin Lebar
b2d6ad7cfd [SelectionDAG] Get rid of bool parameters in SelectionDAG::getLoad, getStore, and friends.
Summary:
Instead, we take a single flags arg (a bitset).

Also add a default 0 alignment, and change the order of arguments so the
alignment comes before the flags.

This greatly simplifies many callsites, and fixes a bug in
AMDGPUISelLowering, wherein the order of the args to getLoad was
inverted.  It also greatly simplifies the process of adding another flag
to getLoad.

Reviewers: chandlerc, tstellarAMD

Subscribers: jholewinski, arsenm, jyknight, dsanders, nemanjai, llvm-commits

Differential Revision: http://reviews.llvm.org/D22249

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275592 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 18:27:10 +00:00
Justin Lebar
14fc45e102 [CodeGen] Take a MachineMemOperand::Flags in MachineFunction::getMachineMemOperand.
Summary:
Previously we took an unsigned.

Hooray for type-safety.

Reviewers: chandlerc

Subscribers: dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D22282

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 18:26:59 +00:00
Krzysztof Parzyszek
5e3461ebc2 [Hexagon] Add a scheduling DAG mutation
- Remove output dependencies on USR_OVF register.
- Update chain edge latencies between v60 vector loads/stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 17:48:09 +00:00
Krzysztof Parzyszek
bd8bfbd4cb [Hexagon] Update instruction itineraries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 16:58:34 +00:00
Krzysztof Parzyszek
76ebffffd3 [Hexagon] Fixes/changes to instruction selection
- Add patterns for rr/abs addressing modes.
- Set addrMode to PostInc where necessary.
- Misc fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275574 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 16:29:02 +00:00
Krzysztof Parzyszek
733cec8f05 [Hexagon] Improve patterns with stack-based addressing
- Treat bitwise OR with a frame index as an ADD wherever possible, fold it
  into addressing mode.
- Extend patterns for memops to allow memops with frame indexes as address
  operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275569 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 15:35:52 +00:00
Jacques Pienaar
48ed4ab2d6 Rename AnalyzeBranch* to analyzeBranch*.
Summary: NFC. Rename AnalyzeBranch/AnalyzeBranchPredicate to analyzeBranch/analyzeBranchPredicate to follow LLVM coding style and be consistent with TargetInstrInfo's analyzeCompare and analyzeSelect.

Reviewers: tstellarAMD, mcrosier

Subscribers: mcrosier, jholewinski, jfb, arsenm, dschuff, jyknight, dsanders, nemanjai

Differential Revision: https://reviews.llvm.org/D22409

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 14:41:04 +00:00
Krzysztof Parzyszek
1a360b3be9 [Hexagon] Packetize function call arguments with tail call instructions
On Hexagon is it legal to packetize the instructions setting up call
arguments with the call instruction itself. This was already done,
except for tail calls. Make sure tail calls are handled as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 19:30:55 +00:00
Duncan P. N. Exon Smith
8c13ec21d3 Hexagon: Avoid implicit iterator conversions, NFC
Avoid implicit iterator conversions from MachineInstrBundleIterator to
MachineInstr* in the Hexagon backend, mostly by preferring MachineInstr&
over MachineInstr* and switching to range-based for loops.

There's a long tail of API cleanup here, but I'm planning to leave the
rest to the Hexagon maintainers.  HexagonInstrInfo defines many of its
own predicates, and most of them still take MachineInstr*.  Some of
those actually check for nullptr, so I didn't feel comfortable changing
them to MachineInstr& en masse.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275142 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 01:55:32 +00:00
Nirav Dave
6b00c9f9a9 Fix branch relaxation in 16-bit mode.
Thread through MCSubtargetInfo to relaxInstruction function allowing relaxation
to generate jumps with 16-bit sized immediates in 16-bit mode.

This fixes PR22097.

Reviewers: dwmw2, tstellarAMD, craig.topper, jyknight

Subscribers: jfb, arsenm, jyknight, llvm-commits, dsanders

Differential Revision: http://reviews.llvm.org/D20830

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 14:23:53 +00:00
Duncan P. N. Exon Smith
04671b92e9 Target: Avoid getFirstTerminator() => pointer, NFC
Stop using an implicit conversion from the return of
MachineBasicBlock::getFirstTerminator to MachineInstr*.  In two cases,
directly dereference to a MachineInstr& since later code assumes it's
valid.  In a third case, change to an iterator since later code checks
against MachineBasicBlock::end.

Although the fix for the third case avoids undefined behaviour, I expect
this doesn't cause a functionality change in practice (since the basic
block already has a terminator).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 18:26:20 +00:00
Benjamin Kramer
b4e53350f9 [Hexagon] Create global std::map lazily.
This could of course be a simple binary search with no global state
involved at all if someone cares enough. Just don't make everyone
linking the hexagon backend pay for it on process startup and shutdown.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 13:05:12 +00:00
Krzysztof Parzyszek
364f2492a3 [Hexagon] Revert r274381: that was actually wrong
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 20:45:19 +00:00
Krzysztof Parzyszek
7993722a44 [Hexagon] Use MachineOperand::readsReg instead of isUse
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 20:28:30 +00:00
Duncan P. N. Exon Smith
a204da23db CodeGen: Use MachineInstr& in TargetLowering, NFC
This is a mechanical change to make TargetLowering API take MachineInstr&
(instead of MachineInstr*), since the argument is expected to be a valid
MachineInstr.  In one case, changed a parameter from MachineInstr* to
MachineBasicBlock::iterator, since it was used as an insertion point.

As a side effect, this removes a bunch of MachineInstr* to
MachineBasicBlock::iterator implicit conversions, a necessary step
toward fixing PR26753.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 22:52:52 +00:00