[PATCH] D120476: [LoongArch] Add basic support to AsmParser

Min-Yih Hsu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 20:40:28 PST 2022


myhsu added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp:81
+unsigned
+LoongArchMCCodeEmitter::getImmOpValueSub1(const MCInst &MI, unsigned OpNo,
+                                          SmallVectorImpl<MCFixup> &Fixups,
----------------
SixWeining wrote:
> myhsu wrote:
> > Why did you include code emitter changes here? can you split these (and the `EncoderMethod` changes in the tablegen files) into another patch?
> These 2 methods are used by assembler to encode instruction's `unusual` immediate operand.  The word `unusual` means the encoding of an immediate in instruction is not the same as its binary representation. For example,  the `bl` instruction requires a signed 28-bits integer as its operand and the low 2-bits must be 0. So assembler only need to encode the uppper 26-bits into instruction's encoding.
> 
> So I think these changes could not be moved otherwise the MC test will fail.
but without these two instructions to encode `unusual`, why didn't the previous version of tests (.mir files) also fail?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120476



More information about the llvm-commits mailing list