1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

53618 Commits

Author SHA1 Message Date
Chris Lattner
84f83c2727 enhance jump threading to preserve TBAA information when PRE'ing loads,
fixing rdar://11039258, an issue that came up when inspecting clang's 
bootstrapped codegen.

llvm-svn: 152635
2012-03-13 18:07:41 +00:00
Dan Gohman
fa43b599ac Teach globalopt how to evaluate an invoke with a non-void return type.
llvm-svn: 152634
2012-03-13 18:01:37 +00:00
Duncan Sands
60c339c405 Generalize the "trunc(ptrtoint(x)) - trunc(ptrtoint(y)) ->
trunc(ptrtoint(x-y))" optimization introduced by Chandler.

llvm-svn: 152626
2012-03-13 14:07:05 +00:00
Duncan Sands
9931da5d8d Uniformize the InstructionSimplify interface by ensuring that all routines
take a TargetLibraryInfo parameter.  Internally, rather than passing TD, TLI
and DT parameters around all over the place, introduce a struct for holding
them.

llvm-svn: 152623
2012-03-13 11:42:19 +00:00
Eli Bendersky
18a6065211 Add profiling support for Intel Parallel Amplifier XE (VTune) for JITted code in LLVM.
Also refactor the existing OProfile profiling code to reuse the same interfaces with the VTune profiling code.
In addition, unit tests for the profiling interfaces were added.

This patch was prepared by Andrew Kaylor and Daniel Malea, and reviewed in the llvm-commits list by Jim Grosbach

llvm-svn: 152620
2012-03-13 08:33:15 +00:00
Bill Wendling
c5e906092b Add a return type.
llvm-svn: 152614
2012-03-13 05:52:28 +00:00
Bill Wendling
a77901b3ba Inline the d'tor and add an anchor instead.
llvm-svn: 152613
2012-03-13 05:51:56 +00:00
Bill Wendling
2cbe0fc313 Refactor the SelectionDAG's 'dump' methods into their own .cpp file.
No functionality change.

llvm-svn: 152611
2012-03-13 05:47:27 +00:00
Lang Hames
19d04fbc96 Fixed typo in comment.
llvm-svn: 152610
2012-03-13 05:43:30 +00:00
Eli Friedman
77682009bc Fix regression from r151466: an we can't replace uses of an instruction reachable from the entry block with uses of an instruction not reachable from the entry block. PR12231.
llvm-svn: 152595
2012-03-13 01:06:07 +00:00
Chandler Carruth
ce889fff68 Address some review comments from Duncan. This moves the iterative
offset accumulation to use a boring APInt instead of ConstantExprs.
I didn't go all the way to an 'int64_t' because I wanted APInt to handle
any magic required to properly wrap the arithmetic when the pointer
width is <64 bits. If there is a significant penalty from using APInt
here, first off WTF, and secondly let me know and I'll do the math by
hand.

I've left one layer still operating w/ ConstantExpr because it makes the
interface quite a bit simpler, and that one isn't iterative so has much
lower cost.

I suppose this may potentially speed up some strang compilation
situations, but I don't really expect much. It should have no functional
impact either way.

llvm-svn: 152590
2012-03-13 00:06:15 +00:00
Kevin Enderby
9f26c75ab5 Added a missing error check for X86 assembly with mismatched base and index
registers not both being 64-bit or both being 32-bit registers.

llvm-svn: 152580
2012-03-12 21:32:09 +00:00
Benjamin Kramer
a3a97e8220 Inline a trivial helper function.
llvm-svn: 152577
2012-03-12 21:18:53 +00:00
Bill Wendling
c2b6b0d28b Revert due to nightly test failures.
--- Reverse-merging r152486 into '.':
U    lib/CodeGen/SjLjEHPrepare.cpp

llvm-svn: 152571
2012-03-12 20:19:41 +00:00
Chandler Carruth
015ff468c2 When inlining a function and adding its inner call sites to the
candidate set for subsequent inlining, try to simplify the arguments to
the inner call site now that inlining has been performed.

The goal here is to propagate and fold constants through deeply nested
call chains. Without doing this, we loose the inliner bonus that should
be applied because the arguments don't match the exact pattern the cost
estimator uses.

Reviewed on IRC by Benjamin Kramer.

llvm-svn: 152556
2012-03-12 11:19:33 +00:00
Chandler Carruth
d1c1c98162 Teach instsimplify how to constant fold pointer differences.
Typically instcombine has handled this, but pointer differences show up
in several contexts where we would like to get constant folding, and
cannot afford to run instcombine. Specifically, I'm working on improving
the constant folding of arguments used in inline cost analysis with
instsimplify.

Doing this in instsimplify implies some algorithm changes. We have to
handle multiple layers of all-constant GEPs because instsimplify cannot
fold them into a single GEP the way instcombine can. Also, we're only
interested in all-constant GEPs. The result is that this doesn't really
replace the instcombine logic, it's just complimentary and focused on
constant folding.

Reviewed on IRC by Benjamin Kramer.

llvm-svn: 152555
2012-03-12 11:19:31 +00:00
Duncan Sands
280a43349c Don't cast away constant qualifier.
llvm-svn: 152553
2012-03-12 10:51:06 +00:00
Bob Wilson
a0d2185fe0 Switch to unified syntax for VFP instructions in inline assembly.
<rdar://problem/11024696>

llvm-svn: 152548
2012-03-12 06:15:36 +00:00
Benjamin Kramer
6c8c4afc05 Replace a hand-coded leading one counting loop with the magic from MathExtras.h.
llvm-svn: 152545
2012-03-11 19:32:35 +00:00
Benjamin Kramer
702df4f3ee Remove global map. This code isn't even hot.
llvm-svn: 152544
2012-03-11 18:12:04 +00:00
Benjamin Kramer
c798b7be6d DwarfDebug: Store the filename/dirname pair as a zero-separated string in a stringmap, instead of using a highly inefficient std::map of a pair of std::strings.
llvm-svn: 152541
2012-03-11 14:56:26 +00:00
Craig Topper
df2bf795d6 Convert more static tables of registers used by calling convention to uint16_t to reduce space.
llvm-svn: 152538
2012-03-11 07:57:25 +00:00
Craig Topper
c83a2b1ac0 Use uint16_t to store registers and opcode in static tables in the target specific backends.
llvm-svn: 152537
2012-03-11 07:16:55 +00:00
Craig Topper
682445688d Remove unused functions getArgRegs and getNumArgRegs.
llvm-svn: 152535
2012-03-11 06:46:40 +00:00
Stepan Dyatkovskiy
72fdcabd4d llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.

llvm-svn: 152532
2012-03-11 06:09:17 +00:00
Michael J. Spencer
69772efcb2 Make StringRef::getAsInteger work with all integer types. Before this change
it would fail with {,u}int64_t on x86-64 Linux.

This also removes code duplication.

llvm-svn: 152517
2012-03-10 23:02:54 +00:00
Benjamin Kramer
e68be7638b Make helper static, so it can be inlined into its sole caller.
llvm-svn: 152515
2012-03-10 22:41:06 +00:00
Kay Tiong Khoo
aaa4140718 *fix typo in comment; test of commit access
llvm-svn: 152507
2012-03-10 21:29:49 +00:00
Bill Wendling
59ed3a53a6 As Duncan pointed out, pointers tend not to be in floating point format...for now.
llvm-svn: 152499
2012-03-10 18:20:55 +00:00
Bill Wendling
5f16e35eed Make this transformation slightly less agressive and more correct.
The 'CmpInst::isFalseWhenEqual' function returns 'false' for values other than
simply equality. For instance, it returns 'false' for <= or >=. This isn't the
correct behavior for this transformation, which is checking for strict equality
and non-equality. It was causing the gcc.c-torture/execute/frame-address.c test
to fail because it would completely (and incorrectly) optimize a whole function
into a 'ret i32 0'.

llvm-svn: 152497
2012-03-10 17:56:03 +00:00
Benjamin Kramer
ae4fd1b853 C files in llvm still have to be C89 compliant, remove C++-style comments.
llvm-svn: 152495
2012-03-10 15:10:06 +00:00
Benjamin Kramer
534acfa94f Microoptimize getVRegDef. def_begin isn't free, don't compute it twice.
llvm-svn: 152492
2012-03-10 12:50:44 +00:00
Chandler Carruth
a4cd27625a Refactor some methods to look through bitcasts and GEPs on pointers into
a common collection of methods on Value, and share their implementation.
We had two variations in two different places already, and I need the
third variation for inline cost estimation.

Reviewed by Duncan Sands on IRC, but further comments here welcome.

llvm-svn: 152490
2012-03-10 08:39:09 +00:00
Bill Wendling
1a3f2619a7 Fix disasm of iret, sysexit, and sysret when displayed with Intel syntax.
Patch by Kay Tiong Khoo!

llvm-svn: 152487
2012-03-10 07:37:27 +00:00
Bill Wendling
1e68fbcdae Implement a more intelligent way of spilling uses across an invoke boundary.
The old way of determine when and where to spill a value that was used inside of
a landing pad resulted in spilling that value everywhere and not just at the
invoke edge.

This algorithm determines which values are used within a landing pad. It then
spills those values before the invoke and reloads them before the uses. This
should prevent excessive spilling in many cases, e.g. inside of loops.
<rdar://problem/10609139>

llvm-svn: 152486
2012-03-10 07:11:55 +00:00
Jakob Stoklund Olesen
ee9a75c67f Report the defining instruction.
llvm-svn: 152460
2012-03-10 00:44:11 +00:00
Jakob Stoklund Olesen
5c3128acf6 Add SSA verification to MachineVerifier.
Somehow we never verified SSA dominance before.

llvm-svn: 152458
2012-03-10 00:36:06 +00:00
Jakob Stoklund Olesen
5c58e991c5 Use SmallPtrSet instead of DenseSet.
llvm-svn: 152457
2012-03-10 00:36:04 +00:00
Benjamin Kramer
d2881e4edc Give dagcombiner's worklist some inline capacity.
llvm-svn: 152454
2012-03-10 00:23:58 +00:00
Akira Hatanaka
8cbaf16390 Do not custom lower i64 nodes if i64 is not a legal type. Move lines that set
operation action of nodes.

llvm-svn: 152452
2012-03-10 00:03:50 +00:00
Akira Hatanaka
93f6fbc38b Lower SETCC nodes during legalization. Previously, it was lowered in DAG combine pass.
llvm-svn: 152450
2012-03-09 23:46:03 +00:00
Jakob Stoklund Olesen
b89fca5c5a Assert on SSA errors in LiveVariables.
All uses of a virtual register must be dominated by its def.

llvm-svn: 152449
2012-03-09 23:41:44 +00:00
Akira Hatanaka
8d12a0fbf8 Remove unused header files.
llvm-svn: 152447
2012-03-09 23:28:30 +00:00
Andrew Trick
d1d69201aa misched: handle scheduler that insert instructions at empty region boundaries.
And add comments, since this is obviously confusing.

llvm-svn: 152445
2012-03-09 22:34:56 +00:00
Kevin Enderby
15f974a5a4 Add the missing call to Error when a bad X86 scale expression is parsed.
llvm-svn: 152443
2012-03-09 22:24:10 +00:00
David Meyer
c6de5a081b [Object]
Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big

llvm-svn: 152435
2012-03-09 20:41:57 +00:00
Duncan Sands
0a3403af6e Add statistics on removed switch cases, and fix the phi statistic
to count the number of phis changed, not the number visited.

llvm-svn: 152425
2012-03-09 19:21:15 +00:00
Dan Gohman
784659a39f When identifying exit nodes for the reverse-CFG reverse-post-order
traversal, consider nodes for which the only successors are backedges
which the traversal is ignoring to be exit nodes. This fixes a problem
where the bottom-up traversal was failing to visit split blocks along
split loop backedges. This fixes rdar://10989035.

llvm-svn: 152421
2012-03-09 18:50:52 +00:00
Kevin Enderby
1a3b6570f8 Fix the x86 disassembler to at least print the lock prefix if it is the first
prefix.  Added a FIXME to remind us this still does not work when it is not the
first prefix.

llvm-svn: 152414
2012-03-09 17:52:49 +00:00
Duncan Sands
8139573edf Eliminate switch cases that can never match, for example removes all
negative switch cases if the branch condition is known to be positive.
Inspired by a recent improvement to GCC's VRP.

llvm-svn: 152405
2012-03-09 13:45:18 +00:00
Anton Korobeynikov
906cbb66d3 Add support for r600 (AMD GPUs HD2XXX - HD6XXX) target triplet.
Patch by Tom Stellard!

llvm-svn: 152400
2012-03-09 10:09:36 +00:00
Nick Lewycky
a2fe9e0d87 Factor out the analysis of addition and subtraction in ComputeMaskedBits. Reuse
it to analyze extractvalue(llvm.[us](add|sub).with.overflow.*) intrinsics!

llvm-svn: 152398
2012-03-09 09:23:50 +00:00
Andrew Trick
3e325de8e9 misched: handle scheduling region boundaries nicely.
llvm-svn: 152393
2012-03-09 08:02:51 +00:00
Craig Topper
3dee24b8c3 Use uint16_t to store opcodes in static tables in X86 backend.
llvm-svn: 152391
2012-03-09 07:45:21 +00:00
Ahmed Charles
cc93a16f47 Fix undefined behavior in the Mips backend.
llvm-svn: 152390
2012-03-09 06:36:45 +00:00
Andrew Trick
96816e59a6 misched interface: rename Begin/End to RegionBegin/RegionEnd since they are not private.
llvm-svn: 152382
2012-03-09 04:29:02 +00:00
Andrew Trick
ddb78e11ee misched comments
llvm-svn: 152374
2012-03-09 03:46:42 +00:00
Andrew Trick
f53b511937 revert 152356: verify misched changes using -misched=shuffle.
llvm-svn: 152373
2012-03-09 03:46:39 +00:00
Chandler Carruth
63f95ab839 Undo a previous restriction on the inline cost calculation which Nick
introduced. Specifically, there are cost reductions for all
constant-operand icmp instructions against an alloca, regardless of
whether the alloca will in fact be elligible for SROA. That means we
don't want to abort the icmp reduction computation when we abort the
SROA reduction computation. That in turn frees us from the need to keep
a separate worklist and defer the ICmp calculations.

Use this new-found freedom and some judicious function boundaries to
factor the innards of computing the cost factor of any given instruction
out of the loop over the instructions and into static helper functions.
This greatly simplifies the code, and hopefully makes it more clear what
is happening here.

Reviewed by Eric Christopher. There is some concern that we'd like to
ensure this doesn't get out of hand, and I plan to benchmark the effects
of this change over the next few days along with some further fixes to
the inline cost.

llvm-svn: 152368
2012-03-09 02:49:36 +00:00
Chad Rosier
a10cf5e1b9 Fix a regression from r147481.
Original commit message from r147481:
DAGCombine for transforming 128->256 casts into a vmovaps, rather
then a vxorps + vinsertf128 pair if the original vector came from a load.

Fix:
Unaligned loads need to generate a vmovups.
rdar://10974078

llvm-svn: 152366
2012-03-09 02:00:48 +00:00
Andrew Trick
71ba4d00f2 misched: allow the default scheduler to be one chosen by the target.
llvm-svn: 152360
2012-03-09 00:52:20 +00:00
Evan Cheng
6e3b9b3d5c Cache MBB->begin. It's possible the scheduler / bundler may change MBB->begin().
llvm-svn: 152356
2012-03-09 00:24:29 +00:00
Benjamin Kramer
94f6c8f462 Silence unused function warning when graphviz is not available.
llvm-svn: 152346
2012-03-08 22:15:23 +00:00
Duncan Sands
40d7bf2dbc Revert commit 152300 (ddunbar) since it still seems to be breaking
buildbots.  Original commit message:

[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values.

llvm-svn: 152304
2012-03-08 09:32:21 +00:00
Craig Topper
79f1e75059 Use uint16_t to store instruction implicit uses and defs. Reduces static data.
llvm-svn: 152301
2012-03-08 08:22:45 +00:00
Daniel Dunbar
1f5bb1e781 [ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values.

llvm-svn: 152300
2012-03-08 07:42:18 +00:00
Stepan Dyatkovskiy
79f3dd93b7 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152297
2012-03-08 07:06:20 +00:00
Daniel Dunbar
fe15f6be2f Revert r152288, "[ADT] Change the trivial FoldingSetNodeID::Add* methods to be
inline.", which is breaking the bots in a way I don't understand.

llvm-svn: 152295
2012-03-08 04:17:15 +00:00
Akira Hatanaka
7390c7f0b4 Invoke setTargetDAGCombine for SELECT.
llvm-svn: 152290
2012-03-08 03:26:37 +00:00
Daniel Dunbar
b99e53d8c3 [ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline.
llvm-svn: 152288
2012-03-08 02:52:00 +00:00
Akira Hatanaka
9de051a22a Swap the operands of a select node if the false (the second) operand is 0.
For example, this pattern 
(select (setcc lhs, rhs, cc), true, 0)
is transformed to this one:
(select (setcc lhs, rhs, inverse(cc)), 0, true)

This enables MipsDAGToDAGISel::ReplaceUsesWithZeroReg (added in r152280) to
replace 0 with $zero.

llvm-svn: 152285
2012-03-08 02:14:24 +00:00
Chandler Carruth
c0ed0a5f22 Rotate two of the functions used to count bonuses for the inline cost
analysis to be methods on the cost analysis's function info object
instead of the code metrics object. These really are just users of the
code metrics, they're building the information for the function's
analysis.

This is the first step of growing the amount of information we collect
about a function in order to cope with pair-wise simplifications due to
allocas.

llvm-svn: 152283
2012-03-08 02:04:19 +00:00
Akira Hatanaka
3440b8840f Set minimum function alignment to 3 if target is Mips64.
llvm-svn: 152282
2012-03-08 01:59:33 +00:00
Akira Hatanaka
f500c76435 This patch eliminates redundant instructions that produce 0.
For example, the first instruction in the code below can be eliminated if the
use of $vr0 is replaced with $zero: 

addiu $vr0, $zero, 0
add $vr2, $vr1, $vr0

add $vr2, $vr1, $zero

llvm-svn: 152280
2012-03-08 01:51:59 +00:00
Andrew Trick
65153639f8 misched interface: Expose the MachineScheduler pass.
Allow targets to provide their own schedulers (subclass of
ScheduleDAGInstrs) to the misched pass. Select schedulers using
-misched=...

llvm-svn: 152278
2012-03-08 01:41:12 +00:00
Jim Grosbach
6c4a2c8050 ARM don't use MCRelaxAll, as it's not safe on ARM.
The ARM code generator makes aggressive assumptions about the encodings
being selected for branches which MCRelaxAll invalidates.

rdar://11006355

llvm-svn: 152268
2012-03-08 00:07:52 +00:00
Sean Callanan
d2dc3cff1d Improved support in RuntimeDyldMachO for generating
code that will be relocated into another memory space.
Now when relocations are resolved, the address of
the relocation in the host memory (where the JIT is)
is passed separately from the address that the
relocation will be at in the target memory (where
the code will run).

llvm-svn: 152264
2012-03-07 23:05:25 +00:00
Andrew Trick
cbd96ef2f2 Cleanup VLIWPacketizer to use the updated ScheduleDAGInstrs interface.
llvm-svn: 152262
2012-03-07 23:01:09 +00:00
Andrew Trick
d16430c664 misched prep: Expose the ScheduleDAGInstrs interface so targets may
implement their own MachineScheduler.

llvm-svn: 152261
2012-03-07 23:01:06 +00:00
Andrew Trick
80aaf38e4e misched prep: Remove LLVM_LIBRARY_VISIBILITY from ScheduleDAGInstrs.
llvm-svn: 152260
2012-03-07 23:01:02 +00:00
Andrew Trick
5ab2b8a031 misched prep: Comment the ScheduleDAGInstrs interface.
llvm-svn: 152259
2012-03-07 23:00:59 +00:00
Andrew Trick
df0a76e646 misched prep: Cleanup ScheduleDAGInstrs interface.
ScheduleDAGInstrs will be the main interface for MI-level
schedulers. Make sure it's readable: one page of protected fields, one
page of public methids.

llvm-svn: 152258
2012-03-07 23:00:57 +00:00
Andrew Trick
8608f03241 misched prep: remove extra "protected"
llvm-svn: 152257
2012-03-07 23:00:54 +00:00
Andrew Trick
40eae1a830 misched prep: rename InsertPos to End.
ScheduleDAGInstrs knows nothing about how instructions will be moved or inserted.

llvm-svn: 152256
2012-03-07 23:00:52 +00:00
Andrew Trick
2b0038db94 misched preparation: rename core scheduler methods for consistency.
We had half the API with one convention, half with another. Now was a
good time to clean it up.

llvm-svn: 152255
2012-03-07 23:00:49 +00:00
Benjamin Kramer
8aa45ad186 Copy the right amount of elements.
llvm-svn: 152254
2012-03-07 22:48:42 +00:00
Benjamin Kramer
ef27a1e10d SmallPtrSet: Copy all the elements when swapping, not just numelements.
This fixes a build failure in webkit. Copying all elements shouldn't be
necessary, I'll look out for a better fix soon.

llvm-svn: 152252
2012-03-07 22:33:21 +00:00
Chad Rosier
07b6e758e1 [fast-isel] ARMEmitCmp generates FMSTAT, which transfers the floating-point
condition flags to CPSR.  This allows us to simplify SelectCmp.
Patch by Zonr Chang <zonr.xchg@gmail.com>.

llvm-svn: 152243
2012-03-07 20:59:26 +00:00
Jakob Stoklund Olesen
47b877f5bd Fix infinite loop in nested multiclasses.
Patch by Michael Liao!

llvm-svn: 152232
2012-03-07 16:39:35 +00:00
Chandler Carruth
5cfce10358 Try to clarify this comment some.
llvm-svn: 152221
2012-03-07 10:13:40 +00:00
Chandler Carruth
2ac287af28 Remove another outbreak of customized (and completely broken) hashing.
This one is particularly annoying because the hashing algorithm is
highly specialized, with a strange "equivalence" definition that subsets
the fields involved.

Still, this looks at the exact same set of data as the old code, but
without bitwise or-ing over parts of it and other mixing badness. No
functionality changed here. I've left a substantial fixme about the fact
that there is a cleaner and more principled way to do this, but it
requires making the equality definition actual stable for particular
types...

llvm-svn: 152218
2012-03-07 09:39:46 +00:00
Bill Wendling
828a0d7638 Where the BranchFolding pass removes a branch then adds another better branch,
the DebugLoc information can be maintained throughout by grabbing the DebugLoc
before the RemoveBranch and then passing the result to the InsertBranch.
Patch by Andrew Stanford-Jason!

llvm-svn: 152212
2012-03-07 08:49:42 +00:00
Andrew Trick
47489a0a3d Fix cmake
llvm-svn: 152210
2012-03-07 05:46:04 +00:00
Andrew Trick
d7a7509ea0 comment
llvm-svn: 152209
2012-03-07 05:21:54 +00:00
Andrew Trick
b76bc2eacb misched preparation: clarify ScheduleDAG and ScheduleDAGInstrs roles.
ScheduleDAG is responsible for the DAG: SUnits and SDeps. It provides target hooks for latency computation.

ScheduleDAGInstrs extends ScheduleDAG and defines the current scheduling region in terms of MachineInstr iterators. It has access to the target's scheduling itinerary data. ScheduleDAGInstrs provides the logic for building the ScheduleDAG for the sequence of MachineInstrs in the current region. Target's can implement highly custom schedulers by extending this class.

ScheduleDAGPostRATDList provides the driver and diagnostics for current postRA scheduling. It maintains a current Sequence of scheduled machine instructions and logic for splicing them into the block. During scheduling, it uses the ScheduleHazardRecognizer provided by the target.

Specific changes:
- Removed driver code from ScheduleDAG. clearDAG is the only interface needed.

- Added enterRegion/exitRegion hooks to ScheduleDAGInstrs to delimit the scope of each scheduling region and associated DAG. They should be used to setup and cleanup any region-specific state in addition to the DAG itself. This is necessary because we reuse the same ScheduleDAG object for the entire function. The target may extend these hooks to do things at regions boundaries, like bundle terminators. The hooks are called even if we decide not to schedule the region. So all instructions in a block are "covered" by these calls.

- Added ScheduleDAGInstrs::begin()/end() public API.

- Moved Sequence into the driver layer, which is specific to the scheduling algorithm.

llvm-svn: 152208
2012-03-07 05:21:52 +00:00
Andrew Trick
0df67ea935 ScheduleDAGInstrs comments
llvm-svn: 152207
2012-03-07 05:21:47 +00:00
Andrew Trick
9dcbf0e144 misched preparation: modularize schedule emission.
ScheduleDAG has nothing to do with how the instructions are scheduled.

llvm-svn: 152206
2012-03-07 05:21:44 +00:00
Andrew Trick
794bad1f46 misched preparation: modularize schedule printing.
ScheduleDAG will not refer to the scheduled instruction sequence.

llvm-svn: 152205
2012-03-07 05:21:40 +00:00
Andrew Trick
c3b53855a2 misched preparation: modularize schedule verification.
ScheduleDAG will not refer to the scheduled instruction sequence.

llvm-svn: 152204
2012-03-07 05:21:36 +00:00
Andrew Trick
074325d509 whitespace
llvm-svn: 152203
2012-03-07 05:21:32 +00:00
Chandler Carruth
53d60ebfa2 Switch this code to use hash_combine_range rather than incremental calls
to hash_combine. One of the interfaces could already do this, and the
other can just use a small buffer. This is a much more efficient way to
use the hash_combine interface, although I don't have any particular
benchmark where this code was hot, so I can't measure much of an impact.
It at least doesn't slow anything down.

llvm-svn: 152200
2012-03-07 03:22:32 +00:00
Chandler Carruth
42ee38de30 Cache the sized-ness of struct types, once we reach the steady state of
"is sized". This prevents every query to isSized() from recursing over
every sub-type of a struct type. This could get *very* slow for
extremely deep nesting of structs, as in 177.mesa.

This change is a 45% speedup for 'opt -O2' of 177.mesa.linked.bc, and
likely a significant speedup for other cases as well. It even impacts
-O0 cases because so many part of the code try to check whether a type
is sized.

Thanks for the review from Nick Lewycky and Benjamin Kramer on IRC.

llvm-svn: 152197
2012-03-07 02:33:09 +00:00
Nick Lewycky
7c4db49d7e No functionality change. Type::isSized() can be expensive, so avoid calling it
until after other inexpensive tests.

llvm-svn: 152195
2012-03-07 02:27:53 +00:00
Jim Grosbach
d0770582f9 ARM pre-v6 assembly parsing for umull/smull.
llvm-svn: 152188
2012-03-07 01:09:17 +00:00
Jim Grosbach
dbeec050c2 ARM pre-v6 alias for 'nop' to 'mov r0, r0'
llvm-svn: 152185
2012-03-07 00:52:41 +00:00
Jim Grosbach
9ef7f069b5 Tidy up. Remove dead code that slipped into previous commit.
llvm-svn: 152184
2012-03-07 00:52:39 +00:00
Andrew Trick
a87bfe64ad Added -view-background to avoid waiting for each GraphViz invocation.
GV and XDOT paths are untested but should work the same.

llvm-svn: 152179
2012-03-07 00:18:27 +00:00
Andrew Trick
b400cf42a4 Added -view-misched=dags options.
llvm-svn: 152178
2012-03-07 00:18:25 +00:00
Andrew Trick
8474910b42 Cleanup in preparation for misched: Move DAG visualization logic.
Soon, ScheduleDAG will not refer to the BB.

llvm-svn: 152177
2012-03-07 00:18:22 +00:00
Andrew Trick
d35b75a36c Added MachineBasicBlock::getFullName() to standardize/factor codegen diagnostics.
llvm-svn: 152176
2012-03-07 00:18:18 +00:00
Andrew Trick
e06a3f8642 whitespace
llvm-svn: 152175
2012-03-07 00:18:15 +00:00
Andrew Trick
1fb15f4f48 Cleanup: DAG building is specific to either SD or MI scheduling. Not part of the target interface.
llvm-svn: 152174
2012-03-07 00:18:12 +00:00
Andrew Trick
80ff2f2d36 misched comments
llvm-svn: 152173
2012-03-07 00:18:08 +00:00
Andrew Trick
0f29eb5ff1 misched: Use the StartBlock/FinishBlock hooks
llvm-svn: 152172
2012-03-07 00:18:05 +00:00
Eric Christopher
6d5c7a5141 Add the DW_AT_APPLE_runtime_class attribute to forward declarations
as well as completely defined classes.

This fixes rdar://10956070

llvm-svn: 152171
2012-03-07 00:15:19 +00:00
Evan Cheng
f04f2e7a52 Extend r148086 to check for [r +/- reg] address mode. This fixes queens performance regression (due to increased register pressure from overly aggressive pre-inc formation).
llvm-svn: 152162
2012-03-06 23:33:32 +00:00
Jim Grosbach
3b5f99f716 ARM more NEON VLD/VST composite physical register refactoring.
Register pair, all lanes subscripting.

llvm-svn: 152157
2012-03-06 23:10:38 +00:00
Jakob Stoklund Olesen
b29383fc6a Hoist common code out of if statement.
llvm-svn: 152153
2012-03-06 22:27:13 +00:00
Jim Grosbach
a3eeee8a91 ARM refactor more NEON VLD/VST instructions to use composite physregs
Register pair VLD1/VLD2 all-lanes instructions. Kill off more of the
pseudos as a result.

llvm-svn: 152150
2012-03-06 22:01:44 +00:00
Benjamin Kramer
0637e87d74 SmallPtrSet: Provide a more efficient implementation of swap than the default triple-copy std::swap.
This currently assumes that both sets have the same SmallSize to keep the implementation simple,
a limitation that can be lifted if someone cares.

llvm-svn: 152143
2012-03-06 20:40:02 +00:00
Eli Friedman
c397259ea6 Fix the operand ordering on aliases for shld and shrd. PR12173, part 2.
llvm-svn: 152136
2012-03-06 19:58:46 +00:00
Jim Grosbach
63e971ffae Tidy up. Kill some dead code.
llvm-svn: 152131
2012-03-06 18:59:19 +00:00
Jakob Stoklund Olesen
f772e5e379 Allow the same types in DPair as in QPR.
llvm-svn: 152129
2012-03-06 18:44:11 +00:00
Kevin Enderby
64d11852dd Fix a bug in the ARM disassembly of the neon VLD2 all lanes instruction.
llvm-svn: 152127
2012-03-06 18:33:12 +00:00
Roman Divacky
9bfd7cd1ad Convert PowerPC to register mask operands.
llvm-svn: 152122
2012-03-06 16:41:49 +00:00
Jay Foad
f7931a878d Change ConstantAggrUniqueMap to use Chandler's new hashing
implementation. Patch by Meador Inge

llvm-svn: 152116
2012-03-06 10:43:52 +00:00
Jakob Stoklund Olesen
d4e1cb591a Add <imp-def> operands when reloading into physregs.
When an instruction only writes sub-registers, it is still necessary to
add an <imp-def> operand for the super-register.  When reloading into a
virtual register, rewriting will add the operand, but when loading
directly into a virtual register, the <imp-def> operand is still
necessary.

llvm-svn: 152095
2012-03-06 02:48:17 +00:00
Evan Cheng
891cc85c9f Avoid finalizeBundles infinite looping.
llvm-svn: 152089
2012-03-06 02:00:52 +00:00
Owen Anderson
23d0deb35a Make it possible for a target to mark FSUB as Expand. This requires providing a default expansion (FADD+FNEG), and teaching DAGCombine not to form FSUBs post-legalize if they are not legal.
llvm-svn: 152079
2012-03-06 00:29:31 +00:00
Lang Hames
a49054ac9c Split fpscr into two registers: FPSCR and FPSCR_NZCV.
The fpscr register contains both flags (set by FP operations/comparisons) and
control bits. The control bits (FPSCR) should be reserved, since they're always
available and needn't be defined before use. The flag bits (FPSCR_NZCV) should
like to be unreserved so they can be hoisted by MachineCSE. This fixes PR12165.

llvm-svn: 152076
2012-03-06 00:19:55 +00:00
Eli Friedman
eec5df7382 A few more cases of missing masking in ComputeMaskedBits; found by inspection.
llvm-svn: 152070
2012-03-05 23:22:40 +00:00
Jim Grosbach
91314c2db6 ARM vpush/vpop assembler mnemonics accept an optional size suffix.
rdar://10988114

llvm-svn: 152068
2012-03-05 23:16:31 +00:00
Eli Friedman
59cebb7902 Make sure we don't return bits outside the mask in ComputeMaskedBits. PR12189.
llvm-svn: 152066
2012-03-05 23:09:40 +00:00
Jim Grosbach
a6b09b4691 ARM Refactor VLD/VST spaced pair instructions.
Use the new composite physical registers.

llvm-svn: 152063
2012-03-05 21:43:40 +00:00
Jim Grosbach
d0fb2e7c99 ARM Remove a bit of dead code.
llvm-svn: 152061
2012-03-05 21:09:58 +00:00
Jim Grosbach
fdfaed95ae ARM refactor away a bunch of VLD/VST pseudo instructions.
With the new composite physical registers to represent arbitrary pairs
of DPR registers, we don't need the pseudo-registers anymore. Get rid of
a bunch of them that use DPR register pairs and just use the real
instructions directly instead.

llvm-svn: 152045
2012-03-05 19:33:30 +00:00
Jim Grosbach
2eea383b12 Make MCRegisterInfo available to the the MCInstPrinter.
Used to allow context sensitive printing of super-register or sub-register
references.

llvm-svn: 152043
2012-03-05 19:33:20 +00:00
Bill Wendling
64e089e62c Fix warnings about adding a bool to a string.
Patch by Sean Silva!

llvm-svn: 152042
2012-03-05 19:29:36 +00:00
Chad Rosier
f2e436b74f Address Evan's comments for r151877.
Specifically, remove the magic number when checking to see if the copy has a 
glue operand and simplify the checking logic.

rdar://10930395

llvm-svn: 152041
2012-03-05 19:27:12 +00:00
Sebastian Pop
e6eeed8151 updated patch for the ARM fused multiply add/sub
In this update:
- I assumed neon2 does not imply vfpv4, but neon and vfpv4 imply neon2.
- I kept setting .fpu=neon-vfpv4 code attribute because that is what the
assembler understands.

Patch by Ana Pazos <apazos@codeaurora.org>

llvm-svn: 152036
2012-03-05 17:39:52 +00:00
Sebastian Pop
d7b990a624 fix typos
llvm-svn: 152035
2012-03-05 17:39:47 +00:00
Sebastian Pop
64efa0a7a8 remove spaces on empty lines
llvm-svn: 152034
2012-03-05 17:39:45 +00:00
Duncan Sands
2640024ac8 This is not a common case, in fact it never happens!
llvm-svn: 152027
2012-03-05 12:23:00 +00:00
Chandler Carruth
533fb74c5d Switch mem2reg to use the new hashing infrastructure.
llvm-svn: 152026
2012-03-05 11:29:56 +00:00
Chandler Carruth
517e7a4d9e Replace the ad-hoc hashing in GVN with the new hashing infrastructure.
This implicitly fixes a nasty bug in the GVN hashing (that thankfully
could only manifest as a performance bug): actually include the opcode
in the hash. The old code started the hash off with the opcode, but then
overwrote it with the type pointer.

Since this is likely to be pretty hot (GVN being already pretty
expensive) I've included a micro-optimization to just not bother with
the varargs hashing if they aren't present. I can't measure any change
in GVN performance due to this, even with a big test case like Duncan's
sqlite one. Everything I see is in the noise floor. That said, this
closes a loop hole for a potential scaling problem due to collisions if
the opcode were the differentiating aspect of the expression.

llvm-svn: 152025
2012-03-05 11:29:54 +00:00
Chandler Carruth
61ebb8db34 Switch the TableGen record's string-based DenseMap key to use the new
hashing infrastructure. I wonder why we don't just use StringMap here,
and I may revisit the issue if I have time, but for now I'm just trying
to consolidate.

llvm-svn: 152023
2012-03-05 10:36:16 +00:00
Craig Topper
a95d527c6a Convert more GenRegisterInfo tables from unsigned to uint16_t to reduce static data size.
llvm-svn: 152016
2012-03-05 05:37:41 +00:00
Eli Friedman
4a049305a9 Make aliases for shld and shrd match gas. PR12173.
llvm-svn: 152014
2012-03-05 04:31:54 +00:00
Jakob Stoklund Olesen
d184d231a8 Stop fixing bad machine code in LiveIntervalAnalysis.
The first def of a virtual register cannot also read the register.
Assert on such bad machine code instead of trying to fix it.
TwoAddressInstructionPass should never create code like that.

llvm-svn: 152010
2012-03-04 19:19:10 +00:00
Jakob Stoklund Olesen
e1b39ecc51 Stop adding <imp-def> operands when coalescing sub-registers.
We are already setting <undef> flags, and that is good enough. The
<imp-def> operands don't mean anything any more.

llvm-svn: 152009
2012-03-04 19:19:07 +00:00
Jakob Stoklund Olesen
fd29132e44 Use <def,undef> operands when spilling NEON bundles.
MachineOperands that define part of a virtual register must have an
<undef> flag if they are not intended as read-modify-write operands.

The old trick of adding an <imp-def> operand doesn't work any longer.

Fixes PR12177.

llvm-svn: 152008
2012-03-04 18:40:30 +00:00
Duncan Sands
ccc56e1071 Nick pointed out on IRC that GVN's propagateEquality wasn't propagating
equalities into phi node operands for which the equality is known to
hold in the incoming basic block.  That's because replaceAllDominatedUsesWith
wasn't handling phi nodes correctly in general (that this didn't give wrong
results was just luck: the specific way GVN uses replaceAllDominatedUsesWith
precluded wrong changes to phi nodes).

llvm-svn: 152006
2012-03-04 13:25:19 +00:00
Chandler Carruth
a93fbd8fff Replace the hashing functions on APInt and APFloat with overloads of the
new hash_value infrastructure, and replace their implementations using
hash_combine. This removes a complete copy of Jenkin's lookup3 hash
function (which is both significantly slower and lower quality than the
one implemented in hash_combine) along with a somewhat scary xor-only
hash function.

Now that APInt and APFloat can be passed directly to hash_combine,
simplify the rest of the LLVMContextImpl hashing to use the new
infrastructure.

llvm-svn: 152004
2012-03-04 12:02:57 +00:00
Chandler Carruth
b4a6f80d2e Add generic support for hashing StringRef objects using the new hashing library.
llvm-svn: 152003
2012-03-04 10:55:27 +00:00
Bill Wendling
88f55b45b2 Do trivial CSE of dead BBs during codegen preparation.
Some BBs can become dead after codegen preparation. If we delete them here, it
could help enable tail-call optimizations later on.
<rdar://problem/10256573>

llvm-svn: 152002
2012-03-04 10:46:01 +00:00
Craig Topper
8cc9d75c6a Use uint16_t to store register overlaps to reduce static data.
llvm-svn: 152001
2012-03-04 10:43:23 +00:00
Craig Topper
4ca8c48cc1 Use uint16_t instead of unsigned to store registers in reg classes. Reduces static data size.
llvm-svn: 151998
2012-03-04 10:16:38 +00:00
Craig Topper
585b4225c3 Use uint16_t to store registers in callee saved register tables to reduce size of static data.
llvm-svn: 151996
2012-03-04 03:33:22 +00:00
Craig Topper
231243e781 Use uint8_t instead of enums to store values in X86 disassembler table. Shaves 150k off the size of X86DisassemblerDecoder.o
llvm-svn: 151995
2012-03-04 02:16:41 +00:00
Rafael Espindola
837258385f Correctly initialize LineSectionSymbol. Thanks to Duncan Sands for noticing it.
llvm-svn: 151979
2012-03-03 14:24:15 +00:00
Duncan Sands
b36789951f Include cctype for isdigit. Patch by Stephen Hines.
llvm-svn: 151973
2012-03-03 09:36:58 +00:00
Benjamin Kramer
2a3719125f LVI: Recognize the form instcombine canonicalizes range checks into when forming constant ranges.
This could probably be made a lot smarter, but this is a common case and doesn't require LVI to scan a lot
of code. With this change CVP can optimize away the "shift == 0" case in Hashing.h that only gets hit when
"shift" is in a range not containing 0.

llvm-svn: 151919
2012-03-02 15:34:43 +00:00
Evgeniy Stepanov
19a3f5fed4 ASan: use getTypeAllocSize instead of getTypeStoreSize.
This change replaces getTypeStoreSize with getTypeAllocSize in AddressSanitizer
instrumentation for stack allocations.

One case where old behaviour produced undesired results is an optimization in
InstCombine pass (PromoteCastOfAllocation), which can replace  alloca(T) with
alloca(S), where S has the same AllocSize, but a smaller StoreSize. Another
case is memcpy(long double => long double), where ASan will poison bytes 10-15
of a stack-allocated long double (StoreSize  10, AllocSize 16,
sizeof(long double) = 16).

See http://llvm.org/bugs/show_bug.cgi?id=12047 for more context.

llvm-svn: 151887
2012-03-02 10:41:08 +00:00
Chad Rosier
c6fad847e9 Prevent obscure and incorrect tail-call optimization.
In this instance we are generating the tail-call during legalizeDAG.  The 2nd
floor call can't be a tail call because it clobbers %xmm1, which is defined by
the first floor call.  The first floor call can't be a tail-call because it's
not in the tail position.  The only reasonable way I could think to fix this
in a target-independent manner was to check for glue logic on the copy reg.

rdar://10930395

llvm-svn: 151877
2012-03-02 02:50:46 +00:00
Eric Christopher
bb8f3701cd Grammar-o in function name.
llvm-svn: 151875
2012-03-02 02:11:47 +00:00
Eric Christopher
73cbb37d7a Grammar.
llvm-svn: 151874
2012-03-02 01:57:55 +00:00
Eric Christopher
a634c38544 If the linkage name doesn't exist we're supposed to emit a reference
to the string table for the function name, not the function name.

llvm-svn: 151873
2012-03-02 01:57:52 +00:00
Dan Gohman
e0e8af6739 Fix an iterator invalidation problem. operator[] on a DenseMap
can insert a new element, invalidating iterators. Use find
instead, and handle the case where the key is not found explicitly.

llvm-svn: 151871
2012-03-02 01:26:46 +00:00
Dan Gohman
acbf555d2f Misc micro-optimizations.
llvm-svn: 151869
2012-03-02 01:13:53 +00:00
Eric Christopher
39493f0f97 Revert "Reorder the sections being output to reduce the number of assembler"
The inline table needs to be constructed ahead of time so that it doesn't try to
create new strings while we're emitting everything.

This reverts commit a8ff9bccb399183cdd5f1c3cec2bda763664b4b0.

llvm-svn: 151864
2012-03-02 00:30:24 +00:00
Evan Cheng
31b407de17 Neuter the optimization I implemented with r107852 and r108258 which turn some
floating point equality comparisons into integer ones with -ffast-math. The
issue is the optimization causes +0.0 != -0.0.

Now the optimization is only done when one side is known to be 0.0. The other
side's sign bit is masked off for the comparison.

rdar://10964603

llvm-svn: 151861
2012-03-01 23:27:13 +00:00
Chandler Carruth
bdbd61e7cf Switch FoldingSet over to the new hashing infrastructure. We might want
to do more invasive refactoring here to get FoldingSet to use size_t or
even hash_code directly, but for now this is a good first step to remove
Yet Another Hashing Algorithm from LLVM.

llvm-svn: 151859
2012-03-01 23:18:44 +00:00
Jakob Stoklund Olesen
b87ff8f772 Handle regmasks in Thumb1RegisterInfo::saveScavengerRegister().
This function could have r12 live across a function call when compiling
thumb1 code.

The test case for this is not included because it is very long. It must
provoke emergency spilling near a function call. The behavior is
provoked by MultiSource/Applications/JM/lencod, and it triggers an
assertion in the scavenger.

<rdar://problem/10963642>

llvm-svn: 151855
2012-03-01 22:57:32 +00:00
Eric Christopher
3d271eb540 Reorder the sections being output to reduce the number of assembler
fixups that are being used to determine section offsets. Reduces
the total number of fixups by 50% for a non-trivial testcase.

Part of rdar://10413936

llvm-svn: 151852
2012-03-01 22:50:31 +00:00
Jim Grosbach
cd931af452 ARM use the right opcode for FP<->Integer move in fast-isel.
rdar://10965031

llvm-svn: 151850
2012-03-01 22:47:09 +00:00
Michael J. Spencer
0eb4a851f6 Minimal changes for LLVM to compile under VS11.
llvm-svn: 151849
2012-03-01 22:42:52 +00:00
Akira Hatanaka
6336ac5257 Changes for migrating to using register mask operands.
llvm-svn: 151847
2012-03-01 22:27:29 +00:00
David Meyer
7f21ecb667 [Object]
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object.

llvm-svn: 151845
2012-03-01 22:19:54 +00:00
Kevin Enderby
26dad6994b Change ARMInstPrinter::printPredicateOperand() so it will not abort if it
runs into the undefined 15 condition code value.

llvm-svn: 151844
2012-03-01 22:13:02 +00:00
Akira Hatanaka
75b06f4a49 Fix bugs which were introduced when support for base+index floating point loads
and stores was added.

- SelectAddr should return false if Parent is an unaligned f32 load or store.
- Only aligned load and store nodes should be matched to select reg+imm
  floating point instructions.
- MIPS does not have support for f64 unaligned load or store instructions.

llvm-svn: 151843
2012-03-01 22:12:30 +00:00
Benjamin Kramer
88e1073516 BumpPtrAllocator: Make sure threshold cannot be initialized with a value smaller than the slab size.
This replaces r151834 with a simpler fix.

llvm-svn: 151842
2012-03-01 22:10:16 +00:00
Argyrios Kyrtzidis
cdf7b1a45c If BumpPtrAllocator is requested to allocate a size that exceeds the slab size,
increase the slab size.

llvm-svn: 151834
2012-03-01 20:36:32 +00:00
Chandler Carruth
f5c22e9409 Add the source file with trivial definitions in it that was missing from
r151822, sorry sorry. =[

We need 'git svn nothave' or some such...

llvm-svn: 151824
2012-03-01 18:58:59 +00:00
Chandler Carruth
cc9b4516cb Rewrite LLVM's generalized support library for hashing to follow the API
of the proposed standard hashing interfaces (N3333), and to use
a modified and tuned version of the CityHash algorithm.

Some of the highlights of this change:
 -- Significantly higher quality hashing algorithm with very well
    distributed results, and extremely few collisions. Should be close to
    a checksum for up to 64-bit keys. Very little clustering or clumping of
    hash codes, to better distribute load on probed hash tables.
 -- Built-in support for reserved values.
 -- Simplified API that composes cleanly with other C++ idioms and APIs.
 -- Better scaling performance as keys grow. This is the fastest
    algorithm I've found and measured for moderately sized keys (such as
    show up in some of the uniquing and folding use cases)
 -- Support for enabling per-execution seeds to prevent table ordering
    or other artifacts of hashing algorithms to impact the output of
    LLVM. The seeding would make each run different and highlight these
    problems during bootstrap.

This implementation was tested extensively using the SMHasher test
suite, and pased with flying colors, doing better than the original
CityHash algorithm even.

I've included a unittest, although it is somewhat minimal at the moment.
I've also added (or refactored into the proper location) type traits
necessary to implement this, and converted users of GeneralHash over.

My only immediate concerns with this implementation is the performance
of hashing small keys. I've already started working to improve this, and
will continue to do so. Currently, the only algorithms faster produce
lower quality results, but it is likely there is a better compromise
than the current one.

Many thanks to Jeffrey Yasskin who did most of the work on the N3333
paper, pair-programmed some of this code, and reviewed much of it. Many
thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original
authors of CityHash on which this is heavily based, and Austin Appleby
who created MurmurHash and the SMHasher test suite.

Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for
all of the review comments! If there are further comments or concerns,
please let me know and I'll jump on 'em.

llvm-svn: 151822
2012-03-01 18:55:25 +00:00
James Molloy
1038b57cac Fix a codegen fault in which log2 or exp2 could be dead-code eliminated even though they could have sideeffects.
Only allow log2/exp2 to be converted to an intrinsic if they are declared "readnone".

llvm-svn: 151807
2012-03-01 14:32:18 +00:00
Benjamin Kramer
44c3c88cb7 Make TargetRegisterClasses non-virtual by making the only virtual function a function pointer.
This allows us to make TRC non-polymorphic and value-initializable, eliminating a huge static
initializer and a ton of cruft from the generated code.

Shrinks ARMBaseRegisterInfo.o by ~100k.

llvm-svn: 151806
2012-03-01 13:37:55 +00:00
Benjamin Kramer
c57a6d4a2a Emit the "is an intrinsic overloaded" table as a bitfield.
llvm-svn: 151792
2012-03-01 02:16:57 +00:00
Akira Hatanaka
7964a20cf6 Pass endian information to constructors. Define separate functions to create
objects for big endian and little endian targets.

Patch by Jack Carter.

llvm-svn: 151788
2012-03-01 01:53:15 +00:00
Jakob Stoklund Olesen
2055fc1331 Make InlineSpiller bundle-aware.
Simply treat bundles as instructions. Spill code is inserted between
bundles, never inside a bundle.  Rewrite all operands in a bundle at
once.

Don't attempt and memory operand folding inside bundles.

llvm-svn: 151787
2012-03-01 01:43:25 +00:00
David Meyer
44201a2d17 [Object]
* Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile.
* Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable.
* Implement this new interface completely for ELF, leave stubs for COFF and MachO.
* Add 'llvm-readobj' tool for dumping ObjectFile information.

llvm-svn: 151785
2012-03-01 01:36:50 +00:00
Jakob Stoklund Olesen
1885bf0ac7 Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in
getInstructionIndex().

Also provide a const version. C++ is great for touch typing practice.

llvm-svn: 151782
2012-03-01 01:26:01 +00:00
Lang Hames
6cd018d0bc Don't redundantly copy implicit operands when rematerializing.
While we're at it - don't copy vreg implicit operands while rematerializing.
This fixes PR12138.

llvm-svn: 151779
2012-03-01 00:41:17 +00:00
Sean Callanan
171b2ddfbd Fixed the 32-bit runtime dynamic loader to allocate
code sections when needed.  It just had a conditional
the wrong way around.

llvm-svn: 151777
2012-03-01 00:15:29 +00:00
Kevin Enderby
46c639cf8a Added annotations for x86 pc relative loads to llvm's 'C' disassembler.
So with darwin's otool(1) an x86_64 hello world .o file will print:
leaq	L_.str(%rip), %rax ## literal pool for: Hello world

llvm-svn: 151769
2012-02-29 22:58:34 +00:00
Daniel Dunbar
ce00dc437f BitstreamWriter: Change primary output buffer to be a SmallVector instead of an
std::vector.
 - Good for 1-2% speedup on writing PCH for Cocoa.h.
 - Clang side API match to follow shortly, there wasn't an easy way to make this
   non-breaking.

llvm-svn: 151750
2012-02-29 20:31:09 +00:00
Daniel Dunbar
769ebcfda1 BitcodeWriter: Expose less implementation details -- make BackpatchWord private
and remove getBuffer().

llvm-svn: 151748
2012-02-29 20:31:01 +00:00
Daniel Dunbar
b887c34acf Bitcode: Don't expose WriteBitcodeToStream to clients.
llvm-svn: 151747
2012-02-29 20:30:56 +00:00
Andrew Trick
cf63a3d03a Intel Atom instruction itineraries for mov sign extension and mov zero extension.
Patch by Tyler Nowicki!

llvm-svn: 151743
2012-02-29 19:44:41 +00:00
Benjamin Kramer
1b5aa9f5cd LegalizeIntegerTypes: Reorder operations in the "big shift by small amount" optimization, making the lives of later passes easier.
llvm-svn: 151722
2012-02-29 13:27:00 +00:00
Duncan Sands
207ee17589 Have GVN also do condition propagation when the right-hand side is not
a constant.  This fixes PR1768.

llvm-svn: 151713
2012-02-29 11:12:03 +00:00
David Meyer
e9705e2949 [Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ST_Undefined. Implement these completely for ELF.
Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type
is unknown, not that the symbol is undefined. (For that, use ST_Undefined).

llvm-svn: 151696
2012-02-29 02:11:55 +00:00
Bill Wendling
7786b1f9dc Restrict this transformation to equality conditions.
This transformation is not correct for not-equal conditions:

(trunc x) != C1 & (and x, CA) != C2 -> (and x, CA|CMAX) != C1|C2

Let
  C1 == 0
  C2 == 0
  CA == 0xFF0000
  CMAX == 0xFF
and truncating to i8.

The original truth table:

    x   | A: trunc x != 0 | B: x & 0xFF0000 != 0 | A & B != 0
--------------------------------------------------------------
0x00000 |        0        |          0           |     0
0x00001 |        1        |          0           |     0
0x10000 |        0        |          1           |     0
0x10001 |        1        |          1           |     1

The truth table of the replacement:

    x   | x & 0xFF00FF != 0
----------------------------
0x00000 |        0
0x00001 |        1
0x10000 |        1
0x10001 |        1

So they are different.

llvm-svn: 151691
2012-02-29 01:46:50 +00:00
Jakob Stoklund Olesen
99c9b19c27 Add an analyzeVirtReg() function.
This function does more or less the same as
MI::readsWritesVirtualRegister(), but it supports bundles as well.

It also determines if any constraint requires reading and writing
operands to use the same register.  Most clients want to know.

Use the more modern MO.readsReg() instead of trying to sort out undefs
and partial redefines.  Stop supporting the extra full <imp-def> operand
as an alternative to <def,undef> sub-register defines.

llvm-svn: 151690
2012-02-29 01:40:37 +00:00
Derek Schuff
db82ff1e09 Make MemoryObject accessor members const again
llvm-svn: 151687
2012-02-29 01:09:06 +00:00
Daniel Dunbar
fd297dc564 Support/PathV2: Fix namespace qualifier in make_absolute(), for Win32.
llvm-svn: 151685
2012-02-29 00:46:46 +00:00
Jakob Stoklund Olesen
55ff251cc1 Move the operand iterator into MachineInstrBundle.h where it belongs.
Extract a base class and provide four specific sub-classes for iterating
over const/non-const bundles/instructions.

This eliminates the mystery bool constructor argument.

llvm-svn: 151684
2012-02-29 00:33:41 +00:00
Daniel Dunbar
4fd53dbd0e Support/PathV2: Fix make_absolute() to match is_absolute() and not expect to
find root names on Unix.
 - This fixes make_absolute to not basically always call current_path() on
   Unix systems.
 - I think the API probably needs cleanup in this area, but I'll let Michael
   handle that.

llvm-svn: 151681
2012-02-29 00:20:37 +00:00
Derek Schuff
c344aa4c7f Fix PR12080 by ensuring that MaterializeModule actually reads all the bitcode
in the streaming case.

llvm-svn: 151676
2012-02-29 00:07:09 +00:00
Michael J. Spencer
d29a314efb [PathV2] Fix bug in relative_path.
llvm-svn: 151675
2012-02-29 00:06:24 +00:00
Jim Grosbach
cb853fbdc9 ARM implement TargetInstrInfo::getNoopForMachoTarget()
Without this hook, functions w/ a completely empty body (including no
epilogue) will cause an MCEmitter assertion failure.

For example,
define internal fastcc void @empty_function() {
  unreachable
}

rdar://10947471

llvm-svn: 151673
2012-02-28 23:53:30 +00:00
David Meyer
31e23de700 In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), and isWeak(), with a bitset of flags.
llvm-svn: 151670
2012-02-28 23:47:53 +00:00
Lang Hames
61e76ce0cf Kill off LiveRangeEdit::getNewVRegs and LiveRangeEdit::getUselessVRegs. These
methods are no longer needed now that LinearScan has gone away.

(Contains tweaks trivialSpillEverywhere to enable the removal of getNewVRegs).

llvm-svn: 151658
2012-02-28 22:07:24 +00:00
Rafael Espindola
646dff508a On ELF, create relocations to the abbreviation and line sections when producing
debug info for assembly files. We were already doing the right thing when
producing debug info for C/C++.

ELF linkers don't know dwarf, so they depend on these relocations to produce
valid dwarf output.

llvm-svn: 151655
2012-02-28 21:13:05 +00:00
Jim Grosbach
329e745b30 ARM vbit/vbif/vbsl assembly optional size suffix.
These instructions accept but do not require a size suffix.

rdar://10947225

llvm-svn: 151646
2012-02-28 19:11:07 +00:00
Evan Cheng
c5ead6c49e Re-commit r151623 with fix. Only issue special no-return calls if it's a direct call.
llvm-svn: 151645
2012-02-28 18:51:51 +00:00
Benjamin Kramer
9bff93fd22 Fix off-by one in comment.
llvm-svn: 151644
2012-02-28 18:37:06 +00:00
Roman Divacky
0398d1fddc Properly MCize the section switch, removing a FIXME.
llvm-svn: 151639
2012-02-28 18:15:25 +00:00
Benjamin Kramer
daa291f4fd LegalizeIntegerTypes: Reenable the large shift with small amount optimization.
To avoid problems with zero shifts when getting the bits that move between words
we use a trick: first shift the by amount-1, then do another shift by one. When
amount is 0 (and size 32) we first shift by 31, then by one, instead of by 32.

Also fix a latent bug that emitted the low and high words in the wrong order
when shifting right.

Fixes PR12113.

llvm-svn: 151637
2012-02-28 17:58:00 +00:00
Daniel Dunbar
b448d31a6b Revert r151623 "Some ARM implementaions, e.g. A-series, does return stack prediction. ...", it is breaking the Clang build during the Compiler-RT part.
llvm-svn: 151630
2012-02-28 15:36:07 +00:00
Daniel Dunbar
001b372f9a Remove stray semi-colon.
llvm-svn: 151629
2012-02-28 15:35:52 +00:00
Nadav Rotem
9c1789a96c Code cleanup following CR by Duncan.
llvm-svn: 151627
2012-02-28 14:13:19 +00:00
Nadav Rotem
75b36e6716 Fix a bug in the code that builds SDNodes from vector GEPs.
When the GEP index is a vector of pointers, the code that calculated the size
of the element started from the vector type, and not the contained pointer type.
As a result, instead of looking at the data element pointed by the vector, this
code used the size of the vector. This works for 32bit members (on 32bit
systems), but not for other types. Added code to peel the vector type and
added a test.

llvm-svn: 151626
2012-02-28 11:54:05 +00:00
Jia Liu
bdcd314be3 remove blanks, and some code format
llvm-svn: 151625
2012-02-28 07:46:26 +00:00
Evan Cheng
d29a22e4b0 Some ARM implementaions, e.g. A-series, does return stack prediction. That is,
the processor keeps a return addresses stack (RAS) which stores the address
and the instruction execution state of the instruction after a function-call
type branch instruction.

Calling a "noreturn" function with normal call instructions (e.g. bl) can
corrupt RAS and causes 100% return misprediction so LLVM should use a
unconditional branch instead. i.e.
mov lr, pc
b _foo
The "mov lr, pc" is issued in order to get proper backtrace.

rdar://8979299

llvm-svn: 151623
2012-02-28 06:42:03 +00:00
Pete Cooper
ab5f2302dc Reverted r152620 - DSE: Shorten memset when a later store overwrites the start of it. There were all sorts of buildbot issues
llvm-svn: 151621
2012-02-28 05:06:24 +00:00
Pete Cooper
93352dcd53 DSE: Shorten memset when a later store overwrites the start of it
llvm-svn: 151620
2012-02-28 04:27:10 +00:00
Bill Wendling
5841e676f3 Oops...Don't commit the other stuff..
llvm-svn: 151618
2012-02-28 04:01:21 +00:00
Bill Wendling
993b2b234e Modify comment to reflect the importance of this code.
llvm-svn: 151617
2012-02-28 03:47:09 +00:00
Akira Hatanaka
df24c0c218 Add comments.
llvm-svn: 151615
2012-02-28 03:18:43 +00:00
Akira Hatanaka
247d834415 Do not reserve $gp as a dedicated global base register if the target ABI is not O32.
llvm-svn: 151614
2012-02-28 03:17:38 +00:00
Akira Hatanaka
0934449dd8 Add support for floating point base register + offset register addressing mode
load and store instructions.

llvm-svn: 151611
2012-02-28 02:55:02 +00:00
Jakob Stoklund Olesen
c74b7b271e Handle regmasks in MachineCSE.
Don't attempt to extend physreg live ranges across calls.

<rdar://problem/10942095>

llvm-svn: 151610
2012-02-28 02:08:50 +00:00
Jakob Stoklund Olesen
e3a308c116 Handle regmasks in the machine code verifier.
llvm-svn: 151607
2012-02-28 01:42:41 +00:00
Jakob Stoklund Olesen
c6377253f7 Enable ARM base pointer when calling functions with large arguments.
When an outgoing call takes more than 2k of arguments on the stack, we
don't allocate that call frame in the prolog, but adjust the stack
pointer immediately before the call instead.

This causes problems with the emergency spill slot because PEI can't
track stack pointer adjustments on the second pass, and if the outgoing
arguments are too big, SP can't be used to reach the emergency spill
slot at all.

Work around these problems by ensuring there is a base or frame pointer
that can be used to access the emergency spill slot.

<rdar://problem/10917166>

llvm-svn: 151604
2012-02-28 01:15:01 +00:00
Michael J. Spencer
0aef1b9f18 [Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.
Add -D option to llvm-nm to dump dynamic symbols.

Patch by David Meyer.

llvm-svn: 151600
2012-02-28 00:40:37 +00:00
Chad Rosier
2eec1f2ac0 Fix 80-column violation.
llvm-svn: 151599
2012-02-28 00:23:01 +00:00
Bill Wendling
aa73b7af8d Add back removed code. It still causes LLVM to miscompile. But not having it breaks other things.
llvm-svn: 151594
2012-02-27 23:48:30 +00:00
Preston Gurd
e0609ed607 This patch adds instruction latencies for the SSE instructions
to the instruction scheduler for the Intel Atom.

llvm-svn: 151590
2012-02-27 23:35:03 +00:00
Eli Friedman
1ff1d1f1bc Duncan pointed out that if the alignment isn't explicitly specified, it defaults to the ABI alignment. Given that, make this code a bit more aggressive in such cases.
llvm-svn: 151584
2012-02-27 23:16:46 +00:00
Evandro Menezes
aa5e01bb84 Delete incorrect reference to inexistent Hexagon architecture manuals.
llvm-svn: 151582
2012-02-27 23:00:52 +00:00
Bill Wendling
f1e75dd4b1 Don't use #if 0. Just remove until I can address this.
llvm-svn: 151580
2012-02-27 22:55:40 +00:00
Bill Wendling
0f3c5db06e The code that cleans up multiple, isomorphic types has a subtle error that
manifests itself when building LLVM with LTO.
<rdar://problem/10913281>

llvm-svn: 151576
2012-02-27 22:34:19 +00:00
Evan Cheng
9627003887 Fix for PR12090: clear def maps of aliases when visiting a copy. e.g.
%S5<def> = COPY %S0<kill>
First clear def map of Q1, etc.

No small test case available.

llvm-svn: 151574
2012-02-27 21:46:42 +00:00
Jim Grosbach
02bf78f5ca ARM BL/BLX instruction fixups should use relocations.
We on the linker to resolve calls to the appropriate BL/BLX instruction
to make interworking function correctly. It uses the symbol in the
relocation to do that, so we need to be careful about being too clever.

To enable this for ARM mode, split the BL/BLX fixup kind off from the
unconditional-branch fixups.

rdar://10927209

llvm-svn: 151571
2012-02-27 21:36:23 +00:00
Eli Friedman
15f56db6c0 Teach BasicAA about the LLVM IR rules that allow reading past the end of an object given sufficient alignment. Fixes PR12098.
llvm-svn: 151553
2012-02-27 20:46:07 +00:00
Roman Divacky
200acf8e6e Reapply r151278 with fixes.
MCize function entry label emission on PowerPC64 properly.

llvm-svn: 151547
2012-02-27 20:20:47 +00:00
Chad Rosier
ff495392fa Add q suffix aliases for the fistp and fisttp mnemonics.
rdar://10921670
PR11935

llvm-svn: 151543
2012-02-27 19:43:12 +00:00
Akira Hatanaka
28521d25c9 Remove unnecessary template parameters.
llvm-svn: 151540
2012-02-27 19:17:53 +00:00
Akira Hatanaka
1e3ba02d8d Fix instruction predicates that were not set correctly.
llvm-svn: 151538
2012-02-27 19:09:08 +00:00
Jakob Stoklund Olesen
edc3446412 Update machine code verifier.
After the SlotIndex slot names were updated, it is possible to apply
stricter checks to live intervals.

Also treat bundles as bags of operands when checking live intervals.

llvm-svn: 151531
2012-02-27 18:24:30 +00:00
Kevin Enderby
91d284c5de Fix the symbolic operand added for the C disassmbler API for the ARM bl
thumb instruction.  The PC adjustment is +4 in Thumb mode and +8 in ARM mode.

llvm-svn: 151530
2012-02-27 18:15:15 +00:00
Benjamin Kramer
e96ae5392c Plog a memleak in GlobalOpt.
Found by valgrind.

llvm-svn: 151525
2012-02-27 12:48:24 +00:00
Duncan Sands
0f1520e70b Micro-optimization, no functionality change.
llvm-svn: 151524
2012-02-27 12:11:41 +00:00
Duncan Sands
7dc8ff6615 The value numbering function is recursive, so it is possible for multiple new
value numbers to be assigned when calculating any particular value number.
Enhance the logic that detects new value numbers to take this into account,
for a tiny compile time speedup.  Fix a comment typo while there.

llvm-svn: 151522
2012-02-27 09:54:35 +00:00
Duncan Sands
9e95178a81 When performing a conditional branch depending on the value of a comparison
%cmp (eg: A==B) we already replace %cmp with "true" under the true edge, and
with "false" under the false edge.  This change enhances this to replace the
negated compare (A!=B) with "false" under the true edge and "true" under the
false edge.  Reported to improve perlbench results by 1%.

llvm-svn: 151517
2012-02-27 08:14:30 +00:00
Craig Topper
9d9d92eab0 Remove HexagonGenIntrinsics.inc from Hexagon cmake file. It does not appear in the Makefile and the output it produces isn't used. The Hexagon intrinsics are all in the global Intrinsics.gen.
llvm-svn: 151514
2012-02-27 02:59:43 +00:00
Jia Liu
65a3b4e8b8 delete useless comment&blank
llvm-svn: 151512
2012-02-27 02:21:34 +00:00
Rafael Espindola
2d9b864afe Fix this assert. IP can point to an instruction with strange dominance
properties (invoke). Just assert that the instruction we return dominates
the insertion point.

llvm-svn: 151511
2012-02-27 02:13:03 +00:00
Craig Topper
ab46706aa9 X86 disassembler support for jcxz, jecxz, and jrcxz. Fixes PR11643. Patch by Kay Tiong Khoo.
llvm-svn: 151510
2012-02-27 01:54:29 +00:00
Rafael Espindola
c333947449 Don't call dominates on unreachable instructions. Should fix the dragonegg
build. Testcase is still reducing.

llvm-svn: 151474
2012-02-26 05:30:08 +00:00
Hal Finkel
abe41f723f Default TargetData alignment information for 128-bit floating-point types.
llvm-svn: 151473
2012-02-26 04:13:31 +00:00
Rafael Espindola
137548bb3e And update the comment...
llvm-svn: 151472
2012-02-26 02:36:56 +00:00
Rafael Espindola
e63adef174 Enable the assert that got all this dominator work started.
llvm-svn: 151471
2012-02-26 02:29:18 +00:00
Rafael Espindola
c97c3343f1 Use the DT dominates function in the verifier.
llvm-svn: 151470
2012-02-26 02:23:37 +00:00
Rafael Espindola
34b7c064cb Change the implementation of dominates(inst, inst) to one based on what the
verifier does. This correctly handles invoke.
Thanks to Duncan, Andrew and Chris for the comments.
Thanks to Joerg for the early testing.

llvm-svn: 151469
2012-02-26 02:19:19 +00:00
Rafael Espindola
f5f6146ba4 Don't call dominates on unreachable instructions.
llvm-svn: 151468
2012-02-26 02:14:25 +00:00
Nick Lewycky
a93c874757 Reinstate the optimization from r151449 with a fix to not turn 'gep %x' into
'gep null' when the icmp predicate is unsigned (or is signed without inbounds).

llvm-svn: 151467
2012-02-26 02:09:49 +00:00
Rafael Espindola
d9e654ca63 Don't call dominates on unreachable instructions.
llvm-svn: 151466
2012-02-26 01:50:14 +00:00
Nick Lewycky
849715d31f Roll these back to r151448 until I figure out how they're breaking
MultiSource/Applications/lua.

llvm-svn: 151463
2012-02-25 23:01:19 +00:00
Nick Lewycky
1636c6eaef An argument and a local identified object (eg. a noalias call) could turn out
equal if both are null. In the test, scope type %t and global @y by adding a
'gep' prefix to them.

llvm-svn: 151452
2012-02-25 20:19:07 +00:00
Nick Lewycky
808d0e3fa7 Fix five-letter typo in comment.
llvm-svn: 151450
2012-02-25 19:12:58 +00:00
Nick Lewycky
94be1c7d95 Teach instsimplify to be more aggressive when analyzing comparisons of pointers
by using llvm::isIdentifiedObject. Also teach it to handle GEPs that have
the same base pointer and constant operands. Fixes PR11238!

llvm-svn: 151449
2012-02-25 19:07:42 +00:00
Nick Lewycky
dce2cfc335 Move isKnownNonNull from private implementation detail of BasicAA to a public
function that others can use, next to llvm::isIdentifiedObject.

llvm-svn: 151446
2012-02-25 10:56:28 +00:00
Nick Lewycky
57a70ec2c4 Remove spurious emacs mode marker.
llvm-svn: 151440
2012-02-25 07:20:06 +00:00
Hal Finkel
3aea686faa Revert r151278, breaks static linking.
Reverting this because it breaks static linking on ppc64. Specifically, it may be linkonce_odr functions that are the problem.
With this patch, if you link statically, calls to some functions end up calling their descriptor addresses instead
of calling to their entry points. This causes the execution to fail with SIGILL (b/c the descriptor address just
has some pointers, not code).

llvm-svn: 151433
2012-02-25 03:40:11 +00:00
NAKAMURA Takumi
17b6271b41 Target/X86: Fix assertion failures and warnings caused by r151382 _ftol2 lowering for i386-*-win32 targets. Patch by Joe Groff.
[Joe Groff] Hi everyone. My previous patch applied as r151382 had a few problems:
Clang raised a warning, and X86 LowerOperation would assert out for
fptoui f64 to i32 because it improperly lowered to an illegal
BUILD_PAIR. Here's a patch that addresses these issues. Let me know if
any other changes are necessary. Thanks.

llvm-svn: 151432
2012-02-25 03:37:25 +00:00
Chad Rosier
7ebe024853 Add comment.
llvm-svn: 151431
2012-02-25 03:07:57 +00:00
Chad Rosier
096b8c0365 Add support for disabling llvm.lifetime intrinsics in the AlwaysInliner. These
are optimization hints, but at -O0 we're not optimizing.  This becomes a problem
when the alwaysinline attribute is abused.
rdar://10921594

llvm-svn: 151429
2012-02-25 02:56:01 +00:00
Lang Hames
25553028ff Make the peephole optimizer clear kill flags on a vreg if it's about to add new
uses of the vreg, since the old kills may no longer be valid.  This was causing
-verify-machineinstrs to complain about uses after kills, and could potentially
have been causing subtle register allocation issues, but I haven't come across a
test case yet.

llvm-svn: 151425
2012-02-25 02:01:00 +00:00
Chad Rosier
06b04ed725 Fix indentation.
llvm-svn: 151420
2012-02-25 01:10:59 +00:00
Eric Christopher
3975f7b73a Grammar-o.
llvm-svn: 151418
2012-02-25 01:02:44 +00:00
Lang Hames
6ec3b488f8 Fixed typo.
llvm-svn: 151417
2012-02-25 00:46:38 +00:00
Akira Hatanaka
8fc9a35d3f Add definitions of floating point multiply add/sub and negative multiply
add/sub instructions.

llvm-svn: 151415
2012-02-25 00:21:52 +00:00
Akira Hatanaka
3b3ee53886 Add an option to use a virtual register as the global base register instead of
reserving a physical register ($gp or $28) for that purpose.

This will completely eliminate loads that restore the value of $gp after every
function call, if the register allocator assigns a callee-saved register, or
eliminate unnecessary loads if it assigns a temporary register. 

example:

.cpload $25       // set $gp.
...
.cprestore 16     // store $gp to stack slot 16($sp).
...
jalr $25          // function call. clobbers $gp.
lw $gp, 16($sp)   // not emitted if callee-saved reg is chosen.
...
lw $2, 4($gp)
...
jalr $25          // function call.
lw $gp, 16($sp)   // not emitted if $gp is not live after this instruction.
...

llvm-svn: 151402
2012-02-24 22:34:47 +00:00
Benjamin Kramer
62ed7b9b09 Remove unused cl::opt, make another opt static.
llvm-svn: 151398
2012-02-24 22:09:25 +00:00
Jakob Stoklund Olesen
090f01cde9 Add missing static
llvm-svn: 151396
2012-02-24 21:52:44 +00:00
Ahmed Charles
1f34683467 Fix undefined behavior.
llvm-svn: 151385
2012-02-24 19:06:15 +00:00
Jim Grosbach
33082fabe9 Thumb2 asm aliases for wide bitwise w/ immediate instructions.
llvm-svn: 151384
2012-02-24 19:06:05 +00:00
Chris Lattner
b01936f21a fix PR12075, a regression in a recent transform I added. In unreachable code, gep chains can be infinite. Just like "stripPointerCasts", use a set to keep track of visited instructions so we don't recurse infinitely.
llvm-svn: 151383
2012-02-24 19:01:58 +00:00
Michael J. Spencer
d2f0ce2674 Add WIN_FTOL_* psudo-instructions to model the unique calling convention
used by the Win32 _ftol2 runtime function. Patch by Joe Groff!

llvm-svn: 151382
2012-02-24 19:01:22 +00:00
Jakob Stoklund Olesen
c077e0f945 Add a -stress-regalloc=<N> option.
This will limit all register classes to N registers in order to stress
test register allocation.

llvm-svn: 151379
2012-02-24 18:34:20 +00:00
Hal Finkel
784c4bf068 X11/X2 loads around indirect calls on ppc64 should not be deleted.
llvm-svn: 151374
2012-02-24 17:54:01 +00:00
Hal Finkel
8c2c90c035 Don't crash when a glue node contains an internal CopyToReg
This is necessary to support the existing ppc lowering code for indirect calls.
Fixes PR12071.

llvm-svn: 151373
2012-02-24 17:53:59 +00:00
Duncan Sands
30c1ce0834 Teach GVN that x+y is the same as y+x and that x<y is the same as y>x.
llvm-svn: 151365
2012-02-24 15:16:31 +00:00
Benjamin Kramer
993a8a86dd SDAGBuilder: Remove register sets that were never read and prune dead code surrounding it.
llvm-svn: 151364
2012-02-24 14:01:17 +00:00
Richard Osborne
7a75ee5a60 Remove dead code.
Patch by Ahmed Charles

llvm-svn: 151360
2012-02-24 11:49:08 +00:00
Duncan Sands
4c85da8a2a Workaround a miscompilation by gcc-4.3 that showed up as a failure
of the StringRef.Split2 unittest on 32 bit machines.

llvm-svn: 151358
2012-02-24 09:01:34 +00:00
Nick Lewycky
04735e1180 ScheduleDAGInstrs.h:155: warning: suggest parentheses around &&' within ||'.
llvm-svn: 151355
2012-02-24 07:59:05 +00:00
Andrew Trick
5c9371d10f PostRA sched: speed up physreg tracking by not abusing SparseSet.
llvm-svn: 151348
2012-02-24 07:04:55 +00:00
Jim Grosbach
34ae41aecb ARM Thumb symbol references in assembly need the low bit set.
Add support for a missed case when the symbols in a difference
expression are in the same section but not the same fragment.

rdar://10924681

llvm-svn: 151345
2012-02-24 05:12:18 +00:00