blob: effd9604028011b025edf7f123bd64936556c489 [file] [log] [blame]
Chris Lattner1efc2ad2009-09-12 20:34:57 +00001//===-- 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 Lattnerb47f6412009-09-13 18:33:59 +000013#include "llvm/Support/Compiler.h"
14
Chris Lattner1efc2ad2009-09-12 20:34:57 +000015namespace llvm {
16 class MCContext;
17 class MCInst;
18 class MCOperand;
19 class MCSymbol;
20 class MachineInstr;
Chris Lattner4117b162009-09-16 06:25:03 +000021 class MachineModuleInfoMachO;
Chris Lattner1efc2ad2009-09-12 20:34:57 +000022 class MachineOperand;
23 class Mangler;
24 class X86ATTAsmPrinter;
25 class X86Subtarget;
26
Chris Lattner68748492009-09-12 21:01:20 +000027/// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
Chris Lattnerb47f6412009-09-13 18:33:59 +000028class VISIBILITY_HIDDEN X86MCInstLower {
Chris Lattner1efc2ad2009-09-12 20:34:57 +000029 MCContext &Ctx;
30 Mangler *Mang;
31 X86ATTAsmPrinter &AsmPrinter;
Chris Lattner68748492009-09-12 21:01:20 +000032
33 const X86Subtarget &getSubtarget() const;
Chris Lattner1efc2ad2009-09-12 20:34:57 +000034public:
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 Lattner1efc2ad2009-09-12 20:34:57 +000041
Chris Lattner1efc2ad2009-09-12 20:34:57 +000042 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 Lattner4117b162009-09-16 06:25:03 +000047
48private:
49 MachineModuleInfoMachO &getMachOMMI() const;
Chris Lattner1efc2ad2009-09-12 20:34:57 +000050};
51
52}
53
54#endif