2004-04-25 09:04:49 +02:00
|
|
|
//===-- SparcV9Internals.h --------------------------------------*- C++ -*-===//
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2003-10-21 17:17:13 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2003-10-21 17:17:13 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2004-02-25 19:44:15 +01:00
|
|
|
// This file defines stuff that is to be private to the SparcV9 backend, but is
|
2002-08-09 22:08:06 +02:00
|
|
|
// shared among different portions of the backend.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-09-14 05:56:45 +02:00
|
|
|
|
2004-04-25 09:04:49 +02:00
|
|
|
#ifndef SPARCV9INTERNALS_H
|
|
|
|
#define SPARCV9INTERNALS_H
|
2001-09-14 05:56:45 +02:00
|
|
|
|
2003-05-24 02:09:50 +02:00
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
2001-09-19 00:52:44 +02:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2002-12-29 04:13:05 +01:00
|
|
|
#include "llvm/Target/TargetSchedInfo.h"
|
2002-12-28 22:00:25 +01:00
|
|
|
#include "llvm/Target/TargetFrameInfo.h"
|
2004-04-23 20:15:47 +02:00
|
|
|
#include "SparcV9RegInfo.h"
|
2001-09-14 05:56:45 +02:00
|
|
|
#include "llvm/Type.h"
|
2004-02-25 19:44:15 +01:00
|
|
|
#include "SparcV9RegClassInfo.h"
|
2001-09-14 05:56:45 +02:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
namespace llvm {
|
|
|
|
|
2002-02-04 00:42:19 +01:00
|
|
|
class LiveRange;
|
2004-02-25 19:44:15 +01:00
|
|
|
class SparcV9TargetMachine;
|
2004-09-20 06:48:05 +02:00
|
|
|
class ModulePass;
|
2004-11-07 01:43:24 +01:00
|
|
|
class GetElementPtrInst;
|
2002-02-04 00:42:19 +01:00
|
|
|
|
2004-02-25 19:44:15 +01:00
|
|
|
enum SparcV9InstrSchedClass {
|
2001-09-14 05:56:45 +02:00
|
|
|
SPARC_NONE, /* Instructions with no scheduling restrictions */
|
|
|
|
SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */
|
|
|
|
SPARC_IEU0, /* Integer class IEU0 */
|
|
|
|
SPARC_IEU1, /* Integer class IEU1 */
|
|
|
|
SPARC_FPM, /* FP Multiply or Divide instructions */
|
|
|
|
SPARC_FPA, /* All other FP instructions */
|
|
|
|
SPARC_CTI, /* Control-transfer instructions */
|
|
|
|
SPARC_LD, /* Load instructions */
|
|
|
|
SPARC_ST, /* Store instructions */
|
|
|
|
SPARC_SINGLE, /* Instructions that must issue by themselves */
|
2005-04-22 01:30:14 +02:00
|
|
|
|
2001-09-14 05:56:45 +02:00
|
|
|
SPARC_INV, /* This should stay at the end for the next value */
|
|
|
|
SPARC_NUM_SCHED_CLASSES = SPARC_INV
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2005-04-22 01:30:14 +02:00
|
|
|
// enum SparcV9MachineOpCode.
|
2004-02-25 19:44:15 +01:00
|
|
|
// const TargetInstrDescriptor SparcV9MachineInstrDesc[]
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2001-09-14 05:56:45 +02:00
|
|
|
// Purpose:
|
2004-02-25 19:44:15 +01:00
|
|
|
// Description of UltraSparcV9 machine instructions.
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2001-09-14 05:56:45 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2003-05-20 22:32:24 +02:00
|
|
|
namespace V9 {
|
2004-02-25 19:44:15 +01:00
|
|
|
enum SparcV9MachineOpCode {
|
2001-09-19 17:56:23 +02:00
|
|
|
#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
|
|
|
|
NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
|
|
|
|
ENUM,
|
2004-02-25 19:44:15 +01:00
|
|
|
#include "SparcV9Instr.def"
|
2001-09-14 05:56:45 +02:00
|
|
|
|
2003-05-20 22:32:24 +02:00
|
|
|
// End-of-array marker
|
|
|
|
INVALID_OPCODE,
|
|
|
|
NUM_REAL_OPCODES = PHI, // number of valid opcodes
|
|
|
|
NUM_TOTAL_OPCODES = INVALID_OPCODE
|
|
|
|
};
|
|
|
|
}
|
2001-09-14 05:56:45 +02:00
|
|
|
|
2001-09-19 17:56:23 +02:00
|
|
|
// Array of machine instruction descriptions...
|
2004-02-25 19:44:15 +01:00
|
|
|
extern const TargetInstrDescriptor SparcV9MachineInstrDesc[];
|
2001-09-14 05:56:45 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2004-02-25 19:44:15 +01:00
|
|
|
// class SparcV9SchedInfo
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2001-09-14 05:56:45 +02:00
|
|
|
// Purpose:
|
|
|
|
// Interface to instruction scheduling information for UltraSPARC.
|
|
|
|
// The parameter values above are based on UltraSPARC IIi.
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2004-02-25 19:44:15 +01:00
|
|
|
class SparcV9SchedInfo: public TargetSchedInfo {
|
2001-09-14 05:56:45 +02:00
|
|
|
public:
|
2004-02-25 19:44:15 +01:00
|
|
|
SparcV9SchedInfo(const TargetMachine &tgt);
|
2001-09-14 05:56:45 +02:00
|
|
|
protected:
|
2002-02-04 06:59:25 +01:00
|
|
|
virtual void initializeResources();
|
2001-09-14 05:56:45 +02:00
|
|
|
};
|
|
|
|
|
2003-08-13 04:38:16 +02:00
|
|
|
/// createStackSlotsPass - External interface to stack-slots pass that enters 2
|
|
|
|
/// empty slots at the top of each function stack
|
2003-11-13 01:17:20 +01:00
|
|
|
///
|
2004-09-20 06:48:05 +02:00
|
|
|
FunctionPass *createStackSlotsPass(const TargetMachine &TM);
|
2003-08-13 04:38:16 +02:00
|
|
|
|
2003-11-13 01:17:20 +01:00
|
|
|
/// Specializes LLVM code for a target machine.
|
|
|
|
///
|
2003-11-07 18:43:43 +01:00
|
|
|
FunctionPass *createPreSelectionPass(const TargetMachine &TM);
|
2003-09-01 22:33:07 +02:00
|
|
|
|
2004-11-07 01:43:24 +01:00
|
|
|
// DecomposeMultiDimRefs - Convert multi-dimensional references consisting of
|
|
|
|
// any combination of 2 or more array and structure indices into a sequence of
|
|
|
|
// instructions (using getelementpr and cast) so that each instruction has at
|
|
|
|
// most one index (except structure references, which need an extra leading
|
|
|
|
// index of [0]).
|
|
|
|
// This pass decomposes all multi-dimensional references in a function.
|
|
|
|
FunctionPass *createDecomposeMultiDimRefsPass();
|
|
|
|
|
|
|
|
// This function decomposes a single instance of such a reference.
|
|
|
|
// Return value: true if the instruction was replaced; false otherwise.
|
2005-04-22 01:30:14 +02:00
|
|
|
//
|
2004-11-07 01:43:24 +01:00
|
|
|
bool DecomposeArrayRef(GetElementPtrInst* GEP);
|
|
|
|
|
2003-11-13 01:17:20 +01:00
|
|
|
/// Peephole optimization pass operating on machine code
|
|
|
|
///
|
2003-11-07 18:43:43 +01:00
|
|
|
FunctionPass *createPeepholeOptsPass(const TargetMachine &TM);
|
2003-09-01 22:33:07 +02:00
|
|
|
|
2003-11-13 01:17:20 +01:00
|
|
|
/// Writes out assembly code for the module, one function at a time
|
|
|
|
///
|
2004-08-18 07:29:08 +02:00
|
|
|
FunctionPass *createAsmPrinterPass(std::ostream &Out, TargetMachine &TM);
|
2003-11-13 01:17:20 +01:00
|
|
|
|
|
|
|
/// getPrologEpilogInsertionPass - Inserts prolog/epilog code.
|
|
|
|
///
|
|
|
|
FunctionPass* createPrologEpilogInsertionPass();
|
|
|
|
|
|
|
|
/// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file.
|
|
|
|
///
|
2004-09-20 06:48:05 +02:00
|
|
|
ModulePass* createBytecodeAsmPrinterPass(std::ostream &Out);
|
2003-08-13 04:38:16 +02:00
|
|
|
|
2004-02-25 19:44:15 +01:00
|
|
|
FunctionPass *createSparcV9MachineCodeDestructionPass();
|
2003-12-20 10:17:40 +01:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-09-14 05:56:45 +02:00
|
|
|
#endif
|