CGRAOmp  0.1
Utils.hpp
Go to the documentation of this file.
1 /*
2 * MIT License
3 *
4 * Copyright (c) 2022 Amano laboratory, Keio University & Processor Research Team, RIKEN Center for Computational Science
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy of
7 * this software and associated documentation files (the "Software"), to deal in
8 * the Software without restriction, including without limitation the rights to
9 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 * of the Software, and to permit persons to whom the Software is furnished to do
11 * so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 * File: /include/Utils.hpp
25 * Project: CGRAOmp
26 * Author: Takuya Kojima in The University of Tokyo (tkojima@hal.ipc.i.u-tokyo.ac.jp)
27 * Created Date: 17-07-2022 19:02:30
28 * Last Modified: 20-07-2022 11:32:04
29 */
30 #ifndef CGRAOMP_UTILS_H
31 #define CGRAOMP_UTILS_H
32 
33 #include "llvm/IR/Function.h"
34 #include "llvm/IR/Instructions.h"
35 #include "llvm/IR/Type.h"
36 #include "llvm/Analysis/LoopInfo.h"
37 #include "llvm/Analysis/LoopAnalysisManager.h"
38 #include "llvm/ADT/SmallVector.h"
39 #include "llvm/ADT/APFloat.h"
40 
41 #include <string>
42 
43 
44 using namespace llvm;
45 
46 namespace CGRAOmp {
47  namespace Utils {
55  LoopStandardAnalysisResults getLSAR(Function &F,
56  FunctionAnalysisManager &AM);
57 
58 
59  BranchInst* findBackBranch(Loop *L);
60 
61  void getAllGEP(Loop* L, SmallVector<Instruction*> &List);
62 
63  void getArrayElementSizes(Type *Ty, SmallVector<int> &sizes, Type* &element_type);
64 
65  int getFloatDataWidth(const APFloat f);
66 
67  int getDataWidth(const Type* T);
68 
69  std::string getFloatType(const APFloat f);
70 
71  double getFloatValueAsDouble(const APFloat f);
72 
73  }
74 
75 }
76 #endif //CGRAOMP_UTILS_H
CGRAOmp::Utils::getLSAR
LoopStandardAnalysisResults getLSAR(Function &F, FunctionAnalysisManager &AM)
a utility function to obtain analysis results in LoopStandardAnalysisResults
Definition: Utils.cpp:50
CGRAOmp::Utils::getAllGEP
void getAllGEP(Loop *L, SmallVector< Instruction * > &List)
Definition: Utils.cpp:79
llvm
Definition: OptionPlugin.cpp:128
CGRAOmp::Utils::findBackBranch
BranchInst * findBackBranch(Loop *L)
Definition: Utils.cpp:68
CGRAOmp::Utils::getDataWidth
int getDataWidth(const Type *T)
Definition: Utils.cpp:137
CGRAOmp
Definition: AGVerifyPass.hpp:50
CGRAOmp::Utils::getFloatType
std::string getFloatType(const APFloat f)
Definition: Utils.cpp:116
CGRAOmp::Utils::getFloatValueAsDouble
double getFloatValueAsDouble(const APFloat f)
Definition: Utils.cpp:126
CGRAOmp::Utils::getArrayElementSizes
void getArrayElementSizes(Type *Ty, SmallVector< int > &sizes, Type *&element_type)
Definition: Utils.cpp:91
CGRAOmp::Utils::getFloatDataWidth
int getFloatDataWidth(const APFloat f)
Definition: Utils.cpp:100