I choose a simple backend llvm-leg(GitHub - frasercrmck/llvm-leg) to understand code generation in the backend, I’m trying to understand instruction selesction. So I look into LEGInstrInfo.td file. The instruction information includes dag ins, dag outs, string asmstr and list pattern(i can’t understand it), And i also know IR will be translated into selection DAG(a data struct) by lowering.
The key problem i want to understand is the process of instruction selection. I know tableGen will produce a MatcherTable(a kind of byte code) according to LEGInstrInfo.td, it will run a program to run instruction selection. So at first, i need to understand all of information used by tablenGen, the second, i need look into -gen-dag-isel backend to find how tableGen use these infromation.
So, my quesiton:
- all information struct are describe in TargetSelectionDAG.td file. i can understand
- SDTypeConstraint – limit for value
- SDTypeProfile – limit for Selection Node(ins and outs)
- SDNodeProperty – property of Selection Node, actually describe operator in the value(Commutative or Associative …)
- SDNode – include opcodeName, limit for value, property of operating …
i can’ understand
- SDNodeXForm, CodePatPred, PatFrag(which use CodePatPred),PatLeaf,Pattern,Pat,ComplexPattern
So my question is that Is there any way for me to understand what these class abstraction is trying to express except for just looking the source code and notes?
- the same question, Is there a easy way for me to understand how tableGen use these information