blob: edaa3d12d570ca302e9cc0ad508a6a145eea4200 [file] [log] [blame]
Brian Gaeke3ca4fcc2004-04-25 07:04:49 +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
Brian Gaeke3ca4fcc2004-04-25 07:04:49 +000015#ifndef SPARCV9INTERNALS_H
16#define SPARCV9INTERNALS_H
Chris Lattnerc6495ee2001-09-14 03:56:45 +000017
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"
Brian Gaeke3b2e5e62004-04-23 18:15:47 +000022#include "SparcV9RegInfo.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000023#include "llvm/Type.h"
Brian Gaekee3d68072004-02-25 18:44:15 +000024#include "SparcV9RegClassInfo.h"
John Criswell7a73b802003-06-30 21:59:07 +000025#include "Config/sys/types.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000026
Brian Gaeked0fde302003-11-11 22:41:34 +000027namespace llvm {
28
Chris Lattner4387e312002-02-03 23:42:19 +000029class LiveRange;
Brian Gaekee3d68072004-02-25 18:44:15 +000030class SparcV9TargetMachine;
Chris Lattner9aa697b2002-04-09 05:16:36 +000031class Pass;
Chris Lattner4387e312002-02-03 23:42:19 +000032
Brian Gaekee3d68072004-02-25 18:44:15 +000033enum SparcV9InstrSchedClass {
Chris Lattnerc6495ee2001-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 Lattnerc6495ee2001-09-14 03:56:45 +000049
50//---------------------------------------------------------------------------
Brian Gaekee3d68072004-02-25 18:44:15 +000051// enum SparcV9MachineOpCode.
52// const TargetInstrDescriptor SparcV9MachineInstrDesc[]
Chris Lattnerc6495ee2001-09-14 03:56:45 +000053//
54// Purpose:
Brian Gaekee3d68072004-02-25 18:44:15 +000055// Description of UltraSparcV9 machine instructions.
Chris Lattnerc6495ee2001-09-14 03:56:45 +000056//
57//---------------------------------------------------------------------------
58
Misha Brukmana98cd452003-05-20 20:32:24 +000059namespace V9 {
Brian Gaekee3d68072004-02-25 18:44:15 +000060 enum SparcV9MachineOpCode {
Chris Lattner9a3d63b2001-09-19 15:56:23 +000061#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
62 NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
63 ENUM,
Brian Gaekee3d68072004-02-25 18:44:15 +000064#include "SparcV9Instr.def"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000065
Misha Brukmana98cd452003-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 Lattnerc6495ee2001-09-14 03:56:45 +000072
Chris Lattner9a3d63b2001-09-19 15:56:23 +000073// Array of machine instruction descriptions...
Brian Gaekee3d68072004-02-25 18:44:15 +000074extern const TargetInstrDescriptor SparcV9MachineInstrDesc[];
Chris Lattnerc6495ee2001-09-14 03:56:45 +000075
Chris Lattnerc6495ee2001-09-14 03:56:45 +000076//---------------------------------------------------------------------------
Brian Gaekee3d68072004-02-25 18:44:15 +000077// class SparcV9SchedInfo
Chris Lattnerc6495ee2001-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 Gaekee3d68072004-02-25 18:44:15 +000084class SparcV9SchedInfo: public TargetSchedInfo {
Chris Lattnerc6495ee2001-09-14 03:56:45 +000085public:
Brian Gaekee3d68072004-02-25 18:44:15 +000086 SparcV9SchedInfo(const TargetMachine &tgt);
Chris Lattnerc6495ee2001-09-14 03:56:45 +000087protected:
Chris Lattner699683c2002-02-04 05:59:25 +000088 virtual void initializeResources();
Chris Lattnerc6495ee2001-09-14 03:56:45 +000089};
90
Chris Lattner48e60792003-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 Brukman7e060be2003-11-13 00:17:20 +000093///
Chris Lattner48e60792003-08-13 02:38:16 +000094Pass *createStackSlotsPass(const TargetMachine &TM);
95
Misha Brukman7e060be2003-11-13 00:17:20 +000096/// Specializes LLVM code for a target machine.
97///
Misha Brukman7eabdc52003-11-07 17:43:43 +000098FunctionPass *createPreSelectionPass(const TargetMachine &TM);
Chris Lattner67699ff2003-09-01 20:33:07 +000099
Misha Brukman7e060be2003-11-13 00:17:20 +0000100/// Peephole optimization pass operating on machine code
101///
Misha Brukman7eabdc52003-11-07 17:43:43 +0000102FunctionPass *createPeepholeOptsPass(const TargetMachine &TM);
Chris Lattner67699ff2003-09-01 20:33:07 +0000103
Misha Brukman7e060be2003-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 Lattner48e60792003-08-13 02:38:16 +0000115
Brian Gaekee3d68072004-02-25 18:44:15 +0000116FunctionPass *createSparcV9MachineCodeDestructionPass();
Chris Lattner583b9d82003-12-20 09:17:40 +0000117
Brian Gaeked0fde302003-11-11 22:41:34 +0000118} // End llvm namespace
119
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000120#endif