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