#include "Common/CodeGenHwModes.h"
#include "Common/CodeGenSchedule.h"
#include "Common/CodeGenTarget.h"
#include "Common/PredicateExpander.h"
#include "Common/Utils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/MC/MCSchedule.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include "llvm/TargetParser/SubtargetFeature.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <string>
#include <vector>
usingnamespacellvm;
#define DEBUG_TYPE …
namespace {
FeatureMapTy;
struct LessRecordFieldFieldName { … };
class SubtargetEmitter { … };
}
FeatureMapTy SubtargetEmitter::Enumeration(raw_ostream &OS) { … }
static void printFeatureMask(raw_ostream &OS,
ArrayRef<const Record *> FeatureList,
const FeatureMapTy &FeatureMap) { … }
void SubtargetEmitter::EmitSubtargetInfoMacroCalls(raw_ostream &OS) { … }
unsigned SubtargetEmitter::FeatureKeyValues(raw_ostream &OS,
const FeatureMapTy &FeatureMap) { … }
unsigned SubtargetEmitter::CPUKeyValues(raw_ostream &OS,
const FeatureMapTy &FeatureMap) { … }
void SubtargetEmitter::FormItineraryStageString(const std::string &Name,
const Record *ItinData,
std::string &ItinString,
unsigned &NStages) { … }
void SubtargetEmitter::FormItineraryOperandCycleString(
const Record *ItinData, std::string &ItinString, unsigned &NOperandCycles) { … }
void SubtargetEmitter::FormItineraryBypassString(const std::string &Name,
const Record *ItinData,
std::string &ItinString,
unsigned NOperandCycles) { … }
void SubtargetEmitter::EmitStageAndOperandCycleData(
raw_ostream &OS, std::vector<std::vector<InstrItinerary>> &ProcItinLists) { … }
void SubtargetEmitter::EmitItineraries(
raw_ostream &OS, std::vector<std::vector<InstrItinerary>> &ProcItinLists) { … }
void SubtargetEmitter::EmitProcessorProp(raw_ostream &OS, const Record *R,
StringRef Name, char Separator) { … }
void SubtargetEmitter::EmitProcessorResourceSubUnits(
const CodeGenProcModel &ProcModel, raw_ostream &OS) { … }
static void EmitRetireControlUnitInfo(const CodeGenProcModel &ProcModel,
raw_ostream &OS) { … }
static void EmitRegisterFileInfo(const CodeGenProcModel &ProcModel,
unsigned NumRegisterFiles,
unsigned NumCostEntries, raw_ostream &OS) { … }
unsigned
SubtargetEmitter::EmitRegisterFileTables(const CodeGenProcModel &ProcModel,
raw_ostream &OS) { … }
void SubtargetEmitter::EmitLoadStoreQueueInfo(const CodeGenProcModel &ProcModel,
raw_ostream &OS) { … }
void SubtargetEmitter::EmitExtraProcessorInfo(const CodeGenProcModel &ProcModel,
raw_ostream &OS) { … }
void SubtargetEmitter::EmitProcessorResources(const CodeGenProcModel &ProcModel,
raw_ostream &OS) { … }
const Record *
SubtargetEmitter::FindWriteResources(const CodeGenSchedRW &SchedWrite,
const CodeGenProcModel &ProcModel) { … }
const Record *
SubtargetEmitter::FindReadAdvance(const CodeGenSchedRW &SchedRead,
const CodeGenProcModel &ProcModel) { … }
void SubtargetEmitter::ExpandProcResources(
ConstRecVec &PRVec, std::vector<int64_t> &ReleaseAtCycles,
std::vector<int64_t> &AcquireAtCycles, const CodeGenProcModel &PM) { … }
void SubtargetEmitter::GenSchedClassTables(const CodeGenProcModel &ProcModel,
SchedClassTables &SchedTables) { … }
void SubtargetEmitter::EmitSchedClassTables(SchedClassTables &SchedTables,
raw_ostream &OS) { … }
void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) { … }
void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) { … }
static void emitPredicateProlog(const RecordKeeper &Records, raw_ostream &OS) { … }
static bool isTruePredicate(const Record *Rec) { … }
static void emitPredicates(const CodeGenSchedTransition &T,
const CodeGenSchedClass &SC, PredicateExpander &PE,
raw_ostream &OS) { … }
static void emitSchedModelHelperEpilogue(raw_ostream &OS,
bool ShouldReturnZero) { … }
static bool hasMCSchedPredicates(const CodeGenSchedTransition &T) { … }
static void collectVariantClasses(const CodeGenSchedModels &SchedModels,
IdxVec &VariantClasses,
bool OnlyExpandMCInstPredicates) { … }
static void collectProcessorIndices(const CodeGenSchedClass &SC,
IdxVec &ProcIndices) { … }
static bool isAlwaysTrue(const CodeGenSchedTransition &T) { … }
void SubtargetEmitter::emitSchedModelHelpersImpl(
raw_ostream &OS, bool OnlyExpandMCInstPredicates) { … }
void SubtargetEmitter::EmitSchedModelHelpers(const std::string &ClassName,
raw_ostream &OS) { … }
void SubtargetEmitter::EmitHwModeCheck(const std::string &ClassName,
raw_ostream &OS) { … }
void SubtargetEmitter::emitGetMacroFusions(const std::string &ClassName,
raw_ostream &OS) { … }
void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS) { … }
void SubtargetEmitter::emitGenMCSubtargetInfo(raw_ostream &OS) { … }
void SubtargetEmitter::EmitMCInstrAnalysisPredicateFunctions(raw_ostream &OS) { … }
void SubtargetEmitter::run(raw_ostream &OS) { … }
static TableGen::Emitter::OptClass<SubtargetEmitter>
X("gen-subtarget", "Generate subtarget enumerations");