• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2021-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// Autogenerated file -- DO NOT EDIT!
17
18Graph* GenerateIntrinsicOperation(Inst* inst) {
19    auto graph = CreateGraphWithOneBasicBlock();
20    auto intrinsic_inst = inst->CastToIntrinsic();
21    switch (intrinsic_inst->GetIntrinsicId()) {
22% Compiler::intrinsics.each do |intrinsic|
23%   next unless intrinsic.has_impl?
24            case RuntimeInterface::IntrinsicId::<%= intrinsic.entrypoint_name %>:
25                intrinsic_inst->AllocateInputTypes(&allocator_, <%= intrinsic.arguments.length() %>);
26% intrinsic.arguments.each_with_index do |arg, i|
27                    intrinsic_inst->AppendInput(CreateParamInst(graph, DataType::<%= arg %>, <%= i %>));
28                    intrinsic_inst->AddInputType(DataType::<%= arg %>);
29% end
30                break;
31% end
32        default:
33            UNREACHABLE();
34    }
35    ASSERT(graph->GetVectorBlocks().size() > 2);
36    auto block = graph->GetVectorBlocks()[2];
37    if (inst->RequireState()) {
38        auto save_state = graph->CreateInstSaveState();
39        block->AppendInst(save_state);
40        inst->AppendInput(save_state);
41    }
42    block->AppendInst(inst);
43    Inst* ret = nullptr;
44    if (inst->GetType() == DataType::VOID) {
45        ret = graph->CreateInstReturnVoid();
46    } else {
47        ret = graph->CreateInstReturn();
48        ret->SetType(inst->GetType());
49        ret->SetInput(0, inst);
50    }
51    block->AppendInst(ret);
52    return graph;
53}
54