forked from OSchip/llvm-project
Revert r332907 "[GlobalISel] Improving InstructionSelect's performance by reducing MatchTable..."
There is a compile time error I didn't see locally, investigating now. llvm-svn: 332912
This commit is contained in:
parent
ed05e2336d
commit
8bdf7be5bb
|
@ -20,7 +20,6 @@
|
|||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/CodeGenCoverage.h"
|
||||
#include "llvm/Support/LowLevelTypeImpl.h"
|
||||
#include <bitset>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
@ -32,6 +31,7 @@ namespace llvm {
|
|||
|
||||
class APInt;
|
||||
class APFloat;
|
||||
class LLT;
|
||||
class MachineInstr;
|
||||
class MachineInstrBuilder;
|
||||
class MachineFunction;
|
||||
|
@ -146,14 +146,12 @@ enum {
|
|||
/// - OpIdx - Operand index
|
||||
/// - Expected register bank (specified as a register class)
|
||||
GIM_CheckRegBankForClass,
|
||||
|
||||
/// Check the operand matches a complex predicate
|
||||
/// - InsnID - Instruction ID
|
||||
/// - OpIdx - Operand index
|
||||
/// - RendererID - The renderer to hold the result
|
||||
/// - Complex predicate ID
|
||||
GIM_CheckComplexPattern,
|
||||
|
||||
/// Check the operand is a specific integer
|
||||
/// - InsnID - Instruction ID
|
||||
/// - OpIdx - Operand index
|
||||
|
@ -170,7 +168,6 @@ enum {
|
|||
/// - OpIdx - Operand index
|
||||
/// - Expected Intrinsic ID
|
||||
GIM_CheckIntrinsicID,
|
||||
|
||||
/// Check the specified operand is an MBB
|
||||
/// - InsnID - Instruction ID
|
||||
/// - OpIdx - Operand index
|
||||
|
@ -199,7 +196,6 @@ enum {
|
|||
/// - OldInsnID - Instruction ID to mutate
|
||||
/// - NewOpcode - The new opcode to use
|
||||
GIR_MutateOpcode,
|
||||
|
||||
/// Build a new instruction
|
||||
/// - InsnID - Instruction ID to define
|
||||
/// - Opcode - The new opcode to use
|
||||
|
@ -210,7 +206,6 @@ enum {
|
|||
/// - OldInsnID - Instruction ID to copy from
|
||||
/// - OpIdx - The operand to copy
|
||||
GIR_Copy,
|
||||
|
||||
/// Copy an operand to the specified instruction or add a zero register if the
|
||||
/// operand is a zero immediate.
|
||||
/// - NewInsnID - Instruction ID to modify
|
||||
|
@ -224,7 +219,6 @@ enum {
|
|||
/// - OpIdx - The operand to copy
|
||||
/// - SubRegIdx - The subregister to copy
|
||||
GIR_CopySubReg,
|
||||
|
||||
/// Add an implicit register def to the specified instruction
|
||||
/// - InsnID - Instruction ID to modify
|
||||
/// - RegNum - The register to add
|
||||
|
@ -237,13 +231,11 @@ enum {
|
|||
/// - InsnID - Instruction ID to modify
|
||||
/// - RegNum - The register to add
|
||||
GIR_AddRegister,
|
||||
|
||||
/// Add a temporary register to the specified instruction
|
||||
/// - InsnID - Instruction ID to modify
|
||||
/// - TempRegID - The temporary register ID to add
|
||||
/// - TempRegFlags - The register flags to set
|
||||
GIR_AddTempRegister,
|
||||
|
||||
/// Add an immediate to the specified instruction
|
||||
/// - InsnID - Instruction ID to modify
|
||||
/// - Imm - The immediate to add
|
||||
|
@ -252,7 +244,6 @@ enum {
|
|||
/// - InsnID - Instruction ID to modify
|
||||
/// - RendererID - The renderer to call
|
||||
GIR_ComplexRenderer,
|
||||
|
||||
/// Render sub-operands of complex operands to the specified instruction
|
||||
/// - InsnID - Instruction ID to modify
|
||||
/// - RendererID - The renderer to call
|
||||
|
@ -281,23 +272,19 @@ enum {
|
|||
/// - OpIdx - Operand index
|
||||
/// - RCEnum - Register class enumeration value
|
||||
GIR_ConstrainOperandRC,
|
||||
|
||||
/// Constrain an instructions operands according to the instruction
|
||||
/// description.
|
||||
/// - InsnID - Instruction ID to modify
|
||||
GIR_ConstrainSelectedInstOperands,
|
||||
|
||||
/// Merge all memory operands into instruction.
|
||||
/// - InsnID - Instruction ID to modify
|
||||
/// - MergeInsnID... - One or more Instruction ID to merge into the result.
|
||||
/// - GIU_MergeMemOperands_EndOfList - Terminates the list of instructions to
|
||||
/// merge.
|
||||
GIR_MergeMemOperands,
|
||||
|
||||
/// Erase from parent.
|
||||
/// - InsnID - Instruction ID to erase
|
||||
GIR_EraseFromParent,
|
||||
|
||||
/// Create a new temporary register that's not constrained.
|
||||
/// - TempRegID - The temporary register ID to initialize.
|
||||
/// - Expected type
|
||||
|
@ -310,7 +297,6 @@ enum {
|
|||
/// - RuleID - The ID of the rule that was covered.
|
||||
GIR_Coverage,
|
||||
|
||||
/// Keeping track of the number of the GI opcodes. Must be the last entry.
|
||||
GIU_NumOpcodes,
|
||||
};
|
||||
|
||||
|
@ -355,15 +341,6 @@ public:
|
|||
template <class PredicateBitset, class ComplexMatcherMemFn,
|
||||
class CustomRendererFn>
|
||||
struct ISelInfoTy {
|
||||
ISelInfoTy(const LLT *TypeObjects, size_t NumTypeObjects,
|
||||
const PredicateBitset *FeatureBitsets,
|
||||
const ComplexMatcherMemFn *ComplexPredicates,
|
||||
const CustomRendererFn *CustomRenderers)
|
||||
: TypeObjects(TypeObjects),
|
||||
FeatureBitsets(FeatureBitsets),
|
||||
ComplexPredicates(ComplexPredicates),
|
||||
CustomRenderers(CustomRenderers) {
|
||||
}
|
||||
const LLT *TypeObjects;
|
||||
const PredicateBitset *FeatureBitsets;
|
||||
const ComplexMatcherMemFn *ComplexPredicates;
|
||||
|
|
|
@ -53,9 +53,8 @@ bool InstructionSelector::executeMatchTable(
|
|||
MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI,
|
||||
const RegisterBankInfo &RBI, const PredicateBitset &AvailableFeatures,
|
||||
CodeGenCoverage &CoverageInfo) const {
|
||||
|
||||
uint64_t CurrentIdx = 0;
|
||||
SmallVector<uint64_t, 4> OnFailResumeAt;
|
||||
SmallVector<uint64_t, 8> OnFailResumeAt;
|
||||
|
||||
enum RejectAction { RejectAndGiveUp, RejectAndResume };
|
||||
auto handleReject = [&]() -> RejectAction {
|
||||
|
@ -63,7 +62,8 @@ bool InstructionSelector::executeMatchTable(
|
|||
dbgs() << CurrentIdx << ": Rejected\n");
|
||||
if (OnFailResumeAt.empty())
|
||||
return RejectAndGiveUp;
|
||||
CurrentIdx = OnFailResumeAt.pop_back_val();
|
||||
CurrentIdx = OnFailResumeAt.back();
|
||||
OnFailResumeAt.pop_back();
|
||||
DEBUG_WITH_TYPE(TgtInstructionSelector::getName(),
|
||||
dbgs() << CurrentIdx << ": Resume at " << CurrentIdx << " ("
|
||||
<< OnFailResumeAt.size() << " try-blocks remain)\n");
|
||||
|
@ -139,13 +139,12 @@ bool InstructionSelector::executeMatchTable(
|
|||
int64_t InsnID = MatchTable[CurrentIdx++];
|
||||
int64_t Expected = MatchTable[CurrentIdx++];
|
||||
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
unsigned Opcode = State.MIs[InsnID]->getOpcode();
|
||||
|
||||
DEBUG_WITH_TYPE(TgtInstructionSelector::getName(),
|
||||
dbgs() << CurrentIdx << ": GIM_CheckOpcode(MIs[" << InsnID
|
||||
<< "], ExpectedOpcode=" << Expected
|
||||
<< ") // Got=" << Opcode << "\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
if (Opcode != Expected) {
|
||||
if (handleReject() == RejectAndGiveUp)
|
||||
return false;
|
||||
|
@ -198,8 +197,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< CurrentIdx << ": GIM_CheckAPIntImmPredicate(MIs["
|
||||
<< InsnID << "], Predicate=" << Predicate << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
assert(State.MIs[InsnID]->getOpcode() == TargetOpcode::G_CONSTANT &&
|
||||
"Expected G_CONSTANT");
|
||||
assert(State.MIs[InsnID]->getOpcode() && "Expected G_CONSTANT");
|
||||
assert(Predicate > GIPFP_APInt_Invalid && "Expected a valid predicate");
|
||||
APInt Value;
|
||||
if (State.MIs[InsnID]->getOperand(1).isCImm())
|
||||
|
@ -238,6 +236,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
dbgs() << CurrentIdx << ": GIM_CheckAtomicOrdering(MIs["
|
||||
<< InsnID << "], " << (uint64_t)Ordering << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
if (!State.MIs[InsnID]->hasOneMemOperand())
|
||||
if (handleReject() == RejectAndGiveUp)
|
||||
return false;
|
||||
|
@ -256,6 +255,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< ": GIM_CheckAtomicOrderingOrStrongerThan(MIs["
|
||||
<< InsnID << "], " << (uint64_t)Ordering << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
if (!State.MIs[InsnID]->hasOneMemOperand())
|
||||
if (handleReject() == RejectAndGiveUp)
|
||||
return false;
|
||||
|
@ -274,6 +274,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< ": GIM_CheckAtomicOrderingWeakerThan(MIs["
|
||||
<< InsnID << "], " << (uint64_t)Ordering << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
if (!State.MIs[InsnID]->hasOneMemOperand())
|
||||
if (handleReject() == RejectAndGiveUp)
|
||||
return false;
|
||||
|
@ -374,6 +375,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< "]->getOperand(" << OpIdx
|
||||
<< "), TypeID=" << TypeID << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
MachineOperand &MO = State.MIs[InsnID]->getOperand(OpIdx);
|
||||
if (!MO.isReg() ||
|
||||
MRI.getType(MO.getReg()) != ISelInfo.TypeObjects[TypeID]) {
|
||||
|
@ -392,6 +394,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< InsnID << "]->getOperand(" << OpIdx
|
||||
<< "), SizeInBits=" << SizeInBits << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
// iPTR must be looked up in the target.
|
||||
if (SizeInBits == 0) {
|
||||
MachineFunction *MF = State.MIs[InsnID]->getParent()->getParent();
|
||||
|
@ -463,6 +466,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
<< InsnID << "]->getOperand(" << OpIdx
|
||||
<< "), Value=" << Value << ")\n");
|
||||
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
|
||||
|
||||
MachineOperand &MO = State.MIs[InsnID]->getOperand(OpIdx);
|
||||
if (MO.isReg()) {
|
||||
// isOperandImmEqual() will sign-extend to 64-bits, so should we.
|
||||
|
@ -558,7 +562,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
}
|
||||
case GIM_Reject:
|
||||
DEBUG_WITH_TYPE(TgtInstructionSelector::getName(),
|
||||
dbgs() << CurrentIdx << ": GIM_Reject\n");
|
||||
dbgs() << CurrentIdx << ": GIM_Reject");
|
||||
if (handleReject() == RejectAndGiveUp)
|
||||
return false;
|
||||
break;
|
||||
|
@ -850,7 +854,7 @@ bool InstructionSelector::executeMatchTable(
|
|||
|
||||
case GIR_Done:
|
||||
DEBUG_WITH_TYPE(TgtInstructionSelector::getName(),
|
||||
dbgs() << CurrentIdx << ": GIR_Done\n");
|
||||
dbgs() << CurrentIdx << ": GIR_Done");
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue