mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[IR] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
llvm-svn: 328850
This commit is contained in:
parent
1fe0ee8df0
commit
6d05e6705c
@ -6,11 +6,11 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
//
|
||||
/// \file
|
||||
/// \brief This file contains the simple types necessary to represent the
|
||||
/// attributes associated with functions and their calls.
|
||||
///
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_IR_ATTRIBUTES_H
|
||||
@ -35,7 +35,6 @@ namespace llvm {
|
||||
class AttrBuilder;
|
||||
class AttributeImpl;
|
||||
class AttributeListImpl;
|
||||
class AttributeList;
|
||||
class AttributeSetNode;
|
||||
template<typename T> struct DenseMapInfo;
|
||||
class Function;
|
||||
@ -203,6 +202,9 @@ inline Attribute unwrap(LLVMAttributeRef Attr) {
|
||||
/// copy. Adding and removing enum attributes is intended to be fast, but adding
|
||||
/// and removing string or integer attributes involves a FoldingSet lookup.
|
||||
class AttributeSet {
|
||||
friend AttributeListImpl;
|
||||
template <typename Ty> friend struct DenseMapInfo;
|
||||
|
||||
// TODO: Extract AvailableAttrs from AttributeSetNode and store them here.
|
||||
// This will allow an efficient implementation of addAttribute and
|
||||
// removeAttribute for enum attrs.
|
||||
@ -210,9 +212,6 @@ class AttributeSet {
|
||||
/// Private implementation pointer.
|
||||
AttributeSetNode *SetNode = nullptr;
|
||||
|
||||
friend AttributeListImpl;
|
||||
template <typename Ty> friend struct DenseMapInfo;
|
||||
|
||||
private:
|
||||
explicit AttributeSet(AttributeSetNode *ASN) : SetNode(ASN) {}
|
||||
|
||||
@ -292,14 +291,14 @@ public:
|
||||
/// \class
|
||||
/// \brief Provide DenseMapInfo for AttributeSet.
|
||||
template <> struct DenseMapInfo<AttributeSet> {
|
||||
static inline AttributeSet getEmptyKey() {
|
||||
uintptr_t Val = static_cast<uintptr_t>(-1);
|
||||
static AttributeSet getEmptyKey() {
|
||||
auto Val = static_cast<uintptr_t>(-1);
|
||||
Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
|
||||
return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
|
||||
}
|
||||
|
||||
static inline AttributeSet getTombstoneKey() {
|
||||
uintptr_t Val = static_cast<uintptr_t>(-2);
|
||||
static AttributeSet getTombstoneKey() {
|
||||
auto Val = static_cast<uintptr_t>(-2);
|
||||
Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
|
||||
return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
|
||||
}
|
||||
@ -333,7 +332,6 @@ private:
|
||||
friend class AttributeListImpl;
|
||||
friend class AttributeSet;
|
||||
friend class AttributeSetNode;
|
||||
|
||||
template <typename Ty> friend struct DenseMapInfo;
|
||||
|
||||
/// \brief The attributes that we are managing. This can be null to represent
|
||||
@ -652,14 +650,14 @@ public:
|
||||
/// \class
|
||||
/// \brief Provide DenseMapInfo for AttributeList.
|
||||
template <> struct DenseMapInfo<AttributeList> {
|
||||
static inline AttributeList getEmptyKey() {
|
||||
uintptr_t Val = static_cast<uintptr_t>(-1);
|
||||
static AttributeList getEmptyKey() {
|
||||
auto Val = static_cast<uintptr_t>(-1);
|
||||
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
|
||||
return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
|
||||
}
|
||||
|
||||
static inline AttributeList getTombstoneKey() {
|
||||
uintptr_t Val = static_cast<uintptr_t>(-2);
|
||||
static AttributeList getTombstoneKey() {
|
||||
auto Val = static_cast<uintptr_t>(-2);
|
||||
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
|
||||
return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
|
||||
}
|
||||
@ -691,9 +689,11 @@ class AttrBuilder {
|
||||
|
||||
public:
|
||||
AttrBuilder() = default;
|
||||
|
||||
AttrBuilder(const Attribute &A) {
|
||||
addAttribute(A);
|
||||
}
|
||||
|
||||
AttrBuilder(AttributeList AS, unsigned Idx);
|
||||
AttrBuilder(AttributeSet AS);
|
||||
|
||||
@ -800,18 +800,19 @@ public:
|
||||
using td_range = iterator_range<td_iterator>;
|
||||
using td_const_range = iterator_range<td_const_iterator>;
|
||||
|
||||
td_iterator td_begin() { return TargetDepAttrs.begin(); }
|
||||
td_iterator td_end() { return TargetDepAttrs.end(); }
|
||||
td_iterator td_begin() { return TargetDepAttrs.begin(); }
|
||||
td_iterator td_end() { return TargetDepAttrs.end(); }
|
||||
|
||||
td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
|
||||
td_const_iterator td_end() const { return TargetDepAttrs.end(); }
|
||||
td_const_iterator td_end() const { return TargetDepAttrs.end(); }
|
||||
|
||||
td_range td_attrs() { return td_range(td_begin(), td_end()); }
|
||||
|
||||
td_const_range td_attrs() const {
|
||||
return td_const_range(td_begin(), td_end());
|
||||
}
|
||||
|
||||
bool td_empty() const { return TargetDepAttrs.empty(); }
|
||||
bool td_empty() const { return TargetDepAttrs.empty(); }
|
||||
|
||||
bool operator==(const AttrBuilder &B);
|
||||
bool operator!=(const AttrBuilder &B) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
@ -186,14 +185,14 @@ uint64_t Attribute::getValueAsInt() const {
|
||||
}
|
||||
|
||||
StringRef Attribute::getKindAsString() const {
|
||||
if (!pImpl) return StringRef();
|
||||
if (!pImpl) return {};
|
||||
assert(isStringAttribute() &&
|
||||
"Invalid attribute type to get the kind as a string!");
|
||||
return pImpl->getKindAsString();
|
||||
}
|
||||
|
||||
StringRef Attribute::getValueAsString() const {
|
||||
if (!pImpl) return StringRef();
|
||||
if (!pImpl) return {};
|
||||
assert(isStringAttribute() &&
|
||||
"Invalid attribute type to get the value as a string!");
|
||||
return pImpl->getValueAsString();
|
||||
@ -241,7 +240,7 @@ std::pair<unsigned, Optional<unsigned>> Attribute::getAllocSizeArgs() const {
|
||||
}
|
||||
|
||||
std::string Attribute::getAsString(bool InAttrGrp) const {
|
||||
if (!pImpl) return "";
|
||||
if (!pImpl) return {};
|
||||
|
||||
if (hasAttribute(Attribute::SanitizeAddress))
|
||||
return "sanitize_address";
|
||||
@ -538,7 +537,7 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C,
|
||||
return *this;
|
||||
|
||||
AttrBuilder B(AS);
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
B.addAttribute(I);
|
||||
|
||||
return get(C, B);
|
||||
@ -637,7 +636,7 @@ AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
|
||||
// There's memory after the node where we can store the entries in.
|
||||
std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects<Attribute>());
|
||||
|
||||
for (Attribute I : *this) {
|
||||
for (const auto I : *this) {
|
||||
if (!I.isStringAttribute()) {
|
||||
AvailableAttrs |= ((uint64_t)1) << I.getKindAsEnum();
|
||||
}
|
||||
@ -656,7 +655,7 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
|
||||
SmallVector<Attribute, 8> SortedAttrs(Attrs.begin(), Attrs.end());
|
||||
std::sort(SortedAttrs.begin(), SortedAttrs.end());
|
||||
|
||||
for (Attribute Attr : SortedAttrs)
|
||||
for (const auto Attr : SortedAttrs)
|
||||
Attr.Profile(ID);
|
||||
|
||||
void *InsertPoint;
|
||||
@ -719,7 +718,7 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C, const AttrBuilder &B) {
|
||||
}
|
||||
|
||||
bool AttributeSetNode::hasAttribute(StringRef Kind) const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Kind))
|
||||
return true;
|
||||
return false;
|
||||
@ -727,43 +726,43 @@ bool AttributeSetNode::hasAttribute(StringRef Kind) const {
|
||||
|
||||
Attribute AttributeSetNode::getAttribute(Attribute::AttrKind Kind) const {
|
||||
if (hasAttribute(Kind)) {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Kind))
|
||||
return I;
|
||||
}
|
||||
return Attribute();
|
||||
return {};
|
||||
}
|
||||
|
||||
Attribute AttributeSetNode::getAttribute(StringRef Kind) const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Kind))
|
||||
return I;
|
||||
return Attribute();
|
||||
return {};
|
||||
}
|
||||
|
||||
unsigned AttributeSetNode::getAlignment() const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Attribute::Alignment))
|
||||
return I.getAlignment();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned AttributeSetNode::getStackAlignment() const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Attribute::StackAlignment))
|
||||
return I.getStackAlignment();
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t AttributeSetNode::getDereferenceableBytes() const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Attribute::Dereferenceable))
|
||||
return I.getDereferenceableBytes();
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t AttributeSetNode::getDereferenceableOrNullBytes() const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Attribute::DereferenceableOrNull))
|
||||
return I.getDereferenceableOrNullBytes();
|
||||
return 0;
|
||||
@ -771,7 +770,7 @@ uint64_t AttributeSetNode::getDereferenceableOrNullBytes() const {
|
||||
|
||||
std::pair<unsigned, Optional<unsigned>>
|
||||
AttributeSetNode::getAllocSizeArgs() const {
|
||||
for (Attribute I : *this)
|
||||
for (const auto I : *this)
|
||||
if (I.hasAttribute(Attribute::AllocSize))
|
||||
return I.getAllocSizeArgs();
|
||||
return std::make_pair(0, 0);
|
||||
@ -813,7 +812,7 @@ AttributeListImpl::AttributeListImpl(LLVMContext &C,
|
||||
"Too many attributes");
|
||||
static_assert(attrIdxToArrayIdx(AttributeList::FunctionIndex) == 0U,
|
||||
"function should be stored in slot 0");
|
||||
for (Attribute I : Sets[0]) {
|
||||
for (const auto I : Sets[0]) {
|
||||
if (!I.isStringAttribute())
|
||||
AvailableFunctionAttrs |= 1ULL << I.getKindAsEnum();
|
||||
}
|
||||
@ -870,17 +869,17 @@ AttributeList::get(LLVMContext &C,
|
||||
ArrayRef<std::pair<unsigned, Attribute>> Attrs) {
|
||||
// If there are no attributes then return a null AttributesList pointer.
|
||||
if (Attrs.empty())
|
||||
return AttributeList();
|
||||
return {};
|
||||
|
||||
assert(std::is_sorted(Attrs.begin(), Attrs.end(),
|
||||
[](const std::pair<unsigned, Attribute> &LHS,
|
||||
const std::pair<unsigned, Attribute> &RHS) {
|
||||
return LHS.first < RHS.first;
|
||||
}) && "Misordered Attributes list!");
|
||||
assert(none_of(Attrs,
|
||||
[](const std::pair<unsigned, Attribute> &Pair) {
|
||||
return Pair.second.hasAttribute(Attribute::None);
|
||||
}) &&
|
||||
assert(llvm::none_of(Attrs,
|
||||
[](const std::pair<unsigned, Attribute> &Pair) {
|
||||
return Pair.second.hasAttribute(Attribute::None);
|
||||
}) &&
|
||||
"Pointless attribute!");
|
||||
|
||||
// Create a vector if (unsigned, AttributeSetNode*) pairs from the attributes
|
||||
@ -906,7 +905,7 @@ AttributeList::get(LLVMContext &C,
|
||||
ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {
|
||||
// If there are no attributes then return a null AttributesList pointer.
|
||||
if (Attrs.empty())
|
||||
return AttributeList();
|
||||
return {};
|
||||
|
||||
assert(std::is_sorted(Attrs.begin(), Attrs.end(),
|
||||
[](const std::pair<unsigned, AttributeSet> &LHS,
|
||||
@ -914,16 +913,16 @@ AttributeList::get(LLVMContext &C,
|
||||
return LHS.first < RHS.first;
|
||||
}) &&
|
||||
"Misordered Attributes list!");
|
||||
assert(none_of(Attrs,
|
||||
[](const std::pair<unsigned, AttributeSet> &Pair) {
|
||||
return !Pair.second.hasAttributes();
|
||||
}) &&
|
||||
assert(llvm::none_of(Attrs,
|
||||
[](const std::pair<unsigned, AttributeSet> &Pair) {
|
||||
return !Pair.second.hasAttributes();
|
||||
}) &&
|
||||
"Pointless attribute!");
|
||||
|
||||
unsigned MaxIndex = Attrs.back().first;
|
||||
|
||||
SmallVector<AttributeSet, 4> AttrVec(attrIdxToArrayIdx(MaxIndex) + 1);
|
||||
for (auto Pair : Attrs)
|
||||
for (const auto Pair : Attrs)
|
||||
AttrVec[attrIdxToArrayIdx(Pair.first)] = Pair.second;
|
||||
|
||||
return getImpl(C, AttrVec);
|
||||
@ -953,7 +952,7 @@ AttributeList AttributeList::get(LLVMContext &C, AttributeSet FnAttrs,
|
||||
|
||||
// If all attribute sets were empty, we can use the empty attribute list.
|
||||
if (NumSets == 0)
|
||||
return AttributeList();
|
||||
return {};
|
||||
|
||||
SmallVector<AttributeSet, 8> AttrSets;
|
||||
AttrSets.reserve(NumSets);
|
||||
@ -973,7 +972,7 @@ AttributeList AttributeList::get(LLVMContext &C, AttributeSet FnAttrs,
|
||||
AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
const AttrBuilder &B) {
|
||||
if (!B.hasAttributes())
|
||||
return AttributeList();
|
||||
return {};
|
||||
Index = attrIdxToArrayIdx(Index);
|
||||
SmallVector<AttributeSet, 8> AttrSets(Index + 1);
|
||||
AttrSets[Index] = AttributeSet::get(C, B);
|
||||
@ -983,7 +982,7 @@ AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
ArrayRef<Attribute::AttrKind> Kinds) {
|
||||
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
|
||||
for (Attribute::AttrKind K : Kinds)
|
||||
for (const auto K : Kinds)
|
||||
Attrs.emplace_back(Index, Attribute::get(C, K));
|
||||
return get(C, Attrs);
|
||||
}
|
||||
@ -991,7 +990,7 @@ AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
ArrayRef<StringRef> Kinds) {
|
||||
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
|
||||
for (StringRef K : Kinds)
|
||||
for (const auto K : Kinds)
|
||||
Attrs.emplace_back(Index, Attribute::get(C, K));
|
||||
return get(C, Attrs);
|
||||
}
|
||||
@ -999,22 +998,22 @@ AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
|
||||
AttributeList AttributeList::get(LLVMContext &C,
|
||||
ArrayRef<AttributeList> Attrs) {
|
||||
if (Attrs.empty())
|
||||
return AttributeList();
|
||||
return {};
|
||||
if (Attrs.size() == 1)
|
||||
return Attrs[0];
|
||||
|
||||
unsigned MaxSize = 0;
|
||||
for (AttributeList List : Attrs)
|
||||
for (const auto List : Attrs)
|
||||
MaxSize = std::max(MaxSize, List.getNumAttrSets());
|
||||
|
||||
// If every list was empty, there is no point in merging the lists.
|
||||
if (MaxSize == 0)
|
||||
return AttributeList();
|
||||
return {};
|
||||
|
||||
SmallVector<AttributeSet, 8> NewAttrSets(MaxSize);
|
||||
for (unsigned I = 0; I < MaxSize; ++I) {
|
||||
AttrBuilder CurBuilder;
|
||||
for (AttributeList List : Attrs)
|
||||
for (const auto List : Attrs)
|
||||
CurBuilder.merge(List.getAttributes(I - 1));
|
||||
NewAttrSets[I] = AttributeSet::get(C, CurBuilder);
|
||||
}
|
||||
@ -1124,7 +1123,7 @@ AttributeList
|
||||
AttributeList::removeAttributes(LLVMContext &C, unsigned Index,
|
||||
const AttrBuilder &AttrsToRemove) const {
|
||||
if (!pImpl)
|
||||
return AttributeList();
|
||||
return {};
|
||||
|
||||
Index = attrIdxToArrayIdx(Index);
|
||||
SmallVector<AttributeSet, 4> AttrSets(this->begin(), this->end());
|
||||
@ -1139,7 +1138,7 @@ AttributeList::removeAttributes(LLVMContext &C, unsigned Index,
|
||||
AttributeList AttributeList::removeAttributes(LLVMContext &C,
|
||||
unsigned WithoutIndex) const {
|
||||
if (!pImpl)
|
||||
return AttributeList();
|
||||
return {};
|
||||
WithoutIndex = attrIdxToArrayIdx(WithoutIndex);
|
||||
if (WithoutIndex >= getNumAttrSets())
|
||||
return *this;
|
||||
@ -1273,7 +1272,7 @@ std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const {
|
||||
AttributeSet AttributeList::getAttributes(unsigned Index) const {
|
||||
Index = attrIdxToArrayIdx(Index);
|
||||
if (!pImpl || Index >= getNumAttrSets())
|
||||
return AttributeSet();
|
||||
return {};
|
||||
return pImpl->begin()[Index];
|
||||
}
|
||||
|
||||
@ -1313,12 +1312,12 @@ LLVM_DUMP_METHOD void AttributeList::dump() const {
|
||||
// FIXME: Remove this ctor, use AttributeSet.
|
||||
AttrBuilder::AttrBuilder(AttributeList AL, unsigned Index) {
|
||||
AttributeSet AS = AL.getAttributes(Index);
|
||||
for (const Attribute &A : AS)
|
||||
for (const auto &A : AS)
|
||||
addAttribute(A);
|
||||
}
|
||||
|
||||
AttrBuilder::AttrBuilder(AttributeSet AS) {
|
||||
for (const Attribute &A : AS)
|
||||
for (const auto &A : AS)
|
||||
addAttribute(A);
|
||||
}
|
||||
|
||||
@ -1389,7 +1388,7 @@ AttrBuilder &AttrBuilder::removeAttributes(AttributeList A, uint64_t Index) {
|
||||
}
|
||||
|
||||
AttrBuilder &AttrBuilder::removeAttribute(StringRef A) {
|
||||
std::map<std::string, std::string>::iterator I = TargetDepAttrs.find(A);
|
||||
auto I = TargetDepAttrs.find(A);
|
||||
if (I != TargetDepAttrs.end())
|
||||
TargetDepAttrs.erase(I);
|
||||
return *this;
|
||||
@ -1529,7 +1528,7 @@ bool AttrBuilder::hasAttributes() const {
|
||||
bool AttrBuilder::hasAttributes(AttributeList AL, uint64_t Index) const {
|
||||
AttributeSet AS = AL.getAttributes(Index);
|
||||
|
||||
for (Attribute Attr : AS) {
|
||||
for (const auto Attr : AS) {
|
||||
if (Attr.isEnumAttribute() || Attr.isIntAttribute()) {
|
||||
if (contains(Attr.getKindAsEnum()))
|
||||
return true;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===---- IRBuilder.cpp - Builder for LLVM Instrs -------------------------===//
|
||||
//===- IRBuilder.cpp - Builder for LLVM Instrs ----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -13,12 +13,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/IR/Constant.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Statepoint.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
/// CreateGlobalString - Make a new global variable with an initializer that
|
||||
@ -30,11 +45,10 @@ GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str,
|
||||
unsigned AddressSpace) {
|
||||
Constant *StrConstant = ConstantDataArray::getString(Context, Str);
|
||||
Module &M = *BB->getParent()->getParent();
|
||||
GlobalVariable *GV = new GlobalVariable(M, StrConstant->getType(),
|
||||
true, GlobalValue::PrivateLinkage,
|
||||
StrConstant, Name, nullptr,
|
||||
GlobalVariable::NotThreadLocal,
|
||||
AddressSpace);
|
||||
auto *GV = new GlobalVariable(M, StrConstant->getType(), true,
|
||||
GlobalValue::PrivateLinkage, StrConstant, Name,
|
||||
nullptr, GlobalVariable::NotThreadLocal,
|
||||
AddressSpace);
|
||||
GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
|
||||
return GV;
|
||||
}
|
||||
@ -45,7 +59,7 @@ Type *IRBuilderBase::getCurrentFunctionReturnType() const {
|
||||
}
|
||||
|
||||
Value *IRBuilderBase::getCastedInt8PtrValue(Value *Ptr) {
|
||||
PointerType *PT = cast<PointerType>(Ptr->getType());
|
||||
auto *PT = cast<PointerType>(Ptr->getType());
|
||||
if (PT->getElementType()->isIntegerTy(8))
|
||||
return Ptr;
|
||||
|
||||
@ -386,7 +400,7 @@ CallInst *IRBuilderBase::CreateAssumption(Value *Cond) {
|
||||
CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
|
||||
Value *Mask, Value *PassThru,
|
||||
const Twine &Name) {
|
||||
PointerType *PtrTy = cast<PointerType>(Ptr->getType());
|
||||
auto *PtrTy = cast<PointerType>(Ptr->getType());
|
||||
Type *DataTy = PtrTy->getElementType();
|
||||
assert(DataTy->isVectorTy() && "Ptr should point to a vector");
|
||||
assert(Mask && "Mask should not be all-ones (null)");
|
||||
@ -406,7 +420,7 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
|
||||
/// be accessed in memory
|
||||
CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
|
||||
unsigned Align, Value *Mask) {
|
||||
PointerType *PtrTy = cast<PointerType>(Ptr->getType());
|
||||
auto *PtrTy = cast<PointerType>(Ptr->getType());
|
||||
Type *DataTy = PtrTy->getElementType();
|
||||
assert(DataTy->isVectorTy() && "Ptr should point to a vector");
|
||||
assert(Mask && "Mask should not be all-ones (null)");
|
||||
@ -520,7 +534,7 @@ static CallInst *CreateGCStatepointCallCommon(
|
||||
ArrayRef<T1> TransitionArgs, ArrayRef<T2> DeoptArgs, ArrayRef<T3> GCArgs,
|
||||
const Twine &Name) {
|
||||
// Extract out the type of the callee.
|
||||
PointerType *FuncPtrType = cast<PointerType>(ActualCallee->getType());
|
||||
auto *FuncPtrType = cast<PointerType>(ActualCallee->getType());
|
||||
assert(isa<FunctionType>(FuncPtrType->getElementType()) &&
|
||||
"actual callee must be a callable value");
|
||||
|
||||
@ -531,7 +545,7 @@ static CallInst *CreateGCStatepointCallCommon(
|
||||
Intrinsic::getDeclaration(M, Intrinsic::experimental_gc_statepoint,
|
||||
ArgTypes);
|
||||
|
||||
std::vector<llvm::Value *> Args =
|
||||
std::vector<Value *> Args =
|
||||
getStatepointArgs(*Builder, ID, NumPatchBytes, ActualCallee, Flags,
|
||||
CallArgs, TransitionArgs, DeoptArgs, GCArgs);
|
||||
return createCallHelper(FnStatepoint, Args, Builder, Name);
|
||||
@ -571,7 +585,7 @@ static InvokeInst *CreateGCStatepointInvokeCommon(
|
||||
uint32_t Flags, ArrayRef<T0> InvokeArgs, ArrayRef<T1> TransitionArgs,
|
||||
ArrayRef<T2> DeoptArgs, ArrayRef<T3> GCArgs, const Twine &Name) {
|
||||
// Extract out the type of the callee.
|
||||
PointerType *FuncPtrType = cast<PointerType>(ActualInvokee->getType());
|
||||
auto *FuncPtrType = cast<PointerType>(ActualInvokee->getType());
|
||||
assert(isa<FunctionType>(FuncPtrType->getElementType()) &&
|
||||
"actual callee must be a callable value");
|
||||
|
||||
@ -580,7 +594,7 @@ static InvokeInst *CreateGCStatepointInvokeCommon(
|
||||
Function *FnStatepoint = Intrinsic::getDeclaration(
|
||||
M, Intrinsic::experimental_gc_statepoint, {FuncPtrType});
|
||||
|
||||
std::vector<llvm::Value *> Args =
|
||||
std::vector<Value *> Args =
|
||||
getStatepointArgs(*Builder, ID, NumPatchBytes, ActualInvokee, Flags,
|
||||
InvokeArgs, TransitionArgs, DeoptArgs, GCArgs);
|
||||
return createInvokeHelper(FnStatepoint, NormalDest, UnwindDest, Args, Builder,
|
||||
@ -663,4 +677,3 @@ CallInst *IRBuilderBase::CreateIntrinsic(Intrinsic::ID ID,
|
||||
Function *Fn = Intrinsic::getDeclaration(M, ID, { Args.front()->getType() });
|
||||
return createCallHelper(Fn, Args, this, Name, FMFSource);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user