@@ -374,16 +374,21 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) {
374374 }
375375 case Type::kPointer : {
376376 const Pointer* pointer = type->AsPointer ();
377- uint32_t subtype = GetTypeInstruction (pointer->pointee_type ());
378- if (subtype == 0 ) {
379- return 0 ;
377+ if (pointer->is_untyped ()) {
378+ typeInst = MakeUnique<Instruction>(
379+ context (), spv::Op::OpTypeUntypedPointerKHR, 0 , id,
380+ std::initializer_list<Operand>{
381+ {SPV_OPERAND_TYPE_STORAGE_CLASS,
382+ {static_cast <uint32_t >(pointer->storage_class ())}}});
383+ } else {
384+ uint32_t subtype = GetTypeInstruction (pointer->pointee_type ());
385+ typeInst = MakeUnique<Instruction>(
386+ context (), spv::Op::OpTypePointer, 0 , id,
387+ std::initializer_list<Operand>{
388+ {SPV_OPERAND_TYPE_STORAGE_CLASS,
389+ {static_cast <uint32_t >(pointer->storage_class ())}},
390+ {SPV_OPERAND_TYPE_ID, {subtype}}});
380391 }
381- typeInst = MakeUnique<Instruction>(
382- context (), spv::Op::OpTypePointer, 0 , id,
383- std::initializer_list<Operand>{
384- {SPV_OPERAND_TYPE_STORAGE_CLASS,
385- {static_cast <uint32_t >(pointer->storage_class ())}},
386- {SPV_OPERAND_TYPE_ID, {subtype}}});
387392 break ;
388393 }
389394 case Type::kFunction : {
@@ -680,9 +685,13 @@ Type* TypeManager::RebuildType(uint32_t type_id, const Type& type) {
680685 }
681686 case Type::kPointer : {
682687 const Pointer* pointer_ty = type.AsPointer ();
683- const Type* ele_ty = pointer_ty->pointee_type ();
684- rebuilt_ty = MakeUnique<Pointer>(RebuildType (GetId (ele_ty), *ele_ty),
685- pointer_ty->storage_class ());
688+ if (pointer_ty->pointee_type ()) {
689+ const Type* ele_ty = pointer_ty->pointee_type ();
690+ rebuilt_ty = MakeUnique<Pointer>(RebuildType (GetId (ele_ty), *ele_ty),
691+ pointer_ty->storage_class ());
692+ } else {
693+ rebuilt_ty = MakeUnique<Pointer>(nullptr , pointer_ty->storage_class ());
694+ }
686695 break ;
687696 }
688697 case Type::kFunction : {
@@ -928,6 +937,11 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) {
928937 id_to_incomplete_type_.erase (inst.result_id ());
929938
930939 } break ;
940+ case spv::Op::OpTypeUntypedPointerKHR: {
941+ type = new Pointer (nullptr , static_cast <spv::StorageClass>(
942+ inst.GetSingleWordInOperand (0 )));
943+ id_to_incomplete_type_.erase (inst.result_id ());
944+ } break ;
931945 case spv::Op::OpTypeFunction: {
932946 bool incomplete_type = false ;
933947 uint32_t return_type_id = inst.GetSingleWordInOperand (0 );
0 commit comments