SparcInstrInfo.h revision 7c90f73a1b06040d971a3dd95a491031ae6238d5
17c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner//===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===//
2b5f662fa0314f7e7e690aae8ebff7136cc3a5ab0Misha Brukman//
3e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//                     The LLVM Compiler Infrastructure
4e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//
5e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke// This file was developed by the LLVM research group and is distributed under
6e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke// the University of Illinois Open Source License. See LICENSE.TXT for details.
7b5f662fa0314f7e7e690aae8ebff7136cc3a5ab0Misha Brukman//
8e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//===----------------------------------------------------------------------===//
9e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//
107c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner// This file contains the Sparc implementation of the TargetInstrInfo class.
11e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//
12e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke//===----------------------------------------------------------------------===//
13e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
147c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner#ifndef SPARCINSTRUCTIONINFO_H
157c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner#define SPARCINSTRUCTIONINFO_H
16e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
17e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke#include "llvm/Target/TargetInstrInfo.h"
187c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner#include "SparcRegisterInfo.h"
19e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
20e785e531f4495068ee46cabd926939eec15a565aBrian Gaekenamespace llvm {
21e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
227c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner/// SPII - This namespace holds all of the target specific flags that
237d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke/// instruction info tracks.
247d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke///
257c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattnernamespace SPII {
267d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke  enum {
277d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke    Pseudo = (1<<0),
287d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke    Load = (1<<1),
297d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke    Store = (1<<2),
307d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke    DelaySlot = (1<<3)
317d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke  };
327d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke};
337d7ac63366956473c8b3ef790447f576315e4c21Brian Gaeke
347c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattnerclass SparcInstrInfo : public TargetInstrInfo {
357c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner  const SparcRegisterInfo RI;
36e785e531f4495068ee46cabd926939eec15a565aBrian Gaekepublic:
377c90f73a1b06040d971a3dd95a491031ae6238d5Chris Lattner  SparcInstrInfo(SparcSubtarget &ST);
38e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
39e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
40e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke  /// such, whenever a client has an instance of instruction info, it should
41e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke  /// always be able to get register info as well (through this method).
42e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke  ///
43e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke  virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
441d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner
451d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner  /// Return true if the instruction is a register to register move and
461d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner  /// leave the source and dest operands in the passed parameters.
471d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner  ///
481d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner  virtual bool isMoveInstr(const MachineInstr &MI,
491d6dc974631a8920a4e5a801a6c7cd4753ae8a8eChris Lattner                           unsigned &SrcReg, unsigned &DstReg) const;
505ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner
515ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// isLoadFromStackSlot - If the specified machine instruction is a direct
525ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// load from a stack slot, return the virtual or physical register number of
535ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// the destination along with the FrameIndex of the loaded stack slot.  If
545ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// not, return 0.  This predicate must return 0 if the instruction has
555ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// any side effects other than loading from the stack slot.
565ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
575ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner
585ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// isStoreToStackSlot - If the specified machine instruction is a direct
595ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// store to a stack slot, return the virtual or physical register number of
605ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// the source reg along with the FrameIndex of the loaded stack slot.  If
615ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// not, return 0.  This predicate must return 0 if the instruction has
625ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  /// any side effects other than storing to the stack slot.
635ccc7225db0cb4d738045ade8e8c38d5345ac08aChris Lattner  virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
64e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke};
65e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
66e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke}
67e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke
68e785e531f4495068ee46cabd926939eec15a565aBrian Gaeke#endif
69