Commit Graph

15939 Commits

Author SHA1 Message Date
Reid Spencer de46e48420 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Jim Laskey 936d546eca General clean up of teh dwarf writer.
1. Most significant is the folding of debug information entries.  This
reduced self hosted -g SelectionDAGISel.s from 120M to 13M and pretty
close to matching .o file sizes with gcc.

2. Debug information entry printing for debugging the dwarf code.

3. Bring all the code closer to llvm standards.

4. Misc. fixes and doc clean ups.

llvm-svn: 31379
2006-11-02 20:12:39 +00:00
Rafael Espindola ac8668d62f move ARMCondCodeToString to ARMAsmPrinter.cpp
remove unused variables from lowerCall

llvm-svn: 31378
2006-11-02 15:00:02 +00:00
Jim Laskey eb0fd251c1 Allow FoldingSet clients to pump up the initial hash size.
llvm-svn: 31377
2006-11-02 14:21:26 +00:00
Reid Spencer 5162c6a67d Remove unused variable.
llvm-svn: 31376
2006-11-02 08:23:44 +00:00
Reid Spencer 3054b14059 Remove unused variables.
llvm-svn: 31375
2006-11-02 08:18:15 +00:00
Reid Spencer b20b6857f3 Remove a function prototype that is no longer needed (REM patch missed it)
llvm-svn: 31374
2006-11-02 08:12:02 +00:00
Reid Spencer 7f311c2f4b Get rid of unused variable.
llvm-svn: 31373
2006-11-02 07:59:59 +00:00
Andrew Lenharth d8b59f67f6 fix 2006-11-01-vastart.ll
llvm-svn: 31371
2006-11-02 03:05:26 +00:00
Reid Spencer 7eb55b395f For PR950:
Replace the REM instruction with UREM, SREM and FREM.

llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Chris Lattner 584a11ae22 Implement the getRegForInlineAsmConstraint method for PPC. With recent
sdisel changes, this eliminates a ton of copies around common inline asms.
For example:

int test2(int Y, int X) {
  asm("foo %0, %1" : "=r"(X): "r"(X));
  return X;
}

now compiles to:

_test2:
        foo r3, r4
        blr

instead of:

_test2:
        mr r2, r4
        foo r2, r2
        mr r3, r2
        blr

GCC produces:

_test2:
        foo r4, r4
        mr r3,r4
        blr

llvm-svn: 31367
2006-11-02 01:44:04 +00:00
Chris Lattner 55402d4403 Allow the getRegForInlineAsmConstraint method to return a register class with
no fixes physreg.  Treat this as permission to use any register in the register
class.  When this happens and it is safe, allow the llvm register allcoator to
allocate the register instead of doing it at isel time.  This eliminates a ton
of copies around common inline asms.  For example:

int test2(int Y, int X) {
  asm("foo %0, %1" : "=r"(X): "r"(X));
  return X;
}

now compiles to:

_test2:
        foo r3, r4
        blr

instead of:

_test2:
        mr r2, r4
        foo r2, r2
        mr r3, r2
        blr

GCC produces:

_test2:
        foo r4, r4
        mr r3,r4
        blr

llvm-svn: 31366
2006-11-02 01:41:49 +00:00
Evan Cheng 93cdd149f7 Rename
llvm-svn: 31364
2006-11-01 23:18:32 +00:00
Evan Cheng d8697deca3 Two-address instructions no longer have to be A := A op C. Now any pair of dest / src operands can be tied together.
llvm-svn: 31363
2006-11-01 23:06:55 +00:00
Devang Patel 2cb4f83b38 There can be more than one PHINode at the start of the block.
llvm-svn: 31362
2006-11-01 23:04:45 +00:00
Evan Cheng 1b2e60e970 Added getTiedToSrcOperand() to check for two-address'ness.
llvm-svn: 31360
2006-11-01 23:00:31 +00:00
Evan Cheng 1359196c4e Clean up.
llvm-svn: 31359
2006-11-01 22:39:30 +00:00
Devang Patel 44519a8feb Handle PHINode with only one incoming value.
This fixes http://llvm.org/bugs/show_bug.cgi?id=979

llvm-svn: 31358
2006-11-01 22:26:43 +00:00
Evan Cheng 47218fab42 CopyFromReg starts a live range so its use should not be considered a floater.
llvm-svn: 31356
2006-11-01 22:17:06 +00:00
Reid Spencer 20ffdbe7c1 Make ScalarEvolution actually use a ZeroExtend expression instead of
having SCZeroExtendExpr be equivalent to SCTruncate

llvm-svn: 31355
2006-11-01 21:53:12 +00:00
Chris Lattner 7cee6ddcd8 give branch folding a simple heuristic to decide which block to split so that
it inserts an uncond branch where it is less likely to cause a problem.  This
fixes some perf issues on ppc.

llvm-svn: 31354
2006-11-01 19:36:29 +00:00
Chris Lattner 5a0bd61c64 Fix GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll and McGill/chomp
llvm-svn: 31352
2006-11-01 18:03:33 +00:00
Rafael Espindola 3576405a26 print null values in bss
llvm-svn: 31349
2006-11-01 14:26:44 +00:00
Rafael Espindola 0cd8d14c7c implement zextload bool and truncstore bool
llvm-svn: 31348
2006-11-01 14:13:27 +00:00
Evan Cheng 91f120f4fa Add a printSetLabel that takes two id's.
llvm-svn: 31347
2006-11-01 09:23:08 +00:00
Chris Lattner eebea43b48 Factor gep instructions through phi nodes.
llvm-svn: 31346
2006-11-01 07:43:41 +00:00
Chris Lattner 14f82c7dcd Turn a phi of many loads into a phi of the address and a single load of the
result.  This can significantly shrink code and exposes identities more
aggressively.

llvm-svn: 31344
2006-11-01 07:13:54 +00:00
Evan Cheng 94e5bc9e83 Fix ldmxcsr JIT encoding.
llvm-svn: 31343
2006-11-01 06:53:52 +00:00
Chris Lattner dc826fc068 Fix a bug in the previous patch
llvm-svn: 31342
2006-11-01 04:55:47 +00:00
Chris Lattner cadac0c5c3 Fold things like "phi [add (a,b), add(c,d)]" into two phi's and one add.
This triggers thousands of times on multisource.

llvm-svn: 31341
2006-11-01 04:51:18 +00:00
Evan Cheng 415f365e5c Print jumptable index.
llvm-svn: 31340
2006-11-01 04:48:30 +00:00
Reid Spencer 5e2e0cb9aa Remove unnecessary sign conversions made possible by last patch.
llvm-svn: 31339
2006-11-01 03:45:43 +00:00
Reid Spencer f84930746e Fix a bug in the interpreter where divides of unmatched signed operands
would fail. E.g. udiv sint X, Y  or sdiv uint X, Y would fail to find a
type match in the switch statement and fail the operation.

llvm-svn: 31338
2006-11-01 03:41:05 +00:00
Chris Lattner f505a5a063 make tail merging more aggressive. If two blocks share a common tail, but the
tail is not an entire block for either of them, pick one, split it, then
merge the common part.

llvm-svn: 31336
2006-11-01 01:16:12 +00:00
Chris Lattner 3ac71b31f0 enable branch folding with an option
llvm-svn: 31335
2006-11-01 00:38:31 +00:00
Evan Cheng 7a6a5b9af5 Add constraints to Instruction class.
llvm-svn: 31332
2006-11-01 00:26:27 +00:00
Andrew Lenharth dfbf91e59d more shotenning
llvm-svn: 31331
2006-10-31 23:46:56 +00:00
Chris Lattner fe43befeda Compile CodeGen/PowerPC/fp-branch.ll to:
_intcoord_cond_next55:
LBB1_3: ;cond_next55
        lis r2, ha16(LCPI1_0)
        lfs f0, lo16(LCPI1_0)(r2)
        fcmpu cr0, f1, f0
        blt cr0, LBB1_2 ;cond_next62.exitStub
LBB1_1: ;bb72.exitStub
        li r3, 1
        blr
LBB1_2: ;cond_next62.exitStub
        li r3, 0
        blr

instead of:

_intcoord_cond_next55:
LBB1_3: ;cond_next55
        lis r2, ha16(LCPI1_0)
        lfs f0, lo16(LCPI1_0)(r2)
        fcmpu cr0, f1, f0
        bge cr0, LBB1_1 ;bb72.exitStub
LBB1_4: ;cond_next55
        lis r2, ha16(LCPI1_0)
        lfs f0, lo16(LCPI1_0)(r2)
        fcmpu cr0, f1, f0
        bnu cr0, LBB1_2 ;cond_next62.exitStub
LBB1_1: ;bb72.exitStub
        li r3, 1
        blr
LBB1_2: ;cond_next62.exitStub
        li r3, 0
        blr

llvm-svn: 31330
2006-10-31 23:06:00 +00:00
Chris Lattner 427301fdae look through isunordered to inline it into branch blocks.
llvm-svn: 31328
2006-10-31 22:37:42 +00:00
Evan Cheng a41c2d6432 Nuke dead code.
llvm-svn: 31327
2006-10-31 21:53:31 +00:00
Chris Lattner 44daa50bed allow the address of a global to be used with the "i" constraint when in
-static mode.  This implements PR882.

llvm-svn: 31326
2006-10-31 20:13:11 +00:00
Chris Lattner 60ce558aaa implement the 'c' inline asm modifier character
llvm-svn: 31325
2006-10-31 20:12:30 +00:00
Chris Lattner 1fd360e13a handle global address constant sdnodes
llvm-svn: 31323
2006-10-31 20:01:56 +00:00
Andrew Lenharth 8b20fa42da Let us play simplify the td file (and fix a few missed sub and mul patterns).
llvm-svn: 31322
2006-10-31 19:52:12 +00:00
Chris Lattner f6a6966cd2 handle "st" as "st(0)"
llvm-svn: 31320
2006-10-31 19:42:44 +00:00
Chris Lattner 6f043b90ea TargetLowering::isOperandValidForConstraint
llvm-svn: 31319
2006-10-31 19:41:18 +00:00
Chris Lattner 8c6949e5b2 Change the prototype for TargetLowering::isOperandValidForConstraint
llvm-svn: 31318
2006-10-31 19:40:43 +00:00
Chris Lattner 984d6e1669 generalize the fix for PR977 to also fix
Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll

llvm-svn: 31317
2006-10-31 18:56:48 +00:00
Chris Lattner eb68f080ef Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
llvm-svn: 31315
2006-10-31 17:52:18 +00:00
Andrew Lenharth 692e4155aa Add all that branch mangling niftiness
llvm-svn: 31313
2006-10-31 16:49:55 +00:00
Rafael Espindola 4e825336a0 add support for calling functions when the caller has variable sized objects
llvm-svn: 31312
2006-10-31 13:03:26 +00:00
Anton Korobeynikov aa4c0f9374 1. Clean up code due to changes in SwitchTo*Section(2)
2. Added partial debug support for mingw\cygwin targets (the same as
   Linux\ELF). Please note, that currently mingw\cygwin uses 'stabs' format
   for storing debug info by default, thus many (runtime) libraries has
   this information included. These formats shouldn't be mixed in one binary
   ('stabs' & 'DWARF'), otherwise binutils tools will be confused.

llvm-svn: 31311
2006-10-31 08:31:24 +00:00
Chris Lattner 968f803928 Turn an assert into an error message. This is commonly triggered when
we don't support a specific constraint yet.  When this happens, print the
unsupported constraint.

llvm-svn: 31310
2006-10-31 07:33:13 +00:00
Anton Korobeynikov 49993529eb Unbreaking static ctors patch.
Defaulting second arguments of SwitchTo*Section, this should make things
somehow clearer.

llvm-svn: 31306
2006-10-31 06:11:06 +00:00
Evan Cheng e6d584765f Fix a typo which can break jumptables.
llvm-svn: 31305
2006-10-31 02:31:00 +00:00
Reid Spencer 2545fe6d93 Make this compile again.
llvm-svn: 31304
2006-10-31 01:45:56 +00:00
Evan Cheng de5ecd6bc1 Apply Aton's LLVM patch for PR973: Linux ctors / dtors support.
llvm-svn: 31303
2006-10-31 01:26:55 +00:00
Reid Spencer 7eda51d4cf Fix a problem introduced by a last-minute change (logic negation).
llvm-svn: 31302
2006-10-30 23:34:32 +00:00
Chris Lattner 3e36e07db2 fix miscompilation of llvm.isunordered, where we branched on the opposite
condition.  This fixes miscompilation of Olden/bh and many others.

llvm-svn: 31301
2006-10-30 23:02:25 +00:00
Reid Spencer b51b5c0b1f Add debug support for X86/ELF targets (Linux). This allows llvm-gcc4
generated object modules to be debugged with gdb. Hopefully this helps
pre-release debugging.

llvm-svn: 31299
2006-10-30 22:32:30 +00:00
Chris Lattner 7443600ef8 fix wonky indentation
llvm-svn: 31298
2006-10-30 22:27:23 +00:00
Devang Patel bf0a5c2d56 Update comment. Valid option is -debug-pass=Structures.
llvm-svn: 31297
2006-10-30 19:25:54 +00:00
Jim Laskey ad2f5b7d18 Switch abbreviations to use the folding set.a.
llvm-svn: 31296
2006-10-30 15:59:54 +00:00
Jim Laskey 43c19124bb Simplify DwarfWriter header.
llvm-svn: 31295
2006-10-30 13:35:07 +00:00
Evan Cheng 0d41d19427 All targets expand BR_JT for now.
llvm-svn: 31294
2006-10-30 08:02:39 +00:00
Evan Cheng 84a28d4e76 Lower jumptable to BR_JT. The legalizer can lower it to a BRIND or let the target custom lower it.
llvm-svn: 31293
2006-10-30 08:00:44 +00:00
Evan Cheng c3e695137d Added a new SDNode type: BR_JT for jumptable branch.
llvm-svn: 31292
2006-10-30 07:59:36 +00:00
Chris Lattner 149e666baf add a highly efficient hash table that is specialized for mapping C strings
to some other type.

llvm-svn: 31286
2006-10-29 23:42:03 +00:00
Chris Lattner b9de90377f Add a new llvm::Allocator abstraction, which will be used by a container
I'm about to add.  This is similar to, but necessarily different than, the
STL allocator class.

llvm-svn: 31285
2006-10-29 22:08:03 +00:00
Chris Lattner fc519cd2d1 Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT.
llvm-svn: 31284
2006-10-29 21:21:20 +00:00
Chris Lattner 504eeda365 Make CanFallThrough more intelligent (so it can handle blocks with (e.g.) no
successors), and make island block movement more general.

This compiles CodeGen/X86/2006-04-27-ISelFoldingBug.ll to:

_loadAndRLEsource_no_exit_2E_1_label_2E_0:
        subl $8, %esp
        movl %esi, 4(%esp)
        movl %ebx, (%esp)
        movl 16(%esp), %eax
        movl 12(%esp), %ecx
LBB1_3: #label.0
        movl _last, %edx
        movl %edx, %esi
        incl %esi
        movl %esi, _last
        movl %ecx, %ebx
        # TRUNCATE movb %bl, %bl
        movl _block, %esi
        movb %bl, 1(%esi,%edx)
        cmpl %eax, _last
        jge LBB1_2      #codeRepl5.exitStub
LBB1_4: #label.0
        cmpl $257, %ecx
        je LBB1_2       #codeRepl5.exitStub
LBB1_1: #label.0.no_exit.1_crit_edge.exitStub
        movl $1, %eax
        movl (%esp), %ebx
        movl 4(%esp), %esi
        addl $8, %esp
        ret
LBB1_2: #codeRepl5.exitStub
        xorl %eax, %eax
        movl (%esp), %ebx
        movl 4(%esp), %esi
        addl $8, %esp
        ret

instead of:

_loadAndRLEsource_no_exit_2E_1_label_2E_0:
        subl $8, %esp
        movl %esi, 4(%esp)
        movl %ebx, (%esp)
        movl 16(%esp), %eax
        movl 12(%esp), %ecx
        jmp LBB1_3      #label.0
LBB1_1: #label.0.no_exit.1_crit_edge.exitStub
        movl $1, %eax
        movl (%esp), %ebx
        movl 4(%esp), %esi
        addl $8, %esp
        ret
LBB1_2: #codeRepl5.exitStub
        xorl %eax, %eax
        movl (%esp), %ebx
        movl 4(%esp), %esi
        addl $8, %esp
        ret
LBB1_3: #label.0
        movl _last, %edx
        movl %edx, %esi
        incl %esi
        movl %esi, _last
        movl %ecx, %ebx
        # TRUNCATE movb %bl, %bl
        movl _block, %esi
        movb %bl, 1(%esi,%edx)
        cmpl %eax, _last
        jge LBB1_2      #codeRepl5.exitStub
LBB1_4: #label.0
        cmpl $257, %ecx
        jne LBB1_1      #label.0.no_exit.1_crit_edge.exitStub
        jmp LBB1_2      #codeRepl5.exitStub

... which is much better layout :)

llvm-svn: 31282
2006-10-29 21:05:41 +00:00
Chris Lattner e60ae823e8 fix Generic/2006-10-29-Crash.ll
llvm-svn: 31281
2006-10-29 21:01:20 +00:00
Chris Lattner f31b9ef458 Fix a load folding issue that Evan noticed: there is no need to export values
used by comparisons in the main block.

llvm-svn: 31279
2006-10-29 18:23:37 +00:00
Jim Laskey 179ebd3fc3 Try again.
llvm-svn: 31278
2006-10-29 09:19:59 +00:00
Jim Laskey 8f05a611e9 Not handling zero length strings.
llvm-svn: 31277
2006-10-29 08:27:07 +00:00
Evan Cheng 7ab6123c42 VLOAD is not the LoadSDNode opcode.
llvm-svn: 31276
2006-10-29 06:14:47 +00:00
Nick Lewycky dc146a9fb9 Remove spurious case. EXTLOAD is not one of the node opcodes.
llvm-svn: 31275
2006-10-29 02:26:30 +00:00
Chris Lattner bba52191fa split critical edges more carefully and intelligently. In particular, critical
edges whose destinations are not phi nodes don't bother us.  Also, share
split edges, since the split edge can't have a phi.  This significantly
reduces the complexity of generated code in some cases.

llvm-svn: 31274
2006-10-28 19:22:10 +00:00
Chris Lattner c07657f59b Teach branch folding to fold identical jump tables together and to delete
jump tables that are dead.

llvm-svn: 31273
2006-10-28 18:34:47 +00:00
Chris Lattner cde339cf1e const'ify jump table stuff
llvm-svn: 31269
2006-10-28 18:17:09 +00:00
Chris Lattner 28328f9a0a add an assert
llvm-svn: 31267
2006-10-28 18:11:20 +00:00
Chris Lattner 28bfe389d1 don't print dead jump tables
llvm-svn: 31266
2006-10-28 18:10:06 +00:00
Chris Lattner 113f7470e6 implement the BlockHasNoFallThrough hook
llvm-svn: 31264
2006-10-28 17:35:02 +00:00
Chris Lattner af8383806b improve deletion of blocks that just contain branches by knowing that
the pred block doesn't fall through into them if it's a jumptable.

llvm-svn: 31263
2006-10-28 17:32:47 +00:00
Chris Lattner 53ebf20c26 add another target hook for branch folding.
llvm-svn: 31262
2006-10-28 17:29:57 +00:00
Jim Laskey eef273a16f Load and stores have not been uniqued properly.
llvm-svn: 31261
2006-10-28 17:25:28 +00:00
Chris Lattner 3e6b1c6157 Split *all* critical edges before isel. This resolves issues with spill code
being inserted on unsplit critical edges, which introduces (sometimes large
amounts of) partially dead spill code.

This also fixes PR925 + CodeGen/Generic/switch-crit-edge-constant.ll

llvm-svn: 31260
2006-10-28 17:04:37 +00:00
Chris Lattner 3e763f5708 add option to isCriticalEdge
llvm-svn: 31258
2006-10-28 06:58:17 +00:00
Chris Lattner a6eb7e0803 break edges more intelligently
llvm-svn: 31257
2006-10-28 06:45:33 +00:00
Chris Lattner 80ea207bfa Expose a smarter way to break critical edges.
llvm-svn: 31256
2006-10-28 06:44:56 +00:00
Chris Lattner 400ac04e64 SplitCriticalEdge checks to see if an edge is critical, don't check twice
llvm-svn: 31255
2006-10-28 06:38:14 +00:00
Chris Lattner b78eb6c8d1 Fix a serious bug that caused any x86 vector stuff to infinite loop
llvm-svn: 31254
2006-10-28 06:15:26 +00:00
Evan Cheng ae8c29a7d3 Doh. Must check if GV is constant first before putting it in .cstring.
llvm-svn: 31253
2006-10-28 05:56:51 +00:00
Evan Cheng 0d782b4c60 Doh. Must check if GV is constant first.
llvm-svn: 31252
2006-10-28 05:56:06 +00:00
Chris Lattner 23540b142c add a method
llvm-svn: 31249
2006-10-28 01:24:05 +00:00
Chris Lattner 5191c65485 prepare for a change I'm about to make
llvm-svn: 31248
2006-10-28 00:59:20 +00:00
Chris Lattner a6873c0f88 don't dist internal readme
llvm-svn: 31247
2006-10-28 00:51:15 +00:00
Chris Lattner acc6b37d0d don't dist internal readme's
llvm-svn: 31246
2006-10-28 00:49:54 +00:00
Chris Lattner 3be52bb570 don't distribute internal readme's
llvm-svn: 31245
2006-10-28 00:48:27 +00:00
Reid Spencer 247e09a07c Make sure all the readme files get distributed.
llvm-svn: 31244
2006-10-28 00:11:39 +00:00
Jim Laskey bd0f088743 Clean up.
llvm-svn: 31243
2006-10-27 23:52:51 +00:00
Chris Lattner 84a035056e Fix a bug in merged condition handling (CodeGen/Generic/2006-10-27-CondFolding.ll).
Add many fewer CFG edges and PHI node entries.  If there is a switch which has
the same block as multiple destinations, only add that block once as a successor/phi
node (in the jumptable case)

llvm-svn: 31242
2006-10-27 23:50:33 +00:00
Jim Laskey f576b42bb2 Switch over from SelectionNodeCSEMap to FoldingSet.
llvm-svn: 31240
2006-10-27 23:46:08 +00:00
Chris Lattner 28174f5a3a this doesn't occur any more in mason
llvm-svn: 31236
2006-10-27 22:02:19 +00:00
Chris Lattner 4c0cc53da1 the code in question is now:
cmpw cr0, r7, r3
        ble cr0, LBB1_5 ;bb25
LBB1_8: ;bb17
        cmpw cr0, r8, r5
        bgt cr0, LBB1_2 ;bb

which is just as good as crnand.

llvm-svn: 31235
2006-10-27 22:00:55 +00:00
Chris Lattner b9392fb635 remove debug code
llvm-svn: 31233
2006-10-27 21:58:03 +00:00
Chris Lattner f1b54fd7a5 Codegen cond&cond with two branches. This compiles (f.e.) PowerPC/and-branch.ll to:
cmpwi cr0, r4, 4
        bgt cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_3: ;entry
        cmplwi cr0, r3, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

        cmpwi cr7, r4, 4
        mfcr r2
        addic r4, r3, -1
        subfe r3, r4, r3
        rlwinm r2, r2, 30, 31, 31
        or r2, r2, r3
        cmplwi cr0, r2, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_1: ;cond_true

llvm-svn: 31232
2006-10-27 21:54:23 +00:00
Chris Lattner ed0110b949 Turn conditions like x<Y|z==q into multiple blocks.
This compiles Regression/CodeGen/X86/or-branch.ll into:

_foo:
        subl $12, %esp
        call L_bar$stub
        movl 20(%esp), %eax
        movl 16(%esp), %ecx
        cmpl $5, %eax
        jl LBB1_1       #cond_true
LBB1_3: #entry
        testl %ecx, %ecx
        jne LBB1_2      #UnifiedReturnBlock
LBB1_1: #cond_true
        call L_bar$stub
        addl $12, %esp
        ret
LBB1_2: #UnifiedReturnBlock
        addl $12, %esp
        ret

instead of:

_foo:
        subl $12, %esp
        call L_bar$stub
        movl 20(%esp), %eax
        movl 16(%esp), %ecx
        cmpl $4, %eax
        setg %al
        testl %ecx, %ecx
        setne %cl
        testb %cl, %al
        jne LBB1_2      #UnifiedReturnBlock
LBB1_1: #cond_true
        call L_bar$stub
        addl $12, %esp
        ret
LBB1_2: #UnifiedReturnBlock
        addl $12, %esp
        ret

And on ppc to:

        cmpwi cr0, r29, 5
        blt cr0, LBB1_1 ;cond_true
LBB1_3: ;entry
        cmplwi cr0, r30, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

        cmpwi cr7, r4, 4
        mfcr r2
        addic r4, r3, -1
        subfe r30, r4, r3
        rlwinm r29, r2, 30, 31, 31
        and r2, r29, r30
        cmplwi cr0, r2, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock

llvm-svn: 31230
2006-10-27 21:36:01 +00:00
Evan Cheng e056dd5928 Fixed a significant bug where unpcklpd is incorrectly used to extract element 1 from a v2f64 value.
llvm-svn: 31228
2006-10-27 21:08:32 +00:00
Jim Laskey cef515fcc0 SmallVector append not insert.
llvm-svn: 31224
2006-10-27 19:38:32 +00:00
Jim Laskey a9e9cae33e Grrr.
llvm-svn: 31223
2006-10-27 19:20:12 +00:00
Jim Laskey a88e609c0f Temp patch for missing functionality.
llvm-svn: 31222
2006-10-27 19:14:16 +00:00
Reid Spencer 115511f2e2 Make the Value and Type methods print a newline so it prints nicely in gdb
llvm-svn: 31221
2006-10-27 18:58:54 +00:00
Evan Cheng bf3df77758 Fix for PR968: expand vector sdiv, udiv, srem, urem.
llvm-svn: 31220
2006-10-27 18:49:08 +00:00
Bill Wendling e0412f500e MathExtras isn't in the llvm/ADT directory but in the llvm/Support directory.
llvm-svn: 31219
2006-10-27 18:47:29 +00:00
Jim Laskey 6ca4a345dd Apply editorials.
llvm-svn: 31218
2006-10-27 18:05:12 +00:00
Jim Laskey 43bc1847a2 Breakout folding hash set from SelectionDAGCSEMap.
llvm-svn: 31215
2006-10-27 16:16:16 +00:00
Reid Spencer e54243f030 Initialize CStringSection member var.
llvm-svn: 31214
2006-10-27 16:14:06 +00:00
Evan Cheng f53ae69365 Change load PatFrag to ignore indexed load.
llvm-svn: 31210
2006-10-26 21:55:50 +00:00
Evan Cheng 96d6bf50ae getPreIndexedLoad -> getIndexedLoad.
llvm-svn: 31209
2006-10-26 21:53:40 +00:00
Evan Cheng e1e06c2de8 Place cstrings in .cstring section.
llvm-svn: 31207
2006-10-26 21:48:57 +00:00
Evan Cheng e974da6bb7 Speed up isCString()
llvm-svn: 31206
2006-10-26 21:48:03 +00:00
Reid Spencer 00c482b7a2 Simplify code a bit by changing instances of:
InsertNewInstBefore(new CastInst(Val, ValTy, Val->GetName()), I)
into:
   InsertCastBefore(Val, ValTy, I)

llvm-svn: 31204
2006-10-26 19:19:06 +00:00
Evan Cheng 392f645783 Put cstrings in .cstring section when compiling for Mac OS X.
llvm-svn: 31203
2006-10-26 19:18:18 +00:00
Evan Cheng 3763c5b1c4 Add isCString() - returns true if a ConstantArray is a CString.
llvm-svn: 31201
2006-10-26 19:15:05 +00:00
Chris Lattner 91386800ea Fix Transforms/InstCombine/2006-10-26-VectorReassoc.ll
llvm-svn: 31200
2006-10-26 18:27:26 +00:00
Chris Lattner fac5f9110c Add isFPOrFPVector() method, which indicates if a type is either FP or a
vector of FP types.

llvm-svn: 31198
2006-10-26 18:22:45 +00:00
Rafael Espindola a23166d6a4 initial support for frame pointers
llvm-svn: 31197
2006-10-26 13:31:26 +00:00
Reid Spencer c6b52da458 Enclose a case in { and } so that the pickier compilers don't complain.
llvm-svn: 31196
2006-10-26 06:17:40 +00:00
Reid Spencer 7e80b0b31e For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.

llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Nick Lewycky 5b979ae531 Fix 2006-10-25-AddSetCC. A relational operator (like setlt) can never
produce an EQ property.

llvm-svn: 31193
2006-10-26 02:35:18 +00:00
Reid Spencer 810dd064aa Make the makefile tell us when Intrinsics.gen is being updated.
llvm-svn: 31191
2006-10-26 01:42:23 +00:00
Nick Lewycky 9d17c82a26 Resurrect r1.25.
Fix and comment the "or", "and" and "xor" transformations.

llvm-svn: 31189
2006-10-25 23:48:24 +00:00
Chris Lattner 0d4479b77d simplify code
llvm-svn: 31188
2006-10-25 22:21:37 +00:00
Evan Cheng c415c5be49 During vector shuffle lowering, we sometimes commute a vector shuffle to try
to match MOVL (movss, movsd, etc.). Don't forget to commute it back and try
unpck* and shufp* if that doesn't pan out.

llvm-svn: 31186
2006-10-25 21:49:50 +00:00
Evan Cheng 7e065ff7e4 X86ISD::PEXTRW 3rd operand type is always target pointer type.
llvm-svn: 31185
2006-10-25 21:35:05 +00:00
Chris Lattner 53f53db919 hide symbols properly
llvm-svn: 31184
2006-10-25 21:14:31 +00:00
Evan Cheng 798b306311 Remove -disable-x86-shuffle-opti
llvm-svn: 31183
2006-10-25 20:48:19 +00:00
Chris Lattner 9feb308d51 turn off tail merging for now
llvm-svn: 31180
2006-10-25 18:08:50 +00:00
Chris Lattner 7a7835deb4 be more aggressive about matching identical instructions.
llvm-svn: 31179
2006-10-25 18:08:14 +00:00
Devang Patel 71b99297aa Move getPreferredAlignmentLog from AsmPrinter to TargetData
llvm-svn: 31171
2006-10-24 20:32:14 +00:00
Rafael Espindola bd29281e97 expand ISD::VACOPY
llvm-svn: 31170
2006-10-24 20:15:21 +00:00
John Criswell 6af0b120b8 Removed extraneous semi-colon; this was prevening the grammar file from
bison'ing correctly.

llvm-svn: 31169
2006-10-24 19:09:48 +00:00
Chris Lattner 61bcf9154d visitSwitchCase knows how to insert conditional branches well. Change
visitBr to just call visitSwitchCase, eliminating duplicate logic.

llvm-svn: 31167
2006-10-24 18:07:37 +00:00
Chris Lattner 963ddad31a Generalize CaseBlock a bit more:
Rename LHSBB/RHSBB to TrueBB/FalseBB.  Allow the RHS value to be null,
in which case the LHS is treated as a bool.

llvm-svn: 31166
2006-10-24 17:57:59 +00:00
Chris Lattner 9030fc690a Fix CodeGen/IA64/ret-0.ll, which has apparently been broken since some of the
isel changes happened months ago.

llvm-svn: 31164
2006-10-24 17:09:43 +00:00
Rafael Espindola ed32883b27 fix warning about missing newline at end of file
llvm-svn: 31162
2006-10-24 17:07:11 +00:00
Chris Lattner 3f179d24c6 generalize 'CaseBlock'. It really allows any comparison to be inserted.
llvm-svn: 31161
2006-10-24 17:03:35 +00:00
Chris Lattner aaeede0aa2 implement uncond branch insertion, mark branches with isBranch.
llvm-svn: 31160
2006-10-24 16:47:57 +00:00
Chris Lattner ccd7704354 implement uncond branch insertion for the branch folding pass
llvm-svn: 31159
2006-10-24 16:44:55 +00:00
Chris Lattner 042d56230e implement uncond branch insertion so alpha works work branchfolding.
llvm-svn: 31158
2006-10-24 16:41:36 +00:00
Chris Lattner b7267bd034 implement uncond branch insertion for sparc to fix regressions from last night
due to branchfolding

llvm-svn: 31157
2006-10-24 16:39:19 +00:00
Chris Lattner f054003ba7 new bad case
llvm-svn: 31156
2006-10-24 16:12:47 +00:00
Jim Laskey 1941bfa361 Don't do dead block elimination in fast mode.
llvm-svn: 31155
2006-10-24 16:11:49 +00:00
Jim Laskey a916192267 LinearScanner hotspot.
llvm-svn: 31153
2006-10-24 14:35:25 +00:00
Jim Laskey 516cd40b5c Tighter data structure for deleted debug labels.
llvm-svn: 31152
2006-10-24 11:50:43 +00:00
Chris Lattner ebb1ad4382 Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
llvm-svn: 31151
2006-10-24 06:26:32 +00:00
Chris Lattner ceb51d8427 move single basic blocks that are neither fallen into nor fall out of into
a place more useful.  In particular, if we can put them in a place where code
will be able to fall into it, do so.  Otherwise, put it in a place it can fall
through into a successor.  Otherwise, if preventing a fallthrough, move to the
end of the function, out of the way.

This deletes several hundred unconditional branches from spass.

llvm-svn: 31149
2006-10-24 01:12:32 +00:00
Chris Lattner d43e8a7429 Add intrinsics for the rest of the DCB* instructions.
llvm-svn: 31148
2006-10-24 01:08:42 +00:00
Chris Lattner dc7b9beb20 Revert back to r1.21, which was the last revision of predsimplify that
passes llvm-gcc bootstrap.

llvm-svn: 31146
2006-10-24 00:36:21 +00:00
Chris Lattner 94866bef35 add moveBefore/moveAfter helper methods
llvm-svn: 31145
2006-10-24 00:02:26 +00:00
Chris Lattner ebdb1d6724 Enable tail merging by default.
llvm-svn: 31140
2006-10-23 22:10:12 +00:00
Rafael Espindola b43efe86f5 implement STRB and STRH
llvm-svn: 31138
2006-10-23 20:34:27 +00:00
Rafael Espindola cd5f662c7b expand ISD::MEMSET
llvm-svn: 31137
2006-10-23 20:08:22 +00:00
Andrew Lenharth 9cdaa53007 Make these hack flags hidden, like other dsa hack flags
llvm-svn: 31136
2006-10-23 19:55:24 +00:00
Andrew Lenharth 0c3211eff0 Revert the aggressive inlining for now, it doesn't handle external correctly
llvm-svn: 31135
2006-10-23 19:53:37 +00:00
Chris Lattner fe7b6ef346 Handle fallout from the recent branch-on-undef changes. This fixes
Prolangs-C/agrep and SCCP/2006-10-23-IPSCCP-Crash.ll

llvm-svn: 31132
2006-10-23 18:57:02 +00:00
Chris Lattner 4c931502cc Minor tweak. Instead of generating:
movl 32(%esp), %eax
        cmpl $1, %eax
        je LBB1_1       #bb
LBB1_4: #entry
        cmpl $2, %eax
        je LBB1_2       #bb2
        jmp LBB1_3      #UnifiedReturnBlock
LBB1_1: #bb

notice that we would miss the fall through and emit this instead:

        movl 32(%esp), %eax
        cmpl $2, %eax
        je LBB1_2       #bb2
LBB1_4: #entry
        cmpl $1, %eax
        jne LBB1_3      #UnifiedReturnBlock
LBB1_1: #bb

llvm-svn: 31130
2006-10-23 18:38:22 +00:00
Jim Laskey 5e1a34032b More complete solution to deleting blocks and debug info.
llvm-svn: 31129
2006-10-23 14:56:37 +00:00
Jim Laskey bd7a1d2b4d [SU]int update - inactive code may get activated someday
llvm-svn: 31128
2006-10-23 14:39:22 +00:00
Nick Lewycky 53b4158448 Remove the Backwards operation. Resolving now works at the time when a
property is added by running through the list of uses of the value and
adding resolved properties to the property set.

llvm-svn: 31126
2006-10-23 01:56:02 +00:00
Chris Lattner 76a7bc8c55 Fix phi node updating for switches lowered to linear sequences of branches.
llvm-svn: 31125
2006-10-22 23:00:53 +00:00
Chris Lattner 4c3ef4782d disable this code for now, it's not yet safely updating phi nodes
llvm-svn: 31124
2006-10-22 22:47:10 +00:00
Nick Lewycky 6f5c30fcec Fix similar missing optimization opportunity in XOR.
llvm-svn: 31123
2006-10-22 22:22:58 +00:00
Chris Lattner bb3084546a this part implemented.
llvm-svn: 31122
2006-10-22 21:40:12 +00:00
Nick Lewycky af2b0571d0 Whoops! Add missing NULL check.
llvm-svn: 31121
2006-10-22 21:38:24 +00:00
Anton Korobeynikov 41a83d7871 Do section switching right way for Mingw\Cygwin and Linux.
This will allow (after llvm-gcc linkage fix) more dummy tests using
libstdc++ to pass on mingw :)

llvm-svn: 31120
2006-10-22 21:37:13 +00:00
Chris Lattner 6d6fc26257 Implement PR964 and Regression/CodeGen/Generic/SwitchLowering.ll
llvm-svn: 31119
2006-10-22 21:36:53 +00:00
Nick Lewycky 2c734f3fc1 Handle "if ((x|y) != 0)" for ints like we do for bools. Fixes missed
optimization opportunity pointed out by Chris Lattner.

llvm-svn: 31118
2006-10-22 21:36:41 +00:00
Nick Lewycky f345008339 AllocaInst can't return a null pointer. Fixes missed optimization
opportunity pointed out by Andrew Lewycky.

llvm-svn: 31115
2006-10-22 19:53:27 +00:00
Chris Lattner 250eff20da Add a workaround for PR962, disabling the more aggressive form of this
transformation.  This speeds up a C++ app 2.25x.

llvm-svn: 31113
2006-10-22 18:42:26 +00:00
Reid Spencer aa1c614784 Don't generate a prototype for _setjmp. At least on Linux, this function
has a different prototype than the one #included from <setjmp.h>. This
patch fixes siod and a number of other test cases on Linux that were
failing the CBE because of this _setjmp issue.

llvm-svn: 31112
2006-10-22 09:58:21 +00:00
Reid Spencer c7212791a4 Regenerate.
llvm-svn: 31111
2006-10-22 07:03:43 +00:00
Reid Spencer 6309fa1438 Remove unneeded CHECK_FOR_ERROR invocations.
llvm-svn: 31110
2006-10-22 07:03:09 +00:00
Chris Lattner 7d1d03445e regenerate
llvm-svn: 31109
2006-10-22 06:08:13 +00:00
Chris Lattner fd3d29a978 change keyword to datalayout
llvm-svn: 31108
2006-10-22 06:07:41 +00:00
Chris Lattner 0489716a67 Change keyword to datalayout
llvm-svn: 31107
2006-10-22 06:06:56 +00:00
Chris Lattner af17096dcf 3 Changes:
1. Better document what is going on here.
2. Only hack on one branch per iteration, making the results less conservative.
3. Handle the problematic case by marking edges executable instead of by
   playing with value lattice states.  This is far less pessimistic, and fixes
   SCCP/ipsccp-gvar.ll.

llvm-svn: 31106
2006-10-22 05:59:17 +00:00
Chris Lattner 9f5a129543 don't break infinite loops
llvm-svn: 31102
2006-10-21 06:11:43 +00:00
Chris Lattner 23f22de26f Implement support for branch reversal, fix a bug in branch analysis.
This provides stuff like:

        cmpw cr0, r15, r29
        mr r14, r15
-       bge cr0, LBB3_111       ;bb656
-       b LBB3_90       ;bb501
+       blt cr0, LBB3_90        ;bb501
 LBB3_111:      ;bb656
        lwz r18, 68(r1)

which is particularly good for dispatch group formation.

llvm-svn: 31101
2006-10-21 06:03:11 +00:00
Chris Lattner 28f17f45be Use branch reversal to do stuff like this:
call L_strcmp$stub
        testl %eax, %eax
-       jne LBB26_208   #cond_true6020
-       jmp LBB26_227   #bb7119
+       je LBB26_227    #bb7119
 LBB26_208:     #cond_true6020
        movl $l31_str14, 4(%esp)

        testl %eax, %eax
-       jne LBB26_704   #cond_true13042
-       jmp LBB26_713   #bb13151
+       je LBB26_713    #bb13151
 LBB26_704:     #cond_true13042
        movl $_str52, 4(%esp)

        cmpl 76(%ecx), %eax
-       jge LBB26_1628  #cond_false63.i.i
-       jmp LBB26_1769  #_Z8makeGridP13mrSurfaceListidiidd.exit.i
+       jl LBB26_1769   #_Z8makeGridP13mrSurfaceListidiidd.exit.i
 LBB26_1628:    #cond_false63.i.i
        movl $0, 48964(%esp)

llvm-svn: 31100
2006-10-21 05:54:00 +00:00
Chris Lattner 3a897f31fa Implement support for branch condition reversal.
llvm-svn: 31099
2006-10-21 05:52:40 +00:00
Chris Lattner 3ca52185af Transform code like:
jle FOO
  jmp BAR
BAR:

into:

  jle FOO
BAR:

... whoa!

llvm-svn: 31098
2006-10-21 05:43:30 +00:00
Chris Lattner d881660366 Simplify code, no functionality change
llvm-svn: 31097
2006-10-21 05:42:09 +00:00
Chris Lattner 94e04442eb implement support for inserting a cond branch
llvm-svn: 31096
2006-10-21 05:36:13 +00:00
Chris Lattner 6fca75ec05 allow insertion of a conditional branch with fall-through
llvm-svn: 31095
2006-10-21 05:34:23 +00:00
Chris Lattner 4fe01c42ca Three changes:
1. Remove a bunch of ifdef'd code.
2. When a block just contains an uncond branch, change all blocks branching
   to it to jump to the destination instead.
3. If branch analysis tells us some edges in the machinecfg are not actually
   possible, remove them.

#2 triggers a suprisingly large number of times.

llvm-svn: 31094
2006-10-21 05:08:28 +00:00
Chris Lattner 20e75d4635 update assert message
llvm-svn: 31093
2006-10-21 04:42:29 +00:00
Chris Lattner 60c9d4dc76 Add an experimental cross-jumping implementation.
This is currently disabled by default and limited in several ways, but does
have a positive effect.

llvm-svn: 31090
2006-10-21 00:47:49 +00:00
Chris Lattner 33f5af09e4 implement MachineOperand::isIdenticalTo
llvm-svn: 31088
2006-10-20 22:39:59 +00:00
Chris Lattner af1222c1a7 llvm-extract should remove module-level asm
llvm-svn: 31086
2006-10-20 21:35:41 +00:00
Chris Lattner 8366b874a9 bugfix
llvm-svn: 31074
2006-10-20 20:44:34 +00:00
Chris Lattner 319c86fd38 Fix an ugly problem in SCCP. This fixes Benchmarks/Misc-C++/mandel-text.cpp
llvm-svn: 31073
2006-10-20 20:19:08 +00:00
Chris Lattner 5dee3b2526 Fix miscompilation of MallocBench/espresso which code review pointed out
but apparently didn't make it into the final patch.

llvm-svn: 31070
2006-10-20 18:20:21 +00:00
Chris Lattner c5ab6ce613 Make flag and chain edges visually distinguishable from value edges in DOT
output.

llvm-svn: 31067
2006-10-20 18:06:09 +00:00
Chris Lattner c0fb567e23 Implement branch analysis/xform hooks required by the branch folding pass.
llvm-svn: 31065
2006-10-20 17:42:20 +00:00
Reid Spencer e0fc4dfc22 For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.

llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Devang Patel 5d417e35bc While creating mask, use 1ULL instead of 1.
llvm-svn: 31062
2006-10-20 01:16:56 +00:00
Chris Lattner b8b11599dd Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform.
llvm-svn: 31061
2006-10-20 00:42:07 +00:00
Chris Lattner 23dd1f6325 add a method to determine whether evaluation of a constant can trap.
llvm-svn: 31059
2006-10-20 00:27:06 +00:00
Bill Wendling be96e1cd09 Partially in response to PR926: insert the newly created machine basic
blocks into the basic block list when lowering the switch inst. into a
binary tree of if-then statements. This allows the "visitSwitchCase" func
to allow for fall-through behavior.

llvm-svn: 31057
2006-10-19 21:46:38 +00:00
Devang Patel 5d6df959e3 It is OK to remove extra cast if operation is EQ/NE even though source
and destination sign may not match but other conditions are met.

llvm-svn: 31056
2006-10-19 20:59:13 +00:00
Devang Patel 88afd00d1d Typo Typo.
llvm-svn: 31055
2006-10-19 19:21:36 +00:00
Devang Patel 472530d9fc Typo.
llvm-svn: 31054
2006-10-19 19:05:38 +00:00
Devang Patel b42aef4925 Fix bug in PR454 resolution. Added new test case.
This fixes llvmAsmParser.cpp miscompile by llvm on PowerPC Darwin.

llvm-svn: 31053
2006-10-19 18:54:08 +00:00
Rafael Espindola 336d62e99a use Pat to implement extloadi8 and extloadi16
llvm-svn: 31052
2006-10-19 17:05:03 +00:00
Rafael Espindola f8274c0318 implement undef
llvm-svn: 31049
2006-10-19 13:45:00 +00:00
Rafael Espindola ea67b973c2 print common symbols
llvm-svn: 31048
2006-10-19 13:30:40 +00:00
Rafael Espindola ff62819e2f implement extloadi8 and extloadi16
llvm-svn: 31047
2006-10-19 12:45:04 +00:00
Rafael Espindola 3c563c5072 expand SIGN_EXTEND_INREG
llvm-svn: 31046
2006-10-19 12:06:50 +00:00
Rafael Espindola b260306625 expand brind so that we don't have to implement jump tables right now
llvm-svn: 31045
2006-10-19 10:56:43 +00:00
Reid Spencer 309e03aea2 Beef up the output from DiffFilesWithTolerance by setting the error code
to describe the difference being reported. This assists with understanding
differences an llvm-test and should help with bugpoint too.

llvm-svn: 31044
2006-10-18 20:23:52 +00:00
Jim Laskey 55e4dcad36 Add option for controlling inclusion of global AA.
llvm-svn: 31040
2006-10-18 19:08:31 +00:00
Chris Lattner f4aeff00c2 fit in 80 cols
llvm-svn: 31039
2006-10-18 18:26:48 +00:00
Chris Lattner 35a1471046 add a note
llvm-svn: 31038
2006-10-18 17:04:09 +00:00
Rafael Espindola bad440742e add blx
llvm-svn: 31037
2006-10-18 16:21:43 +00:00
Rafael Espindola 01dd97a8aa add isTerminatortto b and bcond
llvm-svn: 31036
2006-10-18 16:20:57 +00:00
Jim Laskey a15b0ebb5e Use global info for alias analysis.
llvm-svn: 31035
2006-10-18 12:29:57 +00:00
Rafael Espindola b21e8d2e12 implement CallingConv::Fast as CallingConv::C
llvm-svn: 31034
2006-10-18 12:03:07 +00:00
Anton Korobeynikov 24b7ac303c Fixed mingw\cygwin linkonce linkage once again.
Added workaround for linker bug with linkonce sections.
Changed sections prefix to allow linker merge them
(PE loader doesn't like too much long-named sections :) )
All of this unbreaks libstdc++ on mingw32 allowing (small)
programs to be compiled, linked and run.

llvm-svn: 31033
2006-10-18 09:12:29 +00:00
Owen Anderson 85690f3ba5 Add support for the new "target data" information in .ll files. This provides
a better encoding of the targets data layout, rather than trying to guess it
from the endianness and pointersize like before.

Update the generated files.

llvm-svn: 31031
2006-10-18 02:21:48 +00:00
Owen Anderson e223754ff4 Add support for the new "target data" information in .ll files. This provides
a better encoding of the targets data layout, rather than trying to guess it
from the endianness and pointersize like before.

llvm-svn: 31030
2006-10-18 02:21:12 +00:00
Chris Lattner 454436dcc5 set the ppc64 stack pointer right, dynamic alloca now works for ppc64
llvm-svn: 31028
2006-10-18 01:20:43 +00:00
Chris Lattner ab4df83426 Expand alloca for ppc64
llvm-svn: 31027
2006-10-18 01:18:48 +00:00
Chris Lattner 73da320e50 Teach the branch folder to update debug info if it removes blocks with line
# notes in it.

llvm-svn: 31026
2006-10-17 23:17:27 +00:00
Chris Lattner 34136d0cc1 add a method to remove a line # record.
llvm-svn: 31025
2006-10-17 23:16:42 +00:00
Chris Lattner 0408e5b7ce expose DWARF_LABEL opcode# so the branch folder can update debug info properly.
llvm-svn: 31024
2006-10-17 22:41:45 +00:00
Chris Lattner 145f6b3ec8 Do not leak all of the SourceLineInfo objects. Do not bother mallocing each
one separately.

llvm-svn: 31022
2006-10-17 22:06:46 +00:00
Chris Lattner 78fd0f83ff Trivial patch to speed up legalizing common i64 constants.
llvm-svn: 31020
2006-10-17 21:47:13 +00:00
Chris Lattner 327b88b102 Fix CodeGen/PowerPC/2006-10-17-brcc-miscompile.ll
llvm-svn: 31019
2006-10-17 21:24:15 +00:00
Evan Cheng 2f4ddce75c Fix printer for StoreSDNode.
llvm-svn: 31017
2006-10-17 21:18:26 +00:00
Evan Cheng 1839d76f69 Reflect MemOpAddrMode change; added a helper to create pre-indexed load.
llvm-svn: 31016
2006-10-17 21:14:32 +00:00
Rafael Espindola ba8f296167 expand ISD::SDIV, ISD::UDIV, ISD::SREM and ISD::UREM
llvm-svn: 31014
2006-10-17 21:05:33 +00:00
Rafael Espindola 3968263ca8 add the FPUnaryOp and DFPUnaryOp classes
llvm-svn: 31013
2006-10-17 20:45:22 +00:00
Rafael Espindola 99bf133d58 add FABSS and FABSD
llvm-svn: 31012
2006-10-17 20:33:13 +00:00
Anton Korobeynikov 75b01beb2f Adding linkonce linkage codegeneration support for mingw32\cygwin
targets.

llvm-svn: 31011
2006-10-17 20:29:49 +00:00
Jim Laskey e7d2c24a7d Make it simplier to dump DAGs while in DAGCombiner. Remove a nasty optimization.
llvm-svn: 31009
2006-10-17 19:33:52 +00:00
Rafael Espindola 2d7d14262a remove extra [] in stores
llvm-svn: 31008
2006-10-17 18:29:14 +00:00
Chris Lattner bca3e297fe Enable deleting branches to successor blocks. With the previous patches,
branch folding can now compile stuff like this:

void foo(int W, int X, int Y, int Z) {
  if (W & 1) {
    for (; X;--X) bar();
  } else if (W & 2) {
    for (; Y;--Y) bar();
  } else if (W & 4) {
    for (; Z;--Z) bar();
  } else if (W & 8) {
    for (; W;--W) bar();
  }

  if (W) {
    bar();
  }
}

contrived testcase where loops exits all end up merging together.  To have
the loop merges be:

...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...

instead of:


...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
        b LBB1_20       ;cond_next48
LBB1_17:        ;cond_next48.loopexit1
        b LBB1_20       ;cond_next48
LBB1_18:        ;cond_next48.loopexit2
        b LBB1_20       ;cond_next48
LBB1_19:        ;cond_next48.loopexit3
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...


This is CodeGen/PowerPC/branch-opt.ll

llvm-svn: 31006
2006-10-17 18:16:40 +00:00
Chris Lattner a61f0105bd add support for inserting an uncond branch
llvm-svn: 31003
2006-10-17 18:06:55 +00:00
Rafael Espindola 19398ec86e initial implementation of addressing mode 5
llvm-svn: 31002
2006-10-17 18:04:53 +00:00
Jim Laskey d24b913a61 Clean up interface to getGlobalLinkName.
llvm-svn: 31001
2006-10-17 17:17:24 +00:00
Chris Lattner 56c9d2597e Reenable this pass, fixing the bugs in it.
It now correctly deletes unreachable blocks and blocks that are empty.

llvm-svn: 31000
2006-10-17 17:13:52 +00:00
Evan Cheng 1e3a39cd08 Make sure operand does have size and element type operands.
llvm-svn: 30999
2006-10-17 17:06:35 +00:00
Rafael Espindola feb50708eb add the immediate to the Offset in eliminateFrameIndex
llvm-svn: 30998
2006-10-17 14:34:02 +00:00
Jim Laskey 7126254a0e Basic support for getGlobalLinkName.
llvm-svn: 30997
2006-10-17 13:41:07 +00:00
Rafael Espindola 418c8e69bb add FSTD and FSTS
llvm-svn: 30996
2006-10-17 13:36:07 +00:00
Rafael Espindola c31ee94920 add FCPYS and FCPYD
llvm-svn: 30995
2006-10-17 13:13:23 +00:00
Jim Laskey 2794184191 Use S_debug for dwarf info.
llvm-svn: 30994
2006-10-17 11:30:57 +00:00
Evan Cheng a3e1ad7a61 Proper fix.
llvm-svn: 30993
2006-10-17 00:24:49 +00:00
Evan Cheng ed60d16ac7 One more try.
llvm-svn: 30992
2006-10-16 23:44:08 +00:00
Reid Spencer 3c514959dd Undo Chris' last patch, it caused a regression.
llvm-svn: 30991
2006-10-16 23:08:08 +00:00
Evan Cheng 1367ff084d Unbreak x86-64 build.
llvm-svn: 30990
2006-10-16 22:53:28 +00:00
Evan Cheng f3ae00a64a Be careful when looking through a vbit_convert. Optimizing this:
(vector_shuffle
  (vbitconvert (vbuildvector (copyfromreg v4f32), 1, v4f32), 4, f32),
  (undef, undef, undef, undef), (0, 0, 0, 0), 4, f32)
to the
  vbitconvert
is a very bad idea.

llvm-svn: 30989
2006-10-16 22:49:37 +00:00
Rafael Espindola afdd47ace4 add fdivs e fdivd
llvm-svn: 30988
2006-10-16 21:50:04 +00:00
Rafael Espindola f719c5f43d expand ISD::SHL_PARTS, ISD::SRA_PARTS and ISD::SRL_PARTS
llvm-svn: 30987
2006-10-16 21:10:32 +00:00
Evan Cheng afb610468b Added a X86CompilationCallback variant which saves XMM argument registers for targets with SSE.
llvm-svn: 30986
2006-10-16 21:01:55 +00:00
Evan Cheng a8b4aeace0 Proper fix for rdar://problem/4770604 Thanks to Stuart Hastings!
llvm-svn: 30985
2006-10-16 21:00:37 +00:00
Jim Laskey dcb2b83886 Pass AliasAnalysis thru to DAGCombiner.
llvm-svn: 30984
2006-10-16 20:52:31 +00:00
Jim Laskey 9db3a08864 Global name regression.
llvm-svn: 30982
2006-10-16 19:38:41 +00:00
Rafael Espindola e341d60f53 define the DFPBinOp class
llvm-svn: 30981
2006-10-16 18:39:22 +00:00
Rafael Espindola f63752f94b add the FPBinOp class
llvm-svn: 30980
2006-10-16 18:32:36 +00:00
Rafael Espindola b23dc14135 define the Addr1BinOp class
llvm-svn: 30979
2006-10-16 18:18:14 +00:00
Rafael Espindola 203922d083 define the IntBinOp class and use it to implement the multiply instructions
llvm-svn: 30978
2006-10-16 17:57:20 +00:00
Rafael Espindola c4abf8dc5b fix assembly syntax
llvm-svn: 30977
2006-10-16 17:38:12 +00:00
Rafael Espindola 677ee8390d implement LDRB, LDRSB, LDRH and LDRSH
llvm-svn: 30976
2006-10-16 17:17:22 +00:00
Rafael Espindola 595dc4c884 implement smull and umull
llvm-svn: 30975
2006-10-16 16:33:29 +00:00
Evan Cheng 949bcc94ea Avoid getting into an infinite loop when -disable-x86-shuffle-opti is specified.
llvm-svn: 30974
2006-10-16 06:36:00 +00:00
Evan Cheng ff1a712794 SelectScalarSSELoad should call CanBeFoldedBy as well.
llvm-svn: 30973
2006-10-16 06:34:55 +00:00
Chris Lattner ff20ba3f51 regenerate
llvm-svn: 30971
2006-10-15 23:27:25 +00:00
Chris Lattner aad30b7804 Produce a useful error message for Regression/Verifier/2006-10-15-AddrLabel.ll
llvm-svn: 30970
2006-10-15 23:26:46 +00:00
Chris Lattner 04e71c6e4d label* is not a valid type, add an assertion.
llvm-svn: 30968
2006-10-15 23:21:12 +00:00
Chris Lattner 9a1c7dd27a fix a buggy check that accidentally disabled this xform
llvm-svn: 30967
2006-10-15 22:42:15 +00:00
Anton Korobeynikov 34e051d537 Align stack size to DWORD boundary
llvm-svn: 30964
2006-10-14 20:53:35 +00:00
Rafael Espindola 2b7f635951 expand ISD::BRCOND
llvm-svn: 30963
2006-10-14 17:59:54 +00:00
Rafael Espindola 4c1baf1528 fix some fp condition codes
use non trapping comparison instructions

llvm-svn: 30962
2006-10-14 13:42:53 +00:00
Jim Laskey 3bf4f3bd60 Tidy up after truncstore changes.
llvm-svn: 30961
2006-10-14 12:14:27 +00:00
Evan Cheng 47fbeda5ce Debug tweak.
llvm-svn: 30959
2006-10-14 08:34:06 +00:00
Evan Cheng b86375cfd0 Corrected load folding check. We need to start from the root of the sub-dag
being matched and ensure there isn't a non-direct path to the load (i.e. a
path that goes out of the sub-dag.)

llvm-svn: 30958
2006-10-14 08:33:25 +00:00
Chris Lattner 6a1b2de8c4 Make sure that the node returned by SimplifySetCC is added to the worklist
so that it can be deleted if unused.

llvm-svn: 30955
2006-10-14 03:52:46 +00:00
Chris Lattner 0626bd2fbc fold setcc of a setcc.
llvm-svn: 30953
2006-10-14 01:02:29 +00:00
Chris Lattner bd9acad805 When SimplifySetCC was moved to the DAGCombiner, it was never removed from
SelectionDAG and it has since bitrotted.  Remove the copy from SelectionDAG.
Next, remove the constant folding piece of DAGCombiner::SimplifySetCC into
a new FoldSetCC method which can be used by getNode() and SimplifySetCC.

This fixes obscure bugs.

llvm-svn: 30952
2006-10-14 00:41:01 +00:00
Chris Lattner 47db29a405 disable this pass for now, it's causing issues
llvm-svn: 30951
2006-10-14 00:30:06 +00:00
Chris Lattner 3218e0eed5 falling off the end of a function is ok with an unreachable instruction.
llvm-svn: 30950
2006-10-14 00:21:48 +00:00
Jim Laskey dcf983ce41 Reduce the workload by not adding chain users to work list.
llvm-svn: 30948
2006-10-13 23:32:28 +00:00
Chris Lattner 45ffb1eb70 Fix a bug where we incorrectly turned '(X & 0) == 0' into '(X & 0) >> -1',
which is undefined.  "0" isn't a power of 2.

llvm-svn: 30947
2006-10-13 22:46:18 +00:00
Chris Lattner a47294ed7a implement branch inspection/modification methods.
llvm-svn: 30946
2006-10-13 21:21:17 +00:00
Evan Cheng ab51cf2e78 Merge ISD::TRUNCSTORE to ISD::STORE. Switch to using StoreSDNode.
llvm-svn: 30945
2006-10-13 21:14:26 +00:00
Chris Lattner 55ad08a59b add the branch folding pass as a late cleanup pass for all targets. For now
it just deletes empty MBB's.  Soon it will do more :)

llvm-svn: 30941
2006-10-13 20:45:56 +00:00
Chris Lattner 3e8e57c771 disable some objectionable code, maybe we can bring this pass to life
llvm-svn: 30939
2006-10-13 20:43:10 +00:00