forked from OSchip/llvm-project
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
This commit is contained in:
parent
dbec49d574
commit
c23e641055
|
@ -1568,16 +1568,15 @@ void DAGISelEmitter::ParsePatterns() {
|
||||||
"with temporaries yet!");
|
"with temporaries yet!");
|
||||||
|
|
||||||
bool IterateInference;
|
bool IterateInference;
|
||||||
|
bool InferredAllPatternTypes, InferredAllResultTypes;
|
||||||
do {
|
do {
|
||||||
// Infer as many types as possible. If we cannot infer all of them, we
|
// 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.
|
// can never do anything with this pattern: report it to the user.
|
||||||
if (!Pattern->InferAllTypes())
|
InferredAllPatternTypes = Pattern->InferAllTypes();
|
||||||
Pattern->error("Could not infer all types in pattern!");
|
|
||||||
|
|
||||||
// Infer as many types as possible. If we cannot infer all of them, we can
|
// 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.
|
// never do anything with this pattern: report it to the user.
|
||||||
if (!Result->InferAllTypes())
|
InferredAllResultTypes = Result->InferAllTypes();
|
||||||
Result->error("Could not infer all types in pattern result!");
|
|
||||||
|
|
||||||
// Apply the type of the result to the source pattern. This helps us
|
// 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
|
// resolve cases where the input type is known to be a pointer type (which
|
||||||
|
@ -1589,6 +1588,13 @@ void DAGISelEmitter::ParsePatterns() {
|
||||||
UpdateNodeType(Pattern->getOnlyTree()->getExtTypes(), *Result);
|
UpdateNodeType(Pattern->getOnlyTree()->getExtTypes(), *Result);
|
||||||
} while (IterateInference);
|
} 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.
|
// Validate that the input pattern is correct.
|
||||||
{
|
{
|
||||||
std::map<std::string, TreePatternNode*> InstInputs;
|
std::map<std::string, TreePatternNode*> InstInputs;
|
||||||
|
|
Loading…
Reference in New Issue