Commit Graph

2638 Commits

Author SHA1 Message Date
Nate Begeman a6808b8efc Fix typo of the word 'implicit' I made resolving a CVS conflict. Whoops!
llvm-svn: 15808
2004-08-16 02:12:49 +00:00
Nate Begeman dabf0a52c0 Fix frame pointer handling:
Reserve R0 in store/load from stack slot for building >32k offsets from SP
or FP.  This also requires we use R11 rather than R0 for holding the LR
value we want to save or restore.  Also, tell the register allocator not
to use R31 (our FP) in functions that have a frame pointer.  These changes
fix Burg.

llvm-svn: 15807
2004-08-16 01:52:12 +00:00
Nate Begeman 8b44a07246 Fix mismatched adjust down/up of SP in functions that contain variable
sized allocas.

llvm-svn: 15806
2004-08-16 01:50:22 +00:00
Chris Lattner 48a3b942ae Insertion methods now return void instead of #instrs inserted. Also, use
more powerful forms of BuildMI to concisify the code

llvm-svn: 15782
2004-08-15 22:15:56 +00:00
Chris Lattner 98de1d7795 These methods no longer take a TargetRegisterClass* operand.
llvm-svn: 15774
2004-08-15 21:56:44 +00:00
Alkis Evlogimenos 4922e2e8ef Make this compile on gc 3.4.1 (static_cast to non-const type was not
allowed).

llvm-svn: 15766
2004-08-15 09:18:55 +00:00
Nate Begeman 78862c3717 Add future optimization opportunity
llvm-svn: 15760
2004-08-15 06:43:10 +00:00
Nate Begeman 373744c6dc Fix float to int codepath by always allocating 8 bytes for the target of a double store; optimize cmplwi generation.
llvm-svn: 15759
2004-08-15 06:42:28 +00:00
Chris Lattner 7dfaac4300 Zimm16 is now dead. Its entry is not removed from the enum, to avoid having
to renumber everything.  Similar elimination should be applied to other
operand enum values that are only used to format printing in the .s file.

llvm-svn: 15755
2004-08-15 05:48:47 +00:00
Chris Lattner da2e56fb0c Convert all of the DForm_6* operations, which makes all of the Zimm16 users
dead.

llvm-svn: 15754
2004-08-15 05:46:14 +00:00
Chris Lattner 94ab6273b6 Reenable the CCRC
llvm-svn: 15752
2004-08-15 05:31:15 +00:00
Chris Lattner 8a796858da Convert the DForm_4 over to the asmprintergen
llvm-svn: 15751
2004-08-15 05:20:16 +00:00
Nate Begeman abc8173b18 Remove dead code
llvm-svn: 15750
2004-08-15 00:31:02 +00:00
Chris Lattner ec1cc1b861 Print mflr using the asmwriter generator
llvm-svn: 15749
2004-08-14 23:27:29 +00:00
Nate Begeman 412602d7d9 Replace PowerPCPEI.cpp with target independant PrologEpilogInserter
llvm-svn: 15746
2004-08-14 22:16:36 +00:00
Nate Begeman 0c8c0346f8 Add support for frame pointers, and large offsets from stack and frame pointers. Adopt elimination of MachineFunction& arg from eliminateFrameIndex.
llvm-svn: 15745
2004-08-14 22:13:58 +00:00
Nate Begeman 9c7ddc3e21 Add indexed forms of load doubleword and load word algebraic for 64 bit targets
llvm-svn: 15743
2004-08-14 22:12:20 +00:00
Nate Begeman caeb78e720 Fix handling of FP constants with single precision, and loading of internal linkage function addresses
llvm-svn: 15742
2004-08-14 22:11:38 +00:00
Nate Begeman 0ad7f813d8 Add initial support for using the generated asm writer. Also, fix FP constant printing to always print 8 byte intializers. Move printing of LinkOnce stubs.
llvm-svn: 15741
2004-08-14 22:09:10 +00:00
Nate Begeman 8536df7dbe Add generation of asm writer from tablegen files to Makefile
llvm-svn: 15740
2004-08-14 22:06:38 +00:00
Nate Begeman 6e5010d935 Remove an unneeded header and forward declaration
llvm-svn: 15722
2004-08-13 09:33:17 +00:00
Nate Begeman 5bf9bfe398 Fix siod by switching BoolTy to byte rather than int until CFE changes for
Darwin.  Also, change asm printer to output proper stubs for external
functions whose address is passed as an argument to aid in bugpointing.

llvm-svn: 15721
2004-08-13 09:32:01 +00:00
Nate Begeman 420213f3c5 Fix 177.mesa compilation, don't use floating point regs for base addresses!
llvm-svn: 15720
2004-08-13 04:45:14 +00:00
Nate Begeman 2f1d849271 Fix llc crasher compiling siod by giving BuildMI the correct number of arguments
llvm-svn: 15719
2004-08-13 03:56:49 +00:00
Nate Begeman 2e8bfa2364 Longs are in one register on PowerPC 64; use appropriate instructions to operate on them.
llvm-svn: 15711
2004-08-13 02:20:47 +00:00
Nate Begeman 765cb5f844 Add some more 64 bit instructions we need for the PowerPC-64 ISel to the tablegen files
llvm-svn: 15710
2004-08-13 02:19:26 +00:00
Misha Brukman af77fe4097 Disable PPC64 backend by default because LLC cannot choose automatically between
SparcV9 and PowerPC64 without target triples, since they are both 64-bit
big-endian targets.

llvm-svn: 15688
2004-08-12 17:16:43 +00:00
Misha Brukman 52a4abc299 * Correct 64-bit version: blr 1 (not 0)
* BuildMI() can build 0-param instructions (e.g., NOP)

llvm-svn: 15681
2004-08-12 03:30:03 +00:00
Misha Brukman 5d967b3c5e * Print out full names for non-GPR or -FPR registers
* BuildMI() really *does* handle 0 params!

llvm-svn: 15680
2004-08-12 03:28:47 +00:00
Misha Brukman 58040a63ee * Pointers are 8 bytes, hence cLong type on 64-bit PPC
* Fix loading of GlobalValues

llvm-svn: 15678
2004-08-12 02:53:01 +00:00
Misha Brukman 6f2e67a726 Eliminate special-casing 14-bit immediate load/store opcodes
llvm-svn: 15677
2004-08-12 02:51:38 +00:00
Misha Brukman 5098bd5499 Correctly print out ASCII literal strings on AIX
llvm-svn: 15674
2004-08-12 01:01:13 +00:00
Misha Brukman 345399b06e Mark R2 as available for allocation on Darwin/PPC32, but not AIX/PPC64
llvm-svn: 15673
2004-08-12 00:10:01 +00:00
Misha Brukman c94c0f75f4 * Move AIX into the llvm namespace to be accessed from RegisterInfo
* Mark InstrInfo with 32 vs. 64 bit flag
* Enable the 64-bit isel and asm printer

llvm-svn: 15672
2004-08-11 23:47:08 +00:00
Misha Brukman aea37d65c8 Set the is64bit flag and propagate it to PowerPCRegisterInfo
llvm-svn: 15671
2004-08-11 23:45:43 +00:00
Misha Brukman 39f7533b40 * Set the is64bit boolean flag in PowerPCRegisterInfo
* Doubles are 8 bytes in 64-bit PowerPC, and use the general register class
* Use double-word loads and stores for restoring from/saving to stack
* Do not allocate R2 if compiling for AIX

llvm-svn: 15670
2004-08-11 23:44:55 +00:00
Misha Brukman c2a043488a 64-bit instruction selector and AIX-specific 64-bit asm printer
llvm-svn: 15669
2004-08-11 23:42:15 +00:00
Misha Brukman d7344dc9bd Fix names of 64-bit CMP*D* opcodes, add LWA and STD* opcodes
llvm-svn: 15668
2004-08-11 23:33:34 +00:00
Misha Brukman 78c1dcfc3e Add support for 64-bit CMPDI, CMPLDI, and CMPLD opcodes
llvm-svn: 15667
2004-08-11 20:56:14 +00:00
Misha Brukman 28beda9ba4 Add doubleword load/store (64-bit only).
llvm-svn: 15665
2004-08-11 15:54:36 +00:00
Misha Brukman 7224ee1e4c Hyphenate ##-bit and remove first-person from comments.
llvm-svn: 15663
2004-08-11 13:35:44 +00:00
Nate Begeman f17ea0f7b7 Clean up 32/64bit and Darwin/AIX split. Next steps: 64 bit ISel, AIX asm printer.
llvm-svn: 15662
2004-08-11 07:40:04 +00:00
Chris Lattner 6f0291792e Fix a case where constantexprs could leak into the PPC isel.
llvm-svn: 15661
2004-08-11 07:34:50 +00:00
Nate Begeman 7526da6ead Fix 255.vortex by using getClassB instead of getClass
llvm-svn: 15648
2004-08-11 03:30:55 +00:00
Misha Brukman e67a212267 Breaking up the PowerPC target into 32- and 64-bit subparts, Part III: the rest.
llvm-svn: 15636
2004-08-11 00:11:25 +00:00
Misha Brukman 284086aa4a Breaking up the PowerPC target into 32- and 64-bit subparts: Part II: 64-bit.
llvm-svn: 15635
2004-08-11 00:10:41 +00:00
Misha Brukman d022a5ac5a Breaking up the PowerPC target into 32- and 64-bit subparts, Part I: 32-bit.
llvm-svn: 15634
2004-08-11 00:09:42 +00:00
Misha Brukman dad438bfb9 Renamed PPC32 (namespace for regs, opcodes) to PPC to include 64-bit targets
llvm-svn: 15631
2004-08-10 22:47:03 +00:00
Misha Brukman 0b9444e536 * Fix file header to use tablegen emacs mode instead of c++
* Wrap long line to 80 cols

llvm-svn: 15630
2004-08-10 21:24:44 +00:00
Nate Begeman 63be70d8f2 Fix casts of float to unsigned long
Replace STDX (store 64 bit int indexed) with STFDX (store double indexed)
Fix latent bug in indexed load generation
Generate indexed loads and stores in many more cases

llvm-svn: 15626
2004-08-10 20:42:36 +00:00
Misha Brukman c6b114f258 DForm 5/6 extended mneumonics take 3 arguments.
llvm-svn: 15620
2004-08-10 19:03:31 +00:00
Misha Brukman 09d87b4939 Fix DForm_4: format is `op r, r, i'
llvm-svn: 15613
2004-08-10 18:07:55 +00:00
Misha Brukman 189229151f Stub definition of the PowerPC CodeEmitter class; this isn't functional (yet).
llvm-svn: 15600
2004-08-09 23:03:59 +00:00
Misha Brukman eca36a5aa0 CodePrinter -> AsmPrinter
llvm-svn: 15599
2004-08-09 22:27:45 +00:00
Misha Brukman 8f951e579b Remove ClassPrefix variable as it's no longer used.
llvm-svn: 15586
2004-08-09 19:13:29 +00:00
Misha Brukman d210ed1855 Define a ClassPrefix for PowerPC.
llvm-svn: 15580
2004-08-09 17:46:26 +00:00
Misha Brukman b3401c4c50 Generate a code emitter for PowerPC as well, this will be used in the JIT.
llvm-svn: 15578
2004-08-09 17:24:32 +00:00
Misha Brukman 5295e1db10 Use instruction formats as defined in the PowerPC ISA manual
llvm-svn: 15577
2004-08-09 17:24:04 +00:00
Reid Spencer 42817b7ea1 Fix stack size processing now that the return address isn't an implied
push onto the top of the stack like x86, which uses the local area
offset.  This will allow the removal of PowerPCPEI.cpp soon.

llvm-svn: 15573
2004-08-09 01:24:32 +00:00
Chris Lattner a8dcf2423e Changes commited for Nate Begeman:
Use a PowerPC specific prolog epilog inserter to control where spilled
callee save regs are placed on the stack.
Get rid of implicit return address stack slot, save return address reg
(LR) in appropriate slot
Improve code generated for functions that don't have calls or access
globals


Note from Chris: PowerPCPEI will eventually be eliminated, once the
functionality is merged into CodeGen/PrologEpilogInserter.cpp

llvm-svn: 15536
2004-08-06 06:58:50 +00:00
John Criswell 2fc39a9c2f Added Louis Gerbarg. Louis is given credit in the CREDITS.TXT file, so I
assume Louis also holds copyright.

llvm-svn: 15534
2004-08-05 23:46:27 +00:00
John Criswell e7ccf6445e Add additional copyright notice for the PowerPC backend.
Thanks Nate!

llvm-svn: 15531
2004-08-05 20:36:00 +00:00
Misha Brukman 7d41ed5271 Simplify makefile by combining all TableGen dependencies into one variable
llvm-svn: 15527
2004-08-05 18:34:15 +00:00
Misha Brukman 2068654d68 Align dependencies so they don't hurt the eyes to look at them
llvm-svn: 15504
2004-08-04 21:37:41 +00:00
Misha Brukman cdd72aaa1f Remove unused instruction classes
llvm-svn: 15501
2004-08-04 21:18:57 +00:00
Misha Brukman f74157ab15 Make tablegen targets depend on PowerPCInstrFormats.td as well
llvm-svn: 15500
2004-08-04 21:18:36 +00:00
Chris Lattner 08c58e63d9 getValues does not exist
llvm-svn: 15495
2004-08-04 17:29:14 +00:00
Misha Brukman 8a1978fd72 Remove unused opcodes.
llvm-svn: 15447
2004-08-03 20:23:44 +00:00
Misha Brukman 570dcf63e6 * Use simpler instruction templates to define instructions
* Fix several extended opcodes

llvm-svn: 15423
2004-08-02 21:58:52 +00:00
Misha Brukman 6b21bde2d6 Replace patterns 0, 4, and 5 with simpler heirarchical definitions that use the
official PowerPC instruction format lingo: X- and D-form.

llvm-svn: 15422
2004-08-02 21:56:35 +00:00
Misha Brukman cd4f51b4b6 Separate instruction formats from instruction definitions.
llvm-svn: 15414
2004-08-02 16:54:54 +00:00
Misha Brukman 695d50d030 * Conditional save/restore of LR disabled as it's not quite correct
* sumarray2d fixed: large fixed-size alloca
* make is now compileable
* Re-organized tests to fit them under proper headings

Patch by Nate Begeman.

llvm-svn: 15347
2004-07-30 15:53:09 +00:00
Misha Brukman c102577ff1 Do not mark LR as callee-save: not quite correctly done. Patch: Nate Begeman.
llvm-svn: 15346
2004-07-30 15:51:51 +00:00
Misha Brukman 471b43a357 * Temporarily suspend LR save/restore optimization as it is not quite correct
* Implement large fixed-size allocas            Entire patch by Nate Begeman.

llvm-svn: 15345
2004-07-30 15:50:45 +00:00
Chris Lattner 07fad1cdee Minor corrections
llvm-svn: 15309
2004-07-28 20:18:53 +00:00
Misha Brukman 7f01b2539b Add notes on bug involving casting ulong -> double, thanks to Nate Begeman.
llvm-svn: 15307
2004-07-28 19:16:10 +00:00
Misha Brukman 862bb562cc Simplify loading (un)signed constants to registers, patch by Nate Begeman.
llvm-svn: 15306
2004-07-28 19:13:49 +00:00
Misha Brukman db13b6edba Remove an extra 8 byte distance penalty. Patch by Nate Begeman.
llvm-svn: 15305
2004-07-28 19:13:07 +00:00
Misha Brukman ca5880025d Find longs by type, not by their primitive size being 64. Patch by Nate Begeman.
llvm-svn: 15304
2004-07-28 19:12:24 +00:00
Misha Brukman f7037385e2 LI can only take signed values, so values > 32767 can only be loaded with ORI
llvm-svn: 15299
2004-07-28 00:56:04 +00:00
Misha Brukman bd1d7dceb7 Reorganize tests to place them in proper directories.
llvm-svn: 15298
2004-07-28 00:55:12 +00:00
Misha Brukman 04dee3bb66 UnitTests 2003-05-26-Shorts and 2003-07-09-LoadShorts have been fixed;
2003-05-22-VarSizeArray is broken.

llvm-svn: 15297
2004-07-28 00:01:41 +00:00
Misha Brukman 47d5a22f8b Fix printing of immediate operands by looking at their operand types in
the TargetInstrInfo.  This fixes UnitTests 2003-05-26-Shorts and
2003-07-09-LoadShorts.

llvm-svn: 15296
2004-07-28 00:00:48 +00:00
Misha Brukman 92ca8eccd8 Renamed files:
* PowerPCReg.td => PowerPCRegisterinfo.td
* PowerPCInstrs.td => PowerPCInstrInfo.td

llvm-svn: 15295
2004-07-27 23:29:16 +00:00
Misha Brukman 2ffb787446 Branch selection support implemented by Nate Begeman for long branches.
llvm-svn: 15288
2004-07-27 18:43:04 +00:00
Misha Brukman a594740016 Correctly print out long branches, assert on finding pseudo instr COND_BRANCH
Patch by Nate Begeman.

llvm-svn: 15286
2004-07-27 18:40:39 +00:00
Misha Brukman 09396bf158 Run the branch selection pass right before the asm printer.
Patch by Nate Begeman.

llvm-svn: 15285
2004-07-27 18:39:34 +00:00
Misha Brukman 4d66925aea Remove empty unused method processFunctionBeforeFrameFinalized()
llvm-svn: 15284
2004-07-27 18:38:40 +00:00
Misha Brukman 83df71af70 Add COND_BRANCH pseudo instruction, patch by Nate Begeman.
llvm-svn: 15283
2004-07-27 18:35:54 +00:00
Misha Brukman 5b092c15c6 Build COND_BRANCHes which may become long or short, decided by a later pass.
Patch by Nate Begeman.

llvm-svn: 15282
2004-07-27 18:35:23 +00:00
Misha Brukman a783ee55a9 Moved definition of invertPPCBranchOpcode() into PowerPCInstrInfo class.
Patch by Nate Begeman.

llvm-svn: 15281
2004-07-27 18:34:11 +00:00
Misha Brukman ef8cf023a0 Add PowerPCBranchSelector to discover which are `long' branches.
Contributed by Nate Begeman.

llvm-svn: 15280
2004-07-27 18:33:06 +00:00
Misha Brukman 9eaa879f49 Fixed saving/restoring LR unconditionally, only done as necessary.
llvm-svn: 15275
2004-07-27 17:17:48 +00:00
Misha Brukman bc1a2f96a6 Save and restore LR just like any other register and ONLY if we actually modify
it (due to calls or globals access).  We now compile `void empty(){}' to `blr'.

llvm-svn: 15274
2004-07-27 17:17:18 +00:00
Misha Brukman 26978c3730 LR is a 32-bit int reg
llvm-svn: 15273
2004-07-27 17:15:32 +00:00
Misha Brukman f1a7e941fb MovePCtoLR (which is `bl' in disguise) modifies LR implicitly
llvm-svn: 15272
2004-07-27 17:15:05 +00:00
Misha Brukman 2bcffa484b Register LR is callee-saved
llvm-svn: 15271
2004-07-27 17:14:34 +00:00
Misha Brukman 640ec1e5e6 Add IMPLICIT_DEF of LR for branch-and-link instrs (calls and global accesses)
llvm-svn: 15270
2004-07-27 17:13:58 +00:00
Misha Brukman b5ed14486b Do not store the stack pointer if the stack size is 0.
Also, convert C-style comments to C++ and make sure code wraps at 80 cols.

llvm-svn: 15245
2004-07-26 22:00:26 +00:00
Misha Brukman 58499ead7d ADDI can take several forms, including:
addi r1, r2, 0
  addi r1, <frame index #n>, 0

so we must check for the second parameter being a register for this instruction
to be considered a reg-to-reg copy.

llvm-svn: 15244
2004-07-26 21:50:38 +00:00
Misha Brukman 6c125a92d7 assert() on MachineInstr properties instead of checking them dynamically
llvm-svn: 15243
2004-07-26 21:35:58 +00:00
Misha Brukman 43f1c4045a * Recognize `addi r1, r2, 0' a move instruction
* List formats of instructions currently recognized as moves

llvm-svn: 15242
2004-07-26 21:29:00 +00:00
Misha Brukman 74e3a17958 * Rewrote casts
* Implemented GEP folding
* Dynamically output global address stuff once per function
* Fix casting fp<->short/byte

Patch contributed by Nate Begeman.

llvm-svn: 15237
2004-07-26 18:13:24 +00:00
Misha Brukman ed664f91a4 Increment the label number in runOnFunction() rather than while printing out
some instruction.  Patch by Nate Begeman.

llvm-svn: 15236
2004-07-26 16:28:33 +00:00
Misha Brukman d815472ebd More notes on bugs, unimplemented features, and suggested code improvements.
Written by Nate Begeman.

llvm-svn: 15235
2004-07-26 16:23:55 +00:00
Misha Brukman 40f07ec771 Fix subtracting values > 2^15 in the prologue/epilogue, by Nate Begeman.
llvm-svn: 15234
2004-07-26 16:22:52 +00:00
Misha Brukman 8930d4f24e Running list of bugs, unimplemented features, currently broken tests, until we
have a nightly tester set up for PowerPC.

llvm-svn: 15147
2004-07-23 22:37:22 +00:00
Misha Brukman c150bdb52e Eliminate spurious empty space; make code easier to page through.
llvm-svn: 15146
2004-07-23 22:35:49 +00:00
Misha Brukman 66c816a6a3 Simplify boolean test.
llvm-svn: 15145
2004-07-23 21:43:26 +00:00
Misha Brukman 26a04b79cb Implement casting a floating point to 32-bit unsigned value
llvm-svn: 15143
2004-07-23 20:32:59 +00:00
Misha Brukman 7dba17d1ce * Codegen of GEPs dramatically improved by folding multiplies and adds
* Function pointers implemented correctly using appropriate stubs

Contributed by Nate Begeman.

llvm-svn: 15133
2004-07-23 16:08:20 +00:00
Misha Brukman 4fb48609dc Bool alignment on MacOSX/PowerPC is 4 bytes.
llvm-svn: 15122
2004-07-23 01:11:46 +00:00
Misha Brukman db72025d1d * Change class of BoolTy back to cInt
* Fix indentation back to 2 spaces

llvm-svn: 15121
2004-07-23 01:11:19 +00:00
Misha Brukman 333f58836c * Change bool from cInt to cByte (for now)
* Don't allow negative immediates to users of unsigned immediates
* Fix long compares
* Support <const int>, op as a potential immediate candidate
* Fix sign extension of short and byte loads
* Fix and improve integer casts
* Fix passing of doubles as vararg functions

Patch contributed by Nate Begeman.

llvm-svn: 15109
2004-07-22 15:58:04 +00:00
Misha Brukman dbd14bc3e5 * Add the lost fix to define the second reg of a 2-reg representation of longs
* Fix opcode RLWNM -> RLWINM since it uses an immediate const shift value

llvm-svn: 15087
2004-07-21 20:30:18 +00:00
Misha Brukman 87e07f8596 * Speed up canUseAsImmediateForOpcode() by comparing Operand before
dyn_cast<>ing and checking Constant's value
* Convert tabs to spaces

llvm-svn: 15086
2004-07-21 20:22:06 +00:00
Misha Brukman 8d75aa4475 * Fix printing of signed immediate values (Nate Begeman)
* Fix printing of `zeroinitializer'
* Fix printing of `linkonce' globals, complete with stubs

llvm-svn: 15084
2004-07-21 20:11:11 +00:00
Misha Brukman 072af37088 * Fix printing of signed immediate values
* Generation of opcodes that take 16 bit immediates
* Rewrote multiply to be correct for 64 bit values
* Rewrote all the long handling to be correct for PowerPC
* Fix visitSelectInst() to define the upper register of the pair of regs
  representing a long value

Patch contributed by Nate Begeman.

llvm-svn: 15083
2004-07-21 20:09:08 +00:00
Misha Brukman 455622577a Use addSImm() instead of addImm() for stack offsets, which may be negative.
llvm-svn: 15081
2004-07-21 19:36:57 +00:00
Misha Brukman 984bfdc702 Add SUBI instruction
llvm-svn: 15077
2004-07-21 15:53:04 +00:00
Misha Brukman 75f3291ef3 Shorts are aligned to 2 bytes, bools to 1 byte (in structs).
llvm-svn: 15048
2004-07-20 20:59:57 +00:00
Misha Brukman 8e36261aa8 Treat external variables similarly to those with weak linkage: load indirect.
llvm-svn: 15047
2004-07-20 20:43:05 +00:00
Misha Brukman 4aab086eda Differentiate between global and weak symbol loads
llvm-svn: 15037
2004-07-20 15:52:25 +00:00
Misha Brukman 684ef6ca20 * Differentiate between global and weak symbol loads
* Fix functions that take more than 32 bytes of args
* Alignment of doubles in structs is 4 bytes, not 8
* Fix passing long args: rN = hi, rN+1 = lo
* Rewrite signed divide
* Rewrite Intrinsic::returnaddress

Patch courtesy of Nate Begeman.

llvm-svn: 15036
2004-07-20 15:51:37 +00:00
Misha Brukman 42666aed5e Differentiate between global and weak symbol loads
llvm-svn: 15035
2004-07-20 15:45:27 +00:00
Misha Brukman dff882a230 Double alignment in structs is 4 bytes, not 8. Patch by Nate Begeman.
llvm-svn: 15034
2004-07-20 15:43:25 +00:00
Misha Brukman e036ff8b32 Fix stack frame layout in prologue/epilogue. Patch courtesy of Nate Begeman.
llvm-svn: 15026
2004-07-20 02:23:09 +00:00
Misha Brukman 5e744fa1a3 Move handing of GlobalValues from getReg() to copyConstantToRegister(), this
will avoid extra register-to-register copies.  Thanks to Chris for the idea.

llvm-svn: 15019
2004-07-20 00:59:38 +00:00
Misha Brukman 22802cc6cd * Fn args passed in registers are now recorded as used by the call instruction
`-> asm printer updated to not print out those registers with the call instr

All of Shootout tests now work.  Great thanks to Nate Begeman for the patch!

llvm-svn: 15015
2004-07-20 00:42:19 +00:00
Misha Brukman 818a9dc317 * cFP class split into cFP32 and cFP64
* Fn args passed in registers are now recorded as used by the call instruction
`-> asm printer updated to not print out those registers with the call instr
* Stack frame layout in prolog/epilog fixed, spills and vararg fns now work
* float/double to signed int codegen now correct
* various single precision float codegen bugs fixed
* const integer multiply codegen fixed
* select and setcc blocks inserted into the correct place in machine CFG
* load of integer constant code optimized

All of Shootout tests now work.  Great thanks to Nate Begeman for the patch!

llvm-svn: 15014
2004-07-20 00:41:46 +00:00
Chris Lattner 6bdfbaf80d Fix infinite loop
llvm-svn: 14971
2004-07-18 18:45:01 +00:00
Chris Lattner aba6c47900 CPR Fixes
llvm-svn: 14961
2004-07-18 07:29:35 +00:00
Misha Brukman e6f4a5ebb0 We don't really need to #include IPO.h into this file.
llvm-svn: 14911
2004-07-17 18:37:46 +00:00
Misha Brukman b85c2522fa * Use LI(S) to copy constants into registers intead of ADDI(S) as the latter is
a funky way to "use" R0 for a 0-valued operand
* Add IMPLICIT_DEFs for incoming function arguments via registers to help the
  register allocator not clobber those registers
* Implement comparisons with longs
* Teach emitSelectOperation() to fold the SetCC operation

Patch contributed by Nate Begeman

llvm-svn: 14901
2004-07-16 21:06:24 +00:00
Misha Brukman db032fb1f9 * Store all non-volatile int registers R13-31 on the stack, restore on exit
* Fix comment formatting

llvm-svn: 14900
2004-07-16 20:55:20 +00:00
Misha Brukman 780da8425f Fix code formatting
llvm-svn: 14899
2004-07-16 20:54:25 +00:00
Misha Brukman 3adf84ba0d Implement PowerPCInstrInfo::isMoveInstr(), patch by Nate Begeman
llvm-svn: 14898
2004-07-16 20:51:55 +00:00
Misha Brukman f0def96a36 Add prototype for TargetInstrInfo::isMoveInstr()
llvm-svn: 14897
2004-07-16 20:50:55 +00:00
Misha Brukman 9c2c293225 * Enable allocation of registers r2-r10
* Allocate registers 13-31 backwards (to be able to store them all at once)

llvm-svn: 14896
2004-07-16 20:35:20 +00:00
Misha Brukman 6ed15fd181 Add IMPLICIT_DEFS pseudo-instruction; patch by: Nate Begeman
llvm-svn: 14895
2004-07-16 20:33:41 +00:00
Misha Brukman 8c9938654a The generated instruction selector isn't (yet) functional
llvm-svn: 14894
2004-07-16 20:31:13 +00:00
Misha Brukman d4ac818593 * Output non-lazy linking stubs for external global variables
* Get rid of dead and #if 0'd code
* Minor for loop speed-up: save end iterator instead of querying every time

llvm-svn: 14893
2004-07-16 20:29:04 +00:00
Misha Brukman a6b9a566b9 Define double alignment as 8 bytes now that assert(DoubleAlignment == PointerSize)
has been eliminated

llvm-svn: 14891
2004-07-16 19:32:12 +00:00
Misha Brukman d350b64352 * Add spaces between words and numbers in comments printed out for longs/floats
* Print out IMPLICIT_DEFS as comments in the assembly, patch by Nate Begeman

llvm-svn: 14890
2004-07-16 19:01:13 +00:00
Brian Gaeke 5ce1408537 Do IMPLICIT_DEFs on incoming args' hard regs, to avoid confusing the regalloc.
Support single-fp incoming args.
Support single-fp outgoing args ('call' operands).
Support double-fp return values.

llvm-svn: 14880
2004-07-16 10:31:25 +00:00
Chris Lattner 2453818b8a The powerpc is now gone. However it is now just known as the Skeleton target.
llvm-svn: 14877
2004-07-16 07:14:34 +00:00
Chris Lattner c9819f09c2 Revert stuff that I didn't mean to checkin
llvm-svn: 14844
2004-07-15 02:33:38 +00:00
Chris Lattner 7dc9de5f43 Patches towards fixing PR341
llvm-svn: 14841
2004-07-15 02:14:30 +00:00
Misha Brukman 2661c50173 Make sure MTSPR instruction is inserted into the BasicBlock
llvm-svn: 14822
2004-07-14 18:26:31 +00:00
Misha Brukman 5193410cd9 Don't define the same register twice when loading a ConstantPointerRef to a reg
llvm-svn: 14819
2004-07-14 17:57:04 +00:00
Misha Brukman d4cbe67ce6 * Fix multiplication by powers of two and otherwise
* Clarify variable name (StoreInst SI instead of LI)

llvm-svn: 14818
2004-07-14 15:29:51 +00:00
Misha Brukman aa678b5ed4 * Specify that FP arith options have 3 operands
* Correctly load FP constants from the constant pool, should be refactored

llvm-svn: 14799
2004-07-13 15:35:45 +00:00
Misha Brukman be1b680f54 Correctly load FP constants out of the constant pool.
llvm-svn: 14782
2004-07-12 23:49:47 +00:00
Misha Brukman dcb0eec80d Implement getModuleMatchQuality and getJITMatchQuality() for PowerPC
llvm-svn: 14780
2004-07-12 23:36:12 +00:00
Chris Lattner b889c6b261 Delete the allocate*TargetMachine function, which is now dead.
The shared command line options are now in a header that makes sense.

llvm-svn: 14757
2004-07-11 04:17:58 +00:00
Chris Lattner c2726e63ed Delete the allocate*TargetMachine function, which is now dead .
The shared command line options are now in a header that makes sense.

llvm-svn: 14756
2004-07-11 04:17:10 +00:00
Chris Lattner 73eb9436ee Make these format a bit nicer
llvm-svn: 14747
2004-07-11 03:27:42 +00:00
Chris Lattner 4266f8017d Auto-registrate target
llvm-svn: 14745
2004-07-11 02:48:49 +00:00
Chris Lattner 97c176b639 Add compilability
llvm-svn: 14744
2004-07-11 02:48:28 +00:00
Misha Brukman 82a065dc41 * Add support for indexing into structures, thanks to Chris (x86)
The large diff is because of indentation of a whole region
* Fix querying predecessor blocks in SelectPHINodes(), thanks to Brian (v8)
* Add support for external functions malloc() and free()
* Fix some code indentation

Remember, kids: It's not plagiarism if you "creatively borrow" from your
sources.  It's called "research"!

llvm-svn: 14723
2004-07-09 15:45:07 +00:00
Misha Brukman 14d02cd2d8 Read/write the offset value for stack-relative loads via correct instr operand.
llvm-svn: 14722
2004-07-09 15:37:16 +00:00
Misha Brukman aefab3404e Add support for __fixdfdi(), __floatdisf(), and __floatdidf() external functions
llvm-svn: 14703
2004-07-08 19:41:16 +00:00
Misha Brukman 4c4e044e65 * Use several Function* for external functions instead of a std::map
* Non-const FP values must be loaded into int regs (for vararg fns) via memory

llvm-svn: 14701
2004-07-08 18:27:59 +00:00
Misha Brukman 59b2d4ef9d * Add support for loading FP constants from the constant pool
* Load FP values into int regs as well for vararg functions; without memory ops!

llvm-svn: 14700
2004-07-08 18:02:38 +00:00
Misha Brukman b604b4df21 * Fix header comment, excise references to X86
* Add suport for printing out references to constant pool indices

llvm-svn: 14699
2004-07-08 17:58:04 +00:00
Misha Brukman 3955f9079b * Use a map for caching lookups to external functions (fp div/rem)
* Tabs to spaces

llvm-svn: 14673
2004-07-07 20:07:22 +00:00
Misha Brukman 6ff655117d * Wrap long lines (comments and code)
* Tabs to spaces

llvm-svn: 14672
2004-07-07 20:01:36 +00:00
Misha Brukman ef84814ea9 Add fmod() to the Module being compiled so that it gets a stub in the asm file
llvm-svn: 14670
2004-07-07 15:36:18 +00:00
Misha Brukman 4556d889f4 * Add support for calling vararg functions (must pass doubles in int regs too)
* Make visitSetCondInst() share condition-generating code with EmitComparison()
* There are 13 FPRs for function-passing arguments, not 8
* Do not rely on registers being sequential, use an array lookup
* In unimplemented switch cases, send an error and abort instead of silent
  fall-through
* Add doInitialization() for adding function prototypes for external math fns
* Minor changes: fix indentation, spacing, code clarity

llvm-svn: 14653
2004-07-06 22:51:53 +00:00
Misha Brukman 2138f1b2b0 Use the more compact `bl' instead of cryptic (but equivalent) `bcl 20,31'
llvm-svn: 14652
2004-07-06 22:40:34 +00:00
Misha Brukman e9b763a83f * Add utility functions: convert SetCC => PPC opcode and invert PPC opcode
* If SetCondInst is folded into BranchInst (and it is the only user), do not
  emit code for SetCondInst
* Fix assembly opcodes in comments in visitSetCondInst()
* Fix codegen of conditional branches

llvm-svn: 14643
2004-07-06 15:32:44 +00:00
Misha Brukman 4308baa0f1 Add FIXME notes for spilling int/fp regs (need to calculate stack space).
llvm-svn: 14581
2004-07-02 17:54:38 +00:00
Chris Lattner 3594324248 Fix all of those problems that the PPC backend has running 176.gcc :)
llvm-svn: 14565
2004-07-02 05:48:42 +00:00
Misha Brukman 24a0371791 * Follow the PowerPC convention of leaving 24 bytes for linking on the stack.
* Also leave space for spilling integer registers (this should be calculated)

llvm-svn: 14554
2004-07-01 21:35:00 +00:00
Misha Brukman d028593c6e * Get rid of constant-expr handling code: we use the ConstantExpr lowering pass
* Use the SetCC handling code in the format of Brian's V8
* Add FIXMEs where calls to functions are being made without adding them to the
  Module first... they cause missing symbols at assembly-time.

llvm-svn: 14553
2004-07-01 21:34:10 +00:00
Misha Brukman 1f3a7f0255 Wrap long line
llvm-svn: 14552
2004-07-01 21:27:59 +00:00
Misha Brukman d575287551 * Do not allocate r0 as we use it indiscriminantly in the instr selector.
* Do not define CR register class because we don't (yet) have the i4 type

llvm-svn: 14551
2004-07-01 21:24:50 +00:00
Misha Brukman fcc59bd0e0 Check if operand has an allocated reg before requesting it.
llvm-svn: 14550
2004-07-01 21:09:12 +00:00
Misha Brukman 0648a903c7 * Coalesce the handy CALL* alias opcodes with the standard ones
* Congregate more branch-and-link opcodes together
* Mark FP, CPR, and special registers as volatile across calls

llvm-svn: 14511
2004-06-30 22:00:45 +00:00
Misha Brukman 299fa1b147 * Allow more registers to be allocated from the general register pool
* Define the condition register class

llvm-svn: 14510
2004-06-30 21:54:50 +00:00
Misha Brukman fee5a22f8a * Inquire about the number of operands from the instruction directly
* Only check for a register if we are sure the instruction has one allocated

llvm-svn: 14509
2004-06-30 21:54:12 +00:00
Misha Brukman 2b9106f808 Always assume a function may have calls because the printer may add `bl' to get
the PC in a code sequence for global variables.

llvm-svn: 14506
2004-06-30 00:09:12 +00:00
Misha Brukman 351646f31e * Don't save LR when outputting globals: it's already saved on the stack once
for the function
* Registers aren't necessarily sequential wrt their enums, don't rely on it
  when emitting function arguments into sequential registers
* Remove X86-specific comments about AL/BL/AH/BH/EDX/etc
* Add an abort() for an unimplemented signed right shift
* The src operand for a GEP was never emitted!  Fixed.
* We can skip zero-valued GEP indices as they are no-ops.

"Hello, World!" now works.

llvm-svn: 14505
2004-06-29 23:45:05 +00:00
Misha Brukman c794feab51 * Stop using BBNumbering, we don't really need it
* Only increment labelNumber once, because it's used by both Load{hi,lo}Addr
* There is no .bss section on PowerPC
* Use .align 2 instead of other random numbers

llvm-svn: 14504
2004-06-29 23:40:57 +00:00
Misha Brukman d409669877 Set up the prologue and epilogue to be more like the manual and GCC output.
llvm-svn: 14502
2004-06-29 23:38:26 +00:00
Misha Brukman 7454c6fff0 * Use LA instead of LWZ for LoadLoAddr
* Specify the isCall bit and caller-save registers for some call instrs

llvm-svn: 14501
2004-06-29 23:37:36 +00:00
Misha Brukman 5459dfb47b Only allocate non-volatile registers R13-31 (for now).
llvm-svn: 14500
2004-06-29 23:35:32 +00:00
Misha Brukman 4efe3da794 Lower ConstantExpressions before the code generator.
llvm-svn: 14497
2004-06-29 23:33:20 +00:00
Misha Brukman 802403723b * Fix saving LR in function prologue
* Adjust epilogue restore sequence to match the PowerPC documentation

llvm-svn: 14480
2004-06-29 17:14:42 +00:00
Misha Brukman 811f5c2c4c Assembly syntax/comment fixes by Nate Begeman.
llvm-svn: 14479
2004-06-29 17:13:26 +00:00
Chris Lattner c5f9b356af The code generator should work with unreachable blocks. If not, then this
is a bug that should be fixed in the code generator, not papered over with
the simplifycfg pass.  Eliminating this makes bugpoint much more useful

llvm-svn: 14477
2004-06-29 07:20:16 +00:00
Misha Brukman 15c10883ff Can't print out machine code before it is constructed.
llvm-svn: 14472
2004-06-28 21:16:57 +00:00
Misha Brukman 3aad397726 Fix the assembly opcode on LOADLoAddr, courtesy of Nate Begeman.
llvm-svn: 14470
2004-06-28 18:27:08 +00:00
Misha Brukman 767fa11096 Set isBranch and isTerminator bits on all branch instructions.
llvm-svn: 14469
2004-06-28 18:23:35 +00:00
Misha Brukman 2f0cda8b2a Fix loading and storing PC-relative static variables, courtesy of Nate Begeman.
llvm-svn: 14468
2004-06-28 18:20:59 +00:00
Misha Brukman 75985d725c No need to generate a lazy-linking stub for internal functions, they can be
resolved by the static linker.

llvm-svn: 14467
2004-06-28 18:03:37 +00:00
Misha Brukman 8455e0177b Do not set the `link' bit when branching to the first BB of a function, as it
will cause an infinite loop.  The link bit is only used for calling functions.

llvm-svn: 14466
2004-06-28 17:57:40 +00:00
Misha Brukman 9cb88aae40 Fix spacing around function arguments.
llvm-svn: 14463
2004-06-28 15:53:27 +00:00
Misha Brukman c52ea2574d Allow debugging machine instrs (by printout) before/after isel and regalloc
llvm-svn: 14416
2004-06-25 19:57:47 +00:00
Misha Brukman 26e36e5758 Combine several if stmts with returns into an if-then-elseif-else chain.
llvm-svn: 14414
2004-06-25 19:24:52 +00:00
Misha Brukman c22fd9a6a5 Do not move any values into registers for a void return (there isn't anything).
llvm-svn: 14413
2004-06-25 19:04:27 +00:00
Misha Brukman b5932a5708 Convert tabs to spaces.
llvm-svn: 14412
2004-06-25 18:45:07 +00:00
Misha Brukman 5dbf760e00 Fix opcode: no immediate in an `or r1, r2, r3' (all registers) instr.
llvm-svn: 14411
2004-06-25 18:36:53 +00:00
Misha Brukman c56b66f504 * Be consistent about MachineBB labels and references to them in instr stream
* Use MachineBB's built-in numbering system instead of reinventing one

llvm-svn: 14408
2004-06-25 15:42:10 +00:00
Misha Brukman a27375832b * Initialize the entire array statically, not member-at-a-time
* Remove x86-specific comment re: intel vs. at&t assembly syntax

llvm-svn: 14406
2004-06-25 15:11:34 +00:00
Misha Brukman 468d9a0087 Fix bug in previous checkin.
llvm-svn: 14405
2004-06-25 14:57:19 +00:00
Misha Brukman 9ff1cda1a8 * Wrap long lines
* Replace silent fall-through FIXME comments with an error to cerr and an abort
* No need to set size of statically initialized arrays

llvm-svn: 14404
2004-06-25 14:50:41 +00:00
Misha Brukman 08b0e61841 Excise X86-specific comments.
llvm-svn: 14403
2004-06-25 14:13:26 +00:00
Misha Brukman 5e3afa0d4c Add option to print out machine code before register allocation.
llvm-svn: 14387
2004-06-24 23:55:01 +00:00
Misha Brukman a79dd915b7 Use DEBUG() guard for printing out debug info.
llvm-svn: 14386
2004-06-24 23:54:05 +00:00
Misha Brukman c45a5a369d Add a `break' in the switch/case statement between the int/fp sections.
llvm-svn: 14385
2004-06-24 23:53:24 +00:00
Misha Brukman a08a2363ec * Lowercase the register names
* Parenthesize assert() expressions correctly
* Fix spacing around for() and if() statements

llvm-svn: 14384
2004-06-24 23:51:00 +00:00
Misha Brukman 842c710028 * Tabs to spaces
* Send an error message to std::cerr before abort()ing

llvm-svn: 14381
2004-06-24 23:19:36 +00:00
Misha Brukman f62ee7a11b * Tabs to spaces
* Remove unnecessary parens, braces, clean up code layout

llvm-svn: 14379
2004-06-24 23:04:11 +00:00
Misha Brukman 9adccb6a50 Unindent some more code to be consistent.
llvm-svn: 14377
2004-06-24 22:00:15 +00:00
Misha Brukman 1e057bf1b7 Unindent some code, it only needs 2 spaces.
llvm-svn: 14376
2004-06-24 21:56:15 +00:00
Misha Brukman 29b3dd7d35 In emitting code for a GEP instr, iterate over GEPTypes because there is one
more operand in GEPOps than there are types in GEPTypes: the pointer that is the
first operand of the GEP instruction.

llvm-svn: 14375
2004-06-24 21:54:47 +00:00
Misha Brukman f57c3cd1e8 * Order #includes
* Use the DEBUG() guard for debug printouts

llvm-svn: 14367
2004-06-24 17:31:42 +00:00
Misha Brukman c88c1ba066 Spell out `NoFramePointerElim'.
llvm-svn: 14300
2004-06-21 21:18:48 +00:00
Misha Brukman 5cb198a9c6 Use the common `NoFPElim' setting instead of our own.
llvm-svn: 14298
2004-06-21 21:10:24 +00:00
Misha Brukman 5e323e10df * Make indentation consistent at 2 chars
* Doxygenify function comments
* Wrap code at 80 cols

llvm-svn: 14295
2004-06-21 20:22:03 +00:00
Misha Brukman a97f29237e This file is no longer applicable.
llvm-svn: 14294
2004-06-21 20:17:41 +00:00
Misha Brukman 302df232b5 llvm/IntrinsicLowering.h => llvm/CodeGen/IntrinsicLowering.h
llvm-svn: 14292
2004-06-21 18:30:31 +00:00
Misha Brukman 11f74d7072 Intrinsic::isnan has gone away, support for it commented out.
Intrinsic::isunordered has arrived, and we just use the standard lowering
pass for it.

llvm-svn: 14290
2004-06-21 17:58:36 +00:00
Misha Brukman c3a0b330c9 Convert tabs to spaces.
llvm-svn: 14289
2004-06-21 17:41:12 +00:00
Misha Brukman 254d2cf452 Type::getPrimitiveID() -> getTypeID()
llvm-svn: 14288
2004-06-21 17:25:55 +00:00
Misha Brukman 6292a056a8 Type::getPrimitiveID() -> getTypeID()
llvm-svn: 14287
2004-06-21 17:19:08 +00:00
Misha Brukman e05203fb40 Initial revision
llvm-svn: 14283
2004-06-21 16:55:25 +00:00
Misha Brukman bba0f0e492 Add file comment.
llvm-svn: 14172
2004-06-14 15:13:59 +00:00
Chris Lattner 6d6b3b3ce9 Fix the fixed stack offset, patch contributed by Vladimir Prus
llvm-svn: 14110
2004-06-10 06:19:25 +00:00
Chris Lattner daeeaa72cd fine grainify namespacification
llvm-svn: 11959
2004-02-28 19:53:18 +00:00
Alkis Evlogimenos 6a35516dcc Add back machine code deleter pass until we get a MachineCode pass
that will be responsible for the creation of MachineFunctions and will
be required by all MachineFunctionPass passes.

llvm-svn: 11453
2004-02-15 00:03:15 +00:00
Alkis Evlogimenos 80da865f77 Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.

llvm-svn: 11340
2004-02-12 02:27:10 +00:00
Brian Gaeke ac2ced8554 Include PowerPC.h. Flesh out the stub versions of addPassesToEmitAssembly()
and addPassesToJITCompile() slightly.

llvm-svn: 11076
2004-02-02 19:06:36 +00:00
Brian Gaeke 2458bd6507 Add comments describing how you would add prototypes for factory methods for
PowerPC-specific passes here.

llvm-svn: 11073
2004-02-02 19:05:28 +00:00
Brian Gaeke f0cc848602 Add the JITInfo object, accessor & initializer.
llvm-svn: 10972
2004-01-23 06:39:30 +00:00
Brian Gaeke 4880432af8 Add CodeEmitter and JITInfo stubs. Dump the old
PowerPCTargetMachine::addPassesToJITCompile() method, in favor of the
TargetJITInfo interface.

llvm-svn: 10971
2004-01-23 06:35:43 +00:00
Brian Gaeke b14a3f73cd Import of skeletal PowerPC backend I have had laying around for months...
llvm-svn: 10937
2004-01-21 21:13:19 +00:00