LLVM Instruction selection matcher

I have a few questions about matching in the selector.

  1. Why does the size of the MatcherTable greatly exceed the number of patterns defined in the target description? If it simply contains all the variants of the patterns then what is the encoding of these entries ?
  2. Is there a simple way to extract the root opcode of a pattern from the MatcherTable entry ?
  3. I believe the entries in the MatcherTable are ordered by some measure of cost. What exactly does the cost represent and can it be retrieved while the selector runs ?


On a related note: Is there any documentation on the DAG state machine ?