Commit Graph

56 Commits

Author SHA1 Message Date
Misha Brukman
5b5708106e Renamed PPC32 (namespace for regs, opcodes) to PPC to include 64-bit targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15631 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-10 22:47:03 +00:00
Nate Begeman
b64af918cb 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15626 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-10 20:42:36 +00:00
Chris Lattner
3ea934668b 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15536 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-06 06:58:50 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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