blob: d0e03ed52c4a3daeee8d2030cc0d92a4ebd71bec [file] [log] [blame]
Brian Gaekee3d68072004-02-25 18:44:15 +00001//===-- SparcV9Internals.h ----------------------------------------*- C++ -*-===//
Vikram S. Adve7f37fe52001-11-08 04:55:13 +00002//
John Criswell856ba762003-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 Gaekee3d68072004-02-25 18:44:15 +000010// This file defines stuff that is to be private to the SparcV9 backend, but is
Chris Lattner035dfbe2002-08-09 20:08:06 +000011// shared among different portions of the backend.
12//
13//===----------------------------------------------------------------------===//
Chris Lattnerc6495ee2001-09-14 03:56:45 +000014
15#ifndef SPARC_INTERNALS_H
16#define SPARC_INTERNALS_H
17
Misha Brukmane9d88382003-05-24 00:09:50 +000018#include "llvm/CodeGen/MachineInstrBuilder.h"
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +000019#include "llvm/Target/TargetMachine.h"
Chris Lattnerd0f166a2002-12-29 03:13:05 +000020#include "llvm/Target/TargetSchedInfo.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000021#include "llvm/Target/TargetFrameInfo.h"
Chris Lattnerdde12622002-12-29 02:50:33 +000022#include "llvm/Target/TargetCacheInfo.h"
Chris Lattnerd0f166a2002-12-29 03:13:05 +000023#include "llvm/Target/TargetRegInfo.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000024#include "llvm/Type.h"
Brian Gaekee3d68072004-02-25 18:44:15 +000025#include "SparcV9RegClassInfo.h"
John Criswell7a73b802003-06-30 21:59:07 +000026#include "Config/sys/types.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000027
Brian Gaeked0fde302003-11-11 22:41:34 +000028namespace llvm {
29
Chris Lattner4387e312002-02-03 23:42:19 +000030class LiveRange;
Brian Gaekee3d68072004-02-25 18:44:15 +000031class SparcV9TargetMachine;
Chris Lattner9aa697b2002-04-09 05:16:36 +000032class Pass;
Chris Lattner4387e312002-02-03 23:42:19 +000033
Brian Gaekee3d68072004-02-25 18:44:15 +000034enum SparcV9InstrSchedClass {
Chris Lattnerc6495ee2001-09-14 03:56:45 +000035 SPARC_NONE, /* Instructions with no scheduling restrictions */
36 SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */
37 SPARC_IEU0, /* Integer class IEU0 */
38 SPARC_IEU1, /* Integer class IEU1 */
39 SPARC_FPM, /* FP Multiply or Divide instructions */
40 SPARC_FPA, /* All other FP instructions */
41 SPARC_CTI, /* Control-transfer instructions */
42 SPARC_LD, /* Load instructions */
43 SPARC_ST, /* Store instructions */
44 SPARC_SINGLE, /* Instructions that must issue by themselves */
45
46 SPARC_INV, /* This should stay at the end for the next value */
47 SPARC_NUM_SCHED_CLASSES = SPARC_INV
48};
49
Chris Lattnerc6495ee2001-09-14 03:56:45 +000050
51//---------------------------------------------------------------------------
Brian Gaekee3d68072004-02-25 18:44:15 +000052// enum SparcV9MachineOpCode.
53// const TargetInstrDescriptor SparcV9MachineInstrDesc[]
Chris Lattnerc6495ee2001-09-14 03:56:45 +000054//
55// Purpose:
Brian Gaekee3d68072004-02-25 18:44:15 +000056// Description of UltraSparcV9 machine instructions.
Chris Lattnerc6495ee2001-09-14 03:56:45 +000057//
58//---------------------------------------------------------------------------
59
Misha Brukmana98cd452003-05-20 20:32:24 +000060namespace V9 {
Brian Gaekee3d68072004-02-25 18:44:15 +000061 enum SparcV9MachineOpCode {
Chris Lattner9a3d63b2001-09-19 15:56:23 +000062#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
63 NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
64 ENUM,
Brian Gaekee3d68072004-02-25 18:44:15 +000065#include "SparcV9Instr.def"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000066
Misha Brukmana98cd452003-05-20 20:32:24 +000067 // End-of-array marker
68 INVALID_OPCODE,
69 NUM_REAL_OPCODES = PHI, // number of valid opcodes
70 NUM_TOTAL_OPCODES = INVALID_OPCODE
71 };
72}
Chris Lattnerc6495ee2001-09-14 03:56:45 +000073
Chris Lattner9a3d63b2001-09-19 15:56:23 +000074// Array of machine instruction descriptions...
Brian Gaekee3d68072004-02-25 18:44:15 +000075extern const TargetInstrDescriptor SparcV9MachineInstrDesc[];
Chris Lattnerc6495ee2001-09-14 03:56:45 +000076
Chris Lattnerc6495ee2001-09-14 03:56:45 +000077//---------------------------------------------------------------------------
Brian Gaekee3d68072004-02-25 18:44:15 +000078// class SparcV9SchedInfo
Chris Lattnerc6495ee2001-09-14 03:56:45 +000079//
80// Purpose:
81// Interface to instruction scheduling information for UltraSPARC.
82// The parameter values above are based on UltraSPARC IIi.
83//---------------------------------------------------------------------------
84
Brian Gaekee3d68072004-02-25 18:44:15 +000085class SparcV9SchedInfo: public TargetSchedInfo {
Chris Lattnerc6495ee2001-09-14 03:56:45 +000086public:
Brian Gaekee3d68072004-02-25 18:44:15 +000087 SparcV9SchedInfo(const TargetMachine &tgt);
Chris Lattnerc6495ee2001-09-14 03:56:45 +000088protected:
Chris Lattner699683c2002-02-04 05:59:25 +000089 virtual void initializeResources();
Chris Lattnerc6495ee2001-09-14 03:56:45 +000090};
91
Chris Lattnerf6e0e282001-09-14 04:32:55 +000092//---------------------------------------------------------------------------
Brian Gaekee3d68072004-02-25 18:44:15 +000093// class SparcV9CacheInfo
Vikram S. Adve5afff3b2001-11-09 02:15:52 +000094//
95// Purpose:
96// Interface to cache parameters for the UltraSPARC.
97// Just use defaults for now.
98//---------------------------------------------------------------------------
99
Brian Gaekee3d68072004-02-25 18:44:15 +0000100struct SparcV9CacheInfo: public TargetCacheInfo {
101 SparcV9CacheInfo(const TargetMachine &T) : TargetCacheInfo(T) {}
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000102};
103
Vikram S. Advec1521632001-10-22 13:31:53 +0000104
Chris Lattner48e60792003-08-13 02:38:16 +0000105/// createStackSlotsPass - External interface to stack-slots pass that enters 2
106/// empty slots at the top of each function stack
Misha Brukman7e060be2003-11-13 00:17:20 +0000107///
Chris Lattner48e60792003-08-13 02:38:16 +0000108Pass *createStackSlotsPass(const TargetMachine &TM);
109
Misha Brukman7e060be2003-11-13 00:17:20 +0000110/// Specializes LLVM code for a target machine.
111///
Misha Brukman7eabdc52003-11-07 17:43:43 +0000112FunctionPass *createPreSelectionPass(const TargetMachine &TM);
Chris Lattner67699ff2003-09-01 20:33:07 +0000113
Misha Brukman7e060be2003-11-13 00:17:20 +0000114/// Peephole optimization pass operating on machine code
115///
Misha Brukman7eabdc52003-11-07 17:43:43 +0000116FunctionPass *createPeepholeOptsPass(const TargetMachine &TM);
Chris Lattner67699ff2003-09-01 20:33:07 +0000117
Misha Brukman7e060be2003-11-13 00:17:20 +0000118/// Writes out assembly code for the module, one function at a time
119///
120FunctionPass *createAsmPrinterPass(std::ostream &Out, const TargetMachine &TM);
121
122/// getPrologEpilogInsertionPass - Inserts prolog/epilog code.
123///
124FunctionPass* createPrologEpilogInsertionPass();
125
126/// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file.
127///
128Pass* createBytecodeAsmPrinterPass(std::ostream &Out);
Chris Lattner48e60792003-08-13 02:38:16 +0000129
Brian Gaekee3d68072004-02-25 18:44:15 +0000130FunctionPass *createSparcV9MachineCodeDestructionPass();
Chris Lattner583b9d82003-12-20 09:17:40 +0000131
Brian Gaeked0fde302003-11-11 22:41:34 +0000132} // End llvm namespace
133
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000134#endif