[LLVMdev] [llvm-commits] [patch] ARM/MC/ELF add new stub for movt/movw in ARMFixupKinds

Jason Kim jasonwkim at google.com
Tue Nov 16 16:01:53 PST 2010


+llvmdev
-llvmcommits

On Fri, Nov 12, 2010 at 8:03 AM, Jim Grosbach <grosbach at apple.com> wrote:
> Sorta. getBinaryCodeForInst() is auto-generated by tablegen, so shouldn't be modified directly. The target can register hooks for instruction operands for any special encoding needs, including registering fixups, using the EncoderMethod string. For an example, have a look at the LDRi12 instruction and how it registers a fixup for the addrmode_imm12 operand when it needs one.

Hi Jim,. follow up question for ya:

The current movt/movw pair (as defined in ARMInstrInfo.td)  does not
use EncoderMethod string to declare  a special case handler.

At the current time, for the assembly printing,
MCAsmStreamer::EmitInstruction(const MCInst &Inst) calls out to
  MCExpr::print(raw_ostream &OS)
   which then calls out to MCSymbolRefExpr::getVariantKindName() to
print the magic :lower16: and :upper16: asm tags for .s emission
Currently, movt/movw emission works correctly in .s, but not in .o emission

This lead me to believe that the correct place to put the code to handle
MCSymbolRefExpr::VK_ARM_(HI||LO)16 for the .o path was to place a case
in getMachineOpValue() (i.e. not
ARMMCCodeEmitter::getBinaryCodeForInstr like I mistakenly wrote in my
prior email.)

Are you implying that the movt/movw instruction definition in the .td
files need to be fixed up instead to declare a new special case for .o
emission via the EncoderMethod string, for the .o emission of
movt/movw to be considered "correct"?
(If so, I have a few more followup^2 quesitions :-)

Thanks!

-jason

>
> On Nov 11, 2010, at 7:06 PM, Jason Kim wrote:
>
>> Is getBinaryCodeForInst the best place to place the case for
>> supporting movt/movw fixup emission?
>> The call stack seems to be:
>>
>> #0 ARMMCCodeEmitter::getBinaryCodeForInstr
>> #1 ARMMCCodeEmitter::EncodeInstruction
>> #2 MCELFStreamer::EmitInstToData
>> #3 MCObjectStreamer::EmitInstruction
>> #4 ARMAsmPrinter::EmitInstruction
>> <arm-mc-elf-s08.patch>_______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>




More information about the llvm-dev mailing list