diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-06-20 00:31:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-06-20 00:31:27 +0000 |
| commit | c23e64105543bfad51e93d9152b0ece6d9de2f72 (patch) | |
| tree | 8665661fde8b05621bbbdb622100b3e52a261207 /llvm/utils/TableGen | |
| parent | dbec49d5745440444e68a1b7a7bb0d97aa9eadd8 (diff) | |
| download | bcm5719-llvm-c23e64105543bfad51e93d9152b0ece6d9de2f72.tar.gz bcm5719-llvm-c23e64105543bfad51e93d9152b0ece6d9de2f72.zip | |
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.
llvm-svn: 28865
Diffstat (limited to 'llvm/utils/TableGen')
| -rw-r--r-- | llvm/utils/TableGen/DAGISelEmitter.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index 5febddaa893..5983fb7c020 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -1568,17 +1568,16 @@ void DAGISelEmitter::ParsePatterns() { "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 @@ void DAGISelEmitter::ParsePatterns() { 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. { |

