forked from OSchip/llvm-project
Reapply r291025 ("AMDGPU: Remove unneccessary intermediate vector")
llvm-svn: 291460
This commit is contained in:
parent
8f1f3c40f6
commit
5f45e7890a
|
@ -822,6 +822,7 @@ public:
|
||||||
bool isForcedVOP3() const { return ForcedEncodingSize == 64; }
|
bool isForcedVOP3() const { return ForcedEncodingSize == 64; }
|
||||||
bool isForcedDPP() const { return ForcedDPP; }
|
bool isForcedDPP() const { return ForcedDPP; }
|
||||||
bool isForcedSDWA() const { return ForcedSDWA; }
|
bool isForcedSDWA() const { return ForcedSDWA; }
|
||||||
|
ArrayRef<unsigned> getMatchedVariants() const;
|
||||||
|
|
||||||
std::unique_ptr<AMDGPUOperand> parseRegister();
|
std::unique_ptr<AMDGPUOperand> parseRegister();
|
||||||
bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) override;
|
bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) override;
|
||||||
|
@ -1630,31 +1631,44 @@ unsigned AMDGPUAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
|
||||||
return Match_Success;
|
return Match_Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// What asm variants we should check
|
||||||
|
ArrayRef<unsigned> AMDGPUAsmParser::getMatchedVariants() const {
|
||||||
|
if (getForcedEncodingSize() == 32) {
|
||||||
|
static const unsigned Variants[] = {AMDGPUAsmVariants::DEFAULT};
|
||||||
|
return makeArrayRef(Variants);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isForcedVOP3()) {
|
||||||
|
static const unsigned Variants[] = {AMDGPUAsmVariants::VOP3};
|
||||||
|
return makeArrayRef(Variants);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isForcedSDWA()) {
|
||||||
|
static const unsigned Variants[] = {AMDGPUAsmVariants::SDWA};
|
||||||
|
return makeArrayRef(Variants);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isForcedDPP()) {
|
||||||
|
static const unsigned Variants[] = {AMDGPUAsmVariants::DPP};
|
||||||
|
return makeArrayRef(Variants);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const unsigned Variants[] = {
|
||||||
|
AMDGPUAsmVariants::DEFAULT, AMDGPUAsmVariants::VOP3,
|
||||||
|
AMDGPUAsmVariants::SDWA, AMDGPUAsmVariants::DPP
|
||||||
|
};
|
||||||
|
|
||||||
|
return makeArrayRef(Variants);
|
||||||
|
}
|
||||||
|
|
||||||
bool AMDGPUAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
bool AMDGPUAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||||
OperandVector &Operands,
|
OperandVector &Operands,
|
||||||
MCStreamer &Out,
|
MCStreamer &Out,
|
||||||
uint64_t &ErrorInfo,
|
uint64_t &ErrorInfo,
|
||||||
bool MatchingInlineAsm) {
|
bool MatchingInlineAsm) {
|
||||||
// What asm variants we should check
|
|
||||||
std::vector<unsigned> MatchedVariants;
|
|
||||||
if (getForcedEncodingSize() == 32) {
|
|
||||||
MatchedVariants = {AMDGPUAsmVariants::DEFAULT};
|
|
||||||
} else if (isForcedVOP3()) {
|
|
||||||
MatchedVariants = {AMDGPUAsmVariants::VOP3};
|
|
||||||
} else if (isForcedSDWA()) {
|
|
||||||
MatchedVariants = {AMDGPUAsmVariants::SDWA};
|
|
||||||
} else if (isForcedDPP()) {
|
|
||||||
MatchedVariants = {AMDGPUAsmVariants::DPP};
|
|
||||||
} else {
|
|
||||||
MatchedVariants = {AMDGPUAsmVariants::DEFAULT,
|
|
||||||
AMDGPUAsmVariants::VOP3,
|
|
||||||
AMDGPUAsmVariants::SDWA,
|
|
||||||
AMDGPUAsmVariants::DPP};
|
|
||||||
}
|
|
||||||
|
|
||||||
MCInst Inst;
|
MCInst Inst;
|
||||||
unsigned Result = Match_Success;
|
unsigned Result = Match_Success;
|
||||||
for (auto Variant : MatchedVariants) {
|
for (auto Variant : getMatchedVariants()) {
|
||||||
uint64_t EI;
|
uint64_t EI;
|
||||||
auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
|
auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
|
||||||
Variant);
|
Variant);
|
||||||
|
|
Loading…
Reference in New Issue