2005-10-21 21:00:04 +02:00
|
|
|
//===- SubtargetEmitter.h - Generate subtarget enumerations -----*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:37:13 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-10-21 21:00:04 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend emits subtarget enumerations.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SUBTARGET_EMITTER_H
|
|
|
|
#define SUBTARGET_EMITTER_H
|
|
|
|
|
|
|
|
#include "TableGenBackend.h"
|
2005-10-27 21:47:21 +02:00
|
|
|
#include "llvm/Target/TargetInstrItineraries.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2005-10-21 21:00:04 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class SubtargetEmitter : public TableGenBackend {
|
2005-10-27 21:47:21 +02:00
|
|
|
|
2005-10-21 21:00:04 +02:00
|
|
|
RecordKeeper &Records;
|
2005-10-26 19:30:34 +02:00
|
|
|
std::string Target;
|
2005-11-01 21:06:59 +01:00
|
|
|
bool HasItineraries;
|
2005-10-25 17:16:36 +02:00
|
|
|
|
2009-07-03 02:10:29 +02:00
|
|
|
void Enumeration(raw_ostream &OS, const char *ClassName, bool isBits);
|
|
|
|
void FeatureKeyValues(raw_ostream &OS);
|
|
|
|
void CPUKeyValues(raw_ostream &OS);
|
|
|
|
unsigned CollectAllItinClasses(raw_ostream &OS,
|
2005-11-01 21:06:59 +01:00
|
|
|
std::map<std::string, unsigned> &ItinClassesMap);
|
2010-04-18 22:31:01 +02:00
|
|
|
void FormItineraryStageString(const std::string &Names,
|
|
|
|
Record *ItinData, std::string &ItinString,
|
2009-08-17 18:02:57 +02:00
|
|
|
unsigned &NStages);
|
|
|
|
void FormItineraryOperandCycleString(Record *ItinData, std::string &ItinString,
|
|
|
|
unsigned &NOperandCycles);
|
|
|
|
void EmitStageAndOperandCycleData(raw_ostream &OS, unsigned NItinClasses,
|
2005-10-28 23:47:29 +02:00
|
|
|
std::map<std::string, unsigned> &ItinClassesMap,
|
|
|
|
std::vector<std::vector<InstrItinerary> > &ProcList);
|
2009-07-03 02:10:29 +02:00
|
|
|
void EmitProcessorData(raw_ostream &OS,
|
2005-10-28 23:47:29 +02:00
|
|
|
std::vector<std::vector<InstrItinerary> > &ProcList);
|
2009-07-03 02:10:29 +02:00
|
|
|
void EmitProcessorLookup(raw_ostream &OS);
|
|
|
|
void EmitData(raw_ostream &OS);
|
|
|
|
void ParseFeaturesFunction(raw_ostream &OS);
|
2005-10-25 17:16:36 +02:00
|
|
|
|
2005-10-21 21:00:04 +02:00
|
|
|
public:
|
2005-11-01 21:06:59 +01:00
|
|
|
SubtargetEmitter(RecordKeeper &R) : Records(R), HasItineraries(false) {}
|
2005-10-21 21:00:04 +02:00
|
|
|
|
|
|
|
// run - Output the subtarget enumerations, returning true on failure.
|
2009-07-03 02:10:29 +02:00
|
|
|
void run(raw_ostream &o);
|
2005-10-21 21:00:04 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|