LLVM API Documentation
00001 //===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file the shared super class printer that converts from our internal 00011 // representation of machine-dependent LLVM code to Intel and AT&T format 00012 // assembly language. 00013 // This printer is the output mechanism used by `llc'. 00014 // 00015 //===----------------------------------------------------------------------===// 00016 00017 #include "X86ATTAsmPrinter.h" 00018 #include "X86IntelAsmPrinter.h" 00019 #include "X86Subtarget.h" 00020 using namespace llvm; 00021 00022 /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code 00023 /// for a MachineFunction to the given output stream, using the given target 00024 /// machine description. 00025 /// 00026 FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, 00027 X86TargetMachine &tm) { 00028 const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>(); 00029 00030 if (Subtarget->isFlavorIntel()) { 00031 return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo()); 00032 } else { 00033 return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo()); 00034 } 00035 } 00036 00037 namespace { 00038 static struct Register { 00039 Register() { 00040 X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass); 00041 } 00042 } Registrator; 00043 } 00044 00045 extern "C" int X86AsmPrinterForceLink; 00046 int X86AsmPrinterForceLink = 0;