[llvm-dev] LLVM function parameters
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 13 13:34:19 PDT 2018
On 4/13/2018 12:47 PM, James Courtier-Dutton via llvm-dev wrote:
> Hi,
>
> When using the LLVM IR builder, I have a situation that might have 5
> parameters when building the function nodes and instructions.
> Later on, I wish to remove one of the parameters so the same function
> now has only 4 parameters. For example, the parameter may not actually
> be used by any of the instructions in the function.
> How do I remove a parameter from the function?
> I am hoping that there is a way to do this with the LLVM IR builder,
> without having to define the function parameters again, and then add
> all the nodes and instructions again.
There is no way to mutate the type of a function; you have to make a new
one. That said, it's not actually that much code; see, for example,
DeadArgumentEliminationPass::DeleteDeadVarargs in
lib/Transforms/IPO/DeadArgumentElimination.cpp .
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-dev
mailing list