1 //===-- X86AsmPrinter.cpp - Convert X86 LLVM code to AT&T assembly --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a printer that converts from our internal representation
11 // of machine-dependent LLVM code to X86 machine code.
13 //===----------------------------------------------------------------------===//
15 #include "X86AsmPrinter.h"
16 #include "X86ATTInstPrinter.h"
17 #include "X86IntelInstPrinter.h"
18 #include "X86MCInstLower.h"
21 #include "X86COFFMachineModuleInfo.h"
22 #include "X86MachineFunctionInfo.h"
23 #include "X86TargetMachine.h"
24 #include "llvm/CallingConv.h"
25 #include "llvm/DerivedTypes.h"
26 #include "llvm/Module.h"
27 #include "llvm/Type.h"
28 #include "llvm/Assembly/Writer.h"
29 #include "llvm/MC/MCAsmInfo.h"
30 #include "llvm/MC/MCContext.h"
31 #include "llvm/MC/MCExpr.h"
32 #include "llvm/MC/MCSectionMachO.h"
33 #include "llvm/MC/MCStreamer.h"
34 #include "llvm/MC/MCSymbol.h"
35 #include "llvm/CodeGen/MachineJumpTableInfo.h"
36 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
37 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
38 #include "llvm/Support/ErrorHandling.h"
39 #include "llvm/Support/FormattedStream.h"
40 #include "llvm/Target/Mangler.h"
41 #include "llvm/Target/TargetOptions.h"
42 #include "llvm/Target/TargetRegistry.h"
43 #include "llvm/ADT/SmallString.h"
46 //===----------------------------------------------------------------------===//
47 // Primitive Helper Functions.
48 //===----------------------------------------------------------------------===//
50 void X86AsmPrinter::PrintPICBaseSymbol() const {
51 const TargetLowering *TLI = TM.getTargetLowering();
52 O << *static_cast<const X86TargetLowering*>(TLI)->getPICBaseSymbol(MF,
56 /// runOnMachineFunction - Emit the function body.
58 bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
59 SetupMachineFunction(MF);
61 if (Subtarget->isTargetCOFF()) {
62 const Function *F = MF.getFunction();
63 O << "\t.def\t " << *CurrentFnSym << ";\t.scl\t" <<
64 (F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT)
65 << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
69 // Have common code print out the function header with linkage info etc.
72 // Emit the rest of the function body.
75 // We didn't modify anything.
79 /// printSymbolOperand - Print a raw symbol reference operand. This handles
80 /// jump tables, constant pools, global address and external symbols, all of
81 /// which print to a label with various suffixes for relocation types etc.
82 void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
83 switch (MO.getType()) {
84 default: llvm_unreachable("unknown symbol type!");
85 case MachineOperand::MO_JumpTableIndex:
86 O << *GetJTISymbol(MO.getIndex());
88 case MachineOperand::MO_ConstantPoolIndex:
89 O << *GetCPISymbol(MO.getIndex());
90 printOffset(MO.getOffset(), O);
92 case MachineOperand::MO_GlobalAddress: {
93 const GlobalValue *GV = MO.getGlobal();
96 if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB)
97 GVSym = GetSymbolWithGlobalValueBase(GV, "$stub");
98 else if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
99 MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE ||
100 MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
101 GVSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
103 GVSym = Mang->getSymbol(GV);
105 // Handle dllimport linkage.
106 if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
107 GVSym = OutContext.GetOrCreateSymbol(Twine("__imp_") + GVSym->getName());
109 if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
110 MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE) {
111 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
112 MachineModuleInfoImpl::StubValueTy &StubSym =
113 MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(Sym);
114 if (StubSym.getPointer() == 0)
115 StubSym = MachineModuleInfoImpl::
116 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
117 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
118 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
119 MachineModuleInfoImpl::StubValueTy &StubSym =
120 MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(Sym);
121 if (StubSym.getPointer() == 0)
122 StubSym = MachineModuleInfoImpl::
123 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
124 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
125 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
126 MachineModuleInfoImpl::StubValueTy &StubSym =
127 MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
128 if (StubSym.getPointer() == 0)
129 StubSym = MachineModuleInfoImpl::
130 StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
133 // If the name begins with a dollar-sign, enclose it in parens. We do this
134 // to avoid having it look like an integer immediate to the assembler.
135 if (GVSym->getName()[0] != '$')
138 O << '(' << *GVSym << ')';
139 printOffset(MO.getOffset(), O);
142 case MachineOperand::MO_ExternalSymbol: {
143 const MCSymbol *SymToPrint;
144 if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
145 SmallString<128> TempNameStr;
146 TempNameStr += StringRef(MO.getSymbolName());
147 TempNameStr += StringRef("$stub");
149 MCSymbol *Sym = GetExternalSymbolSymbol(TempNameStr.str());
150 MachineModuleInfoImpl::StubValueTy &StubSym =
151 MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
152 if (StubSym.getPointer() == 0) {
153 TempNameStr.erase(TempNameStr.end()-5, TempNameStr.end());
154 StubSym = MachineModuleInfoImpl::
155 StubValueTy(OutContext.GetOrCreateSymbol(TempNameStr.str()),
158 SymToPrint = StubSym.getPointer();
160 SymToPrint = GetExternalSymbolSymbol(MO.getSymbolName());
163 // If the name begins with a dollar-sign, enclose it in parens. We do this
164 // to avoid having it look like an integer immediate to the assembler.
165 if (SymToPrint->getName()[0] != '$')
168 O << '(' << *SymToPrint << '(';
173 switch (MO.getTargetFlags()) {
175 llvm_unreachable("Unknown target flag on GV operand");
176 case X86II::MO_NO_FLAG: // No flag.
178 case X86II::MO_DARWIN_NONLAZY:
179 case X86II::MO_DLLIMPORT:
180 case X86II::MO_DARWIN_STUB:
181 // These affect the name of the symbol, not any suffix.
183 case X86II::MO_GOT_ABSOLUTE_ADDRESS:
185 PrintPICBaseSymbol();
188 case X86II::MO_PIC_BASE_OFFSET:
189 case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
190 case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
192 PrintPICBaseSymbol();
194 case X86II::MO_TLSGD: O << "@TLSGD"; break;
195 case X86II::MO_GOTTPOFF: O << "@GOTTPOFF"; break;
196 case X86II::MO_INDNTPOFF: O << "@INDNTPOFF"; break;
197 case X86II::MO_TPOFF: O << "@TPOFF"; break;
198 case X86II::MO_NTPOFF: O << "@NTPOFF"; break;
199 case X86II::MO_GOTPCREL: O << "@GOTPCREL"; break;
200 case X86II::MO_GOT: O << "@GOT"; break;
201 case X86II::MO_GOTOFF: O << "@GOTOFF"; break;
202 case X86II::MO_PLT: O << "@PLT"; break;
206 /// print_pcrel_imm - This is used to print an immediate value that ends up
207 /// being encoded as a pc-relative value. These print slightly differently, for
208 /// example, a $ is not emitted.
209 void X86AsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
210 const MachineOperand &MO = MI->getOperand(OpNo);
211 switch (MO.getType()) {
212 default: llvm_unreachable("Unknown pcrel immediate operand");
213 case MachineOperand::MO_Immediate:
216 case MachineOperand::MO_MachineBasicBlock:
217 O << *MO.getMBB()->getSymbol();
219 case MachineOperand::MO_GlobalAddress:
220 case MachineOperand::MO_ExternalSymbol:
221 printSymbolOperand(MO);
227 void X86AsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
228 const char *Modifier) {
229 const MachineOperand &MO = MI->getOperand(OpNo);
230 switch (MO.getType()) {
231 default: llvm_unreachable("unknown operand type!");
232 case MachineOperand::MO_Register: {
234 unsigned Reg = MO.getReg();
235 if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
236 EVT VT = (strcmp(Modifier+6,"64") == 0) ?
237 MVT::i64 : ((strcmp(Modifier+6, "32") == 0) ? MVT::i32 :
238 ((strcmp(Modifier+6,"16") == 0) ? MVT::i16 : MVT::i8));
239 Reg = getX86SubSuperRegister(Reg, VT);
241 O << X86ATTInstPrinter::getRegisterName(Reg);
245 case MachineOperand::MO_Immediate:
246 O << '$' << MO.getImm();
249 case MachineOperand::MO_JumpTableIndex:
250 case MachineOperand::MO_ConstantPoolIndex:
251 case MachineOperand::MO_GlobalAddress:
252 case MachineOperand::MO_ExternalSymbol: {
254 printSymbolOperand(MO);
260 void X86AsmPrinter::printSSECC(const MachineInstr *MI, unsigned Op) {
261 unsigned char value = MI->getOperand(Op).getImm();
262 assert(value <= 7 && "Invalid ssecc argument!");
264 case 0: O << "eq"; break;
265 case 1: O << "lt"; break;
266 case 2: O << "le"; break;
267 case 3: O << "unord"; break;
268 case 4: O << "neq"; break;
269 case 5: O << "nlt"; break;
270 case 6: O << "nle"; break;
271 case 7: O << "ord"; break;
275 void X86AsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op,
276 const char *Modifier) {
277 const MachineOperand &BaseReg = MI->getOperand(Op);
278 const MachineOperand &IndexReg = MI->getOperand(Op+2);
279 const MachineOperand &DispSpec = MI->getOperand(Op+3);
281 // If we really don't want to print out (rip), don't.
282 bool HasBaseReg = BaseReg.getReg() != 0;
283 if (HasBaseReg && Modifier && !strcmp(Modifier, "no-rip") &&
284 BaseReg.getReg() == X86::RIP)
287 // HasParenPart - True if we will print out the () part of the mem ref.
288 bool HasParenPart = IndexReg.getReg() || HasBaseReg;
290 if (DispSpec.isImm()) {
291 int DispVal = DispSpec.getImm();
292 if (DispVal || !HasParenPart)
295 assert(DispSpec.isGlobal() || DispSpec.isCPI() ||
296 DispSpec.isJTI() || DispSpec.isSymbol());
297 printSymbolOperand(MI->getOperand(Op+3));
301 assert(IndexReg.getReg() != X86::ESP &&
302 "X86 doesn't allow scaling by ESP");
306 printOperand(MI, Op, Modifier);
308 if (IndexReg.getReg()) {
310 printOperand(MI, Op+2, Modifier);
311 unsigned ScaleVal = MI->getOperand(Op+1).getImm();
313 O << ',' << ScaleVal;
319 void X86AsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op,
320 const char *Modifier) {
321 assert(isMem(MI, Op) && "Invalid memory reference!");
322 const MachineOperand &Segment = MI->getOperand(Op+4);
323 if (Segment.getReg()) {
324 printOperand(MI, Op+4, Modifier);
327 printLeaMemReference(MI, Op, Modifier);
330 void X86AsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) {
331 PrintPICBaseSymbol();
333 PrintPICBaseSymbol();
337 bool X86AsmPrinter::printAsmMRegister(const MachineOperand &MO, char Mode) {
338 unsigned Reg = MO.getReg();
340 default: return true; // Unknown mode.
341 case 'b': // Print QImode register
342 Reg = getX86SubSuperRegister(Reg, MVT::i8);
344 case 'h': // Print QImode high register
345 Reg = getX86SubSuperRegister(Reg, MVT::i8, true);
347 case 'w': // Print HImode register
348 Reg = getX86SubSuperRegister(Reg, MVT::i16);
350 case 'k': // Print SImode register
351 Reg = getX86SubSuperRegister(Reg, MVT::i32);
353 case 'q': // Print DImode register
354 Reg = getX86SubSuperRegister(Reg, MVT::i64);
358 O << '%' << X86ATTInstPrinter::getRegisterName(Reg);
362 /// PrintAsmOperand - Print out an operand for an inline asm expression.
364 bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
366 const char *ExtraCode) {
367 // Does this asm operand have a single letter operand modifier?
368 if (ExtraCode && ExtraCode[0]) {
369 if (ExtraCode[1] != 0) return true; // Unknown modifier.
371 const MachineOperand &MO = MI->getOperand(OpNo);
373 switch (ExtraCode[0]) {
374 default: return true; // Unknown modifier.
375 case 'a': // This is an address. Currently only 'i' and 'r' are expected.
380 if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol()) {
381 printSymbolOperand(MO);
386 printOperand(MI, OpNo);
392 case 'c': // Don't print "$" before a global var name or constant.
395 else if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol())
396 printSymbolOperand(MO);
398 printOperand(MI, OpNo);
401 case 'A': // Print '*' before a register (it must be a register)
404 printOperand(MI, OpNo);
409 case 'b': // Print QImode register
410 case 'h': // Print QImode high register
411 case 'w': // Print HImode register
412 case 'k': // Print SImode register
413 case 'q': // Print DImode register
415 return printAsmMRegister(MO, ExtraCode[0]);
416 printOperand(MI, OpNo);
419 case 'P': // This is the operand of a call, treat specially.
420 print_pcrel_imm(MI, OpNo);
423 case 'n': // Negate the immediate or print a '-' before the operand.
424 // Note: this is a temporary solution. It should be handled target
425 // independently as part of the 'MC' work.
434 printOperand(MI, OpNo);
438 bool X86AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
439 unsigned OpNo, unsigned AsmVariant,
440 const char *ExtraCode) {
441 if (ExtraCode && ExtraCode[0]) {
442 if (ExtraCode[1] != 0) return true; // Unknown modifier.
444 switch (ExtraCode[0]) {
445 default: return true; // Unknown modifier.
446 case 'b': // Print QImode register
447 case 'h': // Print QImode high register
448 case 'w': // Print HImode register
449 case 'k': // Print SImode register
450 case 'q': // Print SImode register
451 // These only apply to registers, ignore on mem.
453 case 'P': // Don't print @PLT, but do print as memory.
454 printMemReference(MI, OpNo, "no-rip");
458 printMemReference(MI, OpNo);
462 void X86AsmPrinter::EmitStartOfAsmFile(Module &M) {
463 if (Subtarget->isTargetDarwin())
464 OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
468 void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
469 if (Subtarget->isTargetDarwin()) {
470 // All darwin targets use mach-o.
471 TargetLoweringObjectFileMachO &TLOFMacho =
472 static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
474 MachineModuleInfoMachO &MMIMacho =
475 MMI->getObjFileInfo<MachineModuleInfoMachO>();
477 // Output stubs for dynamically-linked functions.
478 MachineModuleInfoMachO::SymbolListTy Stubs;
480 Stubs = MMIMacho.GetFnStubList();
481 if (!Stubs.empty()) {
482 const MCSection *TheSection =
483 TLOFMacho.getMachOSection("__IMPORT", "__jump_table",
484 MCSectionMachO::S_SYMBOL_STUBS |
485 MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE |
486 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
487 5, SectionKind::getMetadata());
488 OutStreamer.SwitchSection(TheSection);
490 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
492 OutStreamer.EmitLabel(Stubs[i].first);
493 // .indirect_symbol _foo
494 OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
495 MCSA_IndirectSymbol);
496 // hlt; hlt; hlt; hlt; hlt hlt = 0xf4 = -12.
497 const char HltInsts[] = { -12, -12, -12, -12, -12 };
498 OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/);
502 OutStreamer.AddBlankLine();
505 // Output stubs for external and common global variables.
506 Stubs = MMIMacho.GetGVStubList();
507 if (!Stubs.empty()) {
508 const MCSection *TheSection =
509 TLOFMacho.getMachOSection("__IMPORT", "__pointers",
510 MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
511 SectionKind::getMetadata());
512 OutStreamer.SwitchSection(TheSection);
514 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
515 // L_foo$non_lazy_ptr:
516 OutStreamer.EmitLabel(Stubs[i].first);
517 // .indirect_symbol _foo
518 MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second;
519 OutStreamer.EmitSymbolAttribute(MCSym.getPointer(),
520 MCSA_IndirectSymbol);
523 // External to current translation unit.
524 OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
526 // Internal to current translation unit.
528 // When we place the LSDA into the TEXT section, the type info
529 // pointers need to be indirect and pc-rel. We accomplish this by
530 // using NLPs. However, sometimes the types are local to the file. So
531 // we need to fill in the value for the NLP in those cases.
532 OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym.getPointer(),
534 4/*size*/, 0/*addrspace*/);
537 OutStreamer.AddBlankLine();
540 Stubs = MMIMacho.GetHiddenGVStubList();
541 if (!Stubs.empty()) {
542 OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
545 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
546 // L_foo$non_lazy_ptr:
547 OutStreamer.EmitLabel(Stubs[i].first);
549 OutStreamer.EmitValue(MCSymbolRefExpr::
550 Create(Stubs[i].second.getPointer(),
552 4/*size*/, 0/*addrspace*/);
555 OutStreamer.AddBlankLine();
558 // Funny Darwin hack: This flag tells the linker that no global symbols
559 // contain code that falls through to other global symbols (e.g. the obvious
560 // implementation of multiple entry points). If this doesn't occur, the
561 // linker can safely perform dead code stripping. Since LLVM never
562 // generates code that does this, it is always safe to set.
563 OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols);
566 if (Subtarget->isTargetCOFF()) {
567 X86COFFMachineModuleInfo &COFFMMI =
568 MMI->getObjFileInfo<X86COFFMachineModuleInfo>();
570 // Emit type information for external functions
571 for (X86COFFMachineModuleInfo::stub_iterator I = COFFMMI.stub_begin(),
572 E = COFFMMI.stub_end(); I != E; ++I) {
573 O << "\t.def\t " << I->getKeyData()
574 << ";\t.scl\t" << COFF::C_EXT
575 << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
579 if (Subtarget->isTargetCygMing()) {
580 // Necessary for dllexport support
581 std::vector<const MCSymbol*> DLLExportedFns, DLLExportedGlobals;
583 TargetLoweringObjectFileCOFF &TLOFCOFF =
584 static_cast<TargetLoweringObjectFileCOFF&>(getObjFileLowering());
586 for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
587 if (I->hasDLLExportLinkage())
588 DLLExportedFns.push_back(Mang->getSymbol(I));
590 for (Module::const_global_iterator I = M.global_begin(),
591 E = M.global_end(); I != E; ++I)
592 if (I->hasDLLExportLinkage())
593 DLLExportedGlobals.push_back(Mang->getSymbol(I));
595 // Output linker support code for dllexported globals on windows.
596 if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
597 OutStreamer.SwitchSection(TLOFCOFF.getCOFFSection(".section .drectve",
599 SectionKind::getMetadata()));
600 for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i)
601 O << "\t.ascii \" -export:" << *DLLExportedGlobals[i] << ",data\"\n";
603 for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i)
604 O << "\t.ascii \" -export:" << *DLLExportedFns[i] << "\"\n";
609 if (Subtarget->isTargetELF()) {
610 TargetLoweringObjectFileELF &TLOFELF =
611 static_cast<TargetLoweringObjectFileELF &>(getObjFileLowering());
613 MachineModuleInfoELF &MMIELF = MMI->getObjFileInfo<MachineModuleInfoELF>();
615 // Output stubs for external and common global variables.
616 MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
617 if (!Stubs.empty()) {
618 OutStreamer.SwitchSection(TLOFELF.getDataRelSection());
619 const TargetData *TD = TM.getTargetData();
621 for (unsigned i = 0, e = Stubs.size(); i != e; ++i)
622 O << *Stubs[i].first << ":\n"
623 << (TD->getPointerSize() == 8 ?
624 MAI->getData64bitsDirective() : MAI->getData32bitsDirective())
625 << *Stubs[i].second.getPointer() << '\n';
633 //===----------------------------------------------------------------------===//
634 // Target Registry Stuff
635 //===----------------------------------------------------------------------===//
637 static MCInstPrinter *createX86MCInstPrinter(const Target &T,
638 unsigned SyntaxVariant,
639 const MCAsmInfo &MAI,
641 if (SyntaxVariant == 0)
642 return new X86ATTInstPrinter(O, MAI);
643 if (SyntaxVariant == 1)
644 return new X86IntelInstPrinter(O, MAI);
648 // Force static initialization.
649 extern "C" void LLVMInitializeX86AsmPrinter() {
650 RegisterAsmPrinter<X86AsmPrinter> X(TheX86_32Target);
651 RegisterAsmPrinter<X86AsmPrinter> Y(TheX86_64Target);
653 TargetRegistry::RegisterMCInstPrinter(TheX86_32Target,createX86MCInstPrinter);
654 TargetRegistry::RegisterMCInstPrinter(TheX86_64Target,createX86MCInstPrinter);