summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenDAGPatterns.h
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2018-07-13 16:42:15 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2018-07-13 16:42:15 +0000
commit22b1af870ff35c22e4d2089eb2625631f73fcc97 (patch)
tree7e5140cf65db82031a7f16727da43d3c6bed3f27 /llvm/utils/TableGen/CodeGenDAGPatterns.h
parentd362b6ad29eaadf2d11df219b2030b36e61682ae (diff)
downloadbcm5719-llvm-22b1af870ff35c22e4d2089eb2625631f73fcc97.tar.gz
bcm5719-llvm-22b1af870ff35c22e4d2089eb2625631f73fcc97.zip
[TableGen] Suppress type validation when parsing pattern fragments
Currently, any attempt to define a PatFrag involving any floating-point only (or vector only) node causes a hard assertion failure in TableGen if the current target does not have any floating-point (or vector) types. This is annoying if you want to provide convenience fragments in common code (e.g. include/llvm/Target/TargetSelectionDAG.td) that is parsed on all platforms, including those that miss such types. But really, there's no reason not accept this when parsing the fragment -- of course it would be an error for such a target to actually *use* such a fragment anywhere, but as long as it doesn't, I think TableGen shouldn't error out. The immediate cause of the assertion failure is the test inside the ValidateOnExit destructor. This patch simply disables that check while infering types during parsing of pattern fragments (only). Reviewed By: hfinkel, kparzysz Differential Revision: https://reviews.llvm.org/D48887 llvm-svn: 337023
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.h')
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index e4523797edf..c682f3d3268 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -333,9 +333,21 @@ struct TypeInfer {
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();
OpenPOWER on IntegriCloud