Skip to content

Commit

Permalink
[GlobalISel] Add a few comments to the tablegen backend. NFC.
Browse files Browse the repository at this point in the history
Based on a review of D29478 by Kristof Beyls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294077 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ahmedbougacha committed Feb 4, 2017
1 parent f299253 commit 15b47b4
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions utils/TableGen/GlobalISelEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ class InstructionMatcher

//===- Actions ------------------------------------------------------------===//

/// An action taken when all Matcher predicates succeeded for a parent rule.
///
/// Typical actions include:
/// * Changing the opcode of an instruction.
/// * Adding an operand to an instruction.
class MatchAction {
public:
virtual ~MatchAction() {}
Expand All @@ -304,6 +309,8 @@ class DebugCommentAction : public MatchAction {
}
};

/// Generates code to set the opcode (really, the MCInstrDesc) of a matched
/// instruction to a given Instruction.
class MutateOpcodeAction : public MatchAction {
private:
const CodeGenInstruction *I;
Expand All @@ -318,12 +325,15 @@ class MutateOpcodeAction : public MatchAction {
};

/// Generates code to check that a match rule matches.
///
/// This currently supports a single match position but could be extended to
/// support multiple positions to support div/rem fusion or load-multiple
/// instructions.
class RuleMatcher {
/// A list of matchers that all need to succeed for the current rule to match.
/// FIXME: This currently supports a single match position but could be
/// extended to support multiple positions to support div/rem fusion or
/// load-multiple instructions.
std::vector<std::unique_ptr<InstructionMatcher>> Matchers;

/// A list of actions that need to be taken when all predicates in this rule
/// have succeeded.
std::vector<std::unique_ptr<MatchAction>> Actions;

public:
Expand Down

0 comments on commit 15b47b4

Please sign in to comment.