1 //===-- MCSubtargetInfo.cpp - Subtarget Information -----------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCSubtargetInfo.h"
11 #include "llvm/MC/MCInstrItineraries.h"
12 #include "llvm/MC/SubtargetFeature.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Support/raw_ostream.h"
20 MCSubtargetInfo::getInstrItineraryForCPU(StringRef CPU) const {
21 assert(ProcItins && "Instruction itineraries information not available!");
24 for (size_t i = 1; i < NumProcs; i++) {
25 assert(strcmp(ProcItins[i - 1].Key, ProcItins[i].Key) < 0 &&
26 "Itineraries table is not sorted");
33 const SubtargetInfoKV *Found =
34 std::lower_bound(ProcItins, ProcItins+NumProcs, KV);
35 if (Found == ProcItins+NumProcs || StringRef(Found->Key) != CPU) {
37 << "' is not a recognized processor for this target"
38 << " (ignoring processor)\n";
39 return InstrItineraryData();
42 return InstrItineraryData(Stages, OperandCycles, ForwardingPathes,
43 (InstrItinerary *)Found->Value);