oota-llvm.git
13 years agobuild: Go back to dropping __eprintf reference when building with Clang, see
Daniel Dunbar [Tue, 7 Dec 2010 16:29:44 +0000 (16:29 +0000)]
build: Go back to dropping __eprintf reference when building with Clang, see
comment.

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

13 years agoAdd parens to pacify gcc.
Benjamin Kramer [Tue, 7 Dec 2010 15:50:35 +0000 (15:50 +0000)]
Add parens to pacify gcc.

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

13 years agoRemove some dead code from the jump threading pass.
Frits van Bommel [Tue, 7 Dec 2010 13:08:07 +0000 (13:08 +0000)]
Remove some dead code from the jump threading pass.

The last uses of these functions were removed in r113852 when LazyValueInfo was permanently enabled and removed the need for them.

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

13 years agoCMake: Fix warning in gtest header used by unit tests.
Frits van Bommel [Tue, 7 Dec 2010 10:22:07 +0000 (10:22 +0000)]
CMake: Fix warning in gtest header used by unit tests.

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

13 years agoPR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
Jay Foad [Tue, 7 Dec 2010 08:25:19 +0000 (08:25 +0000)]
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

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

13 years agoDon't leak the mutex when loading dynamic libraries.
Owen Anderson [Tue, 7 Dec 2010 07:56:20 +0000 (07:56 +0000)]
Don't leak the mutex when loading dynamic libraries.

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

13 years agoutils/lit/lit/TestFormats.py: [PR8438] unittests: Seek *Tests (not BUILD_MODE/*Tests...
NAKAMURA Takumi [Tue, 7 Dec 2010 07:41:32 +0000 (07:41 +0000)]
utils/lit/lit/TestFormats.py: [PR8438] unittests: Seek *Tests (not BUILD_MODE/*Tests) under whole unittests/ if BUILD_MODE == '.'

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

13 years agounittests/CMakeLists.txt: Tweak unittests' layout to be identical to GNU build.
NAKAMURA Takumi [Tue, 7 Dec 2010 07:41:23 +0000 (07:41 +0000)]
unittests/CMakeLists.txt: Tweak unittests' layout to be identical to GNU build.

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

13 years agoFix relocations with weak definitions.
Rafael Espindola [Tue, 7 Dec 2010 05:57:28 +0000 (05:57 +0000)]
Fix relocations with weak definitions.

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

13 years agoRevert test/Archive/check_binary_output.ll". It fails on a buildbot.
NAKAMURA Takumi [Tue, 7 Dec 2010 05:57:02 +0000 (05:57 +0000)]
Revert test/Archive/check_binary_output.ll". It fails on a buildbot.

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

13 years agoreapply r121100 with a tweak to constant fold ConstExprs with TargetData
Chris Lattner [Tue, 7 Dec 2010 04:33:29 +0000 (04:33 +0000)]
reapply r121100 with a tweak to constant fold ConstExprs with TargetData
(if available) as we go so that we get simple constantexprs not insane ones.
This fixes the failure of clang/test/CodeGenCXX/virtual-base-ctor.cpp
that the previous iteration of this patch had.

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

13 years agoSupport/PathV2: Cleanup separator handling.
Michael J. Spencer [Tue, 7 Dec 2010 03:57:48 +0000 (03:57 +0000)]
Support/PathV2: Cleanup separator handling.

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

13 years agoSupport/PathV2: Remove the error_code return type from all functions in the path
Michael J. Spencer [Tue, 7 Dec 2010 03:57:37 +0000 (03:57 +0000)]
Support/PathV2: Remove the error_code return type from all functions in the path
namespace. None of them return anything except for success anyway. These will be
converted to returning their result soon.

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

13 years agoSupport/PathV2: Move make_absolute from path to fs.
Michael J. Spencer [Tue, 7 Dec 2010 03:57:17 +0000 (03:57 +0000)]
Support/PathV2: Move make_absolute from path to fs.

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

13 years agoFix pcrel relocations that cross sections.
Rafael Espindola [Tue, 7 Dec 2010 03:50:14 +0000 (03:50 +0000)]
Fix pcrel relocations that cross sections.

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

13 years agotest/Archive/check_binary_output.ll: Add a new test to check output of 'llvm-ar ...
NAKAMURA Takumi [Tue, 7 Dec 2010 03:35:20 +0000 (03:35 +0000)]
test/Archive/check_binary_output.ll: Add a new test to check output of 'llvm-ar -p' is sane. Thanks to Danil Malyshev!

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

13 years agotest/Other/close-stderr.ll: Require the feature 'shell'. It is not executable on...
NAKAMURA Takumi [Tue, 7 Dec 2010 02:43:58 +0000 (02:43 +0000)]
test/Other/close-stderr.ll: Require the feature 'shell'. It is not executable on Win32 but it is executable on MSYS-bash.

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

13 years agotest: Add the feature 'shell' on LLVM_ON_UNIX.
NAKAMURA Takumi [Tue, 7 Dec 2010 02:43:51 +0000 (02:43 +0000)]
test: Add the feature 'shell' on LLVM_ON_UNIX.

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

13 years agolib/Target/X86/X86MCAsmInfo.cpp: [PR8741] On Win64, specify explicit PrivateGlobalPre...
NAKAMURA Takumi [Tue, 7 Dec 2010 02:43:45 +0000 (02:43 +0000)]
lib/Target/X86/X86MCAsmInfo.cpp: [PR8741] On Win64, specify explicit PrivateGlobalPrefix as ".L".

Or, global symbols @Lxxxx might be treated as temporal symbol by MCSymbol.

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

13 years agoTemporarily revert r121100 as it's causing clang to fail
Eric Christopher [Tue, 7 Dec 2010 02:41:11 +0000 (02:41 +0000)]
Temporarily revert r121100 as it's causing clang to fail
CodeGenCXX/virtual-base-ctor.cpp.

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

13 years agoTwo things: Fix testcase to use extern - otherwise the link will always
Eric Christopher [Tue, 7 Dec 2010 02:05:42 +0000 (02:05 +0000)]
Two things: Fix testcase to use extern - otherwise the link will always
succeed. Also make the testcase clearer as to what we're doing and
emit a checking notification to the log.

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

13 years agofix PR8710 - teach global opt that some constantexprs are too complex to
Chris Lattner [Tue, 7 Dec 2010 01:59:32 +0000 (01:59 +0000)]
fix PR8710 - teach global opt that some constantexprs are too complex to
put in a global variable's initializer.

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

13 years agoRemove unused member.
Jakob Stoklund Olesen [Tue, 7 Dec 2010 01:32:45 +0000 (01:32 +0000)]
Remove unused member.

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

13 years agoPromote "enumerator in switch of enum is not handled" to level 1 warning on MSVC...
Francois Pichet [Tue, 7 Dec 2010 01:25:06 +0000 (01:25 +0000)]
Promote "enumerator in switch of enum is not handled" to level 1 warning on MSVC. It was disabled by default.

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

13 years agoTest: Fix Support.Path and _all_ of the unittest death tests. GetTempPath defaults...
Michael J. Spencer [Tue, 7 Dec 2010 01:23:49 +0000 (01:23 +0000)]
Test: Fix Support.Path and _all_ of the unittest death tests. GetTempPath defaults to \Windows\.

If I typed anything else it would just decline into cursing.

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

13 years agoSupport/Unix/PathV2: Return the real error from realpath instead of any error
Michael J. Spencer [Tue, 7 Dec 2010 01:23:39 +0000 (01:23 +0000)]
Support/Unix/PathV2: Return the real error from realpath instead of any error
that close or unlink set.

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

13 years agoSupport/Unix/PathV2: Use 0770 instead of 0700 when creating a directory. Also use
Michael J. Spencer [Tue, 7 Dec 2010 01:23:29 +0000 (01:23 +0000)]
Support/Unix/PathV2: Use 0770 instead of 0700 when creating a directory. Also use
the standard macros instead of octal notation.

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

13 years agoSupport/PathV2: Use SmallVector::clear instead of set_size.
Michael J. Spencer [Tue, 7 Dec 2010 01:23:19 +0000 (01:23 +0000)]
Support/PathV2: Use SmallVector::clear instead of set_size.

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

13 years agoSupport/PathV2: Clarify and correct documentation.
Michael J. Spencer [Tue, 7 Dec 2010 01:23:08 +0000 (01:23 +0000)]
Support/PathV2: Clarify and correct documentation.

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

13 years agoSupport/PathV2: Move current_path from path to fs and fix the Unix implementation.
Michael J. Spencer [Tue, 7 Dec 2010 01:22:31 +0000 (01:22 +0000)]
Support/PathV2: Move current_path from path to fs and fix the Unix implementation.

Unix bug spotted by Dan Gohman.

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

13 years agoAdd an OpReinterpret operation to TableGen's NeonEmitter.
Bob Wilson [Tue, 7 Dec 2010 01:12:23 +0000 (01:12 +0000)]
Add an OpReinterpret operation to TableGen's NeonEmitter.
An OpReinterpret entry is handled by translating it to OpCast intrinsics for
all combinations of source and destination types with the same total size.
This will be used to generate all the vreinterpret intrinsics.

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

13 years agoFix whitespace.
Bob Wilson [Tue, 7 Dec 2010 01:12:19 +0000 (01:12 +0000)]
Fix whitespace.

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

13 years agoFix a crash reduced from gcc produced assembly.
Rafael Espindola [Tue, 7 Dec 2010 01:09:54 +0000 (01:09 +0000)]
Fix a crash reduced from gcc produced assembly.

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

13 years agoSecond attempt at converting Thumb2's LDRpci, including updating the gazillion places...
Owen Anderson [Tue, 7 Dec 2010 00:45:21 +0000 (00:45 +0000)]
Second attempt at converting Thumb2's LDRpci, including updating the gazillion places that need to know about it.

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

13 years agoAdd python scripts to extract debug info using LLDB and do comparison.
Devang Patel [Tue, 7 Dec 2010 00:34:59 +0000 (00:34 +0000)]
Add python scripts to extract debug info using LLDB and do comparison.

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

13 years agoAdd a simple breakpoint location printer. This will be used by upcoming "debug info...
Devang Patel [Tue, 7 Dec 2010 00:33:43 +0000 (00:33 +0000)]
Add a simple breakpoint location printer. This will be used by upcoming "debug info in optimized code" quality test harness to set breakpoints at "interesting" locations.

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

13 years agoSorry for such a large commit. The summary is that only MachO cares about the
Rafael Espindola [Tue, 7 Dec 2010 00:27:36 +0000 (00:27 +0000)]
Sorry for such a large commit. The summary is that only MachO cares about the
actuall addresses in a .o file, so it is better to let the MachO writer compute
it.

This is good for two reasons. First, areas that shouldn't care about
addresses now don't have access to it. Second, the layout of each section
is independent. I should use this in a subsequent commit to speed it up.

Most of the patch is just removing the section address computation. The two
interesting parts are the change on how we handle padding in the end
of sections and how MachO can get the address of a-b when a and b are in
different sections.

Since now the expression evaluation normally doesn't know the section address,
it will think that a-b needs relocation and let the MachO writer know. Once
it has computed the section addresses, it calls back the expression evaluation
with the section addresses to resolve these expressions.

The remaining problem is the handling of padding. Currently it will create
a special alignment fragment at the end. Since that fragment doesn't update
the alignment of the section, it needs the real address to be computed.

Since now the layout will not compute a-b with a and b in different sections,
the only effect that the special alignment fragment has is update the
address size of the section. This can also be done by the MachO writer.

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

13 years agoAdd fixup for Thumb1 BL/BLX instructions.
Jim Grosbach [Mon, 6 Dec 2010 23:57:07 +0000 (23:57 +0000)]
Add fixup for Thumb1 BL/BLX instructions.

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

13 years agoImplement jump threading of 'indirectbr' by keeping track of whether we're looking...
Frits van Bommel [Mon, 6 Dec 2010 23:36:56 +0000 (23:36 +0000)]
Implement jump threading of 'indirectbr' by keeping track of whether we're looking for ConstantInt*s or BlockAddress*s.

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

13 years agoUndefined value in reg 0 may need a marker to identify end of source range.
Devang Patel [Mon, 6 Dec 2010 22:48:22 +0000 (22:48 +0000)]
Undefined value in reg 0 may need a marker to identify end of source range.
This will be used to truncate live range of DBG_VALUE instruction by register allocator and friends.

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

13 years agoIf dbg_declare() or dbg_value() is not lowered by isel then emit DEBUG message instea...
Devang Patel [Mon, 6 Dec 2010 22:39:26 +0000 (22:39 +0000)]
If dbg_declare() or dbg_value() is not lowered by isel then emit DEBUG message instead of creating DBG_VALUE for undefined value in reg0.

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

13 years agoUse references to simplify the code a bit.
Rafael Espindola [Mon, 6 Dec 2010 22:30:54 +0000 (22:30 +0000)]
Use references to simplify the code a bit.

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

13 years agoAdding bug fix that was suppose to be part of 121044.
Wesley Peck [Mon, 6 Dec 2010 22:19:28 +0000 (22:19 +0000)]
Adding bug fix that was suppose to be part of 121044.
patch contributed by Jack Whitham!

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

13 years agoFixed reversed operands for IDIV and CMP instructions in MBlaze backend.
Wesley Peck [Mon, 6 Dec 2010 22:06:49 +0000 (22:06 +0000)]
Fixed reversed operands for IDIV and CMP instructions in MBlaze backend.
Use BRAD instead of BRD for indirect branches in MBlaze backend.

patch contributed by Jack Whitham!

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

13 years agoRefactor ELFObjectWriter.
Jason W Kim [Mon, 6 Dec 2010 21:57:34 +0000 (21:57 +0000)]
Refactor ELFObjectWriter.
+ ARM/X86/MBlaze now share a common RecordRelocation
+ ARM/X86/MBlaze arch specific routines are limited to GetRelocType()

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

13 years agoreplace a linear scan with a symtab lookup, reduce indentation.
Chris Lattner [Mon, 6 Dec 2010 21:53:07 +0000 (21:53 +0000)]
replace a linear scan with a symtab lookup, reduce indentation.
No functionality change.

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

13 years agouse getSymbolOffset.
Rafael Espindola [Mon, 6 Dec 2010 21:51:55 +0000 (21:51 +0000)]
use getSymbolOffset.

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

13 years agoUse a stronger predicate here, pointed out by Duncan
Chris Lattner [Mon, 6 Dec 2010 21:48:10 +0000 (21:48 +0000)]
Use a stronger predicate here, pointed out by Duncan

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

13 years agoadd some DEBUG statements.
Chris Lattner [Mon, 6 Dec 2010 21:13:51 +0000 (21:13 +0000)]
add some DEBUG statements.

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

13 years agoFix a 16-bit immediate value detection bug in the MBlaze delay slot filler.
Wesley Peck [Mon, 6 Dec 2010 21:11:01 +0000 (21:11 +0000)]
Fix a 16-bit immediate value detection bug in the MBlaze delay slot filler.
Address more hazards in the MBlaze delay slot filler.

patch contributed by Jack Whitham!

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

13 years agoAnother use of getSymbolOffset.
Rafael Espindola [Mon, 6 Dec 2010 19:55:05 +0000 (19:55 +0000)]
Another use of getSymbolOffset.

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

13 years agoRemove the instruction fragment to data fragment lowering since it was causing
Rafael Espindola [Mon, 6 Dec 2010 19:08:48 +0000 (19:08 +0000)]
Remove the instruction fragment to data fragment lowering since it was causing
freed data to be read. I will open a bug to track it being reenabled.

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

13 years agoRevert r121021, which broke the buildbots.
Owen Anderson [Mon, 6 Dec 2010 18:57:40 +0000 (18:57 +0000)]
Revert r121021, which broke the buildbots.

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

13 years agoTrailing whitespace.
Jim Grosbach [Mon, 6 Dec 2010 18:47:44 +0000 (18:47 +0000)]
Trailing whitespace.

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

13 years agoImprove handling of Thumb2 PC-relative loads by converting LDRpci (and friends) to...
Owen Anderson [Mon, 6 Dec 2010 18:35:51 +0000 (18:35 +0000)]
Improve handling of Thumb2 PC-relative loads by converting LDRpci (and friends) to Pseudos.

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

13 years agoEncode the register operand of ARM CondCode operands correctly. ARM::CPSR if
Jim Grosbach [Mon, 6 Dec 2010 18:30:57 +0000 (18:30 +0000)]
Encode the register operand of ARM CondCode operands correctly. ARM::CPSR if
the instruction is predicated, reg0 otherwise.

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

13 years agoThe ARM AsmMatcher needs to know that the CCOut operand is a register value,
Jim Grosbach [Mon, 6 Dec 2010 18:21:12 +0000 (18:21 +0000)]
The ARM AsmMatcher needs to know that the CCOut operand is a register value,
not an immediate. It stores either ARM::CPSR or reg0.

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

13 years agoDo not try luck by using given name to create temporary file. In parallel builds...
Devang Patel [Mon, 6 Dec 2010 18:04:39 +0000 (18:04 +0000)]
Do not try luck by using given name to create temporary file. In parallel builds it may not work.

This time for .s file.

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

13 years agoSecond try at making direct object emission produce the same results
Rafael Espindola [Mon, 6 Dec 2010 17:27:56 +0000 (17:27 +0000)]
Second try at making direct object emission produce the same results
as llc + llvm-mc. This time ELF is not changed and I tested that llvm-gcc
bootstrap on darwin10 using darwin9's assembler and linker.

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

13 years agoRevert previous two patches while I try to find out how to make both
Rafael Espindola [Mon, 6 Dec 2010 15:35:15 +0000 (15:35 +0000)]
Revert previous two patches while I try to find out how to make both
linux and darwin assemblers happy :-(

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

13 years agoUpdate test for the extra =.
Rafael Espindola [Mon, 6 Dec 2010 15:05:36 +0000 (15:05 +0000)]
Update test for the extra =.

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

13 years agoAdd an EmitAbsValue helper method and use it in cases where we want to be sure
Rafael Espindola [Mon, 6 Dec 2010 14:53:14 +0000 (14:53 +0000)]
Add an EmitAbsValue helper method and use it in cases where we want to be sure
that no relocations are used (on MochO).
Fixes llc producing different output from llc + llvm-mc.

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

13 years agoFix clang warning: "extra ';' inside a class [-pedantic]".
Frits van Bommel [Mon, 6 Dec 2010 10:48:11 +0000 (10:48 +0000)]
Fix clang warning: "extra ';' inside a class [-pedantic]".

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

13 years agoFix PR8735, a really terrible problem in the inliner's "alloca merging"
Chris Lattner [Mon, 6 Dec 2010 07:52:42 +0000 (07:52 +0000)]
Fix PR8735, a really terrible problem in the inliner's "alloca merging"
optimization.

Consider:
static void foo() {
  A = alloca
  ...
}

static void bar() {
  B = alloca
  ...
  call foo();
}

void main() {
  bar()
}

The inliner proceeds bottom up, but lets pretend it decides not to inline foo
into bar.  When it gets to main, it inlines bar into main(), and says "hey, I
just inlined an alloca "B" into main, lets remember that.  Then it keeps going
and finds that it now contains a call to foo.  It decides to inline foo into
main, and says "hey, foo has an alloca A, and I have an alloca B from another
inlined call site, lets reuse it".  The problem with this of course, is that
the lifetime of A and B are nested, not disjoint.

Unfortunately I can't create a reasonable testcase for this: the one in the
PR is both huge and extremely sensitive, because you minor tweaks end up
causing foo to get inlined into bar too early.  We already have tests for the
basic alloca merging optimization and this does not break them.

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

13 years agoimprove comment
Chris Lattner [Mon, 6 Dec 2010 07:43:04 +0000 (07:43 +0000)]
improve comment

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

13 years agoimprove -debug output and comments a little.
Chris Lattner [Mon, 6 Dec 2010 07:38:40 +0000 (07:38 +0000)]
improve -debug output and comments a little.

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

13 years agoSupport/Windows: Make MinGW happy.
Michael J. Spencer [Mon, 6 Dec 2010 06:02:07 +0000 (06:02 +0000)]
Support/Windows: Make MinGW happy.

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

13 years agoSupport/FileSystem: Add directory_iterator implementation.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:42 +0000 (04:28 +0000)]
Support/FileSystem: Add directory_iterator implementation.

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

13 years agoSupport/PathV2: Fix append to not add a slash to empty or root paths.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:23 +0000 (04:28 +0000)]
Support/PathV2: Fix append to not add a slash to empty or root paths.

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

13 years agoSupport/Windows: Add ScopedHandle and move some clients over to it.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:13 +0000 (04:28 +0000)]
Support/Windows: Add ScopedHandle and move some clients over to it.

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

13 years agoKillTheDoctor: Cleanup error_code usage.
Michael J. Spencer [Mon, 6 Dec 2010 04:28:01 +0000 (04:28 +0000)]
KillTheDoctor: Cleanup error_code usage.

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

13 years agoKillTheDoctor: Fix spelling.
Michael J. Spencer [Mon, 6 Dec 2010 04:27:52 +0000 (04:27 +0000)]
KillTheDoctor: Fix spelling.

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

13 years agoSupport/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
Michael J. Spencer [Mon, 6 Dec 2010 04:27:42 +0000 (04:27 +0000)]
Support/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
implementation needs it for wchar_t and SmallVectorImpl in general.

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

13 years agoptx: add shift instructions
Che-Liang Chiou [Mon, 6 Dec 2010 04:00:03 +0000 (04:00 +0000)]
ptx: add shift instructions

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

13 years agoRemove the getAddress getter, initialize Ordinal in the constructor and use
Rafael Espindola [Mon, 6 Dec 2010 03:48:09 +0000 (03:48 +0000)]
Remove the getAddress getter, initialize Ordinal in the constructor and use
that on the ELF writer to detect a section we created.

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

13 years agoSimplify a bit.
Rafael Espindola [Mon, 6 Dec 2010 03:36:43 +0000 (03:36 +0000)]
Simplify a bit.

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

13 years agoUse getSymbolOffset on the COFF writer.
Rafael Espindola [Mon, 6 Dec 2010 03:24:04 +0000 (03:24 +0000)]
Use getSymbolOffset on the COFF writer.

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

13 years agoDon't use PadSectionToAlignment on windows.
Rafael Espindola [Mon, 6 Dec 2010 03:03:44 +0000 (03:03 +0000)]
Don't use PadSectionToAlignment on windows.

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

13 years agoAdd a getSymbolOffset method and use it in the ELF writer.
Rafael Espindola [Mon, 6 Dec 2010 02:57:26 +0000 (02:57 +0000)]
Add a getSymbolOffset method and use it in the ELF writer.

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

13 years agoFix PR8728, a miscompilation I recently introduced. When optimizing
Chris Lattner [Mon, 6 Dec 2010 01:48:06 +0000 (01:48 +0000)]
Fix PR8728, a miscompilation I recently introduced.  When optimizing
memcpy's like:
  memcpy(A, B)
  memcpy(A, C)

we cannot delete the first memcpy as dead if A and C might be aliases.
If so, we actually get:

  memcpy(A, B)
  memcpy(A, A)

which is not correct to transform into:

  memcpy(A, A)

This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks
Jakub!

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

13 years agoadd a helper method.
Chris Lattner [Mon, 6 Dec 2010 01:01:28 +0000 (01:01 +0000)]
add a helper method.

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

13 years agoEliminate unneeded #include's.
Evan Cheng [Sun, 5 Dec 2010 23:41:43 +0000 (23:41 +0000)]
Eliminate unneeded #include's.

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

13 years agoARM/CMakeLists.txt: Add missing MLxExpansionPass.cpp since r120960.
NAKAMURA Takumi [Sun, 5 Dec 2010 23:08:57 +0000 (23:08 +0000)]
ARM/CMakeLists.txt: Add missing MLxExpansionPass.cpp since r120960.

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

13 years agoCode clean up.
Evan Cheng [Sun, 5 Dec 2010 23:03:45 +0000 (23:03 +0000)]
Code clean up.

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

13 years agoRemove an unused variable.
Evan Cheng [Sun, 5 Dec 2010 23:03:35 +0000 (23:03 +0000)]
Remove an unused variable.

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

13 years agoSome cleanup before I start committing some incremental progress on
Cameron Zwarich [Sun, 5 Dec 2010 22:34:08 +0000 (22:34 +0000)]
Some cleanup before I start committing some incremental progress on
StrongPHIElimination.

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

13 years agoMaking use of VFP / NEON floating point multiply-accumulate / subtraction is
Evan Cheng [Sun, 5 Dec 2010 22:04:16 +0000 (22:04 +0000)]
Making use of VFP / NEON floating point multiply-accumulate / subtraction is
difficult on current ARM implementations for a few reasons.
1. Even though a single vmla has latency that is one cycle shorter than a pair
   of vmul + vadd, a RAW hazard during the first (4? on Cortex-a8) can cause
   additional pipeline stall. So it's frequently better to single codegen
   vmul + vadd.
2. A vmla folowed by a vmul, vmadd, or vsub causes the second fp instruction to
   stall for 4 cycles. We need to schedule them apart.
3. A vmla followed vmla is a special case. Obvious issuing back to back RAW
   vmla + vmla is very bad. But this isn't ideal either:
     vmul
     vadd
     vmla
   Instead, we want to expand the second vmla:
     vmla
     vmul
     vadd
   Even with the 4 cycle vmul stall, the second sequence is still 2 cycles
   faster.

Up to now, isel simply avoid codegen'ing fp vmla / vmls. This works well enough
but it isn't the optimial solution. This patch attempts to make it possible to
use vmla / vmls in cases where it is profitable.

A. Add missing isel predicates which cause vmla to be codegen'ed.
B. Make sure the fmul in (fadd (fmul)) has a single use. We don't want to
   compute a fmul and a fmla.
C. Add additional isel checks for vmla, avoid cases where vmla is feeding into
   fp instructions (except for the #3 exceptional case).
D. Add ARM hazard recognizer to model the vmla / vmls hazards.
E. Add a special pre-regalloc case to expand vmla / vmls when it's likely the
   vmla / vmls will trigger one of the special hazards.

Work in progress, only A+B are enabled.

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

13 years agoRemove the PHIElimination.h header, as it is no longer needed.
Cameron Zwarich [Sun, 5 Dec 2010 21:39:42 +0000 (21:39 +0000)]
Remove the PHIElimination.h header, as it is no longer needed.

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

13 years agoClarify some of the differences between indexing with getelementptr and indexing...
Frits van Bommel [Sun, 5 Dec 2010 20:54:38 +0000 (20:54 +0000)]
Clarify some of the differences between indexing with getelementptr and indexing with insertvalue/extractvalue.

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

13 years agoFix PR 4170 by having ExtractValueInst::getIndexedType() reject out-of-bounds indexing.
Frits van Bommel [Sun, 5 Dec 2010 20:50:26 +0000 (20:50 +0000)]
Fix PR 4170 by having ExtractValueInst::getIndexedType() reject out-of-bounds indexing.

Also add asserts that the indices are valid in InsertValueInst::init(). ExtractValueInst already asserts when constructed with invalid indices.

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

13 years agoI forgot to actually remove the FindCopyInsertPoint() declaration from
Cameron Zwarich [Sun, 5 Dec 2010 19:58:57 +0000 (19:58 +0000)]
I forgot to actually remove the FindCopyInsertPoint() declaration from
PHIElimination.h.

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

13 years agoRemove the SplitCriticalEdge() method declaration from PHIElimination.h. At one
Cameron Zwarich [Sun, 5 Dec 2010 19:54:23 +0000 (19:54 +0000)]
Remove the SplitCriticalEdge() method declaration from PHIElimination.h. At one
time, this method existed, but now PHIElimination uses the method of the same
name on MachineBasicBlock.

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

13 years agoMove the FindCopyInsertPoint method of PHIElimination to a new standalone
Cameron Zwarich [Sun, 5 Dec 2010 19:51:05 +0000 (19:51 +0000)]
Move the FindCopyInsertPoint method of PHIElimination to a new standalone
function so that it can be shared with StrongPHIElimination.

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

13 years agoRefactor jump threading.
Frits van Bommel [Sun, 5 Dec 2010 19:06:41 +0000 (19:06 +0000)]
Refactor jump threading.
Should have no functional change other than the order of two transformations that are mutually-exclusive and the exact formatting of debug output.
Internally, it now stores the ConstantInt*s as Constant*s, and actual undef values instead of nulls.

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

13 years agoRemove trailing whitespace.
Frits van Bommel [Sun, 5 Dec 2010 19:02:47 +0000 (19:02 +0000)]
Remove trailing whitespace.

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

13 years agoTeach SimplifyCFG to turn
Frits van Bommel [Sun, 5 Dec 2010 18:29:03 +0000 (18:29 +0000)]
Teach SimplifyCFG to turn
  (indirectbr (select cond, blockaddress(@fn, BlockA),
                            blockaddress(@fn, BlockB)))
into
  (br cond, BlockA, BlockB).

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

13 years agoTeach X86ISelLowering that the second result of X86ISD::UMUL is a flags
Chris Lattner [Sun, 5 Dec 2010 07:49:54 +0000 (07:49 +0000)]
Teach X86ISelLowering that the second result of X86ISD::UMUL is a flags
result.  This allows us to compile:

void *test12(long count) {
      return new int[count];
}

into:

test12:
movl $4, %ecx
movq %rdi, %rax
mulq %rcx
movq $-1, %rdi
cmovnoq %rax, %rdi
jmp __Znam                  ## TAILCALL

instead of:

test12:
movl $4, %ecx
movq %rdi, %rax
mulq %rcx
seto %cl
testb %cl, %cl
movq $-1, %rdi
cmoveq %rax, %rdi
jmp __Znam

Of course it would be even better if the regalloc inverted the cmov to 'cmovoq',
which would eliminate the need for the 'movq %rdi, %rax'.

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

13 years agoit turns out that when ".with.overflow" intrinsics were added to the X86
Chris Lattner [Sun, 5 Dec 2010 07:30:36 +0000 (07:30 +0000)]
it turns out that when ".with.overflow" intrinsics were added to the X86
backend that they were all implemented except umul.  This one fell back
to the default implementation that did a hi/lo multiply and compared the
top.  Fix this to check the overflow flag that the 'mul' instruction
sets, so we can avoid an explicit test.  Now we compile:

void *func(long count) {
      return new int[count];
}

into:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
seto %cl                     ## encoding: [0x0f,0x90,0xc1]
testb %cl, %cl                ## encoding: [0x84,0xc9]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL

instead of:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
testq %rdx, %rdx              ## encoding: [0x48,0x85,0xd2]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL

Other than the silly seto+test, this is using the o bit directly, so it's going in the right
direction.

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

13 years agofix the rest of the linux miscompares :)
Chris Lattner [Sun, 5 Dec 2010 02:08:07 +0000 (02:08 +0000)]
fix the rest of the linux miscompares :)

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

13 years agogeneralize the previous check to handle -1 on either side of the
Chris Lattner [Sun, 5 Dec 2010 02:00:51 +0000 (02:00 +0000)]
generalize the previous check to handle -1 on either side of the
select, inserting a not to compensate.  Add a missing isZero check
that I lost somehow.

This improves codegen of:

void *func(long count) {
      return new int[count];
}

from:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
testq %rdx, %rdx              ## encoding: [0x48,0x85,0xd2]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

to:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
cmpq $1, %rdx                ## encoding: [0x48,0x83,0xfa,0x01]
sbbq %rdi, %rdi              ## encoding: [0x48,0x19,0xff]
notq %rdi                    ## encoding: [0x48,0xf7,0xd7]
orq %rax, %rdi              ## encoding: [0x48,0x09,0xc7]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

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