This is enough to compile and link but doesn't yet do anything particularly useful. Once an ASM parser and printer are added in the next two patches, the whole thing can be usefully tested.
Details
Diff Detail
Event Timeline
lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp | ||
---|---|---|
27 | What values can this take? Is this an enum, or a bitmask? | |
50 | Should this function ever be called? If not, llvm_unreachable. | |
lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp | ||
21 | OT for this patch, but does the use of a single variable CalleeSaveStackSlotSize imply that we assume all registers which are callee saved have a fixed spill size? This seems strange for architectures which have multiple register classes with different sizes. |
lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp | ||
---|---|---|
40 | Nit: The LLVM Coding Standards say that comments should use proper capitalization, punctuation, etc.: http://llvm.org/docs/CodingStandards.html#commenting | |
lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | ||
47–48 | Nit: The LLVM Coding Standards say not to duplicate method names in comments: http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments Also applies to the method below. |
Add llvm_unreachable as suggested by @reames and address nits from @jordy.portman.lists regarding comment formatting.
lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp | ||
---|---|---|
27 | Ultimately, it should be one of the ELFOSABI_* values defined in llvm/support/ELF.h. Except unlike (for instance) OSType in Triple.h, the enum has no name. The uint8_t type also matches the return type of the static helper MCELFObjectTargetWriter::getOSABI which is used to set its value. I think uint8_t is therefore the best choice here. The value is never inspected in RISCV backend code anyway, it's just passed around. |
lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | ||
---|---|---|
72 | The cast here is odd. It would be cleaner to make Bits a uint32_t and then let the compiler pick the matching instantiation of write<>. It might be worth a comment saying that this will need changing for variable-length instructions, too (the RISC-V spec currently allows instructions to be up to 320 bits, though I don't know of anyone who is using ones that are longer than 64 bits yet). |
lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp | ||
---|---|---|
23 | No, it doesn't. We spill according to the register class size. This value seems only to be used in lib/MC/MCDwarf.cpp, for emitting CFI instructions -- and that use case seems like it's just a factor written to the CIE which all the CFI instructions get multiplied by. |
Refresh to follow changes made in rL283702, putting TheRISCV32Target and TheRISCV64Target behind accessors.
What values can this take? Is this an enum, or a bitmask?