================ @@ -0,0 +1,303 @@ +#ifndef LLVM_ABI_TYPES_H +#define LLVM_ABI_TYPES_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Allocator.h" +#include <cstdint> + +namespace llvm { +namespace abi { + +enum class TypeKind { + Void, + Integer, + Float, + Pointer, + Array, + Vector, + Struct, + Union, + Function +}; + +class Type { +protected: + TypeKind Kind; + uint64_t SizeInBits; + uint64_t AlignInBits; + bool IsExplicitlyAligned; + + Type(TypeKind K, uint64_t Size, uint64_t Align, bool ExplicitAlign = false) + : Kind(K), SizeInBits(Size), AlignInBits(Align), + IsExplicitlyAligned(ExplicitAlign) {} + +public: + TypeKind getKind() const { return Kind; } + uint64_t getSizeInBits() const { return SizeInBits; } + uint64_t getAlignInBits() const { return AlignInBits; } + bool hasExplicitAlignment() const { return IsExplicitlyAligned; } + + void setExplicitAlignment(uint64_t Align) { + AlignInBits = Align; + IsExplicitlyAligned = true; + } + + bool isVoid() const { return Kind == TypeKind::Void; } + bool isInteger() const { return Kind == TypeKind::Integer; } + bool isFloat() const { return Kind == TypeKind::Float; } + bool isPointer() const { return Kind == TypeKind::Pointer; } + bool isArray() const { return Kind == TypeKind::Array; } + bool isVector() const { return Kind == TypeKind::Vector; } + bool isStruct() const { return Kind == TypeKind::Struct; } + bool isUnion() const { return Kind == TypeKind::Union; } + bool isFunction() const { return Kind == TypeKind::Function; } +}; + +class VoidType : public Type { +public: + VoidType() : Type(TypeKind::Void, 0, 0) {} + + static bool classof(const Type *T) { return T->getKind() == TypeKind::Void; } +}; + +class IntegerType : public Type { +private: + bool IsSigned; + +public: + IntegerType(uint64_t BitWidth, uint64_t Align, bool Signed) ---------------- vortex73 wrote:
I've added this in the Mapper is that alright? https://github.com/llvm/llvm-project/pull/140112 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits