summaryrefslogtreecommitdiff
path: root/include/llvm/Target
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-13 19:38:51 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-13 19:38:51 +0000
commit67d894ea64bc52245abf3f2ba89122a749d99c53 (patch)
tree958d3ced50746f0f856f498fd00fd6807362ce01 /include/llvm/Target
parent4e8e642eaa969db43b2a3ff6955abf3ca8b6789a (diff)
downloadllvm-67d894ea64bc52245abf3f2ba89122a749d99c53.tar.gz
llvm-67d894ea64bc52245abf3f2ba89122a749d99c53.tar.bz2
llvm-67d894ea64bc52245abf3f2ba89122a749d99c53.tar.xz
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
Diffstat (limited to 'include/llvm/Target')
-rw-r--r--include/llvm/Target/TargetRegistry.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h
index 87be7f39e5..9c2d959f58 100644
--- a/include/llvm/Target/TargetRegistry.h
+++ b/include/llvm/Target/TargetRegistry.h
@@ -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);
}
};