Added getTypeNumBytes() function as a class member to several SPIR-V Types:
- Scalar
- Array
- Vector
- Pointer
This is a function that will expose getTypeNumBytes() from SPIRVLowering.cpp to other classes. Support of other SPIR-V types can be added on demand.
Nit: The Type in the method does not help much given this is a method for .. type. :)
Typically think the method name and variable name and other name as the first line of documentation. A good name can go a long way for helping others understanding the code without referencing to the documentation and others additional stuff. For example, NumBytes is good here given it's very clear the unit of the return number so one does not need to guess whether is in bytes or bits or whatever. What do you think about getSizeInBytes here?
Also we need to document it here. What if the type can have explicit layout? What if not? What does it mean to return None?