[PATCHES] PR18303: Use appropriate Feature flags for encoding instructions

David Peixotto dpeixott at codeaurora.org
Thu Jan 9 14:53:48 PST 2014


On 1/9/2014 3:23 AM, David Woodhouse wrote:
> The X86 and ARM TargetAsmParsers are the main users of ToggleFeature().
> The way things currently work is the TargetAsmParser and the CodeEmitter
> are both initialised with the *same* SubtargetInfo object, so when the
> TargetAsmParser frobs it the CodeEmitter sees the change.

This is actually not true when parsing inline assembler. For inline 
assembly a new SubtargetInfo object is created and that leads to more 
problems. The TargetAsmParser is toggling the bits in one SubtargetInfo 
object which is completely unseen by the CodeEmitter. This means that 
any mode changes in inline assembly are ignored by the encoder.

I think that explicitly passing the SubtargetInfo to the 
EncodeInstruction() method would solve the problem with mismatched state 
when parsing inline assembly.

The other issue I found in the ARM backend is that noops can be encoded 
incorrectly because the ARMAsmBackend keeps its own bit of state about 
what mode it is in (http://llvm.org/bugs/show_bug.cgi?id=18019).I think 
adding the feature bits or subtarget info to the MCRelaxableFragment 
should solve this issue as well because the noops are used for an 
AlignmentFragment.



More information about the llvm-commits mailing list