Jie Zhou via llvm-dev
2019-Mar-25 22:49 UTC
[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/add3a21f/attachment.html>
Eli Friedman via llvm-dev
2019-Mar-25 23:27 UTC
[llvm-dev] How to use bugpoint for backend native code generation?
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>
Jie Zhou via llvm-dev
2019-Mar-26 00:00 UTC
[llvm-dev] How to use bugpoint for backend native code generation?
On Mar 25, 2019, at 19:27, Eli Friedman <efriedma at quicinc.com<mailto:efriedma at quicinc.com>> wrote: 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<https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_OptBisect.html&d=DwMGaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=KAtyTEI8n3FritxDpKpR7rv3VjdmUs0luiVKZLb_bNI&m=N8T9xou8gKEMYjs_z4t_ajAvxVNR0Gi7DSTGkmK3UMU&s=i7-oSWHTWDhAbbHVN9ADDhdRRvguklobURQzSWuFVWM&e=> . 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. Hi Eli, Can you be more specific on “emitting assembly”? I know how to generate asm code from source code, but is there a way to generate native asm code after running machine function passes? - Jie -Eli From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto: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<mailto: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/20190326/704c33bc/attachment-0001.html>
Jie Zhou via llvm-dev
2019-Mar-26 18:05 UTC
[llvm-dev] How to use bugpoint for backend native code generation?
On Mar 25, 2019, at 19:27, Eli Friedman <efriedma at quicinc.com<mailto:efriedma at quicinc.com>> wrote: 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<https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_OptBisect.html&d=DwMGaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=KAtyTEI8n3FritxDpKpR7rv3VjdmUs0luiVKZLb_bNI&m=N8T9xou8gKEMYjs_z4t_ajAvxVNR0Gi7DSTGkmK3UMU&s=i7-oSWHTWDhAbbHVN9ADDhdRRvguklobURQzSWuFVWM&e=> . 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. Hi Eli, Just an FYI, I tried to run my pass before ARMConstantIslandPass rather than after it, and it solved my problem, although I’m not very clear of why it works. Thanks, - Jie -Eli From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto: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<mailto: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/20190326/99a45c5f/attachment.html>
Seemingly Similar Threads
- [A bug?] Failed to use BuildMI to add R7 - R12 registers for tADDi8 and tPUSH of ARM
- [A bug?] Failed to use BuildMI to add R7 - R12 registers for tADDi8 and tPUSH of ARM
- Best way of implement a fat pointer for C
- Cast between struct
- How to configure cmake to not rebuild .inc (tablegen) files?