LLVM
8.0.1
|
#include "AArch64.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <utility>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "aarch64-promote-const" |
Functions | |
STATISTIC (NumPromoted, "Number of promoted constants") | |
STATISTIC (NumPromotedUses, "Number of promoted constants uses") | |
INITIALIZE_PASS_BEGIN (AArch64PromoteConstant, "aarch64-promote-const", "AArch64 Promote Constant Pass", false, false) INITIALIZE_PASS_END(AArch64PromoteConstant | |
static bool | isConstantUsingVectorTy (const Type *CstTy) |
Check if the given type uses a vector type. More... | |
static bool | shouldConvertUse (const Constant *Cst, const Instruction *Instr, unsigned OpIdx) |
Check if the given use (Instruction + OpIdx) of Cst should be converted into a load of a global variable initialized with Cst. More... | |
static bool | shouldConvertImpl (const Constant *Cst) |
Check if the given Cst should be converted into a load of a global variable initialized with Cst. More... | |
static bool | shouldConvert (Constant &C, AArch64PromoteConstant::PromotionCacheTy &PromotionCache) |
static void | ensurePromotedGV (Function &F, Constant &C, AArch64PromoteConstant::PromotedConstant &PC) |
Variables | |
static cl::opt< bool > | Stress ("aarch64-stress-promote-const", cl::Hidden, cl::desc("Promote all vector constants")) |
aarch64 promote | const |
aarch64 promote AArch64 Promote Constant | Pass |
aarch64 promote AArch64 Promote Constant | false |
#define DEBUG_TYPE "aarch64-promote-const" |
Definition at line 53 of file AArch64PromoteConstant.cpp.
|
static |
Definition at line 469 of file AArch64PromoteConstant.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T >::begin(), C, llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::dbgs(), llvm::DominatorTree::dominates(), llvm::dyn_cast(), E, llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), F(), llvm::GlobalValue::getParent(), llvm::Value::getType(), I, llvm::instructions(), llvm::GlobalValue::InternalLinkage, LLVM_DEBUG, llvm::GlobalValue::NotThreadLocal, llvm::Value::print(), runOnFunction(), llvm::GlobalVariable::setInitializer(), shouldConvert(), and shouldConvertUse().
INITIALIZE_PASS_BEGIN | ( | AArch64PromoteConstant | , |
"aarch64-promote-const" | , | ||
"AArch64 Promote Constant Pass" | , | ||
false | , | ||
false | |||
) |
Check if the given type uses a vector type.
Definition at line 240 of file AArch64PromoteConstant.cpp.
References llvm::Type::getArrayElementType(), llvm::Type::getStructElementType(), llvm::Type::getStructNumElements(), llvm::Type::isArrayTy(), llvm::Type::isStructTy(), and llvm::Type::isVectorTy().
Referenced by shouldConvertImpl().
|
static |
Definition at line 348 of file AArch64PromoteConstant.cpp.
References assert(), llvm::dbgs(), llvm::DominatorTree::dominates(), llvm::DominatorTreeBase< NodeT, IsPostDom >::findNearestCommonDominator(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getTerminator(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), LLVM_DEBUG, llvm::Value::print(), and shouldConvertImpl().
Referenced by ensurePromotedGV(), and parseCond().
Check if the given Cst should be converted into a load of a global variable initialized with Cst.
A constant should be converted if it is likely that the materialization of the constant will be tricky. Thus, we give up on zero or undef values.
Definition at line 324 of file AArch64PromoteConstant.cpp.
References llvm::Value::getType(), isConstantUsingVectorTy(), llvm::Type::isVectorTy(), llvm::Constant::isZeroValue(), and Stress.
Referenced by shouldConvert().
|
static |
Check if the given use (Instruction + OpIdx) of Cst should be converted into a load of a global variable initialized with Cst.
A use should be converted if it is legal to do so. For instance, it is not legal to turn the mask operand of a shuffle vector into a load of a global variable.
Definition at line 258 of file AArch64PromoteConstant.cpp.
References llvm::dyn_cast(), and llvm::CallBase::getCalledValue().
Referenced by ensurePromotedGV().
STATISTIC | ( | NumPromoted | , |
"Number of promoted constants" | |||
) |
STATISTIC | ( | NumPromotedUses | , |
"Number of promoted constants uses" | |||
) |
aarch64 promote const |
Definition at line 232 of file AArch64PromoteConstant.cpp.
aarch64 promote AArch64 Promote Constant false |
Definition at line 232 of file AArch64PromoteConstant.cpp.
Definition at line 232 of file AArch64PromoteConstant.cpp.
|
static |
Referenced by shouldConvertImpl().