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 #include "locations.h"
17 #include "inst.h"
18 
19 namespace panda::compiler {
LocationsInfo(ArenaAllocator *allocator, Inst *inst)20 LocationsInfo::LocationsInfo(ArenaAllocator *allocator, Inst *inst)
21     // NOLINTNEXTLINE(modernize-avoid-c-arrays)
22     : locations_(allocator->New<Location[]>(inst->GetInputsCount()), inst->GetInputsCount())
23 {
24     ASSERT(inst->IsOperandsDynamic());
25     static_cast<DynamicInputsInst *>(inst)->SetLocationsInfo(this);
26 }
27 
Dump(std::ostream &stm, [[maybe_unused]] Arch arch)28 void Location::Dump(std::ostream &stm, [[maybe_unused]] Arch arch)
29 {
30     stm << "";
31 }
32 
ToString(Arch arch)33 std::string Location::ToString(Arch arch)
34 {
35     std::stringstream ss;
36     Dump(ss, arch);
37     return ss.str();
38 }
39 }  // namespace panda::compiler
40