LLVM  8.0.1
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
llvm::DeadArgumentEliminationPass Class Reference

Eliminate dead arguments (and return values) from functions. More...

#include "llvm/Transforms/IPO/DeadArgumentElimination.h"

Inheritance diagram for llvm::DeadArgumentEliminationPass:
Inheritance graph
[legend]
Collaboration diagram for llvm::DeadArgumentEliminationPass:
Collaboration graph
[legend]

Classes

struct  RetOrArg
 Struct that represents (part of) either a return value or a function argument. More...
 

Public Types

enum  Liveness { Live, MaybeLive }
 Liveness enum - During our initial pass over the program, we determine that things are either alive or maybe alive. More...
 
using UseMap = std::multimap< RetOrArg, RetOrArg >
 
using LiveSet = std::set< RetOrArg >
 
using LiveFuncSet = std::set< const Function * >
 
using UseVector = SmallVector< RetOrArg, 5 >
 

Public Member Functions

 DeadArgumentEliminationPass (bool ShouldHackArguments_=false)
 
PreservedAnalyses run (Module &M, ModuleAnalysisManager &)
 
RetOrArg CreateRet (const Function *F, unsigned Idx)
 Convenience wrapper. More...
 
RetOrArg CreateArg (const Function *F, unsigned Idx)
 Convenience wrapper. More...
 

Public Attributes

UseMap Uses
 This maps a return value or argument to any MaybeLive return values or arguments it uses. More...
 
LiveSet LiveValues
 This set contains all values that have been determined to be live. More...
 
LiveFuncSet LiveFunctions
 This set contains all values that are cannot be changed in any way. More...
 
bool ShouldHackArguments = false
 This allows this pass to do double-duty as the dead arg hacking pass (used only by bugpoint). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::PassInfoMixin< DeadArgumentEliminationPass >
static StringRef name ()
 Gets the name of the pass we are mixed into. More...
 

Detailed Description

Eliminate dead arguments (and return values) from functions.

Definition at line 39 of file DeadArgumentElimination.h.

Member Typedef Documentation

◆ LiveFuncSet

Definition at line 111 of file DeadArgumentElimination.h.

◆ LiveSet

Definition at line 110 of file DeadArgumentElimination.h.

◆ UseMap

Definition at line 92 of file DeadArgumentElimination.h.

◆ UseVector

Definition at line 119 of file DeadArgumentElimination.h.

Member Enumeration Documentation

◆ Liveness

Liveness enum - During our initial pass over the program, we determine that things are either alive or maybe alive.

We don't mark anything explicitly dead (even if we know they are), since anything not alive with no registered uses (in Uses) will never be marked alive and will thus become dead in the end.

Enumerator
Live 
MaybeLive 

Definition at line 75 of file DeadArgumentElimination.h.

Constructor & Destructor Documentation

◆ DeadArgumentEliminationPass()

llvm::DeadArgumentEliminationPass::DeadArgumentEliminationPass ( bool  ShouldHackArguments_ = false)
inline

Definition at line 77 of file DeadArgumentElimination.h.

References run().

Member Function Documentation

◆ CreateArg()

RetOrArg llvm::DeadArgumentEliminationPass::CreateArg ( const Function F,
unsigned  Idx 
)
inline

Convenience wrapper.

Definition at line 88 of file DeadArgumentElimination.h.

References llvm::DeadArgumentEliminationPass::RetOrArg::RetOrArg().

◆ CreateRet()

RetOrArg llvm::DeadArgumentEliminationPass::CreateRet ( const Function F,
unsigned  Idx 
)
inline

Convenience wrapper.

Definition at line 83 of file DeadArgumentElimination.h.

References llvm::DeadArgumentEliminationPass::RetOrArg::RetOrArg().

◆ run()

PreservedAnalyses DeadArgumentEliminationPass::run ( Module M,
ModuleAnalysisManager  
)

Member Data Documentation

◆ LiveFunctions

LiveFuncSet llvm::DeadArgumentEliminationPass::LiveFunctions

This set contains all values that are cannot be changed in any way.

Definition at line 117 of file DeadArgumentElimination.h.

◆ LiveValues

LiveSet llvm::DeadArgumentEliminationPass::LiveValues

This set contains all values that have been determined to be live.

Definition at line 114 of file DeadArgumentElimination.h.

◆ ShouldHackArguments

bool llvm::DeadArgumentEliminationPass::ShouldHackArguments = false

This allows this pass to do double-duty as the dead arg hacking pass (used only by bugpoint).

Definition at line 123 of file DeadArgumentElimination.h.

◆ Uses

UseMap llvm::DeadArgumentEliminationPass::Uses

This maps a return value or argument to any MaybeLive return values or arguments it uses.

This allows the MaybeLive values to be marked live when any of its users is marked live. For example (indices are left out for clarity):

  • Uses[ret F] = ret G This means that F calls G, and F returns the value returned by G.
  • Uses[arg F] = ret G This means that some function calls G and passes its result as an argument to F.
  • Uses[ret F] = arg F This means that F returns one of its own arguments.
  • Uses[arg F] = arg G This means that G calls F and passes one of its own (G's) arguments directly to F.

Definition at line 108 of file DeadArgumentElimination.h.


The documentation for this class was generated from the following files: