Add a new bit that ImmLeaf's can opt into, which allows them to duck out of
[oota-llvm.git] / utils / TableGen / CodeGenDAGPatterns.h
index b113a59e4a94547178d96e4a5f9b4f777a7cd5d8..e4e8574bbca2de4bbcdcaf7116116dfea2eb62cd 100644 (file)
@@ -257,6 +257,17 @@ public:
   /// isAlwaysTrue - Return true if this is a noop predicate.
   bool isAlwaysTrue() const;
   
+  bool isImmediatePattern() const { return !getImmCode().empty(); }
+  
+  /// getImmediatePredicateCode - Return the code that evaluates this pattern if
+  /// this is an immediate predicate.  It is an error to call this on a
+  /// non-immediate pattern.
+  std::string getImmediatePredicateCode() const {
+    std::string Result = getImmCode();
+    assert(!Result.empty() && "Isn't an immediate pattern!");
+    return Result;
+  }
+  
   
   bool operator==(const TreePredicateFn &RHS) const {
     return PatFragRec == RHS.PatFragRec;