0d493c4b47eb3a0ec5e211f92a26ce25207b17a2
[oota-llvm.git] / lib / Target / X86 / X86MCInstLower.h
1 //===-- X86MCInstLower.h - Lower MachineInstr to MCInst -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef X86_MCINSTLOWER_H
11 #define X86_MCINSTLOWER_H
12
13 #include "llvm/Support/Compiler.h"
14
15 namespace llvm {
16   class MCAsmInfo;
17   class MCContext;
18   class MCInst;
19   class MCOperand;
20   class MCSymbol;
21   class MachineInstr;
22   class MachineFunction;
23   class MachineModuleInfoMachO;
24   class MachineOperand;
25   class Mangler;
26   class TargetMachine;
27   class X86AsmPrinter;
28   
29 /// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
30 class LLVM_LIBRARY_VISIBILITY X86MCInstLower {
31   MCContext &Ctx;
32   Mangler *Mang;
33   const MachineFunction &MF;
34   const TargetMachine &TM;
35   const MCAsmInfo &MAI;
36
37   /// AsmPrinter - This is the asmprinter when emission is actually happening,
38   /// or null if an instruction is being lowered for some other reason.
39   X86AsmPrinter *AsmPrinter;
40 public:
41   X86MCInstLower(Mangler *mang, const MachineFunction &MF,
42                  X86AsmPrinter *asmprinter);
43   
44   void Lower(const MachineInstr *MI, MCInst &OutMI) const;
45
46   MCSymbol *GetPICBaseSymbol() const;
47   
48   MCSymbol *GetSymbolFromOperand(const MachineOperand &MO) const;
49   MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
50   
51 private:
52   MachineModuleInfoMachO &getMachOMMI() const;
53 };
54
55 }
56
57 #endif