LLVM
8.0.1
|
#include "llvm/Transforms/IPO/LowerTypeTests.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/TypeMetadataUtils.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/ModuleSummaryIndexYAML.h"
#include "llvm/IR/Operator.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/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TrailingObjects.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <memory>
#include <set>
#include <string>
#include <system_error>
#include <utility>
#include <vector>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "lowertypetests" |
Functions | |
STATISTIC (ByteArraySizeBits, "Byte array size in bits") | |
STATISTIC (ByteArraySizeBytes, "Byte array size in bytes") | |
STATISTIC (NumByteArraysCreated, "Number of byte arrays created") | |
STATISTIC (NumTypeTestCallsLowered, "Number of type test calls lowered") | |
STATISTIC (NumTypeIdDisjointSets, "Number of disjoint sets of type identifiers") | |
INITIALIZE_PASS (LowerTypeTests, "lowertypetests", "Lower type metadata", false, false) ModulePass *llvm | |
static Value * | createMaskedBitTest (IRBuilder<> &B, Value *Bits, Value *BitOffset) |
Build a test that bit BitOffset mod sizeof(Bits)*8 is set in Bits. More... | |
static bool | isKnownTypeIdMember (Metadata *TypeId, const DataLayout &DL, Value *V, uint64_t COffset) |
static bool | isThumbFunction (Function *F, Triple::ArchType ModuleArch) |
static Triple::ArchType | selectJumpTableArmEncoding (ArrayRef< GlobalTypeMember *> Functions, Triple::ArchType ModuleArch) |
static bool | isDirectCall (Use &U) |
Variables | |
static cl::opt< bool > | AvoidReuse ("lowertypetests-avoid-reuse", cl::desc("Try to avoid reuse of byte array addresses using aliases"), cl::Hidden, cl::init(true)) |
static cl::opt< PassSummaryAction > | ClSummaryAction ("lowertypetests-summary-action", cl::desc("What to do with the summary when running this pass"), cl::values(clEnumValN(PassSummaryAction::None, "none", "Do nothing"), clEnumValN(PassSummaryAction::Import, "import", "Import typeid resolutions from summary and globals"), clEnumValN(PassSummaryAction::Export, "export", "Export typeid resolutions to summary and globals")), cl::Hidden) |
static cl::opt< std::string > | ClReadSummary ("lowertypetests-read-summary", cl::desc("Read summary from given YAML file before running pass"), cl::Hidden) |
static cl::opt< std::string > | ClWriteSummary ("lowertypetests-write-summary", cl::desc("Write summary to given YAML file after running pass"), cl::Hidden) |
static const unsigned | kX86JumpTableEntrySize = 8 |
static const unsigned | kARMJumpTableEntrySize = 4 |
#define DEBUG_TYPE "lowertypetests" |
Definition at line 87 of file LowerTypeTests.cpp.
Build a test that bit BitOffset mod sizeof(Bits)*8 is set in Bits.
This pattern matches to the bt instruction on x86.
Definition at line 519 of file LowerTypeTests.cpp.
References AvoidReuse, B, llvm::lowertypetests::BitSetInfo::Bits, llvm::lowertypetests::BitSetInfo::BitSize, llvm::GlobalAlias::create(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::IRBuilder< T, Inserter >::CreateGEP(), llvm::IRBuilder< T, Inserter >::CreateICmpNE(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::IRBuilder< T, Inserter >::CreateZExtOrTrunc(), GEP, llvm::ConstantInt::get(), llvm::ConstantDataArray::get(), llvm::ConstantExpr::getInBoundsGetElementPtr(), llvm::ConstantExpr::getIntToPtr(), llvm::ConstantExpr::getPtrToInt(), llvm::Value::getType(), I, llvm::TypeTestResolution::Inline, llvm::BitmaskEnumDetail::Mask(), and llvm::GlobalValue::PrivateLinkage.
Definition at line 484 of file LowerTypeTests.cpp.
References llvm::lowertypetests::BitSetBuilder::addOffset(), and llvm::lowertypetests::BitSetBuilder::build().
Definition at line 1638 of file LowerTypeTests.cpp.
References llvm::ModuleSummaryIndex::cfiFunctionDecls(), llvm::ModuleSummaryIndex::cfiFunctionDefs(), llvm::dyn_cast(), E, llvm::Module::getFunction(), llvm::Intrinsic::getName(), llvm::Value::getName(), llvm::Use::getUser(), llvm::Constant::handleOperandChange(), llvm::GlobalValue::hasLocalLinkage(), llvm::Intrinsic::icall_branch_funnel, llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::insert(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isCallee(), llvm::GlobalValue::isDSOLocal(), llvm::ModuleSummaryIndex::partiallySplitLTOUnits(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::report_fatal_error(), llvm::Use::set(), llvm::Intrinsic::type_test, llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().
|
static |
Definition at line 630 of file LowerTypeTests.cpp.
References llvm::PHINode::addIncoming(), llvm::lowertypetests::BitSetInfo::AlignLog2, llvm::TypeTestResolution::AlignLog2, llvm::alignTo(), llvm::TypeTestResolution::AllOnes, assert(), B, llvm::tgtok::Bit, llvm::TypeTestResolution::BitMask, llvm::lowertypetests::BitSetInfo::Bits, llvm::lowertypetests::BitSetInfo::BitSize, llvm::TypeTestResolution::ByteArray, llvm::lowertypetests::BitSetInfo::ByteOffset, C, llvm::GlobalAlias::create(), llvm::Function::Create(), llvm::BranchInst::Create(), llvm::IRBuilder< T, Inserter >::CreateICmpEQ(), llvm::IRBuilder< T, Inserter >::CreateICmpULE(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateOr(), llvm::IRBuilder< T, Inserter >::CreatePHI(), llvm::IRBuilder< T, Inserter >::CreatePtrToInt(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::IRBuilder< T, Inserter >::CreateSub(), llvm::dbgs(), llvm::dyn_cast(), llvm::Triple::ELF, llvm::tgtok::Else, llvm::Instruction::eraseFromParent(), llvm::GlobalVariable::eraseFromParent(), llvm::GlobalValue::ExternalLinkage, F(), G, GEP, llvm::ConstantInt::get(), llvm::ConstantAggregateZero::get(), llvm::ArrayType::get(), llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::GlobalValue::getAddressSpace(), llvm::PointerType::getAddressSpace(), llvm::ConstantStruct::getAnon(), llvm::CallBase::getArgOperand(), llvm::ConstantExpr::getBitCast(), llvm::ConstantInt::getFalse(), llvm::Function::getFunctionType(), llvm::ConstantExpr::getGetElementPtr(), llvm::GlobalVariable::getInitializer(), llvm::IRBuilderBase::GetInsertBlock(), llvm::ConstantExpr::getIntToPtr(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::Instruction::getParent(), llvm::DataLayout::getPointerSizeInBits(), llvm::ConstantExpr::getPtrToInt(), llvm::DataLayout::getStructLayout(), llvm::ConstantExpr::getSub(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::GlobalValue::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::GlobalValue::getValueType(), llvm::GlobalValue::getVisibility(), llvm::ConstantExpr::getZExt(), llvm::Value::hasOneUse(), llvm::GlobalObject::hasSection(), llvm::GlobalValue::HiddenVisibility, I, llvm::TypeTestResolution::Inline, llvm::TypeTestResolution::InlineBits, Int32Ty, llvm::lowertypetests::BitSetInfo::isAllOnes(), llvm::GlobalValue::isDeclarationForLinker(), llvm::GlobalValue::isDSOLocal(), llvm::GlobalValue::isThreadLocal(), llvm::GlobalValue::isWeakForLinker(), LLVM_DEBUG, llvm::LLVMContext::MD_absolute_symbol, llvm::LLVMContext::MD_prof, llvm::LLVMContext::MD_type, Name, llvm::NextPowerOf2(), P, llvm::BasicBlock::phis(), llvm::lowertypetests::BitSetInfo::print(), llvm::GlobalValue::PrivateLinkage, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::ReplaceInstWithInst(), llvm::report_fatal_error(), llvm::MCID::Select, llvm::IRBuilderBase::SetInsertPoint(), llvm::GlobalValue::setLinkage(), llvm::Instruction::setMetadata(), llvm::Value::setName(), llvm::GlobalValue::setVisibility(), llvm::TypeTestResolution::Single, llvm::TypeTestResolution::SizeM1, llvm::TypeTestResolution::SizeM1BitWidth, llvm::BasicBlock::splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::Constant::stripPointerCasts(), llvm::Value::takeName(), llvm::TypeTestResolution::TheKind, llvm::TypeIdSummary::TTRes, llvm::TypeTestResolution::Unsat, llvm::Value::user_begin(), llvm::Value::uses(), Visibility, llvm::Triple::x86, and llvm::Triple::x86_64.
|
static |
Definition at line 1253 of file LowerTypeTests.cpp.
References Features, llvm::Function::getFnAttribute(), llvm::Attribute::getValueAsString(), llvm::Attribute::hasAttribute(), llvm::Attribute::None, llvm::StringRef::split(), and llvm::Triple::thumb.
Referenced by llvm::computeBlockSize(), llvm::LowerARMMachineInstrToMCInst(), and selectJumpTableArmEncoding().
|
static |
Definition at line 1273 of file LowerTypeTests.cpp.
References llvm::Function::addFnAttr(), llvm::lowertypetests::GlobalLayoutBuilder::addFragment(), Arg, llvm::Triple::arm, assert(), ClReadSummary, ClSummaryAction, ClWriteSummary, llvm::GlobalAlias::create(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::ArrayRef< T >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::errorCodeToError(), llvm::errorOrToExpected(), llvm::Export, llvm::GlobalValue::ExternalLinkage, F(), llvm::sys::fs::F_Text, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::InlineAsm::get(), llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::ArrayType::get(), llvm::ConstantAsMetadata::get(), llvm::ConstantPointerNull::get(), llvm::MDNode::get(), llvm::PointerType::getAddressSpace(), llvm::Triple::getArch(), llvm::ConstantExpr::getBitCast(), llvm::Function::getContext(), llvm::MemoryBuffer::getFile(), llvm::ConstantExpr::getInBoundsGetElementPtr(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::MDNode::getOperand(), llvm::ConstantExpr::getPointerCast(), llvm::Module::getTargetTriple(), llvm::Value::getType(), llvm::GlobalValue::getType(), llvm::GlobalValue::getValueType(), llvm::GlobalValue::getVisibility(), llvm::Type::getVoidTy(), llvm::Function::hasAddressTaken(), llvm::GlobalValue::hasLocalLinkage(), llvm::GlobalValue::HiddenVisibility, I, llvm::Import, llvm::tgtok::In, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert(), isThumbFunction(), llvm::GlobalValue::isWeakForLinker(), llvm::ISD::JumpTable, llvm::Attribute::Naked, llvm::Attribute::NoUnwind, llvm::GlobalValue::PrivateLinkage, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::report_fatal_error(), llvm::SmallVectorImpl< T >::reserve(), llvm::GlobalObject::setAlignment(), llvm::GlobalObject::setMetadata(), llvm::Value::setName(), llvm::GlobalValue::setVisibility(), llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::raw_string_ostream::str(), llvm::Triple::thumb, and llvm::Triple::Win32.
STATISTIC | ( | ByteArraySizeBits | , |
"Byte array size in bits" | |||
) |
STATISTIC | ( | ByteArraySizeBytes | , |
"Byte array size in bytes" | |||
) |
STATISTIC | ( | NumByteArraysCreated | , |
"Number of byte arrays created" | |||
) |
|
static |
Referenced by createMaskedBitTest().
|
static |
Referenced by selectJumpTableArmEncoding().
|
static |
Referenced by selectJumpTableArmEncoding().
|
static |
Referenced by selectJumpTableArmEncoding().
Definition at line 1133 of file LowerTypeTests.cpp.
Definition at line 1132 of file LowerTypeTests.cpp.