[PATCH] D48887: [TableGen] Suppress type validation when parsing pattern fragments
Ulrich Weigand via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 13 09:47:15 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337023: [TableGen] Suppress type validation when parsing pattern fragments (authored by uweigand, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D48887?vs=153943&id=155414#toc
Repository:
rL LLVM
https://reviews.llvm.org/D48887
Files:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
Index: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
===================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
@@ -333,9 +333,21 @@
TypeSetByHwMode &VTS;
};
+ struct SuppressValidation {
+ SuppressValidation(TypeInfer &TI) : Infer(TI), SavedValidate(TI.Validate) {
+ Infer.Validate = false;
+ }
+ ~SuppressValidation() {
+ Infer.Validate = SavedValidate;
+ }
+ TypeInfer &Infer;
+ bool SavedValidate;
+ };
+
TreePattern &TP;
unsigned ForceMode; // Mode to use when set.
bool CodeGen = false; // Set during generation of matcher code.
+ bool Validate = true; // Indicate whether to validate types.
private:
TypeSetByHwMode getLegalTypes();
Index: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -808,7 +808,7 @@
#ifndef NDEBUG
TypeInfer::ValidateOnExit::~ValidateOnExit() {
- if (!VTS.validate()) {
+ if (Infer.Validate && !VTS.validate()) {
dbgs() << "Type set is empty for each HW mode:\n"
"possible type contradiction in the pattern below "
"(use -print-records with llvm-tblgen to see all "
@@ -3056,9 +3056,15 @@
ThePat.InlinePatternFragments();
// Infer as many types as possible. Don't worry about it if we don't infer
- // all of them, some may depend on the inputs of the pattern.
- ThePat.InferAllTypes();
- ThePat.resetError();
+ // all of them, some may depend on the inputs of the pattern. Also, don't
+ // validate type sets; validation may cause spurious failures e.g. if a
+ // fragment needs floating-point types but the current target does not have
+ // any (this is only an error if that fragment is ever used!).
+ {
+ TypeInfer::SuppressValidation SV(ThePat.getInfer());
+ ThePat.InferAllTypes();
+ ThePat.resetError();
+ }
// If debugging, print out the pattern fragment result.
LLVM_DEBUG(ThePat.dump());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48887.155414.patch
Type: text/x-patch
Size: 2190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180713/9af1edf6/attachment.bin>
More information about the llvm-commits
mailing list