llvm.org GIT mirror llvm / 795a06a
Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248140 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 4 years ago
13 changed file(s) with 40 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
535535 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
536536 SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
537537 return getNode(ISD::CopyToReg, dl, VTs,
538 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
538 makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
539539 }
540540
541541 // Similar to last getCopyToReg() except parameter Reg is a SDValue
544544 SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
545545 SDValue Ops[] = { Chain, Reg, N, Glue };
546546 return getNode(ISD::CopyToReg, dl, VTs,
547 ArrayRef(Ops, Glue.getNode() ? 4 : 3));
547 makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
548548 }
549549
550550 SDValue getCopyFromReg(SDValue Chain, SDLoc dl, unsigned Reg, EVT VT) {
561561 SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
562562 SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
563563 return getNode(ISD::CopyFromReg, dl, VTs,
564 ArrayRef(Ops, Glue.getNode() ? 3 : 2));
564 makeArrayRef(Ops, Glue.getNode() ? 3 : 2));
565565 }
566566
567567 SDValue getCondCode(ISD::CondCode Cond);
480480 return object_error::parse_failed;
481481 if (NumSymbols != (SymTable.sh_size / sizeof(Elf_Sym)))
482482 return object_error::parse_failed;
483 return ArrayRef(ShndxTableBegin, ShndxTableEnd);
483 return makeArrayRef(ShndxTableBegin, ShndxTableEnd);
484484 }
485485
486486 template
235235
236236 public:
237237 CounterMappingContext(ArrayRef Expressions,
238 ArrayRef CounterValues = ArrayRef())
238 ArrayRef CounterValues = None)
239239 : Expressions(Expressions), CounterValues(CounterValues) {}
240240
241241 void setCounts(ArrayRef Counts) { CounterValues = Counts; }
6666 /// \returns The fully qualified path to the first \p Name in \p Paths if it
6767 /// exists. \p Name if \p Name has slashes in it. Otherwise an error.
6868 ErrorOr
69 findProgramByName(StringRef Name,
70 ArrayRef Paths = ArrayRef());
69 findProgramByName(StringRef Name, ArrayRef Paths = None);
7170
7271 // These functions change the specified standard stream (stdin or stdout) to
7372 // binary mode. They return errc::success if the specified stream
1273112731 std::all_of(SVN->getMask().begin() + NumElemsPerConcat,
1273212732 SVN->getMask().end(), [](int i) { return i == -1; })) {
1273312733 N0 = DAG.getVectorShuffle(ConcatVT, SDLoc(N), N0.getOperand(0), N0.getOperand(1),
12734 ArrayRef(SVN->getMask().begin(), NumElemsPerConcat));
12734 makeArrayRef(SVN->getMask().begin(), NumElemsPerConcat));
1273512735 N1 = DAG.getUNDEF(ConcatVT);
1273612736 return DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(N), VT, N0, N1);
1273712737 }
109109
110110 bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const {
111111 // First, check DWARF4 form classes.
112 if (Form < ArrayRef(DWARF4FormClasses).size() &&
112 if (Form < makeArrayRef(DWARF4FormClasses).size() &&
113113 DWARF4FormClasses[Form] == FC)
114114 return true;
115115 // Check more forms from DWARF4 and DWARF5 proposals.
583583 Optional> DWARFFormValue::getAsBlock() const {
584584 if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc))
585585 return None;
586 return ArrayRef(Value.data, Value.uval);
587 }
588
586 return makeArrayRef(Value.data, Value.uval);
587 }
588
220220 };
221221 assert(array_lengthof(StandardOpcodeLengths) >=
222222 (Params.DWARF2LineOpcodeBase - 1U));
223 return Emit(MCOS, Params, ArrayRef(StandardOpcodeLengths,
224 Params.DWARF2LineOpcodeBase - 1));
223 return Emit(MCOS, Params, makeArrayRef(StandardOpcodeLengths,
224 Params.DWARF2LineOpcodeBase - 1));
225225 }
226226
227227 static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) {
22032203
22042204 ArrayRef MachOObjectFile::getDyldInfoRebaseOpcodes() const {
22052205 if (!DyldInfoLoadCmd)
2206 return ArrayRef();
2206 return None;
22072207
22082208 MachO::dyld_info_command DyldInfo
22092209 = getStruct(this, DyldInfoLoadCmd);
22102210 const uint8_t *Ptr = reinterpret_cast(
22112211 getPtr(this, DyldInfo.rebase_off));
2212 return ArrayRef(Ptr, DyldInfo.rebase_size);
2212 return makeArrayRef(Ptr, DyldInfo.rebase_size);
22132213 }
22142214
22152215 ArrayRef MachOObjectFile::getDyldInfoBindOpcodes() const {
22162216 if (!DyldInfoLoadCmd)
2217 return ArrayRef();
2217 return None;
22182218
22192219 MachO::dyld_info_command DyldInfo
22202220 = getStruct(this, DyldInfoLoadCmd);
22212221 const uint8_t *Ptr = reinterpret_cast(
22222222 getPtr(this, DyldInfo.bind_off));
2223 return ArrayRef(Ptr, DyldInfo.bind_size);
2223 return makeArrayRef(Ptr, DyldInfo.bind_size);
22242224 }
22252225
22262226 ArrayRef MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
22272227 if (!DyldInfoLoadCmd)
2228 return ArrayRef();
2228 return None;
22292229
22302230 MachO::dyld_info_command DyldInfo
22312231 = getStruct(this, DyldInfoLoadCmd);
22322232 const uint8_t *Ptr = reinterpret_cast(
22332233 getPtr(this, DyldInfo.weak_bind_off));
2234 return ArrayRef(Ptr, DyldInfo.weak_bind_size);
2234 return makeArrayRef(Ptr, DyldInfo.weak_bind_size);
22352235 }
22362236
22372237 ArrayRef MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
22382238 if (!DyldInfoLoadCmd)
2239 return ArrayRef();
2239 return None;
22402240
22412241 MachO::dyld_info_command DyldInfo
22422242 = getStruct(this, DyldInfoLoadCmd);
22432243 const uint8_t *Ptr = reinterpret_cast(
22442244 getPtr(this, DyldInfo.lazy_bind_off));
2245 return ArrayRef(Ptr, DyldInfo.lazy_bind_size);
2245 return makeArrayRef(Ptr, DyldInfo.lazy_bind_size);
22462246 }
22472247
22482248 ArrayRef MachOObjectFile::getDyldInfoExportsTrie() const {
22492249 if (!DyldInfoLoadCmd)
2250 return ArrayRef();
2250 return None;
22512251
22522252 MachO::dyld_info_command DyldInfo
22532253 = getStruct(this, DyldInfoLoadCmd);
22542254 const uint8_t *Ptr = reinterpret_cast(
22552255 getPtr(this, DyldInfo.export_off));
2256 return ArrayRef(Ptr, DyldInfo.export_size);
2256 return makeArrayRef(Ptr, DyldInfo.export_size);
22572257 }
22582258
22592259 ArrayRef MachOObjectFile::getUuid() const {
22602260 if (!UuidLoadCmd)
2261 return ArrayRef();
2261 return None;
22622262 // Returning a pointer is fine as uuid doesn't need endian swapping.
22632263 const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid);
2264 return ArrayRef(reinterpret_cast(Ptr), 16);
2264 return makeArrayRef(reinterpret_cast(Ptr), 16);
22652265 }
22662266
22672267 StringRef MachOObjectFile::getStringTableData() const {
690690 }
691691
692692 if (Info->getShaderType() != ShaderType::COMPUTE) {
693 unsigned ScratchIdx = CCInfo.getFirstUnallocated(ArrayRef(
693 unsigned ScratchIdx = CCInfo.getFirstUnallocated(makeArrayRef(
694694 AMDGPU::SGPR_32RegClass.begin(), AMDGPU::SGPR_32RegClass.getNumRegs()));
695695 Info->ScratchOffsetReg = AMDGPU::SGPR_32RegClass.getRegister(ScratchIdx);
696696 }
217217 // Complete object locators in the MS-ABI start with '??_R4'
218218 else if (SymName.startswith("??_R4")) {
219219 CompleteObjectLocator COL;
220 COL.Data = ArrayRef(
220 COL.Data = makeArrayRef(
221221 reinterpret_cast(SymContents.data()), 3);
222222 StringRef *I = std::begin(COL.Symbols), *E = std::end(COL.Symbols);
223223 collectRelocatedSymbols(Obj, Sec, SecAddress, SymAddress, SymSize, I, E);
226226 // Class hierarchy descriptors in the MS-ABI start with '??_R3'
227227 else if (SymName.startswith("??_R3")) {
228228 ClassHierarchyDescriptor CHD;
229 CHD.Data = ArrayRef(
229 CHD.Data = makeArrayRef(
230230 reinterpret_cast(SymContents.data()), 3);
231231 StringRef *I = std::begin(CHD.Symbols), *E = std::end(CHD.Symbols);
232232 collectRelocatedSymbols(Obj, Sec, SecAddress, SymAddress, SymSize, I, E);
242242 // Base class descriptors in the MS-ABI start with '??_R1'
243243 else if (SymName.startswith("??_R1")) {
244244 BaseClassDescriptor BCD;
245 BCD.Data = ArrayRef(
245 BCD.Data = makeArrayRef(
246246 reinterpret_cast(SymContents.data()) + 1, 5);
247247 StringRef *I = std::begin(BCD.Symbols), *E = std::end(BCD.Symbols);
248248 collectRelocatedSymbols(Obj, Sec, SecAddress, SymAddress, SymSize, I, E);
150150 << " remaining in buffer";
151151 return ;
152152 }
153 printUnwindCode(ArrayRef(I, E));
153 printUnwindCode(makeArrayRef(I, E));
154154 I += UsedSlots;
155155 }
156156 }
432432 if (UI->NumCodes)
433433 outs() << " Unwind Codes:\n";
434434
435 printAllUnwindCodes(ArrayRef(&UI->UnwindCodes[0], UI->NumCodes));
435 printAllUnwindCodes(makeArrayRef(&UI->UnwindCodes[0], UI->NumCodes));
436436
437437 outs() << "\n";
438438 outs().flush();
204204 case MachO::DICE_KIND_DATA:
205205 if (Length >= 4) {
206206 if (!NoShowRawInsn)
207 dumpBytes(ArrayRef(bytes, 4), outs());
207 dumpBytes(makeArrayRef(bytes, 4), outs());
208208 Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
209209 outs() << "\t.long " << Value;
210210 Size = 4;
211211 } else if (Length >= 2) {
212212 if (!NoShowRawInsn)
213 dumpBytes(ArrayRef(bytes, 2), outs());
213 dumpBytes(makeArrayRef(bytes, 2), outs());
214214 Value = bytes[1] << 8 | bytes[0];
215215 outs() << "\t.short " << Value;
216216 Size = 2;
217217 } else {
218218 if (!NoShowRawInsn)
219 dumpBytes(ArrayRef(bytes, 2), outs());
219 dumpBytes(makeArrayRef(bytes, 2), outs());
220220 Value = bytes[0];
221221 outs() << "\t.byte " << Value;
222222 Size = 1;
228228 break;
229229 case MachO::DICE_KIND_JUMP_TABLE8:
230230 if (!NoShowRawInsn)
231 dumpBytes(ArrayRef(bytes, 1), outs());
231 dumpBytes(makeArrayRef(bytes, 1), outs());
232232 Value = bytes[0];
233233 outs() << "\t.byte " << format("%3u", Value) << "\t@ KIND_JUMP_TABLE8\n";
234234 Size = 1;
235235 break;
236236 case MachO::DICE_KIND_JUMP_TABLE16:
237237 if (!NoShowRawInsn)
238 dumpBytes(ArrayRef(bytes, 2), outs());
238 dumpBytes(makeArrayRef(bytes, 2), outs());
239239 Value = bytes[1] << 8 | bytes[0];
240240 outs() << "\t.short " << format("%5u", Value & 0xffff)
241241 << "\t@ KIND_JUMP_TABLE16\n";
244244 case MachO::DICE_KIND_JUMP_TABLE32:
245245 case MachO::DICE_KIND_ABS_JUMP_TABLE32:
246246 if (!NoShowRawInsn)
247 dumpBytes(ArrayRef(bytes, 4), outs());
247 dumpBytes(makeArrayRef(bytes, 4), outs());
248248 Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
249249 outs() << "\t.long " << Value;
250250 if (Kind == MachO::DICE_KIND_JUMP_TABLE32)
62166216 DebugOut, Annotations);
62176217 if (gotInst) {
62186218 if (!NoShowRawInsn) {
6219 dumpBytes(ArrayRef(Bytes.data() + Index, Size), outs());
6219 dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs());
62206220 }
62216221 formatted_raw_ostream FormattedOS(outs());
62226222 StringRef AnnotationsStr = Annotations.str();
62806280 }
62816281 if (!NoShowRawInsn) {
62826282 outs() << "\t";
6283 dumpBytes(ArrayRef(Bytes.data() + Index, InstSize), outs());
6283 dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
62846284 }
62856285 IP->printInst(&Inst, outs(), "", *STI);
62866286 outs() << "\n";
253253 return;
254254 }
255255
256 printUnwindCode(UI, ArrayRef(UCI, UCE));
256 printUnwindCode(UI, makeArrayRef(UCI, UCE));
257257 UCI = UCI + UsedSlots - 1;
258258 }
259259 }