LLVM
8.0.1
|
#include "llvm/Transforms/IPO/DeadArgumentElimination.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include <cassert>
#include <cstdint>
#include <utility>
#include <vector>
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 (NumArgumentsReplacedWithUndef, "Number of unread args replaced with undef") | |
INITIALIZE_PASS (DAH, "deadarghaX0r", "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)", false, false) ModulePass *llvm | |
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the body of the function. More... | |
static unsigned | NumRetVals (const Function *F) |
Convenience function that returns the number of return values. More... | |
static Type * | getRetComponentType (const Function *F, unsigned Idx) |
Returns the sub-type a function will return at a given Idx. More... | |
#define DEBUG_TYPE "deadargelim" |
Definition at line 54 of file DeadArgumentElimination.cpp.
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 343 of file DeadArgumentElimination.cpp.
References llvm::Attribute::AllocSize, Arg, llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::Function::arg_size(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::AMDGPU::HSAMD::Kernel::Key::Attrs, llvm::Function::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::Function::copyAttributesFrom(), llvm::Function::Create(), llvm::CallInst::Create(), llvm::ExtractValueInst::Create(), llvm::InsertValueInst::Create(), llvm::ReturnInst::Create(), llvm::InvokeInst::Create(), llvm::dbgs(), E, llvm::Function::end(), llvm::Function::eraseFromParent(), llvm::MipsISD::Ext, F(), llvm::FunctionType::get(), llvm::AttributeSet::get(), llvm::StructType::get(), llvm::AttributeList::get(), llvm::ArrayType::get(), llvm::UndefValue::get(), llvm::GlobalValue::getAddressSpace(), llvm::InsertValueInst::getAggregateOperandIndex(), llvm::GlobalObject::getAllMetadata(), llvm::Function::getAttributes(), llvm::AttributeList::getAttributes(), llvm::Function::getBasicBlockList(), llvm::GlobalObject::getComdat(), llvm::Function::getContext(), llvm::BasicBlock::getFirstInsertionPt(), llvm::AttributeList::getFnAttributes(), llvm::Module::getFunctionList(), llvm::Function::getFunctionType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::FunctionType::getNumParams(), llvm::AttributeList::getParamAttributes(), llvm::Instruction::getParent(), llvm::GlobalValue::getParent(), llvm::AttributeList::getRetAttributes(), llvm::FunctionType::getReturnType(), llvm::Function::getReturnType(), llvm::Value::getType(), llvm::Use::getUser(), llvm::Type::getVoidTy(), llvm::AttributeSet::hasAttribute(), llvm::AttributeList::hasAttrSomewhere(), llvm::Function::hasFnAttribute(), llvm::GlobalValue::hasLocalLinkage(), llvm::AttributeList::hasParamAttribute(), I, llvm::Attribute::InAlloca, llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), llvm::Function::isIntrinsic(), llvm::FunctionType::isVarArg(), llvm::Type::isVoidTy(), LLVM_DEBUG, llvm::Attribute::Naked, NumRetVals(), llvm::SmallVectorTemplateBase< T >::push_back(), RA, llvm::AttrBuilder::remove(), llvm::AttributeSet::removeAttribute(), llvm::AttrBuilder::removeAttribute(), llvm::Value::replaceAllUsesWith(), llvm::MipsISD::Ret, llvm::Attribute::Returned, llvm::Function::setAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setCallingConv(), llvm::GlobalObject::setComdat(), llvm::SmallVectorBase::size(), llvm::iplist_impl< IntrusiveListT, TraitsT >::splice(), llvm::SplitEdge(), llvm::Value::takeName(), llvm::AttributeFuncs::typeIncompatible(), llvm::Value::use_empty(), llvm::Value::user_back(), llvm::Value::uses(), and llvm::RISCVFenceField::W.
INITIALIZE_PASS | ( | DAH | , |
"deadarghaX0r" | , | ||
"Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)" | , | ||
false | , | ||
false | |||
) |
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the body of the function.
Definition at line 111 of file DeadArgumentElimination.cpp.
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 328 of file DeadArgumentElimination.cpp.
References llvm::Function::getReturnType(), and llvm::Type::isVoidTy().
Referenced by getRetComponentType().
STATISTIC | ( | NumArgumentsEliminated | , |
"Number of unread args removed" | |||
) |
STATISTIC | ( | NumRetValsEliminated | , |
"Number of unused return values removed" | |||
) |
STATISTIC | ( | NumArgumentsReplacedWithUndef | , |
"Number of unread args replaced with undef" | |||
) |