Line data Source code
1 : /**
2 : * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef CCU_REPRESENTATION_FUNC_CALL_H
12 : #define CCU_REPRESENTATION_FUNC_CALL_H
13 :
14 : #include "ccu_rep_base_v1.h"
15 : #include "ccu_rep_funcblock_v1.h"
16 : #include "ccu_rep_reference_manager_v1.h"
17 :
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 : class CcuRepFuncCall : public CcuRepBase {
22 : public:
23 : explicit CcuRepFuncCall(CcuInsGeneratorBase* insGenPtr, const std::string& label);
24 : explicit CcuRepFuncCall(CcuInsGeneratorBase* insGenPtr, const Variable& funcAddrVar);
25 : bool Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep) override;
26 : std::string Describe() override;
27 : uint16_t InstrCount() override;
28 : const std::string& GetLabel() const;
29 :
30 : void Reference(std::shared_ptr<CcuRepFuncBlock> refRep);
31 : void SetFuncManager(CcuRepReferenceManager* funcManager);
32 :
33 : void SetInArg(const Variable& var);
34 : void SetOutArg(const Variable& var);
35 : void SetInArg(const std::vector<Variable>& varList);
36 : void SetOutArg(const std::vector<Variable>& varList);
37 :
38 : int32_t GetCallLayer();
39 :
40 5 : CcuRepReferenceManager* GetFuncManager() { return funcManager; }
41 5 : std::shared_ptr<CcuRepFuncBlock>& GetFuncBlock() { return funcBlock; }
42 0 : Variable GetFuncAddrVar() { return funcAddrVar; }
43 5 : std::vector<CcuRepArg>& GetInArgs() { return inArgs; }
44 5 : std::vector<CcuRepArg>& GetOutArgs() { return outArgs; }
45 5 : uint32_t GetInArgCount() { return inArgCount; }
46 : uint32_t GetOutArgCount() { return outArgCount; }
47 5 : CcuInstr* GetInstr() { return instr; }
48 :
49 : private:
50 : CcuInsGeneratorBase* insGeneratorPtr_;
51 : CcuRepReferenceManager* funcManager{nullptr};
52 :
53 : std::string label;
54 : std::shared_ptr<CcuRepFuncBlock> funcBlock{nullptr};
55 : Variable funcAddrVar;
56 :
57 : std::vector<CcuRepArg> inArgs;
58 : std::vector<CcuRepArg> outArgs;
59 : uint32_t inArgCount{0};
60 : uint32_t outArgCount{0};
61 :
62 : CcuInstr* instr{nullptr};
63 : };
64 :
65 : }; // namespace CcuRep
66 : }; // namespace hcomm
67 : #endif // _CCU_REPRESENTATION_FUNC_CALL_H
|