Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:10

0001 //===- llvm/IR/TypedPointerType.h - Typed Pointer Type --------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains typed pointer type information. It is separated out into
0010 // a separate file to make it less likely to accidentally use this type.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_IR_TYPEDPOINTERTYPE_H
0015 #define LLVM_IR_TYPEDPOINTERTYPE_H
0016 
0017 #include "llvm/IR/Type.h"
0018 
0019 namespace llvm {
0020 
0021 /// A few GPU targets, such as DXIL and SPIR-V, have typed pointers. This
0022 /// pointer type abstraction is used for tracking the types of these pointers.
0023 /// It is not legal to use this type, or derived types containing this type, in
0024 /// LLVM IR.
0025 class TypedPointerType : public Type {
0026   explicit TypedPointerType(Type *ElType, unsigned AddrSpace);
0027 
0028   Type *PointeeTy;
0029 
0030 public:
0031   TypedPointerType(const TypedPointerType &) = delete;
0032   TypedPointerType &operator=(const TypedPointerType &) = delete;
0033 
0034   /// This constructs a pointer to an object of the specified type in a numbered
0035   /// address space.
0036   static TypedPointerType *get(Type *ElementType, unsigned AddressSpace);
0037 
0038   /// Return true if the specified type is valid as a element type.
0039   static bool isValidElementType(Type *ElemTy);
0040 
0041   /// Return the address space of the Pointer type.
0042   unsigned getAddressSpace() const { return getSubclassData(); }
0043 
0044   Type *getElementType() const { return PointeeTy; }
0045 
0046   /// Implement support type inquiry through isa, cast, and dyn_cast.
0047   static bool classof(const Type *T) {
0048     return T->getTypeID() == TypedPointerTyID;
0049   }
0050 };
0051 
0052 } // namespace llvm
0053 
0054 #endif // LLVM_IR_TYPEDPOINTERTYPE_H