2012-02-18 20:03:15 +08:00
|
|
|
//===-- PPCInstrInfo.h - PowerPC Instruction Information --------*- C++ -*-===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-17 12:55:41 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-17 12:55:41 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the PowerPC implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-02-18 20:03:15 +08:00
|
|
|
#ifndef POWERPC_INSTRUCTIONINFO_H
|
|
|
|
#define POWERPC_INSTRUCTIONINFO_H
|
2004-08-17 12:55:41 +08:00
|
|
|
|
2005-10-15 07:51:18 +08:00
|
|
|
#include "PPC.h"
|
2005-10-15 07:59:06 +08:00
|
|
|
#include "PPCRegisterInfo.h"
|
2012-03-18 02:46:09 +08:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2004-08-17 12:55:41 +08:00
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "PPCGenInstrInfo.inc"
|
|
|
|
|
2004-08-17 12:55:41 +08:00
|
|
|
namespace llvm {
|
2006-03-12 17:13:49 +08:00
|
|
|
|
|
|
|
/// PPCII - This namespace holds all of the PowerPC target-specific
|
|
|
|
/// per-instruction flags. These must match the corresponding definitions in
|
|
|
|
/// PPC.td and PPCInstrFormats.td.
|
|
|
|
namespace PPCII {
|
|
|
|
enum {
|
|
|
|
// PPC970 Instruction Flags. These flags describe the characteristics of the
|
|
|
|
// PowerPC 970 (aka G5) dispatch groups and how they are formed out of
|
|
|
|
// raw machine instructions.
|
|
|
|
|
|
|
|
/// PPC970_First - This instruction starts a new dispatch group, so it will
|
|
|
|
/// always be the first one in the group.
|
|
|
|
PPC970_First = 0x1,
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2006-03-12 17:13:49 +08:00
|
|
|
/// PPC970_Single - This instruction starts a new dispatch group and
|
|
|
|
/// terminates it, so it will be the sole instruction in the group.
|
|
|
|
PPC970_Single = 0x2,
|
|
|
|
|
2006-03-13 13:15:10 +08:00
|
|
|
/// PPC970_Cracked - This instruction is cracked into two pieces, requiring
|
|
|
|
/// two dispatch pipes to be available to issue.
|
|
|
|
PPC970_Cracked = 0x4,
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2006-03-12 17:13:49 +08:00
|
|
|
/// PPC970_Mask/Shift - This is a bitmask that selects the pipeline type that
|
|
|
|
/// an instruction is issued to.
|
2006-03-13 13:15:10 +08:00
|
|
|
PPC970_Shift = 3,
|
2006-05-25 01:04:05 +08:00
|
|
|
PPC970_Mask = 0x07 << PPC970_Shift
|
2006-03-12 17:13:49 +08:00
|
|
|
};
|
|
|
|
enum PPC970_Unit {
|
|
|
|
/// These are the various PPC970 execution unit pipelines. Each instruction
|
|
|
|
/// is one of these.
|
|
|
|
PPC970_Pseudo = 0 << PPC970_Shift, // Pseudo instruction
|
|
|
|
PPC970_FXU = 1 << PPC970_Shift, // Fixed Point (aka Integer/ALU) Unit
|
|
|
|
PPC970_LSU = 2 << PPC970_Shift, // Load Store Unit
|
|
|
|
PPC970_FPU = 3 << PPC970_Shift, // Floating Point Unit
|
|
|
|
PPC970_CRU = 4 << PPC970_Shift, // Control Register Unit
|
|
|
|
PPC970_VALU = 5 << PPC970_Shift, // Vector ALU
|
|
|
|
PPC970_VPERM = 6 << PPC970_Shift, // Vector Permute Unit
|
2006-05-25 01:04:05 +08:00
|
|
|
PPC970_BRU = 7 << PPC970_Shift // Branch Unit
|
2006-03-12 17:13:49 +08:00
|
|
|
};
|
2010-11-15 07:42:06 +08:00
|
|
|
} // end namespace PPCII
|
2010-12-24 12:28:06 +08:00
|
|
|
|
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
class PPCInstrInfo : public PPCGenInstrInfo {
|
2006-06-17 08:01:04 +08:00
|
|
|
PPCTargetMachine &TM;
|
2005-10-16 13:39:50 +08:00
|
|
|
const PPCRegisterInfo RI;
|
2008-03-11 06:49:16 +08:00
|
|
|
|
2008-07-08 07:14:23 +08:00
|
|
|
bool StoreRegToStackSlot(MachineFunction &MF,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIdx,
|
2008-03-11 06:49:16 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
2011-12-07 04:55:36 +08:00
|
|
|
bool LoadRegFromStackSlot(MachineFunction &MF, DebugLoc DL,
|
2008-07-08 07:14:23 +08:00
|
|
|
unsigned DestReg, int FrameIdx,
|
2008-03-11 06:49:16 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
2004-08-17 12:55:41 +08:00
|
|
|
public:
|
2008-03-26 06:06:05 +08:00
|
|
|
explicit PPCInstrInfo(PPCTargetMachine &TM);
|
2004-08-17 12:55:41 +08: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).
|
|
|
|
///
|
2008-05-14 09:58:56 +08:00
|
|
|
virtual const PPCRegisterInfo &getRegisterInfo() const { return RI; }
|
2004-08-17 12:55:41 +08:00
|
|
|
|
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.
Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.
Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.
Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.
ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.
ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.
llvm-svn: 122541
2010-12-24 13:03:26 +08:00
|
|
|
ScheduleHazardRecognizer *
|
|
|
|
CreateTargetHazardRecognizer(const TargetMachine *TM,
|
|
|
|
const ScheduleDAG *DAG) const;
|
2011-12-02 12:58:02 +08:00
|
|
|
ScheduleHazardRecognizer *
|
|
|
|
CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II,
|
|
|
|
const ScheduleDAG *DAG) const;
|
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.
Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.
Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.
Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.
ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.
ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.
llvm-svn: 122541
2010-12-24 13:03:26 +08:00
|
|
|
|
2012-06-20 05:14:34 +08:00
|
|
|
bool isCoalescableExtInstr(const MachineInstr &MI,
|
|
|
|
unsigned &SrcReg, unsigned &DstReg,
|
|
|
|
unsigned &SubIdx) const;
|
2008-11-19 03:49:32 +08:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
2006-02-03 04:12:32 +08:00
|
|
|
|
2005-09-10 02:17:41 +08:00
|
|
|
// commuteInstruction - We can commute rlwimi instructions, but only if the
|
|
|
|
// rotate amt is zero. We also have to munge the immediates a bit.
|
2008-06-16 15:33:11 +08:00
|
|
|
virtual MachineInstr *commuteInstruction(MachineInstr *MI, bool NewMI) const;
|
2010-12-24 12:28:06 +08:00
|
|
|
|
|
|
|
virtual void insertNoop(MachineBasicBlock &MBB,
|
2006-03-06 07:49:55 +08:00
|
|
|
MachineBasicBlock::iterator MI) const;
|
|
|
|
|
2006-10-14 05:21:17 +08:00
|
|
|
|
|
|
|
// Branch analysis.
|
|
|
|
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
2009-02-09 15:14:22 +08:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const;
|
2007-05-18 08:05:48 +08:00
|
|
|
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
|
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
2010-06-18 06:43:56 +08:00
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const;
|
2010-07-11 15:31:00 +08:00
|
|
|
virtual void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const;
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2008-01-02 05:11:32 +08:00
|
|
|
virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2008-01-02 05:11:32 +08:00
|
|
|
|
|
|
|
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2010-04-26 15:39:36 +08:00
|
|
|
virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF,
|
2010-04-29 09:13:30 +08:00
|
|
|
int FrameIx,
|
2010-04-26 15:39:36 +08:00
|
|
|
uint64_t Offset,
|
|
|
|
const MDNode *MDPtr,
|
|
|
|
DebugLoc DL) const;
|
|
|
|
|
2008-08-15 06:49:33 +08:00
|
|
|
virtual
|
|
|
|
bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2008-04-17 04:10:13 +08:00
|
|
|
/// GetInstSize - Return the number of bytes of code the specified
|
|
|
|
/// instruction may be. This returns the maximum number of bytes.
|
|
|
|
///
|
|
|
|
virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
|
2004-08-17 12:55:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|