[llvm-dev] How can I fix the error "Inline asm not supported [...] because we don't have an asm parser for this target"?

Alex Susu via llvm-dev
Thu, 25 Feb 2021 17:46:08 -0000

Hello.
     Can somebody please help me with the error reported in this thread?
     It seems that some changes were made from LLVM 8 (from 2019) to the current
LLVM,
such that there is no longer a default(?) MCTargetAsmParser and I need to
implement one in
my back end.

     There is one more issue that I wrote of in the previous message also: I
create inline
assembly expressions in the back end to print some special strings (like
"N/M", which is
an arithmetic expression), which actually do not represent assembler
instructions of the
processor. Therefore, I guess I should have an Asm Parser that should not bother
to parse
the arithmetic expression strings because they do not contains assembler
mnemonics.

   Thank you very much,
     Alex

On 2/21/2021 10:08 PM, Alex Susu wrote:
>    Hello.
>      I am trying to build against the latest LLVM source from GitHub (from
Jan 23 2021) my
> research processor back end, which is mostly inspired from the BPF LLVM
back end. While
> trying this, I got this error that I didn't encounter until now:
>       <<LLVM ERROR: Inline asm not supported by this streamer because
we don't have an asm
> parser for this target"
>        ...
>        llvm::AsmPrinter::emitInlineAsm(llvm::StringRef,
llvm::MCSubtargetInfo const&,
> llvm::MCTargetOptions const&, llvm::MDNode const*,
llvm::InlineAsm::AsmDialect) const
> llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:156:9>>
>
>      Again, this is the first time I encounter this error. It is true I am
using quite a
> bit inline assembly expressions to print some special strings which
actually do not
> represent assembler instructions of the processor.
>
>    My back end is inspired heavily from the BPF back end but in 2015, when
I started my
> back end, BPF did not have an AsmParser folder. Do you recommend to get
inspired from the
> the current AsmParser folder of the BPF back end?
>    Any suggestion is warmly welcome.
>
>    If ever, my LLVM back end can be found here:
> https://sites.google.com/site/alexsusu/myfilecabinet/Connex_be.zip .
>
>    Just to mention, I found some documentation about AsmParser from around
2012:
>
https://www.embecosm.com/appnotes/ean10/ean10-howto-llvmas-1.0.html#idp86952 .
>
>    Thank you very much,
>      Alex