[all-commits] [llvm/llvm-project] fabcad: Let M68kMCCodeEmitter set Scratch size. (#69898)

Erik Jonsson via All-commits all-commits at lists.llvm.org
Thu Oct 26 05:43:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fabcadf2eb20dcc2fa262a5a1c6752ac93544e9d
      https://github.com/llvm/llvm-project/commit/fabcadf2eb20dcc2fa262a5a1c6752ac93544e9d
  Author: Erik Jonsson <erik.j.jonsson at ericsson.com>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp
    M llvm/test/TableGen/VarLenEncoder.td
    M llvm/utils/TableGen/VarLenCodeEmitterGen.cpp

  Log Message:
  -----------
  Let M68kMCCodeEmitter set Scratch size. (#69898)

The Scratch buffer passed to getBinaryCodeForInst needs to be able to
hold any value returned by getMachineOpValue or other custom encoders.
It's better to let the caller of getBinaryCodeForInst set the size of
Scratch as it's impossible for VarLenCodeEmitterGen to know what the
smallest needed size is.

VarLenCodeEmitterGen now calculates its smallest needed Scratch bit
width based on the slice operations and zero extends Scratch if it's too
small. This only guarantees that Scratch has enough bits for the
generated code not for getMachineOpValue or custom encoders.

The smallest internal APInt representation uses one uint64_t word so
there is no point in using a smaller size.




More information about the All-commits mailing list