1 //===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Sparc specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef SPARCTARGETMACHINE_H
15 #define SPARCTARGETMACHINE_H
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetData.h"
19 #include "llvm/Target/TargetFrameInfo.h"
20 #include "SparcInstrInfo.h"
21 #include "SparcSubtarget.h"
22 #include "SparcISelLowering.h"
28 class SparcTargetMachine : public LLVMTargetMachine {
29 const TargetData DataLayout; // Calculates type size & alignment
30 SparcSubtarget Subtarget;
31 SparcTargetLowering TLInfo;
32 SparcInstrInfo InstrInfo;
33 TargetFrameInfo FrameInfo;
36 virtual const TargetAsmInfo *createTargetAsmInfo() const;
38 // To avoid having target depend on the asmprinter stuff libraries, asmprinter
39 // set this functions to ctor pointer at startup time if they are linked in.
40 typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
43 static AsmPrinterCtorFn AsmPrinterCtor;
46 SparcTargetMachine(const Target &T, const Module &M, const std::string &FS);
48 virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
49 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
50 virtual const SparcSubtarget *getSubtargetImpl() const{ return &Subtarget; }
51 virtual const SparcRegisterInfo *getRegisterInfo() const {
52 return &InstrInfo.getRegisterInfo();
54 virtual SparcTargetLowering* getTargetLowering() const {
55 return const_cast<SparcTargetLowering*>(&TLInfo);
57 virtual const TargetData *getTargetData() const { return &DataLayout; }
58 static unsigned getModuleMatchQuality(const Module &M);
60 // Pass Pipeline Configuration
61 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
62 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
63 virtual bool addAssemblyEmitter(PassManagerBase &PM,
64 CodeGenOpt::Level OptLevel,
65 bool Verbose, formatted_raw_ostream &Out);
67 static void registerAsmPrinter(AsmPrinterCtorFn F) {
72 } // end namespace llvm