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
|
|
|
|
|
2011-01-10 12:39:04 +00:00
|
|
|
#include "ARMFrameLowering.h"
|
2007-03-13 01:20:42 +00:00
|
|
|
#include "ARMISelLowering.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "ARMInstrInfo.h"
|
|
|
|
#include "ARMJITInfo.h"
|
2010-05-11 17:31:57 +00:00
|
|
|
#include "ARMSelectionDAGInfo.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "ARMSubtarget.h"
|
2011-01-10 12:39:04 +00:00
|
|
|
#include "Thumb1FrameLowering.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "Thumb1InstrInfo.h"
|
2009-07-02 22:18:33 +00:00
|
|
|
#include "Thumb2InstrInfo.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/ADT/OwningPtr.h"
|
2012-10-08 16:38:25 +00:00
|
|
|
#include "llvm/DataLayout.h"
|
2010-11-15 00:06:54 +00:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetTransformImpl.h"
|
2006-05-14 22:18:28 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2009-06-26 21:28:53 +00:00
|
|
|
class ARMBaseTargetMachine : public LLVMTargetMachine {
|
|
|
|
protected:
|
2009-06-19 01:51:50 +00:00
|
|
|
ARMSubtarget Subtarget;
|
2009-06-26 21:28:53 +00:00
|
|
|
private:
|
2009-06-19 01:51:50 +00:00
|
|
|
ARMJITInfo JITInfo;
|
|
|
|
InstrItineraryData InstrItins;
|
2007-03-13 01:20:42 +00:00
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
public:
|
2011-07-19 06:37:02 +00:00
|
|
|
ARMBaseTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-02 22:16:29 +00:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2008-05-14 01:58:56 +00:00
|
|
|
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
|
2007-01-19 07:51:42 +00:00
|
|
|
virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
2010-09-10 01:29:16 +00:00
|
|
|
virtual const InstrItineraryData *getInstrItineraryData() const {
|
|
|
|
return &InstrItins;
|
2009-06-19 01:51:50 +00:00
|
|
|
}
|
2008-08-17 13:55:10 +00:00
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
// Pass Pipeline Configuration
|
2012-02-04 02:56:59 +00:00
|
|
|
virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2011-11-16 08:38:26 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &MCE);
|
2006-05-14 22:18:28 +00:00
|
|
|
};
|
|
|
|
|
2009-06-26 21:28:53 +00:00
|
|
|
/// ARMTargetMachine - ARM target machine.
|
|
|
|
///
|
|
|
|
class ARMTargetMachine : public ARMBaseTargetMachine {
|
2011-12-20 02:50:00 +00:00
|
|
|
virtual void anchor();
|
2009-06-26 21:28:53 +00:00
|
|
|
ARMInstrInfo InstrInfo;
|
2012-10-08 16:38:25 +00:00
|
|
|
const DataLayout DL; // Calculates type size & alignment
|
2009-06-26 21:28:53 +00:00
|
|
|
ARMTargetLowering TLInfo;
|
2010-05-11 17:31:57 +00:00
|
|
|
ARMSelectionDAGInfo TSInfo;
|
2011-01-10 12:39:04 +00:00
|
|
|
ARMFrameLowering FrameLowering;
|
2012-12-11 23:26:14 +00:00
|
|
|
ARMScalarTargetTransformImpl STTI;
|
2012-10-18 23:22:48 +00:00
|
|
|
VectorTargetTransformImpl VTTI;
|
2010-11-15 00:06:54 +00:00
|
|
|
public:
|
2011-07-19 06:37:02 +00:00
|
|
|
ARMTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-02 22:16:29 +00:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2009-06-26 21:28:53 +00:00
|
|
|
|
|
|
|
virtual const ARMRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
|
|
|
|
2010-04-17 15:26:15 +00:00
|
|
|
virtual const ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return &TLInfo;
|
2009-06-26 21:28:53 +00:00
|
|
|
}
|
|
|
|
|
2010-05-11 17:31:57 +00:00
|
|
|
virtual const ARMSelectionDAGInfo* getSelectionDAGInfo() const {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
2011-01-10 12:39:04 +00:00
|
|
|
virtual const ARMFrameLowering *getFrameLowering() const {
|
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2012-10-18 23:22:48 +00:00
|
|
|
virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
|
|
|
|
return &STTI;
|
|
|
|
}
|
|
|
|
virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
|
|
|
|
return &VTTI;
|
|
|
|
}
|
2009-06-26 21:28:53 +00:00
|
|
|
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
2012-10-08 16:38:25 +00:00
|
|
|
virtual const DataLayout *getDataLayout() const { return &DL; }
|
2009-06-26 21:28:53 +00:00
|
|
|
};
|
|
|
|
|
2007-02-23 03:14:31 +00:00
|
|
|
/// ThumbTargetMachine - Thumb target machine.
|
2009-07-02 22:18:33 +00:00
|
|
|
/// Due to the way architectures are handled, this represents both
|
|
|
|
/// Thumb-1 and Thumb-2.
|
2007-02-23 03:14:31 +00:00
|
|
|
///
|
2009-06-26 21:28:53 +00:00
|
|
|
class ThumbTargetMachine : public ARMBaseTargetMachine {
|
2011-12-20 02:50:00 +00:00
|
|
|
virtual void anchor();
|
2010-03-19 05:25:28 +00:00
|
|
|
// Either Thumb1InstrInfo or Thumb2InstrInfo.
|
|
|
|
OwningPtr<ARMBaseInstrInfo> InstrInfo;
|
2012-10-08 16:38:25 +00:00
|
|
|
const DataLayout DL; // Calculates type size & alignment
|
2009-06-26 21:28:53 +00:00
|
|
|
ARMTargetLowering TLInfo;
|
2010-05-11 17:31:57 +00:00
|
|
|
ARMSelectionDAGInfo TSInfo;
|
2011-01-10 12:39:04 +00:00
|
|
|
// Either Thumb1FrameLowering or ARMFrameLowering.
|
|
|
|
OwningPtr<ARMFrameLowering> FrameLowering;
|
2012-12-11 23:26:14 +00:00
|
|
|
ARMScalarTargetTransformImpl STTI;
|
2012-10-18 23:22:48 +00:00
|
|
|
VectorTargetTransformImpl VTTI;
|
2007-02-23 03:14:31 +00:00
|
|
|
public:
|
2011-07-19 06:37:02 +00:00
|
|
|
ThumbTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-02 22:16:29 +00:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL);
|
2007-02-23 03:14:31 +00:00
|
|
|
|
2009-10-25 19:14:48 +00:00
|
|
|
/// returns either Thumb1RegisterInfo or Thumb2RegisterInfo
|
2009-07-02 22:18:33 +00:00
|
|
|
virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
|
|
|
|
return &InstrInfo->getRegisterInfo();
|
2009-06-26 21:28:53 +00:00
|
|
|
}
|
|
|
|
|
2010-04-17 15:26:15 +00:00
|
|
|
virtual const ARMTargetLowering *getTargetLowering() const {
|
|
|
|
return &TLInfo;
|
2009-06-26 21:28:53 +00:00
|
|
|
}
|
|
|
|
|
2010-05-11 17:31:57 +00:00
|
|
|
virtual const ARMSelectionDAGInfo *getSelectionDAGInfo() const {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
|
|
|
|
2009-07-02 22:18:33 +00:00
|
|
|
/// returns either Thumb1InstrInfo or Thumb2InstrInfo
|
2010-03-19 05:25:28 +00:00
|
|
|
virtual const ARMBaseInstrInfo *getInstrInfo() const {
|
|
|
|
return InstrInfo.get();
|
|
|
|
}
|
2011-01-10 12:39:04 +00:00
|
|
|
/// returns either Thumb1FrameLowering or ARMFrameLowering
|
|
|
|
virtual const ARMFrameLowering *getFrameLowering() const {
|
|
|
|
return FrameLowering.get();
|
2010-11-15 00:06:54 +00:00
|
|
|
}
|
2012-10-18 23:22:48 +00:00
|
|
|
virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
|
|
|
|
return &STTI;
|
|
|
|
}
|
|
|
|
virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
|
|
|
|
return &VTTI;
|
|
|
|
}
|
2012-10-08 16:38:25 +00:00
|
|
|
virtual const DataLayout *getDataLayout() const { return &DL; }
|
2007-02-23 03:14:31 +00:00
|
|
|
};
|
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|