2009-07-16 15:27:25 +02:00
|
|
|
//===- SystemZInstrInfo.h - SystemZ Instruction Information -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the SystemZ implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TARGET_SYSTEMZINSTRINFO_H
|
|
|
|
#define LLVM_TARGET_SYSTEMZINSTRINFO_H
|
|
|
|
|
2009-07-16 15:52:51 +02:00
|
|
|
#include "SystemZ.h"
|
2009-07-16 15:27:25 +02:00
|
|
|
#include "SystemZRegisterInfo.h"
|
2009-07-16 15:51:12 +02:00
|
|
|
#include "llvm/ADT/IndexedMap.h"
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2009-07-16 15:27:25 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class SystemZTargetMachine;
|
|
|
|
|
2009-07-16 16:16:05 +02:00
|
|
|
/// SystemZII - This namespace holds all of the target specific flags that
|
|
|
|
/// instruction info tracks.
|
|
|
|
///
|
|
|
|
namespace SystemZII {
|
|
|
|
enum {
|
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
// SystemZ Specific MachineOperand flags.
|
|
|
|
|
|
|
|
MO_NO_FLAG = 0,
|
|
|
|
|
|
|
|
/// MO_GOTENT - On a symbol operand this indicates that the immediate is
|
|
|
|
/// the offset to the location of the symbol name from the base of the GOT.
|
|
|
|
///
|
|
|
|
/// SYMBOL_LABEL @GOTENT
|
|
|
|
MO_GOTENT = 1,
|
|
|
|
|
|
|
|
/// MO_PLT - On a symbol operand this indicates that the immediate is
|
|
|
|
/// offset to the PLT entry of symbol name from the current code location.
|
|
|
|
///
|
|
|
|
/// SYMBOL_LABEL @PLT
|
|
|
|
MO_PLT = 2
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-07-16 15:27:25 +02:00
|
|
|
class SystemZInstrInfo : public TargetInstrInfoImpl {
|
|
|
|
const SystemZRegisterInfo RI;
|
|
|
|
SystemZTargetMachine &TM;
|
|
|
|
public:
|
|
|
|
explicit SystemZInstrInfo(SystemZTargetMachine &TM);
|
|
|
|
|
|
|
|
/// 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-16 15:51:53 +02:00
|
|
|
virtual const SystemZRegisterInfo &getRegisterInfo() const { return RI; }
|
2009-07-16 15:27:25 +02:00
|
|
|
|
2010-07-11 18:40:46 +02:00
|
|
|
virtual void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
|
2009-07-16 16:32:41 +02:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const;
|
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
|
|
|
|
virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned SrcReg, bool isKill,
|
|
|
|
int FrameIndex,
|
2010-05-06 21:06:44 +02:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, int FrameIdx,
|
2010-05-06 21:06:44 +02:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
|
2009-07-16 16:32:19 +02:00
|
|
|
bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
|
|
|
|
virtual bool isUnpredicatedTerminator(const MachineInstr *MI) const;
|
|
|
|
virtual bool AnalyzeBranch(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
2010-06-18 00:43:56 +02:00
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const;
|
2009-07-16 16:32:19 +02:00
|
|
|
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
|
2009-07-16 15:27:25 +02:00
|
|
|
|
2009-07-16 16:32:19 +02:00
|
|
|
SystemZCC::CondCodes getOppositeCondition(SystemZCC::CondCodes CC) const;
|
|
|
|
SystemZCC::CondCodes getCondFromBranchOpc(unsigned Opc) const;
|
2009-07-16 15:52:51 +02:00
|
|
|
const TargetInstrDesc& getBrCond(SystemZCC::CondCodes CC) const;
|
2009-07-16 16:09:56 +02:00
|
|
|
const TargetInstrDesc& getLongDispOpc(unsigned Opc) const;
|
2009-07-16 16:33:52 +02:00
|
|
|
|
|
|
|
const TargetInstrDesc& getMemoryInstr(unsigned Opc, int64_t Offset = 0) const {
|
|
|
|
if (Offset < 0 || Offset >= 4096)
|
|
|
|
return getLongDispOpc(Opc);
|
|
|
|
else
|
|
|
|
return get(Opc);
|
|
|
|
}
|
2009-07-16 15:27:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|