oota-llvm.git
12 years agoFix bug in TRI::getCommonSuperRegClass().
Jakob Stoklund Olesen [Mon, 7 May 2012 21:59:31 +0000 (21:59 +0000)]
Fix bug in TRI::getCommonSuperRegClass().

Test cases for this code are coming. It is not used for anything yet.

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

12 years agoTeach DAG combine to fold x-x to 0.0 when unsafe FP math is enabled.
Owen Anderson [Mon, 7 May 2012 20:51:25 +0000 (20:51 +0000)]
Teach DAG combine to fold x-x to 0.0 when unsafe FP math is enabled.

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

12 years agoTeach reassociate to commute FMul's and FAdd's in order to canonicalize the order...
Owen Anderson [Mon, 7 May 2012 20:47:23 +0000 (20:47 +0000)]
Teach reassociate to commute FMul's and FAdd's in order to canonicalize the order of their operands across instructions.  This allows for greater CSE opportunities.

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

12 years agoMake IntelJITEvents and OProfileJIT as optional libraries and add
Preston Gurd [Mon, 7 May 2012 19:38:40 +0000 (19:38 +0000)]
Make IntelJITEvents and OProfileJIT as optional libraries and add
optional library support to the llvm-build tool:
 - Add new command line parameter to llvm-build: “--enable-optional-libraries”
 - Add handing of new llvm-build library type “OptionalLibrary”
 - Update Cmake and automake build systems to pass correct flags to llvm-build
   based on configuration

Patch by Dan Malea!

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

12 years agoConstify (trivially) ImmutableSet::iterator::getVisitState().
Jordy Rose [Mon, 7 May 2012 19:24:40 +0000 (19:24 +0000)]
Constify (trivially) ImmutableSet::iterator::getVisitState().

This was probably intended all along.

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

12 years agoAdd TRI::getCommonSuperRegClass().
Jakob Stoklund Olesen [Mon, 7 May 2012 19:14:58 +0000 (19:14 +0000)]
Add TRI::getCommonSuperRegClass().

This function is a generalization of getMatchingSuperRegClass() to the
symmetric case where both sides are using a sub-register index. It will
find a super-register class and sub-register indexes that make this
diagram commute:

                                   PreA
                       SuperRC  ---------->  RCA

                          |                   |
                          |                   |
                     PreB |                   | SubA
                          |                   |
                          |                   |
                          V                   V

                         RCB    ----------> SubRC
                                   SubB

This can be used to coalesce copies like:

  %vreg1:sub16 = COPY %vreg2:sub16; GR64:%vreg1, GR32: %vreg2

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

12 years agoFix a regression from r147481. This combine should only happen if there is a
Chad Rosier [Mon, 7 May 2012 18:47:44 +0000 (18:47 +0000)]
Fix a regression from r147481.  This combine should only happen if there is a
single use.
rdar://11360370

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

12 years agoDon't assume size_t is unsigned long long.
Matt Beaumont-Gay [Mon, 7 May 2012 18:12:42 +0000 (18:12 +0000)]
Don't assume size_t is unsigned long long.

Fixes a -Woverflow warning from gcc when building for 32-bit platforms.

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

12 years agoX86: optimization for -(x != 0)
Manman Ren [Mon, 7 May 2012 18:06:23 +0000 (18:06 +0000)]
X86: optimization for -(x != 0)

This patch will optimize -(x != 0) on X86
FROM
cmpl $0x01,%edi
sbbl %eax,%eax
notl %eax
TO
negl %edi
sbbl %eax %eax

In order to generate negl, I added patterns in Target/X86/X86InstrCompiler.td:
def : Pat<(X86sub_flag 0, GR32:$src), (NEG32r GR32:$src)>;

rdar: 10961709

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

12 years agoAdd support for the 'x' constraint.
Eric Christopher [Mon, 7 May 2012 06:25:19 +0000 (06:25 +0000)]
Add support for the 'x' constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'l' constraint.
Eric Christopher [Mon, 7 May 2012 06:25:15 +0000 (06:25 +0000)]
Add support for the 'l' constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'c' constraint.
Eric Christopher [Mon, 7 May 2012 06:25:10 +0000 (06:25 +0000)]
Add support for the 'c' constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'P' constraint.
Eric Christopher [Mon, 7 May 2012 06:25:02 +0000 (06:25 +0000)]
Add support for the 'P' constraint.

Patch by Jack Carter.

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

12 years agoFix trivial typo in llvm_move.
John McCall [Mon, 7 May 2012 06:00:23 +0000 (06:00 +0000)]
Fix trivial typo in llvm_move.

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

12 years agoFix some issues in the f16c instructions.
Craig Topper [Mon, 7 May 2012 06:00:15 +0000 (06:00 +0000)]
Fix some issues in the f16c instructions.

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

12 years agoAdd support for the 'O' constraint.
Eric Christopher [Mon, 7 May 2012 05:46:48 +0000 (05:46 +0000)]
Add support for the 'O' constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'N' inline asm constraint.
Eric Christopher [Mon, 7 May 2012 05:46:43 +0000 (05:46 +0000)]
Add support for the 'N' inline asm constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'L' inline asm constraint.
Eric Christopher [Mon, 7 May 2012 05:46:37 +0000 (05:46 +0000)]
Add support for the 'L' inline asm constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the inline asm constraint 'K'.
Eric Christopher [Mon, 7 May 2012 05:46:29 +0000 (05:46 +0000)]
Add support for the inline asm constraint 'K'.

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

12 years agoAdd SSE4A MOVNTSS/MOVNTSD instructions.
Craig Topper [Mon, 7 May 2012 05:36:19 +0000 (05:36 +0000)]
Add SSE4A MOVNTSS/MOVNTSD instructions.

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

12 years agoSupport the 'J' constraint.
Eric Christopher [Mon, 7 May 2012 03:13:42 +0000 (03:13 +0000)]
Support the 'J' constraint.

Patch by Jack Carter.

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

12 years agoAdd support for the 'I' inline asm constraint. Also add tests
Eric Christopher [Mon, 7 May 2012 03:13:32 +0000 (03:13 +0000)]
Add support for the 'I' inline asm constraint. Also add tests
from the previous 2 patches.

Patch by Jack Carter.

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

12 years agoAllow 64 bit integer values in gpu registers if arch and abi are 64 bit.
Eric Christopher [Mon, 7 May 2012 03:13:22 +0000 (03:13 +0000)]
Allow 64 bit integer values in gpu registers if arch and abi are 64 bit.

Patch by Jack Carter.

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

12 years agoWhen using inline asm constraints representing
Eric Christopher [Mon, 7 May 2012 03:13:16 +0000 (03:13 +0000)]
When using inline asm constraints representing
non-floating point general registers allow 8 and 16-bit
elements.

Patch by Jack Carter.

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

12 years agoTidy up. Whitespace.
Jim Grosbach [Mon, 7 May 2012 02:25:53 +0000 (02:25 +0000)]
Tidy up. Whitespace.

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

12 years agoUse MVT instead of EVT as the argument to all the shuffle decode functions. Simplify...
Craig Topper [Sun, 6 May 2012 19:46:21 +0000 (19:46 +0000)]
Use MVT instead of EVT as the argument to all the shuffle decode functions. Simplify some of the decode functions.

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

12 years agoAdd VPERMQ/VPERMPD to the list of target specific shuffles that can be looked through...
Craig Topper [Sun, 6 May 2012 18:54:26 +0000 (18:54 +0000)]
Add VPERMQ/VPERMPD to the list of target specific shuffles that can be looked through for DAG combine purposes.

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

12 years agoAdd shuffle decode support for VPERMQ/VPERMPD.
Craig Topper [Sun, 6 May 2012 18:44:02 +0000 (18:44 +0000)]
Add shuffle decode support for VPERMQ/VPERMPD.

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

12 years agoTableGen: AsmMatcher diagnostic when missing instruction mnemonic.
Jim Grosbach [Sun, 6 May 2012 17:33:14 +0000 (17:33 +0000)]
TableGen: AsmMatcher diagnostic when missing instruction mnemonic.

Previously, if an instruction definition was missing the mnemonic,
the next line would just assert(). Issue a real diagnostic instead.

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

12 years agomake SourceMgr tolerate empty SMLoc()'s better.
Chris Lattner [Sun, 6 May 2012 16:20:49 +0000 (16:20 +0000)]
make SourceMgr tolerate empty SMLoc()'s better.

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

12 years agoSwitch the select to branch transformation on by default.
Benjamin Kramer [Sun, 6 May 2012 14:25:16 +0000 (14:25 +0000)]
Switch the select to branch transformation on by default.

The primitive conservative heuristic seems to give a slight overall
improvement while not regressing stuff. Make it available to wider
testing. If you notice any speed regressions (or significant code
size regressions) let me know!

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

12 years agoRemove trailing spaces.
Jakub Staszak [Sun, 6 May 2012 13:52:31 +0000 (13:52 +0000)]
Remove trailing spaces.

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

12 years agoUnix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.
NAKAMURA Takumi [Sun, 6 May 2012 08:24:24 +0000 (08:24 +0000)]
Unix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.

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

12 years agoSupport/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix...
NAKAMURA Takumi [Sun, 6 May 2012 08:24:18 +0000 (08:24 +0000)]
Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.

FIXME: GetRandomNumber() is not implemented in Win32.

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

12 years agoreapply my patch, with a fix for an off-by-one error. Turned out to be a lot
Chris Lattner [Sat, 5 May 2012 22:17:32 +0000 (22:17 +0000)]
reapply my patch, with a fix for an off-by-one error.  Turned out to be a lot
of work for a drive-by fix :)

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

12 years agorevert my patches, which are causing problems.
Chris Lattner [Sat, 5 May 2012 22:11:04 +0000 (22:11 +0000)]
revert my patches, which are causing problems.

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

12 years agoadd missing header <shame>
Chris Lattner [Sat, 5 May 2012 22:04:11 +0000 (22:04 +0000)]
add missing header <shame>

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

12 years agorefactor some code to expose column numbers more and make diagnostic printing slightl...
Chris Lattner [Sat, 5 May 2012 21:39:51 +0000 (21:39 +0000)]
refactor some code to expose column numbers more and make diagnostic printing slightly more efficient.

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

12 years agoNuke a few dead remnants of the CBE.
Jim Grosbach [Sat, 5 May 2012 17:45:12 +0000 (17:45 +0000)]
Nuke a few dead remnants of the CBE.

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

12 years ago[Support] Add missing include.
Daniel Dunbar [Sat, 5 May 2012 16:49:11 +0000 (16:49 +0000)]
[Support] Add missing include.

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

12 years ago[Support] Fix up comments.
Daniel Dunbar [Sat, 5 May 2012 16:39:22 +0000 (16:39 +0000)]
[Support] Fix up comments.

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

12 years ago[Support] Rewrite sys::fs::unique_file to not be stupid with /dev/urandom.
Daniel Dunbar [Sat, 5 May 2012 16:36:24 +0000 (16:36 +0000)]
[Support] Rewrite sys::fs::unique_file to not be stupid with /dev/urandom.
 - Just use sys::Process::GetRandomNumber instead of having two poor
   implementations.
 - This is ~70 times (!) faster on my OS X machine.

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

12 years ago[Support] Add sys::Process::GetRandomNumber().
Daniel Dunbar [Sat, 5 May 2012 16:36:20 +0000 (16:36 +0000)]
[Support] Add sys::Process::GetRandomNumber().
 - Primitive API, but we rarely have need for random numbers.

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

12 years ago[build] Add build check for ::arc4random().
Daniel Dunbar [Sat, 5 May 2012 16:36:16 +0000 (16:36 +0000)]
[build] Add build check for ::arc4random().

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

12 years agoUpdate all outdated autoconf files in the sample project.
Benjamin Kramer [Sat, 5 May 2012 15:02:39 +0000 (15:02 +0000)]
Update all outdated autoconf files in the sample project.

We might just use symlinks here, but I'm afraid of possible portability issues.

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

12 years agoCodeGenPrepare: Add a transform to turn selects into branches in some cases.
Benjamin Kramer [Sat, 5 May 2012 12:49:22 +0000 (12:49 +0000)]
CodeGenPrepare: Add a transform to turn selects into branches in some cases.

This came up when a change in block placement formed a cmov and slowed down a
hot loop by 50%:

ucomisd (%rdi), %xmm0
cmovbel %edx, %esi

cmov is a really bad choice in this context because it doesn't get branch
prediction. If we emit it as a branch, an out-of-order CPU can do a better job
(if the branch is predicted right) and avoid waiting for the slow load+compare
instruction to finish. Of course it won't help if the branch is unpredictable,
but those are really rare in practice.

This patch uses a dumb conservative heuristic, it turns all cmovs that have one
use and a direct memory operand into branches. cmovs usually save some code
size, so we disable the transform in -Os mode. In-Order architectures are
unlikely to benefit as well, those are included in the
"predictableSelectIsExpensive" flag.

It would be better to reuse branch probability info here, but BPI doesn't
support select instructions currently. It would make sense to use the same
heuristics as the if-converter pass, which does the opposite direction of this
transform.

Test suite shows a small improvement here and there on corei7-level machines,
but the actual results depend a lot on the used microarchitecture. The
transformation is currently disabled by default and available by passing the
-enable-cgp-select2branch flag to the code generator.

Thanks to Chandler for the initial test case to him and Evan Cheng for providing
me with comments and test-suite numbers that were more stable than mine :)

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

12 years agoAdd a new target hook "predictableSelectIsExpensive".
Benjamin Kramer [Sat, 5 May 2012 12:49:14 +0000 (12:49 +0000)]
Add a new target hook "predictableSelectIsExpensive".

This will be used to determine whether it's profitable to turn a select into a
branch when the branch is likely to be predicted.

Currently enabled for everything but Atom on X86 and Cortex-A9 devices on ARM.

I'm not entirely happy with the name of this flag, suggestions welcome ;)

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

12 years agoNVPTX: Initialize the UseF32FTZ flag.
Benjamin Kramer [Sat, 5 May 2012 11:22:02 +0000 (11:22 +0000)]
NVPTX: Initialize the UseF32FTZ flag.

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

12 years agoSmall fix in InstCombineCasts.cpp. Restored "alloca + bitcast" reducing for case...
Stepan Dyatkovskiy [Sat, 5 May 2012 07:09:40 +0000 (07:09 +0000)]
Small fix in InstCombineCasts.cpp. Restored "alloca + bitcast" reducing for case when alloca's size is calculated within the "add/sub/... nsw".
Also added fix to 2011-06-13-nsw-alloca.ll test.

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

12 years agoTypo.
Eric Christopher [Sat, 5 May 2012 01:16:06 +0000 (01:16 +0000)]
Typo.

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

12 years agoOrder register classes by spill size first, members last.
Jakob Stoklund Olesen [Fri, 4 May 2012 23:12:22 +0000 (23:12 +0000)]
Order register classes by spill size first, members last.

This is still a topological ordering such that every register class gets
a smaller enum value than its sub-classes.

Placing the smaller spill sizes first makes a difference for the
super-register class bit masks. When looking for a super-register class,
we usually want the smallest possible kind of super-register. That is
now available as the first bit set in the bit mask.

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

12 years agoMake sure findRepresentativeClass picks the widest super-register.
Jakob Stoklund Olesen [Fri, 4 May 2012 22:53:28 +0000 (22:53 +0000)]
Make sure findRepresentativeClass picks the widest super-register.

We want the representative register class to contain the largest
super-registers available. This makes the function less sensitive to the
register class numbering.

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

12 years agoRemove extra comma in debug output.
Jakob Stoklund Olesen [Fri, 4 May 2012 22:53:26 +0000 (22:53 +0000)]
Remove extra comma in debug output.

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

12 years agoFix warnings in release build.
David Blaikie [Fri, 4 May 2012 22:34:16 +0000 (22:34 +0000)]
Fix warnings in release build.

This fixes a couple of Clang warnings in release builds of LLVM:

* Missing return in ISelLowering
* Unused variable in NVPTXutil.cpp

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

12 years agoTweak to the fix in r156212, as with the change in removing the shift the
Kevin Enderby [Fri, 4 May 2012 22:09:52 +0000 (22:09 +0000)]
Tweak to the fix in r156212, as with the change in removing the shift the
SignExtend32<22>(Val<<1) also needs to change to SignExtend32<21>(Val) .

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

12 years agoFix a bug in the ARM disassembler for wide branch conditional instructions
Kevin Enderby [Fri, 4 May 2012 22:02:27 +0000 (22:02 +0000)]
Fix a bug in the ARM disassembler for wide branch conditional instructions
where the symbolic operand's displacement was incorrectly shifted left by 1.
rdar://11387046

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

12 years agoFix a Clang warning in the new NVPTX backend:
Chandler Carruth [Fri, 4 May 2012 21:35:49 +0000 (21:35 +0000)]
Fix a Clang warning in the new NVPTX backend:

In file included from ../lib/Target/NVPTX/VectorElementize.cpp:53:
../lib/Target/NVPTX/NVPTX.h:44:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
  default: assert(0 && "Unknown condition code");
  ^
1 warning generated.

The prevailing pattern in LLVM is to not use a default label, and instead to
use llvm_unreachable to denote that the switch in fact covers all return paths
from the function.

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

12 years agoTeach the code extractor how to extract a sequence of blocks from
Chandler Carruth [Fri, 4 May 2012 21:33:30 +0000 (21:33 +0000)]
Teach the code extractor how to extract a sequence of blocks from
RegionInfo's RegionNode. This mirrors the logic for automating the
extraction from a Loop.

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

12 years agoRename the Region::block_iterator to Region::block_node_iterator, and
Chandler Carruth [Fri, 4 May 2012 20:55:23 +0000 (20:55 +0000)]
Rename the Region::block_iterator to Region::block_node_iterator, and
add a new Region::block_iterator which actually iterates over the basic
blocks of the region.

The old iterator, now call 'block_node_iterator' iterates over
RegionNodes which contain a single basic block. This works well with the
GraphTraits-based iterator design, however most users actually want an
iterator over the BasicBlocks inside these RegionNodes. Now the
'block_iterator' is a wrapper which exposes exactly this interface.
Internally it uses the block_node_iterator to walk all nodes which are
single basic blocks, but transparently unwraps the basic block to make
user code simpler.

While this patch is a bit of a wash, most of the updates are to internal
users, not external users of the RegionInfo. I have an accompanying
patch to Polly that is a strict simplification of every user of this
interface, and I'm working on a pass that also wants the same simplified
interface.

This patch alone should have no functional impact.

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

12 years agoThis patch adds a new NVPTX back-end to LLVM which supports code generation for NVIDI...
Justin Holewinski [Fri, 4 May 2012 20:18:50 +0000 (20:18 +0000)]
This patch adds a new NVPTX back-end to LLVM which supports code generation for NVIDIA PTX 3.0. This back-end will (eventually) replace the current PTX back-end, while maintaining compatibility with it.

The new target machines are:

nvptx (old ptx32) => 32-bit PTX
nvptx64 (old ptx64) => 64-bit PTX

The sources are based on the internal NVIDIA NVPTX back-end, and
contain more functionality than the current PTX back-end currently
provides.

NV_CONTRIB

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

12 years agoAdded missing CMN case in Thumb2SizeReduction pass so that LLVM emits 16-bits encodin...
Sebastian Pop [Fri, 4 May 2012 19:53:56 +0000 (19:53 +0000)]
Added missing CMN case in Thumb2SizeReduction pass so that LLVM emits 16-bits encoding of CMN instructions.

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

12 years agoAdds Intel Atom scheduling latencies to X86InstrSystem.td.
Preston Gurd [Fri, 4 May 2012 19:26:37 +0000 (19:26 +0000)]
Adds Intel Atom scheduling latencies to X86InstrSystem.td.

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

12 years agoPacify GCC's -Wreturn-type
Matt Beaumont-Gay [Fri, 4 May 2012 18:34:27 +0000 (18:34 +0000)]
Pacify GCC's -Wreturn-type

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

12 years agoFactor the computation of input and output sets into a public interface
Chandler Carruth [Fri, 4 May 2012 11:20:27 +0000 (11:20 +0000)]
Factor the computation of input and output sets into a public interface
of the CodeExtractor utility. This allows speculatively computing input
and output sets to measure the likely size impact of the code
extraction.

These sets cannot be reused sadly -- we mutate the function prior to
forming the final sets used by the actual extraction.

The interface has been revamped slightly to make it easier to use
correctly by making the interface const and sinking the computation of
the number of exit blocks into the full extraction function and away
from the rest of this logic which just computed two output parameters.

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

12 years agoRather than trying to gracefully handle input sequences with repeated
Chandler Carruth [Fri, 4 May 2012 11:17:06 +0000 (11:17 +0000)]
Rather than trying to gracefully handle input sequences with repeated
blocks, assert that this doesn't happen. We don't want to bother trying
to support this call pattern as it isn't necessary.

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

12 years agoFix a goof with my previous commit by completely returning when we
Chandler Carruth [Fri, 4 May 2012 11:14:19 +0000 (11:14 +0000)]
Fix a goof with my previous commit by completely returning when we
detect an in-eligible block rather than just breaking out of the loop.

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

12 years agoHoist a safety assert from the extraction method into the construction
Chandler Carruth [Fri, 4 May 2012 10:26:45 +0000 (10:26 +0000)]
Hoist a safety assert from the extraction method into the construction
of the extractor itself.

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

12 years agoMove the CodeExtractor utility to a dedicated header file / source file,
Chandler Carruth [Fri, 4 May 2012 10:18:49 +0000 (10:18 +0000)]
Move the CodeExtractor utility to a dedicated header file / source file,
and expose it as a utility class rather than as free function wrappers.

The simple free-function interface works well for the bugpoint-specific
pass's uses of code extraction, but in an upcoming patch for more
advanced code extraction, they simply don't expose a rich enough
interface. I need to expose various stages of the process of doing the
code extraction and query information to decide whether or not to
actually complete the extraction or give up.

Rather than build up a new predicate model and pass that into these
functions, just take the class that was actually implementing the
functions and lift it up into a proper interface that can be used to
perform code extraction. The interface is cleaned up and re-documented
to work better in a header. It also is now setup to accept the blocks to
be extracted in the constructor rather than in a method.

In passing this essentially reverts my previous commit here exposing
a block-level query for eligibility of extraction. That is no longer
necessary with the more rich interface as clients can query the
extraction object for eligibility directly. This will reduce the number
of walks of the input basic block sequence by quite a bit which is
useful if this enters the normal optimization pipeline.

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

12 years agoMake ARM and Mips use TargetMachine::getTLSModel()
Hans Wennborg [Fri, 4 May 2012 09:40:39 +0000 (09:40 +0000)]
Make ARM and Mips use TargetMachine::getTLSModel()

This moves the logic for selecting a TLS model to a single place,
instead of the previous three (ARM, Mips, and X86 which already
uses this function).

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

12 years agoFix some loops to match coding standards. No functional change intended.
Craig Topper [Fri, 4 May 2012 06:39:13 +0000 (06:39 +0000)]
Fix some loops to match coding standards. No functional change intended.

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

12 years agoFix up some spacing. No functional change.
Craig Topper [Fri, 4 May 2012 06:18:33 +0000 (06:18 +0000)]
Fix up some spacing. No functional change.

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

12 years agoSimplify broadcast lowering code. No functional change intended.
Craig Topper [Fri, 4 May 2012 05:49:51 +0000 (05:49 +0000)]
Simplify broadcast lowering code. No functional change intended.

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

12 years agoAllow v16i16 and v32i8 shuffles to be rewritten as narrower shuffles.
Craig Topper [Fri, 4 May 2012 04:44:49 +0000 (04:44 +0000)]
Allow v16i16 and v32i8 shuffles to be rewritten as narrower shuffles.

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

12 years agoAdd 'landingpad' instructions to the list of instructions to ignore.
Bill Wendling [Fri, 4 May 2012 04:22:32 +0000 (04:22 +0000)]
Add 'landingpad' instructions to the list of instructions to ignore.
Also combine the code in the 'assert' statement.

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

12 years agoSimplify shuffle narrowing code a bit. No functional change intended.
Craig Topper [Fri, 4 May 2012 04:08:44 +0000 (04:08 +0000)]
Simplify shuffle narrowing code a bit. No functional change intended.

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

12 years agoRemove the SubRegClasses field from RegisterClass descriptions.
Jakob Stoklund Olesen [Fri, 4 May 2012 03:30:34 +0000 (03:30 +0000)]
Remove the SubRegClasses field from RegisterClass descriptions.

This information in now computed by TableGen.

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

12 years agoRemove TargetRegisterClass::SuperRegClasses.
Jakob Stoklund Olesen [Fri, 4 May 2012 03:30:28 +0000 (03:30 +0000)]
Remove TargetRegisterClass::SuperRegClasses.

This manually enumerated list of super-register classes has been
superceeded by the automatically computed super-register class masks
available through SuperRegClassIterator.

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

12 years agoPass -fcolor-diagnostics when it is supported. This makes a difference when
Rafael Espindola [Fri, 4 May 2012 03:23:36 +0000 (03:23 +0000)]
Pass -fcolor-diagnostics when it is supported. This makes a difference when
using cmake+ninja, since ninja buffers the compiler output.

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

12 years agoUse SuperRegClassIterator for findRepresentativeClass().
Jakob Stoklund Olesen [Fri, 4 May 2012 02:19:22 +0000 (02:19 +0000)]
Use SuperRegClassIterator for findRepresentativeClass().

The masks returned by SuperRegClassIterator are computed automatically
by TableGen. This is better than depending on the manually specified
SuperRegClasses.

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

12 years agoInitialize SparcInstrInfo before SparcTargetLowering.
Jakob Stoklund Olesen [Fri, 4 May 2012 02:16:39 +0000 (02:16 +0000)]
Initialize SparcInstrInfo before SparcTargetLowering.

The TargetLowering construction needs to use a valid TargetRegisterInfo
instance.

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

12 years agoAdd a SuperRegClassIterator class.
Jakob Stoklund Olesen [Fri, 4 May 2012 01:48:29 +0000 (01:48 +0000)]
Add a SuperRegClassIterator class.

This iterator class provides a more abstract interface to the (Idx,
Mask) lists of super-registers for a register class. The layout of the
tables shouldn't be exposed to clients.

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

12 years agoA pile of long over-due refactorings here. There are some very, *very*
Chandler Carruth [Fri, 4 May 2012 00:58:03 +0000 (00:58 +0000)]
A pile of long over-due refactorings here. There are some very, *very*
minor behavior changes with this, but nothing I have seen evidence of in
the wild or expect to be meaningful. The real goal is unifying our logic
and simplifying the interfaces. A summary of the changes follows:

- Make 'callIsSmall' actually accept a callsite so it can handle
  intrinsics, and simplify callers appropriately.
- Nuke a completely bogus declaration of 'callIsSmall' that was still
  lurking in InlineCost.h... No idea how this got missed.
- Teach the 'isInstructionFree' about the various more intelligent
  'free' heuristics that got added to the inline cost analysis during
  review and testing. This mostly surrounds int->ptr and ptr->int casts.
- Switch most of the interesting parts of the inline cost analysis that
  were essentially computing 'is this instruction free?' to use the code
  metrics routine instead. This way we won't keep duplicating logic.

All of this is motivated by the desire to allow other passes to compute
a roughly equivalent 'cost' metric for a particular basic block as the
inline cost analysis. Sadly, re-using the same analysis for both is
really messy because only the actual inline cost analysis is ever going
to go to the contortions required for simplification, SROA analysis,
etc.

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

12 years agoAdd a FoldingSetVector datastructure which is analogous to a SetVector,
Chandler Carruth [Thu, 3 May 2012 23:38:34 +0000 (23:38 +0000)]
Add a FoldingSetVector datastructure which is analogous to a SetVector,
but using a FoldingSet underneath and with a largely compatible
interface to that of FoldingSet. This can be used anywhere a FoldingSet
would be natural, but iteration order is significant. The initial
intended use case is in Clang's template specialization lists to
preserve instantiation order iteration.

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

12 years agoPR12729: Change 'llvm-objdump' to display the available targets.
Pete Cooper [Thu, 3 May 2012 23:20:10 +0000 (23:20 +0000)]
PR12729: Change 'llvm-objdump' to display the available targets.

Patch by Meador Inge.

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

12 years agoRemove accidentally added file.
Jakob Stoklund Olesen [Thu, 3 May 2012 22:49:58 +0000 (22:49 +0000)]
Remove accidentally added file.

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

12 years agoUse a shared implementation of getMatchingSuperRegClass().
Jakob Stoklund Olesen [Thu, 3 May 2012 22:49:04 +0000 (22:49 +0000)]
Use a shared implementation of getMatchingSuperRegClass().

TargetRegisterClass now gives access to the necessary tables.

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

12 years agoAdd TargetRegisterClass::getSuperRegIndices().
Jakob Stoklund Olesen [Thu, 3 May 2012 22:49:00 +0000 (22:49 +0000)]
Add TargetRegisterClass::getSuperRegIndices().

This is a pointer into one of the tables used by
getMatchingSuperRegClass(). It makes it possible to use a shared
implementation of that function.

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

12 years agoEmit SuperRegMasks as part of the existing SubClassMask arrays.
Jakob Stoklund Olesen [Thu, 3 May 2012 22:48:56 +0000 (22:48 +0000)]
Emit SuperRegMasks as part of the existing SubClassMask arrays.

The RC->getSubClassMask() pointer now points to a sequence of register
class bit masks. The first bit mask is the normal sub-class mask. The
following masks are super-reg class masks used by
getMatchingSuperRegClass().

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

12 years agoFix issues with the ARM bl and blx thumb instructions and the J1 and J2 bits
Kevin Enderby [Thu, 3 May 2012 22:41:56 +0000 (22:41 +0000)]
Fix issues with the ARM bl and blx thumb instructions and the J1 and J2 bits
for the assembler and disassembler.  Which were not being set/read correctly
for offsets greater than 22 bits in some cases.

Changes to lib/Target/ARM/ARMAsmBackend.cpp from Gideon Myles!

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

12 years agoFactor the logic for testing whether a basic block is viable for code
Chandler Carruth [Thu, 3 May 2012 22:26:53 +0000 (22:26 +0000)]
Factor the logic for testing whether a basic block is viable for code
extraction into a public interface. Also clean it up and apply it more
consistently such that we check for landing pads *anywhere* in the
extracted code, not just in single-block extraction.

This will be used to guide decisions in passes that are planning to
eventually perform a round of code extraction.

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

12 years agoremove calls to calloc if the allocated memory is not used (it was already being...
Nuno Lopes [Thu, 3 May 2012 22:08:19 +0000 (22:08 +0000)]
remove calls to calloc if the allocated memory is not used (it was already being done for malloc)
fix a few typos found by Chad in my previous commit

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

12 years agoSupport for target dependent Hexagon VLIW packetizer.
Sirish Pande [Thu, 3 May 2012 21:52:53 +0000 (21:52 +0000)]
Support for target dependent Hexagon VLIW packetizer.

This patch creates and optimizes packets as per Hexagon ISA rules.

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

12 years agoAdd rudimentary CMake logic for detecting Graphviz.
Ted Kremenek [Thu, 3 May 2012 21:51:05 +0000 (21:51 +0000)]
Add rudimentary CMake logic for detecting Graphviz.

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

12 years agoadd support for calloc to objectsize lowering
Nuno Lopes [Thu, 3 May 2012 21:19:58 +0000 (21:19 +0000)]
add support for calloc to objectsize lowering

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

12 years agoFix the type of SubClassMask.
Jakob Stoklund Olesen [Thu, 3 May 2012 18:17:32 +0000 (18:17 +0000)]
Fix the type of SubClassMask.

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

12 years agoCompress tables for getMatchingSuperRegClass().
Jakob Stoklund Olesen [Thu, 3 May 2012 18:14:20 +0000 (18:14 +0000)]
Compress tables for getMatchingSuperRegClass().

Many register classes only have a few super-registers, so it is not
necessary to keep individual bit masks for all possible sub-register
indices.

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

12 years agoAdd the half type to the LLVM IR vim syntax highlighting.
Owen Anderson [Thu, 3 May 2012 17:24:12 +0000 (17:24 +0000)]
Add the half type to the LLVM IR vim syntax highlighting.

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

12 years agoFixed disassembler for vstm/vldm ARM VFP instructions.
Silviu Baranga [Thu, 3 May 2012 16:38:40 +0000 (16:38 +0000)]
Fixed disassembler for vstm/vldm ARM VFP instructions.

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

12 years agoDon't override subreg functions in targets without subregisters.
Jakob Stoklund Olesen [Thu, 3 May 2012 16:26:20 +0000 (16:26 +0000)]
Don't override subreg functions in targets without subregisters.

Some targets have no sub-registers at all. Use the TargetRegisterInfo
versions of composeSubRegIndices(), getSubClassWithSubReg(), and
getMatchingSuperRegClass() for those targets.

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

12 years agoExtensions of Hexagon V4 instructions.
Sirish Pande [Thu, 3 May 2012 16:18:50 +0000 (16:18 +0000)]
Extensions of Hexagon V4 instructions.

This adds new instructions for Hexagon V4 architecture.

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