1 //===-- SparcV9InstrInfo.h - Define TargetInstrInfo for SparcV9 -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This class contains information about individual instructions.
11 // Also see the SparcV9MachineInstrDesc array, which can be found in
12 // SparcV9TargetMachine.cpp.
13 // Other information is computed on demand, and most such functions
14 // default to member functions in base class TargetInstrInfo.
16 //===----------------------------------------------------------------------===//
18 #ifndef SPARCV9INSTRINFO_H
19 #define SPARCV9INSTRINFO_H
21 #include "llvm/Target/TargetInstrInfo.h"
22 #include "llvm/CodeGen/MachineInstr.h"
23 #include "SparcV9Internals.h"
24 #include "SparcV9RegisterInfo.h"
28 struct SparcV9InstrInfo : public TargetInstrInfo {
29 const SparcV9RegisterInfo RI;
33 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
34 /// such, whenever a client has an instance of instruction info, it should
35 /// always be able to get register info as well (through this method).
37 virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
39 // All immediate constants are in position 1 except the
40 // store instructions and SETxx.
42 virtual int getImmedConstantPos(MachineOpCode opCode) const {
44 if (this->maxImmedConstant(opCode, ignore) != 0) {
46 assert(! this->isStore((MachineOpCode) V9::STBr - 1));
48 assert(! this->isStore((MachineOpCode) V9::STXFSRi + 1));
50 if (opCode == V9::SETSW || opCode == V9::SETUW ||
51 opCode == V9::SETX || opCode == V9::SETHI)
53 if (opCode >= V9::STBr && opCode <= V9::STXFSRi)
61 virtual bool hasResultInterlock(MachineOpCode opCode) const
63 // All UltraSPARC instructions have interlocks (note that delay slots
64 // are not considered here).
65 // However, instructions that use the result of an FCMP produce a
66 // 9-cycle stall if they are issued less than 3 cycles after the FCMP.
67 // Force the compiler to insert a software interlock (i.e., gap of
68 // 2 other groups, including NOPs if necessary).
69 return (opCode == V9::FCMPS || opCode == V9::FCMPD || opCode == V9::FCMPQ);
73 } // End llvm namespace