[PATCH] D98379: [RISCV] Add additional checking to tablgen RISCVVEmitter requested in D95016.
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 10 19:56:37 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9773cad51939: [RISCV] Add additional checking to tablgen RISCVVEmitter requested in D95016. (authored by craig.topper).
Changed prior to commit:
https://reviews.llvm.org/D98379?vs=329807&id=329831#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98379/new/
https://reviews.llvm.org/D98379
Files:
clang/utils/TableGen/RISCVVEmitter.cpp
Index: clang/utils/TableGen/RISCVVEmitter.cpp
===================================================================
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ 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"
#include <numeric>
@@ -536,7 +537,7 @@
ScalarType = ScalarTypeKind::Float;
break;
default:
- llvm_unreachable("Unhandled type code!");
+ PrintFatalError("Unhandled type code!");
}
assert(ElementBitwidth != 0 && "Bad element bitwidth!");
}
@@ -587,7 +588,7 @@
Scale = 0;
break;
default:
- llvm_unreachable("Illegal primitive type transformers!");
+ PrintFatalError("Illegal primitive type transformers!");
}
Transformer = Transformer.drop_back();
@@ -595,9 +596,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':
@@ -614,11 +621,11 @@
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:
- llvm_unreachable("Illegal non-primitive type transformer!");
+ PrintFatalError("Illegal non-primitive type transformer!");
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98379.329831.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210311/7fda4f3e/attachment-0001.bin>
More information about the cfe-commits
mailing list