Commit Graph

11097 Commits

Author SHA1 Message Date
Brian Gaeke 0c76d1146f Asm output is looking a lot better; not correct for all operands yet though.
llvm-svn: 12143
2004-03-05 08:39:09 +00:00
Chris Lattner 6c271edcd7 Fix a bug in a previous checkin that broke 175.vpr
llvm-svn: 12128
2004-03-04 21:36:57 +00:00
Chris Lattner bc3381f267 Add support for strto* and v*printf
llvm-svn: 12127
2004-03-04 21:03:54 +00:00
Chris Lattner 0ed8162c1a Add non-crappy support for varargs
llvm-svn: 12126
2004-03-04 20:33:47 +00:00
Chris Lattner 3562ea84ab Implement a FIXME, improving the efficiency of DSA on povray.
This reduces CBU time from 145s -> 122s (debug build), reduces # allocated nodes
from 129420 to 116477.

llvm-svn: 12125
2004-03-04 19:47:04 +00:00
Brian Gaeke 9c609df3c9 Support -print-machineinstrs
llvm-svn: 12124
2004-03-04 19:22:16 +00:00
Chris Lattner 30f94a72f4 Speed up the cbu pass from taking somewhere near the age of the universe to about 90s on povray
llvm-svn: 12123
2004-03-04 19:16:35 +00:00
Brian Gaeke 8351d8c1a8 make -print-machineinstrs work for both SparcV9 and X86
llvm-svn: 12122
2004-03-04 19:16:23 +00:00
Alkis Evlogimenos b9501c1f8c Add assertion for scale verification.
llvm-svn: 12120
2004-03-04 18:05:02 +00:00
Alkis Evlogimenos 8a4159708b Fix bug introduced by yesterday's changes.
llvm-svn: 12119
2004-03-04 18:02:07 +00:00
Alkis Evlogimenos 33cb4260a5 Hide variable from other functions.
llvm-svn: 12118
2004-03-04 17:50:44 +00:00
Chris Lattner 536b131c9c Fix BU datastructures with povray!
The problem was that we were merging a field of a node with a value that was
deleted.  Thanks to bugpoint for reducing povray to a nice small 3 function
example.  :)

llvm-svn: 12116
2004-03-04 17:06:53 +00:00
Chris Lattner 8db52980b7 Minor changes, remove some debugging code that got checked in somehow.
Make sure to scope the NodeMap passed into cloneInto so that it doesn't point
to nodes that are deleted.  Add some FIXME's for future performance enhancements.

llvm-svn: 12115
2004-03-04 17:05:28 +00:00
Brian Gaeke 82ec4a561b Asm printer support, based on x86 - only prints mnemonics for now
llvm-svn: 12113
2004-03-04 06:00:41 +00:00
Brian Gaeke 8ace44fe0d Double-FP pseudo-registers.
llvm-svn: 12112
2004-03-04 05:15:03 +00:00
Brian Gaeke 92c95f812d Subtract instructions; minor cleanups
llvm-svn: 12111
2004-03-04 04:37:45 +00:00
Brian Gaeke d2e89190d9 Floating point regs
llvm-svn: 12110
2004-03-04 04:37:22 +00:00
Chris Lattner f48eb7519a Only clone nodes that are needed in the caller, don't clone ALL aux calls. This improves
povray from having ~600K nodes and 300K call nodes to 65K nodes and 25K call nodes.

llvm-svn: 12109
2004-03-04 03:57:53 +00:00
Brian Gaeke 956fb06a4a Simple copyConstantToReg support, SETHIi and ORri
llvm-svn: 12107
2004-03-04 00:56:25 +00:00
Brian Gaeke 165ff998e0 Support add - note, still missing important copyConstantToRegister stuff
llvm-svn: 12106
2004-03-03 23:03:14 +00:00
Chris Lattner 559487301f Fix a minor bug handling incomplete programs
llvm-svn: 12105
2004-03-03 23:00:19 +00:00
Chris Lattner d9da2678fc Fix a DSA bug that caused DSA to generate incredibly huge graphs and take forever to
do it on povray.  The problem is that we were not copying globals from callees to
callers unless the existed in both graphs.  We should have copied them in the case
where the global pointed to a node that was copied as well.

llvm-svn: 12104
2004-03-03 22:01:09 +00:00
Chris Lattner 91be5332b2 Rename method, add new method
llvm-svn: 12103
2004-03-03 22:00:20 +00:00
Chris Lattner 5fc189157c Deinline methods, add fast exit
llvm-svn: 12102
2004-03-03 20:55:27 +00:00
Chris Lattner 06bd20676d De-inline methods
llvm-svn: 12101
2004-03-03 20:55:15 +00:00
Brian Gaeke 015972103d Make MachineOperand's value named 'contents'. Make really, really sure
it is always completely initialized and copied.
Also, fix up many comments and asserts.

llvm-svn: 12100
2004-03-03 19:07:27 +00:00
Brian Gaeke 3001c6e264 Squash /usr/dcs path; use a 'require <version>' instead.
llvm-svn: 12099
2004-03-03 17:38:51 +00:00
Brian Gaeke c0c260dd37 Add my regression finding by binary searching cvs script.
llvm-svn: 12095
2004-03-03 08:14:25 +00:00
Chris Lattner 140b2cbd28 Fix a node mapping problem that was causing the pool allocator to locally allocate
nodes that were globally live, thus breaking programs.

llvm-svn: 12094
2004-03-03 05:34:31 +00:00
Chris Lattner 93e9878c2c SPECIFY a target data to initialize the CBE target with. Until now we have
been using the default target data layout object to lower malloc instructions,
causing us to allocate more memory than we needed!  This could improve the
performance of the CBE generated code substantially!

llvm-svn: 12088
2004-03-03 02:14:15 +00:00
Chris Lattner 87ed2a4096 Add a new constructor
llvm-svn: 12087
2004-03-03 02:12:47 +00:00
Chris Lattner 7abcc387de Don't emit things like malloc(16*1). Allocation instructions are fixed arity now.
llvm-svn: 12086
2004-03-03 01:40:53 +00:00
Chris Lattner 2e92b469c8 FINALLY be able to get symbolic type names in the globals graph!
llvm-svn: 12082
2004-03-02 21:39:43 +00:00
Chris Lattner 9e100fc3f7 Really, only if reopen
llvm-svn: 12080
2004-03-02 20:46:18 +00:00
John Criswell 626f47f946 Added EH support.
llvm-svn: 12075
2004-03-02 15:54:25 +00:00
Alkis Evlogimenos cb8937197e Make <di> into <dt> (definition list term).
llvm-svn: 12072
2004-03-02 03:36:10 +00:00
Misha Brukman c566ca36a1 Doxygenify comments.
llvm-svn: 12071
2004-03-02 00:22:19 +00:00
Misha Brukman f44acae31e Implement ExtractCodeRegion()
llvm-svn: 12070
2004-03-02 00:20:57 +00:00
Misha Brukman 1998b73492 Add prototype for ExtractCodeRegion()
llvm-svn: 12069
2004-03-02 00:20:32 +00:00
Misha Brukman f272f9b3d5 Make a note that this is usually used via bugpoint.
llvm-svn: 12068
2004-03-02 00:19:09 +00:00
Misha Brukman a6025e6480 Doxygenify some comments.
llvm-svn: 12064
2004-03-01 23:53:11 +00:00
Alkis Evlogimenos 45da18d2a4 Fix <p> missing <p> tag
llvm-svn: 12063
2004-03-01 23:25:38 +00:00
Alkis Evlogimenos 31953c7a10 Add a spiller option to llc. A simple spiller will come soon. When we get CFG in the machine code represenation a global spiller will also be possible. Also document the linear scan register allocator but mark it as experimental for now.
llvm-svn: 12062
2004-03-01 23:18:15 +00:00
Alkis Evlogimenos b76d234ee9 Add the long awaited memory operand folding support for linear scan
llvm-svn: 12058
2004-03-01 20:05:10 +00:00
Misha Brukman b22d09cc5e * If a badref has a name, print it out for ease of debugging
* Doxygenify (some) comments

llvm-svn: 12057
2004-03-01 19:48:13 +00:00
Chris Lattner d86982547f Add new method
llvm-svn: 12056
2004-03-01 19:36:50 +00:00
Chris Lattner c8d23b19fb Correctly add an array marker on a node when appropriate!
llvm-svn: 12055
2004-03-01 19:02:54 +00:00
Misha Brukman 88cc178e3b Fix grammar and doxygenify comments.
llvm-svn: 12054
2004-03-01 18:31:19 +00:00
Misha Brukman 5af2be7d09 * Add implementation of ExtractBasicBlock()
* Add comments to ExtractLoop()

llvm-svn: 12053
2004-03-01 18:28:34 +00:00
Misha Brukman f68f121dd3 Add ability to extract a single basic block into a new function.
llvm-svn: 12052
2004-03-01 18:27:13 +00:00
Misha Brukman 773d6f66db * HTML 4.01 Strict compliance
* Removed unnecessary tabs in the entire file

llvm-svn: 12051
2004-03-01 18:21:04 +00:00
Misha Brukman c501f5530b HTML 4.01 Strict compliance.
llvm-svn: 12050
2004-03-01 17:47:27 +00:00
Chris Lattner f96405a1ce Add this back, as its absence introduces assertions, and it seems to work now
that Instructions are annotable again

llvm-svn: 12045
2004-03-01 15:28:27 +00:00
Tanya Lattner e63e8ea884 fix bug in previous checkin
llvm-svn: 12044
2004-03-01 15:05:17 +00:00
Brian Gaeke 427cec1395 TargetCacheInfo has been removed; its only uses were to propagate a constant
(16) into certain areas of the SPARC V9 back-end. I'm fairly sure the US IIIi's
dcache has 32-byte lines, so I'm not sure where the 16 came from. However, in
the interest of not breaking things any more than they already are, I'm going
to leave the constant alone.

llvm-svn: 12043
2004-03-01 06:43:29 +00:00
Tanya Lattner 48a503be04 Adding new Modulo Scheduling graph files.
llvm-svn: 12031
2004-03-01 02:50:57 +00:00
Tanya Lattner dd10fbe775 Removing old graph files with new graph files that I wrote. Updated ModuloScheduling pass, but still in progress.
llvm-svn: 12030
2004-03-01 02:50:01 +00:00
Chris Lattner 6f6e0f29ad Expand on my note-to-self
llvm-svn: 12029
2004-03-01 02:44:44 +00:00
Chris Lattner 1f4642c47c Handle passing constant integers to functions much more efficiently. Instead
of generating this code:

        mov %EAX, 4
        mov DWORD PTR [%ESP], %EAX
        mov %AX, 123
        movsx %EAX, %AX
        mov DWORD PTR [%ESP + 4], %EAX
        call Y

we now generate:
        mov DWORD PTR [%ESP], 4
        mov DWORD PTR [%ESP + 4], 123
        call Y

Which hurts the eyes less.  :)

Considering that register pressure around call sites is already high (with all
of the callee clobber registers n stuff), this may help a lot.

llvm-svn: 12028
2004-03-01 02:42:43 +00:00
Brian Gaeke b19dcc6651 Don't look in the .libs directories that libtool makes
llvm-svn: 12027
2004-03-01 02:41:22 +00:00
Chris Lattner 5c7d3cda78 Fix a minor code-quality issue. When passing 8 and 16-bit integer constants
to function calls, we would emit dead code, like this:

int Y(int, short, double);
int X() {
  Y(4, 123, 4);
}

--- Old
X:
        sub %ESP, 20
        mov %EAX, 4
        mov DWORD PTR [%ESP], %EAX
***     mov %AX, 123
        mov %AX, 123
        movsx %EAX, %AX
        mov DWORD PTR [%ESP + 4], %EAX
        fld QWORD PTR [.CPIX_0]
        fstp QWORD PTR [%ESP + 8]
        call Y
        mov %EAX, 0
        # IMPLICIT_USE %EAX %ESP
        add %ESP, 20
        ret

Now we emit:
X:
        sub %ESP, 20
        mov %EAX, 4
        mov DWORD PTR [%ESP], %EAX
        mov %AX, 123
        movsx %EAX, %AX
        mov DWORD PTR [%ESP + 4], %EAX
        fld QWORD PTR [.CPIX_0]
        fstp QWORD PTR [%ESP + 8]
        call Y
        mov %EAX, 0
        # IMPLICIT_USE %EAX %ESP
        add %ESP, 20
        ret

Next up, eliminate the mov AX and movsx entirely!

llvm-svn: 12026
2004-03-01 02:34:08 +00:00
Chris Lattner 482cf01a1e Fix the "partial pool allocator" on em3d and others. The problem is that
DSNodes, unlike other GraphTraits nodes, can have null outgoing edges, and
df_iterator doesn't take this into consideration.  As a workaround, the
successor iterator now handles null nodes and 'indicates' that null has
no successors.

llvm-svn: 12025
2004-03-01 01:42:26 +00:00
Chris Lattner b4c203ce67 Make Module annotable. Reid has a bunch of code that depends on this, and
we really don't win that much by eliminating this (not many Modules are
allocated), so it's not worth it.  When we can, we should revisit this in
the future.

llvm-svn: 12023
2004-03-01 01:25:37 +00:00
Chris Lattner 5cf39339d1 Disable tail duplication in a case that breaks on Olden/tsp
llvm-svn: 12021
2004-03-01 01:12:13 +00:00
Misha Brukman 2a4c5b050e Doxygenify comments.
llvm-svn: 12015
2004-02-29 23:55:11 +00:00
Misha Brukman c91e1ff50d * Remove function to find "main" in a Module, there's a method for that
* Removing extraneous empty space and empty comment lines

llvm-svn: 12014
2004-02-29 23:09:10 +00:00
Chris Lattner 43640d7138 Fix -debug-pass=Executions, which relied on Function, Module, and BasicBlock
being annotable

llvm-svn: 12013
2004-02-29 22:37:04 +00:00
Chris Lattner 2de229f31b Fix bug: test/Regression/Transforms/LowerInvoke/2004-02-29-PHICrash.llx
... which tickled the lowerinvoke pass because it used the BCE routines.

llvm-svn: 12012
2004-02-29 22:24:41 +00:00
Chris Lattner 9c9a4c4abd Testcase for a bug that caused a whole bunch of testcases to die in the nightly
tester last night.

llvm-svn: 12011
2004-02-29 22:15:51 +00:00
Chris Lattner 604cc83933 Add an assert
llvm-svn: 12010
2004-02-29 22:01:51 +00:00
Chris Lattner e0c3c18802 Add back #include I messed up
llvm-svn: 12009
2004-02-29 21:40:53 +00:00
Chris Lattner 90ecb92838 Urg, forgot to check this in.
llvm-svn: 12007
2004-02-29 21:03:08 +00:00
Chris Lattner f2bb31c5fd Module does not need to be annotatable aka annotable
llvm-svn: 12005
2004-02-29 19:27:55 +00:00
Chris Lattner fcb4f9d00b Remove public header. It's been moved to lib/Target/SparcV9
llvm-svn: 12004
2004-02-29 19:13:20 +00:00
Chris Lattner 3859031b9b Move the private MachineInstrAnnot.h into a private directory.
llvm-svn: 12003
2004-02-29 19:12:51 +00:00
Chris Lattner d5a49c477d Remove use of an ugly header
llvm-svn: 12002
2004-02-29 19:04:31 +00:00
Chris Lattner 6194ee84ba Move methods out of .h file
llvm-svn: 12001
2004-02-29 19:02:39 +00:00
Chris Lattner 23840c7db5 Do not use explicit casts that hide the dependence on Instruction being
annotable

llvm-svn: 12000
2004-02-29 19:02:26 +00:00
Chris Lattner 79b8d467da Ugh, the old sparc backend attaches MachineCodeForInstruction annotations on
LLVM instructions.  Because it contains an explicit cast, we didn't catch it.
I guess instruction's will be annotable for the duration of the sparcv9's
existence.

llvm-svn: 11999
2004-02-29 18:54:23 +00:00
Alkis Evlogimenos 9a4653edfa Add instruction name description.
llvm-svn: 11998
2004-02-29 18:44:03 +00:00
Alkis Evlogimenos 0824ffc697 Use correct template for SHLD and SHRD instructions so that the memory
operand size is correctly specified.

llvm-svn: 11997
2004-02-29 09:19:40 +00:00
Alkis Evlogimenos c7fd0770a0 Improve allocation order:
1) For 8-bit registers try to use first the ones that are parts of the
   same register (AL then AH). This way we only alias 2 16/32-bit
   registers after allocating 4 8-bit variables.

2) Move EBX as the last register to allocate. This will cause less
   spills to happen since we will have 8-bit registers available up to
   register excaustion (assuming we use the allocation order). It
   would be nice if we could push all of the 8-bit aliased registers
   towards the end but we much prefer to keep callee saved register to
   the end to avoid saving them on entry and exit of the function.

For example this gives a slight reduction of spills with linear scan
on 164.gzip.

Before:

11221 asm-printer           - Number of machine instrs printed
  975 spiller               - Number of loads added
  675 spiller               - Number of stores added
  398 spiller               - Number of register spills

After:

11182 asm-printer           - Number of machine instrs printed
  952 spiller               - Number of loads added
  652 spiller               - Number of stores added
  386 spiller               - Number of register spills

llvm-svn: 11996
2004-02-29 09:17:01 +00:00
Alkis Evlogimenos ea81b79a97 A big X86 instruction rename. The instructions are renamed to make
their names more decriptive. A name consists of the base name, a
default operand size followed by a character per operand with an
optional special size. For example:

ADD8rr -> add, 8-bit register, 8-bit register

IMUL16rmi -> imul, 16-bit register, 16-bit memory, 16-bit immediate

IMUL16rmi8 -> imul, 16-bit register, 16-bit memory, 8-bit immediate

MOVSX32rm16 -> movsx, 32-bit register, 16-bit memory

llvm-svn: 11995
2004-02-29 08:50:03 +00:00
Brian Gaeke 2f80d586b8 Remove dead member variables of SparcV9SchedInfo and TargetSchedInfo
llvm-svn: 11994
2004-02-29 08:40:03 +00:00
Chris Lattner 1e36fb030c Eliminate the X86-specific BMI functions, using BuildMI instead.
Replace uses of addZImm with addImm.

llvm-svn: 11992
2004-02-29 07:22:16 +00:00
Chris Lattner 9a97573267 Fix a miscompilation of 197.parser that occurs when you have single basic
block loops.

llvm-svn: 11990
2004-02-29 07:10:16 +00:00
Chris Lattner bf2963ef91 Fix PR255: [tailduplication] Single basic block loops are very rare
Note that this is a band-aid put over a band-aid.  This just undisables
tail duplication in on very specific case that it seems to work in.

llvm-svn: 11989
2004-02-29 06:41:20 +00:00
Brian Gaeke d470a0f042 Update comment at head of file. Also fix C 'typedef struct' nonsense I
inadvertently left in here.

llvm-svn: 11988
2004-02-29 06:33:28 +00:00
Chris Lattner ed01da8f0b Adjust to change in TII ctor arguments
llvm-svn: 11987
2004-02-29 06:31:44 +00:00
Chris Lattner f20abac9bc Eliminate the distinction between "real" and "unreal" instructions
llvm-svn: 11986
2004-02-29 06:31:16 +00:00
Brian Gaeke e65125dcdf Add more architectures, and ELF64 stuff.
llvm-svn: 11985
2004-02-29 06:30:25 +00:00
Chris Lattner ca89812db7 These two virtual methods are never called.
llvm-svn: 11984
2004-02-29 05:59:33 +00:00
Chris Lattner 71a899dea6 Remove a TON of flags that noone cares about
llvm-svn: 11983
2004-02-29 05:58:30 +00:00
Chris Lattner 59d9e9126d Noone calls these virtual methods
llvm-svn: 11982
2004-02-29 05:58:16 +00:00
Chris Lattner 79d9a93a71 This is the only file in the system that uses this enum. eliminate it.
llvm-svn: 11981
2004-02-29 05:57:59 +00:00
Chris Lattner f611ca055c Scrap a huge layer of cruft out of this interface.
llvm-svn: 11980
2004-02-29 05:57:21 +00:00
Chris Lattner e5f08917ae Implement initial prolog/epilog code insertion methods.
llvm-svn: 11979
2004-02-29 05:18:30 +00:00
Chris Lattner 5e7b3180e5 Remove unneeded #include
llvm-svn: 11978
2004-02-29 05:15:56 +00:00
Chris Lattner 44b1b22a2d int64_t -> int
llvm-svn: 11977
2004-02-29 05:07:02 +00:00
Chris Lattner a33f2b3731 Continue Alkis's int64_t cleanup. This makes all of the immediate related
methods take an int or unsigned value instead of int64_t.

Also, add an 'addImm' method to the MachineInstrBuilder class, because the
fact that the hardware sign or zero extends it does not/should not matter
to the code generator.  Once the old sparc backend is removed the difference
can be eliminated.

llvm-svn: 11976
2004-02-29 05:06:49 +00:00
Chris Lattner 349b8c928d Add BuildMI variants that take a MBB::iterator
llvm-svn: 11975
2004-02-29 04:55:28 +00:00
Alkis Evlogimenos 876f6f96d0 Use correct template for ADC instruction with memory operands.
llvm-svn: 11974
2004-02-29 02:18:17 +00:00
Chris Lattner b1862e4d3b Add an instruction selector capable of selecting 'ret void'
llvm-svn: 11973
2004-02-29 00:27:00 +00:00
Alkis Evlogimenos fa63580517 SHLD and SHRD take 32-bit operands but an 8-bit immediate. Rename them
to denote this fact.

llvm-svn: 11972
2004-02-28 23:46:44 +00:00
Alkis Evlogimenos 4953ae085a Floating point loads/stores act on memory operands. Rename them to
denote this fact.

llvm-svn: 11971
2004-02-28 23:42:35 +00:00
Alkis Evlogimenos c6948fa762 Rename instruction templates to be easier to the human eye to
parse. The name is now I (operand size)*. For example:

Im32 -> instruction with 32-bit memory operands.

Im16i8 -> instruction with 16-bit memory operands and 8 bit immediate
          operands.

llvm-svn: 11970
2004-02-28 23:09:03 +00:00
Alkis Evlogimenos 5b5dee4afb Uncomment instructions that take both an immediate and a memory
operand but their sizes differ.

llvm-svn: 11969
2004-02-28 22:06:59 +00:00
Brian Gaeke c0f3741a16 Fix my sloppiness
llvm-svn: 11968
2004-02-28 22:06:03 +00:00
Alkis Evlogimenos 194939086d Each instruction now has both an ImmType and a MemType. This describes
the size of the immediate and the memory operand on instructions that
use them. This resolves problems with instructions that take both a
memory and an immediate operand but their sizes differ (i.e. ADDmi32b).

llvm-svn: 11967
2004-02-28 22:02:05 +00:00
Brian Gaeke 465a5cc291 Fix typo in comment
llvm-svn: 11966
2004-02-28 21:55:18 +00:00
Chris Lattner c116ede471 Add a testcase for switch instruction induction
llvm-svn: 11965
2004-02-28 21:30:39 +00:00
Chris Lattner d3e6ae263c Implement switch->br and br->switch folding by ripping out the switch->switch
and br->br code and generalizing it.  This allows us to compile code like this:

int test(Instruction *I) {
  if (isa<CastInst>(I))
    return foo(7);
  else if (isa<BranchInst>(I))
    return foo(123);
  else if (isa<UnwindInst>(I))
    return foo(1241);
  else if (isa<SetCondInst>(I))
    return foo(1);
  else if (isa<VAArgInst>(I))
    return foo(42);
  return foo(-1);
}

into:

int %_Z4testPN4llvm11InstructionE("struct.llvm::Instruction"* %I) {
entry:
        %tmp.1.i.i.i.i.i.i.i = getelementptr "struct.llvm::Instruction"* %I, long 0, ubyte 4            ; <uint*> [#uses=1]
        %tmp.2.i.i.i.i.i.i.i = load uint* %tmp.1.i.i.i.i.i.i.i          ; <uint> [#uses=2]
        %tmp.2.i.i.i.i.i.i = seteq uint %tmp.2.i.i.i.i.i.i.i, 27                ; <bool> [#uses=0]
        switch uint %tmp.2.i.i.i.i.i.i.i, label %endif.0 [
                 uint 27, label %then.0
                 uint 2, label %then.1
                 uint 5, label %then.2
                 uint 14, label %then.3
                 uint 15, label %then.3
                 uint 16, label %then.3
                 uint 17, label %then.3
                 uint 18, label %then.3
                 uint 19, label %then.3
                 uint 32, label %then.4
        ]
...

As well as handling the cases in 176.gcc and many other programs more effectively.

llvm-svn: 11964
2004-02-28 21:28:10 +00:00
Chris Lattner 72bb8fcb15 Change this so that LLC actually tries to run the code generator, though it will
immediately abort due to lack of an instruction selector. :)

llvm-svn: 11963
2004-02-28 20:21:45 +00:00
Chris Lattner 72170c4a2e Add a hook to run with the V8 target, though it doesn't currently work. Also
mark the PPC backend as experimental

llvm-svn: 11962
2004-02-28 19:55:16 +00:00
Chris Lattner fc5232ba3a Add hook for V8 target
llvm-svn: 11961
2004-02-28 19:54:16 +00:00
Chris Lattner 990c279f5c SparcV8 now builds.
llvm-svn: 11960
2004-02-28 19:54:00 +00:00
Chris Lattner daeeaa72cd fine grainify namespacification
llvm-svn: 11959
2004-02-28 19:53:18 +00:00
Chris Lattner 1a3ee3e961 Finegrainify namespacification
llvm-svn: 11958
2004-02-28 19:52:49 +00:00
Chris Lattner e40fd90b0b Tab completion is our friend.
llvm-svn: 11957
2004-02-28 19:45:39 +00:00
Chris Lattner 0179fb5881 Clean up rules
llvm-svn: 11956
2004-02-28 19:43:40 +00:00
Chris Lattner 74598091a1 Bring this directory into "it actually compiles" land
llvm-svn: 11955
2004-02-28 19:37:18 +00:00
Chris Lattner 3290952f8b Fix multiple inclusion problem
llvm-svn: 11954
2004-02-28 19:31:32 +00:00
Chris Lattner 772eafa332 if there is already a prototype for malloc/free, use it, even if it's incorrect.
Do not just inject a new prototype.

llvm-svn: 11951
2004-02-28 18:51:45 +00:00
Chris Lattner 36326de312 Do not remove an active template argument even if the superclass had one of the
same name

llvm-svn: 11950
2004-02-28 17:41:48 +00:00
Chris Lattner 178f0f1405 fix a bug in the testcase
llvm-svn: 11949
2004-02-28 17:33:21 +00:00
Chris Lattner 994f2d1406 Ignore X = X assignments that was causing Alkis's rewrite of X86.td to crash
tblgen.

llvm-svn: 11948
2004-02-28 17:31:28 +00:00
Chris Lattner 1ddddf536a new testcase for a tblgen bug that alkis ran into
llvm-svn: 11947
2004-02-28 16:43:44 +00:00
Chris Lattner d959ab9208 Assert instead of going into an infinite loop!
llvm-svn: 11946
2004-02-28 16:31:53 +00:00
Brian Gaeke 18577345aa ELF constants and data structures.
llvm-svn: 11945
2004-02-28 06:26:20 +00:00
Alkis Evlogimenos 2debead504 Do not generate instructions with mismatched memory/immediate sized
operands. The X86 backend doesn't handle them properly right now.

llvm-svn: 11944
2004-02-28 06:01:43 +00:00
Chris Lattner eff5f51807 new testcase for intrinsic folding
llvm-svn: 11943
2004-02-28 05:28:42 +00:00
Chris Lattner b66f42427a The instruction combining pass removes dead instructions, there is no need
to run the die pass after it.

llvm-svn: 11942
2004-02-28 05:26:06 +00:00
Chris Lattner 51ea127bf3 Rename AddUsesToWorkList -> AddUsersToWorkList, as that is what it does.
Create a new AddUsesToWorkList method
optimize memmove/set/cpy of zero bytes to a noop.

llvm-svn: 11941
2004-02-28 05:22:00 +00:00
Chris Lattner f3a366062c Turn 'free null' into nothing
llvm-svn: 11940
2004-02-28 04:57:37 +00:00
Misha Brukman 8a2c28fdda Right, it's really Extractor, not Extraction.
llvm-svn: 11939
2004-02-28 03:37:58 +00:00
Misha Brukman 370c58a44a New Function-level transformation utils.
llvm-svn: 11938
2004-02-28 03:33:30 +00:00
Misha Brukman 3151628a0d Add the prototype for the LoopExtractor Pass.
llvm-svn: 11937
2004-02-28 03:33:17 +00:00
Misha Brukman 03a11340ff A pass that uses the generic CodeExtractor to rip out *every* loop in every
function, as long as the loop isn't the only one in that function. This should
help debugging passes easier with BugPoint.

llvm-svn: 11936
2004-02-28 03:33:01 +00:00
Misha Brukman caa1a5abeb A generic code extractor: given a list of BasicBlocks, it will rip them out into
a new function, taking care of inputs and outputs.

llvm-svn: 11935
2004-02-28 03:26:20 +00:00
Misha Brukman be74d5f73a Two testcases for loops: one with outputs, one without.
llvm-svn: 11934
2004-02-28 03:20:41 +00:00
Alkis Evlogimenos 24b3d0bdae Further comment updates.
llvm-svn: 11933
2004-02-28 03:20:31 +00:00
Alkis Evlogimenos f87966b8c4 Update comments.
llvm-svn: 11932
2004-02-28 03:12:31 +00:00
Alkis Evlogimenos 2dbc79df84 My previous commit broke the jit. The shift instructions always take
an 8-bit immediate. So mark the shifts that take immediates as taking
an 8-bit argument. The rest with the implicit use of CL are marked
appropriately.

A bug still exists:

def SHLDmri32  : I2A8 <"shld", 0xA4, MRMDestMem>, TB;           // [mem32] <<= [mem32],R32 imm8

The immediate in the above instruction is 8-bit but the memory
reference is 32-bit. The printer prints this as an 8-bit reference
which confuses the assembler. Same with SHRDmri32.

llvm-svn: 11931
2004-02-28 02:56:26 +00:00
Brian Gaeke ffeef64177 Turn off the SparcV9MachineCodeDestructionPass for now, because it's buggy
llvm-svn: 11930
2004-02-27 21:15:40 +00:00
Brian Gaeke 50d19bf1de Correct DestroyMachineFunction's getPassName
llvm-svn: 11929
2004-02-27 21:01:14 +00:00
Chris Lattner 06a573f63d Only clone global nodes between graphs if both graphs have the global.
llvm-svn: 11928
2004-02-27 20:05:15 +00:00
Chris Lattner 98f8ca4017 ADD MORE FUNCTIONS!
llvm-svn: 11927
2004-02-27 20:04:48 +00:00
Alkis Evlogimenos b10b04c5ec Fix argument size for SHL, SHR, SAR, SHLD and SHRD families of
instructions.

llvm-svn: 11923
2004-02-27 19:46:30 +00:00
Alkis Evlogimenos 75ed0f67bf Fix encoding of ADD and SUB family of instructions. Also rearrange
them so that they are consistent with AND, XOR, etc...

llvm-svn: 11922
2004-02-27 18:57:00 +00:00
Alkis Evlogimenos 58270fcf1f Rename MRMS[0-7]{r,m} to MRM[0-7]{r,m}.
llvm-svn: 11921
2004-02-27 18:55:12 +00:00
Chris Lattner e82c217b2f setcond instructions don't have aliasing implications.
llvm-svn: 11919
2004-02-27 18:09:25 +00:00
John Criswell a3b47cae4c Added d and hbd MultiSource applications.
llvm-svn: 11915
2004-02-27 18:02:06 +00:00
Chris Lattner 3705370df1 Fix Regression/Assembler/2004-02-27-SelfUseAssertError.ll
llvm-svn: 11913
2004-02-27 17:28:25 +00:00
Chris Lattner 65d7e5f308 Fix a verifier bug that was preventing us from ripping povray+libpng to pieces.
llvm-svn: 11912
2004-02-27 17:26:08 +00:00
Chris Lattner e8ad1347ab Build zlib and libpng
llvm-svn: 11911
2004-02-27 17:00:29 +00:00
Chris Lattner 2b96fee7a6 Updates from Reid
llvm-svn: 11908
2004-02-27 16:17:20 +00:00
Alkis Evlogimenos 9476b7cbe5 Add memory operand folding support for the SETcc family of
instructions.

llvm-svn: 11907
2004-02-27 16:13:37 +00:00
Alkis Evlogimenos a0bae43032 Make MachineOperand's immediate value an int and save 4 bytes out of
each MachineOperand. We don't really need an int64_t immediate :-).

llvm-svn: 11906
2004-02-27 15:05:28 +00:00
Alkis Evlogimenos 8d99063b38 Add memory operand folding support for SHLD and SHRD instructions.
llvm-svn: 11905
2004-02-27 15:03:18 +00:00
Alkis Evlogimenos 3537404299 Add memory operand folding support for SHL, SHR and SAR, SHLD instructions.
llvm-svn: 11903
2004-02-27 09:28:43 +00:00
Alkis Evlogimenos f020dfb43c Rename SHL, SHR, SAR, SHLD and SHLR instructions to make them
consistent with the rest and also pepare for the addition of their
memory operand variants.

llvm-svn: 11902
2004-02-27 06:57:05 +00:00
Chris Lattner 524ee2beee Initial checkin of document, contributed by Reid Spencer.
llvm-svn: 11901
2004-02-27 06:28:34 +00:00
Chris Lattner 4f7accab96 Implement test/Regression/Transforms/InstCombine/canonicalize_branch.ll
This is a really minor thing, but might help out the 'switch statement induction'
code in simplifycfg.

llvm-svn: 11900
2004-02-27 06:27:46 +00:00
Chris Lattner d58a88b28d The instcombiner should canonicalize comparisons.
llvm-svn: 11899
2004-02-27 06:27:07 +00:00
Alkis Evlogimenos e669caafe0 Rename member function to be consistent with the rest.
llvm-svn: 11898
2004-02-27 06:11:15 +00:00
Alkis Evlogimenos 6cf4373394 Add improvements to the code generator.
llvm-svn: 11896
2004-02-27 05:26:23 +00:00
Alkis Evlogimenos 941f9310bb Make spiller push stores right after the definition of a register so
that they are as far away from the loads as possible.

llvm-svn: 11895
2004-02-27 04:51:35 +00:00
Alkis Evlogimenos 519e1e8c92 Fix crash caused by passing register 0 to
MRegisterInfo::isPhysicalRegister().

llvm-svn: 11894
2004-02-27 01:52:34 +00:00
Alkis Evlogimenos 5a3bab9402 Clear maps right after basic block is processed.
llvm-svn: 11892
2004-02-26 23:22:23 +00:00
Misha Brukman 61107d315b Doxygenify comments.
llvm-svn: 11891
2004-02-26 23:20:29 +00:00
Misha Brukman c49e64347c Doxygenify and tersify comments.
llvm-svn: 11890
2004-02-26 23:20:08 +00:00
John Criswell bbde7d667f Added PR258 and 259.
llvm-svn: 11889
2004-02-26 23:13:34 +00:00
John Criswell 9ed08ab1f7 Added support for C++ compilation.
Made removing the object files a separate sh command so that it can easily
be commented out.

llvm-svn: 11888
2004-02-26 23:02:25 +00:00
John Criswell c7ef3c61fd C++ version of llvm-native-gcc.
llvm-svn: 11887
2004-02-26 23:01:21 +00:00
John Criswell 6192eeb0c5 Fixed test case to actually check for the static declaration.
Oops.

llvm-svn: 11886
2004-02-26 22:56:13 +00:00
John Criswell 6fd2e36fd5 Regression tests for PR258 and PR259.
2004-02-26-FPNotPrintableConstants.llx ensures that constants used in an
LLVM program are declared static if they are assigned to global variables.
2004-02-26-LinkOnceFunctions.llx ensures that linkonce functions get the
weak attribute.

llvm-svn: 11885
2004-02-26 22:55:11 +00:00
John Criswell feb7c49ce4 Fixes for PR258 and PR259.
Functions with linkonce linkage are declared with weak linkage.
Global floating point constants used to represent unprintable values
(such as NaN and infinity) are declared static so that they don't interfere
with other CBE generated translation units.

llvm-svn: 11884
2004-02-26 22:20:58 +00:00
Chris Lattner 5ef1638da2 Be a good little compiler and handle direct calls efficiently, even if there
are beastly ConstantPointerRefs in the way...

llvm-svn: 11883
2004-02-26 22:07:22 +00:00
Alkis Evlogimenos 61719d48d2 Uncomment assertions that register# != 0 on calls to
MRegisterInfo::is{Physical,Virtual}Register. Apply appropriate fixes
to relevant files.

llvm-svn: 11882
2004-02-26 22:00:20 +00:00
John Criswell 44cf9fadcb Modified the default pathname for Povray.
llvm-svn: 11881
2004-02-26 20:22:59 +00:00
Chris Lattner 79636d7cd5 Since LLVM uses structure type equivalence, it isn't useful to keep around
multiple type names for the same structural type.  Make DTE eliminate all
but one of the type names

llvm-svn: 11879
2004-02-26 20:02:23 +00:00
Chris Lattner a990863851 Annotations are evil. This makes Value not derive from Annotable, which makes
all dynamically allocated LLVM values 4 bytes smaller, eliminate some vtables, and
make Value's destructor faster.

This makes Function derive from Annotation now because it is the only core LLVM
class that still has an annotation stuck onto it: MachineFunction.
MachineFunction is obviously horrible and gross (like most other annotations), but
will be the subject of refactorings later in the future.  Besides many fewer
Function objects are dynamically allocated that instructions blocks, constants,
types, etc... :)

llvm-svn: 11878
2004-02-26 08:08:38 +00:00
Chris Lattner 19cfc40ce0 add note
llvm-svn: 11876
2004-02-26 08:02:57 +00:00
Chris Lattner 7140e4696a Use a map instead of annotations
llvm-svn: 11875
2004-02-26 08:02:17 +00:00
Chris Lattner e495e774b7 Make TargetData no longer use annotations!
llvm-svn: 11874
2004-02-26 08:01:57 +00:00
Chris Lattner 526a80ec25 Eliminate copy-and-paste comments
llvm-svn: 11873
2004-02-26 08:01:30 +00:00
Chris Lattner 234a2d4f19 remove obsolete comment
llvm-svn: 11872
2004-02-26 07:59:22 +00:00
Chris Lattner 120035898b Make sure that at least one virtual method is defined in a .cpp file to avoid
having the compiler emit RTTI and vtables to EVERY translation unit.

llvm-svn: 11871
2004-02-26 07:24:18 +00:00
Chris Lattner 21e941fbfd turn things like:
if (X == 0 || X == 2)

...where the comparisons and branches are in different blocks... into a switch
instruction.  This comes up a lot in various programs, and works well with
the switch/switch merging code I checked earlier.  For example, this testcase:

int switchtest(int C) {
  return C == 0 ? f(123) :
         C == 1 ? f(3123) :
         C == 4 ? f(312) :
         C == 5 ? f(1234): f(444);
}

is converted into this:
        switch int %C, label %cond_false.3 [
                 int 0, label %cond_true.0
                 int 1, label %cond_true.1
                 int 4, label %cond_true.2
                 int 5, label %cond_true.3
        ]

instead of a whole bunch of conditional branches.

Admittedly the code is ugly, and incomplete.  To be complete, we need to add
br -> switch merging and switch -> br merging.  For example, this testcase:

struct foo { int Q, R, Z; };
#define A (X->Q+X->R * 123)
int test(struct foo *X) {
  return A  == 123 ? X1() :
        A == 12321 ? X2():
        (A == 111 || A == 222) ? X3() :
        A == 875 ? X4() : X5();
}

Gets compiled to this:
        switch int %tmp.7, label %cond_false.2 [
                 int 123, label %cond_true.0
                 int 12321, label %cond_true.1
                 int 111, label %cond_true.2
                 int 222, label %cond_true.2
        ]
...
cond_false.2:           ; preds = %entry
        %tmp.52 = seteq int %tmp.7, 875         ; <bool> [#uses=1]
        br bool %tmp.52, label %cond_true.3, label %cond_false.3

where the branch could be folded into the switch.

This kind of thing occurs *ALL OF THE TIME*, especially in programs like
176.gcc, which is a horrible mess of code.  It contains stuff like *shudder*:

#define SWITCH_TAKES_ARG(CHAR) \
  (   (CHAR) == 'D' \
   || (CHAR) == 'U' \
   || (CHAR) == 'o' \
   || (CHAR) == 'e' \
   || (CHAR) == 'u' \
   || (CHAR) == 'I' \
   || (CHAR) == 'm' \
   || (CHAR) == 'L' \
   || (CHAR) == 'A' \
   || (CHAR) == 'h' \
   || (CHAR) == 'z')

and

#define CONST_OK_FOR_LETTER_P(VALUE, C)                 \
  ((C) == 'I' ? SMALL_INTVAL (VALUE)                    \
   : (C) == 'J' ? SMALL_INTVAL (-(VALUE))               \
   : (C) == 'K' ? (unsigned)(VALUE) < 32                \
   : (C) == 'L' ? ((VALUE) & 0xffff) == 0               \
   : (C) == 'M' ? integer_ok_for_set (VALUE)            \
   : (C) == 'N' ? (VALUE) < 0                           \
   : (C) == 'O' ? (VALUE) == 0                          \
   : (C) == 'P' ? (VALUE) >= 0                          \
   : 0)

and

#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)                     \
{                                                               \
  if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                   \
                   copy_to_mode_reg (SImode, XEXP (X, 1)));     \
  if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                   \
                   copy_to_mode_reg (SImode, XEXP (X, 0)));     \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT)   \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                   \
                   force_operand (XEXP (X, 0), 0));             \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT)   \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                   \
                   force_operand (XEXP (X, 1), 0));             \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS)   \
    (X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
                   XEXP (X, 1));                                \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS)   \
    (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0),                    \
                   force_operand (XEXP (X, 1), NULL_RTX));      \
  if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST       \
           || GET_CODE (X) == LABEL_REF)                        \
    (X) = legitimize_address (flag_pic, X, 0, 0);               \
  if (memory_address_p (MODE, X))                               \
    goto WIN; }

and others.  These macros get used multiple times of course.  These are such
lovely candidates for macros, aren't they?  :)

This code also nicely handles LLVM constructs that look like this:

  if (isa<CastInst>(I))
   ...
  else if (isa<BranchInst>(I))
   ...
  else if (isa<SetCondInst>(I))
   ...
  else if (isa<UnwindInst>(I))
   ...
  else if (isa<VAArgInst>(I))
   ...

where the isa can obviously be a dyn_cast as well.  Switch instructions are a
good thing.

llvm-svn: 11870
2004-02-26 07:13:46 +00:00
Chris Lattner 28a0885929 No need to clear the map here, it will always be empty
llvm-svn: 11868
2004-02-26 05:21:21 +00:00
Chris Lattner 5e39cf9fbd Fix a bug in the densemap that was killing the local allocator, and probably
other clients.  The problem is that the nullVal member was left to the default
constructor to initialize, which for int's does nothing (ie, leaves it unspecified).

To get a zero value, we must use T().  It's C++ wonderful? :)

llvm-svn: 11867
2004-02-26 05:00:15 +00:00
Alkis Evlogimenos e008a4b28f Remove .micro references as those files no longer exist and add some more recent Makefile additions to the list
llvm-svn: 11866
2004-02-26 04:14:10 +00:00
Chris Lattner 973556b724 Fix typeo. grow() cannot shrink storage. clear() should really nuke storage
llvm-svn: 11865
2004-02-26 04:07:12 +00:00
Chris Lattner 36ab728fe5 Fix typo
llvm-svn: 11864
2004-02-26 03:45:03 +00:00
Chris Lattner 128e84197b The node doesn't have to be _no_ node flags, it just has to be complete and
not have any globals.

llvm-svn: 11863
2004-02-26 03:43:43 +00:00
Chris Lattner c8167b0e7e Add _more_ functions
llvm-svn: 11862
2004-02-26 03:43:08 +00:00
Chris Lattner 73687be9d7 We have this snazzy link-time optimizer. How about we start using it? This
removes some cruft from 255.vortex, cleaning up after DAE and IPCP, which
do horrible, beautiful, things to vortex.

llvm-svn: 11861
2004-02-26 03:34:30 +00:00
Chris Lattner 9192bbdad9 Fix some warnings, some of which were spurious, and some of which were real
bugs.  Thanks Brian!

llvm-svn: 11859
2004-02-26 01:20:02 +00:00
Misha Brukman 1743c4090d Instructions to call and return from functions.
llvm-svn: 11858
2004-02-26 00:37:12 +00:00
Brian Gaeke 11331e5d59 One B00g fixed.
llvm-svn: 11857
2004-02-26 00:08:25 +00:00
Alkis Evlogimenos 802cf52b91 Temporarily comment out asserts as they break things. I will uncomment
them when all the problem areas are fixed.

llvm-svn: 11855
2004-02-25 23:56:36 +00:00
Alkis Evlogimenos 19aaae3f3b Fix typo. I wonder how this actually worked.
llvm-svn: 11854
2004-02-25 23:47:17 +00:00
Alkis Evlogimenos 2cf83d3401 Complete the SPEC_ROOT and USE_SPEC to SPEC2000_ROOT and USE_SPEC200 rename.
llvm-svn: 11853
2004-02-25 23:41:32 +00:00
Chris Lattner 71626b8f36 Two changes:
1. Functions do not make things incomplete, only variables
 2. Constant global variables no longer need to be marked incomplete, because
    we are guaranteed that the initializer for the global will be in the
    graph we are hacking on now.  This makes resolution of indirect calls happen
    a lot more in the bu pass, supports things like vtables and the C counterparts
    (giant constant arrays of function pointers), etc...

Testcase here: test/Regression/Analysis/DSGraph/constant_globals.ll

llvm-svn: 11852
2004-02-25 23:36:08 +00:00
Chris Lattner fc0912d02a New testcase
llvm-svn: 11851
2004-02-25 23:34:04 +00:00
Chris Lattner fab2872b6c When building local graphs, clone the initializer for constant globals into each
local graph that uses the global.

llvm-svn: 11850
2004-02-25 23:31:02 +00:00
Alkis Evlogimenos e62ddd405d Fix bugs found with recent addition of assertions in
MRegisterInfo::is{Physical,Virtual}Register.

llvm-svn: 11849
2004-02-25 23:21:52 +00:00
Chris Lattner 6ce59b4a03 Simplify the dead node elimination stuff
Make the incompleteness marker faster by looping directly over the globals
instead of over the scalars to find the globals

Fix a bug where we didn't mark a global incomplete if it didn't have any
outgoing edges.  This wouldn't break any current clients but is still wrong.

llvm-svn: 11848
2004-02-25 23:08:00 +00:00
Chris Lattner 5e5e060618 Add a bunch more functions
llvm-svn: 11847
2004-02-25 23:06:40 +00:00
Chris Lattner 17bce88100 Try harder to get symbol info
llvm-svn: 11846
2004-02-25 23:06:30 +00:00
Brian Gaeke 7b4be13f94 Represent va_list in interpreter as a (ec-stack-depth . var-arg-index)
pair, and look up varargs in the execution stack every time, instead of
just pushing iterators (which can be invalidated during callFunction())
around.  (union GenericValue now has a "pair of uints" member, to support
this mechanism.) Fixes Bug 234.

llvm-svn: 11845
2004-02-25 23:01:48 +00:00
Brian Gaeke 84b76c9be0 Great sparc renaming fallout IV: Sparc --> SparcV9.
llvm-svn: 11844
2004-02-25 22:09:36 +00:00
Alkis Evlogimenos ae54cfc19f Duh, forgot to close the parenthesis.
llvm-svn: 11843
2004-02-25 22:07:14 +00:00
Alkis Evlogimenos cb69f50cb5 Add assert to isPhysicalRegister and isVirtualRegister to fail when
passed the special 'register' 0.

llvm-svn: 11842
2004-02-25 22:04:28 +00:00
Alkis Evlogimenos a9f03fba9d Remove asssert since it is breaking cases that it shouldn't.
llvm-svn: 11841
2004-02-25 22:01:06 +00:00
Alkis Evlogimenos d8bace7f60 Add DenseMap template and actually use it for for mapping virtual regs
to objects.

llvm-svn: 11840
2004-02-25 21:55:45 +00:00
Chris Lattner b66a35ef9c Add a new pass, run internalize first
llvm-svn: 11839
2004-02-25 21:35:13 +00:00
Chris Lattner 0f39359dd2 Add a new pass
llvm-svn: 11838
2004-02-25 21:35:02 +00:00
Chris Lattner 14da4ead95 Add prototype
llvm-svn: 11837
2004-02-25 21:34:51 +00:00
Chris Lattner 8d1da1abee My faith in programmers has been found to be totally misplaced. One would
assume that if they don't intend to write to a global variable, that they
would mark it as constant.  However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.

This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks.  253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be.  Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls.  Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.

176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more).  Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.

This pass is extremely quick and does good things.  I'm going to enable it
in gccas & gccld.  Not bad for 50 SLOC.

llvm-svn: 11836
2004-02-25 21:34:36 +00:00
Misha Brukman 564654d654 SparcV8 regs are really 32-bit, not 64! Thanks, Chris.
llvm-svn: 11835
2004-02-25 21:03:02 +00:00
Misha Brukman f8dcdcc83b Clean up the tablegen descriptions for SparcV8.
llvm-svn: 11834
2004-02-25 21:02:21 +00:00
Misha Brukman 2122b969f9 Fix the SparcV8 register definitions that were imported from PPC template.
llvm-svn: 11833
2004-02-25 21:00:05 +00:00
Misha Brukman 0e3a7ca53e SparcV8 has different types of instructions, but F1 is only used for CALL.
llvm-svn: 11832
2004-02-25 20:52:20 +00:00
Brian Gaeke 232483aecc Note that this test is currently expected to fail.
llvm-svn: 11831
2004-02-25 20:34:02 +00:00
Chris Lattner f5a393a133 Add an assertion
llvm-svn: 11830
2004-02-25 19:37:44 +00:00
Chris Lattner 64c9b223bd Fix failures in 099.go due to the cfgsimplify pass creating switch instructions
where there did not used to be any before

llvm-svn: 11829
2004-02-25 19:30:19 +00:00
Brian Gaeke 9a5bd7fca7 SparcV8 skeleton
llvm-svn: 11828
2004-02-25 19:28:19 +00:00
Brian Gaeke 068b4596d4 Great renaming part II: Sparc --> SparcV9 (also includes command-line options and Makefiles)
llvm-svn: 11827
2004-02-25 19:08:12 +00:00
Brian Gaeke 94e95d2b3e Great renaming: Sparc --> SparcV9
llvm-svn: 11826
2004-02-25 18:44:15 +00:00
Chris Lattner 864c901444 Add a bunch more functions used by perlbmk
llvm-svn: 11824
2004-02-25 17:43:20 +00:00
John Criswell 9f547bcea9 Updated to use llc to generate CBE code.
llvm-svn: 11823
2004-02-25 17:15:02 +00:00
Chris Lattner 8ebf253827 Substantial improvements and cleanups for the release notes. We were missing
a bunch of stuff!  :)

llvm-svn: 11822
2004-02-25 16:36:51 +00:00
Chris Lattner 9c6833c5ca Fix incorrect debug code
llvm-svn: 11821
2004-02-25 15:15:04 +00:00
Chris Lattner 309327a4b5 Teach the instruction selector how to transform 'array' GEP computations into X86
scaled indexes.  This allows us to compile GEP's like this:

int* %test([10 x { int, { int } }]* %X, int %Idx) {
        %Idx = cast int %Idx to long
        %X = getelementptr [10 x { int, { int } }]* %X, long 0, long %Idx, ubyte 1, ubyte 0
        ret int* %X
}

Into a single address computation:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        lea %EAX, DWORD PTR [%EAX + 8*%ECX + 4]
        ret

Before it generated:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        shl %ECX, 3
        add %EAX, %ECX
        lea %EAX, DWORD PTR [%EAX + 4]
        ret

This is useful for things like int/float/double arrays, as the indexing can be folded into
the loads&stores, reducing register pressure and decreasing the pressure on the decode unit.
With these changes, I expect our performance on 256.bzip2 and gzip to improve a lot.  On
bzip2 for example, we go from this:

10665 asm-printer           - Number of machine instrs printed
   40 ra-local              - Number of loads/stores folded into instructions
 1708 ra-local              - Number of loads added
 1532 ra-local              - Number of stores added
 1354 twoaddressinstruction - Number of instructions added
 1354 twoaddressinstruction - Number of two-address instructions
 2794 x86-peephole          - Number of peephole optimization performed

to this:
9873 asm-printer           - Number of machine instrs printed
  41 ra-local              - Number of loads/stores folded into instructions
1710 ra-local              - Number of loads added
1521 ra-local              - Number of stores added
 789 twoaddressinstruction - Number of instructions added
 789 twoaddressinstruction - Number of two-address instructions
2142 x86-peephole          - Number of peephole optimization performed

... and these types of instructions are often in tight loops.

Linear scan is also helped, but not as much.  It goes from:

8787 asm-printer           - Number of machine instrs printed
2389 liveintervals         - Number of identity moves eliminated after coalescing
2288 liveintervals         - Number of interval joins performed
3522 liveintervals         - Number of intervals after coalescing
5810 liveintervals         - Number of original intervals
 700 spiller               - Number of loads added
 487 spiller               - Number of stores added
 303 spiller               - Number of register spills
1354 twoaddressinstruction - Number of instructions added
1354 twoaddressinstruction - Number of two-address instructions
 363 x86-peephole          - Number of peephole optimization performed

to:

7982 asm-printer           - Number of machine instrs printed
1759 liveintervals         - Number of identity moves eliminated after coalescing
1658 liveintervals         - Number of interval joins performed
3282 liveintervals         - Number of intervals after coalescing
4940 liveintervals         - Number of original intervals
 635 spiller               - Number of loads added
 452 spiller               - Number of stores added
 288 spiller               - Number of register spills
 789 twoaddressinstruction - Number of instructions added
 789 twoaddressinstruction - Number of two-address instructions
 258 x86-peephole          - Number of peephole optimization performed

Though I'm not complaining about the drop in the number of intervals.  :)

llvm-svn: 11820
2004-02-25 07:00:55 +00:00
Chris Lattner d1ee55d439 * Make the previous patch more efficient by not allocating a temporary MachineInstr
to do analysis.

*** FOLD getelementptr instructions into loads and stores when possible,
    making use of some of the crazy X86 addressing modes.

For example, the following C++ program fragment:

struct complex {
    double re, im;
    complex(double r, double i) : re(r), im(i) {}
};
inline complex operator+(const complex& a, const complex& b) {
    return complex(a.re+b.re, a.im+b.im);
}
complex addone(const complex& arg) {
    return arg + complex(1,0);
}

Used to be compiled to:
_Z6addoneRK7complex:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
***     mov %EDX, %ECX
        fld QWORD PTR [%EDX]
        fld1
        faddp %ST(1)
***     add %ECX, 8
        fld QWORD PTR [%ECX]
        fldz
        faddp %ST(1)
***     mov %ECX, %EAX
        fxch %ST(1)
        fstp QWORD PTR [%ECX]
***     add %EAX, 8
        fstp QWORD PTR [%EAX]
        ret

Now it is compiled to:
_Z6addoneRK7complex:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        fld QWORD PTR [%ECX]
        fld1
        faddp %ST(1)
        fld QWORD PTR [%ECX + 8]
        fldz
        faddp %ST(1)
        fxch %ST(1)
        fstp QWORD PTR [%EAX]
        fstp QWORD PTR [%EAX + 8]
        ret

Other programs should see similar improvements, across the board.  Note that
in addition to reducing instruction count, this also reduces register pressure
a lot, always a good thing on X86.  :)

llvm-svn: 11819
2004-02-25 06:13:04 +00:00
Chris Lattner 4b3514c173 Add a helper to create an addressing mode given all of the pieces.
llvm-svn: 11818
2004-02-25 06:01:07 +00:00
Chris Lattner d825d30f42 add an inefficient way of folding structure and constant array indexes together
into a single LEA instruction.  This should improve the code generated for
things like X->A.B.C[12].D.

The bigger benefit is still coming though.  Note that this uses an LEA instruction
instead of an add, giving the register allocator more freedom.  We should probably
never generate ADDri32's.

llvm-svn: 11817
2004-02-25 03:45:50 +00:00
Chris Lattner f85e33cd79 Implement special case for storing an immediate into memory so that we don't need
an intermediate register.

llvm-svn: 11816
2004-02-25 02:56:58 +00:00
Brian Gaeke 04cff21c2f Cygwin defines log2 as a macro. Undef it here IFF it has already been defined,
so that we always get the inline function instead. Remember, kids, like it says
in the GCC manual, "An Inline Function is As Fast As a Macro."

llvm-svn: 11815
2004-02-25 01:53:45 +00:00
Brian Gaeke 01d9231855 small portability fix.
llvm-svn: 11814
2004-02-24 22:58:31 +00:00
Chris Lattner 9ccb1af08f Add support for 'rename'
llvm-svn: 11813
2004-02-24 22:17:00 +00:00
Chris Lattner d996e543eb Make the verifier a little more explicit about this problem.
llvm-svn: 11811
2004-02-24 22:06:07 +00:00
Chris Lattner 396cdaf067 Add support for remove, fwrite, and fread
Also fix problem where we didn't check to see if a node pointer was null.
Though fclose(null) doesn't make a lot of sense, 300.twolf does it.

llvm-svn: 11810
2004-02-24 22:02:48 +00:00
John Criswell 47c5459cec Added the VTune tests.
llvm-svn: 11809
2004-02-24 21:43:38 +00:00
Brian Gaeke 10a32da382 FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
llvm-svn: 11804
2004-02-24 19:46:00 +00:00
Chris Lattner b471f0188f Fix some unexpected fallout from the config.h changes. Because the CBE no
longer was getting this #include, it always fell back on the less precise
floating point initializer values, causing some testsuite failures.

llvm-svn: 11803
2004-02-24 18:34:10 +00:00
Chris Lattner 8ee0593f0d Fix a faulty optimization on FP values
llvm-svn: 11801
2004-02-24 18:10:14 +00:00
John Criswell a92e58610d Fixed minor typos.
llvm-svn: 11800
2004-02-24 16:13:56 +00:00
Chris Lattner 90ea78edba If a block is made dead, make sure to promptly remove it.
llvm-svn: 11799
2004-02-24 16:09:21 +00:00