Commit Graph

5849 Commits

Author SHA1 Message Date
Dan Gohman
b5cc34d098 Correctly handle calls with no return values. This fixes
2006-01-23-UnionInit on x86-64 when inlining is not enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-07 00:12:37 +00:00
Dan Gohman
4daa9071ed Don't dereference the end() iterator. Thanks to
ENABLE_EXPENSIVE_CHECKS for finding this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 18:00:07 +00:00
Devang Patel
e4d4b8c533 Remove unncessary isDeclaration() checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 17:30:07 +00:00
Chris Lattner
d20a00d011 reorder #include order, patch by Kenneth Boyd!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 03:54:25 +00:00
Chris Lattner
78129446ca Add #include to get alloca, patch by Kenneth Boyd!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 03:53:16 +00:00
Chris Lattner
31d7161206 wrap some long lines and expand i32 mul's to libcalls, inspired by a
patch by Mikael Lepisto!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 21:27:46 +00:00
Oscar Fuentes
80533040bc CMake: Reflected changes on source file structure. New plugin support
for llvmc2 incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 21:18:50 +00:00
Argyrios Kyrtzidis
0304b87cce Fix compilation error on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 08:11:49 +00:00
Dan Gohman
241f464d24 Fix fast-isel's handling of atomic instructions. They may
expand to multiple basic blocks, in which case fast-isel
needs to informed of which block to use as it resumes
inserting instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 00:56:36 +00:00
Dan Gohman
022b21ff7c Fix a bug in the local allocator's liveness computation where it
was setting kill flags on tied uses in two-address instructions.
The kill flags were causing the allocator to think it could
allocate the use and its tied def in different registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 00:31:14 +00:00
Dale Johannesen
1b54c7fe9b Pass MemOperand through for 64-bit atomics on 32-bit,
incidentally making the case where the memop is a
pointer deref work.  Fix cmp-and-swap regression.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 19:41:08 +00:00
Dan Gohman
ca0a5d9356 Use -1ULL instead of uint64_t(-1), at Anton's suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 17:56:45 +00:00
Evan Cheng
17a82eaeb6 Fix typos pointed out by Duncan. Also untabify these files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 17:11:58 +00:00
Dan Gohman
d735b8019b Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:45:36 +00:00
Duncan Sands
e47561ccff 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 07:41:46 +00:00
Dan Gohman
91b6f97ce4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 01:28:47 +00:00
Dan Gohman
d98d6203e4 Optimize conditional branches in X86FastISel. This replaces
sequences like this:
       sete    %al
       testb   %al, %al
       jne     LBB11_1
with this:
       je      LBB11_1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 22:15:21 +00:00
Dan Gohman
6ade6f55a8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56968 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 22:09:09 +00:00
Andrew Lenharth
88ab90b475 fix build gcc 4.3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 20:15:08 +00:00
Owen Anderson
8481ee7f52 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 19:40:33 +00:00
Dale Johannesen
48c1bc2ace Handle some 64-bit atomics on x86-32, some of the time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 18:53:47 +00:00
Evan Cheng
b1290a6cc4 A Partitioned Boolean Quadratic Programming (PBQP) based register allocator.
Contributed by Lang Hames.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 18:29:27 +00:00
Dan Gohman
d790a5ceee Fix a think-o in isSafeToMove. This fixes it from thinking that
volatile memory references are safe to move.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 15:04:30 +00:00
Devang Patel
4ae641f4d1 Remove OptimizeForSize global. Use function attribute optsize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 23:18:38 +00:00
Dan Gohman
dc756858f9 Enable FastISel by default (on x86 and x86-64) with the -fast option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 20:39:19 +00:00
Dan Gohman
aeaf245db3 Make some implicit conversions explicit, to avoid compiler warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 19:58:59 +00:00
Dan Gohman
38ac062c2f Fold trivial two-operand tokenfactors where the operands are equal
immediately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 15:11:19 +00:00
Dan Gohman
929d3eb171 Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 15:07:49 +00:00
Bill Wendling
6158d8492c Implement the -fno-builtin option in the front-end, not in the back-end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 00:59:58 +00:00
Owen Anderson
05472ee54b Mark merged-in VNInfo's as being PHIKilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 23:58:47 +00:00
Owen Anderson
309c6162c6 Fix a simple error in renumbering kill markaers, that took an inordinant amount of time to track down.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 22:51:54 +00:00
Bill Wendling
fd8ca5a0ef - Initialize "--no-builtin" to "false".
- Testcase for r56885.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 21:40:30 +00:00
Bill Wendling
6f287b22d2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 21:22:07 +00:00
Dan Gohman
5ec9efd61b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:48:29 +00:00
Dan Gohman
f06c835f76 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56867 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 18:30:35 +00:00
Evan Cheng
dc37786595 Re-apply 56835 along with header file changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56848 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 15:44:16 +00:00
Duncan Sands
46292be362 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".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 10:00:30 +00:00
Evan Cheng
d41474d2c0 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56835 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 06:36:58 +00:00
Dale Johannesen
71d1bf55a2 Remove misuse of ReplaceNodeResults for atomics with
valid types.  No functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 22:25:26 +00:00
Dan Gohman
a43abd102f Fix FastISel to not initialize the PIC-base register multiple times
in functions with PIC references from more than one basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 21:55:50 +00:00
Bill Wendling
d5d8191b20 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"
...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:10:44 +00:00
Dan Gohman
7810bfed55 Rename ConstantSDNode's getSignExtended to getSExtValue, for
consistancy with ConstantInt, and re-implement it in terms
of ConstantInt's getSExtValue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:54:37 +00:00
Evan Cheng
36a55023c1 Fix @llvm.frameaddress codegen. FP elimination optimization should be disabled when frame address is desired. Also add support for depth > 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:48:35 +00:00
Dale Johannesen
86098bd6a6 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:31:26 +00:00
Owen Anderson
082d351361 We don't need to insert copies for implicit_def's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 18:50:46 +00:00
Bill Wendling
d751c64a67 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 00:28:12 +00:00
Devang Patel
0598866c05 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Dale Johannesen
c9c6da61ac 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 20:47:45 +00:00
Dan Gohman
5dd9c2e9ae Support for i1 XOR in FastISel. It is actually safe because
i1 operands are assumed to already by zero-extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 17:22:52 +00:00
Dan Gohman
77ca41e5c3 Don't print fast-isel debug messages by default. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 17:21:42 +00:00