[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jun 19 17:31:39 PDT 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.214 -> 1.215
---
Log message:

Don't require src/dst patterns to be able to fully resolve their types, 
because information about one can help refine the other.  This allows us to
write:

def : Pat<(i32 (extload xaddr:$src, i8)),
          (LBZX xaddr:$src)>;

as:

def : Pat<(extload xaddr:$src, i8),
          (LBZX xaddr:$src)>;

because tblgen knows LBZX returns i32.



---
Diffs of the changes:  (+11 -5)

 DAGISelEmitter.cpp |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.214 llvm/utils/TableGen/DAGISelEmitter.cpp:1.215
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.214	Mon Jun 19 19:18:02 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Mon Jun 19 19:31:27 2006
@@ -1568,17 +1568,16 @@
                     "with temporaries yet!");
     
     bool IterateInference;
+    bool InferredAllPatternTypes, InferredAllResultTypes;
     do {
       // Infer as many types as possible.  If we cannot infer all of them, we
       // can never do anything with this pattern: report it to the user.
-      if (!Pattern->InferAllTypes())
-        Pattern->error("Could not infer all types in pattern!");
+      InferredAllPatternTypes = Pattern->InferAllTypes();
       
       // Infer as many types as possible.  If we cannot infer all of them, we can
       // never do anything with this pattern: report it to the user.
-      if (!Result->InferAllTypes())
-        Result->error("Could not infer all types in pattern result!");
-     
+      InferredAllResultTypes = Result->InferAllTypes();
+
       // Apply the type of the result to the source pattern.  This helps us
       // resolve cases where the input type is known to be a pointer type (which
       // is considered resolved), but the result knows it needs to be 32- or
@@ -1588,6 +1587,13 @@
       IterateInference |= Result->getOnlyTree()->
         UpdateNodeType(Pattern->getOnlyTree()->getExtTypes(), *Result);
     } while (IterateInference);
+
+    // Verify that we inferred enough types that we can do something with the
+    // pattern and result.  If these fire the user has to add type casts.
+    if (!InferredAllPatternTypes)
+      Pattern->error("Could not infer all types in pattern!");
+    if (!InferredAllResultTypes)
+      Result->error("Could not infer all types in pattern result!");
     
     // Validate that the input pattern is correct.
     {






More information about the llvm-commits mailing list