<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 5/7/11 2:01 PM, Gokul Ramaswamy wrote:
<blockquote
cite="mid:BANLkTikhp6_2UiSf+2CrcqMuaAOhRFkDaQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hello All,<br>
<br>
I want to change the return type of a function in a Pass(in
a module Pass). I dont want to change any of the arguments of that
function.<br>
Assume that, I can handle the returning values properly inside the
function. Please guide me how to do this ?<br clear="all">
</blockquote>
<br>
You need to do the following steps:<br>
<br>
1) Create a new function with the desired function type.<br>
2) Clone the body of the old function into the new function<br>
3) Find all calls calling the old function and replace them with
calls to the new function.<br>
<br>
This is necessary because a function cannot have its type changed
once it has been created.<br>
<br>
Automatic Pool Allocation adds parameters to functions (which is
similar to what you need to do). See MakeFunctionClone() in
poolalloc/lib/PoolAllocate/PoolAllocate.cpp in the poolalloc
project. Use<br>
<br>
svn co <a class="moz-txt-link-freetext" href="http://llvm.org/svn/llvm-project/poolalloc/trunk">http://llvm.org/svn/llvm-project/poolalloc/trunk</a> poolalloc<br>
<br>
... to get a copy from SVN.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:BANLkTikhp6_2UiSf+2CrcqMuaAOhRFkDaQ@mail.gmail.com"
type="cite">
<br>
<br>
-- <br>
Regards,<br>
Gokul Ramaswamy,<br>
Graduate Student,<br>
Department of CSE, IIT Bombay<br>
<a moz-do-not-send="true"
href="http://www.cse.iitb.ac.in/%7Eramaswamy" target="_blank">http://www.cse.iitb.ac.in/~ramaswamy</a><br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>