platform/upstream/llvm.git
9 years agoDebug Info: Move DIEDwarfExpression into DwarfExpression.h because it
Adrian Prantl [Wed, 14 Jan 2015 01:01:22 +0000 (01:01 +0000)]
Debug Info: Move DIEDwarfExpression into DwarfExpression.h because it
needs to be accessed from both DwarfCompileUnit.cpp and DwarfUnit.cpp.

NFC.

llvm-svn: 225898

9 years agoUtils: Extract helper function, NFC
Duncan P. N. Exon Smith [Wed, 14 Jan 2015 01:01:19 +0000 (01:01 +0000)]
Utils: Extract helper function, NFC

llvm-svn: 225897

9 years agoUtils: Use MDTuple::get() directly, NFC
Duncan P. N. Exon Smith [Wed, 14 Jan 2015 00:59:57 +0000 (00:59 +0000)]
Utils: Use MDTuple::get() directly, NFC

Working towards supporting `MDLocation` in `MapMetadata()`.

llvm-svn: 225896

9 years ago[SimplifyLibCalls] Don't try to simplify indirect calls.
Ahmed Bougacha [Wed, 14 Jan 2015 00:55:05 +0000 (00:55 +0000)]
[SimplifyLibCalls] Don't try to simplify indirect calls.

It turns out, all callsites of the simplifier are guarded by a check for
CallInst::getCalledFunction (i.e., to make sure the callee is direct).

This check wasn't done when trying to further optimize a simplified fortified
libcall, introduced by a refactoring in r225640.

Fix that, add a testcase, and document the requirement.

llvm-svn: 225895

9 years agoUpdate HelpText for -fsanitize= option.
Alexey Samsonov [Wed, 14 Jan 2015 00:51:17 +0000 (00:51 +0000)]
Update HelpText for -fsanitize= option.

There are too many available sanitizers now - redirect to
user manual instead of listing them all.

llvm-svn: 225894

9 years agoRemove unused predicate.
Eric Christopher [Wed, 14 Jan 2015 00:50:33 +0000 (00:50 +0000)]
Remove unused predicate.

llvm-svn: 225893

9 years agoUpdate for move in llvm.
Eric Christopher [Wed, 14 Jan 2015 00:50:32 +0000 (00:50 +0000)]
Update for move in llvm.

llvm-svn: 225892

9 years agoMigrate ABIName to MCTargetOptions so that it can be shared between
Eric Christopher [Wed, 14 Jan 2015 00:50:31 +0000 (00:50 +0000)]
Migrate ABIName to MCTargetOptions so that it can be shared between
the TargetMachine level and the MC level.

llvm-svn: 225891

9 years agoDon't set LD_PRELOAD to ''. It doesn't work on OpenBSD.
Rafael Espindola [Wed, 14 Jan 2015 00:39:56 +0000 (00:39 +0000)]
Don't set LD_PRELOAD to ''. It doesn't work on OpenBSD.

Patch by Brad Smith.

llvm-svn: 225890

9 years agoLook through sugar when determining whether a type is a scoped enumeration
Richard Smith [Wed, 14 Jan 2015 00:33:10 +0000 (00:33 +0000)]
Look through sugar when determining whether a type is a scoped enumeration
type. Patch by Stephan Bergmann!

llvm-svn: 225889

9 years agoSema: An extern declaration can't be a redeclaration of a parameter
David Majnemer [Wed, 14 Jan 2015 00:31:13 +0000 (00:31 +0000)]
Sema: An extern declaration can't be a redeclaration of a parameter

In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

This is a different approach to r225780.

llvm-svn: 225875

9 years agoRevert r225854: [PM] Move the LazyCallGraph printing functionality to
Chandler Carruth [Wed, 14 Jan 2015 00:27:45 +0000 (00:27 +0000)]
Revert r225854: [PM] Move the LazyCallGraph printing functionality to
a print method.

This was formulated on a bad idea, but sadly I didn't uncover how bad
this was until I got further down the path. I had hoped that we could
provide a low boilerplate way of printing analyses, but it just doesn't
seem like this really fits the needs of the analyses. Not all analyses
really want to do printing, and those that do don't all use the same
interface. Instead, with the new pass manager let's just take advantage
of the fact that creating an explicit printer pass like the LCG has is
pretty low boilerplate already and rely on that for testing.

llvm-svn: 225861

9 years agoRevert "Convert other drivers to use WrapperNode" and subsequent commits.
Rui Ueyama [Wed, 14 Jan 2015 00:21:34 +0000 (00:21 +0000)]
Revert "Convert other drivers to use WrapperNode" and subsequent commits.

r225764 broke a basic functionality on Mac OS. This change reverts
r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832.

llvm-svn: 225859

9 years agoDebug Info: Don't bother emitting DW_AT_frame_base if the function has
Adrian Prantl [Wed, 14 Jan 2015 00:15:16 +0000 (00:15 +0000)]
Debug Info: Don't bother emitting DW_AT_frame_base if the function has
no frame register. "Tested" via an assertion triggered by DwarfExpression.

llvm-svn: 225858

9 years agoRevert "Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a"
Adrian Prantl [Wed, 14 Jan 2015 00:15:12 +0000 (00:15 +0000)]
Revert "Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a"

This reverts commit r225852, it was a bad idea.

MachineReg should always be a physical register. If it isn't this DebugLoc
shouldn't have been created in the first place.

llvm-svn: 225857

9 years agoSink a parameter into the callee since it's always the same expression in terms of...
David Blaikie [Wed, 14 Jan 2015 00:04:42 +0000 (00:04 +0000)]
Sink a parameter into the callee since it's always the same expression in terms of another parameter

llvm-svn: 225856

9 years ago[PM] Move the LazyCallGraph printing functionality to a print method.
Chandler Carruth [Tue, 13 Jan 2015 23:53:50 +0000 (23:53 +0000)]
[PM] Move the LazyCallGraph printing functionality to a print method.

I'm adding generic analysis printing utility pass support which will
require such a method (or a specialization) so this will let the
existing printing logic satisfy that.

llvm-svn: 225854

9 years agoSave & restore the array of which registers have already been
Jason Molenda [Tue, 13 Jan 2015 23:48:53 +0000 (23:48 +0000)]
Save & restore the array of which registers have already been
saved/restored across a mid-function epilogue.  We ignore
repeated push/pops of a register so once we saw one 'pop %rbp',
we'd ignore it the second time we saw it.
<rdar://problem/19417410>

llvm-svn: 225853

9 years agoDebug Info: Bail out of AddMachineRegPiece() if MachineReg is not a
Adrian Prantl [Tue, 13 Jan 2015 23:39:15 +0000 (23:39 +0000)]
Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a
physical register. The call to getMinimalPhysRegClass() later on asserts
on this condition.

llvm-svn: 225852

9 years agoDebug Info: Move the complex expression handling (=the remainder) of
Adrian Prantl [Tue, 13 Jan 2015 23:39:11 +0000 (23:39 +0000)]
Debug Info: Move the complex expression handling (=the remainder) of
emitDebugLocValue() into DwarfExpression.

Ought to be NFC, but it actually uncovered a bug in the debug-loc-asan.ll
testcase. The testcase checks that the address of variable "y" is stored
at [RSP+16], which also lines up with the comment.
It also check(ed) that the *value* of "y" is stored in RDI before that,
but that is actually incorrect, since RDI is the very value that is
stored in [RSP+16]. Here's the assembler output:

movb 2147450880(%rcx), %r8b
#DEBUG_VALUE: bar:y <- RDI
cmpb $0, %r8b
movq %rax, 32(%rsp)          # 8-byte Spill
movq %rsi, 24(%rsp)          # 8-byte Spill
movq %rdi, 16(%rsp)          # 8-byte Spill
.Ltmp3:
#DEBUG_VALUE: bar:y <- [RSP+16]

Fixed the comment to spell out the correct register and the check to
expect an address rather than a value.

Note that the range that is emitted for the RDI location was and is still
wrong, it claims to begin at the function prologue, but really it should
start where RDI is first assigned.

llvm-svn: 225851

9 years ago[AVX512] Add 16x32 unpck tests as well
Adam Nemet [Tue, 13 Jan 2015 23:27:55 +0000 (23:27 +0000)]
[AVX512] Add 16x32 unpck tests as well

Forgot this from r225838.

llvm-svn: 225850

9 years agoExtend PipePosix with support for named pipes/timeout-based IO and integrate it with...
Oleksiy Vyalov [Tue, 13 Jan 2015 23:19:40 +0000 (23:19 +0000)]
Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver.

http://reviews.llvm.org/D6954

llvm-svn: 225849

9 years agocleanup.
Adrian Prantl [Tue, 13 Jan 2015 23:11:51 +0000 (23:11 +0000)]
cleanup.

llvm-svn: 225848

9 years agoDocument, cleanup, and clang-format DwarfExpression.h
Adrian Prantl [Tue, 13 Jan 2015 23:11:07 +0000 (23:11 +0000)]
Document, cleanup, and clang-format DwarfExpression.h

llvm-svn: 225847

9 years agoDebug Info: Turn DIExpression::getFrameRegister() into an isFrameRegister()
Adrian Prantl [Tue, 13 Jan 2015 23:10:43 +0000 (23:10 +0000)]
Debug Info: Turn DIExpression::getFrameRegister() into an isFrameRegister()
function.

NFC.

llvm-svn: 225846

9 years agoDebugInfo: Correct the location of EH cleanup for blocks
David Blaikie [Tue, 13 Jan 2015 23:06:27 +0000 (23:06 +0000)]
DebugInfo: Correct the location of EH cleanup for blocks

This was previously piggybacking on whatever happened to be the last
location set on CGDebugInfo/DIBuilder, which was wrong (it was often the
current location, such as the 'fn()' call site, not the end of the
block). With my improvements to set/unset the location in a scoped
manner (r225000) this went from a bad quality situation, to a crash.
Fixing this goes part-way to unblocking the recommit of r225000.

It's likely that any call to CodeGenFunction::StartFunction without the
CurEHLocation set represents a similar bug or risk of a bug. Perhaps
there are some callers that know they won't generate EH cleanups, but
I'm not sure.

I considered a generic catch-fix in StartFunction (just fallback to the
GlobalDecl's location) but that seemed like it'd mask bugs where the EH
location shouldn't be the same as the decl's location (& indeed by not
using that stop-gap I found this bug). We'll see how long I can hold out
on the generic catch-all. I might eventually be able to add an assertion
in.

llvm-svn: 225845

9 years agoR600/SI: Add pattern for bitcasting fp immediates to integers
Tom Stellard [Tue, 13 Jan 2015 22:59:41 +0000 (22:59 +0000)]
R600/SI: Add pattern for bitcasting fp immediates to integers

The backend now assumes that all immediates are integers.  This allows
us to simplify immediate handling code, becasue we no longer need to
handle fp and integer immediates differently.

llvm-svn: 225844

9 years ago[PM] Remove the defunt CGSCC-specific debug flag.
Chandler Carruth [Tue, 13 Jan 2015 22:45:13 +0000 (22:45 +0000)]
[PM] Remove the defunt CGSCC-specific debug flag.

Even before I sunk the debug flag into the opt tool this had been made
obsolete by factoring the pass and analysis managers into a single set
of templates that all used the core flag. No functionality changed here.

llvm-svn: 225842

9 years ago[PM] Push the debug option for the new pass manager into the opt tool
Chandler Carruth [Tue, 13 Jan 2015 22:42:38 +0000 (22:42 +0000)]
[PM] Push the debug option for the new pass manager into the opt tool
and expose the necessary hooks in the API directly.

This makes it much cleaner for example to log the usage of a pass
manager from a library. It also makes it more obvious that this
functionality isn't "optional" or "asserts-only" for the pass manager.

llvm-svn: 225841

9 years agoFix function names in tests from r225838.
Adam Nemet [Tue, 13 Jan 2015 22:40:15 +0000 (22:40 +0000)]
Fix function names in tests from r225838.

llvm-svn: 225840

9 years agoclang-format: [Java] Detect `native` keyword.
Nico Weber [Tue, 13 Jan 2015 22:32:50 +0000 (22:32 +0000)]
clang-format: [Java] Detect `native` keyword.

Before:
  public native<X> Foo foo();

After:
  public native <X> Foo foo();

llvm-svn: 225839

9 years ago[AVX512] Unpack support in new shuffle lowering
Adam Nemet [Tue, 13 Jan 2015 22:20:18 +0000 (22:20 +0000)]
[AVX512] Unpack support in new shuffle lowering

This now handles both 32 and 64-bit element sizes.

In this version, the test are in vector-shuffle-512-v8.ll, canonicalized by
Chandler's update_llc_test_checks.py.

Part of <rdar://problem/17688758>

llvm-svn: 225838

9 years ago[AVX512] Add pretty-printing of shuffle mask for unpacks
Adam Nemet [Tue, 13 Jan 2015 22:20:14 +0000 (22:20 +0000)]
[AVX512] Add pretty-printing of shuffle mask for unpacks

llvm-svn: 225837

9 years agoDAGCombiner: simplify by using condition variables; NFC
Matthias Braun [Tue, 13 Jan 2015 22:17:46 +0000 (22:17 +0000)]
DAGCombiner: simplify by using condition variables; NFC

llvm-svn: 225836

9 years agoAdd [extern_c] attribute to _Builtin_intrinsics module
Ben Langmuir [Tue, 13 Jan 2015 21:54:32 +0000 (21:54 +0000)]
Add [extern_c] attribute to _Builtin_intrinsics module

This allows users to import this module inside an extern "C" {} block.

llvm-svn: 225835

9 years agoMention FreeBSD support.
Roman Divacky [Tue, 13 Jan 2015 21:31:03 +0000 (21:31 +0000)]
Mention FreeBSD support.

llvm-svn: 225834

9 years ago[PM] Sink the convenience typedefs after the class template they are
Chandler Carruth [Tue, 13 Jan 2015 21:30:27 +0000 (21:30 +0000)]
[PM] Sink the convenience typedefs after the class template they are
referring to and give them nice comments.

Previously, these were used, but now things use the generic form of the
AnalysisManager.

llvm-svn: 225833

9 years agoRemove InputGraph::getNextFile().
Rui Ueyama [Tue, 13 Jan 2015 21:27:12 +0000 (21:27 +0000)]
Remove InputGraph::getNextFile().

getNextFile used to have a complex logic to determine which file
should be processed by the Resolver on next iteration.
Now, it is just a sequential accessor to the internal array and
provides no sensible feature.

This patch also removes InputGraph::getGroupSize and InputGraph::
skipGroup to simplify the code.

llvm-svn: 225832

9 years agoFixed an issue where if the operating system python plug-in is changed at runtime...
Greg Clayton [Tue, 13 Jan 2015 21:13:08 +0000 (21:13 +0000)]
Fixed an issue where if the operating system python plug-in is changed at runtime, it wouldn't cause the process to reload the new operating system plug-in, now it does.

This is currently controlled by a setting:

(lldb) settings set target.process.python-os-plugin-path <path>

Or clearing it with:

(lldb) settings clear target.process.python-os-plugin-path

The process will now reload the OperatingSystem plug-in.

This was implemented by:
- adding the ability to set a notify callback for when an option value is changed
- added the ability for the process plug-in to load the operating system plug-in on the fly
- fixed bugs in the Process::GetStatus() so all threads are displayed if their thread IDs are larger than 32 bits
- adding a callback in ProcessProperties to tell when the "python-os-plugin-path" is changed by the user
- fixing a crasher in ProcessMachCore that happens when updating the thread list when the OS plugin is reloaded

llvm-svn: 225831

9 years agoAsmParser/Bitcode: Add support for MDLocation
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 21:10:44 +0000 (21:10 +0000)]
AsmParser/Bitcode: Add support for MDLocation

This adds assembly and bitcode support for `MDLocation`.  The assembly
side is rather big, since this is the first `MDNode` subclass (that
isn't `MDTuple`).  Part of PR21433.

(If you're wondering where the mountains of testcase updates are, we
don't need them until I update `DILocation` and `DebugLoc` to actually
use this class.)

llvm-svn: 225830

9 years agoUse init list and move operator instead of swap().
Rui Ueyama [Tue, 13 Jan 2015 21:09:05 +0000 (21:09 +0000)]
Use init list and move operator instead of swap().

llvm-svn: 225829

9 years agoR600: Implement getRecipEstimate
Matt Arsenault [Tue, 13 Jan 2015 20:53:23 +0000 (20:53 +0000)]
R600: Implement getRecipEstimate

This requires a new hook to prevent expanding sqrt in terms
of rsqrt and reciprocal. v_rcp_f32, v_rsq_f32, and v_sqrt_f32 are
all the same rate, so this expansion would just double the number
of instructions and cycles.

llvm-svn: 225828

9 years agoR600: Implement getRsqrtEstimate
Matt Arsenault [Tue, 13 Jan 2015 20:53:18 +0000 (20:53 +0000)]
R600: Implement getRsqrtEstimate

Only do for f32 since I'm unclear on both what this is expecting
for the refinement steps in terms of accuracy, and what
f64 instruction actually provides.

llvm-svn: 225827

9 years agoIR: Fix GCC error from MDLocation::getInlinedAt()
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 20:50:21 +0000 (20:50 +0000)]
IR: Fix GCC error from MDLocation::getInlinedAt()

Apparently GCC didn't like my ternary operator from r225824.  Use an
`if`.

llvm-svn: 225826

9 years agoRoll gotools to 47f2109c.
Peter Collingbourne [Tue, 13 Jan 2015 20:45:08 +0000 (20:45 +0000)]
Roll gotools to 47f2109c.

At the same time, perform a number of simplifications:

- Rename go.tools directory to gotools.

- Import only the go directory; all required Go analysis code and
  its dependencies have now been moved to this directory.

llvm-svn: 225825

9 years agoIR: Add MDLocation class
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 20:44:56 +0000 (20:44 +0000)]
IR: Add MDLocation class

Add a new subclass of `UniquableMDNode`, `MDLocation`.  This will be the
IR version of `DebugLoc` and `DILocation`.  The goal is to rename this
to `DILocation` once the IR classes supersede the `DI`-prefixed
wrappers.

This isn't used anywhere yet.  Part of PR21433.

llvm-svn: 225824

9 years agoR600: Make cttz / ctlz cheap to speculate
Matt Arsenault [Tue, 13 Jan 2015 19:46:48 +0000 (19:46 +0000)]
R600: Make cttz / ctlz cheap to speculate

Speculating things is generally good. SI+ has instructions for these
for 32-bit values. This is still probably better even with the expansion
for 64-bit values, although it is odd that this callback doesn't have
the size as a parameter.

llvm-svn: 225822

9 years agoFix non-determinism issue in SLP
Julien Lerouge [Tue, 13 Jan 2015 19:45:52 +0000 (19:45 +0000)]
Fix non-determinism issue in SLP

The issue was introduced in r214638:

+  for (auto &BSIter : BlocksSchedules) {
+    scheduleBlock(BSIter.second.get());
+  }

Because BlocksSchedules is a DenseMap with BasicBlock* keys, blocks are
scheduled in non-deterministic order, resulting in unpredictable IR.

Patch by Daniel Reynaud!

llvm-svn: 225821

9 years agoUse the integrated assembler as default on SystemZ
Ulrich Weigand [Tue, 13 Jan 2015 19:45:16 +0000 (19:45 +0000)]
Use the integrated assembler as default on SystemZ

This was already done in clang, this commit now uses the integrated
assembler as default when using LLVM tools directly.

A number of test cases deliberately using an invalid instruction in
inline asm now have to use -no-integrated-as.

llvm-svn: 225820

9 years agoUse the integrated assembler as default on PowerPC
Ulrich Weigand [Tue, 13 Jan 2015 19:43:45 +0000 (19:43 +0000)]
Use the integrated assembler as default on PowerPC

This was already done in clang, this commit now uses the integrated
assembler as default when using LLVM tools directly.

A number of test cases using inline asm had to be adapted, either by
updating the expected output, or by using -no-integrated-as (for such
tests that deliberately use an invalid instruction in inline asm).

llvm-svn: 225819

9 years agoUse types of matching size when generating multi-dimensional address expressions
Tobias Grosser [Tue, 13 Jan 2015 19:37:59 +0000 (19:37 +0000)]
Use types of matching size when generating multi-dimensional address expressions

This change ensures that the values that represent the array size of a
multi-dimensional access are correctly sign-extended when used to compute a
memory address used in the run-time alias check.

To make the test case more readable, we name the instructions that we generate.

llvm-svn: 225818

9 years agoRunning clang-format on CommandLine.h and CommandLine.cpp.
Chris Bieneman [Tue, 13 Jan 2015 19:14:20 +0000 (19:14 +0000)]
Running clang-format on CommandLine.h and CommandLine.cpp.

No functional changes, I'm just going to be doing a lot of work in these files and it would be helpful if they had more current LLVM style.

llvm-svn: 225817

9 years agoSimplify.
Rui Ueyama [Tue, 13 Jan 2015 18:51:09 +0000 (18:51 +0000)]
Simplify.

We can remove these methods because every InputElement has
only one File.

llvm-svn: 225816

9 years agoAdd link to Go bindings documentation.
Peter Collingbourne [Tue, 13 Jan 2015 18:49:42 +0000 (18:49 +0000)]
Add link to Go bindings documentation.

llvm-svn: 225815

9 years agoReplace vector<unique_ptr<File> with unique_ptr<File>.
Rui Ueyama [Tue, 13 Jan 2015 18:47:25 +0000 (18:47 +0000)]
Replace vector<unique_ptr<File> with unique_ptr<File>.

Because each InputElement has exactly one File, we no longer have
to use a vector to store pointers to Files.

llvm-svn: 225814

9 years agoWhen attribute 'optnone' appears on the same declaration with a
Paul Robinson [Tue, 13 Jan 2015 18:34:56 +0000 (18:34 +0000)]
When attribute 'optnone' appears on the same declaration with a
conflicting attribute, warn about the conflict and pick a "winning"
attribute to preserve, instead of emitting an error.  This matches the
behavior when the conflicting attributes are on different declarations.

Along the way I discovered that conflicts involving __forceinline were
reported as 'always_inline' (alternate spelling, same attribute) so
fixed that up to report the attribute as spelled in the source.

llvm-svn: 225813

9 years agoFix maxLoopDepth computation in ScopInfo
David Peixotto [Tue, 13 Jan 2015 18:31:55 +0000 (18:31 +0000)]
Fix maxLoopDepth computation in ScopInfo

The max loop depth was incorrectly computed for scops that contain a
block from a loop but do not contain the entire loop. We need to
check that the full loop is contained in the region when computing
the max loop depth.

These scops occur when a region containing an inner loop is expanded
to include some blocks from the outer loop, but it cannot be fully
expanded to contain the outer loop because the region containing the
outer loop is invalid.

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

llvm-svn: 225812

9 years agoRevert "r225808 - [PowerPC] Add StackMap/PatchPoint support"
Hal Finkel [Tue, 13 Jan 2015 18:25:05 +0000 (18:25 +0000)]
Revert "r225808 - [PowerPC] Add StackMap/PatchPoint support"

Reverting this while I investiage buildbot failures (segfaulting in
GetCostForDef at ScheduleDAGRRList.cpp:314).

llvm-svn: 225811

9 years agoUpdate multiline.ll testcase to handle (ppc64le) .localentry directive
Will Schmidt [Tue, 13 Jan 2015 18:17:08 +0000 (18:17 +0000)]
Update multiline.ll testcase to handle (ppc64le) .localentry directive

The ppc64le platform will emit a .localentry directive. This is triggering
a false-positive against a CHECK-NOT: .loc in multiline.ll.
Add a space "{{ }}" to the check-not line to allow for arguments, and
prevent .localentry from matching.

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

llvm-svn: 225810

9 years ago[PowerPC] Add missing override keyword
Hal Finkel [Tue, 13 Jan 2015 18:02:22 +0000 (18:02 +0000)]
[PowerPC] Add missing override keyword

llvm-svn: 225809

9 years ago[PowerPC] Add StackMap/PatchPoint support
Hal Finkel [Tue, 13 Jan 2015 17:48:12 +0000 (17:48 +0000)]
[PowerPC] Add StackMap/PatchPoint support

This commit does two things:

 1. Refactors PPCFastISel to use more of the common infrastructure for call
    lowering (this lets us take advantage of this common code for lowering some
    common intrinsics, stackmap/patchpoint among them).

 2. Adds support for stackmap/patchpoint lowering. For the most part, this is
    very similar to the support in the AArch64 target, with the obvious differences
    (different registers, NOP instructions, etc.). The test cases are adapted
    from the AArch64 test cases.

One difference of note is that the patchpoint call sequence takes 24 bytes, so
you can't use less than that (on AArch64 you can go down to 16). Also, as noted
in the docs, we take the patchpoint address to be the actual code address
(assuming the call is local in the TOC-sharing sense), which should yield
higher performance than generating the full cross-DSO indirect-call sequence
and is likely just as useful for JITed code (if not, we'll change it).

StackMaps and Patchpoints are still marked as experimental, and so this support
is doubly experimental. So go ahead and experiment!

llvm-svn: 225808

9 years ago[StackMaps] Use CurrentFnSymForSize
Hal Finkel [Tue, 13 Jan 2015 17:48:07 +0000 (17:48 +0000)]
[StackMaps] Use CurrentFnSymForSize

When computing the call-site offset, use AP.CurrentFnSymForSize instead of
AP.CurrentFnSym. There should be no change for other targets, but this is
necessary for generating valid expressions for PPC64/ELF.

llvm-svn: 225807

9 years ago[StackMaps] Mark in CallLoweringInfo when lowering a patchpoint
Hal Finkel [Tue, 13 Jan 2015 17:48:04 +0000 (17:48 +0000)]
[StackMaps] Mark in CallLoweringInfo when lowering a patchpoint

While, generally speaking, the process of lowering arguments for a patchpoint
is the same as lowering a regular indirect call, on some targets it may not be
exactly the same. Targets may not, for example, want to add additional register
dependencies that apply only to making cross-DSO calls through linker stubs,
may not want to load additional registers out of function descriptors, and may
not want to add additional side-effect-causing instructions that cannot be
removed later with the call itself being generated.

The PowerPC target will use this in a future commit (for all of the reasons
stated above).

llvm-svn: 225806

9 years ago[StackMaps] Allow the target to pre-process the live-out mask
Hal Finkel [Tue, 13 Jan 2015 17:47:59 +0000 (17:47 +0000)]
[StackMaps] Allow the target to pre-process the live-out mask

Some targets, PowerPC for example, have pseudo-registers (such as that used to
represent the rounding mode), that don't have DWARF register numbers or a
register class. These are used only for internal dependency tracking, and
should not appear in the recorded live-outs. This adds a callback allowing the
target to pre-process the live-out mask in order to remove these kinds of
registers so that the StackMaps code does not complain about them and/or
attempt to include them in the output.

This will be used by the PowerPC target in a future commit.

llvm-svn: 225805

9 years ago[PowerPC] Split the blr definition into BLR and BLR8
Hal Finkel [Tue, 13 Jan 2015 17:47:54 +0000 (17:47 +0000)]
[PowerPC] Split the blr definition into BLR and BLR8

We really need a separate 64-bit version of this instruction so that it can be
marked as clobbering LR8 (instead of just LR). No change in functionality
(although the verifier might be slightly happier), however, it is required for
stackmap/patchpoint support. Thus, this will be covered by stackmap test cases
once those are added.

llvm-svn: 225804

9 years agoInherit attributes when infering a framework module
Ben Langmuir [Tue, 13 Jan 2015 17:47:44 +0000 (17:47 +0000)]
Inherit attributes when infering a framework module

If a module map contains
framework module * [extern_c] {}

We will now infer [extern_c] on the inferred framework modules (we
already inferred [system] as a special case).

llvm-svn: 225803

9 years agoHandle [extern_c] attribute in module printer
Ben Langmuir [Tue, 13 Jan 2015 17:47:38 +0000 (17:47 +0000)]
Handle [extern_c] attribute in module printer

I'm not sure why we have OS.indent(Indent+2) for the system attribute,
but presumably we want the same behaviour for all attributes...

llvm-svn: 225802

9 years agoRemove unused method canInferFrameworkModule
Ben Langmuir [Tue, 13 Jan 2015 17:47:29 +0000 (17:47 +0000)]
Remove unused method canInferFrameworkModule

llvm-svn: 225801

9 years ago[PowerPC] Add DWARF numbers for CA (XER), etc.
Hal Finkel [Tue, 13 Jan 2015 17:45:11 +0000 (17:45 +0000)]
[PowerPC] Add DWARF numbers for CA (XER), etc.

For registers that have DWARF numbers (like CA, which is really part of XER),
add them. Also, RM is not an SPR, and the declaration hack (where it is
declared as an SPR with an arbitrary number) is not needed, so just declare it
as a register.

NFC; although CA's register number will be needed when stackmap/patchpoint
support is added.

llvm-svn: 225800

9 years agoMake regex::assign not clobber the regex in case of failure. Fixes PR#22213
Marshall Clow [Tue, 13 Jan 2015 16:49:52 +0000 (16:49 +0000)]
Make regex::assign not clobber the regex in case of failure. Fixes PR#22213

llvm-svn: 225799

9 years ago[mips][microMIPS] Fix issue with 16b instructions in jr instruction delay slot
Jozef Kolek [Tue, 13 Jan 2015 15:59:17 +0000 (15:59 +0000)]
[mips][microMIPS] Fix issue with 16b instructions in jr instruction delay slot

16 bit instructions are not allowed in jr delay slot. Same stands for
PseudoIndirectBranch and PseudoReturn.

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

llvm-svn: 225798

9 years agoAdded a Mips lld milestone to the release notes for the 3.6 release.
Daniel Sanders [Tue, 13 Jan 2015 15:17:00 +0000 (15:17 +0000)]
Added a Mips lld milestone to the release notes for the 3.6 release.

llvm-svn: 225797

9 years agofixed the missed bracket introduced by checkin rev 225792
Andrey Churbanov [Tue, 13 Jan 2015 15:16:49 +0000 (15:16 +0000)]
fixed the missed bracket introduced by checkin rev 225792

llvm-svn: 225796

9 years agoAdded TLI hook for isFPExtFree. Some of the FMA combine heuristics are now guarded...
Olivier Sallenave [Tue, 13 Jan 2015 15:06:36 +0000 (15:06 +0000)]
Added TLI hook for isFPExtFree. Some of the FMA combine heuristics are now guarded with that hook.

llvm-svn: 225795

9 years agoThis patch enables the use of KMP_AFFINITY=balanced on non-MIC Architectures. The...
Andrey Churbanov [Tue, 13 Jan 2015 14:54:00 +0000 (14:54 +0000)]
This patch enables the use of KMP_AFFINITY=balanced on non-MIC Architectures.  The restriction for using balanced affinity on non-MIC architectures is it only works for one-package machines.

llvm-svn: 225794

9 years agosmall fixes to the hierarchical barrier
Andrey Churbanov [Tue, 13 Jan 2015 14:47:02 +0000 (14:47 +0000)]
small fixes to the hierarchical barrier

llvm-svn: 225793

9 years agoaarch64 port sent by C. Bergstrom
Andrey Churbanov [Tue, 13 Jan 2015 14:43:35 +0000 (14:43 +0000)]
aarch64 port sent by C. Bergstrom

llvm-svn: 225792

9 years agoRevert "SLPVectorizer: Cache results from memory alias checking."
Erik Eckstein [Tue, 13 Jan 2015 14:36:46 +0000 (14:36 +0000)]
Revert "SLPVectorizer: Cache results from memory alias checking."

The alias cache has a problem of incorrect collisions in case a new instruction is allocated at the same address as a previously deleted instruction.

llvm-svn: 225790

9 years agoReturn the architecture by probing predefined compiler macros
Andrey Churbanov [Tue, 13 Jan 2015 14:35:23 +0000 (14:35 +0000)]
Return the architecture by probing predefined compiler macros

llvm-svn: 225789

9 years agoSilence warnings about unknown pragmas for compilers that are not Clang. NFC.
Aaron Ballman [Tue, 13 Jan 2015 14:30:07 +0000 (14:30 +0000)]
Silence warnings about unknown pragmas for compilers that are not Clang. NFC.

llvm-svn: 225788

9 years ago[OCaml] Allow out-of-tree builds of LLVM bindings.
Peter Zotov [Tue, 13 Jan 2015 12:17:56 +0000 (12:17 +0000)]
[OCaml] Allow out-of-tree builds of LLVM bindings.

In order to use this feature, configure LLVM as usual,
but then build and install it as:

   make all install SYSTEM_LLVM_CONFIG=llvm-config

where llvm-config is the llvm-config binary installed on your
system (possibly llvm-config-VERSION on e.g. Debian).

llvm-svn: 225787

9 years agoSLPVectorizer: Cache results from memory alias checking.
Erik Eckstein [Tue, 13 Jan 2015 11:37:51 +0000 (11:37 +0000)]
SLPVectorizer: Cache results from memory alias checking.

This speeds up the dependency calculations for blocks with many load/store/call instructions.
Beside the improved runtime, there is no functional change.

llvm-svn: 225786

9 years ago[PM] In the PassManager template, remove a pointless indirection through
Chandler Carruth [Tue, 13 Jan 2015 11:36:43 +0000 (11:36 +0000)]
[PM] In the PassManager template, remove a pointless indirection through
a nested class template for the PassModel, and use the T-suffix for the
two typedefs to match the code in the AnalysisManager.

This is the last of the fairly fundamental code cleanups here. Will be
focusing on the printing of analyses next to finish that aspect off.

llvm-svn: 225785

9 years ago[PM] Remove the 'AnalysisManagerT' type parameter from numerous layers
Chandler Carruth [Tue, 13 Jan 2015 11:31:43 +0000 (11:31 +0000)]
[PM] Remove the 'AnalysisManagerT' type parameter from numerous layers
of templates in the new pass manager.

The analysis manager is now itself just a template predicated on the IR
unit. This makes lots of the templates really trivial and more clear:
they are all parameterized on a single type, the IR unit's type.
Everything else is a function of that. To me, this is a really nice
cleanup of the APIs and removes a layer of 'magic' and 'indirection'
that really wasn't there and just got in the way of understanding what
is going on here.

llvm-svn: 225784

9 years ago[PM] Refactor the new pass manager to use a single template to implement
Chandler Carruth [Tue, 13 Jan 2015 11:13:56 +0000 (11:13 +0000)]
[PM] Refactor the new pass manager to use a single template to implement
the generic functionality of the pass managers themselves.

In the new infrastructure, the pass "manager" isn't actually interesting
at all. It just pipelines a single chunk of IR through N passes. We
don't need to know anything about the IR or the passes to do this really
and we can replace the 3 implementations of the exact same functionality
with a single generic PassManager template, complementing the single
generic AnalysisManager template.

I've left typedefs in place to give convenient names to the various
obvious instantiations of the template.

With this, I think I've nuked almost all of the redundant logic in the
managers, and I think the overall design is actually simpler for having
single templates that clearly indicate there is no special logic here.
The logging is made somewhat more annoying by this change, but I don't
think the difference is worth having heavy-weight traits to help log
things.

llvm-svn: 225783

9 years ago[mips] Fix va_arg() for pointer types on big-endian N32.
Daniel Sanders [Tue, 13 Jan 2015 10:47:00 +0000 (10:47 +0000)]
[mips] Fix va_arg() for pointer types on big-endian N32.

Summary:
The Mips ABI's treat pointers in the same way as integers. They are
sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter
for O32 and N64 where pointers are already the correct width but it does matter
for big-endian N32, where pointers are 32-bit and need promoting.

The caller side is already passing pointers correctly. This patch corrects the
callee.

Reviewers: vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 225782

9 years agoRevert "Sema: An extern declaration can't be a redeclaration of a parameter"
David Majnemer [Tue, 13 Jan 2015 10:14:57 +0000 (10:14 +0000)]
Revert "Sema: An extern declaration can't be a redeclaration of a parameter"

This reverts commit r225780, we can't compile line 181 in
sanitizer_platform_limits_posix.cc with this commit.

llvm-svn: 225781

9 years agoSema: An extern declaration can't be a redeclaration of a parameter
David Majnemer [Tue, 13 Jan 2015 09:55:56 +0000 (09:55 +0000)]
Sema: An extern declaration can't be a redeclaration of a parameter

In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

llvm-svn: 225780

9 years agoUpdate release notes wrt OCaml bindings.
Peter Zotov [Tue, 13 Jan 2015 09:48:02 +0000 (09:48 +0000)]
Update release notes wrt OCaml bindings.

llvm-svn: 225779

9 years ago[OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
Peter Zotov [Tue, 13 Jan 2015 09:47:59 +0000 (09:47 +0000)]
[OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.

As a result, installations of LLVM in non-standard locations
will not require passing custom -ccopt -L flags when building
the binary, nor absolute paths would be embedded in the cma/cmxa
files. Additionally, the executables will not require changes
to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still
has to be set for ocamlc without -custom.

See http://caml.inria.fr/mantis/view.php?id=6642.
Note that the patch is approved, but not merged yet.
It will be released in 4.03 and likely 4.02.

llvm-svn: 225778

9 years agoUpdate clang-format.el to use xml output and patch in the returned chunks.
Manuel Klimek [Tue, 13 Jan 2015 08:35:34 +0000 (08:35 +0000)]
Update clang-format.el to use xml output and patch in the returned chunks.

This leads to better undo behavior and avoids window content jumping
around.

Patch by Johann Klähn.

llvm-svn: 225777

9 years agoParse: Switch to using EOF tokens for late parsed attributes
David Majnemer [Tue, 13 Jan 2015 08:35:24 +0000 (08:35 +0000)]
Parse: Switch to using EOF tokens for late parsed attributes

The EOF token injection technique is preferable to using
isBeforeInTranslationUnit to determine whether or not additional cleanup
is needed.  I don't have an example off-hand that requires it but it is
nicer nonetheless.

llvm-svn: 225776

9 years agoIR/MetadataTest.cpp: Appease msc17 to avoid initializer list.
NAKAMURA Takumi [Tue, 13 Jan 2015 08:13:46 +0000 (08:13 +0000)]
IR/MetadataTest.cpp: Appease msc17 to avoid initializer list.

llvm-svn: 225775

9 years agoParse: Don't crash when default argument in typedef consists of sole '='
David Majnemer [Tue, 13 Jan 2015 07:42:33 +0000 (07:42 +0000)]
Parse: Don't crash when default argument in typedef consists of sole '='

We'd crash trying to make the SourceRange for the tokens we'd like to
highlight.  Don't assume there is more than one token makes up the
default argument.

llvm-svn: 225774

9 years agoEnhance the eh_frame unwind instruction augmenter so that
Jason Molenda [Tue, 13 Jan 2015 07:39:03 +0000 (07:39 +0000)]
Enhance the eh_frame unwind instruction augmenter so that
it will do the right thing on x86 routines with a mid-function
epilogue sequence (where the unwind rules need to be reinstalled
after the epilogue has completed).
<rdar://problem/19417410>

llvm-svn: 225773

9 years agoPeephole opt needs optimizeSelect() to keep track of newly created MIs
Mehdi Amini [Tue, 13 Jan 2015 07:07:13 +0000 (07:07 +0000)]
Peephole opt needs optimizeSelect() to keep track of newly created MIs

Peephole optimizer is scanning a basic block forward. At some point it
needs to answer the question "given a pointer to an MI in the current
BB, is it located before or after the current instruction".
To perform this, it keeps a set of the MIs already seen during the scan,
if a MI is not in the set, it is assumed to be after.
It means that newly created MIs have to be inserted in the set as well.

This commit passes the set as an argument to the target-dependent
optimizeSelect() so that it can properly update the set with the
(potentially) newly created MIs.

llvm-svn: 225772

9 years agoAdd an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite
Jason Molenda [Tue, 13 Jan 2015 06:07:07 +0000 (06:07 +0000)]
Add an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite
which will verify if the eh_frame instructions include details about
the prologue or not.  Both clang and gcc include prologue instructions
but there's no requirement for them to do so -- and I'm sure we'll
have to interoperate with a compiler that doesn't generate prologue
info at some point.

I don't have any compilers that omit the prologue instructions so the
testing was of the "makre sure augmented unwind info is still created".
With an eh_frame without prologue, this code should reject the
augmentation scheme altogether and we should fall back to using assembly
instruction profiling.

llvm-svn: 225771

9 years agoChange the x86 assembly instruction unwind parser to
Jason Molenda [Tue, 13 Jan 2015 06:04:04 +0000 (06:04 +0000)]
Change the x86 assembly instruction unwind parser to
step through the complete function looking for any epilogue
instructions.  If we find an epilogue sequence, re-instate
the correct unwind instructions if there is more code past
that epilogue -- this will correctly handle an x86 function
with multiple epilogues in it.

NB there is still a bug with the "eh_frame augmented"
UnwindPlans and mid-function epilogues.  Looking at that next.

<rdar://problem/18863406>

llvm-svn: 225770

9 years agoRemove dead code.
Rui Ueyama [Tue, 13 Jan 2015 05:59:17 +0000 (05:59 +0000)]
Remove dead code.

Now every InputElement has exactly one File in it, so "expand"
method is now no-op.

llvm-svn: 225769

9 years agoParse: Don't crash if missing an initializer expression
David Majnemer [Tue, 13 Jan 2015 05:28:24 +0000 (05:28 +0000)]
Parse: Don't crash if missing an initializer expression

llvm-svn: 225768