11// SPDX-License-Identifier: MIT
2- // Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
2+ // Copyright (C) 2024-2025 , Advanced Micro Devices, Inc. All rights reserved.
33
44#ifndef _AIEBU_COMMON_WRITER_H_
55#define _AIEBU_COMMON_WRITER_H_
66
77#include < map>
88#include < string>
99#include < vector>
10+ #include < unordered_map>
1011#include " symbol.h"
1112#include " code_section.h"
1213
@@ -19,10 +20,14 @@ class writer
1920 const code_section m_type;
2021 std::vector<uint8_t > m_data;
2122 std::vector<symbol> m_symbols;
23+ std::unordered_map<std::string, std::string> m_metadata;
2224
2325public:
24- writer (const std::string name, code_section type, std::vector<uint8_t >& data): m_name(name), m_type(type), m_data(std::move(data)) {}
25- writer (const std::string name, code_section type): m_name(name), m_type(type) {}
26+ writer (std::string name, code_section type, std::vector<uint8_t >&& data)
27+ : m_name(std::move(name)),
28+ m_type (type),
29+ m_data(std::move(data)) {}
30+ writer (std::string name, code_section type): m_name(std::move(name)), m_type(type) {}
2631 virtual ~writer () = default ;
2732
2833 virtual void write_byte (uint8_t byte);
@@ -80,6 +85,17 @@ class writer
8085 }
8186
8287 void padding (offset_type size);
88+
89+ void add_metadata (std::unordered_map<std::string, std::string>&& metadata)
90+ {
91+ m_metadata = std::move (metadata);
92+ }
93+
94+ std::string&
95+ get_metadata (const std::string& key)
96+ {
97+ return m_metadata[key];
98+ }
8399};
84100}
85101#endif // _AIEBU_COMMON_WRITER_H_
0 commit comments