Dylan McKay via llvm-dev
2016-Jan-18 06:41 UTC
[llvm-dev] Using `smullohi` in TableGen patterns
I’m hitting TableGen errors trying to match the smullohi <lhs> <rhs>
node
in TableGen.
smullohi returns two results, which is the problem. I am not sure how to
match against multiple results. The only other nodes to return two operands
are umullohi, udivrem, and sdivrem. There are no examples of these in
TableGen in tree.
The closest I can get is this:
set (R1, R0, (umullohi GPR8:$lhs, GPR8:$rhs))
Which fails:
Assertion failed: (Ops.size() >= NumSrcResults &&
"Didn't
provide enough results"), function EmitResultCode, file
/Users/dylanmckay/projects/llvm/avr-llvm/utils/TableGen/DAGISelMatcherGen.cpp,
line 989.
0 libLLVMSupport.dylib 0x0000000108e8c47e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1 libLLVMSupport.dylib 0x0000000108e8c8c9
PrintStackTraceSignalHandler(void*) + 25
2 libLLVMSupport.dylib 0x0000000108e89069
llvm::sys::RunSignalHandlers() + 425
3 libLLVMSupport.dylib 0x0000000108e8cc29 SignalHandler(int) + 345
4 libsystem_platform.dylib 0x00007fff947f5eaa _sigtramp + 26
5 libLLVMSupport.dylib 0x0000000108eafec9
llvm::sys::DynamicLibrary::Invalid + 9361
6 libLLVMSupport.dylib 0x0000000108e8c8eb raise + 27
7 libLLVMSupport.dylib 0x0000000108e8c9a2 abort + 18
8 libLLVMSupport.dylib 0x0000000108e8c981 __assert_rtn + 129
9 llvm-tblgen 0x000000010893f524 (anonymous
namespace)::MatcherGen::EmitResultCode() + 964
10 llvm-tblgen 0x000000010893e12f
llvm::ConvertPatternToMatcher(llvm::PatternToMatch const&, unsigned
int, llvm::CodeGenDAGPatterns const&) + 143
11 llvm-tblgen 0x0000000108927ca5 (anonymous
namespace)::DAGISelEmitter::run(llvm::raw_ostream&) + 3205
12 llvm-tblgen 0x0000000108926fd6
llvm::EmitDAGISel(llvm::RecordKeeper&, llvm::raw_ostream&) + 54
13 llvm-tblgen 0x0000000108a6dfc8 (anonymous
namespace)::LLVMTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&)
+ 328
14 libLLVMTableGen.dylib 0x0000000108fd7cb1
llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&,
llvm::RecordKeeper&)) + 2385
15 llvm-tblgen 0x0000000108a6de5b main + 91
16 libdyld.dylib 0x00007fff946fe5ad start + 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160118/01f7a3dd/attachment.html>
Matt Arsenault via llvm-dev
2016-Jan-18 10:34 UTC
[llvm-dev] Using `smullohi` in TableGen patterns
> On Jan 17, 2016, at 22:41, Dylan McKay via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I’m hitting TableGen errors trying to match the smullohi <lhs> <rhs> node in TableGen. > > smullohi returns two results, which is the problem. I am not sure how to match against multiple results. The only other nodes to return two operands are umullohi, udivrem, and sdivrem. There are no examples of these in TableGen in tree. > > The closest I can get is this: > > set (R1, R0, (umullohi GPR8:$lhs, GPR8:$rhs))As far as I know, you cannot define a tablegen pattern with multiple results, and need to use C++ matching. I’m kind of surprised there are defined td nodes for these. -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160118/ab142d18/attachment.html>
Dylan McKay via llvm-dev
2016-Jan-18 10:48 UTC
[llvm-dev] Using `smullohi` in TableGen patterns
> As far as I know, you cannot define a tablegen pattern with multipleresults, and need to use C++ matching. I’m kind of surprised there are defined td nodes for these. Yes they were added a while ago, but never used. 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? On Mon, Jan 18, 2016 at 11:34 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:> > On Jan 17, 2016, at 22:41, Dylan McKay via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > I’m hitting TableGen errors trying to match the smullohi <lhs> <rhs> node > in TableGen. > > smullohi returns two results, which is the problem. I am not sure how to > match against multiple results. The only other nodes to return two operands > are umullohi, udivrem, and sdivrem. There are no examples of these in > TableGen in tree. > > The closest I can get is this: > > set (R1, R0, (umullohi GPR8:$lhs, GPR8:$rhs)) > > > As far as I know, you cannot define a tablegen pattern with multiple > results, and need to use C++ matching. I’m kind of surprised there are > defined td nodes for these. > > -Matt >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160118/0abcc70c/attachment.html>