oota-llvm.git
14 years agoUse llvm::format instead of ftostr (which just calls sprintf).
Benjamin Kramer [Fri, 29 Jan 2010 14:40:33 +0000 (14:40 +0000)]
Use llvm::format instead of ftostr (which just calls sprintf).

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

14 years agoChange the SREM case to match the logic in the IR version ComputeMaskedBits.
Duncan Sands [Fri, 29 Jan 2010 09:45:26 +0000 (09:45 +0000)]
Change the SREM case to match the logic in the IR version ComputeMaskedBits.

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

14 years agoCatch more trivial tail call opportunities: no inputs and output types match.
Evan Cheng [Fri, 29 Jan 2010 06:45:59 +0000 (06:45 +0000)]
Catch more trivial tail call opportunities: no inputs and output types match.

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

14 years agoHaving RHSKnownZero and RHSKnownOne be alternative names for KnownZero and KnownOne
Duncan Sands [Fri, 29 Jan 2010 06:18:46 +0000 (06:18 +0000)]
Having RHSKnownZero and RHSKnownOne be alternative names for KnownZero and KnownOne
(via APInt &RHSKnownZero = KnownZero, etc) seems dangerous and confusing to me: it
is easy not to notice this, and then wonder why KnownZero/RHSKnownZero changed
underneath you when you modified RHSKnownZero/KnownZero etc.  So get rid of this.
No intended functionality change (tested with "make check" + llvm-gcc bootstrap).

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

14 years agoIt looks like the changes to the SRem logic of SimplifyDemandedUseBits
Duncan Sands [Fri, 29 Jan 2010 06:18:37 +0000 (06:18 +0000)]
It looks like the changes to the SRem logic of SimplifyDemandedUseBits
(fix for PR6165) are needed here too.

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

14 years agoFileCheck: Switch "possible match" calculation to use StringRef::edit_distance.
Daniel Dunbar [Fri, 29 Jan 2010 03:22:19 +0000 (03:22 +0000)]
FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.
 - Thanks Doug, who is obviously less lazy than me!

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

14 years agoMake strcpy_chk lower to strcpy if we have a safe size.
Eric Christopher [Fri, 29 Jan 2010 01:37:11 +0000 (01:37 +0000)]
Make strcpy_chk lower to strcpy if we have a safe size.

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

14 years agoQuick fix to make the header file for the enhanced
Sean Callanan [Fri, 29 Jan 2010 01:34:29 +0000 (01:34 +0000)]
Quick fix to make the header file for the enhanced
disassembly information have a better comment (and
better guard macros).

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

14 years agoAdded a bare-bones Makefile to build the enhanced disassembly
Sean Callanan [Fri, 29 Jan 2010 01:30:01 +0000 (01:30 +0000)]
Added a bare-bones Makefile to build the enhanced disassembly
library as a static and a shared library.  Added dependencies
so the target-specific enhanced disassembly info tables are
built before the library.

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

14 years agoRecognize 'add_executable' when analyzing CMake files.
Ted Kremenek [Fri, 29 Jan 2010 01:10:55 +0000 (01:10 +0000)]
Recognize 'add_executable' when analyzing CMake files.

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

14 years agoUpdate CMake build.
Ted Kremenek [Fri, 29 Jan 2010 01:10:25 +0000 (01:10 +0000)]
Update CMake build.

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

14 years agoAdd constant support to object size handling and remove default
Eric Christopher [Fri, 29 Jan 2010 01:09:57 +0000 (01:09 +0000)]
Add constant support to object size handling and remove default
lowering. We'll either figure it out, or not and be lowered by
SelectionDAGBuild.

Add test.

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

14 years agoGeneric reformatting and comment fixing. No functionality change.
Bill Wendling [Fri, 29 Jan 2010 00:52:43 +0000 (00:52 +0000)]
Generic reformatting and comment fixing. No functionality change.

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

14 years agoAdd newline to debugging output, and fix some grammar-os in comment.
Bill Wendling [Fri, 29 Jan 2010 00:27:39 +0000 (00:27 +0000)]
Add newline to debugging output, and fix some grammar-os in comment.

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

14 years agoAdded a custom TableGen backend to support the
Sean Callanan [Fri, 29 Jan 2010 00:21:04 +0000 (00:21 +0000)]
Added a custom TableGen backend to support the
enhanced disassembler, and the necessary makefile
rules to build the table for X86.

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

14 years agomem2reg erases the dbg.declare intrinsics that it converts to dbg.val intrinsics
Victor Hernandez [Fri, 29 Jan 2010 00:01:35 +0000 (00:01 +0000)]
mem2reg erases the dbg.declare intrinsics that it converts to dbg.val intrinsics

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

14 years agoAssign the ordering of SDNodes in a much less intrusive fashion. After the
Bill Wendling [Thu, 28 Jan 2010 21:51:40 +0000 (21:51 +0000)]
Assign the ordering of SDNodes in a much less intrusive fashion. After the
"visit*" method is called, take the newly created nodes, walk them in a DFS
fashion, and if they don't have an ordering set, then give it one.

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

14 years agoSupport some more options...
Mikhail Glushenkov [Thu, 28 Jan 2010 18:19:36 +0000 (18:19 +0000)]
Support some more options...

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

14 years agoRemove the folding rule
Dan Gohman [Thu, 28 Jan 2010 18:08:26 +0000 (18:08 +0000)]
Remove the folding rule
  getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)
  to
  inttoptr (i64 0 to i8*)
from the VMCore constant folder. It didn't handle sign-extension properly
in the case where the source integer is smaller than a pointer size. And,
it relied on an assumption about sizeof(i8).

The Analysis constant folder still folds these kinds of things; it has
access to TargetData, so it can do them right.

Add a testcase which tests that the VMCore constant folder doesn't
miscompile this, and that the Analysis folder does fold it.

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

14 years agoReplace strcpy with memcpy when we have the length around anyway.
Benjamin Kramer [Thu, 28 Jan 2010 18:04:38 +0000 (18:04 +0000)]
Replace strcpy with memcpy when we have the length around anyway.

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

14 years agoFix PR6165. The bug was that LHSKnownZero was being and'd with DemandedMask
Duncan Sands [Thu, 28 Jan 2010 17:22:42 +0000 (17:22 +0000)]
Fix PR6165.  The bug was that LHSKnownZero was being and'd with DemandedMask
when it should have been and'd with LowBits.  Fix that and while there beef
up the logic in the case of a negative LHS.

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

14 years agoAdd llvm::Program::ChangeStderrToBinary().
Douglas Gregor [Thu, 28 Jan 2010 06:42:08 +0000 (06:42 +0000)]
Add llvm::Program::ChangeStderrToBinary().

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

14 years agoCheck Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
Dan Gohman [Thu, 28 Jan 2010 06:32:46 +0000 (06:32 +0000)]
Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
rather than after.

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

14 years agoconvert the last 3 targets to use EmitFunctionBody() now that
Chris Lattner [Thu, 28 Jan 2010 06:22:43 +0000 (06:22 +0000)]
convert the last 3 targets to use EmitFunctionBody() now that
it has before/end body hooks.

 lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp |   49 ++-----------
 lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp   |   87 ++++++------------------
 lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp |   56 +++------------
 test/CodeGen/XCore/ashr.ll                      |    2
 4 files changed, 48 insertions(+), 146 deletions(-)

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

14 years agoMake getAlignOf return an i64, for consistency with getSizeOf and
Dan Gohman [Thu, 28 Jan 2010 02:43:22 +0000 (02:43 +0000)]
Make getAlignOf return an i64, for consistency with getSizeOf and
getOffsetOf, and remove the comment about assuming i8 is byte-aligned,
which is no longer applicable.

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

14 years agoRemove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
Dan Gohman [Thu, 28 Jan 2010 02:15:55 +0000 (02:15 +0000)]
Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
use plain SCEVUnknowns with ConstantExpr::getSizeOf and
ConstantExpr::getOffsetOf constants. This eliminates a bunch of
special-case code.

Also add code for pattern-matching these expressions, for clients that
want to recognize them.

Move ScalarEvolution's logic for expanding array and vector sizeof
expressions into an element count times the element size, to expose
the multiplication to subsequent folding, into the regular constant
folder.

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

14 years agoadd target hooks for emitting random gunk before and after the function body.
Chris Lattner [Thu, 28 Jan 2010 01:58:58 +0000 (01:58 +0000)]
add target hooks for emitting random gunk before and after the function body.

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

14 years agoFix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is...
Evan Cheng [Thu, 28 Jan 2010 01:57:22 +0000 (01:57 +0000)]
Fix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is different from its inputs.
This fixes PR6146.

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

14 years agoswitch blackfin to the default runOnMachineFunction
Chris Lattner [Thu, 28 Jan 2010 01:54:33 +0000 (01:54 +0000)]
switch blackfin to the default runOnMachineFunction

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

14 years agoeliminate a now-useless class.
Chris Lattner [Thu, 28 Jan 2010 01:50:22 +0000 (01:50 +0000)]
eliminate a now-useless class.

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

14 years agoSwitch MSP430, SPU, Sparc, and SystemZ to use EmitFunctionBody().
Chris Lattner [Thu, 28 Jan 2010 01:48:52 +0000 (01:48 +0000)]
Switch MSP430, SPU, Sparc, and SystemZ to use EmitFunctionBody().

Diffstat:
 6 files changed, 30 insertions(+), 284 deletions(-)

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

14 years agoUpdate of 94055 to track the IR level call site information via an intrinsic.
Jim Grosbach [Thu, 28 Jan 2010 01:45:32 +0000 (01:45 +0000)]
Update of 94055 to track the IR level call site information via an intrinsic.
This allows code gen and the exception table writer to cooperate to make sure
landing pads are associated with the correct invoke locations.

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

14 years agoRecord the death of ModuleProvier and GhostLinkage in the release notes and
Jeffrey Yasskin [Thu, 28 Jan 2010 01:41:20 +0000 (01:41 +0000)]
Record the death of ModuleProvier and GhostLinkage in the release notes and
give upgrade instructions.

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

14 years agoGive AsmPrinter the most common expected implementation of
Chris Lattner [Thu, 28 Jan 2010 01:28:58 +0000 (01:28 +0000)]
Give AsmPrinter the most common expected implementation of
runOnMachineFunction, and switch PPC to use EmitFunctionBody.
The two ppc asmprinters now don't heave to define
runOnMachineFunction.

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

14 years agoTruncate the release notes so they're ready to accumulate notes for the 2.7 release.
Jeffrey Yasskin [Thu, 28 Jan 2010 01:14:43 +0000 (01:14 +0000)]
Truncate the release notes so they're ready to accumulate notes for the 2.7 release.

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

14 years agoswitch ARM to EmitFunctionBody().
Chris Lattner [Thu, 28 Jan 2010 01:10:34 +0000 (01:10 +0000)]
switch ARM to EmitFunctionBody().

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

14 years agoemit a 0 byte instead of a noop if a function is empty on darwin.
Chris Lattner [Thu, 28 Jan 2010 01:06:32 +0000 (01:06 +0000)]
emit a 0 byte instead of a noop if a function is empty on darwin.
"0" is nice and target independent.

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

14 years agoRemove the argument from EmitJumpTableInfo, because it doesn't need it.
Chris Lattner [Thu, 28 Jan 2010 01:02:27 +0000 (01:02 +0000)]
Remove the argument from EmitJumpTableInfo, because it doesn't need it.

Move the X86 implementation of function body emission up to
AsmPrinter::EmitFunctionBody, which works by calling the virtual
EmitInstruction method.

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

14 years agoDrop the argument to AsmPrinter::EmitConstantPool and make it virtual.
Chris Lattner [Thu, 28 Jan 2010 00:19:24 +0000 (00:19 +0000)]
Drop the argument to AsmPrinter::EmitConstantPool and make it virtual.
Overload it in the ARM backend to do nothing, since is does insane
constant pool emission.

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

14 years agodon't emit constant pools twice.
Chris Lattner [Thu, 28 Jan 2010 00:15:18 +0000 (00:15 +0000)]
don't emit constant pools twice.

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

14 years agorename printVisibility to EmitVisibility and make it private,
Chris Lattner [Thu, 28 Jan 2010 00:05:10 +0000 (00:05 +0000)]
rename printVisibility to EmitVisibility and make it private,
constify EmitLinkage.

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

14 years agoswitch ARM to use EmitFunctionHeader.
Chris Lattner [Wed, 27 Jan 2010 23:58:11 +0000 (23:58 +0000)]
switch ARM to use EmitFunctionHeader.

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

14 years agoeliminate the ARMFunctionInfo::Align member, using
Chris Lattner [Wed, 27 Jan 2010 23:37:36 +0000 (23:37 +0000)]
eliminate the ARMFunctionInfo::Align member, using
MachineFunction::Alignment instead.

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

14 years agoadd a helper function for bumping up the alignment of a machine function.
Chris Lattner [Wed, 27 Jan 2010 23:35:43 +0000 (23:35 +0000)]
add a helper function for bumping up the alignment of a machine function.

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

14 years agoswitch blackfin to use EmitFunctionHeader. BlackfinAsmPrinter.cpp
Chris Lattner [Wed, 27 Jan 2010 23:26:37 +0000 (23:26 +0000)]
switch blackfin to use EmitFunctionHeader.  BlackfinAsmPrinter.cpp
is now less than 200 LOC!

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

14 years agoswitch mips to use the shared EmitFunctionHeader() function
Chris Lattner [Wed, 27 Jan 2010 23:23:58 +0000 (23:23 +0000)]
switch mips to use the shared EmitFunctionHeader() function

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

14 years agoChanged constants to an enum so as not to pollute the
Sean Callanan [Wed, 27 Jan 2010 23:20:51 +0000 (23:20 +0000)]
Changed constants to an enum so as not to pollute the
global namespace needlessly.

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

14 years agoAdded a header file defining the externally-visible C API
Sean Callanan [Wed, 27 Jan 2010 23:03:46 +0000 (23:03 +0000)]
Added a header file defining the externally-visible C API
for the LLVM disassemblers.

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

14 years agoIf the only use of something is a DEBUG_VALUE, don't
Dale Johannesen [Wed, 27 Jan 2010 22:12:36 +0000 (22:12 +0000)]
If the only use of something is a DEBUG_VALUE, don't
let that stop it from being deleted, and change the
DEBUG_VALUE value to undef.

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

14 years agoTreat MO_REG 0 location as undefined in DEBUG_VALUE,
Dale Johannesen [Wed, 27 Jan 2010 22:11:16 +0000 (22:11 +0000)]
Treat MO_REG 0 location as undefined in DEBUG_VALUE,
per document.

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

14 years agoAdd an svn:ignore.
Dan Gohman [Wed, 27 Jan 2010 22:06:46 +0000 (22:06 +0000)]
Add an svn:ignore.

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

14 years agoNeed to recurse for all operands of function-local metadata; and handle Instructions...
Victor Hernandez [Wed, 27 Jan 2010 22:03:03 +0000 (22:03 +0000)]
Need to recurse for all operands of function-local metadata; and handle Instructions (which map to themselves)

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

14 years agoAvoid creating redundant PHIs in SSAUpdater::GetValueInMiddleOfBlock.
Bob Wilson [Wed, 27 Jan 2010 22:01:02 +0000 (22:01 +0000)]
Avoid creating redundant PHIs in SSAUpdater::GetValueInMiddleOfBlock.
This was already being done in SSAUpdater::GetValueAtEndOfBlock so I've
just changed SSAUpdater to check for existing PHIs in both places.

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

14 years agoUpdate CMake build.
Ted Kremenek [Wed, 27 Jan 2010 20:44:12 +0000 (20:44 +0000)]
Update CMake build.

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

14 years agoKill ModuleProvider and ghost linkage by inverting the relationship between
Jeffrey Yasskin [Wed, 27 Jan 2010 20:34:15 +0000 (20:34 +0000)]
Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

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

14 years agoDon't bother with sprintf, just pass the Twine through.
Benjamin Kramer [Wed, 27 Jan 2010 19:58:47 +0000 (19:58 +0000)]
Don't bother with sprintf, just pass the Twine through.

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

14 years agoUse the less expensive getName function instead of getNameStr.
Benjamin Kramer [Wed, 27 Jan 2010 19:46:52 +0000 (19:46 +0000)]
Use the less expensive getName function instead of getNameStr.

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

14 years agoQuick fix to a test that is currently failing on every Linux build bot. No idea
Chandler Carruth [Wed, 27 Jan 2010 10:36:15 +0000 (10:36 +0000)]
Quick fix to a test that is currently failing on every Linux build bot. No idea
if this is the "correct" fix, but it seems a strict improvement.

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

14 years agoSilence GCC warnings with asserts turned off. No functionality change.
Chandler Carruth [Wed, 27 Jan 2010 10:27:10 +0000 (10:27 +0000)]
Silence GCC warnings with asserts turned off. No functionality change.

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

14 years agoMake SMDiagnostic::Print a const method.
Mikhail Glushenkov [Wed, 27 Jan 2010 10:13:28 +0000 (10:13 +0000)]
Make SMDiagnostic::Print a const method.

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

14 years agoTrailing whitespace.
Mikhail Glushenkov [Wed, 27 Jan 2010 10:13:11 +0000 (10:13 +0000)]
Trailing whitespace.

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

14 years agoRevert commit 94666 (ddunbar) [Suppress clang warning about unused arguments].
Duncan Sands [Wed, 27 Jan 2010 10:08:08 +0000 (10:08 +0000)]
Revert commit 94666 (ddunbar) [Suppress clang warning about unused arguments].
It causes g++ to complain: unrecognized option '-Qunused-arguments'

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

14 years agoadd a new AsmPrinter::EmitFunctionEntryLabel virtual function,
Chris Lattner [Wed, 27 Jan 2010 07:21:55 +0000 (07:21 +0000)]
add a new AsmPrinter::EmitFunctionEntryLabel virtual function,
which allows targets to override function entry label emission.
Use it to convert linux/ppc to use EmitFunctionHeader().

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

14 years agoSuppress clang warning about unused arguments.
Daniel Dunbar [Wed, 27 Jan 2010 07:10:10 +0000 (07:10 +0000)]
Suppress clang warning about unused arguments.

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

14 years agoPerform trivial tail call optimization for callees with "C" ABI. These are done
Evan Cheng [Wed, 27 Jan 2010 06:25:16 +0000 (06:25 +0000)]
Perform trivial tail call optimization for callees with "C" ABI. These are done
even when -tailcallopt is not specified and it does not require changing ABI.
First case is the most trivial one. Perform tail call optimization when both
the caller and callee do not return values and when the callee does not take
any input arguments.

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

14 years agomerge two ifs
Chris Lattner [Wed, 27 Jan 2010 02:18:21 +0000 (02:18 +0000)]
merge two ifs

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

14 years agosome cleanups.
Chris Lattner [Wed, 27 Jan 2010 02:12:20 +0000 (02:12 +0000)]
some cleanups.

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

14 years agono need to check for null
Chris Lattner [Wed, 27 Jan 2010 02:04:20 +0000 (02:04 +0000)]
no need to check for null

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

14 years agoRemove a dead target hook.
Evan Cheng [Wed, 27 Jan 2010 01:44:40 +0000 (01:44 +0000)]
Remove a dead target hook.

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

14 years agoppc/linux isn't ready for this and it was an accident that it was included.
Chris Lattner [Wed, 27 Jan 2010 01:02:43 +0000 (01:02 +0000)]
ppc/linux isn't ready for this and it was an accident that it was included.
This should fix a bunch of linux buildbot failures.

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

14 years agoWhen converting dbg.declare to dbg.value, attach promoted store's debug metadata...
Victor Hernandez [Wed, 27 Jan 2010 00:44:36 +0000 (00:44 +0000)]
When converting dbg.declare to dbg.value, attach promoted store's debug metadata to dbg.value

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

14 years agoLinker needs to do deep-copy of function-local metadata to update references to funct...
Victor Hernandez [Wed, 27 Jan 2010 00:30:42 +0000 (00:30 +0000)]
Linker needs to do deep-copy of function-local metadata to update references to function arguments

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

14 years agouse existing basic block numbers instead of recomputing
Chris Lattner [Wed, 27 Jan 2010 00:20:02 +0000 (00:20 +0000)]
use existing basic block numbers instead of recomputing
a new set of them.

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

14 years agoSwitch MSP430, CellSPU, SystemZ, Darwin/PPC, Alpha, and Sparc to
Chris Lattner [Wed, 27 Jan 2010 00:17:20 +0000 (00:17 +0000)]
Switch MSP430, CellSPU, SystemZ, Darwin/PPC, Alpha, and Sparc to
EmitFunctionHeader:

7 files changed, 16 insertions(+), 210 deletions(-)

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

14 years agoClarify what -tailcallopt option actually do.
Evan Cheng [Wed, 27 Jan 2010 00:10:09 +0000 (00:10 +0000)]
Clarify what -tailcallopt option actually do.

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

14 years agoAdjust setjmp instruction sequence to not need 32-bit alignment padding
Jim Grosbach [Wed, 27 Jan 2010 00:07:20 +0000 (00:07 +0000)]
Adjust setjmp instruction sequence to not need 32-bit alignment padding

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

14 years agoEliminate target hook IsEligibleForTailCallOptimization.
Evan Cheng [Wed, 27 Jan 2010 00:07:07 +0000 (00:07 +0000)]
Eliminate target hook IsEligibleForTailCallOptimization.

Target independent isel should always pass along the "tail call" property. Change
target hook LowerCall's parameter "isTailCall" into a refernce. If the target
decides it's impossible to honor the tail call request, it should set isTailCall
to false to make target independent isel happy.

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

14 years agoRestore to pre-94570 state.
Evan Cheng [Wed, 27 Jan 2010 00:00:57 +0000 (00:00 +0000)]
Restore to pre-94570 state.

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

14 years agomcize label emission for functions.
Chris Lattner [Tue, 26 Jan 2010 23:53:39 +0000 (23:53 +0000)]
mcize label emission for functions.

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

14 years agouse EmitLinkage for functions as well as globals. One output
Chris Lattner [Tue, 26 Jan 2010 23:51:52 +0000 (23:51 +0000)]
use EmitLinkage for functions as well as globals.  One output
change is that we now use ".linkonce discard" for global variables
instead of ".linkonce samesize".  These should be the same, just less
strict.  If anyone is interested in mcizing MCSection for COFF targets,
this should be easy to fix.

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

14 years agopull linkage emission code out to a new EmitLinkage function.
Chris Lattner [Tue, 26 Jan 2010 23:47:12 +0000 (23:47 +0000)]
pull linkage emission code out to a new EmitLinkage function.

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

14 years agorearrange some directives, no functionality change.
Chris Lattner [Tue, 26 Jan 2010 23:41:48 +0000 (23:41 +0000)]
rearrange some directives, no functionality change.

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

14 years agoRoll r94484 (avoiding RTTI problems in tests) forward again in a way that isn't
Jeffrey Yasskin [Tue, 26 Jan 2010 23:30:46 +0000 (23:30 +0000)]
Roll r94484 (avoiding RTTI problems in tests) forward again in a way that isn't
broken by setting CXXFLAGS on the command line.

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

14 years agoAvoid extra calls to MD->getNumOperands()
Victor Hernandez [Tue, 26 Jan 2010 23:29:09 +0000 (23:29 +0000)]
Avoid extra calls to MD->getNumOperands()

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

14 years agoIgnore 'forced' tailcall opt in fastisel mode.
Evan Cheng [Tue, 26 Jan 2010 23:28:40 +0000 (23:28 +0000)]
Ignore 'forced' tailcall opt in fastisel mode.

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

14 years agoremove a noop function.
Chris Lattner [Tue, 26 Jan 2010 23:26:29 +0000 (23:26 +0000)]
remove a noop function.

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

14 years agoFix inline cost predictions with SCIENCE.
Jakob Stoklund Olesen [Tue, 26 Jan 2010 23:21:56 +0000 (23:21 +0000)]
Fix inline cost predictions with SCIENCE.

After running a batch of measurements, it is clear that the inliner metrics
need some adjustments:

Own argument bonus:       20 -> 5
Outgoing argument penalty: 0 -> 5
Alloca bonus:             10 -> 5
Constant instr bonus:      7 -> 5
Dead successor bonus:     40 -> 5*(avg instrs/block)

The new cost metrics are generaly 25 points higher than before, so we may need
to move thresholds.

With this change, InlineConstants::CallPenalty becomes a political correction:

if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction()))
  NumInsts += InlineConstants::CallPenalty + CS.arg_size();

The code size is accurately modelled by CS.arg_size(). CallPenalty is added
because calls tend to take a long time, so it may not be worth it to inline a
function with lots of calls.

All of the political corrections are in the InlineConstants namespace:
IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty,
NoreturnPenalty.

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

14 years agonow that enough stuff is constified, move function header printing
Chris Lattner [Tue, 26 Jan 2010 23:18:44 +0000 (23:18 +0000)]
now that enough stuff is constified, move function header printing
logic up from X86 into the common code.  The other targets will
hopefully start using this soon.

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

14 years agoconstify a bunch of dwarf stuff now that the registerinfo method
Chris Lattner [Tue, 26 Jan 2010 23:18:02 +0000 (23:18 +0000)]
constify a bunch of dwarf stuff now that the registerinfo method
is constified.

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

14 years agoconstify a method argument.
Chris Lattner [Tue, 26 Jan 2010 23:15:09 +0000 (23:15 +0000)]
constify a method argument.

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

14 years agoAllow some automatic tailcall optimization without changing ABI.
Evan Cheng [Tue, 26 Jan 2010 23:13:04 +0000 (23:13 +0000)]
Allow some automatic tailcall optimization without changing ABI.

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

14 years agoDelete blank lines that bug me.
Evan Cheng [Tue, 26 Jan 2010 23:07:57 +0000 (23:07 +0000)]
Delete blank lines that bug me.

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

14 years agocall emitconstantpool and emitjumptable like other targets.
Chris Lattner [Tue, 26 Jan 2010 22:06:58 +0000 (22:06 +0000)]
call emitconstantpool and emitjumptable like other targets.

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

14 years agoBefore existing NamedMDNode entry in the symbol table, remove any existing entry...
Devang Patel [Tue, 26 Jan 2010 22:03:41 +0000 (22:03 +0000)]
Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.

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

14 years agoemit jump table an alias ".set" directives through MCStreamer as
Chris Lattner [Tue, 26 Jan 2010 21:53:08 +0000 (21:53 +0000)]
emit jump table an alias ".set" directives through MCStreamer as
assignments.

.set x, a-b

is the same as:

x = a-b

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

14 years agofix CastInst::castIsValid to reject aggregate types, fixing PR6153:
Chris Lattner [Tue, 26 Jan 2010 21:51:43 +0000 (21:51 +0000)]
fix CastInst::castIsValid to reject aggregate types, fixing PR6153:

llvm-as: t.ll:1:25: error: invalid cast opcode for cast from '[4 x i8]' to '[1 x i32]'
@x = constant [1 x i32] bitcast ([4 x i8] c"abcd" to [1 x i32])
                        ^

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

14 years agoRemve unnecessary include.
Devang Patel [Tue, 26 Jan 2010 21:42:58 +0000 (21:42 +0000)]
Remve unnecessary include.

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

14 years agoUse AssertingVH, just to be paranoid.
Devang Patel [Tue, 26 Jan 2010 21:39:14 +0000 (21:39 +0000)]
Use AssertingVH, just to be paranoid.

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

14 years agoRevert test polarity to match comment and desired outcome. Remove undeserved bonus.
Jakob Stoklund Olesen [Tue, 26 Jan 2010 21:31:35 +0000 (21:31 +0000)]
Revert test polarity to match comment and desired outcome. Remove undeserved bonus.

A GEP with all constant indices is already considered free by
analyzeBasicBlock(), so don't give it an extra bonus in
CountCodeReductionForAlloca().

This patch should remove a small positive bias toward inlining functions with
variable-index GEPs, and remove a smaller negative bias from functions with
all-constant index GEPs.

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

14 years agoRemove dead code.
Jakob Stoklund Olesen [Tue, 26 Jan 2010 21:31:30 +0000 (21:31 +0000)]
Remove dead code.

Functions containing indirectbr are marked NeverInline by analyzeBasicBlock(),
so there is no point in giving indirectbr special treatment in
CountCodeReductionForConstant. It is never called.

No functional change intended.

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