Commit Graph

264 Commits

Author SHA1 Message Date
Misha Brukman
4ffddc5228 * Temporarily suspend LR save/restore optimization as it is not quite correct
* Implement large fixed-size allocas            Entire patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15345 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-30 15:50:45 +00:00
Chris Lattner
83660c5aed Minor corrections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15309 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 20:18:53 +00:00
Misha Brukman
8b88d906a2 Add notes on bug involving casting ulong -> double, thanks to Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15307 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 19:16:10 +00:00
Misha Brukman
a0af38c46a Simplify loading (un)signed constants to registers, patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15306 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 19:13:49 +00:00
Misha Brukman
b7697a6dd2 Remove an extra 8 byte distance penalty. Patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15305 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 19:13:07 +00:00
Misha Brukman
f63bc199c6 Find longs by type, not by their primitive size being 64. Patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15304 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 19:12:24 +00:00
Misha Brukman
8b29776d68 LI can only take signed values, so values > 32767 can only be loaded with ORI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15299 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 00:56:04 +00:00
Misha Brukman
b9b8ba58e7 Reorganize tests to place them in proper directories.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15298 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 00:55:12 +00:00
Misha Brukman
56d38c6ca1 UnitTests 2003-05-26-Shorts and 2003-07-09-LoadShorts have been fixed;
2003-05-22-VarSizeArray is broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15297 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 00:01:41 +00:00
Misha Brukman
af313fb188 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15296 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-28 00:00:48 +00:00
Misha Brukman
8c02c1cbb8 Renamed files:
* PowerPCReg.td => PowerPCRegisterinfo.td
* PowerPCInstrs.td => PowerPCInstrInfo.td


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15295 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 23:29:16 +00:00
Misha Brukman
4ce5ce25e8 Branch selection support implemented by Nate Begeman for long branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15288 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:43:04 +00:00
Misha Brukman
ab96790f2c Correctly print out long branches, assert on finding pseudo instr COND_BRANCH
Patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15286 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:40:39 +00:00
Misha Brukman
bd2c870539 Run the branch selection pass right before the asm printer.
Patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15285 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:39:34 +00:00
Misha Brukman
596c23134b Remove empty unused method processFunctionBeforeFrameFinalized()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15284 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:38:40 +00:00
Misha Brukman
f228fa0580 Add COND_BRANCH pseudo instruction, patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15283 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:35:54 +00:00
Misha Brukman
fa20a6dfd7 Build COND_BRANCHes which may become long or short, decided by a later pass.
Patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15282 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:35:23 +00:00
Misha Brukman
8aebe9f96c Moved definition of invertPPCBranchOpcode() into PowerPCInstrInfo class.
Patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15281 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:34:11 +00:00
Misha Brukman
999d9cfde5 Add PowerPCBranchSelector to discover which are `long' branches.
Contributed by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15280 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 18:33:06 +00:00
Misha Brukman
c91bc30436 Fixed saving/restoring LR unconditionally, only done as necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15275 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:17:48 +00:00
Misha Brukman
9a771d55fe 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'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15274 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:17:18 +00:00
Misha Brukman
e862f306fb LR is a 32-bit int reg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15273 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:15:32 +00:00
Misha Brukman
53f567817c MovePCtoLR (which is `bl' in disguise) modifies LR implicitly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15272 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:15:05 +00:00
Misha Brukman
08cc7b30bb Register LR is callee-saved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15271 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:14:34 +00:00
Misha Brukman
435c785803 Add IMPLICIT_DEF of LR for branch-and-link instrs (calls and global accesses)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15270 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:13:58 +00:00
Misha Brukman
ab640a5728 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15245 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 22:00:26 +00:00
Misha Brukman
3ada3e3f82 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15244 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 21:50:38 +00:00
Misha Brukman
8790d47453 assert() on MachineInstr properties instead of checking them dynamically
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 21:35:58 +00:00
Misha Brukman
774a297c83 * Recognize `addi r1, r2, 0' a move instruction
* List formats of instructions currently recognized as moves


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15242 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 21:29:00 +00:00
Misha Brukman
b097f216b0 * Rewrote casts
* Implemented GEP folding
* Dynamically output global address stuff once per function
* Fix casting fp<->short/byte

Patch contributed by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15237 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 18:13:24 +00:00
Misha Brukman
cf8d244394 Increment the label number in runOnFunction() rather than while printing out
some instruction.  Patch by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15236 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 16:28:33 +00:00
Misha Brukman
bb966a4a59 More notes on bugs, unimplemented features, and suggested code improvements.
Written by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15235 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 16:23:55 +00:00
Misha Brukman
3c616b45e7 Fix subtracting values > 2^15 in the prologue/epilogue, by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15234 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 16:22:52 +00:00
Misha Brukman
1be339ac4c Running list of bugs, unimplemented features, currently broken tests, until we
have a nightly tester set up for PowerPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15147 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 22:37:22 +00:00
Misha Brukman
4722544855 Eliminate spurious empty space; make code easier to page through.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15146 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 22:35:49 +00:00
Misha Brukman
1245c35935 Simplify boolean test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15145 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 21:43:26 +00:00
Misha Brukman
b160d1f9f7 Implement casting a floating point to 32-bit unsigned value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15143 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 20:32:59 +00:00
Misha Brukman
e2eceb5c73 * Codegen of GEPs dramatically improved by folding multiplies and adds
* Function pointers implemented correctly using appropriate stubs

Contributed by Nate Begeman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15133 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 16:08:20 +00:00
Misha Brukman
9accb24c89 Bool alignment on MacOSX/PowerPC is 4 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15122 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 01:11:46 +00:00
Misha Brukman
4c14f33844 * Change class of BoolTy back to cInt
* Fix indentation back to 2 spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15121 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 01:11:19 +00:00
Misha Brukman
2ed17cadb4 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-22 15:58:04 +00:00
Misha Brukman
a31f1f7cb2 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:30:18 +00:00
Misha Brukman
17a9000ac8 * Speed up canUseAsImmediateForOpcode() by comparing Operand before
dyn_cast<>ing and checking Constant's value
* Convert tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:22:06 +00:00
Misha Brukman
97a296f743 * Fix printing of signed immediate values (Nate Begeman)
* Fix printing of `zeroinitializer'
* Fix printing of `linkonce' globals, complete with stubs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15084 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:11:11 +00:00
Misha Brukman
1013ef5228 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15083 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:09:08 +00:00
Misha Brukman
e0380e0c42 Use addSImm() instead of addImm() for stack offsets, which may be negative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 19:36:57 +00:00
Misha Brukman
53d9a48855 Add SUBI instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15077 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 15:53:04 +00:00
Misha Brukman
cd2273f4a7 Shorts are aligned to 2 bytes, bools to 1 byte (in structs).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 20:59:57 +00:00
Misha Brukman
bf417a6d46 Treat external variables similarly to those with weak linkage: load indirect.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15047 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 20:43:05 +00:00
Misha Brukman
86ddcf9d4f Differentiate between global and weak symbol loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15037 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 15:52:25 +00:00
Misha Brukman
ec6319a00c * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15036 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 15:51:37 +00:00
Misha Brukman
e48178e8a6 Differentiate between global and weak symbol loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15035 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 15:45:27 +00:00
Misha Brukman
5c4544160f Double alignment in structs is 4 bytes, not 8. Patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15034 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 15:43:25 +00:00
Misha Brukman
d43b9fd1ae Fix stack frame layout in prologue/epilogue. Patch courtesy of Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15026 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 02:23:09 +00:00
Misha Brukman
ba1c1da36a Move handing of GlobalValues from getReg() to copyConstantToRegister(), this
will avoid extra register-to-register copies.  Thanks to Chris for the idea.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15019 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 00:59:38 +00:00
Misha Brukman
61114619bc * 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15015 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 00:42:19 +00:00
Misha Brukman
7e898c3e04 * 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15014 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 00:41:46 +00:00
Chris Lattner
a51e4f6301 Fix infinite loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14971 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 18:45:01 +00:00
Chris Lattner
67910e1eb0 CPR Fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14961 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 07:29:35 +00:00
Misha Brukman
a57b76fece We don't really need to #include IPO.h into this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14911 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 18:37:46 +00:00
Misha Brukman
bebde759e5 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14901 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 21:06:24 +00:00
Misha Brukman
af7f28cdac * Store all non-volatile int registers R13-31 on the stack, restore on exit
* Fix comment formatting


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14900 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:55:20 +00:00
Misha Brukman
be15f67af7 Fix code formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14899 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:54:25 +00:00
Misha Brukman
01d46e9c55 Implement PowerPCInstrInfo::isMoveInstr(), patch by Nate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14898 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:51:55 +00:00
Misha Brukman
6b4ea88e83 Add prototype for TargetInstrInfo::isMoveInstr()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14897 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:50:55 +00:00
Misha Brukman
86fd274790 * Enable allocation of registers r2-r10
* Allocate registers 13-31 backwards (to be able to store them all at once)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14896 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:35:20 +00:00
Misha Brukman
2bf5438931 Add IMPLICIT_DEFS pseudo-instruction; patch by: Nate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14895 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:33:41 +00:00
Misha Brukman
039ba763d1 The generated instruction selector isn't (yet) functional
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14894 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:31:13 +00:00
Misha Brukman
da2b13f694 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14893 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 20:29:04 +00:00
Misha Brukman
6f14ad1ca0 Define double alignment as 8 bytes now that assert(DoubleAlignment == PointerSize)
has been eliminated


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14891 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 19:32:12 +00:00
Misha Brukman
29188c6ff6 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14890 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 19:01:13 +00:00
Chris Lattner
81d54465d9 The powerpc is now gone. However it is now just known as the Skeleton target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14877 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 07:14:34 +00:00
Chris Lattner
017fdcb76d Revert stuff that I didn't mean to checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14844 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:33:38 +00:00
Chris Lattner
76e2df2645 Patches towards fixing PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14841 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:14:30 +00:00
Misha Brukman
5f8cce1348 Make sure MTSPR instruction is inserted into the BasicBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14822 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 18:26:31 +00:00
Misha Brukman
32caa8de62 Don't define the same register twice when loading a ConstantPointerRef to a reg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 17:57:04 +00:00
Misha Brukman
8d442c2dc4 * Fix multiplication by powers of two and otherwise
* Clarify variable name (StoreInst SI instead of LI)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 15:29:51 +00:00
Misha Brukman
a596f8c3aa * Specify that FP arith options have 3 operands
* Correctly load FP constants from the constant pool, should be refactored


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 15:35:45 +00:00
Misha Brukman
d9aa7836e2 Correctly load FP constants out of the constant pool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14782 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 23:49:47 +00:00
Misha Brukman
01eca8d2c2 Implement getModuleMatchQuality and getJITMatchQuality() for PowerPC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14780 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 23:36:12 +00:00
Chris Lattner
68905bb6fc Delete the allocate*TargetMachine function, which is now dead.
The shared command line options are now in a header that makes sense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 04:17:58 +00:00
Chris Lattner
0cf0c37469 Delete the allocate*TargetMachine function, which is now dead .
The shared command line options are now in a header that makes sense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 04:17:10 +00:00
Chris Lattner
71d24aab2d Make these format a bit nicer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14747 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 03:27:42 +00:00
Chris Lattner
d36c970a11 Auto-registrate target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14745 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 02:48:49 +00:00
Chris Lattner
98599d098f Add compilability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14744 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 02:48:28 +00:00
Misha Brukman
313efcb886 * 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"!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14723 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-09 15:45:07 +00:00
Misha Brukman
c1ef127ae2 Read/write the offset value for stack-relative loads via correct instr operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14722 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-09 15:37:16 +00:00
Misha Brukman
f3f6382423 Add support for __fixdfdi(), __floatdisf(), and __floatdidf() external functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14703 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 19:41:16 +00:00
Misha Brukman
0aa97c625b * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14701 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 18:27:59 +00:00
Misha Brukman
fc879c336b * Add support for loading FP constants from the constant pool
* Load FP values into int regs as well for vararg functions; without memory ops!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14700 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 18:02:38 +00:00
Misha Brukman
05fcd0c891 * Fix header comment, excise references to X86
* Add suport for printing out references to constant pool indices


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14699 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 17:58:04 +00:00
Misha Brukman
2834a4dd1d * Use a map for caching lookups to external functions (fp div/rem)
* Tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14673 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 20:07:22 +00:00
Misha Brukman
e62cd37c2a * Wrap long lines (comments and code)
* Tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14672 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 20:01:36 +00:00
Misha Brukman
b093259edd Add fmod() to the Module being compiled so that it gets a stub in the asm file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14670 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 15:36:18 +00:00
Misha Brukman
d18a31d2fa * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14653 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-06 22:51:53 +00:00
Misha Brukman
4cf5112500 Use the more compact bl' instead of cryptic (but equivalent) bcl 20,31'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14652 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-06 22:40:34 +00:00
Misha Brukman
e9c6551fed * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14643 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-06 15:32:44 +00:00
Misha Brukman
68a9b04e77 Add FIXME notes for spilling int/fp regs (need to calculate stack space).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14581 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-02 17:54:38 +00:00
Chris Lattner
fab96f0b69 Fix all of those problems that the PPC backend has running 176.gcc :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-02 05:48:42 +00:00
Misha Brukman
452069abcc * Follow the PowerPC convention of leaving 24 bytes for linking on the stack.
* Also leave space for spilling integer registers (this should be calculated)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14554 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 21:35:00 +00:00
Misha Brukman
425ff24bb3 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14553 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 21:34:10 +00:00
Misha Brukman
f233a84b3c Wrap long line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14552 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 21:27:59 +00:00
Misha Brukman
15eb0a15e5 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14551 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 21:24:50 +00:00
Misha Brukman
4363bdb0e5 Check if operand has an allocated reg before requesting it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14550 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 21:09:12 +00:00
Misha Brukman
c661c3001c * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14511 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 22:00:45 +00:00
Misha Brukman
da7515a378 * Allow more registers to be allocated from the general register pool
* Define the condition register class


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14510 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 21:54:50 +00:00
Misha Brukman
b9e8f97aef * Inquire about the number of operands from the instruction directly
* Only check for a register if we are sure the instruction has one allocated


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14509 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 21:54:12 +00:00
Misha Brukman
ce76db9083 Always assume a function may have calls because the printer may add `bl' to get
the PC in a code sequence for global variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14506 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 00:09:12 +00:00
Misha Brukman
14d8c7a6a0 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14505 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:45:05 +00:00
Misha Brukman
61297ee118 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14504 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:40:57 +00:00
Misha Brukman
cbcdb9c0a7 Set up the prologue and epilogue to be more like the manual and GCC output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14502 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:38:26 +00:00
Misha Brukman
5fa2b028b8 * Use LA instead of LWZ for LoadLoAddr
* Specify the isCall bit and caller-save registers for some call instrs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14501 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:37:36 +00:00
Misha Brukman
8ee0100880 Only allocate non-volatile registers R13-31 (for now).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14500 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:35:32 +00:00
Misha Brukman
60f35813fc Lower ConstantExpressions before the code generator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14497 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 23:33:20 +00:00
Misha Brukman
e19ca38a32 * Fix saving LR in function prologue
* Adjust epilogue restore sequence to match the PowerPC documentation


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14480 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 17:14:42 +00:00
Misha Brukman
218bec7bd3 Assembly syntax/comment fixes by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14479 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 17:13:26 +00:00
Chris Lattner
1b17438aa8 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14477 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-29 07:20:16 +00:00
Misha Brukman
7cd444082e Can't print out machine code before it is constructed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14472 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 21:16:57 +00:00
Misha Brukman
3905b57442 Fix the assembly opcode on LOADLoAddr, courtesy of Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14470 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 18:27:08 +00:00
Misha Brukman
b2edb443e0 Set isBranch and isTerminator bits on all branch instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14469 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 18:23:35 +00:00
Misha Brukman
7e5812cd17 Fix loading and storing PC-relative static variables, courtesy of Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14468 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 18:20:59 +00:00
Misha Brukman
a6e58b3cfb No need to generate a lazy-linking stub for internal functions, they can be
resolved by the static linker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14467 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 18:03:37 +00:00
Misha Brukman
9c661c8e26 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14466 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 17:57:40 +00:00
Misha Brukman
bb4a90820c Fix spacing around function arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14463 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 15:53:27 +00:00
Misha Brukman
34fa8714a4 Allow debugging machine instrs (by printout) before/after isel and regalloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14416 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 19:57:47 +00:00
Misha Brukman
c6cc10f48f Combine several if stmts with returns into an if-then-elseif-else chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14414 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 19:24:52 +00:00
Misha Brukman
d47bbf7ce5 Do not move any values into registers for a void return (there isn't anything).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14413 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 19:04:27 +00:00
Misha Brukman
1cbb3ee75f Convert tabs to spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14412 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 18:45:07 +00:00
Misha Brukman
972569a22f Fix opcode: no immediate in an `or r1, r2, r3' (all registers) instr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14411 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 18:36:53 +00:00
Misha Brukman
2bf183c092 * Be consistent about MachineBB labels and references to them in instr stream
* Use MachineBB's built-in numbering system instead of reinventing one


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14408 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 15:42:10 +00:00
Misha Brukman
22e12076e9 * Initialize the entire array statically, not member-at-a-time
* Remove x86-specific comment re: intel vs. at&t assembly syntax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14406 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 15:11:34 +00:00
Misha Brukman
9ecf3bf708 Fix bug in previous checkin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14405 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 14:57:19 +00:00
Misha Brukman
911afde4ae * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14404 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 14:50:41 +00:00
Misha Brukman
179d97cfa3 Excise X86-specific comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14403 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 14:13:26 +00:00
Misha Brukman
75afe1f904 Add option to print out machine code before register allocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14387 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:55:01 +00:00
Misha Brukman
f3e50bea06 Use DEBUG() guard for printing out debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14386 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:54:05 +00:00
Misha Brukman
e327e49913 Add a `break' in the switch/case statement between the int/fp sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14385 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:53:24 +00:00
Misha Brukman
7f484a5fff * Lowercase the register names
* Parenthesize assert() expressions correctly
* Fix spacing around for() and if() statements


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14384 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:51:00 +00:00
Misha Brukman
ca428df792 * Tabs to spaces
* Send an error message to std::cerr before abort()ing


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14381 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:19:36 +00:00
Misha Brukman
46fd00aec6 * Tabs to spaces
* Remove unnecessary parens, braces, clean up code layout


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14379 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 23:04:11 +00:00
Misha Brukman
fadb82f920 Unindent some more code to be consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14377 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 22:00:15 +00:00
Misha Brukman
1916bf9427 Unindent some code, it only needs 2 spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14376 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 21:56:15 +00:00
Misha Brukman
98649d1796 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14375 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 21:54:47 +00:00
Misha Brukman
05794498d9 * Order #includes
* Use the DEBUG() guard for debug printouts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14367 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 17:31:42 +00:00
Misha Brukman
3d357441bf Spell out `NoFramePointerElim'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14300 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 21:18:48 +00:00
Misha Brukman
83eaa0b567 Use the common `NoFPElim' setting instead of our own.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14298 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 21:10:24 +00:00
Misha Brukman
2fec9905aa * Make indentation consistent at 2 chars
* Doxygenify function comments
* Wrap code at 80 cols


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14295 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 20:22:03 +00:00
Misha Brukman
1e32f79d20 This file is no longer applicable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14294 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 20:17:41 +00:00
Misha Brukman
8c9f520b33 llvm/IntrinsicLowering.h => llvm/CodeGen/IntrinsicLowering.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14292 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 18:30:31 +00:00
Misha Brukman
a2916ce49a Intrinsic::isnan has gone away, support for it commented out.
Intrinsic::isunordered has arrived, and we just use the standard lowering
pass for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14290 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 17:58:36 +00:00