Commit Graph

41701 Commits

Author SHA1 Message Date
Mikhail Glushenkov bb63f929d5 Fix build breakage when objdir!=srcdir (proper fix).
llvm-svn: 56999
2008-10-03 10:26:37 +00:00
Mikhail Glushenkov 657e1c5c96 Fix build breakage (again) when srcdir != objdir, other small fixes.
llvm-svn: 56998
2008-10-03 09:09:34 +00:00
Duncan Sands 6e42742d2d The result of getSetCCResultType (eg: i32) may be larger
than the type an i1 is promoted to (eg: i8).  Account
for this.  Noticed by Tilmann Scheller on CellSPU; he
will hopefully take care of fixing this in LegalizeDAG
and adding a testcase!

llvm-svn: 56997
2008-10-03 07:41:46 +00:00
Duncan Sands 3a813a5d3f Teach internalize to preserve the callgraph.
Why?  Because it was there!

llvm-svn: 56996
2008-10-03 07:36:09 +00:00
Nicolas Geoffray 74056ae3d5 Acquire the lock only when necessary. More precisely, do not acquire
the lock when calling a method which may materialize the llvm::Function.

llvm-svn: 56995
2008-10-03 07:27:08 +00:00
Owen Anderson cb4f156b6b SplitBlock should only attempt to update LoopInfo if it is actually being used.
llvm-svn: 56994
2008-10-03 06:55:35 +00:00
Dan Gohman 4e072a75cc Implement fast-isel support for zero-extending from i1.
It turns out that this is a fairly common operation,
and it's easy enough to handle.

llvm-svn: 56990
2008-10-03 01:28:47 +00:00
Dan Gohman b01a9c94d4 Fix X86FastISel to handle dynamic allocas that have avoided
getting inserted into the ValueMap. This avoids infinite
recursion in some rare cases.

llvm-svn: 56989
2008-10-03 01:27:49 +00:00
Bill Wendling 4893c9a78e Unbreak the build.
llvm-svn: 56988
2008-10-03 00:26:49 +00:00
Dan Gohman d9ef073176 Fix a typo.
llvm-svn: 56986
2008-10-03 00:07:11 +00:00
Jim Grosbach 009db89513 Add support for Canadian Cross builds where the host executables are not
runnable on the build machine.

There are a few bits that need built for the build environment (TableGen).
This patch builds those bits, and the associated libraries, for the build
environment as well as the (usual) host environment.

Thanks to Eric C. and Devang P. for pre-commit review.

llvm-svn: 56975
2008-10-02 22:56:44 +00:00
Mikhail Glushenkov 03c8f7b379 Fix build breakage.
Forgot to include Makefile.plugins.

llvm-svn: 56970
2008-10-02 22:41:42 +00:00
Dan Gohman 1ab1d31f7a Optimize conditional branches in X86FastISel. This replaces
sequences like this:
       sete    %al
       testb   %al, %al
       jne     LBB11_1
with this:
       je      LBB11_1

llvm-svn: 56969
2008-10-02 22:15:21 +00:00
Dan Gohman a78bae34a5 Add a new MachineBasicBlock utility function, isLayoutSuccessor, that
can be used when deciding if a block can transfer control to another
via a fall-through instead of a branch.

llvm-svn: 56968
2008-10-02 22:09:09 +00:00
Mikhail Glushenkov f40296bb49 Build system tweaks to make it more convenient for the plugin authors.
Plugins can be now compiled in with a slight Makefile change.
For example, to compile the new Clang driver, use:

cd $LLVMC2_DIR
make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang

llvm-svn: 56967
2008-10-02 21:15:05 +00:00
Andrew Lenharth 72a9e7367c fix build gcc 4.3
llvm-svn: 56965
2008-10-02 20:15:08 +00:00
Owen Anderson c5b45fec6b Use a multimap rather than a map for holding the list of copies to insert, so we don't lose copies when two of them have
the same source.  I don't know what I was thinking when I wrote this originally.
Note: There's probably a more efficient way to do this, but I need to think about it some more, and about what determinism
guarantees need to be present.

llvm-svn: 56964
2008-10-02 19:40:33 +00:00
Dale Johannesen 867d549fce Handle some 64-bit atomics on x86-32, some of the time.
llvm-svn: 56963
2008-10-02 18:53:47 +00:00
Bill Wendling bed16a1a2b Avoid name shadowing with E variable defined in for(). This was giving VC++
grief.

llvm-svn: 56961
2008-10-02 18:39:11 +00:00
Devang Patel 0db9d67f9a Remove redundant check.
llvm-svn: 56960
2008-10-02 18:38:23 +00:00
Evan Cheng b25f4637dd A Partitioned Boolean Quadratic Programming (PBQP) based register allocator.
Contributed by Lang Hames.

llvm-svn: 56959
2008-10-02 18:29:27 +00:00
Oscar Fuentes e3c43d6279 CMake: Added Host.cpp to lib/System/CMakeLists.txt.
llvm-svn: 56957
2008-10-02 17:39:29 +00:00
Daniel Dunbar e9559808bd Rename IRBuilder::IsNonNull -> IsNotNull in response to feedback.
llvm-svn: 56953
2008-10-02 17:05:03 +00:00
Dan Gohman 88536398ff Fix a think-o in isSafeToMove. This fixes it from thinking that
volatile memory references are safe to move.

llvm-svn: 56948
2008-10-02 15:04:30 +00:00
Dan Gohman b158fd751c Work around an interaction between fast-isel and regalloc=local. The
local register allocator's physreg liveness doesn't recognize subregs,
so it doesn't know that defs of %ecx that are immediately followed by
uses of %cl aren't dead. This comes up due to the way fast-isel emits
shift instructions.

This is a temporary workaround. Arguably, local regalloc should
handle subreg references correctly. On the other hand, perhaps
fast-isel should use INSERT_SUBREG instead of just assigning to the
most convenient super-register of %cl when lowering shifts.

This fixes MultiSource/Benchmarks/MallocBench/espresso,
MultiSource/Applications/hexxagon, and others, under -fast.

llvm-svn: 56947
2008-10-02 14:56:12 +00:00
Bill Wendling b04e6edba9 "The original bug was a complaint that _mm_srli_si128 mis-compiled when passed
a constant vector ("{0x123, 0x456}" syntax).  The fix is to simplify the
_mm_srli_si128 macro, and  move the "* 8" from the macro into the compiler
back-end.  I can't change the existing __builtins because so many people are
using them :-(."
Patch by Stuart Hastings!

llvm-svn: 56944
2008-10-02 05:56:52 +00:00
Daniel Dunbar e52e6bfd29 Add llvm::sys::{osName,osVersion} for retrieving operating system name
& version as strings.
 - Win32 code is untested.

llvm-svn: 56942
2008-10-02 01:17:28 +00:00
Dan Gohman dfc507d2b5 Disable fast-isel for this test, as it doesn't emit the same
number of instructions.

llvm-svn: 56940
2008-10-01 23:48:35 +00:00
Devang Patel 9cc9812653 Attributes noinline alwaysinline are incompatible
llvm-svn: 56939
2008-10-01 23:41:25 +00:00
Devang Patel 1b76f2c40b Remove OptimizeForSize global. Use function attribute optsize.
llvm-svn: 56937
2008-10-01 23:18:38 +00:00
Dan Gohman 3b88f10f46 Enable FastISel by default (on x86 and x86-64) with the -fast option.
llvm-svn: 56930
2008-10-01 20:39:19 +00:00
Chris Lattner 41a83d99e6 add a new form of Type::dump that takes a module for type names,
patch provided by Tomas Lindquist Olsen!

llvm-svn: 56929
2008-10-01 20:16:19 +00:00
Dan Gohman 1dd27578dd Make some implicit conversions explicit, to avoid compiler warnings.
llvm-svn: 56927
2008-10-01 19:58:59 +00:00
Dan Gohman 5c8c00af1f Split this test and move it into target-specific directories.
This fixes failures on configurations that don't have one or the
other targets enabled.

llvm-svn: 56926
2008-10-01 19:46:30 +00:00
Dan Gohman 6388dde98e Split x86's ADJCALLSTACK instructions into 32-bit and 64-bit forms.
This allows the 64-bit forms to use+def RSP instead of ESP. This
doesn't fix any real bugs today, but it is more precise and it
makes the debug dumps on x86-64 look more consistent.

Also, add some comments describing the CALL instructions' physreg
operand uses and defs.

llvm-svn: 56925
2008-10-01 18:28:06 +00:00
Jim Grosbach 3dc0a3bce3 Fix typo s/ther/there/
llvm-svn: 56924
2008-10-01 18:16:49 +00:00
Duncan Sands d65a4daeea Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject.  The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.

llvm-svn: 56922
2008-10-01 15:25:41 +00:00
Dan Gohman 94798d31dd Fold trivial two-operand tokenfactors where the operands are equal
immediately.

llvm-svn: 56921
2008-10-01 15:11:19 +00:00
Dan Gohman fbd67be50e Don't prepend a space character for constants in Value::print.
llvm-svn: 56920
2008-10-01 15:09:37 +00:00
Dan Gohman 3a293e7404 Fix typos in comments.
llvm-svn: 56919
2008-10-01 15:07:49 +00:00
Dan Gohman 7354227de0 nounwind-ify this test.
llvm-svn: 56918
2008-10-01 15:07:14 +00:00
Nuno Lopes 96740aad86 revert the addition of Preverves(CallGraph), per Duncan's comments
llvm-svn: 56917
2008-10-01 09:13:40 +00:00
Dan Gohman bb3c5019f8 Mark CALL instructions as having a Use of ESP/RSP.
llvm-svn: 56911
2008-10-01 04:14:30 +00:00
Dan Gohman 3113fa8f32 Don't leave an output file in the test directory.
llvm-svn: 56910
2008-10-01 04:13:23 +00:00
Dan Gohman 67d90de2b0 Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.

llvm-svn: 56908
2008-10-01 02:02:03 +00:00
Bill Wendling 920f6d588e Moved this option to the front-end.
llvm-svn: 56901
2008-10-01 01:02:18 +00:00
Bill Wendling 68f12ee567 Implement the -fno-builtin option in the front-end, not in the back-end.
llvm-svn: 56900
2008-10-01 00:59:58 +00:00
Dan Gohman 1df16dff64 Use explicit target-triples to unbreak this test on non-darwin systems.
llvm-svn: 56896
2008-10-01 00:25:38 +00:00
Owen Anderson 15e6be8cc5 Mark merged-in VNInfo's as being PHIKilled.
llvm-svn: 56893
2008-09-30 23:58:47 +00:00
Owen Anderson f4a36407c7 Fix a simple error in renumbering kill markaers, that took an inordinant amount of time to track down.
llvm-svn: 56889
2008-09-30 22:51:54 +00:00
Bill Wendling 1782584f56 Just don't transform this memset into "bzero" if no-builtin is specified.
llvm-svn: 56888
2008-09-30 22:05:33 +00:00
Nuno Lopes 5093ab4c76 add preserversCFG() + preservers(CallGraph)
llvm-svn: 56887
2008-09-30 22:04:30 +00:00
Bill Wendling e818bc159f - Initialize "--no-builtin" to "false".
- Testcase for r56885.

llvm-svn: 56886
2008-09-30 21:40:30 +00:00
Bill Wendling bd09262e97 Add the new `-no-builtin' flag. This flag is meant to mimic the GCC
`-fno-builtin' flag. Currently, it's used to replace "memset" with "_bzero"
instead of "__bzero" on Darwin10+. This arguably violates the meaning of this
flag, but is currently sufficient. The meaning of this flag should become more
specific over time.

llvm-svn: 56885
2008-09-30 21:22:07 +00:00
Dan Gohman b486350b15 Move the primary fast-isel top-level comments to FastISel.cpp, where
they'll be a little more visible. Also, update and reword them a bit.

llvm-svn: 56877
2008-09-30 20:48:29 +00:00
Nuno Lopes 2bd7b24f1a add AU.setPreservesCFG() since this pass only adds and removes function attributes
llvm-svn: 56868
2008-09-30 18:34:38 +00:00
Dan Gohman 86aa16a69a Optimize SelectionDAG's AssignTopologicalOrder even further.
Completely eliminate the TopOrder std::vector. Instead, sort
the AllNodes list in place. This also eliminates the need to
call AllNodes.size(), a linear-time operation, before
performing the sort.

Also, eliminate the Sources temporary std::vector, since it
essentially duplicates the sorted result as it is being
built.

This also changes the direction of the topological sort
from bottom-up to top-down. The AllNodes list starts out in
roughly top-down order, so this reduces the amount of
reordering needed. Top-down is also more convenient for
Legalize, and ISel needed only minor adjustments.

llvm-svn: 56867
2008-09-30 18:30:35 +00:00
Evan Cheng 1a9a0b7b4e Add runStaticConstructorsDestructors which runs ctors / dtors of a single module. Patch by David Chisnall.
llvm-svn: 56849
2008-09-30 15:51:21 +00:00
Evan Cheng 9156bd2f48 Re-apply 56835 along with header file changes.
llvm-svn: 56848
2008-09-30 15:44:16 +00:00
Duncan Sands dc69391810 Stacker is dead.
llvm-svn: 56844
2008-09-30 15:18:29 +00:00
Duncan Sands 2b9adce1d0 Revert commit 56835 since it breaks the build.
"If a re-materializable instruction has a register
operand, the spiller will change the register operand's
spill weight to HUGE_VAL to avoid it being spilled.
However, if the operand is already in the queue ready
to be spilled, avoid re-materializing it".

llvm-svn: 56837
2008-09-30 10:00:30 +00:00
Evan Cheng 9469049f7d If a re-materializable instruction has a register operand, the spiller will change the register operand's spill weight to HUGE_VAL to avoid it being spilled. However, if the operand is already in the queue ready to be spilled, avoid re-materializing it.
llvm-svn: 56835
2008-09-30 06:36:58 +00:00
Nick Lewycky e8ced3ec19 Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2))
llvm-svn: 56834
2008-09-30 06:08:34 +00:00
Dan Gohman 8392f0c75d Fix X86FastISel's output for x86-32 PIC constant pool addresses.
llvm-svn: 56829
2008-09-30 01:21:32 +00:00
Dan Gohman 6ebe734ca6 Move the GlobalBaseReg field out of X86ISelDAGToDAG.cpp
and X86FastISel.cpp into X86MachineFunction.h, so that it
can be shared, instead of having each selector keep track
of its own.

llvm-svn: 56825
2008-09-30 00:58:23 +00:00
Dan Gohman 5033136825 Disable all x87 usage, including f32 and f64 when the subtarget
doesn't have SSE(2), with X86FastISel.

llvm-svn: 56823
2008-09-30 00:48:39 +00:00
Dale Johannesen f61a84ec43 Remove misuse of ReplaceNodeResults for atomics with
valid types.  No functional change.

llvm-svn: 56808
2008-09-29 22:25:26 +00:00
Dan Gohman 4aa9095398 Fix FastISel to not initialize the PIC-base register multiple times
in functions with PIC references from more than one basic block.

llvm-svn: 56807
2008-09-29 21:55:50 +00:00
Dan Gohman c02dbf451e Fix an over-pessimization about GlobalVariable addresses in X86FastISel.
llvm-svn: 56802
2008-09-29 21:13:15 +00:00
Devang Patel 221fe42006 Support inreg, zext and sext as return value attributes.
llvm-svn: 56801
2008-09-29 20:49:50 +00:00
Devang Patel e97439091f Fix grammar.
llvm-svn: 56796
2008-09-29 18:34:44 +00:00
Devang Patel 3ef3afbfb8 Fix grammer.
llvm-svn: 56795
2008-09-29 18:16:38 +00:00
Devang Patel 6891a55e73 Fix sentence.
llvm-svn: 56794
2008-09-29 18:16:09 +00:00
Evan Cheng 82237f2f42 Fix PR2835. Do not change the width of a volatile load.
llvm-svn: 56792
2008-09-29 17:26:18 +00:00
Duncan Sands 57512a1be4 Speed up these passes when the callgraph has
huge simply connected components.  Suggested
by Chris.

llvm-svn: 56787
2008-09-29 14:59:04 +00:00
Nuno Lopes ffc9da6772 remove redundant test (mayBeOverriden() includes hasLinkOnceLinkage)
llvm-svn: 56786
2008-09-29 14:40:32 +00:00
Duncan Sands e340e18783 Tweak some comments.
llvm-svn: 56784
2008-09-29 13:35:31 +00:00
Matthijs Kooijman eed995b796 Add some hands-on documentation about which files to create and edit when
adding a backend.

llvm-svn: 56783
2008-09-29 11:52:22 +00:00
Duncan Sands 08d91178e9 Rename isWeakForLinker to mayBeOverridden. Use it
instead of hasWeakLinkage in a bunch of optimization
passes.

llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Matthijs Kooijman be4fc9b9fb Add a testcase showing that scalarrepl supports first class structs.
I originally made this script to show that scalarrepl didn't support them, but
it turned out it does. Better to still add the testcase then.

llvm-svn: 56781
2008-09-29 10:42:13 +00:00
Dan Gohman 843fe14fab Move the code that handles DAGISel error conditions into
helper functions instead of duplicating it inline each time
it is needed. This eliminates a few hundred or so copies
of this code in each target.

llvm-svn: 56759
2008-09-27 23:53:14 +00:00
Daniel Dunbar c7486c8636 Add IRBuilder::{CreateIsNull, CreateIsNonNull} helper methods.
- I'm open to the idea that these could have better names. I think
   these read better than CreateEQNull and CreateNENull.

llvm-svn: 56757
2008-09-27 23:22:55 +00:00
Evan Cheng 3774b2f292 Re-apply 56683 with fixes.
llvm-svn: 56748
2008-09-27 01:56:22 +00:00
Devang Patel db937ec8fa Update tests.
llvm-svn: 56730
2008-09-27 00:25:28 +00:00
Daniel Dunbar 1d5e766016 Unbreak build.
llvm-svn: 56727
2008-09-27 00:22:09 +00:00
Bill Wendling ba3d0b7c00 Add missing #include for asserts.
llvm-svn: 56718
2008-09-27 00:08:24 +00:00
Devang Patel 9eb525d4f9 Implement function notes as function attributes.
llvm-svn: 56716
2008-09-26 23:51:19 +00:00
Dale Johannesen c4b02eb4e5 Generated files for warning fix.
llvm-svn: 56715
2008-09-26 23:46:20 +00:00
Dale Johannesen e2ea91e7cb Fix a compiler warning.
llvm-svn: 56714
2008-09-26 23:45:53 +00:00
Evan Cheng 7d6fa97567 Implement "punpckldq %xmm0, $xmm0" as "pshufd $0x50, %xmm0, %xmm" unless optimizing for code size.
llvm-svn: 56711
2008-09-26 23:41:32 +00:00
Devang Patel a05633e105 Now Attributes are divided in three groups
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn

Return attributes use 0 as the index.
Function attributes use ~0U as the index.

This patch requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56704
2008-09-26 22:53:05 +00:00
Bill Wendling c966a737c5 Temporarily reverting r56683. This is causing a failure during the build of llvm-gcc:
/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -mmacosx-version-min=10.4 -O2  -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Gir/devel/llvm/clean/llvm.obj/include -I/Volumes/Gir/devel/llvm/clean/llvm.src/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c ../../llvm-gcc.src/gcc/unwind-dw2-fde-darwin.c -o libgcc/./unwind-dw2-fde-darwin.o
Assertion failed: (TargetRegisterInfo::isVirtualRegister(regA) && TargetRegisterInfo::isVirtualRegister(regB) && "cannot update physical register live information"), function runOnMachineFunction, file /Volumes/Gir/devel/llvm/clean/llvm.src/lib/CodeGen/TwoAddressInstructionPass.cpp, line 311.
../../llvm-gcc.src/gcc/unwind-dw2.c:1527: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
{standard input}:3521:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
{standard input}:3521:symbol: "_dwarf_reg_size_table" can't be undefined in a subtraction expression
{standard input}:3520:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
...

llvm-svn: 56703
2008-09-26 22:10:44 +00:00
Dan Gohman 5628f642ad Fix missing whitespace in the printing of function notes.
llvm-svn: 56702
2008-09-26 22:02:59 +00:00
Dan Gohman 6e0548336a Rename ConstantSDNode's getSignExtended to getSExtValue, for
consistancy with ConstantInt, and re-implement it in terms
of ConstantInt's getSExtValue.

llvm-svn: 56700
2008-09-26 21:54:37 +00:00
Dan Gohman 7e763ed3aa Make some minor reorganizations and comment changes to eliminate trivial
differences between the CallInst and InvokeInst classes.

llvm-svn: 56699
2008-09-26 21:38:45 +00:00
Dan Gohman 7e922aa35d Mark lea fi# as being really rematerializable.
llvm-svn: 56698
2008-09-26 21:30:20 +00:00
Evan Cheng 30f5494efb unpckhps requires sse1, punpckhdq requires sse2.
llvm-svn: 56697
2008-09-26 21:26:30 +00:00
Daniel Dunbar 94cefefcbb Update LICENSE link.
llvm-svn: 56689
2008-09-26 21:12:29 +00:00
Dan Gohman 2564b900ce Fix X86FastISel's address folding to check displacement
values for overflow.

llvm-svn: 56686
2008-09-26 20:04:15 +00:00
Evan Cheng d77cbe8947 Fix @llvm.frameaddress codegen. FP elimination optimization should be disabled when frame address is desired. Also add support for depth > 0.
llvm-svn: 56683
2008-09-26 19:48:35 +00:00
Oscar Fuentes 9e3f7dbeda CMake: Builds all examples. Corrected name of CBackend target.
llvm-svn: 56682
2008-09-26 19:48:03 +00:00
Dale Johannesen c0f4d00d67 Generated files for previous patch.
llvm-svn: 56679
2008-09-26 19:32:34 +00:00
Dale Johannesen a7dd8bfaa5 Another file I forgot.
llvm-svn: 56678
2008-09-26 19:31:53 +00:00
Dale Johannesen 0e32a2c935 Add "inreg" field to CallSDNode (doesn't increase
its size).  Adjust various lowering functions to
pass this info through from CallInst.  Use it to
implement sseregparm returns on X86.  Remove
X86_ssecall calling convention.

llvm-svn: 56677
2008-09-26 19:31:26 +00:00
Dan Gohman 007a6bb9b9 Factor out the code for determining when symblic addresses
require RIP-relative addressing and use it to fix a bug
in X86FastISel in x86-64 PIC mode, where it was trying to
use base/index registers with RIP-relative addresses. This
fixes a bunch of x86-64 testsuite failures.

llvm-svn: 56676
2008-09-26 19:15:30 +00:00
Evan Cheng 994dd0bbec Avoid spilling EBP / RBP twice in the prologue.
llvm-svn: 56675
2008-09-26 19:14:21 +00:00
Owen Anderson a381313d98 We don't need to insert copies for implicit_def's.
llvm-svn: 56674
2008-09-26 18:50:46 +00:00
Jim Grosbach bfc70b050b When looking for executable extensions, ignore .dSYM, as that's the debug info directory on Darwin.
llvm-svn: 56667
2008-09-26 17:27:58 +00:00
Evan Cheng 001ffdd36b X86 address displacement field must be interpreted as a 32-bit value.
llvm-svn: 56665
2008-09-26 16:58:16 +00:00
Oscar Fuentes cdc95498f5 CMake: Builds all targets.
llvm-svn: 56641
2008-09-26 04:40:32 +00:00
Dan Gohman 839105d254 Disable support for x86_f80 in X86FastISel. Supporting it would
require more work.

llvm-svn: 56637
2008-09-26 01:39:32 +00:00
Bill Wendling 374d7f2b16 If we have a function with an unreachable statement such that the ending debug
information is in an unreachable block, then it's possible that the high/low pc
values won't be set for the dwarf information. E.g., this function:

void abort(void) __attribute__((__noreturn__));
void dead_beef(void) __attribute__ ((noreturn));

int *b;

void dead_beef(void) {
  *b=0xdeadbeef;
  abort();
}

has a call to "@llvm.dbg.region.end" only in the unreachable block:

define void @dead_beef() noreturn nounwind  {
entry:
	call void @llvm.dbg.func.start(...)
	call void @llvm.dbg.stoppoint(...)
...
	call void @abort( ) noreturn nounwind 
	unreachable

return:		; No predecessors!
	call void @llvm.dbg.stoppoint(...)
	call void @llvm.dbg.region.end(...)
	ret void
}

The dwarf information emitted is something like:

0x00000084:     TAG_subprogram [5]  
                 AT_name( "dead_beef" )
                 AT_external( 0x01 )
                 AT_prototyped( 0x01 )
                 AT_decl_file( 0x01 )
                 AT_decl_line( 0x08 )

Note that this is *not* the best fix for this problem, but a band-aid for an
gaping wound. This code needs to be changed when we revamp our debugging
information.

llvm-svn: 56628
2008-09-26 00:28:12 +00:00
Evan Cheng 9dbe45c000 Prefer movlhps over punpcklqdq, etc. in more cases.
llvm-svn: 56627
2008-09-25 23:35:16 +00:00
Dan Gohman 0c1b884df1 Fix a bug in which address displacements were being added to the
load from the stub, instead of the result of the load from the stub.

llvm-svn: 56626
2008-09-25 23:34:02 +00:00
Bill Wendling 0c37421623 Make pointer parameter const for isUsedInBasicBlock.
llvm-svn: 56625
2008-09-25 22:42:01 +00:00
Devang Patel 4c758ea3e0 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Anton Korobeynikov 87001fd6fd Reapply 56585:56589 with proper fix for some gcc versions
llvm-svn: 56621
2008-09-25 21:00:33 +00:00
Evan Cheng 74c9ed91b0 With sse3 and when the source is a load or has multiple uses, favors movddup over shuffp*, pshufd, etc. Without sse3 or when the source is from a register, make use of movlhps
llvm-svn: 56620
2008-09-25 20:50:48 +00:00
Dale Johannesen c50ada2f56 Accept 'inreg' attribute on x86 functions as
meaning sse_regparm (i.e. float/double values go
in XMM0 instead of ST0).  Update documentation
to reflect reality.

llvm-svn: 56619
2008-09-25 20:47:45 +00:00
Dan Gohman bb9a211530 Avoid a spurious extra space character when printing empty structs.
llvm-svn: 56616
2008-09-25 17:37:20 +00:00
Dan Gohman 5e490a7567 Support for i1 XOR in FastISel. It is actually safe because
i1 operands are assumed to already by zero-extended.

llvm-svn: 56615
2008-09-25 17:22:52 +00:00
Dan Gohman 6975c36c43 Don't print fast-isel debug messages by default. Thanks Chris!
llvm-svn: 56614
2008-09-25 17:21:42 +00:00
Dan Gohman dd920bf3f0 Don't forget the newline in debug output.
llvm-svn: 56613
2008-09-25 17:17:27 +00:00
Dan Gohman 32a733e2c7 FastISel support for debug info.
llvm-svn: 56610
2008-09-25 17:05:24 +00:00
Richard Pennington 4b35e64504 bug 2812: Segmentation fault on a big emdiam processor.
llvm-svn: 56609
2008-09-25 16:15:10 +00:00
Dan Gohman 3691d507c4 PIC support in X86FastISel.
llvm-svn: 56608
2008-09-25 15:24:26 +00:00
Evan Cheng 84301390ae Temporarily backing out 56585:56589 to unbreak the build.
llvm-svn: 56607
2008-09-25 07:38:08 +00:00
Dan Gohman 3663f156f7 Fix a recent fast-isel coverage regression - don't bail out before
giving the target a chance to materialize constants.

llvm-svn: 56605
2008-09-25 01:28:51 +00:00
Dan Gohman b8e69f1755 Enable DeadMachineInstructionElim when Fast-ISel is enabled.
llvm-svn: 56604
2008-09-25 01:14:49 +00:00
Dan Gohman b873aa632c Add debug output to this pass.
llvm-svn: 56602
2008-09-25 01:06:50 +00:00
Evan Cheng 7b5a6afb44 pmovsxbq etc. requires sse4.1.
llvm-svn: 56600
2008-09-25 00:49:51 +00:00
Dan Gohman acb0554842 Refactor the code that adds standard LLVM codegen passes into
a separate function, eliminating duplication between the
add-passes-for-file and add-passes-for-machine-code code.

llvm-svn: 56599
2008-09-25 00:37:07 +00:00
Evan Cheng 2e7450716a <rdar://problem/6234798> Assertion failed: (!OpInfo.AssignedRegs.Regs.empty() && "Couldn't allocate input reg!")
llvm-svn: 56597
2008-09-25 00:14:04 +00:00
Dan Gohman 382e2ec6b7 Give LowerSubregs.cpp a top-level description.
llvm-svn: 56596
2008-09-24 23:44:12 +00:00
Evan Cheng f8ead16b50 Fix patterns for SSE4.1 move and sign extend instructions. Also add instructions which fold VZEXT_MOVL and VZEXT_LOAD.
llvm-svn: 56594
2008-09-24 23:27:55 +00:00
Evan Cheng 4751549f9b X86ISD::VZEXT_LOAD should produce and fold a chain.
llvm-svn: 56593
2008-09-24 23:26:36 +00:00
Dale Johannesen 86d421df23 Remove SelectionDag early allocation of registers
for earlyclobbers.  Teach Local RA about earlyclobber,
and add some tests for it.

llvm-svn: 56592
2008-09-24 23:13:09 +00:00
Anton Korobeynikov 2d59db7ae4 Finally get rid of virtual inheritance in TAI
llvm-svn: 56589
2008-09-24 22:23:17 +00:00
Anton Korobeynikov 3097c10347 Minor cleanup
llvm-svn: 56588
2008-09-24 22:22:54 +00:00
Anton Korobeynikov a9163feefe Get rid of virtual inheritance for ARM TAI
llvm-svn: 56587
2008-09-24 22:22:27 +00:00
Anton Korobeynikov 237f087eb9 Get rid of virtual inheritance for PPC TAI
llvm-svn: 56586
2008-09-24 22:22:03 +00:00
Anton Korobeynikov 77aa975bdd Use crazy template-based inheritance instead of virtual one.
llvm-svn: 56585
2008-09-24 22:21:39 +00:00
Anton Korobeynikov fd7faecfc2 Use helper
llvm-svn: 56584
2008-09-24 22:21:04 +00:00
Anton Korobeynikov d19e91e5a8 SmallPtrSet will be better
llvm-svn: 56583
2008-09-24 22:20:46 +00:00
Anton Korobeynikov 8e7b93938d Get rid of ReadOnlySection duplicate
llvm-svn: 56582
2008-09-24 22:20:27 +00:00
Anton Korobeynikov 91a6705839 Use named sections, where they should be
llvm-svn: 56581
2008-09-24 22:19:13 +00:00
Anton Korobeynikov 5906234c1d Get rid of now unused {Four,Eight,Sixteen}ByteConstantSection
llvm-svn: 56580
2008-09-24 22:18:54 +00:00
Anton Korobeynikov 123afb88c4 Use generic section-handling stuff to emit constant pool entries
llvm-svn: 56579
2008-09-24 22:17:59 +00:00
Anton Korobeynikov 41573b2131 Cleanup
llvm-svn: 56578
2008-09-24 22:17:27 +00:00
Anton Korobeynikov 22db30548d Get rid of duplicate char*/Section* stuff for TLS sections
llvm-svn: 56577
2008-09-24 22:17:06 +00:00
Anton Korobeynikov 1f365bbf55 Cleanup, no functionality change
llvm-svn: 56576
2008-09-24 22:16:33 +00:00
Anton Korobeynikov 7497762606 Get rid of duplicate char*/Section* DataSection
llvm-svn: 56575
2008-09-24 22:16:16 +00:00
Anton Korobeynikov f8dc8aac3c Get rid of duplicate char*/Section* TextSection
llvm-svn: 56574
2008-09-24 22:15:21 +00:00
Anton Korobeynikov 076e905b94 Move actual section printing stuff to AsmPrinter from TAI reducing heap traffic.
llvm-svn: 56573
2008-09-24 22:14:23 +00:00
Anton Korobeynikov 69ff51baa0 Drop obsolete hook and change all usage to new interface
llvm-svn: 56572
2008-09-24 22:13:07 +00:00
Anton Korobeynikov 7d002fa77b Provide direct function to switch to Section
llvm-svn: 56571
2008-09-24 22:12:10 +00:00
Anton Korobeynikov 8ac1127ed6 SPU section handling is really huge mess. Replace remaining TAI calls for sections with explicit names in order not to block existing backends during section handling migration. SPU folks! Please consider using new section handling facility someday.
llvm-svn: 56570
2008-09-24 22:11:42 +00:00
Anton Korobeynikov 69721aa85c Remove dead code for PIC16 (preparation to switch to new section handling stuff)
llvm-svn: 56569
2008-09-24 22:11:26 +00:00
Anton Korobeynikov ffecb087a3 XMM6-XMM15 are callee-saved on Win64. Patch by Nicolas Capens!
llvm-svn: 56568
2008-09-24 22:03:04 +00:00
Owen Anderson 4ef4b1a7c1 Fix off-by-one error when updating live intervals.
llvm-svn: 56567
2008-09-24 21:30:38 +00:00
Oscar Fuentes 24b43007d1 CMake: Disabled some warnings for MSVC.
llvm-svn: 56565
2008-09-24 19:27:54 +00:00
Steve Naroff a18f283d1d Add Attributes.cpp to the vcproj.
llvm-svn: 56561
2008-09-24 17:23:28 +00:00
Evan Cheng cdc0060e27 Add DisableGVCompilation which forces the JIT to assert when it tries to allocate space for a GlobalVariable.
llvm-svn: 56557
2008-09-24 16:25:55 +00:00
Bill Wendling dea91308ae Reapplying r56550
llvm-svn: 56553
2008-09-24 10:25:02 +00:00
Bill Wendling 162c26dee3 Forgot this part with my last patch. Sorry about the breakage.
llvm-svn: 56552
2008-09-24 10:16:24 +00:00
Eric Christopher 4e26a81371 Temporarily revert r56550 until missing commit can be added.
llvm-svn: 56551
2008-09-24 08:30:44 +00:00
Bill Wendling 7c31464a0b Refactor the constant folding code into it's own function. And call it from both
the SelectionDAG and DAGCombiner code. The only functionality change is that now
the DAG combiner is performing the constant folding for these operations instead
of being a no-op.

This is *not* in response to a bug, so there isn't a testcase.

llvm-svn: 56550
2008-09-24 07:11:26 +00:00
Evan Cheng 25dd4a2daf Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.
llvm-svn: 56549
2008-09-24 06:48:55 +00:00
Eric Christopher c1ea149dcd Fix fallout in CodeGenPrepare from 56526. Will likely need more work.
llvm-svn: 56546
2008-09-24 05:32:41 +00:00
Eric Christopher a867337344 Fix fallout from revision r56535.
llvm-svn: 56545
2008-09-24 04:55:49 +00:00
Oscar Fuentes ace327af3e CMake: Lists of source files updated. Removed bogus dependency from
lib/VMCore/CMakeLists.txt

llvm-svn: 56541
2008-09-24 01:58:12 +00:00
Oscar Fuentes 0d94c21a2b CMake: Removed unnecessary messages from msvc_llvm_config macro.
llvm-svn: 56540
2008-09-24 01:54:03 +00:00
Dale Johannesen c36660d756 Next round of earlyclobber handling. Approach the
RA problem by expanding the live interval of an
earlyclobber def back one slot.  Remove
overlap-earlyclobber throughout.  Remove 
earlyclobber bits and their handling from
live internals.

llvm-svn: 56539
2008-09-24 01:07:17 +00:00
Devang Patel 6402c7236f s/ParamAttrsWithIndex/FnAttributeWithIndex/g
llvm-svn: 56535
2008-09-24 00:55:02 +00:00
Evan Cheng 423b4f24c8 Test fp not.
llvm-svn: 56534
2008-09-24 00:50:16 +00:00
Devang Patel 0009505a25 s/ParamAttributeListImpl/AttributeListImpl/g
llvm-svn: 56532
2008-09-24 00:29:49 +00:00
Dan Gohman 6b33aa4d96 Refactor the logic for testing if an instruction is dead into a
separate method.

llvm-svn: 56531
2008-09-24 00:27:38 +00:00
Dan Gohman 1e2b282be3 Set SetStore to false, to allow this pass to delete
dead loads.

llvm-svn: 56529
2008-09-24 00:07:08 +00:00
Dan Gohman 7c59ed6ff8 Add a method to MachineInstr for testing whether it makes
any volatile memory references.

llvm-svn: 56528
2008-09-24 00:06:15 +00:00
Devang Patel e15607b7bb Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
llvm-svn: 56527
2008-09-24 00:06:15 +00:00
Evan Cheng e0add20c1b Properly handle 'm' inline asm constraints. If a GV is being selected for the addressing mode, it requires the same logic for PIC relative addressing, etc.
llvm-svn: 56526
2008-09-24 00:05:32 +00:00
Devang Patel e87abd26ba Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
Do not check isDeclaration() in hasNote(). It is clients' responsibility.

llvm-svn: 56524
2008-09-23 23:52:03 +00:00
Devang Patel f405b5e532 80 cols
llvm-svn: 56521
2008-09-23 23:32:15 +00:00
Devang Patel a987d3e3fb s/ParameterAttributes/Attributes/g
llvm-svn: 56520
2008-09-23 23:25:44 +00:00
Devang Patel 21d4e4e783 Remove tabs.
llvm-svn: 56515
2008-09-23 23:18:26 +00:00
Devang Patel ba3fa6c6e1 s/ParameterAttributes/Attributes/g
llvm-svn: 56513
2008-09-23 23:03:40 +00:00
Devang Patel 82fed6702b Use parameter attribute store (soon to be renamed) for
Function Notes also. Function notes are stored at index ~0.

llvm-svn: 56511
2008-09-23 22:35:17 +00:00
Dan Gohman 676145f02d Now that DeadMachineInstructionElim is basically working
correctly, it's not necessary to explicitly remove registers
from their use-def lists.

llvm-svn: 56509
2008-09-23 22:04:18 +00:00
Dan Gohman 918fe08a56 Arrange for FastISel code to have access to the MachineModuleInfo
object. This will be needed to support debug info.

llvm-svn: 56508
2008-09-23 21:53:34 +00:00
Dan Gohman 269999cb03 Track local physical register liveness. This is not the most
efficient implementation possible, but it's pretty simple and
good enough for the time being.

llvm-svn: 56504
2008-09-23 21:40:44 +00:00
Chris Lattner 4f6646780e regenerate
llvm-svn: 56502
2008-09-23 21:18:31 +00:00
Chris Lattner 7f0a77f11d allow inreg on the result of a function
llvm-svn: 56501
2008-09-23 21:18:08 +00:00
Dan Gohman c07f686665 Replace the LiveRegs SmallSet with a simple counter that keeps
track of the number of live registers, which is all the set was
being used for.

llvm-svn: 56498
2008-09-23 18:50:48 +00:00
Dan Gohman ed1cf1a8f1 Fix these enums' starting values to reflect the way that
instruction opcodes are now numbered. No functionality change.

llvm-svn: 56497
2008-09-23 18:42:32 +00:00
Dan Gohman 4eb9956940 Update the comment to reflect the new name.
llvm-svn: 56496
2008-09-23 18:27:53 +00:00
Dan Gohman e64c9944f6 Delete an unused function.
llvm-svn: 56495
2008-09-23 18:26:47 +00:00
Dan Gohman 2430073657 Move the code for initializing the global base reg out of
X86ISelDAGToDAG.cpp and into X86InstrInfo.cpp. This will allow
it to be reused by FastISel.

llvm-svn: 56494
2008-09-23 18:22:58 +00:00
Duncan Sands 9c40c28926 Rationalize the names of passes that print information:
-callgraph => print-callgraph
    -callscc   => print-callgraph-sccs
    -cfgscc    => print-cfg-sccs
    -externalfnconstants => print-externalfnconstants
    -print               => print-function
    -print-alias-sets (no change)
    -print-callgraph     => dot-callgraph
    -print-cfg           => dot-cfg
    -print-cfg-only      => dot-cfg-only
    -print-dom-info (no change)
    -printm              => print-module
    -printusedtypes      => print-used-types

llvm-svn: 56487
2008-09-23 12:47:39 +00:00
Matthijs Kooijman bdb215d338 Fix indendation.
llvm-svn: 56486
2008-09-23 08:54:41 +00:00
Owen Anderson 4cdc18ad80 Add initial support for inserting last minute copies.
llvm-svn: 56485
2008-09-23 04:37:10 +00:00