LLVM API Documentation

X86AsmPrinter.cpp

Go to the documentation of this file.
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 "X86.h"
00018 #include "X86ATTAsmPrinter.h"
00019 #include "X86IntelAsmPrinter.h"
00020 #include "llvm/Target/TargetAsmInfo.h"
00021 #include "llvm/Target/TargetRegistry.h"
00022 using namespace llvm;
00023 
00024 /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
00025 /// for a MachineFunction to the given output stream, using the given target
00026 /// machine description.
00027 ///
00028 static AsmPrinter *createX86CodePrinterPass(formatted_raw_ostream &o,
00029                                             TargetMachine &tm,
00030                                             const TargetAsmInfo *tai,
00031                                             bool verbose) {
00032   if (tm.getTargetAsmInfo()->getAssemblerDialect() == 1)
00033     return new X86IntelAsmPrinter(o, tm, tai, verbose);
00034   return new X86ATTAsmPrinter(o, tm, tai, verbose);
00035 }
00036 
00037 // Force static initialization.
00038 extern "C" void LLVMInitializeX86AsmPrinter() { 
00039   TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass);
00040   TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass);
00041 }