[llvm-dev] How to use bugpoint for backend native code generation?

Eli Friedman via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 25 16:27:09 PDT 2019


Currently bugpoint doesn’t support backend passes.  We didn’t have any support for serializing MachineFunctions until relatively recently, and that support still isn’t really complete.  Depending on the nature of your issue, opt-bisect-limit might be helpful; see http://llvm.org/docs/OptBisect.html .

That said, there’s probably a more straightforward way to track down your particular issue: you should be able to get a readable error message by just emitting assembly, then feeding the output to clang.  And my first guess for the cause of the problem is that your pass is running after ARMConstantIslands, which is almost never what you want.

-Eli

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Jie Zhou via llvm-dev
Sent: Monday, March 25, 2019 3:49 PM
To: via llvm-dev <llvm-dev at lists.llvm.org>
Subject: [EXT] [llvm-dev] How to use bugpoint for backend native code generation?

Hello,

I’m writing machine function passes for programs running with ARMv7-M ISA. My pass adds some instructions to the original code, and now I got

fatal error: error in backend: out of range pc-relative fixup value

when llvm generates native code after running the transformation pass. I think it’s because my transformation pass increases the size of the original code and thus some branch instructions cannot reach their destination (for example, the beq instruction can only jump to a pc-relative destination within range -256 to 254 bytes).

It looks like bugpoint is a good tool to pinpoint which branch instruction caused the error. Unfortunately the blogs I found online are all about using bugpoint for IR passes but not for native code generation. Can anyone give me some help on this issue? (pointing to a good tutorial, or sharing some techniques to pinpoint the troublesome instructions, etc.)

Thanks very much.

- Jie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190325/b0e0ee00/attachment.html>


More information about the llvm-dev mailing list