Commit ec1b0d97 authored by yonchicy's avatar yonchicy
Browse files

准备添加global_value_number

No related merge requests found
Showing with 26 additions and 0 deletions
+26 -0
#include "global_value_numbering.h"
\ No newline at end of file
#ifndef COMPILER_GLOBAL_VALUE_NUMBERING_H
#define COMPILER_GLOBAL_VALUE_NUMBERING_H
#include "ir/constant.h"
#include "ir/instruction.h"
#include "pass.h"
class Function;
class BinaryInst;
class ConstantFold : public Transform {
public:
ConstantFold(Module* m,const std::string &name): Transform(m,name){}
void run() override;
void constantFold(Function* f);
Constant* calConstantIntBinary(Instruction* pInstruction);
Constant* calConstantFloatBinary(Instruction* instr);
private:
// Function* _cur_fun;
bool detectBinaryConstantFold(BinaryInst* inst);
bool detectCastConstantFold(UnaryInst* pInst);
bool detectCmpConstantFold(CmpInst* pInst);
};
#endif //COMPILER_GLOBAL_VALUE_NUMBERING_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment