trouble understanding tablegen

I’m somewhat new to LLVM and I’m trying to learn tablegen. I found a tutorial on how to create a backend for a given target but I can’t figure out how does tablegen do pattern matching.

Here is the specific link to the tutorial.

http://jonathan2251.github.io/lbd/llvmstructure.html#llvmstructure-f13

The image describes how instruction selection occurs but I can’t make heads or tails of it. I’d really appreciate any help on this.

Thanks