Skip to content

Commit 92239c8

Browse files
committed
Really Add .cpp
1 parent 92164fa commit 92239c8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//===-- AVRTargetTransformInfo.cpp - AVR specific TTI ---------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "AVRTargetTransformInfo.h"
10+
#include "llvm/CodeGen/CostTable.h"
11+
12+
using namespace llvm;
13+
14+
bool AVRTTIImpl::isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
15+
const TargetTransformInfo::LSRCost &C2) const {
16+
// AVR specific here are "instruction number 1st priority".
17+
// If we need to emit adds inside the loop to add up base registers, then
18+
// we need at least one extra temporary register.
19+
unsigned C1NumRegs = C1.NumRegs + (C1.NumBaseAdds != 0);
20+
unsigned C2NumRegs = C2.NumRegs + (C2.NumBaseAdds != 0);
21+
return std::tie(C1.Insns, C1NumRegs, C1.AddRecCost,
22+
C1.NumIVMuls, C1.NumBaseAdds,
23+
C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
24+
std::tie(C2.Insns, C2NumRegs, C2.AddRecCost,
25+
C2.NumIVMuls, C2.NumBaseAdds,
26+
C2.ScaleCost, C2.ImmCost, C2.SetupCost);
27+
}

0 commit comments

Comments
 (0)