Skip to content

Commit 83e7322

Browse files
committed
Update mlir-tblgen
1 parent f83f61f commit 83e7322

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "mlir/TableGen/GenInfo.h"
1515

1616
#include "llvm/ADT/SmallBitVector.h"
17+
#include "llvm/ADT/StringSwitch.h"
1718
#include "llvm/CodeGenTypes/MachineValueType.h"
1819
#include "llvm/Support/CommandLine.h"
1920
#include "llvm/Support/PrettyStackTrace.h"
@@ -60,8 +61,13 @@ using IndicesTy = llvm::SmallBitVector;
6061

6162
/// Return a CodeGen value type entry from a type record.
6263
static llvm::MVT::SimpleValueType getValueType(const Record *rec) {
63-
return (llvm::MVT::SimpleValueType)rec->getValueAsDef("VT")->getValueAsInt(
64-
"Value");
64+
return StringSwitch<llvm::MVT::SimpleValueType>(
65+
rec->getValueAsDef("VT")->getValueAsString("LLVMName"))
66+
#define GET_VT_ATTR(Ty, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
67+
.Case(#Ty, llvm::MVT::Ty)
68+
#include "llvm/CodeGen/GenVT.inc"
69+
#undef GET_VT_ATTR
70+
.Case("INVALID_SIMPLE_VALUE_TYPE", llvm::MVT::INVALID_SIMPLE_VALUE_TYPE);
6571
}
6672

6773
/// Return the indices of the definitions in a list of definitions that

0 commit comments

Comments
 (0)