[LLVMdev] Patch for PR4776
ransford at cs.umass.edu
Thu Sep 17 10:08:25 PDT 2009
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5939 bytes
Desc: not available
More information about the llvm-dev