Add CodeGenTarget::guessInstructionProperties.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 23 Aug 2012 19:34:41 +0000 (19:34 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 23 Aug 2012 19:34:41 +0000 (19:34 +0000)
Currently, TableGen just guesses instruction properties when it can't
infer them form patterns.

This adds a guessInstructionProperties flag to the instruction set
definition that will be used to disable guessing. The flag is intended
as a migration aid. It will be removed again when no more targets need
their properties guessed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162460 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/Target.td
utils/TableGen/CodeGenTarget.cpp
utils/TableGen/CodeGenTarget.h

index c406bca602874570e63f932e19196b70cfee883f..1f8660732bc5455422950407006d6f5f3087054f 100644 (file)
@@ -631,6 +631,17 @@ class InstrInfo {
   // Sparc manual specifies its instructions in the format [31..0] (big), while
   // PowerPC specifies them using the format [0..31] (little).
   bit isLittleEndianEncoding = 0;
+
+  // The instruction properties mayLoad, mayStore, and hasSideEffects are unset
+  // by default, and TableGen will infer their value from the instruction
+  // pattern when possible.
+  //
+  // Normally, TableGen will issue an error it it can't infer the value of a
+  // property that hasn't been set explicitly. When guessInstructionProperties
+  // is set, it will guess a safe value instead.
+  //
+  // This option is a temporary migration help. It will go away.
+  bit guessInstructionProperties = 1;
 }
 
 // Standard Pseudo Instructions.
index 1dd2efc4a1bf550a982b71670d690f0c6003b6a4..885481617f419e59a97d429c4154feaea7a66ce8 100644 (file)
@@ -334,6 +334,15 @@ bool CodeGenTarget::isLittleEndianEncoding() const {
   return getInstructionSet()->getValueAsBit("isLittleEndianEncoding");
 }
 
+/// guessInstructionProperties - Return true if it's OK to guess instruction
+/// properties instead of raising an error.
+///
+/// This is configurable as a temporary migration aid. It will eventually be
+/// permanently false.
+bool CodeGenTarget::guessInstructionProperties() const {
+  return getInstructionSet()->getValueAsBit("guessInstructionProperties");
+}
+
 //===----------------------------------------------------------------------===//
 // ComplexPattern implementation
 //
index 2f8cee4588a45dce6797782e149726495f39b5ba..672b1406a52d98ba1e991080fe723be02b3e0527 100644 (file)
@@ -177,6 +177,10 @@ public:
   ///
   bool isLittleEndianEncoding() const;
 
+  /// guessInstructionProperties - should we just guess unset instruction
+  /// properties?
+  bool guessInstructionProperties() const;
+
 private:
   void ComputeInstrsByEnum() const;
 };