10#ifndef AIE_REGISTER_DATABASE_H
11#define AIE_REGISTER_DATABASE_H
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/StringMap.h"
15#include "llvm/ADT/StringRef.h"
16#include "llvm/Support/JSON.h"
61class RegisterDatabase {
64 static std::unique_ptr<RegisterDatabase>
loadAIE2();
67 static std::unique_ptr<RegisterDatabase>
loadAIE4();
71 llvm::StringRef module)
const;
79 llvm::StringRef module)
const;
82 std::optional<uint32_t>
lookupEvent(llvm::StringRef name,
83 llvm::StringRef module)
const;
88 uint32_t value)
const;
91 RegisterDatabase() =
default;
95 static std::unique_ptr<RegisterDatabase> load(llvm::StringRef registerFile,
96 llvm::StringRef archKey);
98 bool loadFromJSON(llvm::StringRef registerPath, llvm::StringRef eventPath,
99 llvm::StringRef archKey, llvm::raw_ostream &diag);
103 void buildOffsetIndex();
105 llvm::StringMap<RegisterInfo> registers_;
106 llvm::StringMap<EventInfo> events_;
110 llvm::StringMap<llvm::DenseMap<uint32_t, const RegisterInfo *>>
std::optional< uint32_t > encodeFieldValue(const BitFieldInfo &field, uint32_t value) const
Encode a value for a specific bitfield.
static std::unique_ptr< RegisterDatabase > loadAIE2()
Load database for AIE2 architecture.
static std::unique_ptr< RegisterDatabase > loadAIE4()
Load database for AIE4 architecture.
const RegisterInfo * lookupRegister(llvm::StringRef name, llvm::StringRef module) const
Lookup register by name and module.
std::optional< uint32_t > lookupEvent(llvm::StringRef name, llvm::StringRef module) const
Lookup event by name and module.
const RegisterInfo * lookupRegisterByOffset(uint32_t offset, llvm::StringRef module) const
Lookup register by tile-relative offset and module name.
Bit field information for a register.
uint32_t getWidth() const
const BitFieldInfo * getField(llvm::StringRef fieldName) const
Lookup a bit field by name, case-insensitively.
std::vector< BitFieldInfo > bit_fields