clang 24.0.0git
CGHLSLRuntime.cpp File Reference
#include "CGHLSLRuntime.h"
#include "CGDebugInfo.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "HLSLBufferLayoutBuilder.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/HLSLResource.h"
#include "clang/AST/MatrixUtils.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Type.h"
#include "clang/Basic/DiagnosticDriver.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetOptions.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Enum.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Frontend/HLSL/HLSLResource.h"
#include "llvm/Frontend/HLSL/RootSignatureMetadata.h"
#include "llvm/Frontend/HLSL/SemanticSignaturePacking.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <array>
#include <cstdint>
#include <optional>

Go to the source code of this file.

Classes

class  OpaqueValueVisitor

Functions

static const clang::HLSLAttributedResourceType * createBufferHandleType (const HLSLBufferDecl *BufDecl)
static Value * buildVectorInput (IRBuilder<> &B, Function *F, llvm::Type *Ty)
static bool requiresFlatInterpolation (llvm::Type *Ty)
static llvm::hlsl::InterpolationMode getSPIRVInterpolationMode (llvm::hlsl::InterpolationMode InterpMode, llvm::Type *Ty, llvm::Triple::EnvironmentType Stage, llvm::hlsl::IOType IO)
static void addSPIRVInterfaceDecorations (llvm::GlobalVariable *GV, llvm::hlsl::SPIRVInterfaceDecoration Decoration, unsigned Operand, llvm::hlsl::InterpolationMode InterpMode=llvm::hlsl::InterpolationMode::Undefined)
static llvm::Value * createSPIRVInputLoad (IRBuilder<> &B, llvm::Module &M, llvm::Type *Ty, const Twine &Name, llvm::hlsl::SPIRVInterfaceDecoration Decoration, unsigned Operand, llvm::hlsl::InterpolationMode InterpMode)
static void createSPIRVOutputStore (IRBuilder<> &B, llvm::Module &M, llvm::Value *Source, const Twine &Name, llvm::hlsl::SPIRVInterfaceDecoration Decoration, unsigned Operand, llvm::hlsl::InterpolationMode InterpMode)
static QualType getSemanticLeafType (const clang::DeclaratorDecl *Decl)
static SemanticShape getSemanticShape (ASTContext &Ctx, QualType Ty)
static llvm::dxil::ElementType getSignatureComponentType (CodeGenModule &CGM, QualType Ty)
static llvm::hlsl::SemanticSignatureElement createSemanticSignatureElement (CodeGenModule &CGM, uint32_t SigId, HLSLAppliedSemanticAttr *Semantic, std::optional< unsigned > Index, const SemanticShape &Shape)
static void gatherFunctions (SmallVectorImpl< Function * > &Fns, llvm::Module &M, bool CtorOrDtor)
static void initializeBuffer (CodeGenModule &CGM, llvm::GlobalVariable *GV, Intrinsic::ID IntrID, ArrayRef< llvm::Value * > Args)

Function Documentation

◆ addSPIRVInterfaceDecorations()

void addSPIRVInterfaceDecorations ( llvm::GlobalVariable * GV,
llvm::hlsl::SPIRVInterfaceDecoration Decoration,
unsigned Operand,
llvm::hlsl::InterpolationMode InterpMode = llvm::hlsl::InterpolationMode::Undefined )
static

◆ buildVectorInput()

Value * buildVectorInput ( IRBuilder<> & B,
Function * F,
llvm::Type * Ty )
static

◆ createBufferHandleType()

◆ createSemanticSignatureElement()

llvm::hlsl::SemanticSignatureElement createSemanticSignatureElement ( CodeGenModule & CGM,
uint32_t SigId,
HLSLAppliedSemanticAttr * Semantic,
std::optional< unsigned > Index,
const SemanticShape & Shape )
static

Definition at line 1337 of file CGHLSLRuntime.cpp.

References getSignatureComponentType(), uint32_t, and uint8_t.

◆ createSPIRVInputLoad()

llvm::Value * createSPIRVInputLoad ( IRBuilder<> & B,
llvm::Module & M,
llvm::Type * Ty,
const Twine & Name,
llvm::hlsl::SPIRVInterfaceDecoration Decoration,
unsigned Operand,
llvm::hlsl::InterpolationMode InterpMode )
static

◆ createSPIRVOutputStore()

void createSPIRVOutputStore ( IRBuilder<> & B,
llvm::Module & M,
llvm::Value * Source,
const Twine & Name,
llvm::hlsl::SPIRVInterfaceDecoration Decoration,
unsigned Operand,
llvm::hlsl::InterpolationMode InterpMode )
static

◆ gatherFunctions()

void gatherFunctions ( SmallVectorImpl< Function * > & Fns,
llvm::Module & M,
bool CtorOrDtor )
static

◆ getSemanticLeafType()

QualType getSemanticLeafType ( const clang::DeclaratorDecl * Decl)
static

Definition at line 1296 of file CGHLSLRuntime.cpp.

◆ getSemanticShape()

◆ getSignatureComponentType()

◆ getSPIRVInterpolationMode()

llvm::hlsl::InterpolationMode getSPIRVInterpolationMode ( llvm::hlsl::InterpolationMode InterpMode,
llvm::Type * Ty,
llvm::Triple::EnvironmentType Stage,
llvm::hlsl::IOType IO )
static

◆ initializeBuffer()

void initializeBuffer ( CodeGenModule & CGM,
llvm::GlobalVariable * GV,
Intrinsic::ID IntrID,
ArrayRef< llvm::Value * > Args )
static

◆ requiresFlatInterpolation()

bool requiresFlatInterpolation ( llvm::Type * Ty)
static

Definition at line 1102 of file CGHLSLRuntime.cpp.

Referenced by getSPIRVInterpolationMode().