2011-07-01 20:45:01 +00:00
|
|
|
//==-- llvm/MC/MCSubtargetInfo.h - Subtarget Information ---------*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the subtarget options of a Target machine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCSUBTARGET_H
|
|
|
|
#define LLVM_MC_MCSUBTARGET_H
|
|
|
|
|
|
|
|
#include "llvm/MC/SubtargetFeature.h"
|
|
|
|
#include "llvm/MC/MCInstrItineraries.h"
|
2011-07-11 03:57:24 +00:00
|
|
|
#include <string>
|
2011-07-01 20:45:01 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class StringRef;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// MCSubtargetInfo - Generic base class for all target subtargets.
|
|
|
|
///
|
|
|
|
class MCSubtargetInfo {
|
2011-07-11 03:57:24 +00:00
|
|
|
std::string TargetTriple; // Target triple
|
2011-07-01 20:45:01 +00:00
|
|
|
const SubtargetFeatureKV *ProcFeatures; // Processor feature list
|
|
|
|
const SubtargetFeatureKV *ProcDesc; // Processor descriptions
|
2012-07-07 04:00:00 +00:00
|
|
|
const SubtargetInfoKV *ProcSchedModel; // Scheduler machine model
|
|
|
|
const InstrStage *Stages; // Instruction itinerary stages
|
|
|
|
const unsigned *OperandCycles; // Itinerary operand cycles
|
2012-07-07 03:59:48 +00:00
|
|
|
const unsigned *ForwardingPaths; // Forwarding paths
|
2011-07-01 20:45:01 +00:00
|
|
|
unsigned NumFeatures; // Number of processor features
|
|
|
|
unsigned NumProcs; // Number of processors
|
2011-07-09 05:47:46 +00:00
|
|
|
uint64_t FeatureBits; // Feature bits for current CPU + FS
|
2011-07-07 07:07:08 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
public:
|
2011-07-11 03:57:24 +00:00
|
|
|
void InitMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS,
|
2011-07-07 07:07:08 +00:00
|
|
|
const SubtargetFeatureKV *PF,
|
2011-07-01 20:45:01 +00:00
|
|
|
const SubtargetFeatureKV *PD,
|
2012-07-07 04:00:00 +00:00
|
|
|
const SubtargetInfoKV *ProcSched,
|
|
|
|
const InstrStage *IS,
|
2011-07-01 20:45:01 +00:00
|
|
|
const unsigned *OC, const unsigned *FP,
|
2011-07-07 07:07:08 +00:00
|
|
|
unsigned NF, unsigned NP);
|
|
|
|
|
2011-07-11 03:57:24 +00:00
|
|
|
/// getTargetTriple - Return the target triple string.
|
|
|
|
StringRef getTargetTriple() const {
|
|
|
|
return TargetTriple;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// getFeatureBits - Return the feature bits.
|
2011-07-07 07:07:08 +00:00
|
|
|
///
|
|
|
|
uint64_t getFeatureBits() const {
|
|
|
|
return FeatureBits;
|
2011-07-01 20:45:01 +00:00
|
|
|
}
|
|
|
|
|
2011-07-07 07:07:08 +00:00
|
|
|
/// ReInitMCSubtargetInfo - Change CPU (and optionally supplemented with
|
|
|
|
/// feature string), recompute and return feature bits.
|
|
|
|
uint64_t ReInitMCSubtargetInfo(StringRef CPU, StringRef FS);
|
|
|
|
|
2011-07-09 05:47:46 +00:00
|
|
|
/// ToggleFeature - Toggle a feature and returns the re-computed feature
|
|
|
|
/// bits. This version does not change the implied bits.
|
|
|
|
uint64_t ToggleFeature(uint64_t FB);
|
|
|
|
|
|
|
|
/// ToggleFeature - Toggle a feature and returns the re-computed feature
|
|
|
|
/// bits. This version will also change all implied bits.
|
|
|
|
uint64_t ToggleFeature(StringRef FS);
|
|
|
|
|
2012-07-07 04:00:00 +00:00
|
|
|
/// getSchedModelForCPU - Get the machine model of a CPU.
|
|
|
|
///
|
2012-09-05 21:43:57 +00:00
|
|
|
const MCSchedModel *getSchedModelForCPU(StringRef CPU) const;
|
2012-07-07 04:00:00 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
/// getInstrItineraryForCPU - Get scheduling itinerary of a CPU.
|
|
|
|
///
|
|
|
|
InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|