1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 06:22:56 +02:00
Commit Graph

36502 Commits

Author SHA1 Message Date
Chris Lattner
f93e3d7dd7 For long double constants, print an approximation of their value to the .s file to make it easier to read.
llvm-svn: 46407
2008-01-27 06:09:28 +00:00
Chris Lattner
aa553aa0c1 Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
llvm-svn: 46406
2008-01-27 05:29:54 +00:00
Chris Lattner
00183edf55 Add some notes.
llvm-svn: 46405
2008-01-26 20:12:07 +00:00
Chris Lattner
6124c0eb2d Remove some code for inferring alignment info from the x86 backend
now that the dag combiner does it.

llvm-svn: 46404
2008-01-26 20:07:42 +00:00
Chris Lattner
e66aea6532 New test to verify that "merging 4 loads into a vec load" continues to work and
continues to infer alignment info.

llvm-svn: 46403
2008-01-26 20:06:45 +00:00
Chris Lattner
266b518f13 make this 64-bit safe
llvm-svn: 46402
2008-01-26 19:50:30 +00:00
Chris Lattner
682346a7b0 Infer alignment of loads and increase their alignment when we can tell they are
from the stack.  This allows us to compile stack-align.ll to:

_test:
	movsd	LCPI1_0, %xmm0
	movapd	%xmm0, %xmm1
***	andpd	4(%esp), %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

instead of:

_test:
	movsd	LCPI1_0, %xmm0
**	movsd	4(%esp), %xmm1
**	andpd	%xmm0, %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

llvm-svn: 46401
2008-01-26 19:45:50 +00:00
Chris Lattner
f0c3240135 remove a useless xfailed test.
llvm-svn: 46400
2008-01-26 19:35:46 +00:00
Duncan Sands
9fae964ef7 Invert this test, because it is wrong if we allow
readonly functions to use byval parameters as local
storage (how much do we want this?).

llvm-svn: 46399
2008-01-26 12:33:01 +00:00
Bill Wendling
7b83688c73 If there's no instructions being emitted on X86 for a function, emit a
nop. Emit the nop directly for PPC.

llvm-svn: 46398
2008-01-26 09:03:52 +00:00
Bill Wendling
26fb9335f5 Need to convert to LLVM code and not C.
llvm-svn: 46397
2008-01-26 06:56:08 +00:00
Bill Wendling
3e622b88b6 Rename the .c to .ll
llvm-svn: 46396
2008-01-26 06:53:40 +00:00
Bill Wendling
7151e8d92c Move testcase to the code gen directory.
llvm-svn: 46395
2008-01-26 06:53:06 +00:00
Bill Wendling
1c92468074 If there are no machine instructions emitted for a function, then insert
a "nop" instruction so that we don't have the function's label associated
with something that it's not supposed to be associated with.

llvm-svn: 46394
2008-01-26 06:51:24 +00:00
Duncan Sands
792234c366 Create an explicit copy for byval parameters even
when inlining a readonly function.

llvm-svn: 46393
2008-01-26 06:41:49 +00:00
Bill Wendling
1e56a2ffb6 If we have a function like this:
void bork() {
  int *address = 0;
  *address = 0;
}

It's compiled into LLVM code that looks like this:

define void @bork() noreturn nounwind  {
entry:
        unreachable
}

This is bad on some platforms (like PPC) because it will generate the label for
the function but no body. The label could end up being associated with some
non-code related stuff, like a section. This places a "trap" instruction if the
SimplifyCFG pass removed all code from the function leaving only one
"unreachable" instruction.

llvm-svn: 46387
2008-01-26 01:43:44 +00:00
Devang Patel
c40820e322 Add another testcase.
llvm-svn: 46385
2008-01-26 01:21:48 +00:00
Chris Lattner
53a98f46fd Fix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to
delete a node even if it was not dead in some cases.  Instead, just add it to
the worklist.  Also, make sure to use the CombineTo methods, as it was doing
things that were unsafe: the top level combine loop could touch dangling memory.

This fixes CodeGen/Generic/2008-01-25-dag-combine-mul.ll

llvm-svn: 46384
2008-01-26 01:09:19 +00:00
Chris Lattner
8d8b31d5f4 don't bother making x&-1 only to simplify it in dag combine. This commonly occurs expanding i64 ops.
llvm-svn: 46383
2008-01-26 01:05:42 +00:00
Evan Cheng
e62e9a8d96 New test case.
llvm-svn: 46382
2008-01-26 00:35:43 +00:00
Chris Lattner
6b56f4031f reduce indentation
llvm-svn: 46377
2008-01-25 23:34:24 +00:00
Chris Lattner
c2df169459 add a testcase for a bug Duncan pointed out.
llvm-svn: 46372
2008-01-25 22:36:24 +00:00
Duncan Sands
10316ffbb2 Do this more neatly.
llvm-svn: 46369
2008-01-25 22:06:51 +00:00
Chris Lattner
f2a0e6c176 Reorder a field to reduce the size of StackObject. Note that this
may require a clean rebuild on leopard. :(

llvm-svn: 46360
2008-01-25 17:49:41 +00:00
Duncan Sands
ced29554f7 Test for PR1942.
llvm-svn: 46357
2008-01-25 17:36:44 +00:00
Chris Lattner
8c621a474e fix long lines.
llvm-svn: 46355
2008-01-25 17:24:52 +00:00
Chris Lattner
00ead854ef JITEmitter.cpp was trying to sync the icache for function stubs, but
was actually passing a completely incorrect size to sys_icache_invalidate.
Instead of having the JITEmitter do this (which doesn't have the correct 
size), just make the target sync its own stubs.

llvm-svn: 46354
2008-01-25 16:41:09 +00:00
Duncan Sands
b9f1e3df90 Add more assertions to catch accesses outside of
arrays.  Also, as a convenience, don't barf, just
return false, if someone calls isTruncStoreLegal
or isLoadXLegal with an extended type for the in
memory type.

llvm-svn: 46352
2008-01-25 10:20:53 +00:00
Owen Anderson
a4ff15c69f DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
llvm-svn: 46351
2008-01-25 10:10:33 +00:00
Chris Lattner
93f4f5970c move this field back. Moving the field causes miscompilations (!) of voronoi and others.
llvm-svn: 46350
2008-01-25 07:29:34 +00:00
Chris Lattner
59dc439330 Add skeletal code to increase the alignment of loads and stores when
we can infer it.  This will eventually help stuff, though it doesn't
do much right now because all fixed FI's have an alignment of 1.

llvm-svn: 46349
2008-01-25 07:20:16 +00:00
Chris Lattner
1ce075bcaa move MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
a reference to TargetFrameInfo.  Rearrange order of fields in StackObject to
save a word.

llvm-svn: 46348
2008-01-25 07:19:06 +00:00
Chris Lattner
74d4792eb2 include alignment and volatility information in -view-*-dags output
llvm-svn: 46347
2008-01-25 06:40:45 +00:00
Chris Lattner
72795598b9 add a fixme.
llvm-svn: 46346
2008-01-25 06:20:20 +00:00
Chris Lattner
726a4e45e5 optimize fxor like for
llvm-svn: 46345
2008-01-25 06:14:17 +00:00
Chris Lattner
79076fdf2a Add target-specific dag combines for FAND(x,0) and FOR(x,0). This allows
us to compile:

double test(double X) {
  return copysign(0.0, X);
}

into:

_test:
	andpd	LCPI1_0(%rip), %xmm0
	ret

instead of:
_test:
	pxor	%xmm1, %xmm1
	andpd	LCPI1_0(%rip), %xmm1
	movapd	%xmm0, %xmm2
	andpd	LCPI1_1(%rip), %xmm2
	movapd	%xmm1, %xmm0
	orpd	%xmm2, %xmm0
	ret

llvm-svn: 46344
2008-01-25 05:46:26 +00:00
Anton Korobeynikov
37309ed741 Provide correct DWARF register numbering for debug information emission on x86-32/Darwin.
This should fix bunch of issues.

llvm-svn: 46337
2008-01-25 00:34:13 +00:00
Devang Patel
587591ba1b New test.
llvm-svn: 46333
2008-01-24 23:55:34 +00:00
Chris Lattner
6dfec0fb0e Don't dump the function!
llvm-svn: 46320
2008-01-24 19:28:11 +00:00
Chris Lattner
2c3646ea4a getUnderlyingObject can return null, handle this.
llvm-svn: 46318
2008-01-24 19:07:10 +00:00
Ted Kremenek
274df5b7db Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

llvm-svn: 46316
2008-01-24 18:59:52 +00:00
Chris Lattner
cd5013eb2f Teach basicaa that 'byval' arguments define a new memory location that
can't be aliased to other known objects.  This allows us to know that byval 
pointer args don't alias globals, etc.

llvm-svn: 46315
2008-01-24 18:00:32 +00:00
Chris Lattner
5740a10d2c Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
llvm-svn: 46314
2008-01-24 17:47:11 +00:00
Chris Lattner
81531125a8 clarify a comment, thanks Duncan.
llvm-svn: 46313
2008-01-24 17:10:01 +00:00
Chris Lattner
16a8f126d3 Significantly simplify and improve handling of FP function results on x86-32.
This case returns the value in ST(0) and then has to convert it to an SSE
register.  This causes significant codegen ugliness in some cases.  For 
example in the trivial fp-stack-direct-ret.ll testcase we used to generate:

_bar:
	subl	$28, %esp
	call	L_foo$stub
	fstpl	16(%esp)
	movsd	16(%esp), %xmm0
	movsd	%xmm0, 8(%esp)
	fldl	8(%esp)
	addl	$28, %esp
	ret

because we move the result of foo() into an XMM register, then have to
move it back for the return of bar.

Instead of hacking ever-more special cases into the call result lowering code
we take a much simpler approach: on x86-32, fp return is modeled as always 
returning into an f80 register which is then truncated to f32 or f64 as needed.
Similarly for a result, we model it as an extension to f80 + return.

This exposes the truncate and extensions to the dag combiner, allowing target
independent code to hack on them, eliminating them in this case.  This gives 
us this code for the example above:

_bar:
	subl	$12, %esp
	call	L_foo$stub
	addl	$12, %esp
	ret

The nasty aspect of this is that these conversions are not legal, but we want
the second pass of dag combiner (post-legalize) to be able to hack on them.
To handle this, we lie to legalize and say they are legal, then custom expand
them on entry to the isel pass (PreprocessForFPConvert).  This is gross, but
less gross than the code it is replacing :)

This also allows us to generate better code in several other cases.  For 
example on fp-stack-ret-conv.ll, we now generate:

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstps	8(%esp)
	movl	16(%esp), %eax
	cvtss2sd	8(%esp), %xmm0
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

where before we produced (incidentally, the old bad code is identical to what
gcc produces):

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	cvtsd2ss	(%esp), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	16(%esp), %eax
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

Note that we generate slightly worse code on pr1505b.ll due to a scheduling 
deficiency that is unrelated to this patch.

llvm-svn: 46307
2008-01-24 08:07:48 +00:00
Chris Lattner
866ce96e6b Fix this buggy transformation. Two observations:
1. we already know the value is dead, so don't bother replacing 
   it with undef.
2. The very case the comment describes actually makes the load
   live which asserts in deletenode.  If we do the replacement
   and the node becomes live, just treat it as new.  This fixes
   a failure on X86/2008-01-16-InvalidDAGCombineXform.ll with
   some local changes in my tree.

llvm-svn: 46306
2008-01-24 07:57:06 +00:00
Chris Lattner
bf6550dd56 The dag combiner is missing revisiting nodes that it really should, and thus leaving
dead stuff around.  This gets fed into the isel pass and causes certain foldings from
happening because nodes have extraneous uses floating around.  For example, if we turned
foo(bar(x)) -> baz(x), we sometimes left bar(x) around.

llvm-svn: 46305
2008-01-24 07:18:21 +00:00
Chris Lattner
44e58d7816 fold fp_round(fp_round(x)) -> fp_round(x).
llvm-svn: 46304
2008-01-24 06:45:35 +00:00
Chris Lattner
214c11ee6f take these with a pr #
llvm-svn: 46303
2008-01-24 06:35:44 +00:00
Gordon Henriksen
639468e763 Fixing the stack walker.
llvm-svn: 46302
2008-01-24 05:16:36 +00:00