2012-02-18 20:03:15 +08:00
|
|
|
//===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-11 08:09:42 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-11 08:09:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-17 12:55:41 +08:00
|
|
|
// This file declares the PowerPC specific subclass of TargetMachine.
|
2004-08-11 08:09:42 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
|
|
|
|
#define LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
|
2004-08-11 08:09:42 +08:00
|
|
|
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "PPCInstrInfo.h"
|
|
|
|
#include "PPCSubtarget.h"
|
2013-01-02 19:36:10 +08:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
2005-10-15 07:44:05 +08:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2004-08-11 08:09:42 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2016-05-19 00:00:24 +08:00
|
|
|
/// Common code between 32-bit and 64-bit PowerPC targets.
|
2006-06-16 09:37:27 +08:00
|
|
|
///
|
2017-10-13 06:57:28 +08:00
|
|
|
class PPCTargetMachine final : public LLVMTargetMachine {
|
2015-02-17 14:45:15 +08:00
|
|
|
public:
|
|
|
|
enum PPCABI { PPC_ABI_UNKNOWN, PPC_ABI_ELFv1, PPC_ABI_ELFv2 };
|
|
|
|
private:
|
2014-11-13 17:26:31 +08:00
|
|
|
std::unique_ptr<TargetLoweringObjectFile> TLOF;
|
2015-02-17 14:45:15 +08:00
|
|
|
PPCABI TargetABI;
|
2015-07-12 10:33:57 +08:00
|
|
|
|
2014-10-06 14:45:36 +08:00
|
|
|
mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap;
|
2007-01-24 11:41:36 +08:00
|
|
|
|
2005-10-15 07:44:05 +08:00
|
|
|
public:
|
2015-06-12 03:41:26 +08:00
|
|
|
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
2016-05-19 06:04:49 +08:00
|
|
|
StringRef FS, const TargetOptions &Options,
|
2017-08-03 10:16:21 +08:00
|
|
|
Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
|
|
|
|
CodeGenOpt::Level OL, bool JIT);
|
2005-10-16 13:39:50 +08:00
|
|
|
|
2014-11-21 07:37:18 +08:00
|
|
|
~PPCTargetMachine() override;
|
|
|
|
|
2014-10-06 14:45:36 +08:00
|
|
|
const PPCSubtarget *getSubtargetImpl(const Function &F) const override;
|
2017-07-26 06:21:08 +08:00
|
|
|
// DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
|
|
|
|
// subtargets are per-function entities based on the target-specific
|
|
|
|
// attributes of each function.
|
2017-07-01 03:49:05 +08:00
|
|
|
const PPCSubtarget *getSubtargetImpl() const = delete;
|
2008-08-17 21:54:28 +08:00
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
// Pass Pipeline Configuration
|
2014-04-29 15:57:37 +08:00
|
|
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
2013-01-26 07:05:59 +08:00
|
|
|
|
(Re-landing) Expose a TargetMachine::getTargetTransformInfo function
Re-land r321234. It had to be reverted because it broke the shared
library build. The shared library build broke because there was a
missing LLVMBuild dependency from lib/Passes (which calls
TargetMachine::getTargetIRAnalysis) to lib/Target. As far as I can
tell, this problem was always there but was somehow masked
before (perhaps because TargetMachine::getTargetIRAnalysis was a
virtual function).
Original commit message:
This makes the TargetMachine interface a bit simpler. We still need
the std::function in TargetIRAnalysis to avoid having to add a
dependency from Analysis to Target.
See discussion:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html
I avoided adding all of the backend owners to this review since the
change is simple, but let me know if you feel differently about this.
Reviewers: echristo, MatzeB, hfinkel
Reviewed By: hfinkel
Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits
Differential Revision: https://reviews.llvm.org/D41464
llvm-svn: 321375
2017-12-23 02:21:59 +08:00
|
|
|
TargetTransformInfo getTargetTransformInfo(const Function &F) override;
|
2015-01-31 19:17:59 +08:00
|
|
|
|
2014-11-13 17:26:31 +08:00
|
|
|
TargetLoweringObjectFile *getObjFileLowering() const override {
|
|
|
|
return TLOF.get();
|
|
|
|
}
|
2015-02-17 14:45:15 +08:00
|
|
|
bool isELFv2ABI() const { return TargetABI == PPC_ABI_ELFv2; }
|
|
|
|
bool isPPC64() const {
|
2015-06-16 23:44:21 +08:00
|
|
|
const Triple &TT = getTargetTriple();
|
2015-02-17 14:45:15 +08:00
|
|
|
return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
|
|
|
|
};
|
2017-06-01 02:41:23 +08:00
|
|
|
|
|
|
|
bool isMachineVerifierClean() const override {
|
|
|
|
return false;
|
|
|
|
}
|
2004-08-11 08:09:42 +08:00
|
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|