Hexagon V60/HVX DFA scheduler support
Extended DFA tablegen to:
- added "-debug-only dfa-emitter" support to llvm-tblgen
- defined CVI_PIPE* resources for the V60 vector coprocessor
- allow specification of multiple required resources
- supports ANDs of ORs
- e.g. [SLOT2, SLOT3], [CVI_MPY0, CVI_MPY1] means:
(SLOT2 OR SLOT3) AND (CVI_MPY0 OR CVI_MPY1)
- added support for combo resources
- allows specifying ORs of ANDs
- e.g. [CVI_XLSHF, CVI_MPY01] means:
(CVI_XLANE AND CVI_SHIFT) OR (CVI_MPY0 AND CVI_MPY1)
- increased DFA input size from 32-bit to 64-bit
- allows for a maximum of 4 AND'ed terms of 16 resources
- supported expressions now include:
expression => term [AND term] [AND term] [AND term]
term => resource [OR resource]*
resource => one_resource | combo_resource
combo_resource => (one_resource [AND one_resource]*)
Author: Dan Palermo <dpalermo@codeaurora.org>
kparzysz: Verified AMDGPU codegen to be unchanged on all llc
tests, except those dealing with instruction encodings.
Reapply the previous patch, this time without circular dependencies.
llvm-svn: 253793
This commit is contained in:
@@ -31,10 +31,17 @@
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
using namespace llvm;
|
||||
|
||||
DFAPacketizer::DFAPacketizer(const InstrItineraryData *I, const int (*SIT)[2],
|
||||
DFAPacketizer::DFAPacketizer(const InstrItineraryData *I,
|
||||
const DFAStateInput (*SIT)[2],
|
||||
const unsigned *SET):
|
||||
InstrItins(I), CurrentState(0), DFAStateInputTable(SIT),
|
||||
DFAStateEntryTable(SET) {}
|
||||
DFAStateEntryTable(SET) {
|
||||
// Make sure DFA types are large enough for the number of terms & resources.
|
||||
assert((DFA_MAX_RESTERMS * DFA_MAX_RESOURCES) <= (8 * sizeof(DFAInput))
|
||||
&& "(DFA_MAX_RESTERMS * DFA_MAX_RESOURCES) too big for DFAInput");
|
||||
assert((DFA_MAX_RESTERMS * DFA_MAX_RESOURCES) <= (8 * sizeof(DFAStateInput))
|
||||
&& "(DFA_MAX_RESTERMS * DFA_MAX_RESOURCES) too big for DFAStateInput");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@@ -60,26 +67,37 @@ void DFAPacketizer::ReadTable(unsigned int state) {
|
||||
DFAStateInputTable[i][1];
|
||||
}
|
||||
|
||||
//
|
||||
// getInsnInput - Return the DFAInput for an instruction class.
|
||||
//
|
||||
DFAInput DFAPacketizer::getInsnInput(unsigned InsnClass) {
|
||||
// Note: this logic must match that in DFAPacketizerDefs.h for input vectors.
|
||||
DFAInput InsnInput = 0;
|
||||
unsigned i = 0;
|
||||
for (const InstrStage *IS = InstrItins->beginStage(InsnClass),
|
||||
*IE = InstrItins->endStage(InsnClass); IS != IE; ++IS, ++i) {
|
||||
InsnInput = addDFAFuncUnits(InsnInput, IS->getUnits());
|
||||
assert ((i < DFA_MAX_RESTERMS) && "Exceeded maximum number of DFA inputs");
|
||||
}
|
||||
return InsnInput;
|
||||
}
|
||||
|
||||
// canReserveResources - Check if the resources occupied by a MCInstrDesc
|
||||
// are available in the current state.
|
||||
bool DFAPacketizer::canReserveResources(const llvm::MCInstrDesc *MID) {
|
||||
unsigned InsnClass = MID->getSchedClass();
|
||||
const llvm::InstrStage *IS = InstrItins->beginStage(InsnClass);
|
||||
unsigned FuncUnits = IS->getUnits();
|
||||
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
||||
DFAInput InsnInput = getInsnInput(InsnClass);
|
||||
UnsignPair StateTrans = UnsignPair(CurrentState, InsnInput);
|
||||
ReadTable(CurrentState);
|
||||
return (CachedTable.count(StateTrans) != 0);
|
||||
}
|
||||
|
||||
|
||||
// reserveResources - Reserve the resources occupied by a MCInstrDesc and
|
||||
// change the current state to reflect that change.
|
||||
void DFAPacketizer::reserveResources(const llvm::MCInstrDesc *MID) {
|
||||
unsigned InsnClass = MID->getSchedClass();
|
||||
const llvm::InstrStage *IS = InstrItins->beginStage(InsnClass);
|
||||
unsigned FuncUnits = IS->getUnits();
|
||||
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
||||
DFAInput InsnInput = getInsnInput(InsnClass);
|
||||
UnsignPair StateTrans = UnsignPair(CurrentState, InsnInput);
|
||||
ReadTable(CurrentState);
|
||||
assert(CachedTable.count(StateTrans) != 0);
|
||||
CurrentState = CachedTable[StateTrans];
|
||||
|
||||
Reference in New Issue
Block a user