Commit Graph

24160 Commits

Author SHA1 Message Date
Peter Collingbourne
6f69f4074f LTO: expose LTO_SYMBOL_COMDAT flag, which indicates that the definition is part of a comdat group.
Reviewers: rafael

Subscribers: llvm-commits, ruiu

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 21:41:27 +00:00
Douglas Katzman
3238e64ef4 Fix English usage in command line flag help string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 20:03:23 +00:00
Davide Italiano
5a78f2db38 [ELF] Introduce getValue() for ELF Symbols.
Differential Revision:	http://reviews.llvm.org/D10328
Reviewed by:	rafael


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 19:59:04 +00:00
Daniel Sanders
4ddb0ced90 Replace string GNU Triples with llvm::Triple in TargetMachine. NFC.
Summary:
For the moment, TargetMachine::getTargetTriple() still returns a StringRef.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: ted, llvm-commits, rengolin, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239554 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 19:41:26 +00:00
Ahmed Bougacha
fd83cb21ce [CodeGen] ArrayRef'ize cond/pred in various TII APIs. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 19:30:37 +00:00
Rafael Espindola
6c56decee0 Generalize emitAbsoluteSymbolDiff.
This makes emitAbsoluteSymbolDiff always succeed and moves logic from the asm
printer to it.

The object one now also works on ELF. If two symbols are in the same fragment,
we will never move them apart.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 18:58:08 +00:00
Douglas Katzman
b0cbcd2362 Fix comment typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239541 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 16:46:27 +00:00
Nemanja Ivanovic
f7d6501d1d LLVM support for vector quad bit permute and gather instructions through builtins
This patch corresponds to review:
http://reviews.llvm.org/D10096

This is the back end portion of the patch related to D10095.
The patch adds the instructions and back end intrinsics for:
vbpermq
vgbbd


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239505 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 06:21:25 +00:00
Pete Cooper
5a118340dd Remove MachineModuleInfo::UsedFunctions as it has no users.
It hasn't been used since r130964.

This also removes MachineModuleInfo::isUsedFunction and
MachineModuleInfo::AnalyzeModule, both of which were only
there to support UsedFunctions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 01:04:56 +00:00
Jingyue Wu
294c7822a0 [NFC] added a missing space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239495 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:54:02 +00:00
Pete Cooper
ea423677ca Stop returning a Use* from allocHungOffUses.
This always just set the User::OperandList which is now set
in that method instead of being returned.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:38:46 +00:00
Pete Cooper
33102d2faa Add User::growHungoffUses and use it to grow the hung off uses. NFC.
PhiNode, SwitchInst, LandingPad and IndirectBr all had virtually identical
logic for growing the hung off uses.
Move it to User so that they can all call a single shared implementation.

Their destructors were all empty after this change and were deleted.  They all
have virtual clone_impl methods which can be used as vtable anchors.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:38:41 +00:00
Pete Cooper
0fa7dc6b36 Delete User::dropHungOffUses and move it in to ~User which is the only caller. NFC.
Now that the subclasses which care about hung off uses let ~User clean it up,
there's no need for a separate method.  Just inline it to ~User and delete it.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239491 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:38:38 +00:00
Pete Cooper
0aae8ce09f Make User track whether a class has 'hung off uses' and delete them in its destructor.
Currently all of the logic for deleting hung off uses, which PHI/switch/etc use,
is in their classes.

This adds a bit to Value which tracks whether that user had hung off uses,
then User can be responsible for clearing them instead of the sub classes.

Note, the bit used here was taken from NumOperands which was 30-bits.
Given the reduction to 29 bits, and the average User being just over 100 bytes,
a single User with 29-bits of num operands would need 50GB of RAM for itself
so its reasonable to assume that 29-bits is enough for now.

This is a step towards hiding all the hung off uses logic in the User.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239490 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:38:34 +00:00
Pete Cooper
e0e42bb51f Move the special Phi logic for hung off uses in to User::allocHungOffUses. NFC.
PhiNode's need to allocate space for an array of Use[N] and then BasicBlock*[N].

They had their own allocHungOffUses to handle all of this.  This moves the logic
in to User::allocHungOffUses and PhiNode passes in a bool to say to allocate
the BB* space too.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 22:38:30 +00:00
Teresa Johnson
b78ea510c1 Add new EliminateAvailableExternally module pass, which is performed in
O2 compiles just before GlobalDCE, unless we are preparing for LTO.

This pass eliminates available externally globals (turning them into
declarations), regardless of whether they are dead/unreferenced, since
we are guaranteed to have a copy available elsewhere at link time.
This enables additional opportunities for GlobalDCE.

If we are preparing for LTO (e.g. a -flto -c compile), the pass is not
included as we want to preserve available externally functions for possible
link time inlining. The FE indicates whether we are doing an -flto compile
via the new PrepareForLTO flag on the PassManagerBuilder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 17:49:28 +00:00
Daniel Sanders
4d13f315d1 Replace string GNU Triples with llvm::Triple in MCSubtargetInfo and create*MCSubtargetInfo(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, ted, jfb, llvm-commits, rengolin, jholewinski

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 12:11:26 +00:00
Daniel Sanders
fff114c890 Replace string GNU Triples with llvm::Triple in create*MCRelocationInfo(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, llvm-commits, rengolin

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 10:54:40 +00:00
Daniel Sanders
03c060b6d4 Replace string GNU Triples with llvm::Triple in MCAsmBackend subclasses and create*AsmBackend(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239464 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 10:35:34 +00:00
Yaron Keren
a6f2be013a Replace magic number 19 with the constant GlobalValueSubClassDataBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239459 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 06:00:59 +00:00
Pete Cooper
dbb0802eb6 Revert "Move MCSymbol Value in to the union of Offset and CommonSize."
This reverts commit 2e449ec5bcdf67b52b315b16c2128aaf25d5b73c.

This was svn r239440.  Its currently failing an ARM test so reverting while I work out
what to do next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 22:35:55 +00:00
Pete Cooper
c11f1d8ae8 Move MCSymbol Value in to the union of Offset and CommonSize.
It wasn't possible to have a variable Symbol with offset or 'isCommon' so
this just enables better packing of the MCSymbol class.

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239440 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 22:21:37 +00:00
Peter Collingbourne
1d815cac84 LibDriver, llvm-lib: introduce.
llvm-lib is intended to be a lib.exe compatible utility that also
understands bitcode. The implementation lives in a library so that
lld can use it to implement /lib.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 21:50:22 +00:00
Reid Kleckner
bdcbc426af [WinEH] Add 32-bit SEH state table emission prototype
This gets all the handler info through to the asm printer and we can
look at the .xdata tables now. I've convinced one small catch-all test
case to work, but other than that, it would be a stretch to say this is
functional.

The state numbering algorithm avoids doing any scope reconstruction as
we do for C++ to simplify the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239433 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 21:42:19 +00:00
Pete Cooper
38f72d04ea Reduce duplication in MCSymbol Name handling. NFC>
Based on feedback to r239428 by David Blaikie, use const_cast to reduce
duplication of the const and non-const versions of getNameEntryPtr.

Also have that method return the pointer to the name directly instead
of users having to then get the name from the union.

Finally, add a FIXME that we should use a static_assert once available in
the new operator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 20:41:08 +00:00
Pete Cooper
5c8a22f11b Make MCSymbol::Name be a union of uint64_t and a pointer.
This should hopefully fix the 32-bit bots which were allocating space for a pointer
but needed to be aligned to 64-bits.

Now we allocate enough space for a uint64_t and a pointer and cast to the appropriate storage

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 19:56:05 +00:00
Akira Hatanaka
0e3246a86f Remove DisableTailCalls from TargetOptions and the code in resetTargetOptions
that was resetting it.

Remove the uses of DisableTailCalls in subclasses of TargetLowering and use
the value of function attribute "disable-tail-calls" instead. Also,
unconditionally add pass TailCallElim to the pipeline and check the function
attribute at the start of runOnFunction to disable the pass on a per-function
basis. 
 
This is part of the work to remove TargetMachine::resetTargetOptions, and since
DisableTailCalls was the last non-fast-math option that was being reset in that
function, we should be able to remove the function entirely after the work to
propagate IR-level fast-math flags to DAG nodes is completed.

Out-of-tree users should remove the uses of DisableTailCalls and make changes
to attach attribute "disable-tail-calls"="true" or "false" to the functions in
the IR.

rdar://problem/13752163

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 19:07:19 +00:00
Pete Cooper
79e04c5844 Allocate space for MCSymbol::Name only if required.
Similarly to User which allocates a number of Use's prior to the this pointer,
allocate space for the Name* for MCSymbol only when we need a name.

Given that an MCSymbol is 48-bytes on 64-bit systems, this saves a decent % of space.

Given the verify_uselistorder test case with debug info and llc, 50k symbols have names
out of 700k so this optimises for the common case of temporary unnamed symbols.

Reviewed by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 18:36:13 +00:00
Eli Bendersky
a0c9e11a2b Add more wrappers for symbol APIs to the C API.
This represents some of the functionality we expose in the llvmlite Python
binding.

Patch by Antoine Pitrou

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 15:57:30 +00:00
Rui Ueyama
eae4673c2f Remove object_error::success and use std::error_code() instead
make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 15:20:42 +00:00
Toma Tabacu
c154887856 Recommit "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).
Specified the llvm namespace for the 2 calls to make_unique() which caused
compilation errors in Visual Studio 2013.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 13:33:26 +00:00
Matt Arsenault
d99ce2f630 MC: Add target hook to control symbol quoting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 00:31:39 +00:00
Reid Kleckner
dea5078cde [MC] Use unsigned for the Kind bitfield in MCSymbol
Fixes most of the test suite on Windows with clang-cl.

I'm not sure why the test suite was passing with MSVC 2013. Maybe they
changed their behavior and we are emulating their old sign extension
behavior. I think this deserves more investigation, but I want to green
the bot first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 22:12:44 +00:00
Keno Fischer
4332f869bf [InstrInfo] Refactor foldOperandImpl to thread through InsertPt. NFC
Summary:
This was a longstanding FIXME and is a necessary precursor to cases
where foldOperandImpl may have to create more than one instruction
(e.g. to constrain a register class). This is the split out NFC changes from
D6262.

Reviewers: pete, ributzka, uweigand, mcrosier

Reviewed By: mcrosier

Subscribers: mcrosier, ted, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239336 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 20:09:58 +00:00
Rafael Espindola
279ef837e8 Fix a regression in .pop_section.
It was calling ChangeSection with the wrong current section, eventually leading
to a crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239335 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 20:08:55 +00:00
Akira Hatanaka
f7e74363b8 Include header file <functional>.
This is a follow-up to r239325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 19:03:32 +00:00
Akira Hatanaka
fa6bc2e94d [ARM] Pass a callback to FunctionPass constructors to enable skipping execution
on a per-function basis.

Previously some of the passes were conditionally added to ARM's pass pipeline
based on the target machine's subtarget. This patch makes changes to add those
passes unconditionally and execute them conditonally based on the predicate
functor passed to the pass constructors. This enables running different sets of
passes for different functions in the module.

rdar://problem/20542263

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 18:50:43 +00:00
Pete Cooper
d354befbbb Use a PointerUnion in MCSymbol for Section and Fragment. NFC.
The Fragment and Section, and a bool for HasFragment were all used to create
a PointerUnion.  Just use a pointer union instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 18:41:57 +00:00
Pete Cooper
1a8319cbef Make flags get/set method protected so that all flags have to be managed by subclasses.
All of ELF, COFF and MachO now manipulate the flags in helpers so we don't need
anyone to read the flags directly, but instead via those helpers.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239317 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:30 +00:00
Pete Cooper
d3869ee8d2 Move all flags logic to MCSymbolMachO.
Also delete the now unused MCMachOSymbolFlags.h header as the only enum in there was moved to MCSymbolMachO.

Similarly to ELF and COFF, manipulating the flags is now done via helpers instead of spread
throughout the codebase.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:28 +00:00
Pete Cooper
cae8bc4504 Add MCSymbolMachO which will be used to hide the MCSymbolMachO flags.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:23 +00:00
Pete Cooper
e25e889c7c Move all of the MCSymbol COFF flags logic in to MCSymbolCOFF.
All flags setting/getting is now done in the class with helper methods instead
of users having to get the bits in the correct order.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:19 +00:00
Pete Cooper
a335f333be Move COFF Type in to the MCSymbolCOFF class.
The flags field in MCSymbol only needs to be 16-bits on ELF and MachO.
This moves the 16-bit Type out of there so that it can be reduced in size in a future commit.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239313 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:16 +00:00
Pete Cooper
f560b88d7c Add MCSymbolCOFF class and use it to get and set the COFF type field.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:12 +00:00
Pete Cooper
62f764a6c9 Change MCSymbol IsELF to an enum to support future MCSymbolCOFF and MCSymbolMachO.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:09 +00:00
Sanjay Patel
7b4fbad146 fix typos; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 15:21:38 +00:00
Silviu Baranga
a420a14276 [LAA] Fix estimation of number of memchecks
Summary:
We need to add a runtime memcheck for pair of accesses (x,y) where at least one of x and y
are writes.
 
Assuming we have w writes and r reads, currently this number is  estimated as being
w* (w+r-1). This estimation will count (write,write) pairs twice and will overestimate
the number of checks required.

This change adds a getNumberOfChecks method to RuntimePointerCheck, which
will count the number of runtime checks needed (similar in implementation to
needsAnyChecking) and uses it to produce the correct number of runtime checks.

Test Plan:
llvm test suite
spec2k
spec2k6

Performance results: no changes observed (not surprising since the formula for 1 writer is basically the same, which would covers most cases - at least with the current check limit).

Reviewers: anemet

Reviewed By: anemet

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239295 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 10:27:06 +00:00
Hao Liu
43be1d53d1 [LoopVectorize] Teach Loop Vectorizor about interleaved memory accesses.
Interleaved memory accesses are grouped and vectorized into vector load/store and shufflevector.
E.g. for (i = 0; i < N; i+=2) {
       a = A[i];         // load of even element
       b = A[i+1];       // load of odd element
       ...               // operations on a, b, c, d
       A[i] = c;         // store of even element
       A[i+1] = d;       // store of odd element
     }

  The loads of even and odd elements are identified as an interleave load group, which will be transfered into vectorized IRs like:
     %wide.vec = load <8 x i32>, <8 x i32>* %ptr
     %vec.even = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     %vec.odd = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 1, i32 3, i32 5, i32 7>

  The stores of even and odd elements are identified as an interleave store group, which will be transfered into vectorized IRs like:
     %interleaved.vec = shufflevector <4 x i32> %vec.even, %vec.odd, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7> 
     store <8 x i32> %interleaved.vec, <8 x i32>* %ptr

This optimization is currently disabled by defaut. To try it by adding '-enable-interleaved-mem-accesses=true'. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 06:39:56 +00:00
Peter Collingbourne
ee2e3d0eb9 llvm-ar: Move archive writer to Object.
No functional change intended, other than some minor changes to certain
diagnostics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239278 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 02:32:01 +00:00
Craig Topper
0547b62a14 [TableGen] Use the SMLoc header file instead of SourceMgr header file in a couple places. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 01:35:40 +00:00
Colin LeMahieu
e18e3a1027 [MC] Function naming NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239263 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 20:29:37 +00:00
Matt Arsenault
4e8236ed75 Add isLegalAddressingMode address space argument to TTI
Update to match the TLI version, and remove the TLI version's
default argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239260 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 20:12:03 +00:00
Craig Topper
030cc6948a [TableGen] Remove unnecessary include. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239249 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 06:01:22 +00:00
Craig Topper
698d0ae542 [TableGen] Remove unnecessary forward declaration. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239248 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 06:01:19 +00:00
Craig Topper
df70939242 [TableGen] Write one of the Record constructors in terms of the other constructor to reduce code duplication. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 06:01:17 +00:00
Craig Topper
20d6747043 [TableGen] Remove unused function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239246 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 06:01:15 +00:00
Craig Topper
06b2485912 [TableGen] Use 'isa' to check if something is an UnsetInit rather than getting the UnsetInit singleton and comparing pointers. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 06:01:13 +00:00
Davide Italiano
14c78fb9b1 [Object/ELF] Don't confuse isDefined() and isCommon.
Reported by Rafael Espindola. Pointy-hat to me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 02:45:19 +00:00
Davide Italiano
86a28d87b1 [Object/ELF] Provide helpers for symbol types.
These were, originally, in a different form in lld.
They can be reused for other tools, e.g. llvm-readobj.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239231 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 22:54:09 +00:00
Colin LeMahieu
2ca8f0f5d6 [MC] Common symbols weren't being checked for redeclaration which allowed an assembly file to generate an assertion in setCommon(): !isCommon(). This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 20:12:40 +00:00
NAKAMURA Takumi
4fb638b527 TargetParser: Fix comments in enum(s) introduced in r239150. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239211 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:41:35 +00:00
Craig Topper
d032911655 [TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:34:04 +00:00
Duncan P. N. Exon Smith
cb66dc70e3 Remove stray semi-colon, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 17:22:00 +00:00
Chandler Carruth
862b2ad204 [Unroll] Rework the naming and structure of the new unroll heuristics.
The new naming is (to me) much easier to understand. Here is a summary
of the new state of the world:

- '*Threshold' is the threshold for full unrolling. It is measured
  against the estimated unrolled cost as computed by getUserCost in TTI
  (or CodeMetrics, etc). We will exceed this threshold when unrolling
  loops where unrolling exposes a significant degree of simplification
  of the logic within the loop.
- '*PercentDynamicCostSavedThreshold' is the percentage of the loop's
  estimated dynamic execution cost which needs to be saved by unrolling
  to apply a discount to the estimated unrolled cost.
- '*DynamicCostSavingsDiscount' is the discount applied to the estimated
  unrolling cost when the dynamic savings are expected to be high.

When actually analyzing the loop, we now produce both an estimated
unrolled cost, and an estimated rolled cost. The rolled cost is notably
a dynamic estimate based on our analysis of the expected execution of
each iteration.

While we're still working to build up the infrastructure for making
these estimates, to me it is much more clear *how* to make them better
when they have reasonably descriptive names. For example, we may want to
apply estimated (from heuristics or profiles) dynamic execution weights
to the *dynamic* cost estimates. If we start doing that, we would also
need to track the static unrolled cost and the dynamic unrolled cost, as
only the latter could reasonably be weighted by profile information.

This patch is sadly not without functionality change for the new unroll
analysis logic. Buried in the heuristic management were several things
that surprised me. For example, we never subtracted the optimized
instruction count off when comparing against the unroll heursistics!
I don't know if this just got lost somewhere along the way or what, but
with the new accounting of things, this is much easier to keep track of
and we use the post-simplification cost estimate to compare to the
thresholds, and use the dynamic cost reduction ratio to select whether
we can exceed the baseline threshold.

The old values of these flags also don't necessarily make sense. My
impression is that none of these thresholds or discounts have been tuned
yet, and so they're just arbitrary placehold numbers. As such, I've not
bothered to adjust for the fact that this is now a discount and not
a tow-tier threshold model. We need to tune all these values once the
logic is ready to be enabled.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239164 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 17:01:43 +00:00
Alexei Starovoitov
b6ebf678ac [bpf] rename triple names bpf_be -> bpfeb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 16:11:14 +00:00
John Brawn
272d7fdf42 [ARM] Add support for -sp- FPUs and FPU none to TargetParser
These are added mainly for the benefit of clang, but this also means that they
are now allowed in .fpu directives and we emit the correct .fpu directive when
single-precision-only is used.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 13:31:19 +00:00
John Brawn
c1c9bc1df7 [ARM] Add knowledge of FPU subtarget features to TargetParser
Add getFPUFeatures to TargetParser, which gets the list of subtarget features
that are enabled/disabled for each FPU, and use it when handling the .fpu
directive.

No functional change in this commit, though clang will start behaving
differently once it starts using this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 13:29:24 +00:00
Toma Tabacu
dbaee6dadd Revert "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).
This is breaking the Windows buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 12:19:27 +00:00
Toma Tabacu
b349e0f1f1 [mips] [IAS] Restore STI.FeatureBits in .set pop.
Summary:
Only restoring AvailableFeatures is not enough and will lead to buggy behaviour.
For example, if we have a feature enabled and we ".set pop", the next time we try
to ".set" that feature nothing will happen because the "!(STI.getFeatureBits()[Feature])"
check will be false, because we didn't restore STI.FeatureBits.

In order to fix this, we need to make MipsAssemblerOptions remember the STI.FeatureBits
instead of the AvailableFeatures and then regenerate AvailableFeatures each time we ".set pop".
This is because, AFAIK, there is no way to convert from AvailableFeatures back to STI.FeatureBits,
but the reverse is possible by using ComputeAvailableFeatures(STI.FeatureBits).

I also moved the updating of AssemblerOptions inside the "if" statement in
setFeatureBits() and clearFeatureBits(), as there is no reason to update if
nothing changes.

Reviewers: dsanders, mkuper

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239144 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 11:48:54 +00:00
Justin Bogner
0a64b6de98 InstrProf: Fix reading of consecutive 32 bit coverage maps
When we generate coverage data, we explicitly set each coverage map's
alignment to 8 (See InstrProfiling::lowerCoverageData), but when we
read the coverage data, we assume consecutive maps are exactly
adjacent. When we're dealing with 32 bit, maps can end on a 4 byte
boundary, causing us to think the padding is part of the next record.

Fix this by adjusting the buffer to an appropriately aligned address
between records.

This is pretty awkward to test, as it requires a binary with multiple
coverage maps to hit, so we'd need to check in multiple source files
and a binary blob as inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239129 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 01:23:42 +00:00
Alexey Samsonov
85529a57b4 Revert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()."
This reverts commit r239124.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239125 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:58:31 +00:00
Alexey Samsonov
83f903f352 [Object, ELF] Fix segmentation fault in ELFFile::getSectionName().
Don't do a null dereference if .shstrtab section is missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:40:23 +00:00
Jim Grosbach
22a5d492ef MC: Clean up naming in MCObjectFileInfo.h.
Init*() methods to init*().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239121 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:35:03 +00:00
Jim Grosbach
71c4d5dcbf MC: Tidy up formatting and doc comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:35:00 +00:00
Jim Grosbach
eafe465f2a MC: Clean up the naming for MCMachObjectWriter. NFC.
s/ExecutePostLayoutBinding/executePostLayoutBinding/
s/ComputeSymbolTable/computeSymbolTable/
s/BindIndirectSymbols/bindIndirectSymbols/
s/RecordTLVPRelocation/recordTLVPRelocation/
s/RecordScatteredRelocation/recordScatteredRelocation/
s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/
s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/
s/WriteNlist/writeNlist/
s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/
s/WriteSymtabLoadCommand/writeSymtabLoadCommand/
s/WriteSection/writeSection/
s/WriteSegmentLoadCommand/writeSegmentLoadCommand/
s/WriteHeader/writeHeader/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:25:54 +00:00
Jim Grosbach
e2f87598ca MC: Move MachObjectWriter::SectionAddress to private.
There's already a get() method everything that needs it is using.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239118 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:25:19 +00:00
Jim Grosbach
679607868f MC: Tidy up formatting and doc comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239117 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:25:05 +00:00
Alexey Samsonov
27d60c99f7 [Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239110 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 22:49:55 +00:00
Jim Grosbach
bc81286cac MC: Clean up naming in MCObjectWriter. NFC.
s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 22:24:41 +00:00
Jim Grosbach
cc68225e0c MC: Tidy up formatting and doc comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 22:24:29 +00:00
David Blaikie
a520577e7e Re-unique_ptrify LoadedObjectInfo::clone after it was reverted due to some other changes that broke on GCC around the same time
Apparently this functionality isn't used in-tree (or I would go & make
the explicit unique_ptr constructions into implicit constructions to
make them more self documenting now that clone doesn't return a raw
owning pointer anymore) but only by the Julia frontend. This isn't
ideal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239091 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:54:32 +00:00
Diego Novillo
2cdee49937 Tidy comment. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239090 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:49:52 +00:00
David Blaikie
ea36630528 Retry defaulting the virtual dtor in LoadedObjectInfo
Originally committed in r237975, GCC 4.7 gave a compilation error
regarding "looser throw specification" though it seemed to be pointing
to a virtual defaulted dtor in a base class and an override defaulted
dtor in a derived class - so I'm not quite sure why/how they could end
up with different throw specifications. To simplify and reduce the risk
of this, I've just removed the pointless override in the derived class,
the base class's should be sufficient. *fingers crossed*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:41:51 +00:00
Ahmed Bougacha
0d9335eda7 [GlobalMerge] Take into account minsize on Global users' parents.
Now that we can look at users, we can trivially do this: when we would
have otherwise disabled GlobalMerge (currently -O<3), we can just run
it for minsize functions, as it's usually a codesize win.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:39:23 +00:00
Jim Grosbach
aa48bf4e1c MC: Remove obsolete MachO UseAggressiveSymbolFolding.
Fix the FIXME and remove this old as(1) compat option. It was useful for
bringup of the integrated assembler to diff object files, but now it's
just causing more relocations than strictly necessary to be generated.

rdar://21201804

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:27:42 +00:00
David Blaikie
711ff5004a Having another go at some simple cleanup from r237975/r237976
I made a few changes here in a couple of commits - breaking them out
into smaller ones in case I hit the GCC oddities again.

I'm still not /entirely/ sure what the issues were, so apologies if any
of these experiments break things again. Feel free to revert
immediately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:23:13 +00:00
Alexey Samsonov
5400980e1e [Object, MachO] Don't crash on invalid MachO segment load commands.
Summary:
Properly report the error in segment load commands from MachOObjectFile
constructor instead of crashing the program.

Adjust the test case accordingly.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:08:52 +00:00
Alexey Samsonov
7e699dce03 [Object, MachO] Don't crash on invalid MachO load commands.
Summary:
Currently all load commands are parsed in MachOObjectFile constructor.
If the next load command cannot be parsed, or if command size is too
small, properly report it through the error code and fail to construct
the object, instead of crashing the program.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:57:46 +00:00
Colin LeMahieu
08a382531c [MC] Allowing operands to be erased from MCInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:49:52 +00:00
Alexey Samsonov
00faba70cc [Object, MachO] Remove some code duplication. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:34:14 +00:00
Alexey Samsonov
d7eb7d7fb1 [Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.
Summary:
Avoid parsing object file each time MachOObjectFile::getHeader() is
called. Instead, cache the header in MachOObjectFile constructor, where
it's parsed anyway. In future, we must avoid constructing the object
at all if the header can't be parsed.

Test Plan: regression test suite.

Reviewers: rafael

Subscribers: llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:22:03 +00:00
Alexei Starovoitov
ac73683b10 [bpf] add big- and host- endian support
Summary:
-march=bpf    -> host endian
-march=bpf_le -> little endian
-match=bpf_be -> big endian

Test Plan:
v1 was tested by IBM s390 guys and appears to be working there.
It bit rots too fast here.

Reviewers: chandlerc, tstellarAMD

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:15:05 +00:00
Benjamin Kramer
15df8bebdc [APInt] Remove special case for i1.
Add a unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 18:19:13 +00:00
Matt Arsenault
013ef59713 CodeGenPrepare: Provide address space to isLegalAddressingMode
Use -1 as the address space if it can't be determined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 16:17:38 +00:00
Daniel Sanders
6ff6fc6055 Replace string GNU Triples with llvm::Triple in MCAsmInfo subclasses and create*AsmInfo(). NFC.
Summary:
This is the first of several patches to eliminate StringRef forms of GNU
triples from the internals of LLVM. After this is complete, GNU triples
will be replaced by a more authoratitive representation in the form of
an LLVM TargetTuple.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: ted, llvm-commits, rengolin, jholewinski

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 13:12:25 +00:00
Peter Zotov
d34142ebf7 [C API] Add LLVMStructGetTypeAtIndex.
Patch by deadalnix (Amaury SECHET).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 09:09:53 +00:00
Craig Topper
71bb0e10c4 [TableGen] Replace a couple if/else chains with a switch. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 07:40:16 +00:00
Craig Topper
40c791eda9 [TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 07:40:12 +00:00
Rafael Espindola
cddcabadf2 Bring back r239006 with a fix.
The fix is just that getOther had not been updated for packing the st_other
values in fewer bits and could return spurious values:

-  unsigned Other = (getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
+  unsigned Other = (getFlags() & (0x7 << ELF_STO_Shift)) >> ELF_STO_Shift;

Original message:

Pack the MCSymbolELF bit fields into MCSymbol's Flags.

This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 05:59:23 +00:00
Rafael Espindola
64a82a3d70 Revert "Pack the MCSymbolELF bit fields into MCSymbol's Flags."
This reverts commit r239006.

I am debugging the powerpc failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 05:00:12 +00:00
Rafael Espindola
d90fd082f9 Pack the MCSymbolELF bit fields into MCSymbol's Flags.
This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239006 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 02:32:20 +00:00
Chandler Carruth
dc967a97df [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and
port it to the new pass manager.

All this does is extract the inner "location" class used by AA into its
own full fledged type. This seems *much* cleaner as MemoryDependence and
soon MemorySSA also use this heavily, and it doesn't make much sense
being inside the AA infrastructure.

This will also make it much easier to break apart the AA infrastructure
into something that stands on its own rather than using the analysis
group design.

There are a few places where this makes APIs not make sense -- they were
taking an AliasAnalysis pointer just to build locations. I'll try to
clean those up in follow-up commits.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 02:03:15 +00:00
Sanjay Patel
e4e5cf5a66 make reciprocal estimate code generation more flexible by adding command-line options (3rd try)
The first try (r238051) to land this was reverted due to ExecutionEngine build failure;
that was hopefully addressed by r238788.

The second try (r238842) to land this was reverted due to BUILD_SHARED_LIBS failure;
that was hopefully addressed by r238953.

This patch adds a TargetRecip class for processing many recip codegen possibilities.
The class is intended to handle both command-line options to llc as well
as options passed in from a front-end such as clang with the -mrecip option.

The x86 backend is updated to use the new functionality.
Only -mcpu=btver2 with -ffast-math should see a functional change from this patch.
All other x86 CPUs continue to *not* use reciprocal estimates by default with -ffast-math.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 01:32:35 +00:00
Rafael Espindola
c212856f78 Remove MCELFSymbolFlags.h. It is now internal to MCSymbolELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 00:47:43 +00:00
Alexey Samsonov
40ec40a179 [Object, MachO] Introduce MachOObjectFile::load_commands() range iterator.
Summary:
Now users don't have to manually deal with getFirstLoadCommandInfo() /
getNextLoadCommandInfo(), calculate the number of load segments, etc.

No functionality change.

Test Plan: regression test suite

Reviewers: rafael, lhames, loladiro

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238983 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 22:19:36 +00:00
Rafael Espindola
5eb7481d03 Remember if a weakref of a symbol has been used.
This avoids yet another last minute patching of the binding.

While at it, also simplify the weakref implementation a bit by not walking
past it in the expression evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238982 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:52:06 +00:00
Rafael Espindola
f3857c334f Store whether a symbol is a comdat signature in MCSymbolELF.
With this getBinging can now return the correct answer for all cases not
involving a .symver and the elf writer doesn't need to patch it last minute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:41:59 +00:00
Rafael Espindola
2b9f4dc654 Record in a MCSymbolELF if it has been used in a relocation.
No functionality change, just saves an on the side map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:30:10 +00:00
Rafael Espindola
96fdaa4f50 Convert BindingExplicitlySet into a MCSymbolELF field.
I will pack it better in a followup patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:18:03 +00:00
Rafael Espindola
4ce10b56e6 Remove getOrCreateSymbolData. There is no MCSymbolData anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 19:03:11 +00:00
Colin LeMahieu
4009e89061 [Hexagon] Reapply 238772 OSABI was not correctly set, added empty_elf test to make sure it is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238947 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 17:34:16 +00:00
Diego Novillo
e017a69163 Fix typo in comment. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238933 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:22:12 +00:00
Igor Laevsky
9bc6d84867 [Statepoints] Mark statepoint intrinsic with Throws attribute
Differential Revision: http://reviews.llvm.org/D10215



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:18:58 +00:00
Asaf Badouh
ce375dc63a re-apply 238809
AVX-512: Implemented GETEXP instruction for KNL and SKX
Added rounding mode modifier for SQRTPS/PD
Added tests for encoding and intrinsics.
CR:
http://reviews.llvm.org/D9991


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238923 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 13:41:48 +00:00
Daniel Sanders
b0e7aeb694 [arm] Distinguish the /U[qytnms]/, 'Uv', 'Q', and 'm' inline assembly memory constraints.
Summary:
But still handle them the same way since I don't know how they differ on
this target.

Of these, /U[qytnms]/ do not have backend tests but are accepted by clang.

No functional change intended.

Reviewers: t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, aemerson, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 12:33:56 +00:00
Rafael Espindola
a0bcb4184b Revert "make reciprocal estimate code generation more flexible by adding command-line options (2nd try)"
This reverts commit r238842.

It broke -DBUILD_SHARED_LIBS=ON build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:32:44 +00:00
Rafael Espindola
201a551929 Fix the interpretation of a 0 st_name.
The ELF spec is very clear:

-----------------------------------------------------------------------------
If the value is non-zero, it represents a string table index that gives the
symbol name. Otherwise, the symbol table entry has no name.
--------------------------------------------------------------------------

In particular, a st_name of 0 most certainly doesn't mean that the symbol has
the same name as the section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:14:22 +00:00
Rafael Espindola
8c7a0fd91a Move to llvm-objdump a large amount of code to that is only used there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 04:48:06 +00:00
Rafael Espindola
0ba7ba487d Clarify when we can avoid creating names for temp symbols.
Some temporary symbols are created by MC itself. These symbols are never used
for lookup and are never included in the object symbol table, so we can
avoid creating a name for them.

Other temporaries are created by CodeGen or by the user by explicitly asking
for a name starting with .L (or L on MachO).

These temporaries behave like regular symbols, we just try to avoid including
them in the object symbol table, but sometimes they end up there:

const char *foo() {
  return "abc" + 3;
}

will have a relocation pointing to a .L symbol.

It just so happens that almost all MC created temporary has the AlwaysAddSuffix
option and CodeGen/user created ones don't.

One interesting future optimization would be to use unnamed symbols for
all temporaries, but that would require use an st_name of 0 or
having the object writer create the names if a symbol does end up in the
symbol table.

No testcase since this just avoid creating a few extra names for MC created
temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238887 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 22:52:13 +00:00
Sanjoy Das
531270e663 [NFC] Fix spelling in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238884 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 22:33:39 +00:00
Sanjoy Das
e9609875ee [NFCI] Change RewriteStatepointsForGC to a ModulePass.
Summary:
A later change that has RewriteStatepointsForGC change function
attributes throughout the module depends on this.

Reviewers: reames, pgavlin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238882 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 22:33:34 +00:00
Rafael Espindola
4cc59a13c7 Pass a MCSymbolELF to a few ELF only functions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 21:30:13 +00:00
Rafael Espindola
569f382a46 Merge MCELF.h into MCSymbolELF.h.
Now that we have a dedicated type for ELF symbol, these helper functions can
become member function of MCSymbolELF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 20:38:46 +00:00
Benjamin Kramer
5a04f4af36 Push constness through LoopInfo::isLoopHeader and clean it up a bit.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 15:28:27 +00:00
Sanjay Patel
871beb8dd7 make reciprocal estimate code generation more flexible by adding command-line options (2nd try)
The first try (r238051) to land this was reverted due to bot failures
that were hopefully addressed by r238788.

This patch adds a TargetRecip class for processing many recip codegen possibilities.
The class is intended to handle both command-line options to llc as well
as options passed in from a front-end such as clang with the -mrecip option.

The x86 backend is updated to use the new functionality.
Only -mcpu=btver2 with -ffast-math should see a functional change from this patch.
All other x86 CPUs continue to *not* use reciprocal estimates by default with -ffast-math.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 15:28:15 +00:00
Rafael Espindola
9751e35f20 Simplify now that we always use an alignment of 2 for ELF files.
This saves 123144 bytes out of llvm-nm on powerpc64le.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 12:05:27 +00:00
Asaf Badouh
aa9e1c528b revert 238809
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238810 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 07:45:19 +00:00
Asaf Badouh
82fa06895e AVX-512: Implemented GETEXP instruction for KNL and SKX
Added rounding mode modifier for SQRTPS/PD
Added tests for encoding and intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238809 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 07:18:14 +00:00
Craig Topper
caa40ec228 [TableGen] Use range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 06:19:28 +00:00
Craig Topper
77c7578426 Fix typo in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 06:19:25 +00:00
Craig Topper
61f49542d7 [TableGen] Rename ListInit::getSize to just 'size' to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 04:15:57 +00:00
Rafael Espindola
f7e0685b9a Create a MCSymbolELF.
This create a MCSymbolELF class and moves SymbolSize since only ELF
needs a size expression.

This reduces the size of MCSymbol from 56 to 48 bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238801 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 00:25:12 +00:00
Jim Grosbach
398f175c45 MC: Tidy up LOH naming a bit. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238800 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 23:55:06 +00:00
Jim Grosbach
574635710f MC: Tidy up formatting a bit. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 23:55:02 +00:00
David Majnemer
3fcfa4873a [ADT] Add Triple::getEnvironmentVersion
This allows us to extract version numbers from the environment.
getOSVersion is currently overloaded for that purpose, this allows us to
clean it up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238796 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 23:38:09 +00:00
Owen Anderson
bd84bdb2be Move the name pointer out of Value into a map that lives on the
LLVMContext.  Production builds of clang do not set names on most
Value's, so this is wasted space on almost all subclasses of Value.
This reduces the size of all Value subclasses by 8 bytes on 64 bit
hosts.

The one tricky part of this change is averting compile time regression
by keeping Value::hasName() fast.  This required stealing bits out of
NumOperands.

With this change, peak memory usage on verify-uselistorder-nodbg.lto.bc
is decreased by approximately 2.3% (~3MB absolute on my machine).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238791 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 22:24:01 +00:00
Matthias Braun
fa2b7e5cb4 LiveRangeEdit: Fix liveranges not shrinking on subrange kill.
If a dead instruction we may not only have a last-use in the main live
range but also in a subregister range if subregisters are tracked. We
need to partially rebuild live ranges in both cases.

The testcase only broke when subregister liveness was enabled. I
commited it in the current form because there is currently no flag to
enable/disable subregister liveness.

This fixes PR23720.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238785 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 21:26:26 +00:00
Peter Collingbourne
3fcf5a99cb Make the C++ LTO API easier to use from C++ clients.
Start using C++ types such as StringRef and MemoryBuffer in the C++ LTO
API. In doing so, clarify the ownership of the native object file: the caller
now owns it, not the LTOCodeGenerator. The C libLTO library has been modified
to use a derived class of LTOCodeGenerator that owns the object file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238776 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 20:08:30 +00:00
Rafael Espindola
9be6a55ba0 Revert "[Hexagon] Adding basic ELF relocation generation and testing advanced relaxation codepath."
This reverts commit r238748.

It broke the msan bot:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/4372/steps/check-llvm%20msan/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 19:20:47 +00:00
Artur Pilipenko
d997435840 Add isConstant argument to MDBuilder::createTBAAStructTagNode
According to the TBAA description struct-path tag node can have an optional IsConstant field. Add corresponding argument to MDBuilder::createTBAAStructTagNode.

Reviewed By: hfinkel

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 14:53:55 +00:00
Colin LeMahieu
8a6a249f6b [Hexagon] Adding basic ELF relocation generation and testing advanced relaxation codepath.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238748 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 14:51:26 +00:00
Rafael Espindola
ba9e3285d0 The fragment implies the section, don't store both.
This reduces MCSymbol from 64 to 56 bytes on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 14:34:40 +00:00
Craig Topper
dd2a26fccb [TableGen] Move a couple virtual methods out of line so vtable anchors can be removed. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238727 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 06:44:18 +00:00
Craig Topper
f15cab13cb [TableGen] Remove unnecessary explicit initialization to null of a unique_ptr. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 06:44:16 +00:00
Craig Topper
ec93655812 [TableGen] Remove unnecessary forward declarations. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238725 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 06:44:14 +00:00
Matt Arsenault
5f3a6430d6 Add address space argument to isLegalAddressingMode
This is important because of different addressing modes
depending on the address space for GPU targets.

This only adds the argument, and does not update
any of the uses to provide the correct address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238723 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 05:31:59 +00:00
David Blaikie
d84c8ef1be [opaque pointer type] Explicitly store the pointee type of the result of a GEP
Alternatively, this type could be derived on-demand whenever
getResultElementType is called - if someone thinks that's the better
choice (simple time/space tradeoff), I'm happy to give it a go.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238716 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 03:09:34 +00:00
Rafael Espindola
223e58b67d Rename HasData to IsRegistered.
There is no MCSectionData, so the old name is now meaningless.

Also remove some asserts/checks that were there just because the information
they used was in MCSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:52:18 +00:00
Rafael Espindola
d1678240e5 Remove trivial forwarding function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238707 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:39:15 +00:00
Rafael Espindola
2dd8a67317 Store a bit in MCSection saying if it was registered with MCAssembler.
With this we can replace a SetVector with a plain std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:30:01 +00:00
Rafael Espindola
13950e506d Use a bitfield. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238705 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:05:07 +00:00
Rafael Espindola
2e20fdbfcb Use a 32 bit field for the symbol index.
Even 64 ELF uses a 32 bit field to refer to symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 00:58:31 +00:00
Rafael Espindola
481f35f113 Simplify another function that doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 00:27:26 +00:00
David Majnemer
75ce6bba4e [PHITransAddr] Don't translate unreachable values
Unreachable values may use themselves in strange ways due to their
dominance property.  Attempting to translate through them can lead to
infinite recursion, crashing LLVM.  Instead, claim that we weren't able
to translate the value.

This fixes PR23096.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238702 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 00:15:08 +00:00
Rafael Espindola
64afb8375d Simplify interface of function that doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 23:52:50 +00:00
Keno Fischer
23125c500f [DWARF] Fix a bug in line info handling
This fixes a bug in the line info handling in the dwarf code, based on a
problem I when implementing RelocVisitor support for MachO.
Since addr+size will give the first address past the end of the function,
we need to back up one line table entry. Fix this by looking up the
end_addr-1, which is the last address in the range. Note that this also
removes a duplicate output from the llvm-rtdyld line table dump. The
relevant line is the end_sequence one in the line table and has an offset
of the first address part the end of the range and hence should not be
included.
Also factor out the common functionality into a separate function.
This comes up on MachO much more than on ELF, since MachO
doesn't store the symbol size separately, hence making
said situation always occur.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 23:37:04 +00:00
Keno Fischer
dbdf667725 Add RelocVisitor support for MachO
This commit adds partial support for MachO relocations to RelocVisitor.
A simple test case is added to show that relocations are indeed being
applied and that using llvm-dwarfdump on MachO files no longer errors.
Correctness is not yet tested, due to an unrelated bug in DebugInfo,
which will be fixed with appropriate testcase in a followup commit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238663 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 19:44:53 +00:00
Colin LeMahieu
32de7d791e [MC] Allow backends to decide relaxation for unresolved fixups.
Differential Revision: http://reviews.llvm.org/D8217

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 18:42:22 +00:00
Benjamin Kramer
bfe3365795 [MC] Reorder MCSymbol members to reduce padding.
sizeof(MCSymbol) goes from 72 to 64 bytes on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 13:52:30 +00:00
Renato Golin
215bfbf9ea [ARMTargetParser] Move IAS arch ext parser. NFC
The plan was to move the whole table into the already existing ArchExtNames
but some fields depend on a table-generated file, and we don't yet have this
feature in the generic lib/Support side.

Once the minimum target-specific table-generated files are available in a
generic fashion to these libraries, we'll have to keep it in the ASM parser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238651 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 10:30:02 +00:00
Craig Topper
be43b88fae [TableGen] Merge RecTy::typeIsConvertibleTo and RecTy::baseClassOf. NFC
typeIsConvertibleTo was just calling baseClassOf(this) on the argument passed to it, but there weren't different signatures for baseClassOf so passing 'this' didn't really do anything interesting. typeIsConvertibleTo could have just been a non-virtual method in RecTy. But since that would be kind of a silly method, I instead re-distributed the logic from baseClassOf into typeIsConvertibleTo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238648 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 07:36:01 +00:00
Craig Topper
17246b12cf [TableGen] Remove all the variations of RecTy::convertValue and just handle the conversions in convertInitializerTo directly. This saves a bunch of vtable entries. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238646 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 07:34:51 +00:00
David Majnemer
e0d2a2939d [WinCOFF] Add support for the .safeseh directive
.safeseh adds an entry to the .sxdata section to register all the
appropriate functions which may handle an exception.  This entry is not
a relocation to the symbol but instead the symbol table index of the
function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 04:56:02 +00:00
Chandler Carruth
89a133960b [sdag] Add the helper I most want to the DAG -- building a bitcast
around a value using its existing SDLoc.

Start using this in just one function to save omg lines of code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238638 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 04:14:10 +00:00
Jim Grosbach
586c0042da MC: Clean up MCExpr naming. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 01:25:56 +00:00
Rafael Espindola
cfac75ad0e Remove getData.
This completes the mechanical part of merging MCSymbol and MCSymbolData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 21:45:01 +00:00
Rafael Espindola
5760c5fe31 Remove the MCSymbolData typedef.
The getData member function is next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:41:47 +00:00
Rafael Espindola
63e7baf8f6 Merge MCSymbol and MCSymbolData.
As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be
removing that in a second.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238609 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:31:23 +00:00
Rafael Espindola
f00654bc0f Rename getOrCreateSymbolData to registerSymbol and return void.
Another step in merging MCSymbol and MCSymbolData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238607 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:21:02 +00:00
Benjamin Kramer
9589ff8949 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:43:39 +00:00
Rafael Espindola
071c3df378 Move Flags from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:07:51 +00:00
Rafael Espindola
5b68a837c7 Pass MCSymbols to the helper functions in MCELF.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:47:23 +00:00
Rafael Espindola
f021547d33 Use an explicitly defaulted constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238591 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:31:17 +00:00
Rafael Espindola
e97d937576 Pass a MCSymbol to needsRelocateWithSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:26:09 +00:00
Frederic Riss
9282af9d6c [YAMLIO] Make line-wrapping configurable and test it.
Summary:
We would wrap flow mappings and sequences when they go over a hardcoded 70
characters limit. Make the wrapping column configurable (and default to 70
co the change should be NFC for current users). Passing 0 allows to completely
suppress the wrapping which makes it easier to handle in tools like FileCheck.

Reviewers: bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:56:28 +00:00
Rafael Espindola
82fdcc0e7f Move common symbol related information from MCSectionData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:48:04 +00:00
Rafael Espindola
052a7becbe Store MCSymbols in PendingLabels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:41:59 +00:00
Rafael Espindola
28afbf2421 Move SymbolSize from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:24:52 +00:00
Jingyue Wu
ed0d841f59 [DependenceAnalysis] Extend unifySubscriptType for handling coupled subscript groups.
Summary:
In continuation to an earlier commit to DependenceAnalysis.cpp by jingyue (r222100), the type for all subscripts in a coupled group need to be the same since constraints from one subscript may be propagated to another during testing. During testing, new SCEVs may be created and the operands for these need to be the same.
This patch extends unifySubscriptType() to work on lists of subscript pairs, ensuring a common extended type for all of them.

Test Plan:
Added a test case to NonCanonicalizedSubscript.ll which causes dependence analysis to crash without this fix.

All regression tests pass.

Reviewers: spop, sebpop, jingyue

Reviewed By: jingyue

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238573 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 16:58:08 +00:00
Craig Topper
60bc0ab340 [TableGen] Remove convertValue functions for UnOpInit, BinOpInit, and TernOpInit as they weren't able to be called.
I don't think converting the inputs to the Ops was the right behavior anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 05:51:32 +00:00
Matthias Braun
e67bd6c248 CodeGen: Use mop_iterator instead of MIOperands/ConstMIOperands
MIOperands/ConstMIOperands are classes iterating over the MachineOperand
of a MachineInstr, however MachineInstr::mop_iterator does the same
thing.

I assume these two iterators exist to have a uniform interface to
iterate over the operands of a machine instruction bundle and a single
machine instruction. However in practice I find it more confusing to have 2
different iterator classes, so this patch transforms (nearly all) the
code to use mop_iterators.

The only exception being MIOperands::anlayzePhysReg() and
MIOperands::analyzeVirtReg() still needing an equivalent, I leave that
as an exercise for the next patch.

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

This version is slightly modified from the proposed revision in that it
introduces MachineInstr::getOperandNo to avoid the extra counting
variable in the few loops that previously used MIOperands::getOperandNo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 02:56:46 +00:00
Matthias Braun
97c5de758a MachineFrameInfo: Simplify pristine register calculation.
About pristine regsiters:
Pristine registers "hold a value that is useless to the current
function, but that must be preserved - they are callee saved registers
that have not been saved." This concept saves compile time as it frees
the prologue/epilogue inserter from adding every such register to every
basic blocks live-in list.

However the current code in getPristineRegs is formulated in a
complicated way: Inside the function prologue and epilogue all callee
saves are considered pristine, while in the rest of the code only the
non-saved ones are considered pristine.  This requires logic to
differentiate between prologue/epilogue and the rest and in the presence
of shrink-wrapping this even becomes complicated/expensive.  It's also
unnecessary because the prologue epilogue inserters already mark
callee-save registers that are saved/restores properly in the respective
blocks in the prologue/epilogue (see updateLiveness() in
PrologueEpilogueInserter.cpp). So only declaring non-saved/restored
callee saved registers as pristine just works.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 23:20:35 +00:00
Alex Lorenz
3682046086 MIR Serialization: print and parse machine function names.
This commit introduces a serializable structure called
'llvm::yaml::MachineFunction' that stores the machine
function's name. This structure will mirror the machine 
function's state in the future.

This commit prints machine functions as YAML documents
containing a YAML mapping that stores the state of a machine
function. This commit also parses the YAML documents
that contain the machine functions.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:41:12 +00:00
Chris Bieneman
e53c28ad5b Fixing broken bots after r238505.
Need non-const iterator inserts too. These failures seem to be due to differences in the versions of libstdc++ on various operating systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238516 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:18:34 +00:00
Reid Kleckner
5f50442d79 [WinEH] Start inserting state number stores for C++ EH
This moves all the state numbering code for C++ EH to WinEHPrepare so
that we can call it from the X86 state numbering IR pass that runs
before isel.

Now we just call the same state numbering machinery and insert a bunch
of stores. It also populates MachineModuleInfo with information about
the current function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:00:24 +00:00
Chris Bieneman
9cc5055248 Fixing the polly build.
I broke the polly build in r238505. This fixes the failure by adding non-const iterator erase methods to cl::list_storage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238509 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:51:52 +00:00
Rafael Espindola
9886da621d Remove a trivial forwarding function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:36:02 +00:00
Chris Bieneman
d9f97d149f Re-landing "Refactoring cl::list_storage from "is a" to "has a" std::vector."
Originally landed r238485

MSVC resolves identifiers differently from Clang and GCC, this resulted in build bot failures. This pach re-lands r238485 and fixes the build failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238505 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:31:22 +00:00
Chris Bieneman
34aecd4f40 Revert "Refactoring cl::list_storage from "is a" to "has a" std::vector."
This reverts commit 117715ca06.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238491 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:47:02 +00:00
Chris Bieneman
117715ca06 Refactoring cl::list_storage from "is a" to "has a" std::vector.
Summary: This isn't necessarily an ideal change, and I want to at least reduce the API surface area, but for the new API we really shouldn't be relying on cl::list being a std::vector.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238485 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:38:12 +00:00
Alexey Samsonov
8ecf661ef1 Object, ELF: Use error code instead of calling report_fatal_error()
Make createELFObjectFile() return object_error::parse_failed on
encountering invalid ELF file, instead of crashing the program.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:25:42 +00:00
Duncan P. N. Exon Smith
2c7cce70cd AsmPrinter: Stop exposing underlying DIE children list, NFC
Update `DIE` API to hide the implementation of `DIE::Children` so we can
swap it out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238468 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:56:34 +00:00
Pete Cooper
40d9379cd5 Add BranchProbabilityInfo::releaseMemory to clear the Weights field.
BranchProbabilityInfo was leaking 3MB of memory when running 'opt -O2 verify-uselistorder.lto.bc'.  This was due to the Weights member not being cleared once the pass is no longer needed.

This adds the releaseMemory override to clear that field.  The other fields are cleared at the end of runOnFunction so can stay there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238462 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:43:06 +00:00
Duncan P. N. Exon Smith
bfecc6bdee AsmPrinter: Rename begin_values() => values_begin(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238456 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:55:38 +00:00
Colin LeMahieu
58dd70dced [llvm] Parameterizing the output stream for dumpbytes and outputting directly to stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:50 +00:00
Owen Anderson
2f6ca834ff Add support for the convergent flag at the MC and MachineInstr levels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:33:39 +00:00
Duncan P. N. Exon Smith
3899951490 AsmPrinter: Suppress warnings on GCC from r238362, NFC
GCC seems to have some overzealous warnings about strict aliasing.
Rafael reports that this patch suppresses them on GCC 4.9, and I'm
hoping this will work for GCC 4.7 as well.  I'll watch [1] and iterate
if necessary.

[1]: http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/8597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:09:13 +00:00
Rafael Espindola
fd64e0f71a Use range loops for accessing file names. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:03:20 +00:00
Owen Anderson
ca67e337bf Expand the Flags field of MCInstrDesc to 64 bits, while simultaneously
shrinking the Size and NumDefs fields to offset the size growth, and
reordering the fields to preserve a good packing.

This is necessary in the short term for adding a convergent flag, and
simultaneously future-proofs us against more flags being added in the
future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238445 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:03:07 +00:00
Ed Maste
5d25204af9 DebugInfo: .debug_line DWARF64 support
This adds support for the 64-bit DWARF format, but is still limited to
less than 4GB of debug data by the DataExtractor class.  Some versions
of the GNU MIPS toolchain generate 64-Bit DWARF even though it isn't
actually necessary.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 15:38:17 +00:00
Renato Golin
6952e75aa5 [ARMTargetParser] Adding sub-arch information for Clang. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 15:05:18 +00:00
Renato Golin
1af0c40934 [ARMTargetParser] Adding a few more CPUs for Clang CPU detection. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 12:10:37 +00:00
Chandler Carruth
ba80ee7307 [omp] Add a configuration variable for the default OpenMP runtime.
This will be used in my next commit to Clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238388 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 01:47:22 +00:00
Duncan P. N. Exon Smith
59be554de4 AsmPrinter: Return added DIE from DIE::addChild()
Change `DIE::addChild()` to return a reference to the just-added node,
and update consumers to use it directly.  An upcoming commit will
abstract away (and eventually change) the underlying storage of
`DIE::Children`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238372 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:59:03 +00:00
Duncan P. N. Exon Smith
636aba5bd1 AsmPrinter: Stop exposing underlying DIEValue list, NFC
Change the `DIE` API to hide the implementation of the list of
`DIEValue`s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:44:06 +00:00
Duncan P. N. Exon Smith
611a2f2322 AsmPrinter: Store abbreviation data directly in DIE and DIEValue
Stop storing a `DIEAbbrev` in `DIE`, since the data fits neatly inside
the `DIEValue` list.  Besides being a cleaner data structure (avoiding
the parallel arrays), this gives us more freedom to rearrange the
`DIEValue` list.

This fixes the temporary memory regression from 845 MB up to 879 MB, and
drops it further to 829 MB for a net memory decrease of around 1.9%
(incremental decrease around 5.7%).

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238364 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:31:41 +00:00
Duncan P. N. Exon Smith
09fe4bf794 Reapply "AsmPrinter: Change DIEValue to be stored by value"
This reverts commit r238350, effectively reapplying r238349 after fixing
(all?) the problems, all somehow related to how I was using
`AlignedArrayCharUnion<>` inside `DIEValue`:

  - MSVC can only handle `sizeof()` on types, not values.  Change the
    assert.
  - GCC doesn't know the `is_trivially_copyable` type trait.  Instead of
    asserting it, add destructors.
  - Call placement new even when constructing POD (i.e., the pointers).
  - Instead of copying the char buffer, copy the casted classes.

I've left in a couple of `static_assert`s that I think both MSVC and GCC
know how to handle.  If the bots disagree with me, I'll remove them.

  - Check that the constructed type is either standard layout or a
    pointer.  This protects against a programming error: we really want
    the "small" `DIEValue`s to be small and simple, so don't
    accidentally change them not to be.
  - Similarly, check that the size of the buffer is no bigger than a
    `uint64_t` or a pointer.  (I thought checking against
    `sizeof(uint64_t)` would be good enough, but Chandler suggested that
    pointers might sometimes be bigger than that in the context of
    sanitizers.)

I've also committed r238359 in the meantime, which introduces a
DIEValue.def to simplify dispatching between the various types (thanks
to a review comment by David Blaikie).  Without that, this commit would
be almost unintelligible.

Here's the original commit message:
--
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:14:58 +00:00
Duncan P. N. Exon Smith
344593ce6c AsmPrinter: Introduce DIEValue.def, NFC
Use a .def macro file to iterate through the various subclasses of
`DIEValue`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238359 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 21:15:43 +00:00
Rafael Espindola
792e158397 Rename and move getCurrentSectionData.
I think this concludes the merge of MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 21:04:14 +00:00
Rafael Espindola
41cea417fa There is only one current section.
Both MCStreamer and MCObjectStreamer were maintaining a current section
variable and they were slightly out of sync. I don't think this was observable,
but was inefficient and error prone.

Changing this requires a few cascading changes:

* SwitchSection has to call ChangeSection earlier for ChangeSection to see
  the old section.
* With that change, ChangeSection cannot call EmitLabel, since during
  ChangeSection we are still in the old section.
* When the object streamer requires a begin label, just reused the existing
  generic support for begin labels instead of calling EmitLabel directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 20:52:32 +00:00
Duncan P. N. Exon Smith
3c41ae83f2 Revert "AsmPrinter: Change DIEValue to be stored by value"
This reverts commit r238349, since it caused some errors on bots:
  - std::is_trivially_copyable isn't available until GCC 5.0.
  - It was complaining about strict aliasing with my use of
    ArrayCharUnion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:30:27 +00:00
Duncan P. N. Exon Smith
b9d92c6a8d AsmPrinter: Change DIEValue to be stored by value
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:22:50 +00:00
Duncan P. N. Exon Smith
3e7c30ada1 AsmPrinter: Reorganize DIE.h, NFC
An upcoming commit will switch to storing `DIEValue`s by value in a
`DIE`, so move the `DIE` down below all the subclasses it can.  Two
subclasses inherit from `DIE`, so drop those down below `DIE`.

`DIEValue` will become a discriminated union, which contains an instance
of one of the classes that are currently subclasses.  "Big" ones, such
as those that inherit from `DIE`, will continue to be stored by pointer.
This commit does as much of the code motion ahead of time as possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 18:49:38 +00:00
Renato Golin
a052a77187 ARMTargetParser: Normalising build attributes
Now that most of the methods in Clang and LLVM that were parsing arch/cpu/fpu
strings are using ARMTargetParser, it's time to make it a bit more conforming
with what the ABI says.

This commit adds some clarification on what build attributes are accepted and
which are "non-standard". It also makes clear that the "defaultCPU" and
"defaultArch" methods were really just build attribute getters.

It also diverges from GCC's behaviour to say that armv2/armv3 are really an
ARMv4 in the build attributes, when the ABI has a clear state for that: Pre-v4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238344 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 18:15:37 +00:00
Alex Lorenz
61aecc8c23 Resubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format).
This commit a 3rd attempt at comitting the initial MIR serialization patch.
The first commit (r237708) was reverted in 237730. Then the second commit
(r237954) was reverted in r238007, as the MIR library under CodeGen caused
a circular dependency where the CodeGen library depended on MIR and MIR
library depended on CodeGen.

This commit has fixed the dependencies between CodeGen and MIR by
reorganizing the MIR serialization code - the code that prints out
MIR has been moved to CodeGen, and the MIR library has been renamed
to MIRParser. Now the CodeGen library doesn't depend on the
MIRParser library, thus the circular dependency no longer exists.

--Original Commit Message--

MIR Serialization: print and parse LLVM IR using MIR format.

This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR
using the MIR format. This pass is then added as a last pass when a
'stop-after' option is used in llc. The new library adds the initial
functionality for parsing of MIR files as well. This commit also
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238341 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 18:02:19 +00:00
Rafael Espindola
899cab6126 Delete MCSectionData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 15:14:11 +00:00
Rafael Espindola
b167996819 Delete dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:55:09 +00:00
Rafael Espindola
919ce81d38 Move getSubsectionInsertionPoint to MCSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 13:37:28 +00:00
Chandler Carruth
8be6039072 Revert r238305: [PM] Use a simpler technique to drop optional analysis
manager arguments...

I have no idea why, but compilers seem to hate this and its late, so I'm
not going to debug it. :: sigh :: This is why we can't have nice things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238306 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 09:36:33 +00:00
Chandler Carruth
910146c989 [PM] Use a simpler technique to drop optional analysis manager arguments
when invoking run methods.

This technique was suggested by Dinesh Dwivedi who also wrote the
original patch. During the code review, they explained to me that this
isn't a fully general technique as we need to know the signatures of the
method candidates. Since this is really a narrower utility, I switched
the names and structure to be more clearly a specialized run method
invoke helper and commented it accordingly. I still think this is
a pretty big win.

Very sorry to Dinesh for the extreme delay in landing this patch. I've
been far to busy poking at other things.

Original review: http://reviews.llvm.org/D3543

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 09:02:51 +00:00
Daniel Sanders
3a9cbffdcb Revert r238190 and r238197: [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
This broke the llvm-mips-linux builder and several of our out-of-tree builders.
Initial investigations show that the commit probably isn't the problem but
reverting anyway while I investigate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238302 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 08:44:01 +00:00
Quentin Colombet
bdfc11784b [ShrinkWrap] Add a target hook to check whether or not
the target can handle a given basic block as prologue
or epilogue.

Related to <rdar://problem/20821487>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 06:25:48 +00:00
Matthias Braun
f5b4273058 MachineBasicBlock: Cleanup computeRegisterLiveness()
- Clean documentation comment
- Change the API to accept an iterator so you can actually pass
  MachineBasicBlock::end() now.
- Add more "const".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238288 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 05:12:39 +00:00
Rui Ueyama
e498b5094c Object/COFF: Add accessors for import header bitfields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 02:55:04 +00:00
Rui Ueyama
7306f3b6f5 Object/COFF: Add coff_import_header.
This type is described in the PE/COFF spec section 7.1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 02:40:20 +00:00
Owen Anderson
13146c7e3b Add initial support for the convergent attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 23:48:40 +00:00
Rafael Espindola
116e31ffbe clang-format TargetRegistry.h. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238255 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 21:18:29 +00:00
Philip Reames
d59f970668 [PlaceSafepoints] Cleanup InsertSafepointPoll function
While working on another change, I noticed that the naming in this function was mildly deceptive.  While fixing that, I took the oppurtunity to modernize some of the code.  NFC intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 21:03:23 +00:00
Rui Ueyama
30244cec4f Object/COFF: Add COFFSymbolRef::isAbsolute().
COFFSymbolRef has many predicates, like isCommon() or
isExternal(), but this predicate was missing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 20:25:30 +00:00
Akira Hatanaka
6f49135066 Remove NoFramePointerElim and NoFramePointerElimOverride from TargetOptions and
remove ExecutionEngine's dependence on CodeGen. NFC.

This is a follow-up to r238080.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238244 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 20:17:20 +00:00
Matt Arsenault
69dd37580c Make EmitFunctionHeader virtual
This is to fix problems introduced by r232481. For HSAIL,
this function does essentially nothing desirable, and
injects unwanted / incorrect stuff before the function.
The only thing it really needs to do is call EmitFunctionEntryLabel
in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 17:33:15 +00:00
Rui Ueyama
013041ad5c Object/COFF: Define .idata import directory table entry.
This data type is described in the Microsoft PE/COFF spec rev. 8.3 5.4.1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238214 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 16:24:42 +00:00
Rui Ueyama
5a22e848da Object: Add Archive::getNumberOfSymbols().
Add a function that returns number of symbols in archive headers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238213 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 16:20:40 +00:00
Tom Stellard
75775939fa AsmMatcherEmitter: Add an option to override custom converters for InstAlias
If there is an InstAlias defined for an instruction that had a custom
converter (AsmMatchConverter), then when the alias is matched,
the custom converter will be used rather than the converter generated
by the InstAlias.

This patch adds the UseInstAsmMatchConverter field to the InstAlias
class, which allows you to override this behavior and force the
converter generated by the InstAlias to be used.

This is required for some future improvemnts to the R600 assembler.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 15:55:50 +00:00
Rafael Espindola
b14ebd6a1d Replace getOrCreateSectionData with registerSection.
There is now no SectionData to be created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238208 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 15:07:25 +00:00
Rafael Espindola
9ec47b85c7 Remove dead forward declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 14:51:03 +00:00
Rafael Espindola
7ff8c5c348 Have getCurrentSectionData return a MCSection.
I will fix the name shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 14:48:11 +00:00
Daniel Sanders
9ed9b04cea Fix warning introduced in r238190 about lack of virtual destructor in MCObjectFileInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238197 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 12:25:36 +00:00
Michael Kuperstein
d714fcf5c8 Use std::bitset for SubtargetFeatures.
Previously, subtarget features were a bitfield with the underlying type being uint64_t. 
Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset.
No functional change.

The first several times this was committed (e.g. r229831, r233055), it caused several buildbot failures.
Apparently the reason for most failures was both clang and gcc's inability to deal with large numbers (> 10K) of bitset constructor calls in tablegen-generated initializers of instruction info tables. 
This should now be fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 10:47:10 +00:00
Daniel Sanders
bda72d8098 [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

This commit uses DW_EH_PE_sdata8 for N64 as far as is possible at the moment.
However, it is possible to end up with DW_EH_PE_sdata4 when a TargetMachine is
not available. There's no risk of issues with inconsistency here since the
tables are self describing but it does mean there is a small chance of the
PC-relative offset being out of range for particularly large programs.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 10:19:18 +00:00
Simon Atanasyan
eda9f8aa74 [mips] Move some structures represent MIPS specific ELF sections from LLD to LLVM
That allows to reuse the code in other tools like llvm-readobj etc.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238188 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 08:48:14 +00:00
Craig Topper
d60caada8b [TableGen] Remove unnecessary include and just forward declare. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238179 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 06:48:43 +00:00
Rafael Espindola
2224f64c6d Remove most uses of MCSectionData from MCAssembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238172 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 02:17:21 +00:00
Rafael Espindola
ea3533b4c6 Stop using MCSectionData in MCAsmLayout.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 02:00:36 +00:00
Rafael Espindola
369611994b Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238168 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 01:56:56 +00:00
Rafael Espindola
1826cd69f3 Stop using MCSectionData in MCMachObjectWriter.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 01:15:30 +00:00
Rafael Espindola
5c84463094 Remove dead forward declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238164 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:55:28 +00:00
Rafael Espindola
504473e6ae Stop using MCSectionData in MCExpr.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:52:18 +00:00
Rafael Espindola
f363960679 Return a MCSection from MCFragment::getParent().
Another step in merging MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 00:36:57 +00:00
Rafael Espindola
68e7d22de4 Store a MCSection in MCFragment.
Part of the work to merge MCSectionData into MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 23:48:22 +00:00