2012-02-17 09:55:11 +01:00
|
|
|
//===-- MipsTargetMachine.cpp - Define TargetMachine for Mips -------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
2011-04-15 23:51:11 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
|
|
|
// Implements the info about Mips target spec.
|
|
|
|
//
|
2011-04-15 23:51:11 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
|
2017-06-06 13:49:48 +02:00
|
|
|
#include "MipsTargetMachine.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "MCTargetDesc/MipsABIInfo.h"
|
|
|
|
#include "MCTargetDesc/MipsMCTargetDesc.h"
|
2012-03-17 19:46:09 +01:00
|
|
|
#include "Mips.h"
|
2014-01-07 12:48:04 +01:00
|
|
|
#include "Mips16ISelDAGToDAG.h"
|
2013-04-09 21:46:01 +02:00
|
|
|
#include "MipsSEISelDAGToDAG.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "MipsSubtarget.h"
|
2014-11-13 10:26:31 +01:00
|
|
|
#include "MipsTargetObjectFile.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "llvm/ADT/Optional.h"
|
|
|
|
#include "llvm/ADT/STLExtras.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
2013-04-09 21:46:01 +02:00
|
|
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "llvm/CodeGen/BasicTTIImpl.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2012-02-03 06:12:41 +01:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2016-05-10 05:21:59 +02:00
|
|
|
#include "llvm/CodeGen/TargetPassConfig.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "llvm/IR/Attributes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
|
|
|
#include "llvm/Support/CodeGen.h"
|
2013-04-09 21:46:01 +02:00
|
|
|
#include "llvm/Support/Debug.h"
|
2011-08-24 20:08:43 +02:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2014-01-07 12:48:04 +01:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2017-02-01 02:22:51 +01:00
|
|
|
#include "llvm/Target/TargetOptions.h"
|
|
|
|
#include <string>
|
2015-03-14 09:34:25 +01:00
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 00:55:11 +02:00
|
|
|
#define DEBUG_TYPE "mips"
|
|
|
|
|
2009-07-25 08:49:55 +02:00
|
|
|
extern "C" void LLVMInitializeMipsTarget() {
|
|
|
|
// Register the target.
|
2016-10-10 01:00:34 +02:00
|
|
|
RegisterTargetMachine<MipsebTargetMachine> X(getTheMipsTarget());
|
|
|
|
RegisterTargetMachine<MipselTargetMachine> Y(getTheMipselTarget());
|
|
|
|
RegisterTargetMachine<MipsebTargetMachine> A(getTheMips64Target());
|
|
|
|
RegisterTargetMachine<MipselTargetMachine> B(getTheMips64elTarget());
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|
|
|
|
|
2015-06-11 17:34:59 +02:00
|
|
|
static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
2015-03-12 01:07:24 +01:00
|
|
|
const TargetOptions &Options,
|
|
|
|
bool isLittle) {
|
2017-02-01 02:22:51 +01:00
|
|
|
std::string Ret;
|
2015-09-15 18:17:27 +02:00
|
|
|
MipsABIInfo ABI = MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions);
|
2015-01-26 20:03:15 +01:00
|
|
|
|
|
|
|
// There are both little and big endian mips.
|
|
|
|
if (isLittle)
|
|
|
|
Ret += "e";
|
|
|
|
else
|
|
|
|
Ret += "E";
|
|
|
|
|
2016-07-19 12:49:03 +02:00
|
|
|
if (ABI.IsO32())
|
|
|
|
Ret += "-m:m";
|
|
|
|
else
|
|
|
|
Ret += "-m:e";
|
2015-01-26 20:03:15 +01:00
|
|
|
|
|
|
|
// Pointers are 32 bit on some ABIs.
|
|
|
|
if (!ABI.IsN64())
|
|
|
|
Ret += "-p:32:32";
|
|
|
|
|
2015-07-07 23:31:54 +02:00
|
|
|
// 8 and 16 bit integers only need to have natural alignment, but try to
|
2015-01-26 20:03:15 +01:00
|
|
|
// align them to 32 bits. 64 bit integers have natural alignment.
|
|
|
|
Ret += "-i8:8:32-i16:16:32-i64:64";
|
|
|
|
|
|
|
|
// 32 bit registers are always available and the stack is at least 64 bit
|
|
|
|
// aligned. On N64 64 bit registers are also available and the stack is
|
|
|
|
// 128 bit aligned.
|
|
|
|
if (ABI.IsN64() || ABI.IsN32())
|
|
|
|
Ret += "-n32:64-S128";
|
|
|
|
else
|
|
|
|
Ret += "-n32-S64";
|
|
|
|
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
2017-08-03 04:16:21 +02:00
|
|
|
static Reloc::Model getEffectiveRelocModel(bool JIT,
|
2016-05-19 00:04:49 +02:00
|
|
|
Optional<Reloc::Model> RM) {
|
2017-08-03 04:16:21 +02:00
|
|
|
if (!RM.hasValue() || JIT)
|
2016-05-19 00:04:49 +02:00
|
|
|
return Reloc::Static;
|
|
|
|
return *RM;
|
|
|
|
}
|
|
|
|
|
2017-08-03 04:16:21 +02:00
|
|
|
static CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM) {
|
|
|
|
if (CM)
|
|
|
|
return *CM;
|
|
|
|
return CodeModel::Small;
|
|
|
|
}
|
|
|
|
|
2007-08-28 07:13:42 +02:00
|
|
|
// On function prologue, the stack is created by decrementing
|
|
|
|
// its pointer. Once decremented, all references are done with positive
|
2010-11-15 01:06:54 +01:00
|
|
|
// offset from the stack/frame pointer, using StackGrowsUp enables
|
2008-08-06 08:14:43 +02:00
|
|
|
// an easier handling.
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
// Using CodeModel::Large enables different CALL behavior.
|
2015-06-11 21:41:26 +02:00
|
|
|
MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
|
2014-07-02 02:54:07 +02:00
|
|
|
StringRef CPU, StringRef FS,
|
|
|
|
const TargetOptions &Options,
|
2016-05-19 00:04:49 +02:00
|
|
|
Optional<Reloc::Model> RM,
|
2017-08-03 04:16:21 +02:00
|
|
|
Optional<CodeModel::Model> CM,
|
|
|
|
CodeGenOpt::Level OL, bool JIT,
|
2016-05-19 00:04:49 +02:00
|
|
|
bool isLittle)
|
2017-10-13 00:57:28 +02:00
|
|
|
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT,
|
|
|
|
CPU, FS, Options, getEffectiveRelocModel(JIT, RM),
|
|
|
|
getEffectiveCodeModel(CM), OL),
|
2017-02-01 02:22:51 +01:00
|
|
|
isLittle(isLittle), TLOF(llvm::make_unique<MipsTargetObjectFile>()),
|
2015-09-15 18:17:27 +02:00
|
|
|
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
|
2017-08-14 23:49:38 +02:00
|
|
|
Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this,
|
|
|
|
Options.StackAlignmentOverride),
|
2015-06-11 21:41:26 +02:00
|
|
|
NoMips16Subtarget(TT, CPU, FS.empty() ? "-mips16" : FS.str() + ",-mips16",
|
2017-08-14 23:49:38 +02:00
|
|
|
isLittle, *this, Options.StackAlignmentOverride),
|
2015-06-11 21:41:26 +02:00
|
|
|
Mips16Subtarget(TT, CPU, FS.empty() ? "+mips16" : FS.str() + ",+mips16",
|
2017-08-14 23:49:38 +02:00
|
|
|
isLittle, *this, Options.StackAlignmentOverride) {
|
2014-07-19 01:41:32 +02:00
|
|
|
Subtarget = &DefaultSubtarget;
|
2013-05-13 03:16:13 +02:00
|
|
|
initAsmInfo();
|
2013-04-09 21:46:01 +02:00
|
|
|
}
|
|
|
|
|
2017-02-01 02:22:51 +01:00
|
|
|
MipsTargetMachine::~MipsTargetMachine() = default;
|
2014-11-21 00:37:18 +01:00
|
|
|
|
2017-02-01 02:22:51 +01:00
|
|
|
void MipsebTargetMachine::anchor() {}
|
2011-12-20 03:50:00 +01:00
|
|
|
|
2015-06-11 21:41:26 +02:00
|
|
|
MipsebTargetMachine::MipsebTargetMachine(const Target &T, const Triple &TT,
|
|
|
|
StringRef CPU, StringRef FS,
|
|
|
|
const TargetOptions &Options,
|
2016-05-19 00:04:49 +02:00
|
|
|
Optional<Reloc::Model> RM,
|
2017-08-03 04:16:21 +02:00
|
|
|
Optional<CodeModel::Model> CM,
|
|
|
|
CodeGenOpt::Level OL, bool JIT)
|
|
|
|
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, JIT, false) {}
|
2011-09-21 05:00:58 +02:00
|
|
|
|
2017-02-01 02:22:51 +01:00
|
|
|
void MipselTargetMachine::anchor() {}
|
2011-12-20 03:50:00 +01:00
|
|
|
|
2015-06-11 21:41:26 +02:00
|
|
|
MipselTargetMachine::MipselTargetMachine(const Target &T, const Triple &TT,
|
|
|
|
StringRef CPU, StringRef FS,
|
|
|
|
const TargetOptions &Options,
|
2016-05-19 00:04:49 +02:00
|
|
|
Optional<Reloc::Model> RM,
|
2017-08-03 04:16:21 +02:00
|
|
|
Optional<CodeModel::Model> CM,
|
|
|
|
CodeGenOpt::Level OL, bool JIT)
|
|
|
|
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, JIT, true) {}
|
2008-06-04 03:45:25 +02:00
|
|
|
|
2014-09-26 03:44:08 +02:00
|
|
|
const MipsSubtarget *
|
2014-09-26 04:57:05 +02:00
|
|
|
MipsTargetMachine::getSubtargetImpl(const Function &F) const {
|
2015-02-14 03:37:48 +01:00
|
|
|
Attribute CPUAttr = F.getFnAttribute("target-cpu");
|
|
|
|
Attribute FSAttr = F.getFnAttribute("target-features");
|
2014-09-26 03:44:08 +02:00
|
|
|
|
|
|
|
std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
|
|
|
|
? CPUAttr.getValueAsString().str()
|
|
|
|
: TargetCPU;
|
|
|
|
std::string FS = !FSAttr.hasAttribute(Attribute::None)
|
|
|
|
? FSAttr.getValueAsString().str()
|
|
|
|
: TargetFS;
|
|
|
|
bool hasMips16Attr =
|
2015-02-14 03:37:48 +01:00
|
|
|
!F.getFnAttribute("mips16").hasAttribute(Attribute::None);
|
2014-09-26 03:44:08 +02:00
|
|
|
bool hasNoMips16Attr =
|
2015-02-14 03:37:48 +01:00
|
|
|
!F.getFnAttribute("nomips16").hasAttribute(Attribute::None);
|
2014-09-26 03:44:08 +02:00
|
|
|
|
2017-05-22 14:47:41 +02:00
|
|
|
bool HasMicroMipsAttr =
|
|
|
|
!F.getFnAttribute("micromips").hasAttribute(Attribute::None);
|
|
|
|
bool HasNoMicroMipsAttr =
|
|
|
|
!F.getFnAttribute("nomicromips").hasAttribute(Attribute::None);
|
|
|
|
|
2014-09-29 23:57:54 +02:00
|
|
|
// FIXME: This is related to the code below to reset the target options,
|
|
|
|
// we need to know whether or not the soft float flag is set on the
|
2015-05-07 12:29:52 +02:00
|
|
|
// function, so we can enable it as a subtarget feature.
|
2015-05-12 03:26:05 +02:00
|
|
|
bool softFloat =
|
|
|
|
F.hasFnAttribute("use-soft-float") &&
|
|
|
|
F.getFnAttribute("use-soft-float").getValueAsString() == "true";
|
2014-09-29 23:57:54 +02:00
|
|
|
|
2014-09-26 03:44:08 +02:00
|
|
|
if (hasMips16Attr)
|
|
|
|
FS += FS.empty() ? "+mips16" : ",+mips16";
|
|
|
|
else if (hasNoMips16Attr)
|
|
|
|
FS += FS.empty() ? "-mips16" : ",-mips16";
|
2017-05-22 14:47:41 +02:00
|
|
|
if (HasMicroMipsAttr)
|
|
|
|
FS += FS.empty() ? "+micromips" : ",+micromips";
|
|
|
|
else if (HasNoMicroMipsAttr)
|
|
|
|
FS += FS.empty() ? "-micromips" : ",-micromips";
|
2015-05-07 12:29:52 +02:00
|
|
|
if (softFloat)
|
|
|
|
FS += FS.empty() ? "+soft-float" : ",+soft-float";
|
2014-09-26 03:44:08 +02:00
|
|
|
|
2015-05-07 12:29:52 +02:00
|
|
|
auto &I = SubtargetMap[CPU + FS];
|
2014-09-26 03:44:08 +02:00
|
|
|
if (!I) {
|
|
|
|
// This needs to be done before we create a new subtarget since any
|
|
|
|
// creation will depend on the TM and the code generation flags on the
|
|
|
|
// function that reside in TargetOptions.
|
|
|
|
resetTargetOptions(F);
|
2017-09-22 10:52:03 +02:00
|
|
|
I = llvm::make_unique<MipsSubtarget>(TargetTriple, CPU, FS, isLittle, *this,
|
|
|
|
Options.StackAlignmentOverride);
|
2014-09-26 03:44:08 +02:00
|
|
|
}
|
|
|
|
return I.get();
|
|
|
|
}
|
|
|
|
|
2014-07-19 01:41:32 +02:00
|
|
|
void MipsTargetMachine::resetSubtarget(MachineFunction *MF) {
|
|
|
|
DEBUG(dbgs() << "resetSubtarget\n");
|
2014-09-26 03:44:08 +02:00
|
|
|
|
2017-12-15 23:22:58 +01:00
|
|
|
Subtarget = const_cast<MipsSubtarget *>(getSubtargetImpl(MF->getFunction()));
|
2014-08-05 04:39:49 +02:00
|
|
|
MF->setSubtarget(Subtarget);
|
2014-07-19 01:41:32 +02:00
|
|
|
}
|
|
|
|
|
2012-02-03 06:12:41 +01:00
|
|
|
namespace {
|
2017-02-01 02:22:51 +01:00
|
|
|
|
2012-02-03 06:12:41 +01:00
|
|
|
/// Mips Code Generator Pass Configuration Options.
|
|
|
|
class MipsPassConfig : public TargetPassConfig {
|
|
|
|
public:
|
2017-05-30 23:36:41 +02:00
|
|
|
MipsPassConfig(MipsTargetMachine &TM, PassManagerBase &PM)
|
2017-09-22 10:52:03 +02:00
|
|
|
: TargetPassConfig(TM, PM) {
|
2013-10-07 21:13:53 +02:00
|
|
|
// The current implementation of long branch pass requires a scratch
|
|
|
|
// register ($at) to be available before branch instructions. Tail merging
|
|
|
|
// can break this requirement, so disable it when long branch pass is
|
|
|
|
// enabled.
|
|
|
|
EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
|
|
|
|
}
|
2012-02-03 06:12:41 +01:00
|
|
|
|
|
|
|
MipsTargetMachine &getMipsTargetMachine() const {
|
|
|
|
return getTM<MipsTargetMachine>();
|
|
|
|
}
|
|
|
|
|
|
|
|
const MipsSubtarget &getMipsSubtarget() const {
|
|
|
|
return *getMipsTargetMachine().getSubtargetImpl();
|
|
|
|
}
|
|
|
|
|
2014-04-29 09:58:02 +02:00
|
|
|
void addIRPasses() override;
|
|
|
|
bool addInstSelector() override;
|
2014-12-11 22:26:47 +01:00
|
|
|
void addPreEmitPass() override;
|
|
|
|
void addPreRegAlloc() override;
|
2012-02-03 06:12:41 +01:00
|
|
|
};
|
2017-02-01 02:22:51 +01:00
|
|
|
|
|
|
|
} // end anonymous namespace
|
2012-02-03 06:12:41 +01:00
|
|
|
|
2012-02-04 03:56:59 +01:00
|
|
|
TargetPassConfig *MipsTargetMachine::createPassConfig(PassManagerBase &PM) {
|
2017-05-30 23:36:41 +02:00
|
|
|
return new MipsPassConfig(*this, PM);
|
2012-02-03 06:12:41 +01:00
|
|
|
}
|
|
|
|
|
2013-04-10 18:58:04 +02:00
|
|
|
void MipsPassConfig::addIRPasses() {
|
|
|
|
TargetPassConfig::addIRPasses();
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createAtomicExpandPass());
|
2013-04-10 18:58:04 +02:00
|
|
|
if (getMipsSubtarget().os16())
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createMipsOs16Pass());
|
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability.
This patch fixes returns from mips16 functions so that if the function
was in fact called by a mips32 hard float routine, then values
that would have been returned in floating point registers are so returned.
Mips16 mode has no floating point instructions so there is no way to
load values into floating point registers.
This is needed when returning float, double, single complex, double complex
in the Mips ABI.
Helper functions in libc for mips16 are available to do this.
For efficiency purposes, these helper functions have a different calling
convention from normal Mips calls.
Registers v0,v1,a0,a1 are used to pass parameters instead of
a0,a1,a2,a3.
This is because v0,v1,a0,a1 are the natural registers used to return
floating point values in soft float. These values can then be moved
to the appropriate floating point registers with no extra cost.
The only register that is modified is ra in this call.
The helper functions make sure that the return values are in the floating
point registers that they would be in if soft float was not in effect
(which it is for mips16, though the soft float is implemented using a mips32
library that uses hard float).
llvm-svn: 181641
2013-05-11 00:25:39 +02:00
|
|
|
if (getMipsSubtarget().inMips16HardFloat())
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createMips16HardFloatPass());
|
2013-04-10 18:58:04 +02:00
|
|
|
}
|
2010-11-15 01:06:54 +01:00
|
|
|
// Install an instruction selector pass using
|
2007-06-06 09:42:06 +02:00
|
|
|
// the ISelDag to gen Mips code.
|
2012-05-01 10:27:43 +02:00
|
|
|
bool MipsPassConfig::addInstSelector() {
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createMipsModuleISelDagPass());
|
[mips] SelectionDAGISel subclasses now follow the optimization level.
Summary:
It was recently discovered that, for Mips's SelectionDAGISel subclasses,
all optimization levels caused SelectionDAGISel to behave like -O2.
This change adds the necessary plumbing to initialize the optimization level.
Reviewers: andrew.w.kaylor
Subscribers: andrew.w.kaylor, sdardis, dean, llvm-commits, vradosavljevic, petarj, qcolombet, probinson, dsanders
Differential Revision: https://reviews.llvm.org/D14900
llvm-svn: 275410
2016-07-14 15:25:22 +02:00
|
|
|
addPass(createMips16ISelDag(getMipsTargetMachine(), getOptLevel()));
|
|
|
|
addPass(createMipsSEISelDag(getMipsTargetMachine(), getOptLevel()));
|
2007-06-06 09:42:06 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-12-11 22:26:47 +01:00
|
|
|
void MipsPassConfig::addPreRegAlloc() {
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createMipsOptimizePICCallPass());
|
2014-03-10 17:31:25 +01: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-22 19:21:59 +01:00
|
|
|
TargetTransformInfo
|
|
|
|
MipsTargetMachine::getTargetTransformInfo(const Function &F) {
|
|
|
|
if (Subtarget->allowMixed16_32()) {
|
|
|
|
DEBUG(errs() << "No Target Transform Info Pass Added\n");
|
|
|
|
// FIXME: This is no longer necessary as the TTI returned is per-function.
|
|
|
|
return TargetTransformInfo(F.getParent()->getDataLayout());
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG(errs() << "Target Transform Info Pass Added\n");
|
|
|
|
return TargetTransformInfo(BasicTTIImpl(this, F));
|
2013-04-09 21:46:01 +02:00
|
|
|
}
|
|
|
|
|
2010-11-15 01:06:54 +01:00
|
|
|
// Implemented by targets that want to run passes immediately before
|
|
|
|
// machine code is emitted. return true if -print-machineinstrs should
|
2007-06-06 09:42:06 +02:00
|
|
|
// print out the code after the passes.
|
2014-12-11 22:26:47 +01:00
|
|
|
void MipsPassConfig::addPreEmitPass() {
|
2017-04-27 15:10:48 +02:00
|
|
|
addPass(createMicroMipsSizeReductionPass());
|
2016-03-14 17:24:05 +01:00
|
|
|
|
2017-11-20 16:59:18 +01:00
|
|
|
// The delay slot filler and the long branch passes can potientially create
|
|
|
|
// forbidden slot/ hazards for MIPSR6 which the hazard schedule pass will
|
|
|
|
// fix. Any new pass must come before the hazard schedule pass.
|
2017-05-18 19:21:13 +02:00
|
|
|
addPass(createMipsDelaySlotFillerPass());
|
|
|
|
addPass(createMipsLongBranchPass());
|
2017-11-20 16:59:18 +01:00
|
|
|
addPass(createMipsHazardSchedule());
|
2016-06-28 16:26:39 +02:00
|
|
|
addPass(createMipsConstantIslandPass());
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|