[LLVMdev] All backends now use the MC asm printer
venkatra at cs.wisc.edu
Sun Jan 12 12:10:15 PST 2014
On Sat, Jan 11, 2014 at 11:20 PM, Sean Silva <chisophugis at gmail.com> wrote:
> On Sat, Jan 11, 2014 at 5:26 PM, Richard Pennington <rich at pennware.com>
>> On 01/10/2014 04:06 PM, Rafael Espíndola wrote:
>>> In r198030 the last in tree backend was converted to use MCInst for
>>> printing assembly. I removed support for the old printer in r198959.
>>> Out of tree targets have to lower MachineInstr to MCInst to use the new
>> Are there any guidelines as to how the lowering should be done? I'd like
>> to update the (defunct) Microblaze back end before I pull the latest TOT
>> this week.
> Venkatraman, I'm guessing you still have this fresh in your memory. Would
> you mind giving a hand? (bonus points for writing some documentation
> <http://llvm.org/docs/SphinxQuickstartTemplate.html> ;)
Here are the steps that I followed to implement the MCLowering in
1. Implement <Target>MCExpr.cpp
Create a derived class of TargetMCExpr to handle target specific
expressions such as %hi, %lo etc. See examples in AArch64MCExpr.cpp,
2. Implement <Target>MCStreamer.cpp if the target needs any special directives.
for further info.
3. Implement InstPrinter using TableGen-ed AsmWriter. (See examples in
4. Implement <Target>MCInstLower.cpp to lower MachineInstrs to MCInst.
This is implemented by lowering MachineInstr operands to either
MCInst operands or MCExpr. Target specific expressions are lowered to
5. Modify <Target>AsmPrinter to lower MachineInstrs to MCInst and emit
them using the MCStreamer.
6. Finally, register the InstPrinter and the MCStreamers in
Hope that this helps.
For MicroBlaze target, when it removed from the trunk, it is already
using the new MCInstPrinter. So, it may easier to update it.
> -- Sean Silva
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev