diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -19,6 +19,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" +#include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" using namespace llvm; @@ -594,9 +595,15 @@ for (char I : Transformer) { switch (I) { case 'P': + if (IsConstant) + PrintFatalError("'P' transformer cannot be used after 'C'"); + if (IsPointer) + PrintFatalError("'P' transformer cannot be used twice"); IsPointer = true; break; case 'C': + if (IsConstant) + PrintFatalError("'C' transformer cannot be used twice"); IsConstant = true; break; case 'K': @@ -613,7 +620,7 @@ break; case 'S': LMUL = LMULType(0); - // Update ElementBitwidth need ot update Scale too. + // Update ElementBitwidth need to update Scale too. Scale = LMUL.getScale(ElementBitwidth); break; default: