OpenASIP  2.0
LLVMTCERISCVIntrinsicsLowering.hh
Go to the documentation of this file.
1 /*
2  Copyright (C) 2022 Tampere University.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 /**
19  * @file LLVMTCERISCVIntrinsicsLowering.hh
20  *
21  *
22  * Pass for lowering RISC-V intrinsics
23  *
24  * @author Kari Hepola 2022
25  * @note rating: red
26  */
27 
28 #ifndef LLVM_TCE_SCHEDULER_H
29 #define LLVM_TCE_SCHEDULER_H
30 
31 #include <llvm/CodeGen/MachineFunctionPass.h>
32 
33 #include "Machine.hh"
34 #include "BinaryEncoding.hh"
35 #include "InstructionFormat.hh"
36 #include "InterPassData.hh"
37 
38 namespace llvm {
39 
40  extern "C" FunctionPass* createRISCVIntrinsicsPass(const char* target);
41 
42  class LLVMTCERISCVIntrinsicsLowering : public MachineFunctionPass {
43  public:
44  static char ID;
47  virtual bool runOnMachineFunction(MachineFunction &MF);
48  private:
50  std::string findRegs(const std::string& s) const;
51  std::string findOperationName(const std::string& s) const;
52 
53  std::vector<int> findRegIndexes(
54  const MachineBasicBlock::iterator& it) const;
55 
57  const std::string& opName, const std::vector<int>& regIdxs) const;
58 
59  virtual bool doInitialization(Module& m);
63 
64  };
65 }
66 
67 #endif
llvm::LLVMTCERISCVIntrinsicsLowering::~LLVMTCERISCVIntrinsicsLowering
virtual ~LLVMTCERISCVIntrinsicsLowering()
Definition: LLVMTCERISCVIntrinsicsLowering.hh:46
llvm::LLVMTCERISCVIntrinsicsLowering::constructEncoding
int constructEncoding(const std::string &opName, const std::vector< int > &regIdxs) const
Definition: LLVMTCERISCVIntrinsicsLowering.cc:171
llvm
Definition: InlineAsmParser.hh:49
BinaryEncoding
Definition: BinaryEncoding.hh:61
llvm::LLVMTCERISCVIntrinsicsLowering::rFormat_
InstructionFormat * rFormat_
Definition: LLVMTCERISCVIntrinsicsLowering.hh:62
llvm::LLVMTCERISCVIntrinsicsLowering::findRegIndexes
std::vector< int > findRegIndexes(const MachineBasicBlock::iterator &it) const
Definition: LLVMTCERISCVIntrinsicsLowering.cc:142
llvm::LLVMTCERISCVIntrinsicsLowering::findRFormat
InstructionFormat * findRFormat()
Definition: LLVMTCERISCVIntrinsicsLowering.cc:77
llvm::LLVMTCERISCVIntrinsicsLowering::mach_
TTAMachine::Machine * mach_
Definition: LLVMTCERISCVIntrinsicsLowering.hh:60
llvm::LLVMTCERISCVIntrinsicsLowering::doInitialization
virtual bool doInitialization(Module &m)
Definition: LLVMTCERISCVIntrinsicsLowering.cc:72
llvm::LLVMTCERISCVIntrinsicsLowering::LLVMTCERISCVIntrinsicsLowering
LLVMTCERISCVIntrinsicsLowering()
Definition: LLVMTCERISCVIntrinsicsLowering.cc:53
llvm::LLVMTCERISCVIntrinsicsLowering
Definition: LLVMTCERISCVIntrinsicsLowering.hh:42
llvm::LLVMTCERISCVIntrinsicsLowering::findRegs
std::string findRegs(const std::string &s) const
Definition: LLVMTCERISCVIntrinsicsLowering.cc:93
BinaryEncoding.hh
llvm::createRISCVIntrinsicsPass
FunctionPass * createRISCVIntrinsicsPass(const char *)
Definition: LLVMTCERISCVIntrinsicsLowering.cc:216
llvm::LLVMTCERISCVIntrinsicsLowering::runOnMachineFunction
virtual bool runOnMachineFunction(MachineFunction &MF)
Definition: LLVMTCERISCVIntrinsicsLowering.cc:189
Machine.hh
llvm::LLVMTCERISCVIntrinsicsLowering::bem_
BinaryEncoding * bem_
Definition: LLVMTCERISCVIntrinsicsLowering.hh:61
InstructionFormat
Definition: InstructionFormat.hh:46
InterPassData.hh
llvm::LLVMTCERISCVIntrinsicsLowering::ID
static char ID
Definition: LLVMTCERISCVIntrinsicsLowering.hh:44
InstructionFormat.hh
llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName
std::string findOperationName(const std::string &s) const
Definition: LLVMTCERISCVIntrinsicsLowering.cc:114
TTAMachine::Machine
Definition: Machine.hh:73