This patch against svn r82147 "fixes" PR4776. Certain targets (e.g.,
MSP430) allow a symbol to start with a number, e.g. "0x0021"; you can
say stuff like "mov.b &0x0021, r15" to copy a byte from memory address
0x0021 to register r15. LLVM had been generating this ill-formed code
mov.b &_30_x0021, r15 # note ASCII '0' has character code 0x30
Chris suggested that I add a bool for "symbols can start with digit"
to MCAsmInfo and set it to true in the MSP430 backend, then make the
mangler and MCSymbol printer respect that bool -- so that's what I
Chris blessed the patch in the Bugzilla thread, but I wanted to
solicit comments here because it's my first. (Is my approach
reasonable? Would a more conservative strategy, e.g., just allowing
symbols to start with "0x", suffice?)
My own comments: there's a lot of code duplication between MCSymbol
and Mangler; I'm not sure whether that's intentional or unavoidable.
I also noticed words like "name" and "symbol" being used
interchangeably and somewhat inconsistently; my patch simply follows
the naming schemes apparent in each file I touched.
pr4776-vs-r82147.patch (5.8 KB)