Merging Modules

Hi,

Can anyone point me to some code (or offer advice) on how I can merge one Module into another?

I have a list of Modules each containing one Function. I would like to combine them all into one monolithic Module before transforming and optimizing (The original Modules must remain unmodified)

Thanks,

paul

Hi Paul,

Hi Paul,

Hi,

Can anyone point me to some code (or offer advice) on how I can merge one Module into another?

I have a list of Modules each containing one Function. I would like to combine them all into one monolithic Module before transforming and optimizing (The original Modules must remain unmodified)

See Linker::LinkModules(…).

Mm, I think LinkModules is destructive to one of its input modules. Try CloneFunction http://llvm.org/doxygen/namespacellvm.html#aabb040f50a7e75ad8d58bfc5d95636a4 maybe?

Thanks for the advice. Using Linker and CloneModule seems to suit my needs perfectly.