LLVM API Documentation
00001 //===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements an ELF writer for the X86 backend. The public interface 00011 // to this file is the createX86ELFObjectWriterPass function. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "X86.h" 00016 #include "X86TargetMachine.h" 00017 #include "llvm/PassManager.h" 00018 #include "llvm/CodeGen/ELFWriter.h" 00019 #include "llvm/Support/Visibility.h" 00020 using namespace llvm; 00021 00022 namespace { 00023 class VISIBILITY_HIDDEN X86ELFWriter : public ELFWriter { 00024 public: 00025 X86ELFWriter(std::ostream &O, X86TargetMachine &TM) : ELFWriter(O, TM) { 00026 e_machine = 3; // EM_386 00027 } 00028 }; 00029 } 00030 00031 /// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code 00032 /// as an ELF object file. 00033 /// 00034 void llvm::addX86ELFObjectWriterPass(PassManager &FPM, 00035 std::ostream &O, X86TargetMachine &TM) { 00036 X86ELFWriter *EW = new X86ELFWriter(O, TM); 00037 FPM.add(EW); 00038 FPM.add(createX86CodeEmitterPass(TM, EW->getMachineCodeEmitter())); 00039 }