Bill Wendling
92d8ff0471
Machine LICM will check that operands are defined outside of the loop. Also
...
check that register isn't 0 before going further.
llvm-svn: 45498
2008-01-02 21:10:40 +00:00
Bill Wendling
005b47c20c
Remove dead code.
...
llvm-svn: 45496
2008-01-02 20:47:37 +00:00
Chris Lattner
4a0d9c7836
darwin9 and above support aligned common symbols.
...
llvm-svn: 45494
2008-01-02 19:44:55 +00:00
Chris Lattner
abd12447f8
leopard and above support alignment for common symbols.
...
llvm-svn: 45493
2008-01-02 19:35:16 +00:00
Bill Wendling
5843183ca2
Use the new architecture to get the containing machine basic block for a machine
...
instruction. Also, use "splice" to move the new instruction instead of
remove/insert (where it was leaking memory anyway).
llvm-svn: 45492
2008-01-02 19:32:43 +00:00
Nick Lewycky
ea4de32234
Don't be rude, emit debugging info where asked to.
...
llvm-svn: 45485
2008-01-02 02:49:20 +00:00
Owen Anderson
e6856128ab
Move some more instruction creation methods from RegisterInfo into InstrInfo.
...
llvm-svn: 45484
2008-01-01 21:11:32 +00:00
Chris Lattner
fc976a38ff
Make MachineRegisterInfo::getVRegDef more efficient by aiming the keep the def of the vreg at the start of the list, so the list doesn't need to be traversed.
...
llvm-svn: 45483
2008-01-01 21:08:22 +00:00
Chris Lattner
490a9681cb
switch the register iterator to act more like hte LLVM value iterator: dereferencing
...
it now returns the machineinstr of the use. To get the operand, use I.getOperand().
Add a new MachineRegisterInfo::replaceRegWith, which is basically like
Value::replaceAllUsesWith.
llvm-svn: 45482
2008-01-01 20:36:19 +00:00
Gordon Henriksen
d2485b2cec
Adding C bindings for SwitchInst::addCase.
...
Patch by Bryan O'Sullivan!
llvm-svn: 45481
2008-01-01 05:50:53 +00:00
Chris Lattner
7091807c2d
Add a trivial but handy function to efficiently return the machine
...
instruction that defines the specified vreg. Crazy.
llvm-svn: 45480
2008-01-01 03:07:29 +00:00
Chris Lattner
39b56ec51b
Implement automatically updated def/use lists for all MachineInstr register
...
operands. The lists are currently kept in MachineRegisterInfo, but it does
not yet provide an iterator interface to them.
llvm-svn: 45477
2008-01-01 01:12:31 +00:00
Chris Lattner
04a35e9a8c
Fix a bug in my previous patch: refer to the impl not the pure virtual version. It's unclear why gcc would ever compile this...
...
llvm-svn: 45476
2008-01-01 01:05:34 +00:00
Chris Lattner
1285ec2ae7
Fix a problem where lib/Target/TargetInstrInfo.h would include and use
...
a header file from libcodegen. This violates a layering order: codegen
depends on target, not the other way around. The fix to this is to
split TII into two classes, TII and TargetInstrInfoImpl, which defines
stuff that depends on libcodegen. It is defined in libcodegen, where
the base is not.
llvm-svn: 45475
2008-01-01 01:03:04 +00:00
Duncan Sands
8a4882564a
Fix PR1833 - eh.exception and eh.selector return two
...
values, which means doing extra legalization work.
It would be easier to get this kind of thing right if
there was some documentation...
llvm-svn: 45472
2007-12-31 18:35:50 +00:00
Owen Anderson
ae7e2c1e03
Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
...
Machine-level API cleanup instigated by Chris.
llvm-svn: 45470
2007-12-31 06:32:00 +00:00
Chris Lattner
d8b7ecd871
properly encapsulate the parent field of MBB and MI with get/set accessors.
...
llvm-svn: 45469
2007-12-31 04:56:33 +00:00
Chris Lattner
de54e62962
update a couple of references to SSARegMap.
...
llvm-svn: 45468
2007-12-31 04:16:08 +00:00
Chris Lattner
96167aa93c
Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
...
that "machine" classes are used to represent the current state of
the code being compiled. Given this expanded name, we can start
moving other stuff into it. For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.
Update all the clients to match.
This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.
llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Chris Lattner
9e5cc35593
Add new shorter predicates for testing machine operands for various types:
...
e.g. MO.isMBB() instead of MO.isMachineBasicBlock(). I don't plan on
switching everything over, so new clients should just start using the
shorter names.
Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(),
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.
llvm-svn: 45464
2007-12-30 23:10:15 +00:00
Chris Lattner
7504adbd72
More cleanups for MachineOperand:
...
- Eliminate the static "print" method for operands, moving it
into MachineOperand::print.
- Change various set* methods for register flags to take a bool
for the value to set it to. Remove unset* methods.
- Group methods more logically by operand flavor in MachineOperand.h
llvm-svn: 45461
2007-12-30 21:56:09 +00:00
Chris Lattner
7d47b6c164
MachineOperand:
...
- Add getParent() accessors.
- Move SubReg out of the AuxInfo union, to make way for future changes.
- Remove the getImmedValue/setImmedValue methods.
- in some MachineOperand::Create* methods, stop initializing fields that are dead.
MachineInstr:
- Delete one copy of the MachineInstr printing code, now there is only one dump
format and one copy of the code.
- Make MachineOperand use the parent field to get info about preg register names if
no target info is otherwise available.
- Move def/use/kill/dead flag printing to the machineoperand printer, so they are
always printed for an operand.
llvm-svn: 45460
2007-12-30 21:31:53 +00:00
Chris Lattner
f3f074dfdd
fix typo duncan noticed!
...
llvm-svn: 45459
2007-12-30 21:21:10 +00:00
Chris Lattner
31932a7542
simpilfy some register printing code.
...
llvm-svn: 45458
2007-12-30 21:08:36 +00:00
Chris Lattner
46e4658c95
eliminate a copy of the machineoperand printing stuff. Keep the copy that
...
knows how to print offsets.
llvm-svn: 45457
2007-12-30 21:03:30 +00:00
Chris Lattner
ff61fe680e
Simplify and clean up some machine operand/instr printing/dumping stuff.
...
llvm-svn: 45456
2007-12-30 21:01:27 +00:00
Chris Lattner
98c3fabf47
two register machineoperands are not identical unless their subregs match.
...
llvm-svn: 45455
2007-12-30 20:55:08 +00:00
Chris Lattner
4a4943a78f
MachineOperand::getImmedValue -> MachineOperand::getImm
...
llvm-svn: 45454
2007-12-30 20:50:28 +00:00
Chris Lattner
12477d46b4
Use MachineOperand::getImm instead of MachineOperand::getImmedValue. Likewise setImmedValue -> setImm
...
llvm-svn: 45453
2007-12-30 20:49:49 +00:00
Gordon Henriksen
8082358f86
Add some doxygen comments to llvm-c/Core.h.
...
llvm-svn: 45450
2007-12-30 17:46:33 +00:00
Chris Lattner
d6051f028d
make machine operands fatter: give each one an up-pointer to the
...
machineinstr that owns it.
llvm-svn: 45449
2007-12-30 06:11:04 +00:00
Bill Wendling
4c22e299ef
If we have a load of a global address that's not modified during the
...
function, then go ahead and hoist it out of the loop. This is the result:
$ cat a.c
volatile int G;
int A(int N) {
for (; N > 0; --N)
G++;
}
$ llc -o - -relocation-model=pic
_A:
...
LBB1_2: # bb
movl L_G$non_lazy_ptr-"L1$pb"(%eax), %esi
incl (%esi)
incl %edx
cmpl %ecx, %edx
jne LBB1_2 # bb
...
$ llc -o - -relocation-model=pic -machine-licm
_A:
...
movl L_G$non_lazy_ptr-"L1$pb"(%eax), %eax
LBB1_2: # bb
incl (%eax)
incl %edx
cmpl %ecx, %edx
jne LBB1_2 # bb
...
I'm limiting this to the MOV32rm x86 instruction for now.
llvm-svn: 45444
2007-12-30 03:18:58 +00:00
Chris Lattner
fac8748ca7
use simplified operand addition methods.
...
llvm-svn: 45437
2007-12-30 01:01:54 +00:00
Chris Lattner
c2f0543beb
use simplified operand addition methods.
...
llvm-svn: 45436
2007-12-30 00:57:42 +00:00
Chris Lattner
1b0ad80f53
use simplified operand addition methods.
...
llvm-svn: 45435
2007-12-30 00:51:11 +00:00
Chris Lattner
4d0361fbf2
Shrinkify the machine operand creation method names.
...
llvm-svn: 45433
2007-12-30 00:45:46 +00:00
Chris Lattner
19dd6c4eac
Start using the simplified methods for adding operands.
...
llvm-svn: 45432
2007-12-30 00:41:17 +00:00
Chris Lattner
e868c77f16
simplify some code by factoring operand construction better.
...
llvm-svn: 45428
2007-12-30 00:12:25 +00:00
Chris Lattner
ad9a6ccb83
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
8193d4af33
remove attribution from lib Makefiles.
...
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Chris Lattner
d82b30a996
this is done.
...
llvm-svn: 45408
2007-12-29 19:38:02 +00:00
Chris Lattner
d55e743cfe
One readme entry is done, one is really easy (Evan, want to investigate
...
eliminating the llvm.x86.sse2.loadl.pd intrinsic?), one shuffle optzn
may be done (if shufps is better than pinsw, Evan, please review), and
we already know about LICM of simple instructions.
llvm-svn: 45407
2007-12-29 19:31:47 +00:00
Chris Lattner
cd147e5596
Fold comparisons against a constant nan, and optimize ORD/UNORD
...
comparisons with a constant. This allows us to compile isnan to:
_foo:
fcmpu cr7, f1, f1
mfcr r2
rlwinm r3, r2, 0, 31, 31
blr
instead of:
LCPI1_0: ; float
.space 4
_foo:
lis r2, ha16(LCPI1_0)
lfs f0, lo16(LCPI1_0)(r2)
fcmpu cr7, f1, f0
mfcr r2
rlwinm r3, r2, 0, 31, 31
blr
llvm-svn: 45405
2007-12-29 08:37:08 +00:00
Chris Lattner
b36a4a7a84
this xform is implemented.
...
llvm-svn: 45404
2007-12-29 08:19:39 +00:00
Christopher Lamb
dfad5f19b4
Disable null pointer folding transforms for non-generic address spaces. This should probably be a target-specific predicate based on address space. That way for targets where this isn't applicable the predicate can be optimized away.
...
llvm-svn: 45403
2007-12-29 07:56:53 +00:00
Chris Lattner
38687aa2b2
make sure not to zap volatile stores, thanks a lot to Dale for noticing this!
...
llvm-svn: 45402
2007-12-29 07:15:45 +00:00
Chris Lattner
f8e408b7b1
Codegen:
...
as:
_bar:
pushl %esi
subl $8, %esp
movl 16(%esp), %esi
call L_foo$stub
fstps (%esi)
addl $8, %esp
popl %esi
#FP_REG_KILL
ret
instead of:
_bar:
pushl %esi
subl $8, %esp
movl 16(%esp), %esi
call L_foo$stub
fstpl (%esi)
cvtsd2ss (%esi), %xmm0
movss %xmm0, (%esi)
addl $8, %esp
popl %esi
#FP_REG_KILL
ret
llvm-svn: 45401
2007-12-29 06:57:38 +00:00
Chris Lattner
78ae7ff876
don't fold fp_round(fp_extend(load)) -> fp_round(extload)
...
llvm-svn: 45400
2007-12-29 06:55:23 +00:00
Chris Lattner
e3515220d2
avoid going through a stack slot to convert from fpstack to xmm reg
...
if we are just going to store it back anyway. This improves things
like:
double foo();
void bar(double *P) { *P = foo(); }
llvm-svn: 45399
2007-12-29 06:41:28 +00:00
Chris Lattner
7cb2de8e48
Delete a store whose input is a load from the same pointer:
...
x = load p
store x -> p
llvm-svn: 45398
2007-12-29 06:26:16 +00:00
Chris Lattner
ac72965e02
add a note
...
llvm-svn: 45397
2007-12-29 05:51:58 +00:00
Chris Lattner
78c7878ca4
expand note.
...
llvm-svn: 45393
2007-12-29 01:05:01 +00:00
Chris Lattner
2369d2f4ab
dead calls to llvm.stacksave can be deleted, even though they
...
have potential side-effects.
llvm-svn: 45392
2007-12-29 00:59:12 +00:00
Chris Lattner
b8e060f7a6
add a note.
...
llvm-svn: 45388
2007-12-28 22:30:05 +00:00
Chris Lattner
2248a22bda
add a note.
...
llvm-svn: 45387
2007-12-28 21:50:40 +00:00
Owen Anderson
ebd3e9c500
Repair a transform that Chris noticed a bug in. Thanks to Nicholas for pointing out my stupid mistakes when writing this patch. :-)
...
llvm-svn: 45384
2007-12-28 07:42:12 +00:00
Chris Lattner
2456399ce5
disable this instcombine xform, it miscompiles:
...
define i32 @main() {
entry:
%z = alloca i32 ; <i32*> [#uses=2]
store i32 0, i32* %z
%tmp = load i32* %z ; <i32> [#uses=1]
%sub = sub i32 %tmp, 1 ; <i32> [#uses=1]
%cmp = icmp ult i32 %sub, 0 ; <i1> [#uses=1]
%retval = select i1 %cmp, i32 1, i32 0 ; <i32> [#uses=1]
ret i32 %retval
}
into ret 1, instead of ret 0.
Christopher, please investigate.
llvm-svn: 45383
2007-12-28 06:24:31 +00:00
Chris Lattner
e53df84267
add a note
...
llvm-svn: 45377
2007-12-28 04:42:05 +00:00
Anton Korobeynikov
f12327cd32
Ignore functions with internal linkages during linking. This snipped mimics the
...
behaviour of LinkGlobals() function.
llvm-svn: 45375
2007-12-27 23:21:57 +00:00
Gordon Henriksen
86e98275ff
Adding bindings for target triple and data layout.
...
llvm-svn: 45369
2007-12-27 20:13:47 +00:00
Gordon Henriksen
d96b3222e5
Switch the bindings to use LLVMFoldingBuilder.
...
llvm-svn: 45367
2007-12-27 18:25:59 +00:00
Gordon Henriksen
90d48b077d
Fixing several transforms which would drop the collector attribute
...
when copying functions.
llvm-svn: 45356
2007-12-25 22:16:06 +00:00
Chris Lattner
90df7f7424
Don't break critical edges for single-bb loops, this helps with PR1877, though
...
it is only a partial fix. This change is noise for most programs, but
speeds up Shootout-C++/matrix by 20%, Ptrdist/ks by 24%, smg2000 by 8%,
hexxagon by 9%, bzip2 by 9% (not sure I trust this), ackerman by 13%, etc.
OTOH, it slows down Shootout/fib2 by 40% (I'll update PR1877 with this info).
llvm-svn: 45354
2007-12-25 19:06:45 +00:00
Gordon Henriksen
c0a3899bbf
GC poses hazards to the inliner. Consider:
...
define void @f() {
...
call i32 @g()
...
}
define void @g() {
...
}
The hazards are:
- @f and @g have GC, but they differ GC. Inlining is invalid. This
may never occur.
- @f has no GC, but @g does. g's GC must be propagated to @f.
The other scenarios are safe:
- @f and @g have the same GC.
- @f and @g have no GC.
- @g has no GC.
This patch adds inliner checks for the former two scenarios.
llvm-svn: 45351
2007-12-25 03:10:07 +00:00
Gordon Henriksen
a9f4ed4070
Noting and enforcing that GC intrinsics are valid only within a
...
function with GC.
This will catch the error when the inliner inlines a function with
GC into a caller with no GC.
llvm-svn: 45350
2007-12-25 02:31:26 +00:00
Gordon Henriksen
44841db057
Adjusting verification of "llvm.gc*" intrinsic prototypes to match
...
LangRef.
llvm-svn: 45349
2007-12-25 02:02:10 +00:00
Owen Anderson
1064e276a9
Flesh out the Briggs implementation a little bit more, fix a few FIXMEs.
...
llvm-svn: 45347
2007-12-24 22:12:23 +00:00
Chris Lattner
7e1e1f2933
add a -backedge-hack llc-beta option to codegenprepare.
...
When specified, don't split backedges of single-bb loops.
This helps address PR1877
llvm-svn: 45344
2007-12-24 19:32:55 +00:00
Chris Lattner
232e097cff
add a simple hack
...
llvm-svn: 45343
2007-12-24 19:27:46 +00:00
Anton Korobeynikov
a0113f6c70
Cygwin defines uint32_t as unsigned long. Unbreak call to std::min in this case
...
llvm-svn: 45342
2007-12-24 11:16:47 +00:00
Gordon Henriksen
3e409a37ac
Setting GlobalDirective in TargetAsmInfo by default rather than
...
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.
llvm-svn: 45338
2007-12-23 20:58:16 +00:00
Gordon Henriksen
606ac32019
C and Ocaml bindings for ExecutionEngine (i.e., the JIT compiler).
...
llvm-svn: 45335
2007-12-23 16:59:28 +00:00
Owen Anderson
e9538b78ce
Sketch out an implementation of Briggs' copy placement algorithm.
...
llvm-svn: 45334
2007-12-23 15:37:26 +00:00
Chris Lattner
a2156b160a
fix some warnings. This code needs to be de-tabified :(
...
llvm-svn: 45325
2007-12-22 22:47:03 +00:00
Chris Lattner
1c6a1f71cb
fix strict-aliasing violation
...
llvm-svn: 45324
2007-12-22 22:45:38 +00:00
Chris Lattner
084002dcb0
initial code for forming an FGETSIGN node. This is disabled until
...
legalizer support goes in.
llvm-svn: 45323
2007-12-22 21:35:38 +00:00
Chris Lattner
24b2a6de5c
improve support for fgetsign
...
llvm-svn: 45322
2007-12-22 21:26:52 +00:00
Chris Lattner
a8f6fac7a3
Tell TargetLoweringOpt whether it is running before
...
or after legalize.
llvm-svn: 45321
2007-12-22 20:56:36 +00:00
Chris Lattner
f2aa80e0de
Add a new FGETSIGN operation, which defaults to expand on all
...
targets.
llvm-svn: 45320
2007-12-22 20:47:56 +00:00
Anton Korobeynikov
4275f59e61
Erm, really disable :)
...
llvm-svn: 45319
2007-12-22 20:46:24 +00:00
Anton Korobeynikov
9f148a1a2a
Disable, until we'll really need it
...
llvm-svn: 45318
2007-12-22 20:41:12 +00:00
Gordon Henriksen
fccde96a4c
Use getIntrinsicID instead of looking up intrinsic prototypes. Also
...
fixes a bug with indirect calls. (Test case will be included with
ocaml collector patch.)
llvm-svn: 45316
2007-12-22 17:27:01 +00:00
Anton Korobeynikov
07c828b637
Unbreak mingw build
...
llvm-svn: 45314
2007-12-22 14:26:49 +00:00
Evan Cheng
c226a1a7d3
Preliminary PIC JIT support for X86 (32-bit) / Darwin.
...
llvm-svn: 45313
2007-12-22 09:40:20 +00:00
Evan Cheng
5b05d625cd
Oops.
...
llvm-svn: 45312
2007-12-22 09:14:34 +00:00
Chris Lattner
d64df490ca
implement InstCombine/shift-trunc-shift.ll. This allows
...
us to compile:
#include <math.h>
int t1(double d) { return signbit(d); }
into:
_t1:
movd %xmm0, %rax
shrq $63, %rax
ret
instead of:
_t1:
movd %xmm0, %rax
shrq $32, %rax
shrl $31, %eax
ret
on x86-64.
llvm-svn: 45311
2007-12-22 09:07:47 +00:00
Owen Anderson
3fc4fdaa1f
Note what still needs doing.
...
llvm-svn: 45310
2007-12-22 04:59:10 +00:00
Owen Anderson
f3765d08f8
Remove critical edge breaking. It won't be necessary as long as we are very careful when inserting copies.
...
llvm-svn: 45309
2007-12-22 04:50:11 +00:00
Evan Cheng
8f4ec948d3
Fix JIT code emission of X86::MovePCtoStack.
...
llvm-svn: 45307
2007-12-22 02:26:46 +00:00
Devang Patel
e035f776e9
If succ has succ itself as one of the predecessors then do
...
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.
llvm-svn: 45305
2007-12-22 01:32:53 +00:00
Evan Cheng
51f51c7572
Allow JIT with non-static relocation model.
...
llvm-svn: 45304
2007-12-22 01:12:14 +00:00
Anton Korobeynikov
913c80d37f
Fix silly typo in the FP CEP handling.
...
llvm-svn: 45300
2007-12-21 23:33:44 +00:00
Duncan Sands
99690fb26c
Fix a brain fart by our beloved leader (the content
...
of this patch is the last line).
llvm-svn: 45289
2007-12-21 20:18:41 +00:00
Duncan Sands
bc10247769
Get the verifier to check attributes on calls as well
...
as on functions. Make it verify invokes and not just
ordinary calls. As a (desired) side-effect, it is no
longer legal to have call attributes on arguments that
are being passed to the varargs part of a varargs
function (llvm-as drops them on the floor anyway).
llvm-svn: 45286
2007-12-21 19:19:01 +00:00
Duncan Sands
85ca85c070
Make DAE not wipe out attributes on calls, and not drop
...
return attributes on the floor. In the case of a call
to a varargs function where the varargs arguments are
being removed, any call attributes on those arguments
need to be dropped. I didn't do this because I plan to
make it illegal to have such attributes (see next patch).
With this change, compiling the gcc filter2 eh test at -O0
and then running opt -std-compile-opts on it results in
a correctly working program (compiling at -O1 or higher
results in the test failing due to a problem with how we
output eh info into the IR).
llvm-svn: 45285
2007-12-21 19:16:16 +00:00
Nicolas Geoffray
1996d8b1f4
Fix unintented change from last commit
...
llvm-svn: 45282
2007-12-21 12:22:29 +00:00
Nicolas Geoffray
18ab237446
Enable EH for linux/ppc32 targets
...
llvm-svn: 45281
2007-12-21 12:19:44 +00:00
Evan Cheng
a111629401
New entry.
...
llvm-svn: 45280
2007-12-21 01:31:58 +00:00
Evan Cheng
eba18a1952
Fix JIT encoding for CMPSD as well.
...
llvm-svn: 45268
2007-12-20 19:57:09 +00:00
Evan Cheng
8fee10d116
More accurate checks for two-address constraints.
...
llvm-svn: 45259
2007-12-20 09:25:31 +00:00