• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef MAPLE_IR_INCLUDE_JAVA_EH_LOWER_H
17 #define MAPLE_IR_INCLUDE_JAVA_EH_LOWER_H
18 #include "phase_impl.h"
19 #include "class_hierarchy.h"
20 #include "maple_phase_manager.h"
21 
22 namespace maple {
23 class JavaEHLowerer : public FuncOptimizeImpl {
24 public:
JavaEHLowerer(MIRModule & mod,KlassHierarchy * kh,bool dump)25     JavaEHLowerer(MIRModule &mod, KlassHierarchy *kh, bool dump) : FuncOptimizeImpl(mod, kh, dump) {}
26     ~JavaEHLowerer() = default;
27 
Clone()28     FuncOptimizeImpl *Clone() override
29     {
30         return new JavaEHLowerer(*this);
31     }
32 
33     void ProcessFunc(MIRFunction *func) override;
34 
35 private:
36     BlockNode *DoLowerBlock(BlockNode &);
37     BaseNode *DoLowerExpr(BaseNode &, BlockNode &);
38     BaseNode *DoLowerDiv(BinaryNode &, BlockNode &);
39     void DoLowerBoundaryCheck(IntrinsiccallNode &, BlockNode &);
DoLowerRem(BinaryNode & expr,BlockNode & blkNode)40     BaseNode *DoLowerRem(BinaryNode &expr, BlockNode &blkNode)
41     {
42         return DoLowerDiv(expr, blkNode);
43     }
44 
45     uint32 divSTIndex = 0;              // The index of divide operand and result.
46     bool useRegTmp = Options::usePreg;  // Use register to save temp variable or not.
47 };
48 
49 MAPLE_MODULE_PHASE_DECLARE(M2MJavaEHLowerer)
50 }  // namespace maple
51 #endif  // MAPLE_IR_INCLUDE_JAVA_EH_LOWER_H
52