I now have instruction A and instruction B. These two instructions have the same function (the actual scene is slightly different). If the same dag is matched, how to determine the matching priority of these two instructions. Does llvm provide such a setting? What about the priority option of pattern?
If you can answer, thank you very much. I checked some information and some back-end implementations, but found no relevant
def instrA;
def instrB;
def : Pat<dagA, instrA>;
def : Pat<dagA, instrB>;
//so, Is there any tablegen-related definition that provides this kind of function,
//which can complete the setting of DAG “pattern” priority
See getPatternSize in CodeGenDAGPatterns.cpp and AddedComplexity in Instruction and Pattern. In essence, there’s a heuristic based on the size of the pattern being matched that determines the priority.