Generate LLVM C++ API code as backend

前端 未结 2 1154
暖寄归人
暖寄归人 2020-12-08 22:43

The Online LLVM demo page had an option to generate LLVM C++ API code as backend from a source code. However, that demo page is now disabled. I was wondering how we can do i

2条回答
  •  无人及你
    2020-12-08 23:27

    The LLVM C++ backend has to be enabled during configuration when building LLVM. It's enabled by default in the configure (autotools) build, but not in the CMake build when you build on Windows. You can enable it by setting the appropriate flags while configuring with CMake. See this page for more information.

    Quote:

    LLVM_TARGETS_TO_BUILD:STRING Semicolon-separated list of targets to build, or all for building all targets. Case-sensitive. For Visual C++ defaults to X86. On the other cases defaults to all. Example: -DLLVM_TARGETS_TO_BUILD="X86;PowerPC".

    UPDATE

    Since version 3.9 the CppBackend is no more a valid target. They've removed from their code as the generated code were presenting a few issues.

    Check this commit

    Remove bit-rotten CppBackend.
    
    This backend was supposed to generate C++ code which will re-construct
    the LLVM IR passed as input. This seems to me to have very marginal
    usefulness in the first place.
    
    However, the code has never been updated to use IRBuilder, which makes
    its current value negative -- people who look at the output may be
    steered to use the *wrong* C++ APIs to construct IR.
    
    Furthermore, it's generated code that doesn't compile since at least
    2013.
    
    Differential Revision: http://reviews.llvm.org/D19942
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268631 91177308-0d34-0410-b5e6-96231b3b80d8
    

提交回复
热议问题