summaryrefslogtreecommitdiff
path: root/utils/TableGen/InstrInfoEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-06 06:44:58 +0000
committerChris Lattner <sabre@nondot.org>2008-01-06 06:44:58 +0000
commitc8478d8b12c2d7e4cea32d0c9940f5cac2baa4dd (patch)
tree26d074393ffc74b2550a4064726346825bb9878d /utils/TableGen/InstrInfoEmitter.cpp
parent13c6310866bc3ebfc8255a17d8ff2afb233f01cc (diff)
downloadllvm-c8478d8b12c2d7e4cea32d0c9940f5cac2baa4dd.tar.gz
llvm-c8478d8b12c2d7e4cea32d0c9940f5cac2baa4dd.tar.bz2
llvm-c8478d8b12c2d7e4cea32d0c9940f5cac2baa4dd.tar.xz
Change the 'isStore' inferrer to look for 'SDNPMayStore'
instead of "ISD::STORE". This allows us to mark target-specific dag nodes as storing (such as ppc byteswap stores). This allows us to remove more explicit isStore flags from the .td files. Finally, add a warning for when a .td file contains an explicit isStore and tblgen is able to infer it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/InstrInfoEmitter.cpp')
-rw-r--r--utils/TableGen/InstrInfoEmitter.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp
index 4ab285f58f..86615eb932 100644
--- a/utils/TableGen/InstrInfoEmitter.cpp
+++ b/utils/TableGen/InstrInfoEmitter.cpp
@@ -157,9 +157,7 @@ public:
if (Pattern == 0) return; // No pattern.
// Assume there is no side-effect unless we see one.
- // FIXME: Enable this.
- //NeverHasSideEffects = true;
-
+ NeverHasSideEffects = true;
// FIXME: Assume only the first tree is the pattern. The others are clobber
// nodes.
@@ -176,10 +174,9 @@ private:
// Get information about the SDNode for the operator.
const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator());
- // If this is a store node, it obviously stores to memory.
- if (OpInfo.getEnumName() == "ISD::STORE") {
+ // If node writes to memory, it obviously stores to memory.
+ if (OpInfo.hasProperty(SDNPMayStore)) {
isStore = true;
-
} else if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
// If this is an intrinsic, analyze it.
if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem)
@@ -196,15 +193,30 @@ private:
void InstrInfoEmitter::InferFromPattern(const CodeGenInstruction &Inst,
bool &isStore, bool &isLoad,
bool &NeverHasSideEffects) {
- isStore = Inst.isStore;
- isLoad = Inst.isLoad;
- NeverHasSideEffects = Inst.neverHasSideEffects;
+ isStore = isLoad = NeverHasSideEffects = false;
InstAnalyzer(CDP, isStore, isLoad, NeverHasSideEffects).Analyze(Inst.TheDef);
-
+
+ // InstAnalyzer only correctly analyzes isStore so far.
+ if (Inst.isStore) { // If the .td file explicitly sets isStore, use it.
+ // If we decided that this is a store from the pattern, then the .td file
+ // entry is redundant.
+ if (isStore)
+ fprintf(stderr, "Warning: isStore flag explicitly set on instruction '%s'"
+ " but flag already inferred from pattern.\n",
+ Inst.getName().c_str());
+ isStore = true;
+ }
+
+ // These two override everything.
+ isLoad = Inst.isLoad;
+ NeverHasSideEffects = Inst.neverHasSideEffects;
+
+#if 0
// If the .td file explicitly says there is no side effect, believe it.
if (Inst.neverHasSideEffects)
NeverHasSideEffects = true;
+#endif
}