oota-llvm.git
12 years ago[llvm.py] Make LLVMObject.__del__ work if called during __init__
Gregory Szorc [Sat, 10 Mar 2012 21:01:14 +0000 (21:01 +0000)]
[llvm.py] Make LLVMObject.__del__ work if called during __init__

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152505 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove llc + target triple tests into X86
Andrew Trick [Sat, 10 Mar 2012 19:03:51 +0000 (19:03 +0000)]
Move llc + target triple tests into X86

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152502 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAs Duncan pointed out, pointers tend not to be in floating point format...for now.
Bill Wendling [Sat, 10 Mar 2012 18:20:55 +0000 (18:20 +0000)]
As Duncan pointed out, pointers tend not to be in floating point format...for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152499 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't try to filecheck bitcode.
Benjamin Kramer [Sat, 10 Mar 2012 18:07:46 +0000 (18:07 +0000)]
Don't try to filecheck bitcode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152498 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake this transformation slightly less agressive and more correct.
Bill Wendling [Sat, 10 Mar 2012 17:56:03 +0000 (17:56 +0000)]
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'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152497 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoC files in llvm still have to be C89 compliant, remove C++-style comments.
Benjamin Kramer [Sat, 10 Mar 2012 15:10:06 +0000 (15:10 +0000)]
C files in llvm still have to be C89 compliant, remove C++-style comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152495 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMicrooptimize getVRegDef. def_begin isn't free, don't compute it twice.
Benjamin Kramer [Sat, 10 Mar 2012 12:50:44 +0000 (12:50 +0000)]
Microoptimize getVRegDef. def_begin isn't free, don't compute it twice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152492 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor some methods to look through bitcasts and GEPs on pointers into
Chandler Carruth [Sat, 10 Mar 2012 08:39:09 +0000 (08:39 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152490 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix disasm of iret, sysexit, and sysret when displayed with Intel syntax.
Bill Wendling [Sat, 10 Mar 2012 07:37:27 +0000 (07:37 +0000)]
Fix disasm of iret, sysexit, and sysret when displayed with Intel syntax.
Patch by Kay Tiong Khoo!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152487 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement a more intelligent way of spilling uses across an invoke boundary.
Bill Wendling [Sat, 10 Mar 2012 07:11:55 +0000 (07:11 +0000)]
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152486 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[llvm.py] Define enumerations from Core.h; add OpCode class
Gregory Szorc [Sat, 10 Mar 2012 05:50:56 +0000 (05:50 +0000)]
[llvm.py] Define enumerations from Core.h; add OpCode class

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152483 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[llvm.py] Implement interface to object files
Gregory Szorc [Sat, 10 Mar 2012 04:41:24 +0000 (04:41 +0000)]
[llvm.py] Implement interface to object files

It is now possible to load object files and scan over sections, symbols,
and relocations! Includes test code with partial coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152482 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix uses of the C99 PRI format macros not to conflict with C++11 UDLs.
Benjamin Kramer [Sat, 10 Mar 2012 02:04:38 +0000 (02:04 +0000)]
Fix uses of the C99 PRI format macros not to conflict with C++11 UDLs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152474 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReport the defining instruction.
Jakob Stoklund Olesen [Sat, 10 Mar 2012 00:44:11 +0000 (00:44 +0000)]
Report the defining instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152460 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd SSA verification to MachineVerifier.
Jakob Stoklund Olesen [Sat, 10 Mar 2012 00:36:06 +0000 (00:36 +0000)]
Add SSA verification to MachineVerifier.

Somehow we never verified SSA dominance before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152458 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse SmallPtrSet instead of DenseSet.
Jakob Stoklund Olesen [Sat, 10 Mar 2012 00:36:04 +0000 (00:36 +0000)]
Use SmallPtrSet instead of DenseSet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152457 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoGive dagcombiner's worklist some inline capacity.
Benjamin Kramer [Sat, 10 Mar 2012 00:23:58 +0000 (00:23 +0000)]
Give dagcombiner's worklist some inline capacity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152454 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDo not custom lower i64 nodes if i64 is not a legal type. Move lines that set
Akira Hatanaka [Sat, 10 Mar 2012 00:03:50 +0000 (00:03 +0000)]
Do not custom lower i64 nodes if i64 is not a legal type. Move lines that set
operation action of nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152452 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoLower SETCC nodes during legalization. Previously, it was lowered in DAG combine...
Akira Hatanaka [Fri, 9 Mar 2012 23:46:03 +0000 (23:46 +0000)]
Lower SETCC nodes during legalization. Previously, it was lowered in DAG combine pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152450 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAssert on SSA errors in LiveVariables.
Jakob Stoklund Olesen [Fri, 9 Mar 2012 23:41:44 +0000 (23:41 +0000)]
Assert on SSA errors in LiveVariables.

All uses of a virtual register must be dominated by its def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152449 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused header files.
Akira Hatanaka [Fri, 9 Mar 2012 23:28:30 +0000 (23:28 +0000)]
Remove unused header files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152447 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched: handle scheduler that insert instructions at empty region boundaries.
Andrew Trick [Fri, 9 Mar 2012 22:34:56 +0000 (22:34 +0000)]
misched: handle scheduler that insert instructions at empty region boundaries.

And add comments, since this is obviously confusing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152445 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd the missing call to Error when a bad X86 scale expression is parsed.
Kevin Enderby [Fri, 9 Mar 2012 22:24:10 +0000 (22:24 +0000)]
Add the missing call to Error when a bad X86 scale expression is parsed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152443 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSupport reading GNU symbol versions in ELFObjectFile
David Meyer [Fri, 9 Mar 2012 20:59:52 +0000 (20:59 +0000)]
Support reading GNU symbol versions in ELFObjectFile

* Add enums and structures for GNU version information.
* Implement extraction of that information on a per-symbol basis (ELFObjectFile::getSymbolVersion).
* Implement a generic interface, GetELFSymbolVersion(), for getting the symbol version from the ObjectFile (hides the templating).
* Have llvm-readobj print out the version, when available.
* Add a test for the new feature: readobj-elf-versioning.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152436 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[Object]
David Meyer [Fri, 9 Mar 2012 20:41:57 +0000 (20:41 +0000)]
[Object]
Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152435 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd statistics on removed switch cases, and fix the phi statistic
Duncan Sands [Fri, 9 Mar 2012 19:21:15 +0000 (19:21 +0000)]
Add statistics on removed switch cases, and fix the phi statistic
to count the number of phis changed, not the number visited.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152425 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[llvm.py] Make ObjectFile destructor work
Gregory Szorc [Fri, 9 Mar 2012 18:56:33 +0000 (18:56 +0000)]
[llvm.py] Make ObjectFile destructor work

Previous code had a double free in MemoryBuffer. The tests now pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152422 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen identifying exit nodes for the reverse-CFG reverse-post-order
Dan Gohman [Fri, 9 Mar 2012 18:50:52 +0000 (18:50 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152421 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the x86 disassembler to at least print the lock prefix if it is the first
Kevin Enderby [Fri, 9 Mar 2012 17:52:49 +0000 (17:52 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152414 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[Support] Drop verbose _ATTRIBUTE from LLVM_ATTRIBUTE_{READONLY,READNONE} macro
Daniel Dunbar [Fri, 9 Mar 2012 16:30:33 +0000 (16:30 +0000)]
[Support] Drop verbose _ATTRIBUTE from LLVM_ATTRIBUTE_{READONLY,READNONE} macro
names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152413 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTableGen/CodeEmitterGen.cpp: Fix an expression of generating bitmask.
NAKAMURA Takumi [Fri, 9 Mar 2012 14:52:44 +0000 (14:52 +0000)]
TableGen/CodeEmitterGen.cpp: Fix an expression of generating bitmask.

~0U might be i32 on 32-bit hosts, then (uint64_t)~0U might not be expected as (i64)0xFFFFFFFF_FFFFFFFF, but as (i64)0x00000000_FFFFFFFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152407 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/MC/X86/lit.local.cfg: Fix up to detect 'X86' in targets.
NAKAMURA Takumi [Fri, 9 Mar 2012 14:52:38 +0000 (14:52 +0000)]
test/MC/X86/lit.local.cfg: Fix up to detect 'X86' in targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152406 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEliminate switch cases that can never match, for example removes all
Duncan Sands [Fri, 9 Mar 2012 13:45:18 +0000 (13:45 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152405 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for r600 (AMD GPUs HD2XXX - HD6XXX) target triplet.
Anton Korobeynikov [Fri, 9 Mar 2012 10:09:36 +0000 (10:09 +0000)]
Add support for r600 (AMD GPUs HD2XXX - HD6XXX) target triplet.

Patch by Tom Stellard!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152400 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFactor out the analysis of addition and subtraction in ComputeMaskedBits. Reuse
Nick Lewycky [Fri, 9 Mar 2012 09:23:50 +0000 (09:23 +0000)]
Factor out the analysis of addition and subtraction in ComputeMaskedBits. Reuse
it to analyze extractvalue(llvm.[us](add|sub).with.overflow.*) intrinsics!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152398 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[llvm.py] Initial skeleton for Python LLVM bindings
Gregory Szorc [Fri, 9 Mar 2012 09:07:35 +0000 (09:07 +0000)]
[llvm.py] Initial skeleton for Python LLVM bindings

This contains a semi-functional skeleton for the implementation of the
LLVM bindings for Python.

The API for the Object.h interface is roughly designed but not
implemented. MemoryBufferRef is implemented and actually appears to
work!

The ObjectFile unit test fails with a segmentation fault because the
LLVM library isn't being properly initialized. The build system doesn't
know about this code yet, so no alerts should fire.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152397 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched: handle scheduling region boundaries nicely.
Andrew Trick [Fri, 9 Mar 2012 08:02:51 +0000 (08:02 +0000)]
misched: handle scheduling region boundaries nicely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152393 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse uint16_t to store opcodes in static tables in X86 backend.
Craig Topper [Fri, 9 Mar 2012 07:45:21 +0000 (07:45 +0000)]
Use uint16_t to store opcodes in static tables in X86 backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152391 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix undefined behavior in the Mips backend.
Ahmed Charles [Fri, 9 Mar 2012 06:36:45 +0000 (06:36 +0000)]
Fix undefined behavior in the Mips backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152390 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched interface: rename Begin/End to RegionBegin/RegionEnd since they are not private.
Andrew Trick [Fri, 9 Mar 2012 04:29:02 +0000 (04:29 +0000)]
misched interface: rename Begin/End to RegionBegin/RegionEnd since they are not private.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152382 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched comments
Andrew Trick [Fri, 9 Mar 2012 03:46:42 +0000 (03:46 +0000)]
misched comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152374 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agorevert 152356: verify misched changes using -misched=shuffle.
Andrew Trick [Fri, 9 Mar 2012 03:46:39 +0000 (03:46 +0000)]
revert 152356: verify misched changes using -misched=shuffle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152373 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a silly restriction on the fast-path for hash_combine_range. This
Chandler Carruth [Fri, 9 Mar 2012 02:49:38 +0000 (02:49 +0000)]
Fix a silly restriction on the fast-path for hash_combine_range. This
caused several clients to select the slow variation. =[ This is extra
annoying because we don't have any realistic way of testing this -- by
design, these two functions *must* compute the same value.

Found while inspecting the output of some benchmarks I'm working on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152369 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUndo a previous restriction on the inline cost calculation which Nick
Chandler Carruth [Fri, 9 Mar 2012 02:49:36 +0000 (02:49 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152368 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a regression from r147481.
Chad Rosier [Fri, 9 Mar 2012 02:00:48 +0000 (02:00 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152366 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched: allow the default scheduler to be one chosen by the target.
Andrew Trick [Fri, 9 Mar 2012 00:52:20 +0000 (00:52 +0000)]
misched: allow the default scheduler to be one chosen by the target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152360 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdded TargetPassConfig::enablePass
Andrew Trick [Fri, 9 Mar 2012 00:52:17 +0000 (00:52 +0000)]
Added TargetPassConfig::enablePass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152359 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCache MBB->begin. It's possible the scheduler / bundler may change MBB->begin().
Evan Cheng [Fri, 9 Mar 2012 00:24:29 +0000 (00:24 +0000)]
Cache MBB->begin. It's possible the scheduler / bundler may change MBB->begin().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152356 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSilence unused function warning when graphviz is not available.
Benjamin Kramer [Thu, 8 Mar 2012 22:15:23 +0000 (22:15 +0000)]
Silence unused function warning when graphviz is not available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152346 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the no longer existent psp triple from a test.
Benjamin Kramer [Thu, 8 Mar 2012 21:22:27 +0000 (21:22 +0000)]
Remove the no longer existent psp triple from a test.

The test fell back to the C backend, making it useless and it started to fail
on configurations that don't build the C backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHave llvm-mc --version print the list of registered targets like llc does.
Duncan Sands [Thu, 8 Mar 2012 14:24:32 +0000 (14:24 +0000)]
Have llvm-mc --version print the list of registered targets like llc does.
Patch by jey.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152315 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert commit 152300 (ddunbar) since it still seems to be breaking
Duncan Sands [Thu, 8 Mar 2012 09:32:21 +0000 (09:32 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152304 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse uint16_t to store instruction implicit uses and defs. Reduces static data.
Craig Topper [Thu, 8 Mar 2012 08:22:45 +0000 (08:22 +0000)]
Use uint16_t to store instruction implicit uses and defs. Reduces static data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152301 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
Daniel Dunbar [Thu, 8 Mar 2012 07:42:18 +0000 (07:42 +0000)]
[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152300 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTaken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
Stepan Dyatkovskiy [Thu, 8 Mar 2012 07:06:20 +0000 (07:06 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRe-commit r152202 hopefully fixing the MSVC linker error.
Craig Topper [Thu, 8 Mar 2012 06:55:27 +0000 (06:55 +0000)]
Re-commit r152202 hopefully fixing the MSVC linker error.

Original commit message:
Use uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect all 16-bit string table offsets. Also make sure the string to offset table string is not larger than 65536 characters since larger string literals aren't portable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152296 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r152288, "[ADT] Change the trivial FoldingSetNodeID::Add* methods to be
Daniel Dunbar [Thu, 8 Mar 2012 04:17:15 +0000 (04:17 +0000)]
Revert r152288, "[ADT] Change the trivial FoldingSetNodeID::Add* methods to be
inline.", which is breaking the bots in a way I don't understand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152295 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest case for r152280, r152285 and r152290.
Akira Hatanaka [Thu, 8 Mar 2012 03:32:42 +0000 (03:32 +0000)]
Test case for r152280, r152285 and r152290.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInvoke setTargetDAGCombine for SELECT.
Akira Hatanaka [Thu, 8 Mar 2012 03:26:37 +0000 (03:26 +0000)]
Invoke setTargetDAGCombine for SELECT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152290 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline.
Daniel Dunbar [Thu, 8 Mar 2012 02:52:00 +0000 (02:52 +0000)]
[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152288 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwap the operands of a select node if the false (the second) operand is 0.
Akira Hatanaka [Thu, 8 Mar 2012 02:14:24 +0000 (02:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152285 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRotate two of the functions used to count bonuses for the inline cost
Chandler Carruth [Thu, 8 Mar 2012 02:04:19 +0000 (02:04 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSet minimum function alignment to 3 if target is Mips64.
Akira Hatanaka [Thu, 8 Mar 2012 01:59:33 +0000 (01:59 +0000)]
Set minimum function alignment to 3 if target is Mips64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152282 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThis patch eliminates redundant instructions that produce 0.
Akira Hatanaka [Thu, 8 Mar 2012 01:51:59 +0000 (01:51 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched interface: Expose the MachineScheduler pass.
Andrew Trick [Thu, 8 Mar 2012 01:41:12 +0000 (01:41 +0000)]
misched interface: Expose the MachineScheduler pass.

Allow targets to provide their own schedulers (subclass of
ScheduleDAGInstrs) to the misched pass. Select schedulers using
-misched=...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152278 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoARM don't use MCRelaxAll, as it's not safe on ARM.
Jim Grosbach [Thu, 8 Mar 2012 00:07:52 +0000 (00:07 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152268 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImproved support in RuntimeDyldMachO for generating
Sean Callanan [Wed, 7 Mar 2012 23:05:25 +0000 (23:05 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152264 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup VLIWPacketizer to use the updated ScheduleDAGInstrs interface.
Andrew Trick [Wed, 7 Mar 2012 23:01:09 +0000 (23:01 +0000)]
Cleanup VLIWPacketizer to use the updated ScheduleDAGInstrs interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152262 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: Expose the ScheduleDAGInstrs interface so targets may
Andrew Trick [Wed, 7 Mar 2012 23:01:06 +0000 (23:01 +0000)]
misched prep: Expose the ScheduleDAGInstrs interface so targets may
implement their own MachineScheduler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152261 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: Remove LLVM_LIBRARY_VISIBILITY from ScheduleDAGInstrs.
Andrew Trick [Wed, 7 Mar 2012 23:01:02 +0000 (23:01 +0000)]
misched prep: Remove LLVM_LIBRARY_VISIBILITY from ScheduleDAGInstrs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152260 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: Comment the ScheduleDAGInstrs interface.
Andrew Trick [Wed, 7 Mar 2012 23:00:59 +0000 (23:00 +0000)]
misched prep: Comment the ScheduleDAGInstrs interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152259 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: Cleanup ScheduleDAGInstrs interface.
Andrew Trick [Wed, 7 Mar 2012 23:00:57 +0000 (23:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152258 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: remove extra "protected"
Andrew Trick [Wed, 7 Mar 2012 23:00:54 +0000 (23:00 +0000)]
misched prep: remove extra "protected"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152257 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched prep: rename InsertPos to End.
Andrew Trick [Wed, 7 Mar 2012 23:00:52 +0000 (23:00 +0000)]
misched prep: rename InsertPos to End.

ScheduleDAGInstrs knows nothing about how instructions will be moved or inserted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152256 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched preparation: rename core scheduler methods for consistency.
Andrew Trick [Wed, 7 Mar 2012 23:00:49 +0000 (23:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCopy the right amount of elements.
Benjamin Kramer [Wed, 7 Mar 2012 22:48:42 +0000 (22:48 +0000)]
Copy the right amount of elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152254 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSmallPtrSet: Copy all the elements when swapping, not just numelements.
Benjamin Kramer [Wed, 7 Mar 2012 22:33:21 +0000 (22:33 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152252 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[fast-isel] ARMEmitCmp generates FMSTAT, which transfers the floating-point
Chad Rosier [Wed, 7 Mar 2012 20:59:26 +0000 (20:59 +0000)]
[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>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152243 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse llvm-mc instead of llc. Patch by Jack Carter.
Rafael Espindola [Wed, 7 Mar 2012 20:58:59 +0000 (20:58 +0000)]
Use llvm-mc instead of llc. Patch by Jack Carter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152242 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoconfigure: Don't require a perl interpreter to be present, LLVM's buildsystem doesn...
Benjamin Kramer [Wed, 7 Mar 2012 17:07:20 +0000 (17:07 +0000)]
configure: Don't require a perl interpreter to be present, LLVM's buildsystem doesn't depend on perl anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152234 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r152202 as it's causing internal buildbot failures.
Chad Rosier [Wed, 7 Mar 2012 17:06:40 +0000 (17:06 +0000)]
Revert r152202 as it's causing internal buildbot failures.

Original commit message:
Use uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect
all 16-bit string table offsets. Also make sure the string to offset table
string is not larger than 65536 characters since larger string literals aren't
portable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152233 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix infinite loop in nested multiclasses.
Jakob Stoklund Olesen [Wed, 7 Mar 2012 16:39:35 +0000 (16:39 +0000)]
Fix infinite loop in nested multiclasses.

Patch by Michael Liao!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152232 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTry a completely different approach to this type trait to appease older
Chandler Carruth [Wed, 7 Mar 2012 12:27:35 +0000 (12:27 +0000)]
Try a completely different approach to this type trait to appease older
compilers. It seems that GCC 4.3 (and likely older) simply aren't going
to do SFINAE on non-type template parameters the way Clang and modern
GCCs do...

Now we detect the implicit conversion to an integer type, and then
blacklist classes, pointers, and floating point types. This seems to
work well enough, and I'm hopeful will return the bots to life.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152227 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttempt #2 at appeasing GCC 4.3. This compiler really doesn't like these
Chandler Carruth [Wed, 7 Mar 2012 11:31:11 +0000 (11:31 +0000)]
Attempt #2 at appeasing GCC 4.3. This compiler really doesn't like these
traits.

With this change, the pattern used here is *extremely* close to the
pattern used elsewhere in the file, so I'm hoping it survives the
build-bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152225 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTry to clarify this comment some.
Chandler Carruth [Wed, 7 Mar 2012 10:13:40 +0000 (10:13 +0000)]
Try to clarify this comment some.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152221 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch the is_integral_or_enum trait machinery to use an explicit
Chandler Carruth [Wed, 7 Mar 2012 10:05:35 +0000 (10:05 +0000)]
Switch the is_integral_or_enum trait machinery to use an explicit
template argument and an *implicit* conversion from '0' to a null
pointer. For some bizarre reason, GCC 4.3.2 thinks that the cast to
'(T*)' is invalid inside of an enumerator's value... which it isn't but
whatever. ;] This pattern is used elsewhere in the type_traits header
and so hopefully will survive the wrath of the build bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152220 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhat's better than fixing and simplifying broken hash functions?
Chandler Carruth [Wed, 7 Mar 2012 09:54:06 +0000 (09:54 +0000)]
What's better than fixing and simplifying broken hash functions?
Deleting them because they aren't used. =D

Yell if you need these, I'm happy to instead replace them with nice uses
of the new infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152219 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove another outbreak of customized (and completely broken) hashing.
Chandler Carruth [Wed, 7 Mar 2012 09:39:46 +0000 (09:39 +0000)]
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...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152218 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support to the hashing infrastructure for automatically hashing both
Chandler Carruth [Wed, 7 Mar 2012 09:32:32 +0000 (09:32 +0000)]
Add support to the hashing infrastructure for automatically hashing both
integral and enumeration types. This is accomplished with a bit of
template type trait magic. Thanks to Richard Smith for the core idea
here to detect viable types by detecting the set of types which can be
default constructed in a template parameter.

This is used (in conjunction with a system for detecting nullptr_t
should it exist) to provide an is_integral_or_enum type trait that
doesn't need a whitelist or direct compiler support.

With this, the hashing is extended to the more general facility. This
will be used in a subsequent commit to hashing more things, but I wanted
to make sure the type trait magic went through the build bots separately
in case other compilers don't like this formulation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152217 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhere the BranchFolding pass removes a branch then adds another better branch,
Bill Wendling [Wed, 7 Mar 2012 08:49:42 +0000 (08:49 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152212 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix cmake
Andrew Trick [Wed, 7 Mar 2012 05:46:04 +0000 (05:46 +0000)]
Fix cmake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152210 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agocomment
Andrew Trick [Wed, 7 Mar 2012 05:21:54 +0000 (05:21 +0000)]
comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152209 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched preparation: clarify ScheduleDAG and ScheduleDAGInstrs roles.
Andrew Trick [Wed, 7 Mar 2012 05:21:52 +0000 (05:21 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152208 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoScheduleDAGInstrs comments
Andrew Trick [Wed, 7 Mar 2012 05:21:47 +0000 (05:21 +0000)]
ScheduleDAGInstrs comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152207 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched preparation: modularize schedule emission.
Andrew Trick [Wed, 7 Mar 2012 05:21:44 +0000 (05:21 +0000)]
misched preparation: modularize schedule emission.

ScheduleDAG has nothing to do with how the instructions are scheduled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152206 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched preparation: modularize schedule printing.
Andrew Trick [Wed, 7 Mar 2012 05:21:40 +0000 (05:21 +0000)]
misched preparation: modularize schedule printing.

ScheduleDAG will not refer to the scheduled instruction sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152205 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomisched preparation: modularize schedule verification.
Andrew Trick [Wed, 7 Mar 2012 05:21:36 +0000 (05:21 +0000)]
misched preparation: modularize schedule verification.

ScheduleDAG will not refer to the scheduled instruction sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152204 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agowhitespace
Andrew Trick [Wed, 7 Mar 2012 05:21:32 +0000 (05:21 +0000)]
whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152203 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect all...
Craig Topper [Wed, 7 Mar 2012 05:17:23 +0000 (05:17 +0000)]
Use uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect all 16-bit string table offsets. Also make sure the string to offset table string is not larger than 65536 characters since larger string literals aren't portable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152202 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMissing change in r152106 for TinyPtrVector.
Eli Friedman [Wed, 7 Mar 2012 03:37:32 +0000 (03:37 +0000)]
Missing change in r152106 for TinyPtrVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152201 91177308-0d34-0410-b5e6-96231b3b80d8