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 "ARMInstrInfo.h"
|
2010-09-28 02:31:37 +08:00
|
|
|
#include "ARMELFWriterInfo.h"
|
2011-01-10 20:39:04 +08:00
|
|
|
#include "ARMFrameLowering.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"
|
2010-05-12 01:31:57 +08:00
|
|
|
#include "ARMSelectionDAGInfo.h"
|
2009-07-03 06:18:33 +08:00
|
|
|
#include "Thumb1InstrInfo.h"
|
2011-01-10 20:39:04 +08:00
|
|
|
#include "Thumb1FrameLowering.h"
|
2009-07-03 06:18:33 +08:00
|
|
|
#include "Thumb2InstrInfo.h"
|
2010-11-15 08:06:54 +08:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
|
|
|
#include "llvm/MC/MCStreamer.h"
|
2010-03-19 13:25:28 +08:00
|
|
|
#include "llvm/ADT/OwningPtr.h"
|
2006-05-15 06:18:28 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
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
|
|
|
ARMJITInfo JITInfo;
|
|
|
|
InstrItineraryData InstrItins;
|
2007-03-13 09:20:42 +08:00
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
public:
|
2011-07-19 14:37:02 +08:00
|
|
|
ARMBaseTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 15:51:56 +08:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-03 06:16:29 +08:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 16:38:26 +08:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2008-05-14 09:58:56 +08:00
|
|
|
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
|
2007-01-19 15:51:42 +08:00
|
|
|
virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
2010-09-10 09:29:16 +08:00
|
|
|
virtual const InstrItineraryData *getInstrItineraryData() const {
|
|
|
|
return &InstrItins;
|
2009-06-19 09:51:50 +08:00
|
|
|
}
|
2008-08-17 21:55:10 +08:00
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
// Pass Pipeline Configuration
|
2011-11-16 16:38:26 +08:00
|
|
|
virtual bool addPreISel(PassManagerBase &PM);
|
|
|
|
virtual bool addInstSelector(PassManagerBase &PM);
|
|
|
|
virtual bool addPreRegAlloc(PassManagerBase &PM);
|
|
|
|
virtual bool addPreSched2(PassManagerBase &PM);
|
|
|
|
virtual bool addPreEmitPass(PassManagerBase &PM);
|
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &MCE);
|
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;
|
2010-10-04 02:59:45 +08:00
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
|
|
|
ARMELFWriterInfo ELFWriterInfo;
|
2009-06-27 05:28:53 +08:00
|
|
|
ARMTargetLowering TLInfo;
|
2010-05-12 01:31:57 +08:00
|
|
|
ARMSelectionDAGInfo TSInfo;
|
2011-01-10 20:39:04 +08:00
|
|
|
ARMFrameLowering FrameLowering;
|
2010-11-15 08:06:54 +08:00
|
|
|
public:
|
2011-07-19 14:37:02 +08:00
|
|
|
ARMTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 15:51:56 +08:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-03 06:16:29 +08:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 16:38:26 +08:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2009-06-27 05:28:53 +08:00
|
|
|
|
|
|
|
virtual const ARMRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
|
|
|
|
2010-04-17 23:26:15 +08:00
|
|
|
virtual const ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return &TLInfo;
|
2009-06-27 05:28:53 +08:00
|
|
|
}
|
|
|
|
|
2010-05-12 01:31:57 +08:00
|
|
|
virtual const ARMSelectionDAGInfo* getSelectionDAGInfo() const {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
2011-01-10 20:39:04 +08:00
|
|
|
virtual const ARMFrameLowering *getFrameLowering() const {
|
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2010-05-12 01:31:57 +08:00
|
|
|
|
2009-06-27 05:28:53 +08:00
|
|
|
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
2010-10-04 02:59:45 +08:00
|
|
|
virtual const ARMELFWriterInfo *getELFWriterInfo() const {
|
|
|
|
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
|
|
|
|
}
|
2009-06-27 05:28:53 +08:00
|
|
|
};
|
|
|
|
|
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 {
|
2010-03-19 13:25:28 +08:00
|
|
|
// Either Thumb1InstrInfo or Thumb2InstrInfo.
|
|
|
|
OwningPtr<ARMBaseInstrInfo> InstrInfo;
|
2010-10-04 02:59:45 +08:00
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
|
|
|
ARMELFWriterInfo ELFWriterInfo;
|
2009-06-27 05:28:53 +08:00
|
|
|
ARMTargetLowering TLInfo;
|
2010-05-12 01:31:57 +08:00
|
|
|
ARMSelectionDAGInfo TSInfo;
|
2011-01-10 20:39:04 +08:00
|
|
|
// Either Thumb1FrameLowering or ARMFrameLowering.
|
|
|
|
OwningPtr<ARMFrameLowering> FrameLowering;
|
2007-02-23 11:14:31 +08:00
|
|
|
public:
|
2011-07-19 14:37:02 +08:00
|
|
|
ThumbTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 15:51:56 +08:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-03 06:16:29 +08:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 16:38:26 +08:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2007-02-23 11:14:31 +08:00
|
|
|
|
2009-10-26 03:14:48 +08:00
|
|
|
/// returns either Thumb1RegisterInfo or Thumb2RegisterInfo
|
2009-07-03 06:18:33 +08:00
|
|
|
virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo->getRegisterInfo();
|
2009-06-27 05:28:53 +08:00
|
|
|
}
|
|
|
|
|
2010-04-17 23:26:15 +08:00
|
|
|
virtual const ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return &TLInfo;
|
2009-06-27 05:28:53 +08:00
|
|
|
}
|
|
|
|
|
2010-05-12 01:31:57 +08:00
|
|
|
virtual const ARMSelectionDAGInfo *getSelectionDAGInfo() const {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
|
|
|
|
2009-07-03 06:18:33 +08:00
|
|
|
/// returns either Thumb1InstrInfo or Thumb2InstrInfo
|
2010-03-19 13:25:28 +08:00
|
|
|
virtual const ARMBaseInstrInfo *getInstrInfo() const {
|
|
|
|
return InstrInfo.get();
|
|
|
|
}
|
2011-01-10 20:39:04 +08:00
|
|
|
/// returns either Thumb1FrameLowering or ARMFrameLowering
|
|
|
|
virtual const ARMFrameLowering *getFrameLowering() const {
|
|
|
|
return FrameLowering.get();
|
2010-11-15 08:06:54 +08:00
|
|
|
}
|
2009-06-27 05:28:53 +08:00
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
2010-10-04 02:59:45 +08:00
|
|
|
virtual const ARMELFWriterInfo *getELFWriterInfo() const {
|
|
|
|
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
|
|
|
|
}
|
2007-02-23 11:14:31 +08:00
|
|
|
};
|
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|