From 23b2983fe209baa43000d0f627704a3b94bb774f Mon Sep 17 00:00:00 2001 From: Thomas Symalla Date: Tue, 3 Dec 2024 11:45:52 +0100 Subject: [PATCH] Add VarArgs index --- lib/TableGen/Operations.cpp | 3 +-- test/example/generated/ExampleDialect.h.inc | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/TableGen/Operations.cpp b/lib/TableGen/Operations.cpp index 157a9da..acfc92c 100644 --- a/lib/TableGen/Operations.cpp +++ b/lib/TableGen/Operations.cpp @@ -171,8 +171,7 @@ void OperationBase::emitArgumentAccessorDeclarations(llvm::raw_ostream &out, const bool isVarArg = arg.type->isVarArgList(); - if (!isVarArg) - argNames.push_back(capitalizedArgName); + argNames.push_back(capitalizedArgName + (isVarArg ? "Start" : "")); std::string defaultDeclaration = "$0 get$1() $2;"; diff --git a/test/example/generated/ExampleDialect.h.inc b/test/example/generated/ExampleDialect.h.inc index e15512c..9e5794f 100644 --- a/test/example/generated/ExampleDialect.h.inc +++ b/test/example/generated/ExampleDialect.h.inc @@ -419,7 +419,9 @@ bool verifier(::llvm::raw_ostream &errs); /// Returns a new op with the same arguments and a new tail argument list. /// The object on which this is called will be replaced and erased. InstNameConflictVarargsOp *replaceInstName_0(::llvm::ArrayRef); - + enum class ArgumentIndex: uint32_t { +InstName_0Start = 0, +}; ::llvm::Value * getResult(); @@ -648,6 +650,7 @@ bool verifier(::llvm::raw_ostream &errs); WriteVarArgOp *replaceArgs(::llvm::ArrayRef); enum class ArgumentIndex: uint32_t { Data = 0, +ArgsStart = 1, };