Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 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 | |
Chris Lattner | b47f641 | 2009-09-13 18:33:59 +0000 | [diff] [blame] | 13 | #include "llvm/Support/Compiler.h" |
| 14 | |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 15 | namespace llvm { |
| 16 | class MCContext; |
| 17 | class MCInst; |
| 18 | class MCOperand; |
| 19 | class MCSymbol; |
| 20 | class MachineInstr; |
Chris Lattner | 4117b16 | 2009-09-16 06:25:03 +0000 | [diff] [blame] | 21 | class MachineModuleInfoMachO; |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 22 | class MachineOperand; |
| 23 | class Mangler; |
| 24 | class X86ATTAsmPrinter; |
| 25 | class X86Subtarget; |
| 26 | |
Chris Lattner | 6874849 | 2009-09-12 21:01:20 +0000 | [diff] [blame] | 27 | /// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst. |
Chris Lattner | b47f641 | 2009-09-13 18:33:59 +0000 | [diff] [blame] | 28 | class VISIBILITY_HIDDEN X86MCInstLower { |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 29 | MCContext &Ctx; |
| 30 | Mangler *Mang; |
| 31 | X86ATTAsmPrinter &AsmPrinter; |
Chris Lattner | 6874849 | 2009-09-12 21:01:20 +0000 | [diff] [blame] | 32 | |
| 33 | const X86Subtarget &getSubtarget() const; |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 34 | public: |
| 35 | X86MCInstLower(MCContext &ctx, Mangler *mang, X86ATTAsmPrinter &asmprinter) |
| 36 | : Ctx(ctx), Mang(mang), AsmPrinter(asmprinter) {} |
| 37 | |
| 38 | void Lower(const MachineInstr *MI, MCInst &OutMI) const; |
| 39 | |
| 40 | MCSymbol *GetPICBaseSymbol() const; |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 41 | |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 42 | MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; |
| 43 | MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; |
| 44 | MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const; |
| 45 | MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const; |
| 46 | MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const; |
Chris Lattner | 4117b16 | 2009-09-16 06:25:03 +0000 | [diff] [blame] | 47 | |
| 48 | private: |
| 49 | MachineModuleInfoMachO &getMachOMMI() const; |
Chris Lattner | 1efc2ad | 2009-09-12 20:34:57 +0000 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | } |
| 53 | |
| 54 | #endif |