2005-10-16 13:39:50 +08:00
|
|
|
//===-- PPCTargetMachine.cpp - Define TargetMachine for PowerPC -----------===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-06-22 00:55:25 +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-06-22 00:55:25 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2005-08-16 07:47:04 +08:00
|
|
|
// Top-level implementation for the PowerPC target.
|
2004-06-22 00:55:25 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2005-10-15 07:59:06 +08:00
|
|
|
#include "PPCTargetMachine.h"
|
2014-11-13 17:26:31 +08:00
|
|
|
#include "PPCTargetObjectFile.h"
|
2012-03-18 02:46:09 +08:00
|
|
|
#include "PPC.h"
|
2012-02-03 13:12:41 +08:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2014-10-06 14:45:36 +08:00
|
|
|
#include "llvm/IR/Function.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2012-06-08 23:38:21 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2009-07-15 04:18:05 +08:00
|
|
|
#include "llvm/Support/FormattedStream.h"
|
2011-08-25 02:08:43 +08:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/Target/TargetOptions.h"
|
2004-06-22 00:55:25 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2012-06-08 23:38:21 +08:00
|
|
|
static cl::
|
2012-06-09 03:19:53 +08:00
|
|
|
opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden,
|
|
|
|
cl::desc("Disable CTR loops for PPC"));
|
2012-06-08 23:38:21 +08:00
|
|
|
|
[PowerPC] Select between VSX A-type and M-type FMA instructions just before RA
The VSX instruction set has two types of FMA instructions: A-type (where the
addend is taken from the output register) and M-type (where one of the product
operands is taken from the output register). This adds a small pass that runs
just after MI scheduling (and, thus, just before register allocation) that
mutates A-type instructions (that are created during isel) into M-type
instructions when:
1. This will eliminate an otherwise-necessary copy of the addend
2. One of the product operands is killed by the instruction
The "right" moment to make this decision is in between scheduling and register
allocation, because only there do we know whether or not one of the product
operands is killed by any particular instruction. Unfortunately, this also
makes the implementation somewhat complicated, because the MIs are not in SSA
form and we need to preserve the LiveIntervals analysis.
As a simple example, if we have:
%vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
...
%vreg9<def,tied1> = XSMADDADP %vreg9<tied0>, %vreg17, %vreg19,
%RM<imp-use>; VSLRC:%vreg9,%vreg17,%vreg19
...
We can eliminate the copy by changing from the A-type to the
M-type instruction. This means:
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
is replaced by:
%vreg16<def,tied1> = XSMADDMDP %vreg16<tied0>, %vreg18, %vreg9,
%RM<imp-use>; VSLRC:%vreg16,%vreg18,%vreg9
and we remove: %vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
llvm-svn: 204768
2014-03-26 07:29:21 +08:00
|
|
|
static cl::opt<bool>
|
|
|
|
VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early",
|
|
|
|
cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"));
|
|
|
|
|
2009-07-25 14:49:55 +08:00
|
|
|
extern "C" void LLVMInitializePowerPCTarget() {
|
|
|
|
// Register the targets
|
2012-02-03 13:12:30 +08:00
|
|
|
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
|
2009-07-25 14:49:55 +08:00
|
|
|
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
|
2013-07-26 09:35:43 +08:00
|
|
|
RegisterTargetMachine<PPC64TargetMachine> C(ThePPC64LETarget);
|
2009-07-25 14:49:55 +08:00
|
|
|
}
|
2009-06-17 04:12:29 +08:00
|
|
|
|
2014-10-02 04:38:26 +08:00
|
|
|
static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, StringRef TT) {
|
|
|
|
std::string FullFS = FS;
|
|
|
|
Triple TargetTriple(TT);
|
|
|
|
|
|
|
|
// Make sure 64-bit features are available when CPUname is generic
|
|
|
|
if (TargetTriple.getArch() == Triple::ppc64 ||
|
|
|
|
TargetTriple.getArch() == Triple::ppc64le) {
|
|
|
|
if (!FullFS.empty())
|
|
|
|
FullFS = "+64bit," + FullFS;
|
|
|
|
else
|
|
|
|
FullFS = "+64bit";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OL >= CodeGenOpt::Default) {
|
|
|
|
if (!FullFS.empty())
|
|
|
|
FullFS = "+crbits," + FullFS;
|
|
|
|
else
|
|
|
|
FullFS = "+crbits";
|
|
|
|
}
|
|
|
|
return FullFS;
|
|
|
|
}
|
|
|
|
|
2014-11-13 17:26:31 +08:00
|
|
|
static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
|
|
|
|
// If it isn't a Mach-O file then it's going to be a linux ELF
|
|
|
|
// object file.
|
|
|
|
if (TT.isOSDarwin())
|
|
|
|
return make_unique<TargetLoweringObjectFileMachO>();
|
|
|
|
|
|
|
|
return make_unique<PPC64LinuxTargetObjectFile>();
|
|
|
|
}
|
|
|
|
|
2014-10-02 04:38:26 +08:00
|
|
|
// The FeatureString here is a little subtle. We are modifying the feature string
|
|
|
|
// with what are (currently) non-function specific overrides as it goes into the
|
|
|
|
// LLVMTargetMachine constructor and then using the stored value in the
|
|
|
|
// Subtarget constructor below it.
|
2014-06-11 08:53:17 +08:00
|
|
|
PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU,
|
|
|
|
StringRef FS, const TargetOptions &Options,
|
2011-07-20 15:51:56 +08:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
2014-08-09 12:38:56 +08:00
|
|
|
CodeGenOpt::Level OL)
|
2014-10-02 04:38:26 +08:00
|
|
|
: LLVMTargetMachine(T, TT, CPU, computeFSAdditions(FS, OL, TT), Options, RM,
|
|
|
|
CM, OL),
|
2014-11-13 17:26:31 +08:00
|
|
|
TLOF(createTLOF(Triple(getTargetTriple()))),
|
2014-10-02 05:05:35 +08:00
|
|
|
Subtarget(TT, CPU, TargetFS, *this) {
|
2013-05-13 09:16:13 +08:00
|
|
|
initAsmInfo();
|
2005-10-16 13:39:50 +08:00
|
|
|
}
|
|
|
|
|
2014-11-21 07:37:18 +08:00
|
|
|
PPCTargetMachine::~PPCTargetMachine() {}
|
|
|
|
|
2011-12-20 10:50:00 +08:00
|
|
|
void PPC32TargetMachine::anchor() { }
|
|
|
|
|
2012-02-03 13:12:30 +08:00
|
|
|
PPC32TargetMachine::PPC32TargetMachine(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)
|
2014-08-09 12:38:56 +08:00
|
|
|
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {
|
2006-06-16 09:37:27 +08:00
|
|
|
}
|
|
|
|
|
2011-12-20 10:50:00 +08:00
|
|
|
void PPC64TargetMachine::anchor() { }
|
2006-06-16 09:37:27 +08:00
|
|
|
|
2012-02-03 13:12:30 +08:00
|
|
|
PPC64TargetMachine::PPC64TargetMachine(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)
|
2014-08-09 12:38:56 +08:00
|
|
|
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {
|
2006-06-16 09:37:27 +08:00
|
|
|
}
|
|
|
|
|
2014-10-06 14:45:36 +08:00
|
|
|
const PPCSubtarget *
|
|
|
|
PPCTargetMachine::getSubtargetImpl(const Function &F) const {
|
|
|
|
AttributeSet FnAttrs = F.getAttributes();
|
|
|
|
Attribute CPUAttr =
|
|
|
|
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-cpu");
|
|
|
|
Attribute FSAttr =
|
|
|
|
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-features");
|
|
|
|
|
|
|
|
std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
|
|
|
|
? CPUAttr.getValueAsString().str()
|
|
|
|
: TargetCPU;
|
|
|
|
std::string FS = !FSAttr.hasAttribute(Attribute::None)
|
|
|
|
? FSAttr.getValueAsString().str()
|
|
|
|
: TargetFS;
|
|
|
|
|
|
|
|
auto &I = SubtargetMap[CPU + FS];
|
|
|
|
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);
|
|
|
|
I = llvm::make_unique<PPCSubtarget>(TargetTriple, CPU, FS, *this);
|
|
|
|
}
|
|
|
|
return I.get();
|
|
|
|
}
|
2004-08-11 15:40:04 +08:00
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pass Pipeline Configuration
|
|
|
|
//===----------------------------------------------------------------------===//
|
2004-08-11 15:40:04 +08:00
|
|
|
|
2012-02-03 13:12:41 +08:00
|
|
|
namespace {
|
|
|
|
/// PPC Code Generator Pass Configuration Options.
|
|
|
|
class PPCPassConfig : public TargetPassConfig {
|
|
|
|
public:
|
2012-02-04 10:56:59 +08:00
|
|
|
PPCPassConfig(PPCTargetMachine *TM, PassManagerBase &PM)
|
|
|
|
: TargetPassConfig(TM, PM) {}
|
2012-02-03 13:12:41 +08:00
|
|
|
|
|
|
|
PPCTargetMachine &getPPCTargetMachine() const {
|
|
|
|
return getTM<PPCTargetMachine>();
|
|
|
|
}
|
|
|
|
|
2013-04-06 07:29:01 +08:00
|
|
|
const PPCSubtarget &getPPCSubtarget() const {
|
|
|
|
return *getPPCTargetMachine().getSubtargetImpl();
|
|
|
|
}
|
|
|
|
|
2014-09-24 04:46:49 +08:00
|
|
|
void addIRPasses() override;
|
2014-04-29 15:57:37 +08:00
|
|
|
bool addPreISel() override;
|
|
|
|
bool addILPOpts() override;
|
|
|
|
bool addInstSelector() override;
|
|
|
|
bool addPreRegAlloc() override;
|
|
|
|
bool addPreSched2() override;
|
|
|
|
bool addPreEmitPass() override;
|
2012-02-03 13:12:41 +08:00
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-02-04 10:56:59 +08:00
|
|
|
TargetPassConfig *PPCTargetMachine::createPassConfig(PassManagerBase &PM) {
|
2012-06-09 11:14:50 +08:00
|
|
|
return new PPCPassConfig(this, PM);
|
2012-02-03 13:12:41 +08:00
|
|
|
}
|
|
|
|
|
2014-09-24 04:46:49 +08:00
|
|
|
void PPCPassConfig::addIRPasses() {
|
|
|
|
addPass(createAtomicExpandPass(&getPPCTargetMachine()));
|
|
|
|
TargetPassConfig::addIRPasses();
|
|
|
|
}
|
|
|
|
|
Implement PPC counter loops as a late IR-level pass
The old PPCCTRLoops pass, like the Hexagon pass version from which it was
derived, could only handle some simple loops in canonical form. We cannot
directly adapt the new Hexagon hardware loops pass, however, because the
Hexagon pass contains a fundamental assumption that non-constant-trip-count
loops will contain a guard, and this is not always true (the result being that
incorrect negative counts can be generated). With this commit, we replace the
pass with a late IR-level pass which makes use of SE to calculate the
backedge-taken counts and safely generate the loop-count expressions (including
any necessary max() parts). This IR level pass inserts custom intrinsics that
are lowered into the desired decrement-and-branch instructions.
The most fragile part of this new implementation is that interfering uses of
the counter register must be detected on the IR level (and, on PPC, this also
includes any indirect branches in addition to function calls). Also, to make
all of this work, we need a variant of the mtctr instruction that is marked
as having side effects. Without this, machine-code level CSE, DCE, etc.
illegally transform the resulting code. Hopefully, this can be improved
in the future.
This new pass is smaller than the original (and much smaller than the new
Hexagon hardware loops pass), and can handle many additional cases correctly.
In addition, the preheader-creation code has been copied from LoopSimplify, and
after we decide on where it belongs, this code will be refactored so that it
can be explicitly shared (making this implementation even smaller).
The new test-case files ctrloop-{le,lt,ne}.ll have been adapted from tests for
the new Hexagon pass. There are a few classes of loops that this pass does not
transform (noted by FIXMEs in the files), but these deficiencies can be
addressed within the SE infrastructure (thus helping many other passes as well).
llvm-svn: 181927
2013-05-16 05:37:41 +08:00
|
|
|
bool PPCPassConfig::addPreISel() {
|
2012-06-09 03:19:53 +08:00
|
|
|
if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
|
Implement PPC counter loops as a late IR-level pass
The old PPCCTRLoops pass, like the Hexagon pass version from which it was
derived, could only handle some simple loops in canonical form. We cannot
directly adapt the new Hexagon hardware loops pass, however, because the
Hexagon pass contains a fundamental assumption that non-constant-trip-count
loops will contain a guard, and this is not always true (the result being that
incorrect negative counts can be generated). With this commit, we replace the
pass with a late IR-level pass which makes use of SE to calculate the
backedge-taken counts and safely generate the loop-count expressions (including
any necessary max() parts). This IR level pass inserts custom intrinsics that
are lowered into the desired decrement-and-branch instructions.
The most fragile part of this new implementation is that interfering uses of
the counter register must be detected on the IR level (and, on PPC, this also
includes any indirect branches in addition to function calls). Also, to make
all of this work, we need a variant of the mtctr instruction that is marked
as having side effects. Without this, machine-code level CSE, DCE, etc.
illegally transform the resulting code. Hopefully, this can be improved
in the future.
This new pass is smaller than the original (and much smaller than the new
Hexagon hardware loops pass), and can handle many additional cases correctly.
In addition, the preheader-creation code has been copied from LoopSimplify, and
after we decide on where it belongs, this code will be refactored so that it
can be explicitly shared (making this implementation even smaller).
The new test-case files ctrloop-{le,lt,ne}.ll have been adapted from tests for
the new Hexagon pass. There are a few classes of loops that this pass does not
transform (noted by FIXMEs in the files), but these deficiencies can be
addressed within the SE infrastructure (thus helping many other passes as well).
llvm-svn: 181927
2013-05-16 05:37:41 +08:00
|
|
|
addPass(createPPCCTRLoops(getPPCTargetMachine()));
|
2012-06-08 23:38:21 +08:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-06 07:29:01 +08:00
|
|
|
bool PPCPassConfig::addILPOpts() {
|
2014-05-22 07:40:26 +08:00
|
|
|
addPass(&EarlyIfConverterID);
|
|
|
|
return true;
|
2013-04-06 07:29:01 +08:00
|
|
|
}
|
|
|
|
|
2012-02-03 13:12:41 +08:00
|
|
|
bool PPCPassConfig::addInstSelector() {
|
2005-08-18 03:33:30 +08:00
|
|
|
// Install an instruction selector.
|
2012-07-03 03:48:31 +08:00
|
|
|
addPass(createPPCISelDag(getPPCTargetMachine()));
|
Add a PPCCTRLoops verification pass
When asserts are enabled, this adds a verification pass for PPC counter-loop
formation. Unfortunately, without sacrificing code quality, there is no better
way of forming counter-based loops except at the (late) IR level. This means
that we need to recognize, at the IR level, anything which might turn into a
function call (or indirect branch). Because this is currently a finite set of
things, and because SelectionDAG lowering is basic-block local, this can be
done. Nevertheless, it is fragile, and failure results in a miscompile. This
verification pass checks that all (reachable) counter-based branches are
dominated by a loop mtctr instruction, and that no instructions in between
clobber the counter register. If these conditions are not satisfied, then an
ICE will be triggered.
In short, this is to help us sleep better at night.
llvm-svn: 182295
2013-05-21 00:08:17 +08:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
|
|
|
|
addPass(createPPCCTRLoopsVerify());
|
|
|
|
#endif
|
|
|
|
|
2014-05-22 09:21:35 +08:00
|
|
|
addPass(createPPCVSXCopyPass());
|
2006-09-04 12:14:57 +08:00
|
|
|
return false;
|
|
|
|
}
|
2004-08-11 15:40:04 +08:00
|
|
|
|
[PowerPC] Select between VSX A-type and M-type FMA instructions just before RA
The VSX instruction set has two types of FMA instructions: A-type (where the
addend is taken from the output register) and M-type (where one of the product
operands is taken from the output register). This adds a small pass that runs
just after MI scheduling (and, thus, just before register allocation) that
mutates A-type instructions (that are created during isel) into M-type
instructions when:
1. This will eliminate an otherwise-necessary copy of the addend
2. One of the product operands is killed by the instruction
The "right" moment to make this decision is in between scheduling and register
allocation, because only there do we know whether or not one of the product
operands is killed by any particular instruction. Unfortunately, this also
makes the implementation somewhat complicated, because the MIs are not in SSA
form and we need to preserve the LiveIntervals analysis.
As a simple example, if we have:
%vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
...
%vreg9<def,tied1> = XSMADDADP %vreg9<tied0>, %vreg17, %vreg19,
%RM<imp-use>; VSLRC:%vreg9,%vreg17,%vreg19
...
We can eliminate the copy by changing from the A-type to the
M-type instruction. This means:
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
is replaced by:
%vreg16<def,tied1> = XSMADDMDP %vreg16<tied0>, %vreg18, %vreg9,
%RM<imp-use>; VSLRC:%vreg16,%vreg18,%vreg9
and we remove: %vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
llvm-svn: 204768
2014-03-26 07:29:21 +08:00
|
|
|
bool PPCPassConfig::addPreRegAlloc() {
|
2014-05-22 09:21:35 +08:00
|
|
|
initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
|
|
|
|
insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID,
|
|
|
|
&PPCVSXFMAMutateID);
|
[PowerPC] Select between VSX A-type and M-type FMA instructions just before RA
The VSX instruction set has two types of FMA instructions: A-type (where the
addend is taken from the output register) and M-type (where one of the product
operands is taken from the output register). This adds a small pass that runs
just after MI scheduling (and, thus, just before register allocation) that
mutates A-type instructions (that are created during isel) into M-type
instructions when:
1. This will eliminate an otherwise-necessary copy of the addend
2. One of the product operands is killed by the instruction
The "right" moment to make this decision is in between scheduling and register
allocation, because only there do we know whether or not one of the product
operands is killed by any particular instruction. Unfortunately, this also
makes the implementation somewhat complicated, because the MIs are not in SSA
form and we need to preserve the LiveIntervals analysis.
As a simple example, if we have:
%vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
...
%vreg9<def,tied1> = XSMADDADP %vreg9<tied0>, %vreg17, %vreg19,
%RM<imp-use>; VSLRC:%vreg9,%vreg17,%vreg19
...
We can eliminate the copy by changing from the A-type to the
M-type instruction. This means:
%vreg5<def,tied1> = XSMADDADP %vreg5<tied0>, %vreg17, %vreg16,
%RM<imp-use>; VSLRC:%vreg5,%vreg17,%vreg16
is replaced by:
%vreg16<def,tied1> = XSMADDMDP %vreg16<tied0>, %vreg18, %vreg9,
%RM<imp-use>; VSLRC:%vreg16,%vreg18,%vreg9
and we remove: %vreg5<def> = COPY %vreg9; VSLRC:%vreg5,%vreg9
llvm-svn: 204768
2014-03-26 07:29:21 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-10 06:58:37 +08:00
|
|
|
bool PPCPassConfig::addPreSched2() {
|
2014-05-22 09:21:35 +08:00
|
|
|
addPass(createPPCVSXCopyCleanupPass());
|
2014-03-28 07:12:31 +08:00
|
|
|
|
2013-04-10 06:58:37 +08:00
|
|
|
if (getOptLevel() != CodeGenOpt::None)
|
|
|
|
addPass(&IfConverterID);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-02-03 13:12:41 +08:00
|
|
|
bool PPCPassConfig::addPreEmitPass() {
|
2013-04-09 00:24:03 +08:00
|
|
|
if (getOptLevel() != CodeGenOpt::None)
|
|
|
|
addPass(createPPCEarlyReturnPass());
|
2006-09-04 12:14:57 +08:00
|
|
|
// Must run branch selection immediately preceding the asm printer.
|
2012-07-03 03:48:31 +08:00
|
|
|
addPass(createPPCBranchSelectionPass());
|
2004-08-11 15:40:04 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-01-26 07:05:59 +08:00
|
|
|
void PPCTargetMachine::addAnalysisPasses(PassManagerBase &PM) {
|
|
|
|
// Add first the target-independent BasicTTI pass, then our PPC pass. This
|
|
|
|
// allows the PPC pass to delegate to the target independent layer when
|
|
|
|
// appropriate.
|
2013-06-20 04:51:24 +08:00
|
|
|
PM.add(createBasicTargetTransformInfoPass(this));
|
2013-01-26 07:05:59 +08:00
|
|
|
PM.add(createPPCTargetTransformInfoPass(this));
|
|
|
|
}
|
|
|
|
|