Commit Graph

27720 Commits

Author SHA1 Message Date
Bill Wendling fc9063e9cd Replace DEBUG(std::cerr with DOUT. Removed some iostream #includes.
llvm-svn: 31811
2006-11-17 07:33:59 +00:00
Bill Wendling 3216551491 Removed unneeded <iostream> #include.
llvm-svn: 31810
2006-11-17 07:10:51 +00:00
Chris Lattner 21eba2da26 If an indvar with a variable stride is used by the exit condition, go ahead
and handle it like constant stride vars.  This fixes some bad codegen in
variable stride cases.  For example, it compiles this:

void foo(int k, int i) {
  for (k=i+i; k <= 8192; k+=i)
    flags2[k] = 0;
}

to:

LBB1_1: #bb.preheader
        movl %eax, %ecx
        addl %ecx, %ecx
        movl L_flags2$non_lazy_ptr, %edx
LBB1_2: #bb
        movb $0, (%edx,%ecx)
        addl %eax, %ecx
        cmpl $8192, %ecx
        jle LBB1_2      #bb
LBB1_5: #return
        ret

or (if the array is local and we are in dynamic-nonpic or static mode):

LBB3_2: #bb
        movb $0, _flags2(%ecx)
        addl %eax, %ecx
        cmpl $8192, %ecx
        jle LBB3_2      #bb

and:

        lis r2, ha16(L_flags2$non_lazy_ptr)
        lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
        slwi r3, r4, 1
LBB1_2: ;bb
        li r5, 0
        add r6, r4, r3
        stbx r5, r2, r3
        cmpwi cr0, r6, 8192
        bgt cr0, LBB1_5 ;return

instead of:

        leal (%eax,%eax,2), %ecx
        movl %eax, %edx
        addl %edx, %edx
        addl L_flags2$non_lazy_ptr, %edx
        xorl %esi, %esi
LBB1_2: #bb
        movb $0, (%edx,%esi)
        movl %eax, %edi
        addl %esi, %edi
        addl %ecx, %esi
        cmpl $8192, %esi
        jg LBB1_5       #return

and:

        lis r2, ha16(L_flags2$non_lazy_ptr)
        lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
        mulli r3, r4, 3
        slwi r5, r4, 1
        li r6, 0
        add r2, r2, r5
LBB1_2: ;bb
        li r5, 0
        add r7, r3, r6
        stbx r5, r2, r6
        add r6, r4, r6
        cmpwi cr0, r7, 8192
        ble cr0, LBB1_2 ;bb

This speeds up Benchmarks/Shootout/sieve from 8.533s to 6.464s and
implements LoopStrengthReduce/var_stride_used_by_compare.ll

llvm-svn: 31809
2006-11-17 06:17:33 +00:00
Chris Lattner 0727eeaeac New testcase.
llvm-svn: 31808
2006-11-17 06:09:49 +00:00
Reid Spencer 4b8067f37b Undo removal of the runtime libraries. While this may have been a bit
premature, these libraries will be going away for the 2.0 release. Other
arrangements for profiling, gc, etc. should be made in the next few months.

llvm-svn: 31807
2006-11-17 03:32:33 +00:00
Bill Wendling 9d46fcd59c More removal of std::cerr and DEBUG, replacing with DOUT instead.
llvm-svn: 31806
2006-11-17 02:09:07 +00:00
Chris Lattner 3b7261b18e implement a todo: change a map into a vector
llvm-svn: 31805
2006-11-17 01:52:23 +00:00
Evan Cheng 71adba6dce Add opcode to TargetInstrDescriptor.
llvm-svn: 31804
2006-11-17 01:46:27 +00:00
Bill Wendling ca6f6a43e0 #ifndef NDEBUG the "if (Stream) ..." stuff.
llvm-svn: 31803
2006-11-17 01:43:48 +00:00
Evan Cheng 84dd67e08a Add opcode to TargetInstrDescriptor.
llvm-svn: 31802
2006-11-17 01:36:01 +00:00
Bill Wendling fc01016c75 Adjusted the // comments so that doxygen picks them up.
llvm-svn: 31801
2006-11-17 01:13:12 +00:00
Bill Wendling d108b9a60d Replace std::cerr uses of the "DEBUG" macro with "DOUT" instead. Removes
a #include of iostream.

llvm-svn: 31800
2006-11-17 00:50:36 +00:00
Chris Lattner be1a4d80b3 fix typo
llvm-svn: 31799
2006-11-17 00:49:36 +00:00
Bill Wendling d7fda04420 Added "DOUT" macro. This is used as a replacement for the std::cerr
stream. It centralizes the use of std::cerr so that static c'tor/d'tors
aren't scattered around all over the place. The way to use it is like this:

       DOUT << "This is a status line: " << Var << "\n";

If "-debug" is specified, it will print. Otherwise, it'll not print. If
NDEBUG is defined, the DOUT does nothing.

llvm-svn: 31798
2006-11-17 00:49:12 +00:00
Chris Lattner a715288b40 implicit_def_vrrc doesn't generate code.
llvm-svn: 31797
2006-11-16 23:49:52 +00:00
Evan Cheng 538e9cafae New test case.
llvm-svn: 31796
2006-11-16 23:38:21 +00:00
Evan Cheng 572dc9cb4e Correct instructions for moving data between GR64 and SSE registers; also correct load i64 / store i64 from v2i64.
llvm-svn: 31795
2006-11-16 23:33:25 +00:00
Evan Cheng 7ae482c52a Fix a potential bug: MOVPDI2DI, etc. are not copy instructions.
llvm-svn: 31794
2006-11-16 23:22:26 +00:00
Reid Spencer 3f97d03f86 In LLVM 2.0 we won't use the runtime libraries as llvm-gcc3 support will
be dropped. This patch pertains to removing the runtime directory from LLVM.

llvm-svn: 31793
2006-11-16 23:17:27 +00:00
Jim Laskey 48850c10c0 This is a general clean up of the PowerPC ABI. Address several problems and
bugs including making sure that the TOS links back to the previous frame,
that the maximum call frame size is not included twice when using frame
pointers, no longer growing the frame on calls, double storing of SP and
a cleaner/faster dynamic alloca.

llvm-svn: 31792
2006-11-16 22:43:37 +00:00
Chris Lattner 30055b9208 fix a regression that I introduced. stdu should scale the offset by 4
before printing it.

llvm-svn: 31791
2006-11-16 21:45:30 +00:00
Evan Cheng c5e769710e Align stubs on 4 byte boundary. This fixes 447.dealII.
llvm-svn: 31790
2006-11-16 20:13:34 +00:00
Bill Wendling 8969ebca44 *** empty log message ***
llvm-svn: 31789
2006-11-16 20:11:33 +00:00
Evan Cheng e03ca9b0b4 Allow target to specify alignment for function stub.
llvm-svn: 31788
2006-11-16 20:04:54 +00:00
Evan Cheng 9fd73b8a7f Match MachineCodeEmitter changes.
llvm-svn: 31787
2006-11-16 20:04:04 +00:00
Reid Spencer b3030c42e0 Use a release version of bugpoint, if found. Include gccld passes.
llvm-svn: 31786
2006-11-16 18:32:47 +00:00
Chris Lattner 96d7386006 add a statistic
llvm-svn: 31785
2006-11-16 18:13:49 +00:00
Bill Wendling ae2a3097e6 Cleaned up the document. Added "doc_code" divisions for code examples.
llvm-svn: 31784
2006-11-16 09:31:19 +00:00
Bill Wendling d811cc6818 Don't recompute getNumOperands for each iteration.
llvm-svn: 31783
2006-11-16 07:35:18 +00:00
Bill Wendling cc9816c87b Added "removeRange", which takes and removes an entire LiveRange.
llvm-svn: 31781
2006-11-16 02:43:32 +00:00
Bill Wendling c7969fd1e7 Added a new method "CreateNewLiveInterval" which, given a list of
LiveRanges, creates a new LiveInterval from them. The LiveRanges should
have existed already in another LiveInterval, but removed.

llvm-svn: 31780
2006-11-16 02:41:50 +00:00
Chris Lattner 2ccd16c0af make this harder
llvm-svn: 31779
2006-11-16 01:22:52 +00:00
Chris Lattner a7ff5162b0 fix broken encoding
llvm-svn: 31778
2006-11-16 01:01:28 +00:00
Chris Lattner e0a70388c2 enable the branch folding pass for the JIT.
llvm-svn: 31777
2006-11-16 01:00:07 +00:00
Chris Lattner e742d9a4b7 add ppc64 r+i stores with update.
llvm-svn: 31776
2006-11-16 00:57:19 +00:00
Chris Lattner 6f5840c409 add patterns for ppc32 preinc stores. ppc64 next.
llvm-svn: 31775
2006-11-16 00:41:37 +00:00
Chris Lattner 3a494989a6 switch these back to the 'bad old way'
llvm-svn: 31774
2006-11-16 00:33:34 +00:00
Evan Cheng f64da389f8 Fix an incorrectly inverted condition.
llvm-svn: 31773
2006-11-16 00:08:20 +00:00
Evan Cheng 8ae58b5828 ChangeToRegister should clear IsImp bit.
llvm-svn: 31772
2006-11-15 23:55:03 +00:00
Chris Lattner b4e911d15a Fix ppc64 epilog bug.
llvm-svn: 31771
2006-11-15 23:35:30 +00:00
Chris Lattner 5771156be0 Stop using isTwoAddress, switching to operand constraints instead.
Tell the codegen emitter that specific operands are not to be encoded, fixing
JIT regressions w.r.t. pre-inc loads and stores (e.g. lwzu, which we generate
even when general preinc loads are not enabled).

llvm-svn: 31770
2006-11-15 23:24:18 +00:00
Chris Lattner 78a403f90e Remove the isTwoAddress property from the CodeGenInstruction class. It should
not be used for anything other than backwards compat constraint handling.

Add support for a new DisableEncoding property which contains a list of
registers that should not be encoded by the generated code emitter.  Convert
the codeemitter generator to use this, fixing some PPC JIT regressions.

llvm-svn: 31769
2006-11-15 23:23:02 +00:00
Chris Lattner 5c23899c7d add a new field needed by the code emitter generator.
llvm-svn: 31768
2006-11-15 22:55:04 +00:00
Chris Lattner 7cab3de0da Fix typo pointed out by Bryan Adams
llvm-svn: 31766
2006-11-15 21:04:15 +00:00
Evan Cheng dc2c8748a7 Properly transfer kill / dead info.
llvm-svn: 31765
2006-11-15 20:58:11 +00:00
Evan Cheng bbbcac39e6 Kill / dead info has been moved to MI's.
llvm-svn: 31764
2006-11-15 20:56:39 +00:00
Evan Cheng c57819d4a3 commuteInstruction should propagate kill / dead info.
llvm-svn: 31763
2006-11-15 20:56:03 +00:00
Evan Cheng 0ffff1c629 Match live variable changes.
llvm-svn: 31762
2006-11-15 20:55:15 +00:00
Evan Cheng ebb0357b4c Minor updates.
llvm-svn: 31761
2006-11-15 20:54:29 +00:00
Evan Cheng 12ea213de9 A register def can be partially dead when the whole register has use(s) but a subreg does not.
llvm-svn: 31760
2006-11-15 20:54:11 +00:00
Evan Cheng 70ec52896e Do away with kill / dead maps. Move kill / dead info onto MI's.
llvm-svn: 31759
2006-11-15 20:51:59 +00:00
Evan Cheng 5b536a0be9 Add copyKillDeadInfo to copy kill / dead info; other minor updates.
llvm-svn: 31758
2006-11-15 20:48:17 +00:00
Chris Lattner 474b5b7c95 fix ldu/stu jit encoding. Swith 64-bit preinc load instrs to use memri
addrmodes.

llvm-svn: 31757
2006-11-15 19:55:13 +00:00
Devang Patel 9f3083eef0 Add run(Function &F) support in FunctionPassManager_New
llvm-svn: 31756
2006-11-15 19:39:54 +00:00
Chris Lattner 2775aba51d Simplify IntrinsicLowering and clarify that it is only for use by the
CBE and interpreter.

llvm-svn: 31755
2006-11-15 18:00:10 +00:00
Chris Lattner 60c2a0154a Remove unneeded forward decls
llvm-svn: 31754
2006-11-15 17:53:13 +00:00
Chris Lattner 30d08801ef remove dead #include
llvm-svn: 31753
2006-11-15 17:51:15 +00:00
Chris Lattner 0e117c7e9d Fix the PPC regressions last night
llvm-svn: 31752
2006-11-15 17:40:51 +00:00
Chris Lattner e3a63d136d Fix a gcc 4.2 warning.
llvm-svn: 31751
2006-11-15 04:53:24 +00:00
Reid Spencer 8f73ba7e05 Add a method to get the bit width of a packed type.
llvm-svn: 31750
2006-11-15 03:02:41 +00:00
Chris Lattner 1396961e85 Switch loads over to use memri as the operand instead of a reg/imm operand
pair for cleanliness.  Add instructions for PPC32 preinc-stores with commented
out patterns.  More improvement is needed to enable the patterns, but we're
getting close.

llvm-svn: 31749
2006-11-15 02:43:19 +00:00
Chris Lattner c94f214d22 ADd support for adding constraints to suboperands
llvm-svn: 31748
2006-11-15 02:38:17 +00:00
Devang Patel af87fa3a63 Add doInitialization and doFinalization support in FunctionManager_New.
llvm-svn: 31747
2006-11-15 02:07:25 +00:00
Devang Patel 4a3fa4ff26 Tidy up marking of last analysis user pass.
llvm-svn: 31746
2006-11-15 01:48:14 +00:00
Devang Patel ff631ae600 Add doInitialization and doFinalization support in FunctionManager_New.
llvm-svn: 31745
2006-11-15 01:27:05 +00:00
Devang Patel 42add710fa Do not derive CommonPassManagerImpl from Pass.
Now BasicBlockPassManager_New is a FunctionPass,
FunctionPassManager_New is a ModulePass

llvm-svn: 31744
2006-11-15 01:11:27 +00:00
Chris Lattner c75081b7a8 restore some 'magic' code that I removed: it is needed. Add comments explaining
why.

llvm-svn: 31743
2006-11-14 22:17:10 +00:00
Chris Lattner c5dd5b11a4 minimal hack to get patterns whose result type is iPTR to be selected.
llvm-svn: 31742
2006-11-14 21:50:27 +00:00
Devang Patel 07f4f58945 Copy initializeAnalysisImpl() implementation from PassManagerT.
Update LastUser to recursively walk required transitive set.

llvm-svn: 31741
2006-11-14 21:49:36 +00:00
Chris Lattner 75165d07a0 remove some dead code
llvm-svn: 31740
2006-11-14 21:41:35 +00:00
Chris Lattner 7c9f48cefb Add support for nodes that return iPTR.
llvm-svn: 31739
2006-11-14 21:32:01 +00:00
Chris Lattner 110c777f2c changes to get ptr_rc to be accepted in patterns. This is needed for ppc preinc
stores.

llvm-svn: 31738
2006-11-14 21:18:40 +00:00
Evan Cheng cf772f7eca Revert. This wasn't meant to be checked in.
llvm-svn: 31737
2006-11-14 19:20:33 +00:00
Chris Lattner e79a451475 group load and store instructions together. No functionality change.
llvm-svn: 31736
2006-11-14 19:19:53 +00:00
Chris Lattner 58e8bed48e Fix predicates for unindexed stores so they don't accidentally match indexed
stores.

llvm-svn: 31735
2006-11-14 19:13:39 +00:00
Chris Lattner 44dbdbe5cf Rework PPC64 calls. Now we have a LR8/CTR8 register which the PPC64 calls
clobber.  This allows LR8 to be save/restored correctly as a 64-bit quantity,
instead of handling it as a 32-bit quantity.  This unbreaks ppc64 codegen when
the code is actually located above the 4G boundary.

llvm-svn: 31734
2006-11-14 18:44:47 +00:00
Chris Lattner b542925b22 remove a ton of custom selection logic no longer needed
llvm-svn: 31733
2006-11-14 18:43:11 +00:00
Chris Lattner f8c06b335d Fix a bug handling nodes with variable arguments. The code was fixed to assume
that there were two input operands before the variable operand portion.  This
*happened* to be true for all call instructions, which took a chain and a
destination, but was not true for the PPC BCTRL instruction, whose destination
is implicit.

Making this code more general allows elimination of the custom selection logic
for BCTRL.

llvm-svn: 31732
2006-11-14 18:41:38 +00:00
Chris Lattner 4916acbd0f it would be nice of ctlz were lowered to bsf etc.
llvm-svn: 31730
2006-11-14 08:08:46 +00:00
Chris Lattner f05d69ae72 implement InstCombine/shift-simplify.ll by transforming:
(X >> Z) op (Y >> Z)  -> (X op Y) >> Z

for all shifts and all ops={and/or/xor}.

llvm-svn: 31729
2006-11-14 07:46:50 +00:00
Chris Lattner c348c50c38 new testcase
llvm-svn: 31728
2006-11-14 07:45:36 +00:00
Chris Lattner d12a4bf799 implement InstCombine/and-compare.ll:test1. This compiles:
typedef struct { unsigned prefix : 4; unsigned code : 4; unsigned unsigned_p : 4; } tree_common;
int foo(tree_common *a, tree_common *b) { return a->code == b->code; }

into:

_foo:
        movl 4(%esp), %eax
        movl 8(%esp), %ecx
        movl (%eax), %eax
        xorl (%ecx), %eax
        # TRUNCATE movb %al, %al
        shrb $4, %al
        testb %al, %al
        sete %al
        movzbl %al, %eax
        ret

instead of:

_foo:
        movl 8(%esp), %eax
        movb (%eax), %al
        shrb $4, %al
        movl 4(%esp), %ecx
        movb (%ecx), %cl
        shrb $4, %cl
        cmpb %al, %cl
        sete %al
        movzbl %al, %eax
        ret

saving one cycle by eliminating a shift.

llvm-svn: 31727
2006-11-14 06:06:06 +00:00
Chris Lattner 9adf8294ef new testcase
llvm-svn: 31726
2006-11-14 06:04:35 +00:00
Chris Lattner 97ff46b3cc lower "X = seteq Y, Z" to '(shr (ctlz (xor Y, Z)), 5)' instead of
'(shr (ctlz (sub Y, Z)), 5)'.

The use of xor better exposes the operation to bit-twiddling logic in the
dag combiner.  For example, this:

typedef struct {
  unsigned prefix : 4;
  unsigned code : 4;
  unsigned unsigned_p : 4;
} tree_common;

int foo(tree_common *a, tree_common *b) {
  return a->code == b->code;
}

Now compiles to:

_foo:
        lwz r2, 0(r4)
        lwz r3, 0(r3)
        xor r2, r3, r2
        rlwinm r2, r2, 28, 28, 31
        cntlzw r2, r2
        srwi r3, r2, 5
        blr

instead of:

_foo:
        lbz r2, 3(r4)
        lbz r3, 3(r3)
        srwi r2, r2, 4
        srwi r3, r3, 4
        subf r2, r2, r3
        cntlzw r2, r2
        srwi r3, r2, 5
        blr

saving a cycle.

llvm-svn: 31725
2006-11-14 05:28:08 +00:00
Andrew Lenharth 0ad1e3845b A shim over other AA impls to catch incorrect uses
llvm-svn: 31724
2006-11-14 05:21:04 +00:00
Reid Spencer 1b89a7bcc1 Discard code that supported old bytecode formats. This makes the Bytecode
Reader code much easier to read and maintain. Backwards compatibility from
version 5 format has been retained. Older formats will produce an error.

llvm-svn: 31723
2006-11-14 04:47:22 +00:00
Devang Patel ca1892699c Implement removeDeadPasses().
llvm-svn: 31722
2006-11-14 03:05:08 +00:00
Devang Patel 3f0832a3b5 Keep track of Last user of analysis phase.
llvm-svn: 31721
2006-11-14 02:54:23 +00:00
Devang Patel f60b5d9676 Use std::map to map AnalysisID and Pass.
llvm-svn: 31720
2006-11-14 01:59:59 +00:00
Chris Lattner 6dc22332bf add a note
llvm-svn: 31719
2006-11-14 01:57:53 +00:00
Chris Lattner 683712583a minor tweaks, reject vector preinc.
llvm-svn: 31717
2006-11-14 01:38:31 +00:00
Devang Patel 050ec72ae4 Manage analysis passes during run.
llvm-svn: 31716
2006-11-14 01:23:29 +00:00
Tanya Lattner 9ce0379da2 Updating configure script for 2.0
llvm-svn: 31715
2006-11-14 00:59:52 +00:00
Devang Patel dafa4ddc46 Update comments.
llvm-svn: 31713
2006-11-14 00:03:04 +00:00
Evan Cheng dbd3d294e6 Matches MachineInstr changes.
llvm-svn: 31712
2006-11-13 23:36:35 +00:00
Evan Cheng 77af6ac5e8 - Let MachineInstr ctors add implicit def and use operands. Other operands
will be inserted before these operands. If the opcode changes (by
  setOpcode), the implicit operands are updated as well.
- Added IsKill, IsDead fields to MachineOperand in preparation for changes
  that move kill / dead info to MachineInstr's.

llvm-svn: 31711
2006-11-13 23:34:06 +00:00
Devang Patel 7086844634 Update PassManagerImpl_New::analysisCurrentlyAvailable to check all
managed passmanagers.

llvm-svn: 31710
2006-11-13 22:53:19 +00:00
Devang Patel ebba970a6d Check currently available anlysis in active managers.
llvm-svn: 31709
2006-11-13 22:40:09 +00:00
Chris Lattner 1121e50f7e teach the g5 hazard recognizer about update loads. This fixes
Ptrdist/anagram among others.

llvm-svn: 31708
2006-11-13 20:11:06 +00:00
Reid Spencer 3d1027193f For PR950:
Changes for new cast instructions that are backwards compatible.

llvm-svn: 31707
2006-11-13 18:00:52 +00:00