131d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu//===-- XCoreInstrInfo.h - XCore Instruction Information --------*- C++ -*-===// 2b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// 3b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// The LLVM Compiler Infrastructure 4b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// 5b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// This file is distributed under the University of Illinois Open Source 6b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// License. See LICENSE.TXT for details. 7b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// 8b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne//===----------------------------------------------------------------------===// 9b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// 10b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// This file contains the XCore implementation of the TargetInstrInfo class. 11b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne// 12b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne//===----------------------------------------------------------------------===// 13b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 14b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne#ifndef XCOREINSTRUCTIONINFO_H 15b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne#define XCOREINSTRUCTIONINFO_H 16b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 17b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne#include "XCoreRegisterInfo.h" 1879aa3417eb6f58d668aadfedf075240a41d35a26Craig Topper#include "llvm/Target/TargetInstrInfo.h" 19b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 204db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng#define GET_INSTRINFO_HEADER 214db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng#include "XCoreGenInstrInfo.inc" 224db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng 23b25baef26f03b9909b65dd5f762b38f93000445dRichard Osbornenamespace llvm { 24b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 254db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Chengclass XCoreInstrInfo : public XCoreGenInstrInfo { 26b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne const XCoreRegisterInfo RI; 27b25baef26f03b9909b65dd5f762b38f93000445dRichard Osbornepublic: 28a9ad04191cb56c42944b17980b8b2bb2afe11ab2Dan Gohman XCoreInstrInfo(); 29b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 30b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 31b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// such, whenever a client has an instance of instruction info, it should 32b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// always be able to get register info as well (through this method). 33b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// 34b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; } 35b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 36b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// isLoadFromStackSlot - If the specified machine instruction is a direct 37b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// load from a stack slot, return the virtual or physical register number of 38b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// the destination along with the FrameIndex of the loaded stack slot. If 39b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// not, return 0. This predicate must return 0 if the instruction has 40b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// any side effects other than loading from the stack slot. 41cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, 42cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman int &FrameIndex) const; 43b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 44b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// isStoreToStackSlot - If the specified machine instruction is a direct 45b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// store to a stack slot, return the virtual or physical register number of 46b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// the source reg along with the FrameIndex of the loaded stack slot. If 47b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// not, return 0. This predicate must return 0 if the instruction has 48b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne /// any side effects other than storing to the stack slot. 49cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman virtual unsigned isStoreToStackSlot(const MachineInstr *MI, 50cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman int &FrameIndex) const; 51b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 52b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 53b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne MachineBasicBlock *&FBB, 54dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng SmallVectorImpl<MachineOperand> &Cond, 55dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng bool AllowModify) const; 56b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 57b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 583bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings MachineBasicBlock *FBB, 593bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings const SmallVectorImpl<MachineOperand> &Cond, 603bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings DebugLoc DL) const; 61b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 62b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; 63b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 64a98625cdad0a4fefaaf00174669e0cd2f0dbe1bdJakob Stoklund Olesen virtual void copyPhysReg(MachineBasicBlock &MBB, 65a98625cdad0a4fefaaf00174669e0cd2f0dbe1bdJakob Stoklund Olesen MachineBasicBlock::iterator I, DebugLoc DL, 66a98625cdad0a4fefaaf00174669e0cd2f0dbe1bdJakob Stoklund Olesen unsigned DestReg, unsigned SrcReg, 67a98625cdad0a4fefaaf00174669e0cd2f0dbe1bdJakob Stoklund Olesen bool KillSrc) const; 68b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 69b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 70b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne MachineBasicBlock::iterator MI, 71b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne unsigned SrcReg, bool isKill, int FrameIndex, 72746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterClass *RC, 73746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterInfo *TRI) const; 74b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 75b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 76b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne MachineBasicBlock::iterator MI, 77b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne unsigned DestReg, int FrameIndex, 78746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterClass *RC, 79746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterInfo *TRI) const; 80b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 816c6f28ffe42d06655f5977bd0d01214e32de93a5Richard Osborne virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF, 826c6f28ffe42d06655f5977bd0d01214e32de93a5Richard Osborne int FrameIx, 836c6f28ffe42d06655f5977bd0d01214e32de93a5Richard Osborne uint64_t Offset, 846c6f28ffe42d06655f5977bd0d01214e32de93a5Richard Osborne const MDNode *MDPtr, 856c6f28ffe42d06655f5977bd0d01214e32de93a5Richard Osborne DebugLoc DL) const; 86b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 87b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne virtual bool ReverseBranchCondition( 88b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne SmallVectorImpl<MachineOperand> &Cond) const; 89b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne}; 90b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 91b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne} 92b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne 93b25baef26f03b9909b65dd5f762b38f93000445dRichard Osborne#endif 94