[PATCH] D116462: [SPIRV 3/6] Add MC layer, object file support and InstPrinter

Ilia Diachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 2 00:34:43 PST 2022


iliya-diyachkov added a comment.





================
Comment at: llvm/include/llvm/MC/MCContext.h:80
+    enum Environment { IsMachO, IsELF, IsGOFF, IsCOFF, IsWasm, IsXCOFF,
+                       IsSPIRV };
 
----------------
rengolin wrote:
> Is this really a new object file type?
SPIR-V uses its own object file layout. A SPIR-V module is a single linear stream of words starting with some special words such as magic number, version number etc, followed by instruction stream. For more information, please refer to "2.3 Physical Layout of a SPIR-V Module and Instruction" of the SPIR-V specification.


================
Comment at: llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVMCAsmInfo.cpp:20
+                               const MCTargetOptions &Options) {
+  IsLittleEndian = true;
+
----------------
rengolin wrote:
> A previous patch has a comment on data layout that SPIRV can be either little or big endian. Was that comment left-over from copy-paste or is this line just simplifying the implementation for now?
> 
> If the former, removing the comment would be good. If the latter, adding a TODO here would be nice.
Yes, it looks confusing. According to the specification, literals are always packed in little-endian manner, so I'll remove the comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116462/new/

https://reviews.llvm.org/D116462



More information about the llvm-commits mailing list