[llvm] [lld] [RISCV] Support printing immediate of RISCV MCInst in hexadecimal format (PR #74053)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 23:33:49 PST 2023


topperc wrote:

> > > > > > > gnu objdump for RISC-V is inconsistent. Looking at a dump from 2.41 I see Shift by immediate uses hex. addi/andi/ori/xori/li use decimal lui uses hex. load/store offset use decimal. label offsets on branches use hex vmv.v.i uses decimal
> > > > > > 
> > > > > > 
> > > > > > Thanks for your correction, and do you think we should conform to gnu's behavior? Or just be the same as other architecture in llvm.
> > > > > 
> > > > > 
> > > > > We can conform to other architectures.
> > > > 
> > > > 
> > > > AArch64 uses decimal, as a data point, as do the various MIPS targets, PowerPC and x86, at least for a simple load with an offset.
> > > > To me this makes the output less user-friendly, and it's quite annoying churn for downstream. I've been perfectly happy with the output as it stands... Not to mention that it now _deviates_ from what appears to be the standard practice.
> > > > So personally I'm extremely anti this patch.
> > > 
> > > 
> > > AArch64 and X86 both use `formatImm` as far as I can see. How do they end up defaulting to decimal and RISC-V is defaulting to hex?
> > 
> > 
> > Oh they've _all_ been changed, that's awful. Is there an RFC about this tree-wide behavioural change that, IMO, is a regression?
> 
> AArch64 made the change to use formatImm in 2016 http://reviews.llvm.org/D16929 Not sure what llvm-objdump defaulted to at the time.

Here's where objdump default changed https://reviews.llvm.org/D136972

https://github.com/llvm/llvm-project/pull/74053


More information about the llvm-commits mailing list