mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Address some review comments on TargetRegistry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75753 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,7 +32,11 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
/// For registration purposes, this is a POD type so that targets can be
|
/// For registration purposes, this is a POD type so that targets can be
|
||||||
/// registered without the use of static constructors.
|
/// registered without the use of static constructors.
|
||||||
struct Target {
|
///
|
||||||
|
/// Targets should implement a single global instance of this class (which
|
||||||
|
/// will be zero initialized), and pass that instance to the TargetRegistry as
|
||||||
|
/// part of their initialization.
|
||||||
|
class Target {
|
||||||
private:
|
private:
|
||||||
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
|
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
|
||||||
typedef unsigned (*ModuleMatchQualityFnTy)(const Module &M);
|
typedef unsigned (*ModuleMatchQualityFnTy)(const Module &M);
|
||||||
@@ -44,7 +48,7 @@ namespace llvm {
|
|||||||
TargetMachine &,
|
TargetMachine &,
|
||||||
bool);
|
bool);
|
||||||
|
|
||||||
friend class TargetRegistry;
|
friend struct TargetRegistry;
|
||||||
|
|
||||||
/// Next - The next registered target in the linked list, maintained by the
|
/// Next - The next registered target in the linked list, maintained by the
|
||||||
/// TargetRegistry.
|
/// TargetRegistry.
|
||||||
@@ -132,6 +136,10 @@ namespace llvm {
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// RegisterTarget - Register the given target.
|
/// RegisterTarget - Register the given target.
|
||||||
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
///
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Name - The target name. This should be a static string.
|
/// @param Name - The target name. This should be a static string.
|
||||||
@@ -153,6 +161,10 @@ namespace llvm {
|
|||||||
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct a TargetMachine for the target.
|
/// @param Fn - A function to construct a TargetMachine for the target.
|
||||||
static void RegisterTargetMachine(Target &T,
|
static void RegisterTargetMachine(Target &T,
|
||||||
@@ -164,6 +176,10 @@ namespace llvm {
|
|||||||
/// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
|
/// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
|
||||||
/// target.
|
/// target.
|
||||||
///
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct an AsmPrinter for the target.
|
/// @param Fn - A function to construct an AsmPrinter for the target.
|
||||||
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
|
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
|
||||||
|
@@ -11,9 +11,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// FIXME: Worry about locking? In general everything should be registered at
|
// Clients are responsible for avoid race conditions in registration.
|
||||||
// startup.
|
|
||||||
|
|
||||||
static Target *FirstTarget = 0;
|
static Target *FirstTarget = 0;
|
||||||
|
|
||||||
const Target *
|
const Target *
|
||||||
|
Reference in New Issue
Block a user