[LLVMdev] tblgen multiclasses

Chris Lattner sabre at nondot.org
Mon Oct 9 16:00:23 PDT 2006


On Mon, 9 Oct 2006, Roman Levenstein wrote:
> But your previous explanations were so good that I implemented in my
> backend last week almost the same that you've done now in the
> X86InstrSSE.td. I even introduced isCommutable parameter to indicate
> this property, just as you did. So, by now integer arithmetic and
> general purpose instructions are implemented. I'm working on the FP
> support now.

Great :)

> Some feedback about tblgen from my side, i.e. an LLVM newcomer with
> quite some compiler construction experience:

> When it comes to tblgen descriptions and corresponding DAG selection
> and lowering code to be written for a backend, I found the use of
> InFlag, OutFlag and chains less understandable, very underspecified and
> not (well) documented. Even though they are used in all backends,
> their semantics and correct use is far from obvious (even though I'm
> not new to compiler writing).

Right, it is unfortunate that the code generator isn't better documented 
:(.  Patches gratiously accepted :)

> I spent most time on getting these things right. And I learned that if 
> they misbehave it has very fatal consequences on the overall code 
> selection process. Now it works, but I still don't quite understand 
> their overall semantics and don't feel very confident about them. And I 
> guess I'm not the only one. Therefore, I would kindly ask to provide 
> here on the developers list and may be even in the docs a clear 
> explanation of these concepts, giving guidelines on their usage and 
> probably a small, but understandable example making use of them. I think 
> such a description would make creation of new backends much easier and 
> faster.

Basically, flag operands are a hack used to handle resources that are not 
accurately modeled in the scheduler (e.g. condition codes, explicit 
register assignments, etc).  The basic idea of the flag operand is that 
they require the scheduler to keep the "flagged" nodes stuck together in 
the output machine instructions.

If you have a specific question, I'm more than happy to answer it,

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list