| 1 | //===- AVRTargetTransformInfo.h - AVR specific TTI --------------*- C++ -*-===// |
|---|---|
| 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 | /// \file |
| 9 | /// This file defines a TargetTransformInfoImplBase conforming object specific |
| 10 | /// to the AVR target machine. It uses the target's detailed information to |
| 11 | /// provide more precise answers to certain TTI queries, while letting the |
| 12 | /// target independent and default TTI implementations handle the rest. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_LIB_TARGET_AVR_AVRTARGETTRANSFORMINFO_H |
| 17 | #define LLVM_LIB_TARGET_AVR_AVRTARGETTRANSFORMINFO_H |
| 18 | |
| 19 | #include "AVRSubtarget.h" |
| 20 | #include "AVRTargetMachine.h" |
| 21 | #include "llvm/Analysis/TargetTransformInfo.h" |
| 22 | #include "llvm/CodeGen/BasicTTIImpl.h" |
| 23 | #include "llvm/IR/Function.h" |
| 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | class AVRTTIImpl final : public BasicTTIImplBase<AVRTTIImpl> { |
| 28 | using BaseT = BasicTTIImplBase<AVRTTIImpl>; |
| 29 | using TTI = TargetTransformInfo; |
| 30 | |
| 31 | friend BaseT; |
| 32 | |
| 33 | const AVRSubtarget *ST; |
| 34 | const AVRTargetLowering *TLI; |
| 35 | |
| 36 | const AVRSubtarget *getST() const { return ST; } |
| 37 | const AVRTargetLowering *getTLI() const { return TLI; } |
| 38 | |
| 39 | public: |
| 40 | explicit AVRTTIImpl(const AVRTargetMachine *TM, const Function &F) |
| 41 | : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)), |
| 42 | TLI(ST->getTargetLowering()) {} |
| 43 | |
| 44 | bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, |
| 45 | const TargetTransformInfo::LSRCost &C2) const override; |
| 46 | }; |
| 47 | |
| 48 | } // end namespace llvm |
| 49 | |
| 50 | #endif // LLVM_LIB_TARGET_AVR_AVRTARGETTRANSFORMINFO_H |
| 51 |