mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-21 03:05:15 +00:00
Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting. llvm-svn: 135390
This commit is contained in:
parent
9286081ccc
commit
6c24f9c277
@ -234,7 +234,7 @@ public:
|
||||
///
|
||||
virtual
|
||||
ArrayRef<unsigned> getRawAllocationOrder(const MachineFunction &MF) const {
|
||||
return ArrayRef<unsigned>(begin(), getNumRegs());
|
||||
return makeArrayRef(begin(), getNumRegs());
|
||||
}
|
||||
|
||||
/// getSize - Return the size of the register in bytes, which is also the size
|
||||
|
@ -1358,8 +1358,7 @@ static Value *BuildSubAggregate(Value *From, Value* To, Type *IndexedType,
|
||||
return NULL;
|
||||
|
||||
// Insert the value in the new (sub) aggregrate
|
||||
return llvm::InsertValueInst::Create(To, V,
|
||||
ArrayRef<unsigned>(Idxs).slice(IdxSkip),
|
||||
return llvm::InsertValueInst::Create(To, V, makeArrayRef(Idxs).slice(IdxSkip),
|
||||
"tmp", InsertBefore);
|
||||
}
|
||||
|
||||
@ -1435,9 +1434,7 @@ Value *llvm::FindInsertedValue(Value *V, ArrayRef<unsigned> idx_range,
|
||||
// %C = insertvalue {i32, i32 } %A, i32 11, 1
|
||||
// which allows the unused 0,0 element from the nested struct to be
|
||||
// removed.
|
||||
return BuildSubAggregate(V,
|
||||
ArrayRef<unsigned>(idx_range.begin(),
|
||||
req_idx),
|
||||
return BuildSubAggregate(V, makeArrayRef(idx_range.begin(), req_idx),
|
||||
InsertBefore);
|
||||
else
|
||||
// We can't handle this without inserting insertvalues
|
||||
@ -1455,7 +1452,7 @@ Value *llvm::FindInsertedValue(Value *V, ArrayRef<unsigned> idx_range,
|
||||
// requested (though possibly only partially). Now we recursively look at
|
||||
// the inserted value, passing any remaining indices.
|
||||
return FindInsertedValue(I->getInsertedValueOperand(),
|
||||
ArrayRef<unsigned>(req_idx, idx_range.end()),
|
||||
makeArrayRef(req_idx, idx_range.end()),
|
||||
InsertBefore);
|
||||
} else if (ExtractValueInst *I = dyn_cast<ExtractValueInst>(V)) {
|
||||
// If we're extracting a value from an aggregrate that was extracted from
|
||||
|
@ -2519,8 +2519,8 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
|
||||
return Error(ID.Loc, "element " + Twine(i) +
|
||||
" of struct initializer doesn't match struct element type");
|
||||
|
||||
V = ConstantStruct::get(ST, ArrayRef<Constant*>(ID.ConstantStructElts,
|
||||
ID.UIntVal));
|
||||
V = ConstantStruct::get(ST, makeArrayRef(ID.ConstantStructElts,
|
||||
ID.UIntVal));
|
||||
} else
|
||||
return Error(ID.Loc, "constant expression type mismatch");
|
||||
return false;
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; }
|
||||
|
||||
ArrayRef<LiveInterval*> regs() const {
|
||||
return ArrayRef<LiveInterval*>(newRegs_).slice(firstNew_);
|
||||
return makeArrayRef(newRegs_).slice(firstNew_);
|
||||
}
|
||||
|
||||
/// FIXME: Temporary accessors until we can get rid of
|
||||
|
@ -684,7 +684,7 @@ void RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
|
||||
assert(T < GroupSize && "Array overflow");
|
||||
TBS[T] = Number;
|
||||
if (++T == GroupSize) {
|
||||
SpillPlacer->addLinks(ArrayRef<unsigned>(TBS, T));
|
||||
SpillPlacer->addLinks(makeArrayRef(TBS, T));
|
||||
T = 0;
|
||||
}
|
||||
continue;
|
||||
@ -714,7 +714,7 @@ void RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
|
||||
|
||||
ArrayRef<SpillPlacement::BlockConstraint> Array(BCS, B);
|
||||
SpillPlacer->addConstraints(Array);
|
||||
SpillPlacer->addLinks(ArrayRef<unsigned>(TBS, T));
|
||||
SpillPlacer->addLinks(makeArrayRef(TBS, T));
|
||||
}
|
||||
|
||||
void RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
|
||||
@ -749,8 +749,7 @@ void RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
|
||||
// Any new blocks to add?
|
||||
if (ActiveBlocks.size() == AddedTo)
|
||||
break;
|
||||
addThroughConstraints(Cand.Intf,
|
||||
ArrayRef<unsigned>(ActiveBlocks).slice(AddedTo));
|
||||
addThroughConstraints(Cand.Intf, makeArrayRef(ActiveBlocks).slice(AddedTo));
|
||||
AddedTo = ActiveBlocks.size();
|
||||
|
||||
// Perhaps iterating can enable more bundles?
|
||||
|
@ -32,7 +32,7 @@ class RegisterClassInfo {
|
||||
|
||||
RCInfo() : Tag(0), NumRegs(0) {}
|
||||
operator ArrayRef<unsigned>() const {
|
||||
return ArrayRef<unsigned>(Order.get(), NumRegs);
|
||||
return makeArrayRef(Order.get(), NumRegs);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -261,7 +261,7 @@ Type *TypeMapTy::getImpl(Type *Ty) {
|
||||
cast<PointerType>(Ty)->getAddressSpace());
|
||||
case Type::FunctionTyID:
|
||||
return *Entry = FunctionType::get(ElementTypes[0],
|
||||
ArrayRef<Type*>(ElementTypes).slice(1),
|
||||
makeArrayRef(ElementTypes).slice(1),
|
||||
cast<FunctionType>(Ty)->isVarArg());
|
||||
case Type::StructTyID:
|
||||
// Note that this is only reached for anonymous structs.
|
||||
|
@ -487,19 +487,19 @@ ARMBaseRegisterInfo::getRawAllocationOrder(const TargetRegisterClass *RC,
|
||||
|
||||
if (!TFI->hasFP(MF)) {
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPREven1);
|
||||
return makeArrayRef(GPREven1);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPREven4);
|
||||
return makeArrayRef(GPREven4);
|
||||
} else if (FramePtr == ARM::R7) {
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPREven2);
|
||||
return makeArrayRef(GPREven2);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPREven5);
|
||||
return makeArrayRef(GPREven5);
|
||||
} else { // FramePtr == ARM::R11
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPREven3);
|
||||
return makeArrayRef(GPREven3);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPREven6);
|
||||
return makeArrayRef(GPREven6);
|
||||
}
|
||||
} else if (HintType == ARMRI::RegPairOdd) {
|
||||
if (isPhysicalRegister(HintReg) && getRegisterPairOdd(HintReg, MF) == 0)
|
||||
@ -509,19 +509,19 @@ ARMBaseRegisterInfo::getRawAllocationOrder(const TargetRegisterClass *RC,
|
||||
|
||||
if (!TFI->hasFP(MF)) {
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPROdd1);
|
||||
return makeArrayRef(GPROdd1);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPROdd4);
|
||||
return makeArrayRef(GPROdd4);
|
||||
} else if (FramePtr == ARM::R7) {
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPROdd2);
|
||||
return makeArrayRef(GPROdd2);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPROdd5);
|
||||
return makeArrayRef(GPROdd5);
|
||||
} else { // FramePtr == ARM::R11
|
||||
if (!STI.isR9Reserved())
|
||||
return ArrayRef<unsigned>(GPROdd3);
|
||||
return makeArrayRef(GPROdd3);
|
||||
else
|
||||
return ArrayRef<unsigned>(GPROdd6);
|
||||
return makeArrayRef(GPROdd6);
|
||||
}
|
||||
}
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
|
@ -3559,7 +3559,7 @@ void CWriter::visitInsertValueInst(InsertValueInst &IVI) {
|
||||
i != e; ++i) {
|
||||
Type *IndexedTy =
|
||||
ExtractValueInst::getIndexedType(IVI.getOperand(0)->getType(),
|
||||
ArrayRef<unsigned>(b, i+1));
|
||||
makeArrayRef(b, i+1));
|
||||
if (IndexedTy->isArrayTy())
|
||||
Out << ".array[" << *i << "]";
|
||||
else
|
||||
@ -3581,7 +3581,7 @@ void CWriter::visitExtractValueInst(ExtractValueInst &EVI) {
|
||||
i != e; ++i) {
|
||||
Type *IndexedTy =
|
||||
ExtractValueInst::getIndexedType(EVI.getOperand(0)->getType(),
|
||||
ArrayRef<unsigned>(b, i+1));
|
||||
makeArrayRef(b, i+1));
|
||||
if (IndexedTy->isArrayTy())
|
||||
Out << ".array[" << *i << "]";
|
||||
else
|
||||
|
@ -1242,7 +1242,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
Value *NewEV = Builder->CreateExtractValue(IV->getAggregateOperand(),
|
||||
EV.getIndices());
|
||||
return InsertValueInst::Create(NewEV, IV->getInsertedValueOperand(),
|
||||
ArrayRef<unsigned>(insi, inse));
|
||||
makeArrayRef(insi, inse));
|
||||
}
|
||||
if (insi == inse)
|
||||
// The insert list is a prefix of the extract list
|
||||
@ -1254,7 +1254,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
// with
|
||||
// %E extractvalue { i32 } { i32 42 }, 0
|
||||
return ExtractValueInst::Create(IV->getInsertedValueOperand(),
|
||||
ArrayRef<unsigned>(exti, exte));
|
||||
makeArrayRef(exti, exte));
|
||||
}
|
||||
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Agg)) {
|
||||
// We're extracting from an intrinsic, see if we're the only user, which
|
||||
|
@ -506,7 +506,7 @@ LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
|
||||
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
|
||||
unsigned Count) {
|
||||
return wrap(MDNode::get(*unwrap(C),
|
||||
ArrayRef<Value*>(unwrap<Value>(Vals, Count), Count)));
|
||||
makeArrayRef(unwrap<Value>(Vals, Count), Count)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count) {
|
||||
@ -575,8 +575,7 @@ LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
|
||||
LLVMValueRef *ConstantVals,
|
||||
unsigned Count, LLVMBool Packed) {
|
||||
Constant **Elements = unwrap<Constant>(ConstantVals, Count);
|
||||
return wrap(ConstantStruct::getAnon(*unwrap(C),
|
||||
ArrayRef<Constant*>(Elements, Count),
|
||||
return wrap(ConstantStruct::getAnon(*unwrap(C), makeArrayRef(Elements, Count),
|
||||
Packed != 0));
|
||||
}
|
||||
|
||||
@ -602,11 +601,11 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
||||
Constant **Elements = unwrap<Constant>(ConstantVals, Count);
|
||||
StructType *Ty = cast<StructType>(unwrap(StructTy));
|
||||
|
||||
return wrap(ConstantStruct::get(Ty, ArrayRef<Constant*>(Elements, Count)));
|
||||
return wrap(ConstantStruct::get(Ty, makeArrayRef(Elements, Count)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
|
||||
return wrap(ConstantVector::get(ArrayRef<Constant*>(
|
||||
return wrap(ConstantVector::get(makeArrayRef(
|
||||
unwrap<Constant>(ScalarConstantVals, Size), Size)));
|
||||
}
|
||||
/*--.. Constant expressions ................................................--*/
|
||||
@ -934,8 +933,7 @@ LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
|
||||
LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
|
||||
unsigned NumIdx) {
|
||||
return wrap(ConstantExpr::getExtractValue(unwrap<Constant>(AggConstant),
|
||||
ArrayRef<unsigned>(IdxList,
|
||||
NumIdx)));
|
||||
makeArrayRef(IdxList, NumIdx)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
||||
@ -943,8 +941,7 @@ LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
||||
unsigned *IdxList, unsigned NumIdx) {
|
||||
return wrap(ConstantExpr::getInsertValue(unwrap<Constant>(AggConstant),
|
||||
unwrap<Constant>(ElementValueConstant),
|
||||
ArrayRef<unsigned>(IdxList,
|
||||
NumIdx)));
|
||||
makeArrayRef(IdxList, NumIdx)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
|
||||
@ -1680,7 +1677,7 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
|
||||
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
|
||||
const char *Name) {
|
||||
return wrap(unwrap(B)->CreateInvoke(unwrap(Fn), unwrap(Then), unwrap(Catch),
|
||||
ArrayRef<Value *>(unwrap(Args), NumArgs),
|
||||
makeArrayRef(unwrap(Args), NumArgs),
|
||||
Name));
|
||||
}
|
||||
|
||||
@ -2064,7 +2061,7 @@ LLVMValueRef LLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
const char *Name) {
|
||||
return wrap(unwrap(B)->CreateCall(unwrap(Fn),
|
||||
ArrayRef<Value *>(unwrap(Args), NumArgs),
|
||||
makeArrayRef(unwrap(Args), NumArgs),
|
||||
Name));
|
||||
}
|
||||
|
||||
|
@ -526,9 +526,9 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||
OS << " };\n";
|
||||
}
|
||||
OS << " static const ArrayRef<unsigned> Order[] = {\n"
|
||||
<< " ArrayRef<unsigned>(" << RC.getName();
|
||||
<< " makeArrayRef(" << RC.getName();
|
||||
for (unsigned oi = 1, oe = RC.getNumOrders(); oi != oe; ++oi)
|
||||
OS << "),\n ArrayRef<unsigned>(AltOrder" << oi;
|
||||
OS << "),\n makeArrayRef(AltOrder" << oi;
|
||||
OS << ")\n };\n const unsigned Select = " << RC.getName()
|
||||
<< "AltOrderSelect(MF);\n assert(Select < " << RC.getNumOrders()
|
||||
<< ");\n return Order[Select];\n}\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user