summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1bf3e58)
raw | patch | inline | side by side (parent: 1bf3e58)
author | Jon Humphreys <jon@micro.ti.com> | |
Tue, 23 Dec 2014 16:10:54 +0000 (10:10 -0600) | ||
committer | Jon Humphreys <j-humphreys@ti.com> | |
Thu, 22 Jan 2015 23:39:31 +0000 (17:39 -0600) |
lib/Target/C6000/C6000TargetMachine.h | patch | blob | history | |
lib/Target/C6000/C6000TargetTransformInfo.cpp | patch | blob | history |
index 61ad01bdd5b6ac8c6fc306f47bea1a5e27112312..c02dd11c18f9233bf50a3a5d3378be2fa0bbbdff 100644 (file)
Reloc::Model RM, CodeModel::Model CM,
CodeGenOpt::Level OL);
- const DataLayout *getDataLayout() const override { return &DL; }
-
/// \brief Register C6000 analysis passes with a pass manager.
void addAnalysisPasses(PassManagerBase &PM) override;
diff --git a/lib/Target/C6000/C6000TargetTransformInfo.cpp b/lib/Target/C6000/C6000TargetTransformInfo.cpp
index 3aea8033f97724b956c0b6721836f99043e08fc3..3c183439fbff328accbe6670bdbdcb01b012b943 100644 (file)
//===----------------------------------------------------------------------===//
#include "C6000.h"
+#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/CostTable.h"
return this;
}
+ /// \name Scalar TTI Implementations
+ /// @{
+
+ void getUnrollingPreferences(Loop *L,
+ UnrollingPreferences &UP) const override;
+
+ /// @}
+
/// \name Vector TTI Implementations
/// @{
unsigned getMaximumUnrollFactor() const override {
return 4;
}
+
+ unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
+ unsigned AddressSpace) const override;
};
} // end anonymous namespace
llvm::createC6000TargetTransformInfoPass(const C6000TargetMachine *TM) {
return new C6000TTI(TM);
}
+
+void C6000TTI::getUnrollingPreferences(Loop *L,
+ UnrollingPreferences &UP) const {
+ // Scan the loop: don't unroll loops with calls.
+ for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
+ I != E; ++I) {
+ BasicBlock *BB = *I;
+
+ for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J)
+ if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
+ ImmutableCallSite CS(J);
+ if (const Function *F = CS.getCalledFunction()) {
+ if (!TopTTI->isLoweredToCall(F))
+ continue;
+ }
+
+ return;
+ }
+ }
+
+ // Enable runtime and partial unrolling
+ UP.Partial = UP.Runtime = true;
+}
+
+unsigned C6000TTI::getMemoryOpCost(unsigned Opcode, Type *Src,
+ unsigned Alignment,
+ unsigned AddressSpace) const {
+ // TODO: implement correctly...
+ return 1;
+}