Commit Graph

2000 Commits

Author SHA1 Message Date
Chris Lattner 5842560090 Initial impl of this file. Yes this is pretty useless right now, but it
will grow in time.

llvm-svn: 14743
2004-07-11 02:44:26 +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
Brian Gaeke 8165863a9d Support setcc on fp values.
llvm-svn: 14687
2004-07-08 09:08:35 +00:00
Brian Gaeke 7b4722e62c Add floating-point branches and compares. Compares don't complete
until the next cycle, and there's no interlock, so they effectively
have a delay slot.

llvm-svn: 14686
2004-07-08 09:08:22 +00:00
Brian Gaeke 3b204c3f24 Fix bug where SwitchSection would fail to change to ".bss" successfully.
llvm-svn: 14685
2004-07-08 08:08:23 +00:00
Brian Gaeke 4fdd22b922 Fix bug involving bool arguments to binary operators.
Fix typo in comment.

llvm-svn: 14684
2004-07-08 08:08:10 +00:00
Brian Gaeke dc5940794c Fix bug in copying long constants to register pairs. We were getting
the top and bottom halves backwards...how embarrassing.
Support 'cast long to long' and other similar no-op casts to long.
Support 'ret long'.

llvm-svn: 14683
2004-07-08 07:52:13 +00:00
Brian Gaeke 4ba31a2e1e Support 'ret float'
llvm-svn: 14681
2004-07-08 07:22:27 +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
Chris Lattner 0969646d6e Add #includes
llvm-svn: 14625
2004-07-04 17:19:21 +00:00
Reid Spencer eb04d9bcb4 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +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
Brian Gaeke f6d2471c5d Fix use-before-def thinko
llvm-svn: 14570
2004-07-02 07:01:31 +00:00
Chris Lattner 55256dbf9b Fix potential problems with unreachable basic blocks.
Also, while noone's looking, add support for constant expressions.  Wait,
I said not to look!

llvm-svn: 14566
2004-07-02 05:49:11 +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
Chris Lattner 6c322ecc31 Remove dead blocks
llvm-svn: 14564
2004-07-02 05:46:41 +00:00
Brian Gaeke 186e3d1098 Add M_TERMINATOR_FLAG to terminator instructions (branches and returns).
Also, the RETURN instructions are not used in the sparcv9 backend.

llvm-svn: 14559
2004-07-02 04:57:37 +00:00
Brian Gaeke fb894bd864 RETURN instructions are not used in the sparc backend.
When in doubt, stamp it out!!

llvm-svn: 14558
2004-07-02 04:57:35 +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
Chris Lattner 18a08e702d Handle targets where alignment can be bigger than the size of the data.
Contributed by Vladimir Prus!

llvm-svn: 14534
2004-07-01 17:32:59 +00:00
Misha Brukman b9125f462d Fix indentation to be 2 spaces.
llvm-svn: 14512
2004-06-30 22:11:03 +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 04f07b4589 visitSetCondInst() takes a parameter of type `SetCondInst'
llvm-svn: 14508
2004-06-30 21:47:40 +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 887fd23dfc Fix associativity of parameters to assert(): now it actually makes sense.
llvm-svn: 14483
2004-06-29 19:43:20 +00:00
Misha Brukman c968b87d94 Convert tabs to spaces.
llvm-svn: 14482
2004-06-29 19:28:53 +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
Chris Lattner e6e1b48023 I believe that the code generator now properly handles dead basic blocks. If not,
this is a bug, and should be fixed.

llvm-svn: 14476
2004-06-29 07:17:12 +00:00
Chris Lattner 1a920d49f6 Fix a regression from r1.224. In particular, codegen a cast from double ->
float as a truncation by going through memory.  This truncation was being
skipped, which caused 175.vpr to fail after aggressive register promotion.

llvm-svn: 14473
2004-06-29 00:14:38 +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
Brian Gaeke 81f67f60ec Allow saving and restoring of double and float registers.
Allow copying of float registers.

llvm-svn: 14445
2004-06-27 22:59:56 +00:00
Brian Gaeke b3d33c7994 Add FITOS, FITOD, and F{ADD,SUB,MUL,DIV}{S,D}.
llvm-svn: 14444
2004-06-27 22:53:56 +00:00
Brian Gaeke 187ff172b6 Support printing constant pool indices.
If we see an "unknown operand", abort so it's easier to fix it.

llvm-svn: 14441
2004-06-27 22:50:44 +00:00
Brian Gaeke c81b5a5331 Trim whitespace.
Support cast of ints (and narrower) to float and double.
Support cast double to double (using load and store).
Abort if we see a CallInst or SetCondInst with long/fp args, instead
of producing bad code.
Support add, sub, mul, div of float and double.

llvm-svn: 14440
2004-06-27 22:47:33 +00:00
Chris Lattner 6fb22cd7ef There is no reason to print ValueType here
llvm-svn: 14425
2004-06-26 19:36:34 +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
Tanya Lattner 23dbc8170c Made a fix so that you can print out MachineInstrs that belong to a MachineBasicBlock that is not yet attached to a MachineFunction. This change includes changing the third operand (TargetMachine) to a pointer for the MachineInstr::print function.
llvm-svn: 14389
2004-06-25 00:13:11 +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 c562342751 * LowercaseString moved to StringExtras.h
* Wrap long line to 80 cols

llvm-svn: 14382
2004-06-24 23:38:20 +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
Brian Gaeke 27966ba77b Add FSTOD and FDTOS conversion instructions.
llvm-svn: 14372
2004-06-24 21:22:09 +00:00
Brian Gaeke 72490c8d86 Support cast float to float, cast double to float, and cast float to double.
(It's not yet clear how to copy doubles from register to register.)

llvm-svn: 14371
2004-06-24 21:22:08 +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
Brian Gaeke eea4b17cf8 Make the double-fp pseudo registers be "NamedRegs".
llvm-svn: 14366
2004-06-24 09:23:21 +00:00
Brian Gaeke 2f6741f4f3 Fix a dyn_cast in copyConstantToRegister which should have been a cast.
Compactify the code that emits copies of constant ints into registers.

llvm-svn: 14365
2004-06-24 09:17:47 +00:00
Brian Gaeke c605ae6754 The long integer pseudo-regs are history. So long, we hardly knew ye.
llvm-svn: 14364
2004-06-24 08:55:21 +00:00
Brian Gaeke 4ed2826ce5 Use correct add*Imm form in more BuildMI calls.
Fix bug in emitGEPOperation where we weren't passing MBB, IP to getReg.
(hey, wouldn't a constant expression lowering pass be cool? huh huhuhuh)
Fix bug in emitGEPOperation where we might try to OR a constant into a
register which was too big to fit in the immediate field.
Support and, or, xor of longs.

llvm-svn: 14363
2004-06-24 08:55:09 +00:00
Brian Gaeke 7777e66704 Rename the load and store opcodes. The non-fp ones only have one
variant worth worrying about; the fp ones have two.

llvm-svn: 14362
2004-06-24 07:37:12 +00:00
Brian Gaeke c8e1b5abe8 Rename the load and store opcodes. The non-fp ones only have one
variant worth worrying about; the fp ones have two.
Add fp stores.

llvm-svn: 14361
2004-06-24 07:36:59 +00:00
Brian Gaeke 9f455efff1 Rename the load and store opcodes. The non-fp ones only have one
variant worth worrying about; the fp ones have two.
Stub out the case analysis of int-to-fp casts (no code yet).
I think the number of operands passed to BuildMI for loads was wrong.
Support load and store of float and double.

llvm-svn: 14360
2004-06-24 07:36:48 +00:00
Brian Gaeke 8863de761d Strange as it may sound, we'll not use LDD/STD to store longs. For reasons of
representational consistency, we want to address the halves of each 64-bit value
separately.

llvm-svn: 14356
2004-06-24 06:44:57 +00:00
Brian Gaeke 1e8cc73ea3 Support constant cast expressions.
llvm-svn: 14355
2004-06-24 06:33:00 +00:00
Brian Gaeke ae6fb8ae5c Make the most commonly preselected instructions add to the names of the
instructions they augment, instead of replacing them.  It's good for debugging,
and it's OK for the sparcv9 backend.

llvm-svn: 14353
2004-06-23 21:41:32 +00:00
Brian Gaeke 5825bdd8b2 Add pseudo-registers and register class for 64-bit integer values.
llvm-svn: 14332
2004-06-22 20:14:41 +00:00
Misha Brukman 31f4df6b54 Order #includes as per style guide.
llvm-svn: 14305
2004-06-21 21:54:40 +00:00
Misha Brukman 96041e58b9 Direct declaration of namespace-ified globals does not work, must enclose
them with a namespace declaration.

llvm-svn: 14303
2004-06-21 21:44:12 +00:00
Misha Brukman d0bf6f17d1 Specify variables' namespace directly instead of using an enclosing namespace.
llvm-svn: 14302
2004-06-21 21:21:49 +00:00
Misha Brukman 0bfea680bb Move implemented interface header up to the top.
llvm-svn: 14301
2004-06-21 21:20:23 +00:00
Misha Brukman c88c1ba066 Spell out `NoFramePointerElim'.
llvm-svn: 14300
2004-06-21 21:18:48 +00:00
Misha Brukman c22299d21b Spell out `NoFramePointerElim' for readability.
llvm-svn: 14299
2004-06-21 21:17:44 +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 069ca067e1 Implement `NoFPElim' in a target-agnostic fashion so it can be shared.
llvm-svn: 14297
2004-06-21 21:08:45 +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
Chris Lattner bcdadf3765 Move the IntrinsicLowering header into the CodeGen directory, as per PR346
llvm-svn: 14266
2004-06-20 07:49:54 +00:00
Brian Gaeke 5b433a5de9 .zero doesn't work in the Solaris assembler.
llvm-svn: 14231
2004-06-18 08:59:16 +00:00
Brian Gaeke 4125c92009 Get rid of selects the easy way
llvm-svn: 14230
2004-06-18 08:46:15 +00:00
Brian Gaeke 694f7b78d9 Make visitAllocaInst() look more like its X86 counterpart.
llvm-svn: 14229
2004-06-18 08:45:52 +00:00
Brian Gaeke fcc30aca1b Mess around with allocation order. In particular, I think we ought to be
using the local & in regs first because they are not clobbered by calls.

llvm-svn: 14228
2004-06-18 08:19:08 +00:00
Brian Gaeke b42345811e JMPL has a delay slot.
llvm-svn: 14227
2004-06-18 08:18:54 +00:00
Brian Gaeke 7d9af983de Clean up the commented-out F3_3 stuff.
Replace it with a working class for FP instrs.

llvm-svn: 14226
2004-06-18 06:28:21 +00:00
Brian Gaeke 75f3738969 Fix jmpl.
Add some FP moves.

llvm-svn: 14225
2004-06-18 06:28:10 +00:00
Brian Gaeke 12ee9a1e75 Support printing base+offset pairs where the offset is a register.
Use this for printing the jmpl indirect-call instruction.

llvm-svn: 14224
2004-06-18 06:27:59 +00:00
Brian Gaeke 5ebab28a8a Support intrinsic calls (although no particular intrinsics are supported yet).
Support indirect calls.
Support returning a float value.

llvm-svn: 14223
2004-06-18 06:27:48 +00:00
Brian Gaeke 51d3c7b05b Add load instructions for floating-point registers.
llvm-svn: 14217
2004-06-18 05:19:27 +00:00
Brian Gaeke 21305c6f0c Support alloca instructions.
Support copying floating-point constants to registers.
Add assertion to visitCallInst to abort if we hit a NULL calledFunction, for now.

llvm-svn: 14216
2004-06-18 05:19:16 +00:00
Chris Lattner aa27623b99 Codegen sub C, X a little bit better for register pressure. Instead of
mov REG, C
sub REG, X

generate:

neg X
add X, C

which uses one less reg

llvm-svn: 14213
2004-06-18 00:50:37 +00:00
Chris Lattner b30d12292a Fold setcc instructions into select and branches that are not in the same BB as
the setcc.

llvm-svn: 14212
2004-06-18 00:29:22 +00:00
Brian Gaeke c37af629b4 Make storeRegToStackSlot slightly shorter.
Make copyRegToReg return 1 instead of -1.
Edit a comment in emitPrologue().

llvm-svn: 14211
2004-06-17 22:34:48 +00:00
Brian Gaeke eca9546dc3 Set the isBranch and isTerminator flags on branch instructions correctly.
Add a FIXME about the (currently unused) JMPL instructions.

llvm-svn: 14210
2004-06-17 22:34:29 +00:00
Brian Gaeke 63c1d6eda8 Emit stores correctly; don't fail an assertion.
llvm-svn: 14209
2004-06-17 22:34:19 +00:00
Brian Gaeke c4ee938f55 Support generating machine instructions for Phi nodes (based on x86, but with
modifications for 1 LLVM BB --> many MBBs).
Fix store operand order: make it always be Base, Offset, SrcReg (think
"[ Base + Offset ] = SrcReg").
Rewrite visitBranchInst() to be even dumber (but working) -- give up on
the branch fallthrough trick, for the time being.
Make visitSetCondInst() work.

llvm-svn: 14208
2004-06-17 22:34:08 +00:00
Brian Gaeke a067fb3e6b Recognize more branches.
llvm-svn: 14207
2004-06-17 22:33:57 +00:00
Chris Lattner 7887da36de Do not fold loads into instructions if it is used more than once. In particular
we do not want to fold the load in cases like this:

  X = load
    = add A, X
    = add B, X

llvm-svn: 14204
2004-06-17 22:15:25 +00:00
Brian Gaeke 2f2b5f5b93 Use addGlobalAddress and addMBB for call & branch targets instead of addPCDisp.
Abort if we see a PCRelativeDisp MachineOperand, to be safe. This matches
the X86 backend.

llvm-svn: 14202
2004-06-17 19:39:23 +00:00
Chris Lattner 6b7275996c Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner 7011d35594 Remove support for llvm.isnan. Alkis wins :)
llvm-svn: 14189
2004-06-15 21:48:07 +00:00
Chris Lattner 70dfc06e02 Add basic support for the isunordered intrinsic. The isnan stuff still needs to go
llvm-svn: 14185
2004-06-15 21:36:44 +00:00
Brian Gaeke 476c73b241 Fix thinko in visitor... ShiftInsts should currently be delegated
to visitBinaryOperator.

llvm-svn: 14182
2004-06-15 21:09:46 +00:00
Brian Gaeke 675c0e9701 I think we'll use the standard lowering passes for now.
llvm-svn: 14179
2004-06-15 20:37:12 +00:00
Brian Gaeke 0c8ee30d53 Fix bug generating code for void call instructions: don't call
getReg() on void value.

llvm-svn: 14178
2004-06-15 20:06:32 +00:00
Brian Gaeke 065a6cb93a Squash a warning from the Solaris assembler by aligning the stack
on a double-word boundary instead of a single-word boundary.

llvm-svn: 14177
2004-06-15 19:53:10 +00:00
Brian Gaeke ad98a9b526 Allow special-casing of operand printing based on opcode. Print
non-register, non-immed. arguments to SETHI and OR using %hi() and
%lo() respectively.

llvm-svn: 14176
2004-06-15 19:52:59 +00:00
Brian Gaeke 19fbd28a06 Support constant GEP expressions.
Support copying long constants to register pairs.
Support copying ConstantPointerNulls and ConstantPointerRefs to registers.

llvm-svn: 14175
2004-06-15 19:16:07 +00:00
Misha Brukman bba0f0e492 Add file comment.
llvm-svn: 14172
2004-06-14 15:13:59 +00:00
Brian Gaeke 99c6539bce Make -print-machineinstrs even stronger. You get to see the final code after
peepholing, and make it work the same way in the JIT as in LLC.

llvm-svn: 14170
2004-06-14 05:05:45 +00:00
Chris Lattner 1c2be0e5a9 By far, one of the most common uses of isnan is to make 'isunordered'
comparisons.  In an 'isunordered' predicate, which looks like this at
the LLVM level:

        %a = call bool %llvm.isnan(double %X)
        %b = call bool %llvm.isnan(double %Y)
        %COM = or bool %a, %b

We used to generate this code:

        fxch %ST(1)
        fucomip %ST(0), %ST(0)
        setp %AL
        fucomip %ST(0), %ST(0)
        setp %AH
        or %AL, %AH

With this patch, we generate this code:

        fucomip %ST(0), %ST(1)
        fstp %ST(0)
        setp %AL

Which should make alkis happy.  Tested as X86/compare_folding.llx:test1

llvm-svn: 14148
2004-06-11 05:33:49 +00:00
Chris Lattner 71186e2fb6 Fix bug in previous checkin
llvm-svn: 14146
2004-06-11 05:22:44 +00:00
Chris Lattner 5ed9113e14 No really, these are dead now
llvm-svn: 14145
2004-06-11 04:50:14 +00:00
Chris Lattner b35f47627d Now that compare instructions aren't lumped in with the other twoargfp instructions,
we can get rid of the FpUCOM/FpUCOMi pseudo instructions, which makes stuff simpler
and faster.

llvm-svn: 14144
2004-06-11 04:49:02 +00:00
Chris Lattner 0876edf122 Introduce a new FP instruction type to separate the compare cases from the
twoarg cases.

llvm-svn: 14143
2004-06-11 04:41:24 +00:00
Chris Lattner 26a964f88e Add direct support for the isnan intrinsic, implementing test/Regression/CodeGen/X86/isnan.llx
testcase

llvm-svn: 14141
2004-06-11 04:31:10 +00:00
Chris Lattner a0cfedef3a Add support for the setp instructions
llvm-svn: 14140
2004-06-11 04:30:06 +00:00
Chris Lattner 94ff2c3210 Split compare instruction handling OUT of handleTwoArgFP into handleCompareFP.
This makes the code much simpler, and the two cases really do belong apart.
Once we do it, it's pretty obvious how flawed the logic was for A != A case,
so I fixed it (fixing PR369).

This also uses freeStackSlotAfter instead of inserting an fxchg then
popStackAfter'ing in the case where there is a dead result (unlikely, but
possible), producing better code.

llvm-svn: 14139
2004-06-11 04:25:06 +00:00
Brian Gaeke 2655aab200 Turn loads of ConstantPointerNulls into loads of zero... don't spill
them into the constant pool.

llvm-svn: 14128
2004-06-11 02:03:48 +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
Brian Gaeke 5b03a0628f Encode %fsr correctly; don't fail an assertion.
llvm-svn: 14103
2004-06-09 21:54:59 +00:00
Brian Gaeke 87d8878f6d Fix encoding of ST*FSR instructions.
llvm-svn: 14102
2004-06-09 21:54:58 +00:00
Brian Gaeke 87c75632ee Fix assertion failure message to have the right method name.
llvm-svn: 14101
2004-06-09 20:44:42 +00:00
John Criswell 9095c64147 Fix for PR#366. We use getClassB() so that we can handle cast instructions
that cast to bool.

llvm-svn: 14096
2004-06-09 15:18:51 +00:00
Brian Gaeke c365e7cc99 Fix a minor bug in the map - since this pass adds a global symbol, it must be
accounted for in the map (at least, in its current format).

llvm-svn: 14075
2004-06-08 20:08:30 +00:00
Brian Gaeke 76b6426a8c Add a TmpInstruction ctor that doesn't take a MCFI.
llvm-svn: 14073
2004-06-08 18:52:46 +00:00
Brian Gaeke 78faa9a9e6 Fix up some spacing & fix a typo in an assertion in cpValue2Value.
llvm-svn: 14027
2004-06-04 20:51:40 +00:00
Chris Lattner add9f29fdf This file is obsolete
llvm-svn: 14005
2004-06-04 00:15:21 +00:00
Brian Gaeke 6973e85b16 Add new internal-global-symbol mapping info pass... may its life be short
and sweet.

llvm-svn: 13983
2004-06-03 05:03:37 +00:00
Brian Gaeke 0a48c0d913 Add new mapping info pass, when EmitMappingInfo is on.
llvm-svn: 13981
2004-06-03 05:03:01 +00:00
Brian Gaeke 25c6fa0e83 Fix big mistake in my last checkin... the big question is, how did I ever
get this to link before?

llvm-svn: 13980
2004-06-03 05:03:00 +00:00
Brian Gaeke 11cfb090b8 Add decl. for new mapping info pass factory method.
llvm-svn: 13979
2004-06-03 05:02:59 +00:00
Brian Gaeke dca24ddfc7 Collapse together the abstract superclass TargetRegInfo and SparcV9RegInfo, its
only concrete implementation.

llvm-svn: 13977
2004-06-03 02:45:09 +00:00
Chris Lattner 4f816d2e38 <alloca.h> on cygwin pulls in a ton of stuff (macros and function protos)
that we REALLY don't want in the CBE code.

With this fix, the CBE passes all of the MultiSource tests on cygwin that
it does on linux.  Yaay!

llvm-svn: 13975
2004-06-02 23:10:26 +00:00
Chris Lattner 562d15636e Adjust to new TM interface
llvm-svn: 13954
2004-06-02 05:56:04 +00:00
Chris Lattner c832e546d0 Method has been inlined into all callers
llvm-svn: 13953
2004-06-02 05:55:48 +00:00
Chris Lattner 82baa9c394 Convert to the new TargetMachine interface.
llvm-svn: 13952
2004-06-02 05:55:25 +00:00
Chris Lattner 535e8db0da Stubs are no longer needed
llvm-svn: 13951
2004-06-02 05:53:52 +00:00
Chris Lattner 63c07bf246 Adjust to new TM interfaces
llvm-svn: 13949
2004-06-02 05:47:26 +00:00
Brian Gaeke 4cc9328b5d There is no "mcff" here; delete the confusing comments that refer to it.
llvm-svn: 13911
2004-05-30 08:29:16 +00:00
Brian Gaeke 7a8734af7f Transform an occurrence of if(...) { assert (0) }.
llvm-svn: 13908
2004-05-30 07:34:01 +00:00
Brian Gaeke 01c1f3279d Reduce the amount of LLVM Values for which we save reg. allocator
state. Also, save the state for the incoming register of each phi
node.

llvm-svn: 13906
2004-05-30 07:08:43 +00:00
Brian Gaeke 9836668944 Rename verifySavedState to dumpSavedState. Give it a new comment.
Call it at a more appropriate point.

llvm-svn: 13905
2004-05-30 04:22:24 +00:00
Brian Gaeke bc3d8652ec Insert machine instructions generated for Phi nodes into their
corresponding MachineCodeForInstruction vectors.

I need to be able to get the register allocated for the thing which is
called PhiCpRes in this code; this should make that task easier, plus,
Phi nodes are no longer "special" in the sense that their
MachineCodeForInstruction is empty.

llvm-svn: 13904
2004-05-30 03:33:49 +00:00
Brian Gaeke 24c18879f0 Remove unused #include.
llvm-svn: 13899
2004-05-29 23:26:13 +00:00
Brian Gaeke 42112b4a09 Add comments.
llvm-svn: 13898
2004-05-29 23:10:20 +00:00
Brian Gaeke 2398b17a57 Trim whitespace.
llvm-svn: 13897
2004-05-29 22:49:51 +00:00
Brian Gaeke 7fa398d850 Give InsertCodeForPhis() a new documentation comment.
llvm-svn: 13896
2004-05-29 22:20:59 +00:00
Brian Gaeke 90dc744ac0 Give PhiCp nodes better names in many cases.
Simplify InsertPhiElimInstructions(), and give it a better doxygen comment.

llvm-svn: 13880
2004-05-28 19:34:00 +00:00
Brian Gaeke 26925ff857 Make debugging output with -print-machineinstrs more useful: always print out
the transformed LLVM code which is the input to the instruction selector.

llvm-svn: 13879
2004-05-28 19:33:59 +00:00
Chris Lattner c53c2a3a62 Fix the big regression that has been killing the nightly tester these last
few days.  Apparently the old symbol table used to auto rename collisions in
the type symbol table and the new one does not.  It doesn't really make sense
for the new one to do so, so we just make the client do it.

llvm-svn: 13877
2004-05-28 05:47:27 +00:00
Chris Lattner c7e2ff2980 Minor changes. Switch to a SymbolTable remove that does not take linear time
llvm-svn: 13874
2004-05-28 05:30:51 +00:00
Brian Gaeke 1c6f9b4304 Make comment lines stick out less.
llvm-svn: 13858
2004-05-27 21:41:48 +00:00
Chris Lattner 83d067a103 Fix PR344: the incorrect remove was being used.
llvm-svn: 13790
2004-05-26 17:20:52 +00:00
Brian Gaeke 230deea60f Add a (not very meaningful) default constructor for AllocInfo objects.
llvm-svn: 13773
2004-05-25 20:43:47 +00:00
Reid Spencer e7e9671cad Convert to SymbolTable's new iteration interface.
llvm-svn: 13754
2004-05-25 08:53:40 +00:00
Reid Spencer 14428ac740 Remove use of Type::TypeTy from an assert. It will go away soon.
llvm-svn: 13748
2004-05-25 08:50:52 +00:00
Chris Lattner 6e4edd65ab Add support for accurate garbage collection to the LLVM code generators
llvm-svn: 13696
2004-05-23 21:23:35 +00:00
Chris Lattner 3ef067ff33 Add some notes to myself, no functional changes
llvm-svn: 13695
2004-05-23 21:23:12 +00:00
Chris Lattner 66911019e7 minor wording change
llvm-svn: 13694
2004-05-23 21:22:55 +00:00
Brian Gaeke d4889be5ca Fix a typo in a comment.
llvm-svn: 13643
2004-05-23 05:10:06 +00:00
Chris Lattner 83c139d575 Fix to make the CBE always emit comparisons inline. Hopefully this will
fix the really bad code we're getting on PPC.

llvm-svn: 13609
2004-05-20 20:25:50 +00:00
Brian Gaeke 7b7a14d718 Fix a bug in outputting branches to constant PCs. Since the PC is supplied as
a full 64-bit address, it must be adjusted to fit in the branch instruction's
immediate field. (This is only used in the reoptimizer, for now.)

llvm-svn: 13608
2004-05-20 07:43:40 +00:00
Brian Gaeke e8949b3083 Minor simplification: eliminate a dyn_cast.
Fix a typo in a debug message.

llvm-svn: 13607
2004-05-19 21:30:01 +00:00
Brian Gaeke de5ccc18e3 Don't keep track of references to LLVM BasicBlocks while emitting; use
MachineBasicBlocks instead.

llvm-svn: 13568
2004-05-14 06:54:58 +00:00
Brian Gaeke 2b3a81cd33 Support MachineBasicBlock operands on RawFrm instructions.
Get rid of separate numbering for LLVM BasicBlocks; use the automatically
generated MachineBasicBlock numbering.

llvm-svn: 13567
2004-05-14 06:54:57 +00:00
Brian Gaeke 35e73e1ca4 Generate branch machine instructions with MachineBasicBlock operands instead of
LLVM BasicBlock operands.

llvm-svn: 13566
2004-05-14 06:54:56 +00:00
Chris Lattner 8e7aea026a Two more improvements for null pointer handling: storing a null pointer
and passing a null pointer into a function.

For this testcase:

void %test(int** %X) {
  store int* null, int** %X
  call void %test(int** null)
  ret void
}

we now generate this:

test:
        sub %ESP, 12
        mov %EAX, DWORD PTR [%ESP + 16]
        mov DWORD PTR [%EAX], 0
        mov DWORD PTR [%ESP], 0
        call test
        add %ESP, 12
        ret

instead of this:

test:
        sub %ESP, 12
        mov %EAX, DWORD PTR [%ESP + 16]
        mov %ECX, 0
        mov DWORD PTR [%EAX], %ECX
        mov %EAX, 0
        mov DWORD PTR [%ESP], %EAX
        call test
        add %ESP, 12
        ret

llvm-svn: 13558
2004-05-13 15:26:48 +00:00
Chris Lattner 593d22d666 Second half of my fixed-sized-alloca patch. This folds the LEA to compute
the alloca address into common operations like loads/stores.

In a simple testcase like this (which is just designed to excersize the
alloca A, nothing more):

int %test(int %X, bool %C) {
        %A = alloca int
        store int %X, int* %A
        store int* %A, int** %G
        br bool %C, label %T, label %F
T:
        call int %test(int 1, bool false)
        %V = load int* %A
        ret int %V
F:
        call int %test(int 123, bool true)
        %V2 = load int* %A
        ret int %V2
}

We now generate:

test:
        sub %ESP, 12
        mov %EAX, DWORD PTR [%ESP + 16]
        mov %CL, BYTE PTR [%ESP + 20]
***     mov DWORD PTR [%ESP + 8], %EAX
        mov %EAX, OFFSET G
        lea %EDX, DWORD PTR [%ESP + 8]
        mov DWORD PTR [%EAX], %EDX
        test %CL, %CL
        je .LBB2 # PC rel: F
.LBB1:  # T
        mov DWORD PTR [%ESP], 1
        mov DWORD PTR [%ESP + 4], 0
        call test
***     mov %EAX, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret
.LBB2:  # F
        mov DWORD PTR [%ESP], 123
        mov DWORD PTR [%ESP + 4], 1
        call test
***     mov %EAX, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret

Instead of:

test:
        sub %ESP, 20
        mov %EAX, DWORD PTR [%ESP + 24]
        mov %CL, BYTE PTR [%ESP + 28]
***     lea %EDX, DWORD PTR [%ESP + 16]
***     mov DWORD PTR [%EDX], %EAX
        mov %EAX, OFFSET G
        mov DWORD PTR [%EAX], %EDX
        test %CL, %CL
***     mov DWORD PTR [%ESP + 12], %EDX
        je .LBB2 # PC rel: F
.LBB1:  # T
        mov DWORD PTR [%ESP], 1
        mov %EAX, 0
        mov DWORD PTR [%ESP + 4], %EAX
        call test
***     mov %EAX, DWORD PTR [%ESP + 12]
***     mov %EAX, DWORD PTR [%EAX]
        add %ESP, 20
        ret
.LBB2:  # F
        mov DWORD PTR [%ESP], 123
        mov %EAX, 1
        mov DWORD PTR [%ESP + 4], %EAX
        call test
***     mov %EAX, DWORD PTR [%ESP + 12]
***     mov %EAX, DWORD PTR [%EAX]
        add %ESP, 20
        ret

llvm-svn: 13557
2004-05-13 15:12:43 +00:00
Chris Lattner 2bb3325965 Substantially improve code generation for address exposed locals (aka fixed
sized allocas in the entry block).  Instead of generating code like this:

entry:
  reg1024 = ESP+1234
... (much later)
  *reg1024 = 17


Generate code that looks like this:
entry:
  (no code generated)
... (much later)
  t = ESP+1234
  *t = 17

The advantage being that we DRAMATICALLY reduce the register pressure for these
silly temporaries (they were all being spilled to the stack, resulting in very
silly code).  This is actually a manual implementation of rematerialization :)

I have a patch to fold the alloca address computation into loads & stores, which
will make this much better still, but just getting this right took way too much time
and I'm sleepy.

llvm-svn: 13554
2004-05-13 07:40:27 +00:00
Chris Lattner e2d382e1a4 Pass boolean constants into function calls more efficiently, generating:
mov DWORD PTR [%ESP + 4], 1

instead of:

        mov %EAX, 1
        mov DWORD PTR [%ESP + 4], %EAX

llvm-svn: 13494
2004-05-12 16:35:04 +00:00
Chris Lattner 72fb3256f8 Fix a fairly serious pessimizaion that was preventing us from efficiently
compiling things like 'add long %X, 1'.  The problem is that we were switching
the order of the operands for longs even though we can't fold them yet.

llvm-svn: 13451
2004-05-10 15:15:55 +00:00
Chris Lattner a367dd745b Fix some comments, avoid sign extending booleans when zero extend works fine
llvm-svn: 13440
2004-05-09 23:16:33 +00:00
Chris Lattner 1542a98e7b Generate more efficient code for casting booleans to integers (no sign extension required)
llvm-svn: 13439
2004-05-09 22:28:45 +00:00
Chris Lattner f719a52088 syntactically loopify natural loops so that the GCC loop optimizer can find them. This should *dramatically* improve the performance of CBE compiled code on targets that depend on GCC's loop optimizations (like PPC)
llvm-svn: 13438
2004-05-09 20:41:32 +00:00
Chris Lattner 87d036caf2 Do not emit prototypes for setjmp/longjmp, as they are handled specially
llvm-svn: 13437
2004-05-09 16:03:29 +00:00
Chris Lattner 9c29991970 Make the floating point constant pools local to each function, split the
FindUsedTypes manipulation stuff out to be a seperate pass, and make the
main CWriter be a function pass now!

llvm-svn: 13435
2004-05-09 06:20:51 +00:00
Chris Lattner 14d328e2a5 Get this looking more like a function pass.
llvm-svn: 13433
2004-05-09 04:30:20 +00:00
Chris Lattner 2484a6336f Print all PHI copies for successor blocks before the terminator, whether it be a conditional branch or switch.
llvm-svn: 13430
2004-05-09 03:42:48 +00:00
Tanya Lattner 39bd20d6eb Changed CPUResource to allow access to maxnum users.
llvm-svn: 13425
2004-05-08 16:12:50 +00:00
Brian Gaeke 1096ba9422 Add support for widening integral casts.
Flesh out the SetCC support... which currently ends in a little bit
of unfinished code (which is probably completely hilarious) for
generating the condition value splitting the basic block up into 4
blocks, like this (clearly a better API is needed for this!):

       BB
   cond. branch
     /         /          R1=1    R2=0
     \      /
      \    /
    R=phi(R1,R2)

Other minor edits.

llvm-svn: 13423
2004-05-08 06:36:14 +00:00
Brian Gaeke 91bf7cb79b Add a bunch more branches
llvm-svn: 13422
2004-05-08 06:08:29 +00:00
Brian Gaeke 7a66e5fff9 Flesh out GEP support
llvm-svn: 13421
2004-05-08 05:27:20 +00:00
Brian Gaeke d18b330605 Add ADD with immediate
llvm-svn: 13420
2004-05-08 05:26:55 +00:00
Brian Gaeke b56f1c9c10 Add forms of CMP, SUBCC, and a few branches, and some comments.
llvm-svn: 13419
2004-05-08 04:21:32 +00:00
Brian Gaeke f3a479f04a Add stub support for GEPs.
Add support for branches (based loosely on X86/InstSelectSimple).
Add support for not visiting phi nodes in the first pass.
Add support for loading bools.
Flesh out support for stores.

llvm-svn: 13418
2004-05-08 04:21:17 +00:00
Brian Gaeke 584308b71a Add support for copying bool constants to registers.
Disable the code that copies long constants to registers - it looks fishy.
Implement some simple casts: integral, smaller than longs, and equal-width
 or narrowing only.

llvm-svn: 13413
2004-05-07 21:39:30 +00:00
Chris Lattner a2dc6bf6e6 Codegen floating point stores of constants into integer instructions. This
allows us to compile:

store float 10.0, float* %P

into:
        mov DWORD PTR [%EAX], 1092616192

instead of:

.CPItest_0:                                     # float 0x4024000000000000
.long   1092616192      # float 10
...
        fld DWORD PTR [.CPItest_0]
        fstp DWORD PTR [%EAX]

llvm-svn: 13409
2004-05-07 21:18:15 +00:00
Chris Lattner cecf3f94a4 Make comparisons against the null pointer as efficient as integer comparisons
against zero.  In particular, don't emit:

        mov %ESI, 0
        cmp %ECX, %ESI

instead, emit:

       test %ECX, %ECX

llvm-svn: 13407
2004-05-07 19:55:55 +00:00
Brian Gaeke d26074eef1 Missing piece of fix for Bug 333
llvm-svn: 13362
2004-05-04 21:41:45 +00:00
Brian Gaeke f2ff5dd442 Correctly mangle function names when they are used as part of a
constant pool member's name.
This is intended to address Bug 333.

Also, fix an anachronistic usage of "M" as a parameter of type Function *.

llvm-svn: 13357
2004-05-04 21:09:02 +00:00
Chris Lattner c6f601310f Remove unneeded check
llvm-svn: 13355
2004-05-04 19:35:11 +00:00
Chris Lattner 22df9a59b4 Improve signed division by power of 2 *dramatically* from this:
div:
        mov %EDX, DWORD PTR [%ESP + 4]
        mov %ECX, 64
        mov %EAX, %EDX
        sar %EDX, 31
        idiv %ECX
        ret

to this:

div:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, %EAX
        sar %ECX, 5
        shr %ECX, 26
        mov %EDX, %EAX
        add %EDX, %ECX
        sar %EAX, 6
        ret

Note that the intel compiler is currently making this:

div:
        movl      4(%esp), %edx                                 #3.5
        movl      %edx, %eax                                    #4.14
        sarl      $5, %eax                                      #4.14
        shrl      $26, %eax                                     #4.14
        addl      %edx, %eax                                    #4.14
        sarl      $6, %eax                                      #4.14
        ret                                                     #4.14

Which has one less register->register copy.  (hint hint alkis :)

llvm-svn: 13354
2004-05-04 19:33:58 +00:00
Chris Lattner 8c22ece232 Improve code generated for integer multiplications by 2,3,5,9
llvm-svn: 13342
2004-05-04 15:47:14 +00:00
Chris Lattner 7b0a2046d4 Remove unused #include
llvm-svn: 13304
2004-05-01 21:29:16 +00:00
Chris Lattner acbf0c84de Iterate over the Machine CFG that Brian added instead of the LLVM CFG.
Look at all of the pretty minuses. :)

llvm-svn: 13303
2004-05-01 21:27:53 +00:00
Chris Lattner 490e804a4e Add a constructor that got lost
llvm-svn: 13297
2004-05-01 11:17:13 +00:00
Tanya Lattner 6ebf67f8b6 Removing MachineResource class.
llvm-svn: 13291
2004-04-30 20:40:38 +00:00
Brian Gaeke 4390e4a7fc Make RequiresFPRegKill() take a MachineBasicBlock arg.
In InsertFPRegKills(), just check the MachineBasicBlock for successors
instead of its corresponding BasicBlock.

llvm-svn: 13213
2004-04-28 04:45:55 +00:00
Brian Gaeke 33ff118407 In InsertFPRegKills(), use the machine-CFG itself rather than the
LLVM CFG when trying to find the successors of BB.

llvm-svn: 13212
2004-04-28 04:34:16 +00:00
Brian Gaeke 24ec85689b Update the machine-CFG edges whenever we see a branch.
llvm-svn: 13211
2004-04-28 04:19:37 +00:00
Brian Gaeke 444a03b77a Integrate the rest of my random sparcv9 scribblings into this file
llvm-svn: 13204
2004-04-27 22:04:03 +00:00
Chris Lattner 2d3a7a6ff0 Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.

llvm-svn: 13185
2004-04-27 15:13:33 +00:00
Brian Gaeke 03cac379bd Fix file header comments and include guards -- many files have been moved or
renamed since they were last spiffed up, or they just never had proper comments
in the first place.

llvm-svn: 13148
2004-04-25 07:04:49 +00:00
Brian Gaeke 42d321ab66 Add a getRegisterInfo() accessor just like on the X86 target.
llvm-svn: 13147
2004-04-25 06:32:28 +00:00
Brian Gaeke 4ec08db77c Regularize file header comment and include guard.
Include SparcV9RegisterInfo.h.
Add a getRegisterInfo() accessor and SparcV9RegisterInfo instance, just like
on the X86 target.

llvm-svn: 13146
2004-04-25 06:32:16 +00:00
Brian Gaeke f70544c583 Add MRegisterInfo subclass for the SparcV9 target (containing only stub
functions for now). This automatically turns on the printing of machine
registers using their own real names, instead of goofy things like %mreg(42),
and allows us to migrate code incrementally to the new interface as we see fit.

The register file description it uses is hand-written, so that the register
numbers will match the ones that the SparcV9 target already uses.
Perhaps someday we'll tablegen it.

llvm-svn: 13145
2004-04-25 06:32:05 +00:00
Brian Gaeke ced65e8792 Fix a typo.
llvm-svn: 13136
2004-04-23 21:45:02 +00:00
Brian Gaeke 0b65f8f582 Merge TargetRegInfo.h into SparcV9RegInfo.h, which is its only subclass.
This prepares us to be able to de-virtualize and de-abstract it, and
take the register allocator bits out and move them into the register allocator
proper...

llvm-svn: 13127
2004-04-23 18:15:48 +00:00
Brian Gaeke 71509a98c5 Include SparcV9RegInfo.h instead of TargetRegInfo.h.
llvm-svn: 13126
2004-04-23 18:15:47 +00:00
Brian Gaeke fbd43e43a7 Get rid of the old byte-at-a-time emission code used when the Sparc JIT was
being tested on X86, as per Chris's request.

llvm-svn: 13124
2004-04-23 18:10:38 +00:00
Brian Gaeke 6e102a7edd Use emitWordAt() to emit forward-branch fixups.
llvm-svn: 13120
2004-04-23 17:11:16 +00:00