emitter tableGen stack dumped error

Hi Developers,

I have started developing LLVM backend for my Target.
Unfortunately, I hit quite a few times very cryptic error messages when compiling
with TableGen.
The most cryptic error message was when compiling with TableGen, with the option
-gen-emitter . Here I got the following error message:
llvm-tblgen: /home/varun/workspace-llvm/llvm/utils/TableGen/CodeGenInstruction.h:186: std::pair<unsigned int, unsigned int> llvm::CGIOperandList::getSubOperandNumber(unsigned int) const: Assertion `i < OperandList.size() && “Invalid flat operand #”’ failed.
0 llvm-tblgen 0x0000000000641025
1 llvm-tblgen 0x0000000000641380
2 llvm-tblgen 0x000000000063f656
3 llvm-tblgen 0x000000000064099d
4 libpthread.so.0 0x00002abdd763b330
5 libc.so.6 0x00002abdd84ccc37 gsignal + 55
6 libc.so.6 0x00002abdd84d0028 abort + 328
7 libc.so.6 0x00002abdd84c5bf6
8 libc.so.6 0x00002abdd84c5ca2
9 llvm-tblgen 0x000000000042aa36
10 llvm-tblgen 0x000000000045f8f1
11 llvm-tblgen 0x0000000000460215
12 llvm-tblgen 0x0000000000460996
13 llvm-tblgen 0x0000000000460d27
14 llvm-tblgen 0x00000000005ce3df
15 llvm-tblgen 0x0000000000660bf9
16 llvm-tblgen 0x00000000005cea27
17 libc.so.6 0x00002abdd84b7f45 __libc_start_main + 245
18 llvm-tblgen 0x00000000004059e9
Stack dump:
0. Program arguments: …/…/…/bin/llvm-tblgen -gen-emitter -I /home/varun/workspace-llvm/llvm/lib/Target/LEG -I /home/varun/workspace-llvm/llvm/lib/Target -I /home/varun/workspace-llvm/llvm/include /home/varun/workspace-llvm/llvm/lib/Target/LEG/LEG.td -o /home/varun/workspace-llvm/llvm-build/lib/Target/LEG/LEGGenMCCodeEmitter.inc.tmp
Aborted (core dumped)

Please help me to solve this error.

Thank you in advance

It may be difficult to tell what the problem is by looking at the call stack (especially if the function names are missing).
It's likely that there is some mismatch between operand lists for some instruction. If you actually have the core dump, you could load it into a debugger and see where the failing getSubOperandNumber was called from, and insert some debugging code in there (to print the data structures for which the call fails). A lot of the TableGen's data can be printed by calling a member function "dump()". This could lead you closer to the actual location in the .td file that may contain the bug.


please any one help me