2006-05-15 06:18:28 +08:00
|
|
|
//===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-05-15 06:18:28 +08: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 "ARMInstrInfo.h"
|
2006-08-16 22:43:33 +08:00
|
|
|
#include "ARMFrameInfo.h"
|
2007-07-06 05:15:40 +08:00
|
|
|
#include "ARMJITInfo.h"
|
2007-01-19 15:51:42 +08:00
|
|
|
#include "ARMSubtarget.h"
|
2007-03-13 09:20:42 +08:00
|
|
|
#include "ARMISelLowering.h"
|
2009-07-03 06:18:33 +08:00
|
|
|
#include "Thumb1InstrInfo.h"
|
|
|
|
#include "Thumb2InstrInfo.h"
|
2006-05-15 06:18:28 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class Module;
|
|
|
|
|
2009-06-27 05:28:53 +08:00
|
|
|
class ARMBaseTargetMachine : public LLVMTargetMachine {
|
|
|
|
protected:
|
2009-06-19 09:51:50 +08:00
|
|
|
ARMSubtarget Subtarget;
|
2009-06-27 05:28:53 +08:00
|
|
|
|
|
|
|
private:
|
2009-06-19 09:51:50 +08:00
|
|
|
ARMFrameInfo FrameInfo;
|
|
|
|
ARMJITInfo JITInfo;
|
|
|
|
InstrItineraryData InstrItins;
|
|
|
|
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
|
2007-03-13 09:20:42 +08:00
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
public:
|
2009-07-16 04:24:03 +08:00
|
|
|
ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
|
|
|
bool isThumb);
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2008-05-14 09:58:56 +08:00
|
|
|
virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
|
|
|
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
|
2007-01-19 15:51:42 +08:00
|
|
|
virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
2009-06-27 05:28:53 +08:00
|
|
|
virtual const InstrItineraryData getInstrItineraryData() const {
|
2009-06-19 09:51:50 +08:00
|
|
|
return InstrItins;
|
|
|
|
}
|
2008-08-17 21:55:10 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
2008-08-17 21:55:10 +08:00
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
// Pass Pipeline Configuration
|
2009-04-30 07:29:43 +08:00
|
|
|
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
2009-06-13 17:12:55 +08:00
|
|
|
virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
2009-04-30 07:29:43 +08:00
|
|
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
2009-07-16 06:33:19 +08:00
|
|
|
MachineCodeEmitter &MCE);
|
2009-05-31 04:51:52 +08:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
2009-07-16 06:33:19 +08:00
|
|
|
JITCodeEmitter &MCE);
|
2009-07-06 13:09:34 +08:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
2009-07-16 06:33:19 +08:00
|
|
|
ObjectCodeEmitter &OCE);
|
2009-04-30 07:29:43 +08:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
MachineCodeEmitter &MCE);
|
2009-05-31 04:51:52 +08:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
JITCodeEmitter &MCE);
|
2009-07-06 13:09:34 +08:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
ObjectCodeEmitter &OCE);
|
2006-05-15 06:18:28 +08:00
|
|
|
};
|
|
|
|
|
2009-06-27 05:28:53 +08:00
|
|
|
/// ARMTargetMachine - ARM target machine.
|
|
|
|
///
|
|
|
|
class ARMTargetMachine : public ARMBaseTargetMachine {
|
|
|
|
ARMInstrInfo InstrInfo;
|
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
|
|
|
ARMTargetLowering TLInfo;
|
|
|
|
public:
|
2009-07-16 04:24:03 +08:00
|
|
|
ARMTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
2009-06-27 05:28:53 +08:00
|
|
|
|
|
|
|
virtual const ARMRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return const_cast<ARMTargetLowering*>(&TLInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
|
|
|
|
|
|
|
static unsigned getJITMatchQuality();
|
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
|
|
|
};
|
|
|
|
|
2007-02-23 11:14:31 +08:00
|
|
|
/// ThumbTargetMachine - Thumb target machine.
|
2009-07-03 06:18:33 +08:00
|
|
|
/// Due to the way architectures are handled, this represents both
|
|
|
|
/// Thumb-1 and Thumb-2.
|
2007-02-23 11:14:31 +08:00
|
|
|
///
|
2009-06-27 05:28:53 +08:00
|
|
|
class ThumbTargetMachine : public ARMBaseTargetMachine {
|
2009-07-03 06:18:33 +08:00
|
|
|
ARMBaseInstrInfo *InstrInfo; // either Thumb1InstrInfo or Thumb2InstrInfo
|
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
2009-06-27 05:28:53 +08:00
|
|
|
ARMTargetLowering TLInfo;
|
2007-02-23 11:14:31 +08:00
|
|
|
public:
|
2009-07-16 04:24:03 +08:00
|
|
|
ThumbTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
2007-02-23 11:14:31 +08:00
|
|
|
|
2009-07-03 06:18:33 +08:00
|
|
|
/// returns either Thumb1RegisterInfo of Thumb2RegisterInfo
|
|
|
|
virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo->getRegisterInfo();
|
2009-06-27 05:28:53 +08:00
|
|
|
}
|
|
|
|
|
2009-07-03 06:18:33 +08:00
|
|
|
virtual ARMTargetLowering *getTargetLowering() const {
|
2009-06-27 05:28:53 +08:00
|
|
|
return const_cast<ARMTargetLowering*>(&TLInfo);
|
|
|
|
}
|
|
|
|
|
2009-07-03 06:18:33 +08:00
|
|
|
/// returns either Thumb1InstrInfo or Thumb2InstrInfo
|
|
|
|
virtual const ARMBaseInstrInfo *getInstrInfo() const { return InstrInfo; }
|
2009-06-27 05:28:53 +08:00
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
|
|
|
|
2007-07-06 05:15:40 +08:00
|
|
|
static unsigned getJITMatchQuality();
|
2007-02-23 11:14:31 +08:00
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
|
|
|
};
|
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|