[llvm-dev] Using `smullohi` in TableGen patterns

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 19 07:45:21 PST 2016


> If I write a C++ matcher, will the register allocator work correctly? The
> multiplication instruction I'm working with always writes the result to
> registers `R1` and `R0`, but if that logic is in C++, how will the
> regallocator know?

You'd add extra CopyFromReg nodes, glued[1] to your multiplication
node. The values produced by the CopyFromReg nodes are what other
users should actually be using[2]. x86 has similar hard-coded
registers on its multiplication operations, I believe. Try "llc
-view-sched-dags ..." to see the kind of thing you should be
producing.

Cheers.

Tim.

[1] Glue is represented by producing/consuming a value of type MVT::Glue.
[2] You may well have to manually call ReplaceAllUsesOfValueWith after
creating them to make that happen.


More information about the llvm-dev mailing list