Path: blob/main/contrib/llvm-project/llvm/utils/TableGen/Basic/TargetFeaturesEmitter.h
213799 views
//===- TargetFeaturesEmitter.h- Generate CPU Target features ----===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Defines the TargetFeaturesEmitter class, which is used to export9// CPU target features and CPU subtypes.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_UTILS_TABLEGEN_BASIC_EMITTARGETFEATURE_H14#define LLVM_UTILS_TABLEGEN_BASIC_EMITTARGETFEATURE_H1516#include "llvm/ADT/DenseMap.h"17#include "llvm/TableGen/Record.h"1819namespace llvm {20/// Sorting predicate to sort record pointers by their21/// FieldName field.22struct LessRecordFieldFieldName {23bool operator()(const Record *Rec1, const Record *Rec2) const {24return Rec1->getValueAsString("FieldName") <25Rec2->getValueAsString("FieldName");26}27};2829using FeatureMapTy = DenseMap<const Record *, unsigned>;3031class TargetFeaturesEmitter {32protected:33const RecordKeeper &Records;34std::string Target;3536public:37TargetFeaturesEmitter(const RecordKeeper &R);38static void printFeatureMask(raw_ostream &OS,39ArrayRef<const Record *> FeatureList,40const FeatureMapTy &FeatureMap);41FeatureMapTy enumeration(raw_ostream &OS);42void printFeatureKeyValues(raw_ostream &OS, const FeatureMapTy &FeatureMap);43void printCPUKeyValues(raw_ostream &OS, const FeatureMapTy &FeatureMap);44virtual void run(raw_ostream &O);45virtual ~TargetFeaturesEmitter() {};46};47} // namespace llvm48#endif495051