blob: 20ebc424eeba8006b83814ec3be55da33d9d8aca [file] [log] [blame]
Brian Gaeke94e95d22004-02-25 18:44:15 +00001//===-- SparcV9Internals.h ----------------------------------------*- C++ -*-===//
Vikram S. Adve6fcb2892001-11-08 04:55:13 +00002//
John Criswell29265fe2003-10-21 15:17:13 +00003// 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 Gaeke94e95d22004-02-25 18:44:15 +000010// This file defines stuff that is to be private to the SparcV9 backend, but is
Chris Lattner959a5fb2002-08-09 20:08:06 +000011// shared among different portions of the backend.
12//
13//===----------------------------------------------------------------------===//
Chris Lattner5fae0de2001-09-14 03:56:45 +000014
15#ifndef SPARC_INTERNALS_H
16#define SPARC_INTERNALS_H
17
Misha Brukmand21a02a2003-05-24 00:09:50 +000018#include "llvm/CodeGen/MachineInstrBuilder.h"
Ruchira Sasankadfc6c882001-09-18 22:52:44 +000019#include "llvm/Target/TargetMachine.h"
Chris Lattnerf9781b52002-12-29 03:13:05 +000020#include "llvm/Target/TargetSchedInfo.h"
Chris Lattner871e5912002-12-28 21:00:25 +000021#include "llvm/Target/TargetFrameInfo.h"
Chris Lattnerf9781b52002-12-29 03:13:05 +000022#include "llvm/Target/TargetRegInfo.h"
Chris Lattner5fae0de2001-09-14 03:56:45 +000023#include "llvm/Type.h"
Brian Gaeke94e95d22004-02-25 18:44:15 +000024#include "SparcV9RegClassInfo.h"
John Criswell3ef61af2003-06-30 21:59:07 +000025#include "Config/sys/types.h"
Chris Lattner5fae0de2001-09-14 03:56:45 +000026
Brian Gaeke960707c2003-11-11 22:41:34 +000027namespace llvm {
28
Chris Lattner38aa77b2002-02-03 23:42:19 +000029class LiveRange;
Brian Gaeke94e95d22004-02-25 18:44:15 +000030class SparcV9TargetMachine;
Chris Lattner35b90c22002-04-09 05:16:36 +000031class Pass;
Chris Lattner38aa77b2002-02-03 23:42:19 +000032
Brian Gaeke94e95d22004-02-25 18:44:15 +000033enum SparcV9InstrSchedClass {
Chris Lattner5fae0de2001-09-14 03:56:45 +000034 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 Lattner5fae0de2001-09-14 03:56:45 +000049
50//---------------------------------------------------------------------------
Brian Gaeke94e95d22004-02-25 18:44:15 +000051// enum SparcV9MachineOpCode.
52// const TargetInstrDescriptor SparcV9MachineInstrDesc[]
Chris Lattner5fae0de2001-09-14 03:56:45 +000053//
54// Purpose:
Brian Gaeke94e95d22004-02-25 18:44:15 +000055// Description of UltraSparcV9 machine instructions.
Chris Lattner5fae0de2001-09-14 03:56:45 +000056//
57//---------------------------------------------------------------------------
58
Misha Brukman56f4fa12003-05-20 20:32:24 +000059namespace V9 {
Brian Gaeke94e95d22004-02-25 18:44:15 +000060 enum SparcV9MachineOpCode {
Chris Lattnere86a0232001-09-19 15:56:23 +000061#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
62 NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
63 ENUM,
Brian Gaeke94e95d22004-02-25 18:44:15 +000064#include "SparcV9Instr.def"
Chris Lattner5fae0de2001-09-14 03:56:45 +000065
Misha Brukman56f4fa12003-05-20 20:32:24 +000066 // 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 Lattner5fae0de2001-09-14 03:56:45 +000072
Chris Lattnere86a0232001-09-19 15:56:23 +000073// Array of machine instruction descriptions...
Brian Gaeke94e95d22004-02-25 18:44:15 +000074extern const TargetInstrDescriptor SparcV9MachineInstrDesc[];
Chris Lattner5fae0de2001-09-14 03:56:45 +000075
Chris Lattner5fae0de2001-09-14 03:56:45 +000076//---------------------------------------------------------------------------
Brian Gaeke94e95d22004-02-25 18:44:15 +000077// class SparcV9SchedInfo
Chris Lattner5fae0de2001-09-14 03:56:45 +000078//
79// Purpose:
80// Interface to instruction scheduling information for UltraSPARC.
81// The parameter values above are based on UltraSPARC IIi.
82//---------------------------------------------------------------------------
83
Brian Gaeke94e95d22004-02-25 18:44:15 +000084class SparcV9SchedInfo: public TargetSchedInfo {
Chris Lattner5fae0de2001-09-14 03:56:45 +000085public:
Brian Gaeke94e95d22004-02-25 18:44:15 +000086 SparcV9SchedInfo(const TargetMachine &tgt);
Chris Lattner5fae0de2001-09-14 03:56:45 +000087protected:
Chris Lattner5216cc52002-02-04 05:59:25 +000088 virtual void initializeResources();
Chris Lattner5fae0de2001-09-14 03:56:45 +000089};
90
Chris Lattnerec611ae2003-08-13 02:38:16 +000091/// createStackSlotsPass - External interface to stack-slots pass that enters 2
92/// empty slots at the top of each function stack
Misha Brukman167026f2003-11-13 00:17:20 +000093///
Chris Lattnerec611ae2003-08-13 02:38:16 +000094Pass *createStackSlotsPass(const TargetMachine &TM);
95
Misha Brukman167026f2003-11-13 00:17:20 +000096/// Specializes LLVM code for a target machine.
97///
Misha Brukmanbd4a8ed2003-11-07 17:43:43 +000098FunctionPass *createPreSelectionPass(const TargetMachine &TM);
Chris Lattner07923152003-09-01 20:33:07 +000099
Misha Brukman167026f2003-11-13 00:17:20 +0000100/// Peephole optimization pass operating on machine code
101///
Misha Brukmanbd4a8ed2003-11-07 17:43:43 +0000102FunctionPass *createPeepholeOptsPass(const TargetMachine &TM);
Chris Lattner07923152003-09-01 20:33:07 +0000103
Misha Brukman167026f2003-11-13 00:17:20 +0000104/// Writes out assembly code for the module, one function at a time
105///
106FunctionPass *createAsmPrinterPass(std::ostream &Out, const TargetMachine &TM);
107
108/// getPrologEpilogInsertionPass - Inserts prolog/epilog code.
109///
110FunctionPass* createPrologEpilogInsertionPass();
111
112/// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file.
113///
114Pass* createBytecodeAsmPrinterPass(std::ostream &Out);
Chris Lattnerec611ae2003-08-13 02:38:16 +0000115
Brian Gaeke94e95d22004-02-25 18:44:15 +0000116FunctionPass *createSparcV9MachineCodeDestructionPass();
Chris Lattner9a489892003-12-20 09:17:40 +0000117
Brian Gaeke960707c2003-11-11 22:41:34 +0000118} // End llvm namespace
119
Chris Lattner5fae0de2001-09-14 03:56:45 +0000120#endif