Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
TypedPointerType.cpp
Go to the documentation of this file.
1//===- TypedPointerType.cpp - Typed Pointer Type --------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//
10//===----------------------------------------------------------------------===//
11
12#include "llvm/IR/TypedPointerType.h"
13#include "LLVMContextImpl.h"
14
15using namespacellvm;
16
17TypedPointerType *TypedPointerType::get(Type *EltTy,unsignedAddressSpace) {
18assert(EltTy &&"Can't get a pointer to <null> type!");
19assert(isValidElementType(EltTy) &&"Invalid type for pointer element!");
20
21LLVMContextImpl *CImpl = EltTy->getContext().pImpl;
22
23TypedPointerType *&Entry =
24 CImpl->ASTypedPointerTypes[std::make_pair(EltTy,AddressSpace)];
25
26if (!Entry)
27 Entry =new (CImpl->Alloc)TypedPointerType(EltTy,AddressSpace);
28return Entry;
29}
30
31TypedPointerType::TypedPointerType(Type *E,unsigned AddrSpace)
32 :Type(E->getContext(), TypedPointerTyID), PointeeTy(E) {
33ContainedTys = &PointeeTy;
34NumContainedTys = 1;
35setSubclassData(AddrSpace);
36}
37
38boolTypedPointerType::isValidElementType(Type *ElemTy) {
39return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
40 !ElemTy->isMetadataTy() && !ElemTy->isTokenTy() &&
41 !ElemTy->isX86_AMXTy();
42}
LLVMContextImpl.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
TypedPointerType.h
llvm::LLVMContextImpl
Definition:LLVMContextImpl.h:1469
llvm::LLVMContextImpl::ASTypedPointerTypes
DenseMap< std::pair< Type *, unsigned >, TypedPointerType * > ASTypedPointerTypes
Definition:LLVMContextImpl.h:1625
llvm::LLVMContextImpl::Alloc
BumpPtrAllocator Alloc
Definition:LLVMContextImpl.h:1604
llvm::LLVMContext::pImpl
LLVMContextImpl *const pImpl
Definition:LLVMContext.h:69
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Type::isLabelTy
bool isLabelTy() const
Return true if this is 'label'.
Definition:Type.h:228
llvm::Type::NumContainedTys
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition:Type.h:106
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition:Type.h:128
llvm::Type::ContainedTys
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition:Type.h:113
llvm::Type::setSubclassData
void setSubclassData(unsigned val)
Definition:Type.h:99
llvm::Type::isX86_AMXTy
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition:Type.h:200
llvm::Type::isTokenTy
bool isTokenTy() const
Return true if this is 'token'.
Definition:Type.h:234
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition:Type.h:139
llvm::Type::isMetadataTy
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition:Type.h:231
llvm::TypedPointerType
A few GPU targets, such as DXIL and SPIR-V, have typed pointers.
Definition:TypedPointerType.h:25
llvm::TypedPointerType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition:TypedPointerType.cpp:38
llvm::TypedPointerType::get
static TypedPointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Definition:TypedPointerType.cpp:17
llvm::NVPTXAS::AddressSpace
AddressSpace
Definition:NVPTXAddrSpace.h:20
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18

Generated on Thu Jul 17 2025 12:30:59 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp