2009-07-02 22:18:33 +00:00
|
|
|
//===- Thumb2InstrInfo.h - Thumb-2 Instruction Information ----------*- C++ -*-===//
|
2009-06-26 21:28:53 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-07-02 22:18:33 +00:00
|
|
|
// This file contains the Thumb-2 implementation of the TargetInstrInfo class.
|
2009-06-26 21:28:53 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
#ifndef THUMB2INSTRUCTIONINFO_H
|
|
|
|
#define THUMB2INSTRUCTIONINFO_H
|
2009-06-26 21:28:53 +00:00
|
|
|
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "ARM.h"
|
|
|
|
#include "ARMInstrInfo.h"
|
2009-07-02 22:18:33 +00:00
|
|
|
#include "Thumb2RegisterInfo.h"
|
2009-06-26 21:28:53 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class ARMSubtarget;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
class Thumb2InstrInfo : public ARMBaseInstrInfo {
|
|
|
|
Thumb2RegisterInfo RI;
|
2009-06-26 21:28:53 +00:00
|
|
|
public:
|
2009-07-02 22:18:33 +00:00
|
|
|
explicit Thumb2InstrInfo(const ARMSubtarget &STI);
|
2009-06-26 21:28:53 +00:00
|
|
|
|
2009-06-27 12:16:40 +00:00
|
|
|
/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
|
|
|
|
/// such, whenever a client has an instance of instruction info, it should
|
|
|
|
/// always be able to get register info as well (through this method).
|
|
|
|
///
|
2009-07-02 22:18:33 +00:00
|
|
|
const Thumb2RegisterInfo &getRegisterInfo() const { return RI; }
|
2009-06-27 12:16:40 +00:00
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI) const;
|
|
|
|
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI) const;
|
|
|
|
|
|
|
|
bool isMoveInstr(const MachineInstr &MI,
|
2009-06-26 21:28:53 +00:00
|
|
|
unsigned &SrcReg, unsigned &DstReg,
|
|
|
|
unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
|
2009-07-02 22:18:33 +00:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
2009-06-26 21:28:53 +00:00
|
|
|
int &FrameIndex) const;
|
2009-07-02 22:18:33 +00:00
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI,
|
2009-06-26 21:28:53 +00:00
|
|
|
int &FrameIndex) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
bool copyRegToReg(MachineBasicBlock &MBB,
|
2009-06-26 21:28:53 +00:00
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
const TargetRegisterClass *DestRC,
|
|
|
|
const TargetRegisterClass *SrcRC) const;
|
2009-07-02 22:18:33 +00:00
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
2009-06-26 21:28:53 +00:00
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
|
2009-06-26 21:28:53 +00:00
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
2009-06-26 21:28:53 +00:00
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
|
2009-06-26 21:28:53 +00:00
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
bool canFoldMemoryOperand(const MachineInstr *MI,
|
2009-06-27 12:16:40 +00:00
|
|
|
const SmallVectorImpl<unsigned> &Ops) const;
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
int FrameIndex) const;
|
|
|
|
|
|
|
|
MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
MachineInstr* LoadMI) const {
|
2009-06-26 21:28:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
#endif // THUMB2INSTRUCTIONINFO_H
|