1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

18371 Commits

Author SHA1 Message Date
Nadav Rotem
3276e11bb5 IRBuilder: add an assertion that checks if we try to get a debug loc from ->end();
llvm-svn: 185952
2013-07-09 17:54:22 +00:00
Ulrich Weigand
b664c03f18 [PowerPC] Revert r185476 and fix up TLS variant kinds
In the commit message to r185476 I wrote:

>The PowerPC-specific modifiers VK_PPC_TLSGD and VK_PPC_TLSLD
>correspond exactly to the generic modifiers VK_TLSGD and VK_TLSLD.
>This causes some confusion with the asm parser, since VK_PPC_TLSGD
>is output as @tlsgd, which is then read back in as VK_TLSGD.
>
>To avoid this confusion, this patch removes the PowerPC-specific
>modifiers and uses the generic modifiers throughout.  (The only
>drawback is that the generic modifiers are printed in upper case
>while the usual convention on PowerPC is to use lower-case modifiers.
>But this is just a cosmetic issue.)

This was unfortunately incorrect, there is is fact another,
serious drawback to using the default VK_TLSLD/VK_TLSGD
variant kinds: using these causes ELFObjectWriter::RelocNeedsGOT
to return true, which in turn causes the ELFObjectWriter to emit
an undefined reference to _GLOBAL_OFFSET_TABLE_.

This is a problem on powerpc64, because it uses the TOC instead
of the GOT, and the linker does not provide _GLOBAL_OFFSET_TABLE_,
so the symbol remains undefined.  This means shared libraries
using TLS built with the integrated assembler are currently
broken.

While the whole RelocNeedsGOT / _GLOBAL_OFFSET_TABLE_ situation
probably ought to be properly fixed at some point, for now I'm
simply reverting the r185476 commit.  Now this in turn exposes
the breakage of handling @tlsgd/@tlsld in the asm parser that
this check-in was originally intended to fix.

To avoid this regression, I'm also adding a different fix for
this problem: while common code now parses @tlsgd as VK_TLSGD,
a special hack in the asm parser translates this code to the
platform-specific VK_PPC_TLSGD that the back-end now expects.
While this is not really pretty, it's self-contained and
shouldn't hurt anything else for now.  One the underlying
problem is fixed, this hack can be reverted again.

llvm-svn: 185945
2013-07-09 16:41:09 +00:00
Rafael Espindola
f574b25abe Add missing getters. They will be used in llvm-ar.
llvm-svn: 185937
2013-07-09 12:49:24 +00:00
Rafael Espindola
a60439b0f2 Archive members cannot be larger than 4GB. Return a uint32_t.
llvm-svn: 185936
2013-07-09 12:45:11 +00:00
Rafael Espindola
2a3541dfc1 We never compare iterators from two archives. Assert that.
llvm-svn: 185934
2013-07-09 12:30:10 +00:00
Rafael Espindola
852db8570d Add getHeader helper and move ToHeader to the cpp file.
llvm-svn: 185933
2013-07-09 12:22:05 +00:00
Rafael Espindola
0ba1fc3b7f Compute the size of an archive member in the constructor.
It is always computed the same way (by parsing the header). Doing it in the
constructor simplifies the callers a bit.

llvm-svn: 185905
2013-07-09 05:26:25 +00:00
Rafael Espindola
4cfe8ac4c5 Remove declare but not implemented methods.
llvm-svn: 185904
2013-07-09 05:09:08 +00:00
Rafael Espindola
3bc9c4c2cf Move some code out of line. No functionality change.
llvm-svn: 185901
2013-07-09 03:39:35 +00:00
Eric Christopher
e42a65a9b8 Revert "DebugInfo: remove unused helper function getDICompositeType."
This reverts commit r185876 as the functions appear to still be used
by dragonegg.

llvm-svn: 185890
2013-07-09 00:16:56 +00:00
Nadav Rotem
edc4aa7d9e Fix a bug in IRBuilder::ClearInsertionPoint. The IR Builder needs to reset both the BB and the insert point inside the BB.
llvm-svn: 185883
2013-07-08 23:27:43 +00:00
Manman Ren
9e436c6bea DebugInfo: remove unused helper function getDICompositeType.
llvm-svn: 185876
2013-07-08 21:55:46 +00:00
Manman Ren
2871bbf568 Revert r185852.
llvm-svn: 185861
2013-07-08 20:27:34 +00:00
Matt Arsenault
0a992db587 Find xdot or xdot.py.
Ubuntu installs this as xdot, so finding xdot.py would fail.

llvm-svn: 185860
2013-07-08 20:24:54 +00:00
Manman Ren
9e950598ce StringRef: add DenseMapInfo for StringRef.
Remove the implementation in include/llvm/Support/YAMLTraits.h.
Added a DenseMap type DITypeHashMap in DebugInfo.h:
  DenseMap<std::pair<StringRef, unsigned>, MDNode*>

llvm-svn: 185852
2013-07-08 19:17:48 +00:00
Argyrios Kyrtzidis
993565f337 [ADT/NullablePtr] Allow implicit conversion of NullablePtr<OtherT> -> NullablePtr<T> if OtherT is derived from T.
llvm-svn: 185851
2013-07-08 19:12:01 +00:00
Reid Kleckner
3e59a5ddfa Reland "Use Clang's __has_* macros in Compiler.h ..." with fixes
This reverts r185841 and relands r185831 without using
__has_attribute(const).

Clang prior to r161767 (between 3.1 and 3.2) does not accept
__has_attribute(const) due to rdar://10253857.  __const and __const__
are both keyword aliases of const, so they don't work either.

I was able to repro the buildbot failure using clang 3.1 and this patch
fixes it.  Various important versions of XCode use clang 2.9-ish, so
this workaround is necessary.

llvm-svn: 185850
2013-07-08 19:06:25 +00:00
Shuxin Yang
a6173e9a56 Fix a SCEV update problem.
The symptom is seg-fault, and the root cause is that a SCEV contains a SCEVUnknown
which has null-pointer to a llvm::Value.

 This is how the problem take place:
 ===================================
  1). In the pristine input IR, there are two relevant instrutions Op1 and Op2, 
     Op1's corresponding SCEV (denoted as SCEV(op1)) is a SCEVUnknown, and
     SCEV(Op2) contains SCEV(Op1).  None of these instructions are dead.

     Op1 : V1 = ...
     ...
     Op2 : V2 = ... // directly or indirectly (data-flow) depends on Op1
    
  2) Optimizer (LSR in my case) generates an instruction holding the equivalent
     value of Op1, making Op1 dead. 
     Op1': V1' = ...
     Op1: V1 = ... ; now dead)
     Op2 : V2 = ... //Now deps on Op1', but the SCEV(Op2) still contains SCEV(Op1)

  3) Op1 is deleted, and call-back function is called to reset 
     SCEV(Op1) to indicate it is invalid. However, SCEV(Op2) is not 
     invalidated as well.

  4) Following pass get the cached, invalid SCEV(Op2), and try to manipulate it,
     and cause segfault. 

 The fix:
 ========
 It seems there is no clean yet inexpensive fix. I write to dev-list
soliciting good solution, unforunately no ack. So, I decide to fix this 
problem in a brute-force way:

  When ScalarEvolution::getSCEV is called, check if the cached SCEV 
contains a invalid SCEVUnknow, if yes, remove the cached SCEV, and
re-evaluate the SCEV from scratch.

  I compile buch of big *.c and *.cpp, fortunately, I don't see any increase
in compile time.

 Misc:
=====
 The reduced test-case has 2357 lines of code+other-stuff, too big to commit.

 rdar://14283433

llvm-svn: 185843
2013-07-08 17:33:13 +00:00
Quentin Colombet
51c235a1aa Revert: "Use Clang's __has_* macros in Compiler.h to test for features"
This reverts r185831 and 185833.

llvm-svn: 185841
2013-07-08 17:32:13 +00:00
Rafael Espindola
1732782ad3 clang-format this enum.
llvm-svn: 185835
2013-07-08 16:55:56 +00:00
Rafael Espindola
fc25f0c6cf We now always create files with the correct permissions. Simplify the interface.
llvm-svn: 185834
2013-07-08 16:42:01 +00:00
Reid Kleckner
4e247915c9 Attempt to fix Compiler.h for some self-hosting bots
I tested r185831 by self-hosting clang with a recent clang, and got no
warnings.  I haven't been able to reproduce the problem locally.

llvm-svn: 185833
2013-07-08 16:36:29 +00:00
Reid Kleckner
3a0476922a Use Clang's __has_* macros in Compiler.h to test for features
When targetting Windows, clang does not define __GNUC__, and as a result
we don't use our attributes with it.  This leads to warnings about
unused functions that are already annotated with LLVM_ATTRIBUTE_UNUSED.
Rather than testing for __clang__, we can use its __has_attribute and
__has_builtin macros directlty.

While I'm here, conditionally define and use __GNUC_PREREQ for gcc
version checks.  Spelling the check out with three comparisons is
verbose and error prone.

Reviewers: aaron.ballman

Differential Revision: http://llvm-reviews.chandlerc.com/D1080

llvm-svn: 185831
2013-07-08 15:31:29 +00:00
Nick Lewycky
181e3475a3 Add missing per-argument doesNotAccessMemory accessors. No functionality change
since it has no callers today.

llvm-svn: 185775
2013-07-07 08:29:51 +00:00
Nico Rieck
fb7b696627 MC: Implement COFF .linkonce directive
llvm-svn: 185753
2013-07-06 12:13:10 +00:00
Nick Lewycky
7b093a1c2f Extend 'readonly' and 'readnone' to work on function arguments as well as
functions. Make the function attributes pass add it to known library functions
and when it can deduce it.

llvm-svn: 185735
2013-07-06 00:29:58 +00:00
Jakob Stoklund Olesen
9d2c118af7 Remove dead function.
llvm-svn: 185731
2013-07-05 23:04:55 +00:00
Rafael Espindola
5d9e1a875f Remove unique_file now that it is unused.
llvm-svn: 185728
2013-07-05 21:19:35 +00:00
Rafael Espindola
66da97e093 Add a createUniqueFile function and switch llvm's users of unique_file.
This function is complementary to createTemporaryFile. It handles the case were
the unique file is *not* temporary: we will rename it in the end. Since we
will rename it, the file has to be in the same filesystem as the final
destination and we don't prepend the system temporary directory.

This has a small semantic difference from unique_file: the default mode is 0666.
This matches the behavior of most unix tools. For example, with this change
lld now produces files with the same permissions as ld. I will add a test
of this change when I port clang over to createUniqueFile (next commit).

llvm-svn: 185726
2013-07-05 21:01:08 +00:00
Rafael Espindola
b874aa69e3 Add a higher level createTemporaryFile function.
This function is inspired by clang's Driver::GetTemporaryPath. It hides the
pattern used for uniquing and requires simple file names that are always
placed in the system temporary directory.

llvm-svn: 185716
2013-07-05 19:56:49 +00:00
Richard Sandiford
c0fe83c1b6 [SystemZ] Remove no-op MVCs
The stack coloring pass has code to delete stores and loads that become
trivially dead after coloring.  Extend it to cope with single instructions
that copy from one frame index to another.

The testcase happens to show an example of this kicking in at the moment.
It did occur in Real Code too though.

llvm-svn: 185705
2013-07-05 14:38:48 +00:00
Richard Sandiford
77b263e187 [SystemZ] Clean up register scavenging code
SystemZ wants normal register scavenging slots, as close to the stack or
frame pointer as possible.  The only reason it was using custom code was
because PrologEpilogInserter assumed an x86-like layout, where the frame
pointer is at the opposite end of the frame from the stack pointer.
This meant that when frame pointer elimination was disabled,
the slots ended up being as close as possible to the incoming
stack pointer, which is the opposite of what we want on SystemZ.

This patch adds a new knob to say which layout is used and converts
SystemZ to use target-independent scavenging slots.  It's one of the pieces
needed to support frame-to-frame MVCs, where two slots might be required.

The ABI requires us to allocate 160 bytes for calls, so one approach
would be to use that area as temporary spill space instead.  It would need
some surgery to make sure that the slot isn't live across a call though.

I stuck to the "isFPCloseToIncomingSP - ..." style comment on the
"do what the surrounding code does" principle.  The FP case is already
covered by several Systemz/frame-* tests, which fail without the
PrologueEpilogueInserter change, so no new ones are needed.

No behavioural change intended.

llvm-svn: 185696
2013-07-05 12:55:00 +00:00
Rafael Espindola
546e9986a2 Use the raw member names in Archive::Archive.
This a bit more efficient and avoids having a function that uses the string
table being called by a function that searches for it.

llvm-svn: 185680
2013-07-05 03:35:15 +00:00
Ahmed Bougacha
d9dd942d1f Remove use of asymmetric std::lower_bound comparator.
VS 2008 doesn't like it when in debug mode.

llvm-svn: 185676
2013-07-04 23:20:12 +00:00
Aaron Ballman
b95976de16 Changing long to int for consistency.
llvm-svn: 185656
2013-07-04 17:05:21 +00:00
Aaron Ballman
4b08312576 Supporting ssize_t on WIN64 with its proper size. Patch thanks to David Cournapeau!
llvm-svn: 185627
2013-07-04 14:12:25 +00:00
Jakob Stoklund Olesen
d428205e4a Remove the EXCEPTIONADDR, EHSELECTION, and LSDAADDR ISD opcodes.
These exception-related opcodes are not used any longer.

llvm-svn: 185625
2013-07-04 13:54:20 +00:00
Jakob Stoklund Olesen
26add346da Simplify landing pad lowering.
Stop using the ISD::EXCEPTIONADDR and ISD::EHSELECTION when lowering
landing pad arguments. These nodes were previously legalized into
CopyFromReg nodes, but that never worked properly because the
CopyFromReg node weren't guaranteed to be  scheduled at the top of the
basic block.

This meant the exception pointer and selector registers could be
clobbered before being copied to a virtual register.

This patch copies the two physical registers to virtual registers at
the beginning of the basic block, and lowers the landingpad instruction
directly to two CopyFromReg nodes reading the *virtual* registers. This
is safe because virtual registers don't get clobbered.

A future patch will remove the ISD::EXCEPTIONADDR and ISD::EHSELECTION
nodes.

llvm-svn: 185617
2013-07-04 04:53:45 +00:00
Eric Christopher
f5e8037cf3 Reapply r185601 with a fix for the cmake build.
llvm-svn: 185605
2013-07-04 01:10:38 +00:00
Eric Christopher
c31256808e Temporarily revert 185601 as it caused cmake build regressions.
llvm-svn: 185603
2013-07-04 00:51:26 +00:00
Eric Christopher
f92d25bdca Add support for futimens for platforms that don't support futimes.
Patch by pashev.igor.

llvm-svn: 185601
2013-07-04 00:47:09 +00:00
Jakob Stoklund Olesen
8099b21497 Revert r185595-185596 which broke buildbots.
Revert "Simplify landing pad lowering."
Revert "Remove the EXCEPTIONADDR, EHSELECTION, and LSDAADDR ISD opcodes."

llvm-svn: 185600
2013-07-04 00:26:30 +00:00
Jakob Stoklund Olesen
8bc33424b2 Remove the EXCEPTIONADDR, EHSELECTION, and LSDAADDR ISD opcodes.
These exception-related opcodes are not used any longer.

llvm-svn: 185596
2013-07-03 23:56:31 +00:00
Jakob Stoklund Olesen
62ea9eb287 Simplify landing pad lowering.
Stop using the ISD::EXCEPTIONADDR and ISD::EHSELECTION when lowering
landing pad arguments. These nodes were previously legalized into
CopyFromReg nodes, but that never worked properly because the
CopyFromReg node weren't guaranteed to be  scheduled at the top of the
basic block.

This meant the exception pointer and selector registers could be
clobbered before being copied to a virtual register.

This patch copies the two physical registers to virtual registers at
the beginning of the basic block, and lowers the landingpad instruction
directly to two CopyFromReg nodes reading the *virtual* registers. This
is safe because virtual registers don't get clobbered.

A future patch will remove the ISD::EXCEPTIONADDR and ISD::EHSELECTION
nodes.

llvm-svn: 185595
2013-07-03 23:56:24 +00:00
Jakob Stoklund Olesen
131f26f3e2 Add MachineBasicBlock::addLiveIn().
This function adds a live-in physical register to an MBB and ensures
that it is copied to a virtual register immediately.

llvm-svn: 185594
2013-07-03 23:56:20 +00:00
Craig Topper
9729e843cb Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185540
2013-07-03 15:07:05 +00:00
Craig Topper
d9a1ef8f1e Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185512
2013-07-03 05:11:49 +00:00
Eric Christopher
cb5bf5d646 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector
to avoid specifying the vector size.

llvm-svn: 185511
2013-07-03 05:01:24 +00:00
Craig Topper
20f64aee06 Return SmallVectorImpl& instead of SmallVector& in a couple places to avoid having to specify the vector size in multiple places.
llvm-svn: 185507
2013-07-03 04:30:58 +00:00
Craig Topper
70aa354012 Add a space between type and variable name. No functional change.
llvm-svn: 185506
2013-07-03 04:27:31 +00:00