Move VectorUtils from Transforms to Analysis to correct layering violation
[oota-llvm.git] / include / llvm / Analysis / VectorUtils.h
1 //===- llvm/Transforms/Utils/VectorUtils.h - Vector utilities -*- 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 defines some vectorizer utilities.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TRANSFORMS_UTILS_VECTORUTILS_H
15 #define LLVM_TRANSFORMS_UTILS_VECTORUTILS_H
16
17 #include "llvm/Analysis/TargetLibraryInfo.h"
18 #include "llvm/IR/IntrinsicInst.h"
19 #include "llvm/IR/Intrinsics.h"
20
21 namespace llvm {
22
23 /// \brief Identify if the intrinsic is trivially vectorizable.
24 /// This method returns true if the intrinsic's argument types are all
25 /// scalars for the scalar form of the intrinsic and all vectors for
26 /// the vector form of the intrinsic.
27 bool isTriviallyVectorizable(Intrinsic::ID ID);
28
29 /// \brief Identifies if the intrinsic has a scalar operand. It checks for
30 /// ctlz,cttz and powi special intrinsics whose argument is scalar.
31 bool hasVectorInstrinsicScalarOpd(Intrinsic::ID ID, unsigned ScalarOpdIdx);
32
33 /// \brief Identify if call has a unary float signature
34 /// It returns input intrinsic ID if call has a single argument,
35 /// argument type and call instruction type should be floating
36 /// point type and call should only reads memory.
37 /// else return not_intrinsic.
38 Intrinsic::ID checkUnaryFloatSignature(const CallInst &I,
39                                        Intrinsic::ID ValidIntrinsicID);
40
41 /// \brief Identify if call has a binary float signature
42 /// It returns input intrinsic ID if call has two arguments,
43 /// arguments type and call instruction type should be floating
44 /// point type and call should only reads memory.
45 /// else return not_intrinsic.
46 Intrinsic::ID checkBinaryFloatSignature(const CallInst &I,
47                                         Intrinsic::ID ValidIntrinsicID);
48
49 /// \brief Returns intrinsic ID for call.
50 /// For the input call instruction it finds mapping intrinsic and returns
51 /// its intrinsic ID, in case it does not found it return not_intrinsic.
52 Intrinsic::ID getIntrinsicIDForCall(CallInst *CI, const TargetLibraryInfo *TLI);
53
54 } // llvm namespace
55
56 #endif