• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H
17 #define ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H
18 #include "ecmascript/compiler/interpreter_stub.h"
19 #include "ecmascript/compiler/stub_builder.h"
20 
21 namespace panda::ecmascript::kungfu {
22 class OperationsStubBuilder : public StubBuilder {
23 public:
OperationsStubBuilder(StubBuilder * parent)24     explicit OperationsStubBuilder(StubBuilder *parent)
25         : StubBuilder(parent) {}
26     ~OperationsStubBuilder() = default;
27     NO_MOVE_SEMANTIC(OperationsStubBuilder);
28     NO_COPY_SEMANTIC(OperationsStubBuilder);
GenerateCircuit()29     void GenerateCircuit() override {}
30     // unary op
31     GateRef Inc(GateRef glue, GateRef value);
32     GateRef Dec(GateRef glue, GateRef value);
33     GateRef Neg(GateRef glue, GateRef value);
34     GateRef Not(GateRef glue, GateRef value);
35 
36     // binary op
37     GateRef Equal(GateRef glue, GateRef left, GateRef right);
38     GateRef NotEqual(GateRef glue, GateRef left, GateRef right);
39     GateRef Less(GateRef glue, GateRef left, GateRef right);
40     GateRef LessEq(GateRef glue, GateRef left, GateRef right);
41     GateRef Greater(GateRef glue, GateRef left, GateRef right);
42     GateRef GreaterEq(GateRef glue, GateRef left, GateRef right);
43     GateRef Add(GateRef glue, GateRef left, GateRef right);
44     GateRef Sub(GateRef glue, GateRef left, GateRef right);
45     GateRef Mul(GateRef glue, GateRef left, GateRef right);
46     GateRef Div(GateRef glue, GateRef left, GateRef right);
47     GateRef Mod(GateRef glue, GateRef left, GateRef right);
48     GateRef Shl(GateRef glue, GateRef left, GateRef right);
49     GateRef Shr(GateRef glue, GateRef left, GateRef right);
50     GateRef Ashr(GateRef glue, GateRef left, GateRef right);
51     GateRef And(GateRef glue, GateRef left, GateRef right);
52     GateRef Or(GateRef glue, GateRef left, GateRef right);
53     GateRef Xor(GateRef glue, GateRef left, GateRef right);
54 };
55 }  // namespace panda::ecmascript::kungfu
56 #endif  // ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H
57