namespace tidy {
namespace modernize {
-static const llvm::SmallVector<StringRef, 5> DeprecatedTypes = {
- {"::std::ios_base::io_state"},
- {"::std::ios_base::open_mode"},
- {"::std::ios_base::seek_dir"},
- {"::std::ios_base::streamoff"},
- {"::std::ios_base::streampos"}};
+static constexpr std::array<StringRef, 5> DeprecatedTypes = {
+ "::std::ios_base::io_state", "::std::ios_base::open_mode",
+ "::std::ios_base::seek_dir", "::std::ios_base::streamoff",
+ "::std::ios_base::streampos"};
static const llvm::StringMap<StringRef> ReplacementTypes = {
{"io_state", "iostate"},
// Create a vector of the arguments, as well as a constant value to
// express to the runtime the number of variadic arguments.
- std::vector<llvm::Value *> Args = {
- Queue, Flags, Range,
- Kernel, Block, ConstantInt::get(IntTy, NumArgs - 4),
- ElemPtr};
- std::vector<llvm::Type *> ArgTys = {
+ llvm::Value *const Args[] = {Queue, Flags,
+ Range, Kernel,
+ Block, ConstantInt::get(IntTy, NumArgs - 4),
+ ElemPtr};
+ llvm::Type *const ArgTys[] = {
QueueTy, IntTy, RangeTy, GenericVoidPtrTy,
GenericVoidPtrTy, IntTy, ElemPtr->getType()};
- llvm::FunctionType *FTy = llvm::FunctionType::get(
- Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
- auto Call =
- RValue::get(Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
- llvm::ArrayRef<llvm::Value *>(Args)));
+ llvm::FunctionType *FTy = llvm::FunctionType::get(Int32Ty, ArgTys, false);
+ auto Call = RValue::get(
+ Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), Args));
if (TmpSize)
EmitLifetimeEnd(TmpSize, TmpPtr);
return Call;
};
// currently only support the set of multilibs like riscv-gnu-toolchain does.
// TODO: support MULTILIB_REUSE
- SmallVector<RiscvMultilib, 8> RISCVMultilibSet = {
+ constexpr RiscvMultilib RISCVMultilibSet[] = {
{"rv32i", "ilp32"}, {"rv32im", "ilp32"}, {"rv32iac", "ilp32"},
{"rv32imac", "ilp32"}, {"rv32imafc", "ilp32f"}, {"rv64imac", "lp64"},
{"rv64imafdc", "lp64d"}};
return [](const CommandLineArguments &Args, StringRef /*unused*/) {
CommandLineArguments AdjustedArgs;
bool HasSyntaxOnly = false;
- const std::vector<llvm::StringRef> OutputCommands = {
+ constexpr llvm::StringRef OutputCommands[] = {
// FIXME: Add other options that generate output.
"-save-temps",
"--save-temps",
Abbv->Add(BitCodeAbbrevOp(bitc::IDENTIFICATION_CODE_EPOCH));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
auto EpochAbbrev = Stream.EmitAbbrev(std::move(Abbv));
- SmallVector<unsigned, 1> Vals = {bitc::BITCODE_CURRENT_EPOCH};
+ constexpr std::array<unsigned, 1> Vals = {bitc::BITCODE_CURRENT_EPOCH};
Stream.EmitRecord(bitc::IDENTIFICATION_CODE_EPOCH, Vals, EpochAbbrev);
Stream.ExitBlock();
}
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
unsigned WidenNumElts = WidenVT.getVectorNumElements();
- SmallVector<EVT, 2> WidenVTs = { WidenVT, MVT::Other };
EVT InVT = InOp.getValueType();
EVT InEltVT = InVT.getVectorElementType();
// Otherwise unroll into some nasty scalar code and rebuild the vector.
EVT EltVT = WidenVT.getVectorElementType();
- SmallVector<EVT, 2> EltVTs = { EltVT, MVT::Other };
+ std::array<EVT, 2> EltVTs = {EltVT, MVT::Other};
SmallVector<SDValue, 16> Ops(WidenNumElts, DAG.getUNDEF(EltVT));
SmallVector<SDValue, 32> OpChains;
// Use the original element count so we don't do more scalar opts than
unsigned Reg = MF.addLiveIn(ARM::LR, getRegClassFor(MVT::i32));
SDValue ReturnAddress =
DAG.getCopyFromReg(DAG.getEntryNode(), dl, Reg, PtrVT);
- std::vector<EVT> ResultTys = {MVT::Other, MVT::Glue};
+ constexpr EVT ResultTys[] = {MVT::Other, MVT::Glue};
SDValue Callee =
DAG.getTargetExternalSymbol("\01__gnu_mcount_nc", PtrVT, 0);
SDValue RegisterMask = DAG.getRegisterMask(Mask);
SDNode *Result;
switch (IID) {
case Intrinsic::hexagon_V6_vaddcarry: {
- SmallVector<SDValue, 3> Ops = { N->getOperand(1), N->getOperand(2),
- N->getOperand(3) };
+ std::array<SDValue, 3> Ops = {N->getOperand(1), N->getOperand(2),
+ N->getOperand(3)};
SDVTList VTs = CurDAG->getVTList(MVT::v16i32, MVT::v512i1);
Result = CurDAG->getMachineNode(Hexagon::V6_vaddcarry, SDLoc(N), VTs, Ops);
break;
}
case Intrinsic::hexagon_V6_vaddcarry_128B: {
- SmallVector<SDValue, 3> Ops = { N->getOperand(1), N->getOperand(2),
- N->getOperand(3) };
+ std::array<SDValue, 3> Ops = {N->getOperand(1), N->getOperand(2),
+ N->getOperand(3)};
SDVTList VTs = CurDAG->getVTList(MVT::v32i32, MVT::v1024i1);
Result = CurDAG->getMachineNode(Hexagon::V6_vaddcarry, SDLoc(N), VTs, Ops);
break;
}
case Intrinsic::hexagon_V6_vsubcarry: {
- SmallVector<SDValue, 3> Ops = { N->getOperand(1), N->getOperand(2),
- N->getOperand(3) };
+ std::array<SDValue, 3> Ops = {N->getOperand(1), N->getOperand(2),
+ N->getOperand(3)};
SDVTList VTs = CurDAG->getVTList(MVT::v16i32, MVT::v512i1);
Result = CurDAG->getMachineNode(Hexagon::V6_vsubcarry, SDLoc(N), VTs, Ops);
break;
}
case Intrinsic::hexagon_V6_vsubcarry_128B: {
- SmallVector<SDValue, 3> Ops = { N->getOperand(1), N->getOperand(2),
- N->getOperand(3) };
+ std::array<SDValue, 3> Ops = {N->getOperand(1), N->getOperand(2),
+ N->getOperand(3)};
SDVTList VTs = CurDAG->getVTList(MVT::v32i32, MVT::v1024i1);
Result = CurDAG->getMachineNode(Hexagon::V6_vsubcarry, SDLoc(N), VTs, Ops);
break;
// Returns true if the registers Reg1 and Reg2 are consecutive
static bool ConsecutiveRegisters(unsigned Reg1, unsigned Reg2) {
- static SmallVector<unsigned, 31> Registers = {
+ constexpr std::array<unsigned, 31> Registers = {
Mips::AT, Mips::V0, Mips::V1, Mips::A0, Mips::A1, Mips::A2, Mips::A3,
Mips::T0, Mips::T1, Mips::T2, Mips::T3, Mips::T4, Mips::T5, Mips::T6,
Mips::T7, Mips::S0, Mips::S1, Mips::S2, Mips::S3, Mips::S4, Mips::S5,
if (SetjmpF) {
// Register saveSetjmp function
FunctionType *SetjmpFTy = SetjmpF->getFunctionType();
- SmallVector<Type *, 4> Params = {SetjmpFTy->getParamType(0),
- IRB.getInt32Ty(), Type::getInt32PtrTy(C),
- IRB.getInt32Ty()};
+ std::array<Type *, 4> Params = {SetjmpFTy->getParamType(0),
+ IRB.getInt32Ty(), Type::getInt32PtrTy(C),
+ IRB.getInt32Ty()};
FunctionType *FTy =
FunctionType::get(Type::getInt32PtrTy(C), Params, false);
SaveSetjmpF =
int getExternalUsesCost(const std::pair<Value *, int> &LHS,
const std::pair<Value *, int> &RHS) {
int Cost = 0;
- SmallVector<std::pair<Value *, int>, 2> Values = {LHS, RHS};
+ std::array<std::pair<Value *, int>, 2> Values = {LHS, RHS};
for (int Idx = 0, IdxE = Values.size(); Idx != IdxE; ++Idx) {
Value *V = Values[Idx].first;
// Calculate the absolute lane, using the minimum relative lane of LHS
SmallVectorImpl<Value> &ids,
SmallVectorImpl<Value> &nids) {
assert(nDims <= 3 && "invalid number of launch dimensions");
- SmallVector<Value, 3> allIds = {kernelIds.z, kernelIds.y, kernelIds.x};
- SmallVector<Value, 3> allNids = {kernelNids.z, kernelNids.y, kernelNids.x};
+ std::array<Value, 3> allIds = {kernelIds.z, kernelIds.y, kernelIds.x};
+ std::array<Value, 3> allNids = {kernelNids.z, kernelNids.y, kernelNids.x};
ids.clear();
ids.append(std::next(allIds.begin(), allIds.size() - nDims), allIds.end());
nids.clear();
static PassRegistration<ParallelLoopToGpuPass>
pass("convert-parallel-loops-to-gpu", "Convert mapped loop.parallel ops"
- " to gpu launch operations.");
\ No newline at end of file
+ " to gpu launch operations.");
Value subgroupSize = create<ConstantIntOp>(kSubgroupSize, int32Type);
Value isPartialSubgroup =
create<CmpIOp>(CmpIPredicate::slt, activeWidth, subgroupSize);
- SmallVector<Type, 2> shuffleType = {valueType, rewriter.getI1Type()};
+ std::array<Type, 2> shuffleType = {valueType, rewriter.getI1Type()};
auto xorAttr = rewriter.getStringAttr("xor");
createIf(
return parser.emitError(parser.getNameLoc(),
"expected type with valid i1 shape");
- SmallVector<Type, 3> types = {i1Type, type, type};
+ std::array<Type, 3> types = {i1Type, type, type};
return failure(parser.resolveOperands(ops, types, parser.getNameLoc(),
result.operands) ||
parser.addTypeToList(type, result.types));
p << op.getOperationName() << ' ' << op.getOperand(0) << '[' << op.offsets()
<< "][" << op.sizes() << "][" << op.strides() << ']';
- SmallVector<StringRef, 1> elidedAttrs = {
+ std::array<StringRef, 1> elidedAttrs = {
SubViewOp::getOperandSegmentSizeAttr()};
p.printOptionalAttrDict(op.getAttrs(), elidedAttrs);
p << " : " << op.getOperand(0).getType() << " to " << op.getType();
static void print(OpAsmPrinter &p, ReshapeOp op) {
p << op.getOperationName() << " " << op.vector() << ", [" << op.input_shape()
<< "], [" << op.output_shape() << "], " << op.fixed_vector_sizes();
- SmallVector<StringRef, 2> elidedAttrs = {
+ std::array<StringRef, 2> elidedAttrs = {
ReshapeOp::getOperandSegmentSizeAttr(),
ReshapeOp::getFixedVectorSizesAttrName()};
p.printOptionalAttrDict(op.getAttrs(), elidedAttrs);