This patch is to add Image Operands in SPIR-V Dialect. And let ImageDrefGather to use Image Operands as an example.
Image Operands are used in many image instructions. The tricky part is that "Image Operands encodes what oprands follow, as per Image Operands".
And ususally, they are optional to image instructions.
I don't want to change the existing assemblyFormat too much. So this is the format I create for now:
%0 = spv.ImageDrefGather %1, ... %3 : f32 ["Bias|Lod"](%4, %5 : f32, f32) -> ...
Any comment about the Image Operands is welcome since it will impact almost all image instructions' format. Thank you in advance.
Anoter thing is that Image Operands have a lot of validation rules (See Section 3.14 in SPIR-V Spec). It would be a hugh amuont of work.
Therefore I leave an TODO in verifyImageOperands function.
co-authored: Alan Liu <email@example.com>