This commit is contained in:
Tex Riddell 2018-02-12 18:17:52 -08:00
Родитель 7d145d64d5
Коммит ca260c3891
4 изменённых файлов: 46 добавлений и 46 удалений

Просмотреть файл

@ -37,17 +37,17 @@ namespace dxilutil {
bool IsSharedMemoryGlobal(llvm::GlobalVariable *GV);
bool RemoveUnusedFunctions(llvm::Module &M, llvm::Function *EntryFunc,
llvm::Function *PatchConstantFunc, bool IsLib);
void EmitResMappingError(llvm::Instruction *Res);
// Change select/phi on operands into select/phi on operation.
// phi0 = phi a0, b0, c0
// phi1 = phi a1, b1, c1
// Inst = Add(phi0, phi1);
// into
// A = Add(a0, a1);
// B = Add(b0, b1);
// C = Add(c0, c1);
// NewInst = phi A, B, C
// Only support 1 operand now, other oerands should be Constant.
void EmitResMappingError(llvm::Instruction *Res);
// Change select/phi on operands into select/phi on operation.
// phi0 = phi a0, b0, c0
// phi1 = phi a1, b1, c1
// Inst = Add(phi0, phi1);
// into
// A = Add(a0, a1);
// B = Add(b0, b1);
// C = Add(c0, c1);
// NewInst = phi A, B, C
// Only support 1 operand now, other oerands should be Constant.
llvm::Value * SelectOnOperation(llvm::Instruction *Inst, unsigned operandIdx);
std::unique_ptr<llvm::Module> LoadModuleFromBitcode(llvm::StringRef BC,
llvm::LLVMContext &Ctx, std::string &DiagStr);

Просмотреть файл

@ -4401,13 +4401,13 @@ Value *StreamOutputLower(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode,
}
// This table has to match IntrinsicOp orders
IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] = {
IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] = {
{IntrinsicOp::IOP_AcceptHitAndEndSearch, TrivialNoArgOperation, DXIL::OpCode::AcceptHitAndEndSearch},
{IntrinsicOp::IOP_AddUint64, TranslateAddUint64, DXIL::OpCode::UAddc},
{IntrinsicOp::IOP_AllMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_AllMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_AllMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_CallShader, TranslateCallShader, DXIL::OpCode::CallShader},
{IntrinsicOp::IOP_CheckAccessFullyMapped, TranslateCheckAccess, DXIL::OpCode::CheckAccessFullyMapped},
{IntrinsicOp::IOP_CheckAccessFullyMapped, TranslateCheckAccess, DXIL::OpCode::CheckAccessFullyMapped},
{IntrinsicOp::IOP_CurrentRayT, TrivialNoArgWithRetOperation, DXIL::OpCode::CurrentRayT},
{IntrinsicOp::IOP_D3DCOLORtoUBYTE4, TranslateD3DColorToUByte4, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_DeviceMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
@ -4419,10 +4419,10 @@ IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] =
{IntrinsicOp::IOP_GetRenderTargetSampleCount, TrivialNoArgOperation, DXIL::OpCode::RenderTargetGetSampleCount},
{IntrinsicOp::IOP_GetRenderTargetSamplePosition, TranslateGetRTSamplePos, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_GroupMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_GroupMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_HitKind, TrivialNoArgWithRetOperation, DXIL::OpCode::HitKind},
{IntrinsicOp::IOP_IgnoreHit, TrivialNoArgOperation, DXIL::OpCode::IgnoreHit},
{IntrinsicOp::IOP_InstanceID, TrivialNoArgWithRetOperation, DXIL::OpCode::InstanceID},
{IntrinsicOp::IOP_GroupMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_HitKind, TrivialNoArgWithRetOperation, DXIL::OpCode::HitKind},
{IntrinsicOp::IOP_IgnoreHit, TrivialNoArgOperation, DXIL::OpCode::IgnoreHit},
{IntrinsicOp::IOP_InstanceID, TrivialNoArgWithRetOperation, DXIL::OpCode::InstanceID},
{IntrinsicOp::IOP_InstanceIndex, TrivialNoArgWithRetOperation, DXIL::OpCode::InstanceIndex},
{IntrinsicOp::IOP_InterlockedAdd, TranslateIopAtomicBinaryOperation, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_InterlockedAnd, TranslateIopAtomicBinaryOperation, DXIL::OpCode::NumOpCodes},
@ -4433,10 +4433,10 @@ IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] =
{IntrinsicOp::IOP_InterlockedMin, TranslateIopAtomicBinaryOperation, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_InterlockedOr, TranslateIopAtomicBinaryOperation, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_InterlockedXor, TranslateIopAtomicBinaryOperation, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_NonUniformResourceIndex, TranslateNonUniformResourceIndex, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_ObjectRayDirection, TranslateNoArgVectorOperation, DXIL::OpCode::ObjectRayDirection},
{IntrinsicOp::IOP_ObjectRayOrigin, TranslateNoArgVectorOperation, DXIL::OpCode::ObjectRayOrigin},
{IntrinsicOp::IOP_ObjectToWorld, TranslateNoArgMatrixOperation, DXIL::OpCode::ObjectToWorld},
{IntrinsicOp::IOP_NonUniformResourceIndex, TranslateNonUniformResourceIndex, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_ObjectRayDirection, TranslateNoArgVectorOperation, DXIL::OpCode::ObjectRayDirection},
{IntrinsicOp::IOP_ObjectRayOrigin, TranslateNoArgVectorOperation, DXIL::OpCode::ObjectRayOrigin},
{IntrinsicOp::IOP_ObjectToWorld, TranslateNoArgMatrixOperation, DXIL::OpCode::ObjectToWorld},
{IntrinsicOp::IOP_PrimitiveID, TrivialNoArgWithRetOperation, DXIL::OpCode::PrimitiveID},
{IntrinsicOp::IOP_Process2DQuadTessFactorsAvg, TranslateProcessTessFactors, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_Process2DQuadTessFactorsMax, TranslateProcessTessFactors, DXIL::OpCode::NumOpCodes},
@ -4451,12 +4451,12 @@ IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] =
{IntrinsicOp::IOP_QuadReadAcrossDiagonal, TranslateQuadReadAcross, DXIL::OpCode::QuadOp},
{IntrinsicOp::IOP_QuadReadAcrossX, TranslateQuadReadAcross, DXIL::OpCode::QuadOp},
{IntrinsicOp::IOP_QuadReadAcrossY, TranslateQuadReadAcross, DXIL::OpCode::QuadOp},
{IntrinsicOp::IOP_QuadReadLaneAt, TranslateQuadReadLaneAt, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_RayDispatchDimension, TranslateNoArgVectorOperation, DXIL::OpCode::RayDispatchDimension},
{IntrinsicOp::IOP_RayDispatchIndex, TranslateNoArgVectorOperation, DXIL::OpCode::RayDispatchIndex},
{IntrinsicOp::IOP_RayFlag, TrivialNoArgWithRetOperation, DXIL::OpCode::RayFlag},
{IntrinsicOp::IOP_RayTMin, TrivialNoArgWithRetOperation, DXIL::OpCode::RayTMin},
{IntrinsicOp::IOP_ReportHit, TranslateReportIntersection, DXIL::OpCode::ReportHit},
{IntrinsicOp::IOP_QuadReadLaneAt, TranslateQuadReadLaneAt, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_RayDispatchDimension, TranslateNoArgVectorOperation, DXIL::OpCode::RayDispatchDimension},
{IntrinsicOp::IOP_RayDispatchIndex, TranslateNoArgVectorOperation, DXIL::OpCode::RayDispatchIndex},
{IntrinsicOp::IOP_RayFlag, TrivialNoArgWithRetOperation, DXIL::OpCode::RayFlag},
{IntrinsicOp::IOP_RayTMin, TrivialNoArgWithRetOperation, DXIL::OpCode::RayTMin},
{IntrinsicOp::IOP_ReportHit, TranslateReportIntersection, DXIL::OpCode::ReportHit},
{IntrinsicOp::IOP_TraceRay, TranslateTraceRay, DXIL::OpCode::TraceRay},
{IntrinsicOp::IOP_WaveActiveAllEqual, TranslateWaveAllEqual, DXIL::OpCode::WaveActiveAllEqual},
{IntrinsicOp::IOP_WaveActiveAllTrue, TranslateWaveA2B, DXIL::OpCode::WaveAllTrue},
@ -4477,9 +4477,9 @@ IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] =
{IntrinsicOp::IOP_WavePrefixProduct, TranslateWaveA2A, DXIL::OpCode::WavePrefixOp},
{IntrinsicOp::IOP_WavePrefixSum, TranslateWaveA2A, DXIL::OpCode::WavePrefixOp},
{IntrinsicOp::IOP_WaveReadLaneAt, TranslateWaveReadLaneAt, DXIL::OpCode::WaveReadLaneAt},
{IntrinsicOp::IOP_WaveReadLaneFirst, TranslateWaveReadLaneFirst, DXIL::OpCode::WaveReadLaneFirst},
{IntrinsicOp::IOP_WorldRayDirection, TranslateNoArgVectorOperation, DXIL::OpCode::WorldRayDirection},
{IntrinsicOp::IOP_WorldRayOrigin, TranslateNoArgVectorOperation, DXIL::OpCode::WorldRayOrigin},
{IntrinsicOp::IOP_WaveReadLaneFirst, TranslateWaveReadLaneFirst, DXIL::OpCode::WaveReadLaneFirst},
{IntrinsicOp::IOP_WorldRayDirection, TranslateNoArgVectorOperation, DXIL::OpCode::WorldRayDirection},
{IntrinsicOp::IOP_WorldRayOrigin, TranslateNoArgVectorOperation, DXIL::OpCode::WorldRayOrigin},
{IntrinsicOp::IOP_WorldToObject, TranslateNoArgMatrixOperation, DXIL::OpCode::WorldToObject},
{IntrinsicOp::IOP_abort, EmptyLower, DXIL::OpCode::NumOpCodes},
{IntrinsicOp::IOP_abs, TransalteAbs, DXIL::OpCode::NumOpCodes},

Просмотреть файл

@ -3058,7 +3058,7 @@ private:
uint8_t templateArgCount = g_ArBasicKindsTemplateCount[i];
CXXRecordDecl* recordDecl = nullptr;
if (kind == AR_OBJECT_RAY_DESC) {
QualType float3Ty = LookupVectorType(HLSLScalarType::HLSLScalarType_float, 3);
QualType float3Ty = LookupVectorType(HLSLScalarType::HLSLScalarType_float, 3);
recordDecl = CreateRayDescStruct(*m_context, float3Ty);
} else
if (templateArgCount == 0)
@ -5036,8 +5036,8 @@ bool HLSLExternalSource::MatchArguments(
if (pIntrinsicArg->uLegalComponentTypes == LICOMPTYPE_USER_DEFINE_TYPE) {
DXASSERT(objectElement.isNull(), "");
QualType Ty = pCallArg->getType();
// Must be user define type for LICOMPTYPE_USER_DEFINE_TYPE arg.
if (!Ty->isRecordType() ||
// Must be user define type for LICOMPTYPE_USER_DEFINE_TYPE arg.
if (!Ty->isRecordType() ||
hlsl::IsHLSLVecMatType(Ty) ||
hlsl::IsHLSLResourceType(Ty)) {
m_sema->Diag(pCallArg->getExprLoc(),

Просмотреть файл

@ -1,13 +1,13 @@
// RUN: %dxc -T lib_6_2 %s | FileCheck %s
// TODO: make sure CreateHandleFromResourceStructForLib is called.
// CHECK: emit
struct M {
float3 a;
Texture2D<float4> tex;
};
float4 emit(M m) {
return m.tex.Load(m.a);
// RUN: %dxc -T lib_6_2 %s | FileCheck %s
// TODO: make sure CreateHandleFromResourceStructForLib is called.
// CHECK: emit
struct M {
float3 a;
Texture2D<float4> tex;
};
float4 emit(M m) {
return m.tex.Load(m.a);
}