2018-06-19 19:28:59 +08:00
|
|
|
//===-- Target.h ------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
|
|
|
///
|
|
|
|
/// Classes that handle the creation of target-specific objects. This is
|
|
|
|
/// similar to llvm::Target/TargetRegistry.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H
|
|
|
|
#define LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H
|
|
|
|
|
|
|
|
#include "llvm/ADT/Triple.h"
|
2018-06-20 19:54:35 +08:00
|
|
|
#include "llvm/CodeGen/TargetPassConfig.h"
|
|
|
|
#include "llvm/IR/LegacyPassManager.h"
|
2018-06-19 19:28:59 +08:00
|
|
|
|
|
|
|
namespace exegesis {
|
|
|
|
|
|
|
|
class ExegesisTarget {
|
|
|
|
public:
|
2018-06-20 19:54:35 +08:00
|
|
|
// Targets can use this to add target-specific passes in assembleToStream();
|
|
|
|
virtual void addTargetSpecificPasses(llvm::PassManagerBase &PM) const {}
|
|
|
|
|
2018-06-19 19:28:59 +08:00
|
|
|
// Returns the ExegesisTarget for the given triple or nullptr if the target
|
|
|
|
// does not exist.
|
2018-06-20 19:54:35 +08:00
|
|
|
static const ExegesisTarget *lookup(llvm::Triple TT);
|
2018-06-19 19:28:59 +08:00
|
|
|
// Registers a target. Not thread safe.
|
|
|
|
static void registerTarget(ExegesisTarget *T);
|
|
|
|
|
2018-06-19 19:58:10 +08:00
|
|
|
virtual ~ExegesisTarget();
|
2018-06-19 19:28:59 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual bool matchesArch(llvm::Triple::ArchType Arch) const = 0;
|
|
|
|
const ExegesisTarget* Next = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace exegesis
|
|
|
|
|
|
|
|
#endif // LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H
|