Brian Gaeke | 3ca4fcc | 2004-04-25 07:04:49 +0000 | [diff] [blame] | 1 | //===-- SparcV9Internals.h --------------------------------------*- C++ -*-===// |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 2 | // |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 10 | // This file defines stuff that is to be private to the SparcV9 backend, but is |
Chris Lattner | 035dfbe | 2002-08-09 20:08:06 +0000 | [diff] [blame] | 11 | // shared among different portions of the backend. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 14 | |
Brian Gaeke | 3ca4fcc | 2004-04-25 07:04:49 +0000 | [diff] [blame] | 15 | #ifndef SPARCV9INTERNALS_H |
| 16 | #define SPARCV9INTERNALS_H |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 17 | |
Misha Brukman | e9d8838 | 2003-05-24 00:09:50 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetMachine.h" |
Chris Lattner | d0f166a | 2002-12-29 03:13:05 +0000 | [diff] [blame] | 20 | #include "llvm/Target/TargetSchedInfo.h" |
Chris Lattner | 8bd66e6 | 2002-12-28 21:00:25 +0000 | [diff] [blame] | 21 | #include "llvm/Target/TargetFrameInfo.h" |
Brian Gaeke | 3b2e5e6 | 2004-04-23 18:15:47 +0000 | [diff] [blame] | 22 | #include "SparcV9RegInfo.h" |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 23 | #include "llvm/Type.h" |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 24 | #include "SparcV9RegClassInfo.h" |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 25 | #include "Config/sys/types.h" |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 26 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 27 | namespace llvm { |
| 28 | |
Chris Lattner | 4387e31 | 2002-02-03 23:42:19 +0000 | [diff] [blame] | 29 | class LiveRange; |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 30 | class SparcV9TargetMachine; |
Chris Lattner | 9aa697b | 2002-04-09 05:16:36 +0000 | [diff] [blame] | 31 | class Pass; |
Chris Lattner | 4387e31 | 2002-02-03 23:42:19 +0000 | [diff] [blame] | 32 | |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 33 | enum SparcV9InstrSchedClass { |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 34 | SPARC_NONE, /* Instructions with no scheduling restrictions */ |
| 35 | SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */ |
| 36 | SPARC_IEU0, /* Integer class IEU0 */ |
| 37 | SPARC_IEU1, /* Integer class IEU1 */ |
| 38 | SPARC_FPM, /* FP Multiply or Divide instructions */ |
| 39 | SPARC_FPA, /* All other FP instructions */ |
| 40 | SPARC_CTI, /* Control-transfer instructions */ |
| 41 | SPARC_LD, /* Load instructions */ |
| 42 | SPARC_ST, /* Store instructions */ |
| 43 | SPARC_SINGLE, /* Instructions that must issue by themselves */ |
| 44 | |
| 45 | SPARC_INV, /* This should stay at the end for the next value */ |
| 46 | SPARC_NUM_SCHED_CLASSES = SPARC_INV |
| 47 | }; |
| 48 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 49 | |
| 50 | //--------------------------------------------------------------------------- |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 51 | // enum SparcV9MachineOpCode. |
| 52 | // const TargetInstrDescriptor SparcV9MachineInstrDesc[] |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 53 | // |
| 54 | // Purpose: |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 55 | // Description of UltraSparcV9 machine instructions. |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 56 | // |
| 57 | //--------------------------------------------------------------------------- |
| 58 | |
Misha Brukman | a98cd45 | 2003-05-20 20:32:24 +0000 | [diff] [blame] | 59 | namespace V9 { |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 60 | enum SparcV9MachineOpCode { |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 61 | #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ |
| 62 | NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \ |
| 63 | ENUM, |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 64 | #include "SparcV9Instr.def" |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 65 | |
Misha Brukman | a98cd45 | 2003-05-20 20:32:24 +0000 | [diff] [blame] | 66 | // End-of-array marker |
| 67 | INVALID_OPCODE, |
| 68 | NUM_REAL_OPCODES = PHI, // number of valid opcodes |
| 69 | NUM_TOTAL_OPCODES = INVALID_OPCODE |
| 70 | }; |
| 71 | } |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 72 | |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 73 | // Array of machine instruction descriptions... |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 74 | extern const TargetInstrDescriptor SparcV9MachineInstrDesc[]; |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 75 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 76 | //--------------------------------------------------------------------------- |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 77 | // class SparcV9SchedInfo |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 78 | // |
| 79 | // Purpose: |
| 80 | // Interface to instruction scheduling information for UltraSPARC. |
| 81 | // The parameter values above are based on UltraSPARC IIi. |
| 82 | //--------------------------------------------------------------------------- |
| 83 | |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 84 | class SparcV9SchedInfo: public TargetSchedInfo { |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 85 | public: |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 86 | SparcV9SchedInfo(const TargetMachine &tgt); |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 87 | protected: |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 88 | virtual void initializeResources(); |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 91 | /// createStackSlotsPass - External interface to stack-slots pass that enters 2 |
| 92 | /// empty slots at the top of each function stack |
Misha Brukman | 7e060be | 2003-11-13 00:17:20 +0000 | [diff] [blame] | 93 | /// |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 94 | Pass *createStackSlotsPass(const TargetMachine &TM); |
| 95 | |
Misha Brukman | 7e060be | 2003-11-13 00:17:20 +0000 | [diff] [blame] | 96 | /// Specializes LLVM code for a target machine. |
| 97 | /// |
Misha Brukman | 7eabdc5 | 2003-11-07 17:43:43 +0000 | [diff] [blame] | 98 | FunctionPass *createPreSelectionPass(const TargetMachine &TM); |
Chris Lattner | 67699ff | 2003-09-01 20:33:07 +0000 | [diff] [blame] | 99 | |
Misha Brukman | 7e060be | 2003-11-13 00:17:20 +0000 | [diff] [blame] | 100 | /// Peephole optimization pass operating on machine code |
| 101 | /// |
Misha Brukman | 7eabdc5 | 2003-11-07 17:43:43 +0000 | [diff] [blame] | 102 | FunctionPass *createPeepholeOptsPass(const TargetMachine &TM); |
Chris Lattner | 67699ff | 2003-09-01 20:33:07 +0000 | [diff] [blame] | 103 | |
Misha Brukman | 7e060be | 2003-11-13 00:17:20 +0000 | [diff] [blame] | 104 | /// Writes out assembly code for the module, one function at a time |
| 105 | /// |
| 106 | FunctionPass *createAsmPrinterPass(std::ostream &Out, const TargetMachine &TM); |
| 107 | |
| 108 | /// getPrologEpilogInsertionPass - Inserts prolog/epilog code. |
| 109 | /// |
| 110 | FunctionPass* createPrologEpilogInsertionPass(); |
| 111 | |
| 112 | /// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file. |
| 113 | /// |
| 114 | Pass* createBytecodeAsmPrinterPass(std::ostream &Out); |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame] | 115 | |
Brian Gaeke | e3d6807 | 2004-02-25 18:44:15 +0000 | [diff] [blame] | 116 | FunctionPass *createSparcV9MachineCodeDestructionPass(); |
Chris Lattner | 583b9d8 | 2003-12-20 09:17:40 +0000 | [diff] [blame] | 117 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 118 | } // End llvm namespace |
| 119 | |
Chris Lattner | c6495ee | 2001-09-14 03:56:45 +0000 | [diff] [blame] | 120 | #endif |