LLVM 22.0.0git
DeadArgumentElimination.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "deadargelim"

Functions

 STATISTIC (NumArgumentsEliminated, "Number of unread args removed")
 STATISTIC (NumRetValsEliminated, "Number of unused return values removed")
 STATISTIC (NumArgumentsReplacedWithPoison, "Number of unread args replaced with poison")
 INITIALIZE_PASS (DAH, "deadarghaX0r", "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)", false, false) ModulePass *llvm
 This pass removes arguments from functions which are not used by the body of the function.
static unsigned numRetVals (const Function *F)
 Convenience function that returns the number of return values.
static TypegetRetComponentType (const Function *F, unsigned Idx)
 Returns the sub-type a function will return at a given Idx.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "deadargelim"

Definition at line 56 of file DeadArgumentElimination.cpp.

Function Documentation

◆ getRetComponentType()

Type * getRetComponentType ( const Function * F,
unsigned Idx )
static

Returns the sub-type a function will return at a given Idx.

Should correspond to the result type of an ExtractValue instruction executed with just that one Idx (i.e. only top-level structure is considered).

Definition at line 347 of file DeadArgumentElimination.cpp.

References assert(), llvm::dyn_cast(), F, and llvm::Type::isVoidTy().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( DAH ,
"deadarghaX0r" ,
"Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)" ,
false ,
false  )

This pass removes arguments from functions which are not used by the body of the function.

Definition at line 112 of file DeadArgumentElimination.cpp.

References llvm::createDeadArgEliminationPass().

◆ numRetVals()

unsigned numRetVals ( const Function * F)
static

Convenience function that returns the number of return values.

It returns 0 for void functions and 1 for functions not returning a struct. It returns the number of struct elements for functions returning a struct.

Definition at line 333 of file DeadArgumentElimination.cpp.

References llvm::dyn_cast(), F, and llvm::Type::isVoidTy().

◆ STATISTIC() [1/3]

STATISTIC ( NumArgumentsEliminated ,
"Number of unread args removed"  )

◆ STATISTIC() [2/3]

STATISTIC ( NumArgumentsReplacedWithPoison ,
"Number of unread args replaced with poison"  )

◆ STATISTIC() [3/3]

STATISTIC ( NumRetValsEliminated ,
"Number of unused return values removed"  )