mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
TargetRegistry: Reorganize AsmPrinter construction so that clients pass in the
TargetAsmInfo. This eliminates a dependency on TargetMachine.h from TargetRegistry.h, which technically was a layering violation. - Clients probably can only sensibly pass in the same TargetAsmInfo as the TargetMachine has, but there are only limited clients of this API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,9 +20,6 @@
|
||||
#define LLVM_TARGET_TARGETREGISTRY_H
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
// FIXME: We shouldn't need this header, but we need it until there is a
|
||||
// different interface to get the TargetAsmInfo.
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@@ -30,6 +27,7 @@ namespace llvm {
|
||||
class FunctionPass;
|
||||
class MCAsmParser;
|
||||
class Module;
|
||||
class TargetAsmInfo;
|
||||
class TargetAsmParser;
|
||||
class TargetMachine;
|
||||
class formatted_raw_ostream;
|
||||
@@ -53,11 +51,12 @@ namespace llvm {
|
||||
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
|
||||
const std::string &TT,
|
||||
const std::string &Features);
|
||||
typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &,
|
||||
TargetMachine &,
|
||||
bool);
|
||||
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &,
|
||||
MCAsmParser &);
|
||||
typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS,
|
||||
TargetMachine &TM,
|
||||
const TargetAsmInfo *TAI,
|
||||
bool VerboseAsm);
|
||||
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T,
|
||||
MCAsmParser &P);
|
||||
private:
|
||||
/// Next - The next registered target in the linked list, maintained by the
|
||||
/// TargetRegistry.
|
||||
@@ -141,11 +140,12 @@ namespace llvm {
|
||||
|
||||
/// createAsmPrinter - Create a target specific assembly printer pass.
|
||||
FunctionPass *createAsmPrinter(formatted_raw_ostream &OS,
|
||||
TargetMachine &M,
|
||||
TargetMachine &TM,
|
||||
const TargetAsmInfo *TAI,
|
||||
bool Verbose) const {
|
||||
if (!AsmPrinterCtorFn)
|
||||
return 0;
|
||||
return AsmPrinterCtorFn(OS, M, Verbose);
|
||||
return AsmPrinterCtorFn(OS, TM, TAI, Verbose);
|
||||
}
|
||||
|
||||
/// createAsmParser - Create a target specific assembly parser.
|
||||
@@ -409,8 +409,9 @@ namespace llvm {
|
||||
private:
|
||||
static FunctionPass *Allocator(formatted_raw_ostream &OS,
|
||||
TargetMachine &TM,
|
||||
const TargetAsmInfo *TAI,
|
||||
bool Verbose) {
|
||||
return new AsmPrinterImpl(OS, TM, TM.getTargetAsmInfo(), Verbose);
|
||||
return new AsmPrinterImpl(OS, TM, TAI, Verbose);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user