Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ class AMDGPUAsmParser : public MCTargetAsmParser {

#define GET_ASSEMBLER_HEADER
#include "AMDGPUGenAsmMatcher.inc"
#undef GET_ASSEMBLER_HEADER

/// }

Expand Down Expand Up @@ -2023,6 +2024,12 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
ParseStatus parseVOPD(OperandVector &Operands);
};

// TODO: define GET_SUBTARGET_FEATURE_NAME
#define GET_REGISTER_MATCHER
#include "AMDGPUGenAsmMatcher.inc"
#undef GET_REGISTER_MATCHER
#undef GET_SUBTARGET_FEATURE_NAME

} // end anonymous namespace

// May be called with integer type with equivalent bitwidth.
Expand Down Expand Up @@ -5838,10 +5845,14 @@ bool AMDGPUAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MCInst Inst;
Inst.setLoc(IDLoc);
unsigned Result = Match_Success;
FeatureBitset MissingFeatures;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to clear it between loop iterations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of yes and kind of no. This loop iteration thing is what prevented me from getting the automatic diagnostics from the predicate. I don't understand why it's here. It fails to match for the right reason on the correct target instruction, but then moves on to the wrong instruction that fails for the wrong reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used yet so it doesn't matter

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the whole PR is not used yet, so it does not matter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e., make a use of it and we will see.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the PR is so whoever picks this up doesn't have to figure out where in the file to put the .incs


for (auto Variant : getMatchedVariants()) {
uint64_t EI;
auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
Variant);
auto R = MatchInstructionImpl(Operands, Inst, EI, MissingFeatures,
MatchingInlineAsm, Variant);

// TODO: Emit diagnostic from MissingFeatures.
// We order match statuses from least to most specific. We use most specific
// status as resulting
// Match_MnemonicFail < Match_InvalidOperand < Match_MissingFeature
Expand Down Expand Up @@ -10497,7 +10508,6 @@ LLVMInitializeAMDGPUAsmParser() {
RegisterMCAsmParser<AMDGPUAsmParser> B(getTheGCNTarget());
}

#define GET_REGISTER_MATCHER
#define GET_MATCHER_IMPLEMENTATION
#define GET_MNEMONIC_SPELL_CHECKER
#define GET_MNEMONIC_CHECKER
Expand Down