From ae3ba45eb244885dcab0629c6b7ce8dc03d0a3c3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 3 Dec 2008 02:30:17 +0000 Subject: Add a sanity-check to tablegen to catch the case where isSimpleLoad is set but mayLoad is not set. Fix all the problems this turned up. Change code to not use isSimpleLoad instead of mayLoad unless it really wants isSimpleLoad. llvm-svn: 60459 --- llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 9 +++++++++ llvm/utils/TableGen/DAGISelEmitter.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'llvm/utils') diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 859a8ccac8d..b3ed27b8d89 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -1759,6 +1759,15 @@ static void InferFromPattern(const CodeGenInstruction &Inst, MayLoad = true; } + // Sanity-check the isSimpleLoad flag. + if (Inst.isSimpleLoad) { + if (!MayLoad) + fprintf(stderr, + "Warning: mayLoad flag not set or inferred for instruction '%s'" + " which has isSimpleLoad set.\n", + Inst.TheDef->getName().c_str()); + } + if (Inst.neverHasSideEffects) { if (HadPattern) fprintf(stderr, "Warning: neverHasSideEffects set on instruction '%s' " diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index 3674a136c9c..a6e3730ab12 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -1097,7 +1097,7 @@ public: // Generate MemOperandSDNodes nodes for each memory accesses covered by // this pattern. - if (II.isSimpleLoad | II.mayLoad | II.mayStore) { + if (II.mayLoad | II.mayStore) { std::vector::const_iterator mi, mie; for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) { std::string LSIName = "LSI_" + *mi; -- cgit v1.2.3