Implement a basic VectorTargetTransformInfo interface to be used by the loop and...
[oota-llvm.git] / include / llvm / Target / TargetTransformImpl.h
1 //=- llvm/Target/TargetTransformImpl.h - Target Loop Trans Info----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the target-specific implementations of the
11 // TargetTransform interfaces.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TARGET_TARGET_TRANSFORMATION_IMPL_H
16 #define LLVM_TARGET_TARGET_TRANSFORMATION_IMPL_H
17
18 #include "llvm/TargetTransformInfo.h"
19
20 namespace llvm {
21
22 class TargetLowering;
23
24 /// ScalarTargetTransformInfo - This is a default implementation for the
25 /// ScalarTargetTransformInfo interface. Different targets can implement
26 /// this interface differently.
27 class ScalarTargetTransformImpl : public ScalarTargetTransformInfo {
28 private:
29   const TargetLowering *TLI;
30
31 public:
32   /// Ctor
33   explicit ScalarTargetTransformImpl(const TargetLowering *TL) : TLI(TL) {}
34
35   virtual bool isLegalAddImmediate(int64_t imm) const;
36
37   virtual bool isLegalICmpImmediate(int64_t imm) const;
38
39   virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const;
40
41   virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const;
42
43   virtual bool isTypeLegal(Type *Ty) const;
44
45   virtual unsigned getJumpBufAlignment() const;
46
47   virtual unsigned getJumpBufSize() const;
48 };
49
50 class VectorTargetTransformImpl : public VectorTargetTransformInfo {
51 private:
52   const TargetLowering *TLI;
53
54 public:
55   explicit VectorTargetTransformImpl(const TargetLowering *TL) : TLI(TL) {}
56   
57   virtual ~VectorTargetTransformImpl() {}
58
59   virtual unsigned getInstrCost(unsigned Opcode, Type *Ty1, Type *Ty2) const;
60
61   virtual unsigned getBroadcastCost(Type *Tp) const;
62
63   virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
64                                    unsigned Alignment,
65                                    unsigned AddressSpace) const;
66 };
67
68 } // end llvm namespace
69
70 #endif