[LLVMdev] How to split module?

Wenzhi Tao linus_wind at zju.edu.cn
Mon Sep 14 00:25:24 PDT 2009


Hi, all.

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

#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!



More information about the llvm-dev mailing list