Commit Graph

105001 Commits

Author SHA1 Message Date
Ulrich Weigand
9a154bfe94 [PowerPC] Allow stack frames without parameter save area
The PPCFrameLowering::determineFrameLayout routine currently ensures
that every function that allocates a stack frame provides space for the
parameter save area (via PPCFrameLowering::getMinCallFrameSize).

This is actually not necessary.  There may be functions that never call
another routine but still allocate a frame; those do not require the
parameter save area.  In the future, with the ELFv2 ABI, even some
routines that do call other functions do not need to allocate the
parameter save area.

While it is not a bug to allocate the parameter area when it is not
needed, it is better to avoid it to save stack space.

Note that when any particular function call requires the parameter save
area, this space will already have been included by ABI code in the size
the CALLSEQ_START insn is annotated with, and therefore included in the
size returned by MFI->getMaxCallFrameSize().

This means that determineFrameLayout simply does not need to care about
the parameter save area.  (It still needs to ensure that every frame
provides the linkage area.)  This is implemented by this patch.

Note that this exposed a bug in the new fast-isel code where the parameter
area was *not* included in the CALLSEQ_START size; this is also fixed.

A couple of test cases needed to be adapted for the new (smaller) stack
frame size those tests now see.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211495 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 13:47:52 +00:00
Ulrich Weigand
899842d2af [PowerPC] Fix IsDarwin arg in PPCFrameLowering:: calls
As remarked in the commit message to r211493, in several places
throughout the 64-bit SVR4 ABI code there are calls to
PPCFrameLowering::getLinkageSize and getMinCallFrameSize
using an incorrect IsDarwin argument of "true".

(Some of those were made explicit by the above refactoring patch, others
have been there all along.)

This patch fixes those places to pass "false" for IsDarwin.

No change in generated code expected.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211494 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 13:21:43 +00:00
Ulrich Weigand
c125f3c15a [PowerPC] Refactor setMinReservedArea and CalculateParameterAndLinkageAreaSize
The PPCISelLowering.cpp routines PPCTargetLowering::setMinReservedArea and
CalculateParameterAndLinkageAreaSize are currently used as subroutines
from both 64-bit SVR4 and Darwin ABI code.

However, the two ABIs are already quite different w.r.t. AltiVec
conventions, and they will become more different when the ELFv2 ABI is
supported.  Also, in general it seems better to disentangle ABI support
routines for different ABIs to avoid accidentally affecting one ABI when
intending to change only the other.

(Actually, the current code strictly speaking already contains a bug:
these routines call PPCFrameLowering::getMinCallFrameSize and
PPCFrameLowering::getLinkageSize with the IsDarwin parameter set to
"true" even on 64-bit SVR4.  This bug currently has no adverse effect
since those routines always return the same for 64-bit SVR4 and 64-bit
Darwin, but it still seems wrong ...  I'll fix this in a follow-up
commit shortly.)

To remove this code sharing, I'm simply inlining both routines into all
call sites (there are just two each, one for 64-bit SVR4 and one for
Darwin), and simplifying due to constant parameters where possible.

A small piece of code that *does* make sense to share is refactored into
the new routine EnsureStackAlignment, now also called from 32-bit SVR4
ABI code.

No change in generated code is expected.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211493 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 13:08:27 +00:00
Ulrich Weigand
fdb6eb65c7 [PowerPC] Fix on-stack AltiVec arguments with 64-bit SVR4
Current 64-bit SVR4 code seems to have some remnants of Darwin code
in AltiVec argument handing.  This had the effect that AltiVec arguments
(or subsequent arguments) were not correctly placed in the parameter area
in some cases.

The correct behaviour with the 64-bit SVR4 ABI is:
- All AltiVec arguments take up space in the parameter area, just like
  any other arguments, whether vararg or not.
- They are always 16-byte aligned, skipping a parameter area doubleword
  (and the associated GPR, if any), if necessary.

This patch implements the correct behaviour and adds a test case.
(Verified against GCC behaviour via the ABI compat test suite.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211492 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 12:36:34 +00:00
Tim Northover
6f7e87c751 ARM: mark UBFX as not allowing PC.
Strictly, it's unpredictable. But we don't quite model that yet and an error is
better than ignoring the issue. This one somehow got left out before though.

rdar://problem/15997748

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211490 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 09:20:02 +00:00
David Majnemer
139f2f1565 MC: Cleanup parseMSInlineAsm
Utilize range based for-loops to simplify some code.
Use insert() instead of a loop for simplicity/efficiency.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211486 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 02:17:16 +00:00
Saleem Abdulrasool
7a3698ecc9 MC: adjust text section flags for WoA
Correct the section flags for code built for Windows on ARM with
`-ffunction-sections`.  Windows on ARM uses solely Thumb-2 instructions, and
indicates that the function is thumb by placing it in a text section that has
IMAGE_SCN_MEM_16BIT flag set.

When we encounter a .section directive, a new section is constructed.  This may
be a text segment.  In order to identify that we need the additional flag,
expose the target triple through the ObjectFileInfo as this information is lost
otherwise.

Since any modern ARM targeting environment on Windows would be Thumb-2 (Windows
ARM NT or Windows Embedded Compact), introducing a new flag to indicate the
section attribute seems to be a bit overkill.  Simply depend on the target
triple.  Since there is one location that this information is currently needed,
creating a target specific assembly parser and delegating the parsing of section
switches also feels a bit heavy handed.  If it turns out that this information
ends up changing additional behaviour, then it may be worth considering that
alternative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211481 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 22:25:01 +00:00
NAKAMURA Takumi
9124b45918 Revert r211399, "Generate native unwind info on Win64"
It broke Legacy JIT Tests on x86_64-{mingw32|msvc}, aka Windows x64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211480 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 22:00:56 +00:00
Jan Vesely
ddf2a7902a R600: Use LowerSDIVREM for i64 node replace
v2: move div/rem node replacement to R600ISelLowering
    make lowerSDIVREM protected

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211478 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 21:43:01 +00:00
Jan Vesely
cd88535ab9 R600: Implement custom SDIVREM.
Instead of separate SDIV/SREM. SDIV used UDIV which in turn used UDIVREM anyway.
SREM used SDIV(UDIV->UDIVREM)+MUL+SUB, using UDIVREM directly is more efficient.

v2: Don't use all caps names

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211477 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 21:43:00 +00:00
Jan Vesely
728ea0c91b R600: Add udivrem test
v2: move < %s to the end of the line
    space after ;
    add v4i32 test

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211476 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 21:42:58 +00:00
Filipe Cabecinhas
7798d5992a Fix PR20087 by using the source index when changing the vector load
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211472 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 17:21:37 +00:00
NAKAMURA Takumi
fe755c57f8 Introduce a Lit feature "debug_frame" and apply it to llvm/test/MC/ELF/cfi-version.ll.
.debug_frame is not emitted for targeting Windows x64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211466 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 12:35:39 +00:00
Benjamin Kramer
84dd75d8d2 Add a description to the test from r211433 explaining why it's written that way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211465 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 12:22:04 +00:00
Arnold Schwaighofer
78f173a22d LoopVectorizer: Fix a dominance issue
The induction variables start value needs to be defined before we branch
(overflow check) to the scalar preheader where we used it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211460 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 03:38:59 +00:00
Stepan Dyatkovskiy
c815039ca2 MergeFunctions Pass, removed DenseMap helpers.
Patch removes rest part of code related to old implementation.

This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).

This one was the final patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211457 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 01:53:30 +00:00
Stepan Dyatkovskiy
aa5b571d45 MergeFunctions Pass, updated header comments.
Added short description for new comparison algorithm, that introduces
total ordering among functions set.

This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211456 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 00:57:09 +00:00
Weiming Zhao
09f104fc32 Report error for non-zero data in .bss
User may initialize a var with non-zero value and specify .bss section.
E.g. : int a __attribute__((section(".bss"))) = 2;

This patch converts an assertion to error report for better user
experience.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211455 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-22 00:33:44 +00:00
Stepan Dyatkovskiy
427afb91d3 MergeFunctions Pass, FnSet has been replaced with FnTree.
Patch activates new implementation.
So from now, merging process should take time O(N*log(N)).
Where N size of module (we are free to measure it in
functions or in instructions). Internally FnTree represents
binary tree. So every lookup operation takes O(log(N)) time.

It is still not the last patch in series, we also have to
clean-up pass from old code, and update pass comments.

This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211445 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 20:54:36 +00:00
Stepan Dyatkovskiy
83ac8b35e9 MergeFunctions Pass, removed unused methods from old implementation.
Patch removed next old FunctionComparator methods:
    * enumerate
    * isEquivalentOperation
    * isEquivalentGEP
    * isEquivalentType 
    
This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211444 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 20:13:24 +00:00
Stepan Dyatkovskiy
768231880a MergeFunctions, doSanityCheck: fixed body comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211443 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 19:07:51 +00:00
Stepan Dyatkovskiy
e298b1ce98 MergeFunctions Pass, introduced sanity check, that checks order relation,
introduced among functions set.
    
This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 18:58:11 +00:00
Stepan Dyatkovskiy
23a7bfce97 MergeFunctions Pass, introduced total ordering among top-level comparison
methods.
    
Patch changes return type of FunctionComparator::compare() and
FunctionComparator::compare(const BasicBlock*, const BasicBlock*)
methods from bool (equal or not) to {-1, 0, 1} (less, equal, great).
    
This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211437 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 17:55:51 +00:00
Benjamin Kramer
6b7ff6be9c LoopUnrollRuntime: Check for overflow in the trip count calculation.
Fixes PR19823.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211436 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 13:46:25 +00:00
Benjamin Kramer
636a9bece4 Legalizer: Add support for splitting insert_subvectors.
We handle this by spilling the whole thing to the stack and doing the
insertion as a store.

PR19492. This happens in real code because the vectorizer creates v2i128 when AVX is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211435 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 12:56:42 +00:00
Benjamin Kramer
b7f1fb47e6 SCEVExpander: Fold constant PHIs harder. The logic below only understands proper IVs.
PR20093.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211433 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 11:47:18 +00:00
Richard Trieu
7921239c41 Add back functionality removed in r210497.
Instead of asserting, output a message stating that a null pointer was found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211430 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 02:43:02 +00:00
Andrea Di Biagio
5d0ff9c928 [X86] Add ISel patterns to select SSE3/AVX ADDSUB instructions.
This patch adds ISel patterns to select SSE3/AVX ADDSUB instructions
from a sequence of "vadd + vsub + blend".

Example:

///
typedef float float4 __attribute__((ext_vector_type(4)));

float4 foo(float4 A, float4 B) {
  float4 X = A - B;
  float4 Y = A + B;
  return (float4){X[0], Y[1], X[2], Y[3]};
}
///

Before this patch, (with flag -mcpu=corei7) llc produced the following
assembly sequence:
  movaps  %xmm0, %xmm2
  addps   %xmm1, %xmm2
  subps   %xmm1, %xmm0
  blendps $10, %xmm2, %xmm0


With this patch, we now get a single
  addsubps  %xmm1, %xmm0



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211427 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 01:31:15 +00:00
Zachary Turner
9222a2375f Fix the MinGW builder. Apparently std::call_once and
std::recursive_mutex are not available on MinGW and breaks the
builder.  Revert to using a function local static and sys::Mutex
just to get the tree green until we figure out a better solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211424 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 00:24:51 +00:00
Rafael Espindola
45fdc3d534 Always use a temp symbol for CIE.
Fixes pr19185.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211423 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 23:54:32 +00:00
Rafael Espindola
32b14f80c2 Use compact unwind for the iOS simulator.
Another step in fixing pr19185.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211416 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 22:40:55 +00:00
Rafael Espindola
a896f2bddb Use a helper function and clang-format.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 22:37:01 +00:00
Duncan P. N. Exon Smith
fb7b9a7522 Support: ScaledNumber: Fix inconsistent test names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211414 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 22:36:09 +00:00
Duncan P. N. Exon Smith
6f5fa4a363 Support: Write ScaledNumbers::getLg{,Floor,Ceiling}()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211413 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 22:33:40 +00:00
Rafael Espindola
b019bb82be Delete dead code.
The compact unwind info is only used by code that knows it is supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211412 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 22:30:31 +00:00
Duncan P. N. Exon Smith
67291098a6 Support: Write ScaledNumber::getQuotient() and getProduct()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211409 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:47:47 +00:00
Duncan P. N. Exon Smith
97eb788203 Support: Cleanup ScaledNumber::getAdjusted() doc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:44:36 +00:00
Duncan P. N. Exon Smith
2d3fb0a171 Support: Mark end of namespaces
This convinces clang-format to leave a newline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211406 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:43:20 +00:00
Kevin Enderby
efc447827d Fix some double printing of filenames for archives in llvm-nm when
the tool is given multiple files.  Also fix the same issue with Mach-O
universal files. And fix the newline spacing to separate the output
in these cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:29:27 +00:00
Rafael Espindola
85fdfe8efc Don't produce eh_frame relocations when targeting the IOS simulator.
First step for fixing pr19185.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211404 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:15:27 +00:00
Zachary Turner
91e18f7639 Revert "Replace Execution Engine's mutex with std::recursive_mutex."
This reverts commit 1f502bd9d7, due to
GCC / MinGW's lack of support for C++11 threading.

It's possible this will go back in after we come up with a
reasonable solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211401 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:07:14 +00:00
Reid Kleckner
5b8e73ef81 Generate native unwind info on Win64
This patch enables LLVM to emit Win64-native unwind info rather than
DWARF CFI.  It handles all corner cases (I hope), including stack
realignment.

Because the unwind info is not flexible enough to describe stack frames
with a gap of unknown size in the middle, such as the one caused by
stack realignment, I modified register spilling code to place all spills
into the fixed frame slots, so that they can be accessed relative to the
frame pointer.

Patch by Vadim Chugunov!

Reviewed By: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211399 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 20:35:47 +00:00
David Blaikie
20dead8d0c Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 19:54:13 +00:00
Stepan Dyatkovskiy
81ed09a1d1 Commited patch from Björn Steinbrink:
Summary:
Different range metadata can lead to different optimizations in later
passes, possibly breaking the semantics of the merged function. So range
metadata must be taken into consideration when comparing Load
instructions.

Thanks!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211391 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 19:11:56 +00:00
Adam Nemet
8d99e7650f [Make] Fix dependencies for td.expanded
Depend on all the .td files not just the main one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211390 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 19:00:41 +00:00
Ulrich Weigand
e29fc75ea5 [RuntimeDyld] Fix ppc64 stub relocations on little-endian
When RuntimeDyldELF creates stub functions, it needs to install
relocations that will resolve to the final address of the target
routine. Since those are 16-bit relocs, they need to be applied to the
least-significant halfword of the instruction.  On big-endian ppc64,
this means that addresses have to be adjusted by 2, which is what the
code currently does.

However, on a little-endian system, the address must *not* be adjusted;
the least-significant halfword is the first one.  This patch updates the
RuntimeDyldELF code to take the target byte order into account.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211384 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 18:17:56 +00:00
Kevin Enderby
602941c737 Fix a warning about the use of const being ignored with a cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211383 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 18:07:34 +00:00
Ulrich Weigand
2a069ac1f3 [RuntimeDyld] Support more PPC64 relocations
This adds support for several missing PPC64 relocations in the
straight-forward manner to RuntimeDyldELF.cpp.

Note that this actually fixes a failure of a large-model test case on
PowerPC, allowing the XFAIL to be removed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211382 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 17:51:47 +00:00
Tom Stellard
c0bf939e80 R600/SI: Add patterns for ctpop inside a branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211378 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 17:06:11 +00:00
Tom Stellard
61d64acd0c R600/SI: Add a pattern for f32 ftrunc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 17:06:09 +00:00