Add bswap, rotl, and rotr nodes
[oota-llvm.git] / lib / Target / X86 / X86ELFWriter.cpp
1 //===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements an ELF writer for the X86 backend.  The public interface
11 // to this file is the createX86ELFObjectWriterPass function.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "X86.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/CodeGen/ELFWriter.h"
18 #include "llvm/Target/TargetMachine.h"
19 using namespace llvm;
20
21 namespace {
22   class X86ELFWriter : public ELFWriter {
23   public:
24     X86ELFWriter(std::ostream &O, TargetMachine &TM) : ELFWriter(O, TM) {
25       e_machine = 3;   // EM_386
26     }
27   };
28 }
29
30 /// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code
31 /// as an ELF object file.
32 ///
33 void llvm::addX86ELFObjectWriterPass(PassManager &FPM,
34                                      std::ostream &O, TargetMachine &TM) {
35   X86ELFWriter *EW = new X86ELFWriter(O, TM);
36   FPM.add(EW);
37   FPM.add(createX86CodeEmitterPass(EW->getMachineCodeEmitter()));
38 }