github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h --
llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
index 237bfcb57..5f57537a4 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
@@ -835,15 +835,15 @@ void RuleMatcher::emit(MatchTable &Table) {
}
// Emit coverage right before the Done opcode>
- auto EmitCoverage = [&]{
+ auto EmitCoverage = [&] {
assert((Table.isWithCoverage() ? !Table.isCombiner() : true) &&
- "Combiner tables don't support coverage!");
+ "Combiner tables don't support coverage!");
if (Table.isWithCoverage())
Table << MatchTable::Opcode("GIR_Coverage")
<< MatchTable::IntValue(4, RuleID) << MatchTable::LineBreak;
else if (!Table.isCombiner())
Table << MatchTable::Comment(
- ("GIR_Coverage, " + Twine(RuleID) + ",").str())
+ ("GIR_Coverage, " + Twine(RuleID) + ",").str())
<< MatchTable::LineBreak;
};
@@ -1669,10 +1669,9 @@ OperandRenderer::~OperandRenderer() = default;
//===- CopyRenderer
-------------------------------------------------------===//
-void CopyRenderer::emitRenderOpcodes(MatchTable &Table,
- unsigned NewInsnID, unsigned OldInsnID,
- unsigned OldOpIdx, StringRef Name,
- bool ForVariadic) {
+void CopyRenderer::emitRenderOpcodes(MatchTable &Table, unsigned NewInsnID,
+ unsigned OldInsnID, unsigned OldOpIdx,
+ StringRef Name, bool ForVariadic) {
if (!ForVariadic && NewInsnID == 0 && OldInsnID == 0) {
Table << MatchTable::Opcode("GIR_RootToRootCopy");
} else {
@@ -1688,15 +1687,15 @@ void CopyRenderer::emitRenderOpcodes(MatchTable &Table,
}
void CopyRenderer::emitRenderOpcodes(MatchTable &Table) const {
- emitRenderOpcodes(Table, NewInsnID, OldInsnID, OldOpIdx,
- SymbolicName, OldOpIsVariadic);
+ emitRenderOpcodes(Table, NewInsnID, OldInsnID, OldOpIdx, SymbolicName,
+ OldOpIsVariadic);
}
//===- CopyPhysRegRenderer
------------------------------------------------===//
void CopyPhysRegRenderer::emitRenderOpcodes(MatchTable &Table) const {
- CopyRenderer::emitRenderOpcodes(Table, NewInsnID, OldInsnID,
- OldOpIdx, PhysReg->getName());
+ CopyRenderer::emitRenderOpcodes(Table, NewInsnID, OldInsnID, OldOpIdx,
+ PhysReg->getName());
}
//===- CopyOrAddZeroRegRenderer
-------------------------------------------===//
@@ -1706,8 +1705,7 @@ void
CopyOrAddZeroRegRenderer::emitRenderOpcodes(MatchTable &Table) const {
<< MatchTable::Comment("NewInsnID")
<< MatchTable::ULEB128Value(NewInsnID)
<< MatchTable::Comment("OldInsnID")
- << MatchTable::ULEB128Value(OldInsnID)
- << MatchTable::Comment("OpIdx")
+ << MatchTable::ULEB128Value(OldInsnID) << MatchTable::Comment("OpIdx")
<< MatchTable::ULEB128Value(OldOpIdx)
<< MatchTable::NamedValue(
2,
@@ -1748,8 +1746,7 @@ void CopySubRegRenderer::emitRenderOpcodes(MatchTable
&Table) const {
<< MatchTable::Comment("NewInsnID")
<< MatchTable::ULEB128Value(NewInsnID)
<< MatchTable::Comment("OldInsnID")
- << MatchTable::ULEB128Value(OldInsnID)
- << MatchTable::Comment("OpIdx")
+ << MatchTable::ULEB128Value(OldInsnID) << MatchTable::Comment("OpIdx")
<< MatchTable::ULEB128Value(OldOpIdx)
<< MatchTable::Comment("SubRegIdx")
<< MatchTable::IntValue(2, SubReg->EnumValue)
@@ -1827,8 +1824,8 @@ void TempRegRenderer::emitRenderOpcodes(MatchTable
&Table) const {
//===- ImmRenderer
--------------------------------------------------------===//
-void ImmRenderer::emitAddImm(MatchTable &Table,
- unsigned InsnID, int64_t Imm, StringRef ImmName) {
+void ImmRenderer::emitAddImm(MatchTable &Table, unsigned InsnID, int64_t Imm,
+ StringRef ImmName) {
const bool IsInt8 = isInt<8>(Imm);
Table << MatchTable::Opcode(IsInt8 ? "GIR_AddImm8" : "GIR_AddImm")
@@ -1854,8 +1851,7 @@ void ImmRenderer::emitRenderOpcodes(MatchTable &Table)
const {
//===- SubRegIndexRenderer
------------------------------------------------===//
void SubRegIndexRenderer::emitRenderOpcodes(MatchTable &Table) const {
- ImmRenderer::emitAddImm(Table, InsnID, SubRegIdx->EnumValue,
- "SubRegIndex");
+ ImmRenderer::emitAddImm(Table, InsnID, SubRegIdx->EnumValue, "SubRegIndex");
}
//===- RenderComplexPatternOperand
----------------------------------------===//
@@ -1905,8 +1901,7 @@ void CustomOperandRenderer::emitRenderOpcodes(MatchTable
&Table) const {
Table << MatchTable::Opcode("GIR_CustomOperandRenderer")
<< MatchTable::Comment("InsnID") << MatchTable::ULEB128Value(InsnID)
<< MatchTable::Comment("OldInsnID")
- << MatchTable::ULEB128Value(OldInsnID)
- << MatchTable::Comment("OpIdx")
+ << MatchTable::ULEB128Value(OldInsnID) << MatchTable::Comment("OpIdx")
<< MatchTable::ULEB128Value(OldOpIdx)
<< MatchTable::Comment("OperandRenderer")
<< MatchTable::NamedValue(
@@ -2081,7 +2076,8 @@ void EraseInstAction::emitActionOpcodes(MatchTable
&Table) const {
<< MatchTable::LineBreak;
}
-bool EraseInstAction::emitActionOpcodesAndDone(MatchTable &Table,
function_ref<void()> OnDone) const {
+bool EraseInstAction::emitActionOpcodesAndDone(
+ MatchTable &Table, function_ref<void()> OnDone) const {
if (InsnID != 0) {
emitActionOpcodes(Table);
return false;
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
index 7acd5f50a..76f242466 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
@@ -1807,7 +1807,8 @@ protected:
public:
CopyRenderer(unsigned NewInsnID, RuleMatcher &RM, StringRef SymbolicName)
- : OperandRenderer(OR_Copy), NewInsnID(NewInsnID),
SymbolicName(SymbolicName) {
+ : OperandRenderer(OR_Copy), NewInsnID(NewInsnID),
+ SymbolicName(SymbolicName) {
assert(!SymbolicName.empty() && "Cannot copy from an unspecified source");
const OperandMatcher &Operand = RM.getOperandMatcher(SymbolicName);
OldInsnID = Operand.getInstructionMatcher().getInsnVarID();
@@ -1821,10 +1822,9 @@ public:
StringRef getSymbolicName() const { return SymbolicName; }
- static void emitRenderOpcodes(MatchTable &Table,
- unsigned NewInsnID, unsigned OldInsnID,
- unsigned OpIdx, StringRef Name,
- bool ForVariadic = false);
+ static void emitRenderOpcodes(MatchTable &Table, unsigned NewInsnID,
+ unsigned OldInsnID, unsigned OpIdx,
+ StringRef Name, bool ForVariadic = false);
void emitRenderOpcodes(MatchTable &Table) const override;
};
@@ -1842,9 +1842,9 @@ public:
CopyPhysRegRenderer(unsigned NewInsnID, RuleMatcher &RM, const Record *Reg)
: OperandRenderer(OR_CopyPhysReg), NewInsnID(NewInsnID), PhysReg(Reg) {
assert(PhysReg);
- const OperandMatcher &Operand = RM.getPhysRegOperandMatcher(PhysReg);
- OldInsnID = Operand.getInstructionMatcher().getInsnVarID();
- OldOpIdx = Operand.getOpIdx();
+ const OperandMatcher &Operand = RM.getPhysRegOperandMatcher(PhysReg);
+ OldInsnID = Operand.getInstructionMatcher().getInsnVarID();
+ OldOpIdx = Operand.getOpIdx();
}
static bool classof(const OperandRenderer *R) {
@@ -1869,7 +1869,8 @@ protected:
unsigned OldOpIdx;
public:
- CopyOrAddZeroRegRenderer(unsigned NewInsnID, RuleMatcher &RM, StringRef
SymbolicName,
+ CopyOrAddZeroRegRenderer(unsigned NewInsnID, RuleMatcher &RM,
+ StringRef SymbolicName,
const Record *ZeroRegisterDef)
: OperandRenderer(OR_CopyOrAddZeroReg), NewInsnID(NewInsnID),
SymbolicName(SymbolicName), ZeroRegisterDef(ZeroRegisterDef) {
@@ -1899,12 +1900,13 @@ protected:
unsigned OldInsnID;
public:
- CopyConstantAsImmRenderer(unsigned NewInsnID, RuleMatcher &RM, StringRef
SymbolicName)
+ CopyConstantAsImmRenderer(unsigned NewInsnID, RuleMatcher &RM,
+ StringRef SymbolicName)
: OperandRenderer(OR_CopyConstantAsImm), NewInsnID(NewInsnID),
SymbolicName(SymbolicName) {
- InstructionMatcher &InsnMatcher =
RM.getInstructionMatcher(SymbolicName);
- OldInsnID = InsnMatcher.getInsnVarID();
- }
+ InstructionMatcher &InsnMatcher = RM.getInstructionMatcher(SymbolicName);
+ OldInsnID = InsnMatcher.getInsnVarID();
+ }
static bool classof(const OperandRenderer *R) {
return R->getKind() == OR_CopyConstantAsImm;
@@ -1925,12 +1927,13 @@ protected:
unsigned OldInsnID;
public:
- CopyFConstantAsFPImmRenderer(unsigned NewInsnID, RuleMatcher &RM, StringRef
SymbolicName)
+ CopyFConstantAsFPImmRenderer(unsigned NewInsnID, RuleMatcher &RM,
+ StringRef SymbolicName)
: OperandRenderer(OR_CopyFConstantAsFPImm), NewInsnID(NewInsnID),
SymbolicName(SymbolicName) {
- InstructionMatcher &InsnMatcher =
RM.getInstructionMatcher(SymbolicName);
- OldInsnID = InsnMatcher.getInsnVarID();
- }
+ InstructionMatcher &InsnMatcher = RM.getInstructionMatcher(SymbolicName);
+ OldInsnID = InsnMatcher.getInsnVarID();
+ }
static bool classof(const OperandRenderer *R) {
return R->getKind() == OR_CopyFConstantAsFPImm;
@@ -1955,14 +1958,14 @@ protected:
unsigned OldOpIdx;
public:
- CopySubRegRenderer(unsigned NewInsnID, RuleMatcher &RM, StringRef
SymbolicName,
- const CodeGenSubRegIndex *SubReg)
+ CopySubRegRenderer(unsigned NewInsnID, RuleMatcher &RM,
+ StringRef SymbolicName, const CodeGenSubRegIndex *SubReg)
: OperandRenderer(OR_CopySubReg), NewInsnID(NewInsnID),
SymbolicName(SymbolicName), SubReg(SubReg) {
- const OperandMatcher &Operand = RM.getOperandMatcher(SymbolicName);
- OldInsnID = Operand.getInstructionMatcher().getInsnVarID();
- OldOpIdx = Operand.getOpIdx();
- }
+ const OperandMatcher &Operand = RM.getOperandMatcher(SymbolicName);
+ OldInsnID = Operand.getInstructionMatcher().getInsnVarID();
+ OldOpIdx = Operand.getOpIdx();
+ }
static bool classof(const OperandRenderer *R) {
return R->getKind() == OR_CopySubReg;
@@ -2044,8 +2047,8 @@ public:
return R->getKind() == OR_Imm;
}
- static void emitAddImm(MatchTable &Table, unsigned InsnID,
- int64_t Imm, StringRef ImmName = "Imm");
+ static void emitAddImm(MatchTable &Table, unsigned InsnID, int64_t Imm,
+ StringRef ImmName = "Imm");
void emitRenderOpcodes(MatchTable &Table) const override;
};
@@ -2134,9 +2137,9 @@ public:
StringRef SymbolicName)
: OperandRenderer(OR_Custom), InsnID(InsnID), Renderer(Renderer),
SymbolicName(SymbolicName) {
- InstructionMatcher &InsnMatcher =
RM.getInstructionMatcher(SymbolicName);
- OldInsnID = InsnMatcher.getInsnVarID();
- }
+ InstructionMatcher &InsnMatcher = RM.getInstructionMatcher(SymbolicName);
+ OldInsnID = InsnMatcher.getInsnVarID();
+ }
static bool classof(const OperandRenderer *R) {
return R->getKind() == OR_Custom;
@@ -2155,14 +2158,14 @@ protected:
unsigned OldOpIdx;
public:
- CustomOperandRenderer(unsigned InsnID, RuleMatcher &RM, const Record
&Renderer,
- StringRef SymbolicName)
+ CustomOperandRenderer(unsigned InsnID, RuleMatcher &RM,
+ const Record &Renderer, StringRef SymbolicName)
: OperandRenderer(OR_CustomOperand), InsnID(InsnID), Renderer(Renderer),
SymbolicName(SymbolicName) {
- const OperandMatcher &OM = RM.getOperandMatcher(SymbolicName);
- OldInsnID = OM.getInsnVarID();
- OldOpIdx = OM.getOpIdx();
- }
+ const OperandMatcher &OM = RM.getOperandMatcher(SymbolicName);
+ OldInsnID = OM.getInsnVarID();
+ OldOpIdx = OM.getOpIdx();
+ }
static bool classof(const OperandRenderer *R) {
return R->getKind() == OR_CustomOperand;
@@ -2201,9 +2204,11 @@ public:
/// Emit the MatchTable opcodes to implement the action.
virtual void emitActionOpcodes(MatchTable &Table) const = 0;
- /// If this opcode has an overload that can call GIR_Done directly, call \p
OnDone, emit the opcode, and return true.
- /// Otherwise, emit the normal action opcode and return false.
- virtual bool emitActionOpcodesAndDone(MatchTable &Table,
function_ref<void()> OnDone) const {
+ /// If this opcode has an overload that can call GIR_Done directly, call \p
+ /// OnDone, emit the opcode, and return true. Otherwise, emit the normal
+ /// action opcode and return false.
+ virtual bool emitActionOpcodesAndDone(MatchTable &Table,
+ function_ref<void()> OnDone) const {
emitActionOpcodes(Table);
return false;
}
@@ -2242,7 +2247,7 @@ private:
std::vector<const InstructionMatcher *> CopiedFlags;
std::vector<StringRef> SetFlags;
std::vector<StringRef> UnsetFlags;
-std::vector<unsigned> MergeInsnIDs;
+ std::vector<unsigned> MergeInsnIDs;
/// True if the instruction can be built solely by mutating the opcode.
bool canMutate(RuleMatcher &Rule, const InstructionMatcher *Insn) const;
@@ -2323,7 +2328,8 @@ public:
}
void emitActionOpcodes(MatchTable &Table) const override;
- bool emitActionOpcodesAndDone(MatchTable &Table, function_ref<void()>
OnDone) const override;
+ bool emitActionOpcodesAndDone(MatchTable &Table,
+ function_ref<void()> OnDone) const override;
};
class ReplaceRegAction : public MatchAction {
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp
b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index ba721da66..3f3b52c2d 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -1329,8 +1329,8 @@ Error GlobalISelEmitter::importNamedNodeRenderer(
if (R->isSubClassOf("RegisterOperand") &&
!R->isValueUnset("GIZeroRegister")) {
- MIBuilder.addRenderer<CopyOrAddZeroRegRenderer>(M,
- NodeName, R->getValueAsDef("GIZeroRegister"));
+ MIBuilder.addRenderer<CopyOrAddZeroRegRenderer>(
+ M, NodeName, R->getValueAsDef("GIZeroRegister"));
return Error::success();
}
@@ -1351,7 +1351,7 @@ Error GlobalISelEmitter::importNamedNodeRenderer(
// TODO: Remove this check and add CopyRenderer unconditionally.
// TODO: Handle nodes with multiple results (provided they can reach here).
if (isa<UnsetInit>(N.getLeafValue())) {
- MIBuilder.addRenderer<CopyRenderer>(M,NodeName);
+ MIBuilder.addRenderer<CopyRenderer>(M, NodeName);
return Error::success();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/200799
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits