2006-05-14 22:18:28 +00:00
|
|
|
//===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-05-14 22:18:28 +00:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the ARM specific subclass of TargetMachine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef ARMTARGETMACHINE_H
|
|
|
|
#define ARMTARGETMACHINE_H
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
|
|
|
#include "llvm/Target/TargetFrameInfo.h"
|
|
|
|
#include "ARMInstrInfo.h"
|
2006-08-16 14:43:33 +00:00
|
|
|
#include "ARMFrameInfo.h"
|
2007-07-05 21:15:40 +00:00
|
|
|
#include "ARMJITInfo.h"
|
2007-01-19 07:51:42 +00:00
|
|
|
#include "ARMSubtarget.h"
|
2007-03-13 01:20:42 +00:00
|
|
|
#include "ARMISelLowering.h"
|
2006-05-14 22:18:28 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class Module;
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
class ARMTargetMachine : public LLVMTargetMachine {
|
2007-01-19 07:51:42 +00:00
|
|
|
ARMSubtarget Subtarget;
|
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
|
|
|
ARMInstrInfo InstrInfo;
|
|
|
|
ARMFrameInfo FrameInfo;
|
2007-07-05 21:15:40 +00:00
|
|
|
ARMJITInfo JITInfo;
|
2007-03-13 01:20:42 +00:00
|
|
|
ARMTargetLowering TLInfo;
|
2008-10-30 16:10:54 +00:00
|
|
|
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
|
2007-03-13 01:20:42 +00:00
|
|
|
|
2008-08-17 13:55:10 +00:00
|
|
|
protected:
|
|
|
|
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
|
|
|
// set this functions to ctor pointer at startup time if they are linked in.
|
2008-08-21 00:14:44 +00:00
|
|
|
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
|
2009-02-24 08:30:20 +00:00
|
|
|
ARMTargetMachine &tm,
|
2009-03-25 01:47:28 +00:00
|
|
|
bool fast, bool verbose);
|
2008-08-17 13:55:10 +00:00
|
|
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
public:
|
2007-02-23 03:14:31 +00:00
|
|
|
ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2008-05-14 01:58:56 +00:00
|
|
|
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
|
|
|
virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
|
|
|
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
|
|
|
|
virtual const ARMRegisterInfo *getRegisterInfo() const {
|
2006-05-14 22:18:28 +00:00
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
2007-01-19 07:51:42 +00:00
|
|
|
virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
2008-08-17 13:55:10 +00:00
|
|
|
virtual ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return const_cast<ARMTargetLowering*>(&TLInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
|
|
|
AsmPrinterCtor = F;
|
2007-03-13 01:20:42 +00:00
|
|
|
}
|
2008-08-17 13:55:10 +00:00
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
2007-07-05 21:15:40 +00:00
|
|
|
static unsigned getJITMatchQuality();
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
2008-08-17 13:55:10 +00:00
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
// Pass Pipeline Configuration
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
|
|
|
|
virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast);
|
2008-08-17 13:55:10 +00:00
|
|
|
virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
|
2009-03-25 01:47:28 +00:00
|
|
|
bool Verbose, raw_ostream &Out);
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, bool Fast,
|
2007-07-20 21:56:13 +00:00
|
|
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
|
2007-07-20 21:56:13 +00:00
|
|
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
2006-05-14 22:18:28 +00:00
|
|
|
};
|
|
|
|
|
2007-02-23 03:14:31 +00:00
|
|
|
/// ThumbTargetMachine - Thumb target machine.
|
|
|
|
///
|
|
|
|
class ThumbTargetMachine : public ARMTargetMachine {
|
|
|
|
public:
|
|
|
|
ThumbTargetMachine(const Module &M, const std::string &FS);
|
|
|
|
|
2007-07-05 21:15:40 +00:00
|
|
|
static unsigned getJITMatchQuality();
|
2007-02-23 03:14:31 +00:00
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
|
|
|
};
|
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|