mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
99df2e19d4
* Running clang-format on files with some additional custom scripts for my style * Fix missing unique_ptr in remill/BC/Optimizer.h * Fixes and selective disabling of clang-format
27 lines
686 B
C++
27 lines
686 B
C++
#include <llvm/IR/DataLayout.h>
|
|
|
|
namespace remill {
|
|
|
|
#if LLVM_VERSION_NUMBER < LLVM_VERSION(10, 0)
|
|
inline static uint64_t TypeSizeToBits(uint64_t bits) {
|
|
return bits;
|
|
}
|
|
inline static uint64_t BitsToTypeSize(uint64_t size) {
|
|
return size;
|
|
}
|
|
#else
|
|
inline static uint64_t TypeSizeToBits(llvm::TypeSize type_type) {
|
|
return type_type.getFixedSize();
|
|
}
|
|
inline static llvm::TypeSize BitsToTypeSize(uint64_t size) {
|
|
return llvm::TypeSize::Fixed(size);
|
|
}
|
|
#endif
|
|
|
|
inline static uint64_t SizeOfTypeInBits(const llvm::DataLayout &data_layout,
|
|
llvm::Type *type) {
|
|
return TypeSizeToBits(data_layout.getTypeSizeInBits(type));
|
|
}
|
|
|
|
} // namespace remill
|