[LLVMdev] tblgen multiclasses
rafael.espindola at gmail.com
Tue Oct 10 12:21:21 PDT 2006
> > 1) Forcing a value to be in a particular register.
> How does it do it? I cannot remember that it does so explicitly. Or
> do you mean that it forces the InFlag argument of an insn to be the
> same register as the OutFlag of another instruction?
Use a flag to link a CopyToReg and the node that expects the value in
a fixed register.
> > 2) As a hack when a machine state is not made explicit. For example,
> > in the ARM backend I haven't declared the "FP status" and the
> > "status"
> > registers. So the FMSTAT instruction needs a flag.
> OK. Their usage as a mean to tarnsfer a status directly is more clear
> now. The insn with incoming flag basically reuses the outflag of
> another insn. If I understand correctly, any intruction that can change
> status (usually a status register, or are there any other examples???)
Any status that is not explicit. In the ARM we have a floating point
status register also.
> should/can produce an OutFlag. And any instruction that can need a
> flag, should be decalred with InFlag. What about instructions that use
> status, but do not change it (like conditional jumps) - should they
> also have an outFlag to indicate that they propagate a status?
It might be useful to avoid duplicating a cmp.
> And what about such instructions like jumps or calls, where chains
> are used. What is the exact meaning of the chain? What it refers to? Is
> it a chain of operands? Is it a chain of instructions? How is it
> propagated? What is a guideline to use it? If a new backend is to be
> developed, what are the criteria to ecide that a chain should be used
> for a given instruction?
A chain indicates control dependency
(http://llvm.org/docs/CodeGenerator.html). I.e. it orders side
> For example, if we have something like:
> cmp %a, %b
> jmp lt, label1
> jmp gt, label2
> call f1
> What should be propagated as In/Out flags in this example and what and
> why should be propagated as chains?
I think that there must be a flag from "cmp" to "jmp lt" and a flag
from "jmp lt" to "jmp gt". A chain should connect "jmp gt" to "call".
More information about the llvm-dev