LLVM API Documentation
00001 //===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the Sparc implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef SPARCINSTRUCTIONINFO_H 00015 #define SPARCINSTRUCTIONINFO_H 00016 00017 #include "llvm/Target/TargetInstrInfo.h" 00018 #include "SparcRegisterInfo.h" 00019 00020 namespace llvm { 00021 00022 /// SPII - This namespace holds all of the target specific flags that 00023 /// instruction info tracks. 00024 /// 00025 namespace SPII { 00026 enum { 00027 Pseudo = (1<<0), 00028 Load = (1<<1), 00029 Store = (1<<2), 00030 DelaySlot = (1<<3) 00031 }; 00032 }; 00033 00034 class SparcInstrInfo : public TargetInstrInfo { 00035 const SparcRegisterInfo RI; 00036 public: 00037 SparcInstrInfo(SparcSubtarget &ST); 00038 00039 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 00040 /// such, whenever a client has an instance of instruction info, it should 00041 /// always be able to get register info as well (through this method). 00042 /// 00043 virtual const MRegisterInfo &getRegisterInfo() const { return RI; } 00044 00045 /// Return true if the instruction is a register to register move and 00046 /// leave the source and dest operands in the passed parameters. 00047 /// 00048 virtual bool isMoveInstr(const MachineInstr &MI, 00049 unsigned &SrcReg, unsigned &DstReg) const; 00050 00051 /// isLoadFromStackSlot - If the specified machine instruction is a direct 00052 /// load from a stack slot, return the virtual or physical register number of 00053 /// the destination along with the FrameIndex of the loaded stack slot. If 00054 /// not, return 0. This predicate must return 0 if the instruction has 00055 /// any side effects other than loading from the stack slot. 00056 virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; 00057 00058 /// isStoreToStackSlot - If the specified machine instruction is a direct 00059 /// store to a stack slot, return the virtual or physical register number of 00060 /// the source reg along with the FrameIndex of the loaded stack slot. If 00061 /// not, return 0. This predicate must return 0 if the instruction has 00062 /// any side effects other than storing to the stack slot. 00063 virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; 00064 }; 00065 00066 } 00067 00068 #endif