mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
33197fb937
Before this commit it was set to "revng.stack_type" for a silly copy-paste error.
49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/IR/Instruction.h"
|
|
#include "llvm/IR/Instructions.h"
|
|
|
|
inline constexpr const char *StackTypeMDName = "revng.stack_type";
|
|
inline const char *VariableTypeMDName = "revng.variable_type";
|
|
|
|
inline bool hasNamedMetadata(const llvm::AllocaInst *I,
|
|
llvm::StringRef MDName) {
|
|
return nullptr != I->getMetadata(I->getContext().getMDKindID(MDName));
|
|
}
|
|
|
|
/// \name Functions for manipulating stack model type metadata
|
|
///
|
|
///@{
|
|
|
|
inline bool hasStackTypeMetadata(const llvm::AllocaInst *I) {
|
|
return hasNamedMetadata(I, StackTypeMDName);
|
|
};
|
|
|
|
void setStackTypeMetadata(llvm::AllocaInst *I, const model::Type &StackType);
|
|
|
|
model::UpcastableType getStackTypeFromMetadata(llvm::AllocaInst *I,
|
|
const model::Binary &Model);
|
|
|
|
///@}
|
|
|
|
/// \name Helper functions for manipulating local variable model type metadata
|
|
///
|
|
///@{
|
|
|
|
inline bool hasVariableTypeMetadata(const llvm::AllocaInst *I) {
|
|
return hasNamedMetadata(I, VariableTypeMDName);
|
|
}
|
|
|
|
void setVariableTypeMetadata(llvm::AllocaInst *I,
|
|
const model::Type &VariableType);
|
|
|
|
model::UpcastableType getVariableTypeFromMetadata(llvm::AllocaInst *I,
|
|
const model::Binary &Model);
|
|
|
|
///@}
|