[LLVMdev] Replacing all uses of a StructType

John Criswell criswell at illinois.edu
Tue Apr 8 06:52:59 PDT 2014


On 4/8/14, 5:28 AM, Peter Conn wrote:
> Hello,
>
> I'm trying to replace all uses of StructType A with StructType B. I've 
> created a class that inherits from ValueMapTypeRemapper, returns B 
> whenever A is passed to it, and used this class with the 
> CloneFunctionInto function.
>
> Is there a way to clone a function into itself? Currently I've got 
> duplicates of most of my functions, which is fine, but I don't need to 
> duplicate main, so I'm looking for a way to replace all uses of A with 
> B inside main.

You can clone main() into a new function, the rename main() to something 
else (e.g., oldmain()), and then rename your new function main().  In 
fact, I think Value * now has a takeName() method that allows you to do 
the renaming with a single method call.

Regards,

John Criswell

>
> Thanks,
> Peter
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140408/19866667/attachment.html>


More information about the llvm-dev mailing list