Commit Graph

280 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
99719f40ee [Hexagon] Simplify (+fix) instruction selection for indexed loads/stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273733 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 21:27:17 +00:00
Krzysztof Parzyszek
c7a10fc5ed [Hexagon] Add SDAG preprocessing step to expose shifted addressing modes
Transform: (store ch addr (add x (add (shl y c) e)))
       to: (store ch addr (add x (shl (add y d) c))),
where e = (shl d c) for some integer d.
The purpose of this is to enable generation of loads/stores with
shifted addressing mode, i.e. mem(x+y<<#c). For that, the shift
value c must be 0, 1 or 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 20:08:27 +00:00
Rafael Espindola
5e5a33df9e Start using shouldAssumeDSOLocal on Hexagon.
Include a token test showing that access to private is now the same as
to internal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 19:09:14 +00:00
Krzysztof Parzyszek
065537a5a0 [Hexagon] Handle expansion of cmpxchg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 16:07:10 +00:00
Krzysztof Parzyszek
fd1e14e505 [Hexagon] Enable the post-RA scheduler
The aggressive anti-dependency breaker can rename the restored callee-
saved registers. To prevent this, mark these registers are live on all
paths to the return/tail-call instructions, and add implicit use operands
for them to these instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:44:28 +00:00
Krzysztof Parzyszek
fa30381518 When looking for a spill slot in reg scavenger, find one that matches RC
When looking for an available spill slot, the register scavenger would stop
after finding the first one with no register assigned to it. That slot may
have size and alignment that do not meet the requirements of the register
that is to be spilled. Instead, find an available slot that is the closest
in size and alignment to one that is needed to spill a register from RC.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 18:16:00 +00:00
Krzysztof Parzyszek
8b8fb6b298 [Hexagon] Recognize "q" and "v" in inline-asm as register constraints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 14:34:51 +00:00
Krzysztof Parzyszek
ec3abaa727 [Hexagon] Simplify HexagonInstrInfo::isPredicable
Remove all the checks for constant extenders from isPredicable. The users
of it should be the ones checking cost/profitability.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269664 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 16:56:10 +00:00
Krzysztof Parzyszek
d1ae63365b [Hexagon] Remove dead nodes from SelectionDAG to avoid cycles
Recent changes to the instruction selection code exposed a problem where
a dead node was not removed on time. This node had both input and output
chains, which lead to an apparent cycle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 18:48:15 +00:00
Krzysztof Parzyszek
d54aa7c3b5 [Hexagon] Expand VSelect pseudo instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 19:16:02 +00:00
Krzysztof Parzyszek
9c350c822f [Hexagon] Properly handle instruction selection of vsplat intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 17:21:40 +00:00
Krzysztof Parzyszek
1c156dfdcb [Hexagon] Use offsets relative to FP+8 in .cfi_offset instructions
When generating .cfi_offset instructions, make sure that the offset is
calculated with respect to the register used to define the CFA (which is
currently always FP+8).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269191 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 14:53:07 +00:00
Krzysztof Parzyszek
3c0f002a59 [ScheduleDAG] Make sure to process all def operands before any use operands
An example from Hexagon where things went wrong:
  %R0<def> = L2_loadrigp <ga:@fp04>      ; load function address
  J2_callr %R0<kill>, ..., %R0<imp-def>  ; call *R0, return value in R0

ScheduleDAGInstrs::buildSchedGraph would visit all instructions going
backwards, and in each instruction it would visit all operands in their
order on the operand list. In the case of this call, it visited the use
of R0 first, then removed it from the set Uses after it visited the def.
This caused the DAG to be missing the data dependence edge on R0 between
the load and the call.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10 16:50:30 +00:00
Krzysztof Parzyszek
13fc4ae0bf [Hexagon] Treat all conditional branches as predicted (not-taken by default)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 18:22:07 +00:00
Krzysztof Parzyszek
744cc49078 [Hexagon] Optimize addressing modes for load/store
Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 15:49:13 +00:00
Krzysztof Parzyszek
9f608022e3 [RDF] Improve handling of inline-asm
- Keep implicit defs from inline-asm instructions.
- Treat register references from inline-asm as fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 20:33:33 +00:00
Krzysztof Parzyszek
6af1d8fce6 Reset the TopRPTracker's position in ScheduleDAGMILive::initQueues
ScheduleDAGMI::initQueues changes the RegionBegin to the first non-debug
instruction. Since it does not track register pressure, it does not affect
any RP trackers. ScheduleDAGMILive inherits initQueues from ScheduleDAGMI,
and it does reset the TopTPTracker in its schedule method. Any derived,
target-specific scheduler will need to do it as well, but the TopRPTracker
is only exposed as a "const" object to derived classes. Without the ability
to modify the tracker directly, this leaves a derived scheduler with a
potential of having the TopRPTracker out-of-sync with the CurrentTop.

The symptom of the problem:
  void llvm::ScheduleDAGMILive::scheduleMI(llvm::SUnit *, bool):
  Assertion `TopRPTracker.getPos() == CurrentTop && "out of sync"' failed.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267918 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 19:17:44 +00:00
Krzysztof Parzyszek
12db936b00 [RDF] Handle undefined registers in RDF copy propagation
When updating the graph, make sure that new uses without reaching defs
are handled correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 15:09:19 +00:00
Krzysztof Parzyszek
87d4b8c4a1 [Tail duplication] Handle source registers with subregisters
When a block is tail-duplicated, the PHI nodes from that block are
replaced with appropriate COPY instructions. When those PHI nodes
contained use operands with subregisters, the subregisters were
dropped from the COPY instructions, resulting in incorrect code.

Keep track of the subregister information and use this information
when remapping instructions from the duplicated block.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:36:34 +00:00
Krzysztof Parzyszek
f104001091 [Hexagon] Register save/restore functions do not follow regular conventions
Do not mark them as modifying any of the volatile registers by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 17:49:44 +00:00
Krzysztof Parzyszek
d57e2db4cf [Hexagon] Properly close live range in HexagonBlockRanges ---add testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 17:30:13 +00:00
Krzysztof Parzyszek
db55335b2e [Hexagon] Teach mux expansion how to deal with undef predicates
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267165 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 16:47:01 +00:00
Krzysztof Parzyszek
c552ed7f63 [Hexagon] Expand handling of the small-data/bss section
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 18:56:45 +00:00
Krzysztof Parzyszek
dc458b494e [RDF] Consider register as live if any alias is live
This only affects the recomputation of kill flags.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266875 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-20 14:33:23 +00:00
Krzysztof Parzyszek
414bb96c93 [Hexagon] Fix operand swapping in HexagonPeephole
Also, disable zero- and size-extend optimizations for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266821 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 21:36:24 +00:00
Krzysztof Parzyszek
2d715342de [Hexagon] Fix printing the address operand of S2_storerinewabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266811 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 20:20:33 +00:00
Adrian Prantl
4eeaa0da04 [PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Currently each Function points to a DISubprogram and DISubprogram has a
scope field. For member functions the scope is a DICompositeType. DIScopes
point to the DICompileUnit to facilitate type uniquing.

Distinct DISubprograms (with isDefinition: true) are not part of the type
hierarchy and cannot be uniqued. This change removes the subprograms
list from DICompileUnit and instead adds a pointer to the owning compile
unit to distinct DISubprograms. This would make it easy for ThinLTO to
strip unneeded DISubprograms and their transitively referenced debug info.

Motivation
----------

Materializing DISubprograms is currently the most expensive operation when
doing a ThinLTO build of clang.

We want the DISubprogram to be stored in a separate Bitcode block (or the
same block as the function body) so we can avoid having to expensively
deserialize all DISubprograms together with the global metadata. If a
function has been inlined into another subprogram we need to store a
reference the block containing the inlined subprogram.

Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
that updates LLVM IR testcases to the new format.

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 15:57:41 +00:00
Colin LeMahieu
df06a070e7 Revert r265817
lld tests need to be addressed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 18:15:37 +00:00
Colin LeMahieu
c49723bd27 [llvm-objdump] Printing hex instead of dec by default
Differential Revision: http://reviews.llvm.org/D18770

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265817 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 17:55:03 +00:00
Adrian Prantl
7876f64bc3 testcase gardening: update the emissionKind enum to the new syntax. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 00:16:49 +00:00
Krzysztof Parzyszek
3fb5c4321a [Hexagon] Improve handling of unaligned vector loads and stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 15:43:03 +00:00
Krzysztof Parzyszek
621888ea62 [Hexagon] Only use restore functions for single register at -Oz
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 14:52:21 +00:00
Krzysztof Parzyszek
d4af74e531 [Hexagon] Add support for run-time stack overflow checking
Patch by Sundeep Kushwaha.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 20:20:07 +00:00
Krzysztof Parzyszek
deffc78c77 [Hexagon] Generate PIC-specific versions of save/restore routines
In PIC mode, the registers R14, R15 and R28 are reserved for use by
the PLT handling code. This causes all functions to clobber these
registers. While this is not new for regular function calls, it does
also apply to save/restore functions, which do not follow the standard
ABI conventions with respect to the volatile/non-volatile registers.

Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264324 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 19:18:48 +00:00
Paul Robinson
45648a4496 Fix tests that used CHECK-NEXT-NOT and CHECK-DAG-NOT.
FileCheck actually doesn't support combo suffixes.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 19:40:34 +00:00
Krzysztof Parzyszek
bfe4c5ff7e [Hexagon] Implement TLS support
Patch by Anand Kodnani.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261218 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 15:42:57 +00:00
Krzysztof Parzyszek
bd6b8064ca [Hexagon] Add support for __builtin_prefetch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 13:58:38 +00:00
Krzysztof Parzyszek
aec17f6b38 [Hexagon] Missed testcase update in r260895
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260897 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 16:15:02 +00:00
Krzysztof Parzyszek
5e17ebd723 [Hexagon] Use zero-extending loads for anyext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260895 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 16:01:01 +00:00
Krzysztof Parzyszek
b762ae1118 [Hexagon] Optimize stack slot spills
Replace spills to memory with spills to registers, if possible. This
applies mostly to predicate registers (both scalar and vector), since
they are very limited in number. A spill of a predicate register may
happen even if there is a general-purpose register available. In cases
like this the stack spill/reload may be eliminated completely.

This optimization will consider all stack objects, regardless of where
they came from and try to match the live range of the stack slot with
a dead range of a register from an appropriate register class.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260758 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 22:53:35 +00:00
Krzysztof Parzyszek
c006b1e101 [Hexagon] Replace expansion of spill pseudo-instructions in frame lowering
Rewrite the code to handle all pseudo-instructions in a single pass.

This temporarily reverts spill slot optimization that used general-
purpose registers to hold values of spilled predicate registers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260696 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 18:19:53 +00:00
Krzysztof Parzyszek
b92f69441a [Hexagon] Eliminate pseudo instructions for circ/brev loads and stores
We can generate the actual instructions from the intrinsics without the
need for pseudo-instructions. Also, since the intrinsics have a side-
effect in a form of a store, attempt to optimize away loads from the
store location.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260690 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 17:01:51 +00:00
Krzysztof Parzyszek
9f34dc17fe [Hexagon] Specify vector alignment in DataLayout string
The DataLayout can calculate alignment of vectors based on the alignment
of the element type and the number of elements. In fact, it is the product
of these two values. The problem is that for vectors of N x i1, this will
return the alignment of N bytes, since the alignment of i1 is 8 bits. The
vector types of vNi1 should be aligned to N bits instead. Provide explicit
alignment for HVX vectors to avoid such complications.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 14:47:38 +00:00
Benjamin Kramer
67256b88e5 The canonical way to XFAIL a test for all targets is XFAIL: *, not XFAIL:
Fix the lit bug that enabled this "feature" (empty triple is substring
of all possible target triples) and change the two outliers to use the
documented * syntax.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259799 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 16:21:38 +00:00
Krzysztof Parzyszek
d6e0f7e30a [Hexagon] Use general purpose registers to spill pred/mod registers into
Patch by Tobias Edler Von Koch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258527 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:15:58 +00:00
Krzysztof Parzyszek
15802c148c Proper handling of diamond-like cases in if-conversion
If converter was somewhat careless about "diamond" cases, where there
was no join block, or in other words, where the true/false blocks did
not have analyzable branches. In such cases, it was possible for it to
remove (needed) branches, resulting in a loss of entire basic blocks.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 13:14:52 +00:00
Krzysztof Parzyszek
f76a0437da [Hexagon] Generate CONST64 when optimizing for size in copy-to-combine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 14:08:31 +00:00
Krzysztof Parzyszek
002f6273d6 [Hexagon] Use S2_lsr_i_r instead of S2_extractu to obtain upper halfword
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257815 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 21:59:22 +00:00
Krzysztof Parzyszek
edec0136f0 [Hexagon] Expand pseudo instruction Insert4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 15:37:16 +00:00
Krzysztof Parzyszek
ba4dbafbf9 [Hexagon] Handle branches with non-mbb operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257768 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 15:05:27 +00:00