rGeb66833d1957
source link: https://reviews.llvm.org/rGeb66833d19573df97034a81279eda31b8d19815b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Restricted Project
- Restricted Project
- Restricted Project
[clang][WebAssembly] Initial support for reference type externref in clang
This patch introduces a new type externref_t that denotes a WebAssembly opaque
reference type. It also implements builtin builtin_wasm_ref_null_extern(),
that returns a null value of __externref_t. This lays the ground work
for further builtins and reference types.
Differential Revision: https://reviews.llvm.org/D122215
clang/include/clang/AST/ASTContext.h
Show First 20 Lines • Show All 1,120 Lines • ▼ Show 20 Lines | |||
CanQualType SingletonId; | |||
#include "clang/Basic/AArch64SVEACLETypes.def" | |||
#define PPC_VECTOR_TYPE(Name, Id, Size) \ | |||
CanQualType Id##Ty; | |||
#include "clang/Basic/PPCTypes.def" | |||
#define RVV_TYPE(Name, Id, SingletonId) \ | |||
CanQualType SingletonId; | |||
#include "clang/Basic/RISCVVTypes.def" | |||
+ #define WASM_TYPE(Name, Id, SingletonId) CanQualType SingletonId; | |||
+ #include "clang/Basic/WebAssemblyReferenceTypes.def" | |||
// Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. | |||
mutable QualType AutoDeductTy; // Deduction against 'auto'. | |||
mutable QualType AutoRRefDeductTy; // Deduction against 'auto &&'. | |||
// Decl used to help define __builtin_va_list for some targets. | |||
// The decl is built when constructing 'BuiltinVaListDecl'. | |||
mutable Decl *VaListTagDecl = nullptr; | |||
▲ Show 20 Lines • Show All 332 Lines • ▼ Show 20 Lines | |||
getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const; | |||
/// Return the unique reference to a scalable vector type of the specified | |||
/// element type and scalable number of elements. | |||
/// | |||
/// \pre \p EltTy must be a built-in type. | |||
QualType getScalableVectorType(QualType EltTy, unsigned NumElts) const; | |||
+ /// Return a WebAssembly externref type. | |||
+ QualType getWebAssemblyExternrefType() const; | |||
+ | |||
/// Return the unique reference to a vector type of the specified | |||
/// element type and size. | |||
/// | |||
/// \pre \p VectorType must be a built-in type. | |||
QualType getVectorType(QualType VectorType, unsigned NumElts, | |||
VectorType::VectorKind VecKind) const; | |||
/// Return the unique reference to the type for a dependently sized vector of | |||
/// the specified element type. | |||
▲ Show 20 Lines • Show All 1,977 Lines • Show Last 20 Lines |
clang/include/clang/AST/Type.h
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 2,023 Lines • ▼ Show 20 Lines | |||
/// Sizeless types contain data with no specified size, alignment, | |||
/// or layout. | |||
bool isSizelessType() const; | |||
bool isSizelessBuiltinType() const; | |||
/// Returns true for SVE scalable vector types. | |||
bool isSVESizelessBuiltinType() const; | |||
+ /// Check if this is a WebAssembly Reference Type. | |||
+ bool isWebAssemblyReferenceType() const; | |||
+ bool isWebAssemblyExternrefType() const; | |||
+ | |||
/// Determines if this is a sizeless type supported by the | |||
/// 'arm_sve_vector_bits' type attribute, which can be applied to a single | |||
/// SVE vector or predicate, excluding tuple types such as svint32x4_t. | |||
bool isVLSTBuiltinType() const; | |||
/// Returns the representative type for the element of an SVE builtin type. | |||
/// This is used to represent fixed-length SVE vectors created with the | |||
/// 'arm_sve_vector_bits' type attribute as VectorType. | |||
▲ Show 20 Lines • Show All 595 Lines • ▼ Show 20 Lines | |||
#define SVE_TYPE(Name, Id, SingletonId) Id, | |||
#include "clang/Basic/AArch64SVEACLETypes.def" | |||
// PPC MMA Types | |||
#define PPC_VECTOR_TYPE(Name, Id, Size) Id, | |||
#include "clang/Basic/PPCTypes.def" | |||
// RVV Types | |||
#define RVV_TYPE(Name, Id, SingletonId) Id, | |||
#include "clang/Basic/RISCVVTypes.def" | |||
+ // WebAssembly reference types | |||
+ #define WASM_TYPE(Name, Id, SingletonId) Id, | |||
+ #include "clang/Basic/WebAssemblyReferenceTypes.def" | |||
// All other builtin types | |||
#define BUILTIN_TYPE(Id, SingletonId) Id, | |||
#define LAST_BUILTIN_TYPE(Id) LastKind = Id | |||
#include "clang/AST/BuiltinTypes.def" | |||
}; | |||
private: | |||
friend class ASTContext; // ASTContext creates these. | |||
▲ Show 20 Lines • Show All 4,854 Lines • Show Last 20 Lines |
clang/include/clang/AST/TypeProperties.td
Show First 20 Lines • Show All 807 Lines • ▼ Show 20 Lines | |||
#define PPC_VECTOR_TYPE(NAME, ID, SIZE) \ | |||
case BuiltinType::ID: return ctx.ID##Ty; | |||
#include "clang/Basic/PPCTypes.def" | |||
#define RVV_TYPE(NAME, ID, SINGLETON_ID) \ | |||
case BuiltinType::ID: return ctx.SINGLETON_ID; | |||
#include "clang/Basic/RISCVVTypes.def" | |||
+ #define WASM_TYPE(NAME, ID, SINGLETON_ID) \ | |||
+ case BuiltinType::ID: return ctx.SINGLETON_ID; | |||
+ #include "clang/Basic/WebAssemblyReferenceTypes.def" | |||
+ | |||
#define BUILTIN_TYPE(ID, SINGLETON_ID) \ | |||
case BuiltinType::ID: return ctx.SINGLETON_ID; | |||
#include "clang/AST/BuiltinTypes.def" | |||
} | |||
llvm_unreachable("unreachable builtin case"); | |||
}]>; | |||
} | |||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |
clang/include/clang/Basic/BuiltinsWebAssembly.def
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||
TARGET_BUILTIN(__builtin_wasm_relaxed_trunc_u_zero_i32x4_f64x2, "V4UiV2d", "nc", "relaxed-simd") | |||
TARGET_BUILTIN(__builtin_wasm_relaxed_q15mulr_s_i16x8, "V8sV8sV8s", "nc", "relaxed-simd") | |||
TARGET_BUILTIN(__builtin_wasm_relaxed_dot_i8x16_i7x16_s_i16x8, "V8sV16ScV16Sc", "nc", "relaxed-simd") | |||
TARGET_BUILTIN(__builtin_wasm_relaxed_dot_i8x16_i7x16_add_s_i32x4, "V4iV16ScV16ScV4i", "nc", "relaxed-simd") | |||
TARGET_BUILTIN(__builtin_wasm_relaxed_dot_bf16x8_add_f32_f32x4, "V4fV8UsV8UsV4f", "nc", "relaxed-simd") | |||
+ // Reference Types builtins | |||
+ | |||
+ TARGET_BUILTIN(__builtin_wasm_ref_null_extern, "i", "nct", "reference-types") | |||
+ | |||
#undef BUILTIN | |||
#undef TARGET_BUILTIN |
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/WebAssemblyReferenceTypes.def
clang/include/clang/Sema/Sema.h
clang/include/clang/Serialization/ASTBitCodes.h
clang/include/clang/module.modulemap
clang/lib/AST/ASTContext.cpp
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/AST/NSAPI.cpp
clang/lib/AST/PrintfFormatString.cpp
clang/lib/AST/Type.cpp
clang/lib/AST/TypeLoc.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/CodeGen/CodeGenTypes.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/lib/Index/USRGeneration.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Serialization/ASTCommon.cpp
clang/lib/Serialization/ASTReader.cpp
clang/test/CodeGen/WebAssembly/wasm-externref.c
clang/test/CodeGen/builtins-wasm.c
clang/test/CodeGenCXX/wasm-reftypes-mangle.cpp
clang/test/CodeGenCXX/wasm-reftypes-typeinfo.cpp
clang/test/Sema/wasm-refs.c
clang/test/SemaCXX/wasm-refs.cpp
clang/test/SemaTemplate/address_space-dependent.cpp
clang/tools/libclang/CIndex.cpp
llvm/include/llvm/IR/Type.h
llvm/include/llvm/Transforms/Utils.h
llvm/lib/CodeGen/ValueTypes.cpp
llvm/lib/IR/Type.cpp
llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
llvm/lib/Transforms/Utils/Mem2Reg.cpp
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK