[LLVMdev] How to split module?

Chris Lattner clattner at apple.com
Mon Sep 14 09:51:09 PDT 2009


On Sep 14, 2009, at 12:25 AM, Wenzhi Tao wrote:

> Hi, all.
>
> My question is about how to split one module into N modules(N >= 2)?
> For example, given the following code:

I'd suggest looking at bugpoint and the llvm-extract tool.  Both slice  
and dice modules in various ways.  Look at the ExtractFunction.cpp in  
tools/bugpoint for example.

-Chris

>
> #src.c#
> int main()
> {
>    //......//
>    func1();
>    func2();
>    //......//
>    return 0;
> }
> void func1()
> {
>    //......//
> }
> void func2()
> {
>    //......//
> }
>
> func1() has no dependence with func2(), so they can perform parallel
> execution. And I have to split src.c into src1.c and src2.c instead  
> of using
> thread library, because the target machine has multiple RISC  
> processors
> without Operating System,
>
> #src1.c#
> int main()
> {
>    //......//
>    // synchronization
>    func1();
>    // synchronization
>    //......//
>    return 0;
> }
> void func1()
> {
>    //......//
> }
>
> #src2.c#
> int main()
> {
>    //......//
>    // synchronization
>    func2();
>    // synchronization
>    //......//
>    return 0;
> }
> void func2()
> {
>    //......//
> }
>
> Well, Assume the synchronization statements has been added, how to  
> perform the
> splitting on the orginal module wiht the guarantee of correctness.  
> Thanks you!
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list