none
clang_c2 hook to get in between the compiler and the codegen

    Question

  • We wish to write tools that transform the llvm bitcode post compilation, but pre-codegen.  Is there a supported mechanism to hook a function between clang and c2?
    Thursday, December 01, 2016 9:19 PM

All replies

  • Hi Rennie Allen,

    This forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    >>  Is there a supported mechanism to hook a function between clang and c2?

    Do the Clang and C2 mean the Clang with Microsoft CodeGen (v140_clang_c2) Platform Toolset for C++ project in Visual Studio?

    If yes, as far as I know, Visual Studio Extenstion doesn't have such mechanism to add function for this Platform Toolset.

    If no, please tell us what's the clang and c2 do you mean. I will check whether there has a appropriate forum for your question to get a better help.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 02, 2016 5:31 AM
    Moderator
  • Yes, I am referring to what is currently identified as the toolchain "v141_clang_c2".

    Could you confirm that the c2 backend consumes llvm bitcode and not the AST representation?
    Friday, December 02, 2016 6:13 PM
  • Hi Rennie Allen,

    According to the Identifying your Platform and Toolset part in blog Clang with Microsoft CodeGen in VS 2015, the Clang/C2 and Clang/LLVM are two different toolset.

    And there has other community submit a feedback about build same code with Clange/C2(C1) and Clang/LLVM. So I'm afraid that the C2 backend doesn't consume LLVM bitcode.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 05, 2016 1:51 AM
    Moderator
  • Hi Weiewi,

    I understand this, but it does not follow from the information that you provide that clang/C2 could not have the C2 codegen consume bitcode as its input; in fact, common sense would dictate that it should, since the AST representation is likely to be highly volatile, whilst the bitcode representation is quite stable (the clang/llvm project provides far more guarantees about the backward and forward compatibility of bitcode than they do about the internal AST representation).  

    So the logical technical explanation is that C2 should consume llvm bitcode, I was simply looking for confirmation that the obvious (and rational) implementation is actually what was selected.  This will likely require the input of a engineer from the clang/C2 team and cannot be divined from high level documentation and posts by other users.

    Thanks,
    Rennie

    Monday, December 05, 2016 7:01 PM
  • Hi Rennie Allen,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks for your understanding!

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 06, 2016 2:30 AM
    Moderator
  • Thanks Weiwei!  I appreciate it.
    Tuesday, December 06, 2016 5:41 PM