llvm.org GIT mirror llvm / 9cf0eb5
add the files that go with the previous rev git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84531 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
2 changed file(s) with 135 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===-- ARMMCInstLower.cpp - Convert ARM MachineInstr to an MCInst --------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains code to lower ARM MachineInstrs to their corresponding
10 // MCInst records.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "ARMMCInstLower.h"
15 //#include "ARMMCAsmInfo.h"
16 //#include "llvm/CodeGen/MachineModuleInfoImpls.h"
17 #include "llvm/CodeGen/MachineInstr.h"
18 //#include "llvm/MC/MCContext.h"
19 //#include "llvm/MC/MCExpr.h"
20 #include "llvm/MC/MCInst.h"
21 //#include "llvm/MC/MCStreamer.h"
22 //#include "llvm/Support/FormattedStream.h"
23 //#include "llvm/Support/Mangler.h"
24 //#include "llvm/ADT/SmallString.h"
25 using namespace llvm;
26
27
28 #if 0
29 const ARMSubtarget &ARMMCInstLower::getSubtarget() const {
30 return AsmPrinter.getSubtarget();
31 }
32
33 MachineModuleInfoMachO &ARMMCInstLower::getMachOMMI() const {
34 assert(getSubtarget().isTargetDarwin() &&"Can only get MachO info on darwin");
35 return AsmPrinter.MMI->getObjFileInfo();
36 }
37 #endif
38
39
40 void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
41 OutMI.setOpcode(MI->getOpcode());
42
43 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
44 const MachineOperand &MO = MI->getOperand(i);
45
46 MCOperand MCOp;
47 switch (MO.getType()) {
48 default:
49 MI->dump();
50 assert(0 && "unknown operand type");
51 case MachineOperand::MO_Register:
52 MCOp = MCOperand::CreateReg(MO.getReg());
53 break;
54 case MachineOperand::MO_Immediate:
55 MCOp = MCOperand::CreateImm(MO.getImm());
56 break;
57 #if 0
58 case MachineOperand::MO_MachineBasicBlock:
59 MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
60 AsmPrinter.GetMBBSymbol(MO.getMBB()->getNumber()), Ctx));
61 break;
62 case MachineOperand::MO_GlobalAddress:
63 MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
64 break;
65 case MachineOperand::MO_ExternalSymbol:
66 MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
67 break;
68 case MachineOperand::MO_JumpTableIndex:
69 MCOp = LowerSymbolOperand(MO, GetJumpTableSymbol(MO));
70 break;
71 case MachineOperand::MO_ConstantPoolIndex:
72 MCOp = LowerSymbolOperand(MO, GetConstantPoolIndexSymbol(MO));
73 break;
74 #endif
75 }
76
77 OutMI.addOperand(MCOp);
78 }
79
80 }
0 //===-- ARMMCInstLower.h - Lower MachineInstr to MCInst -------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef ARM_MCINSTLOWER_H
10 #define ARM_MCINSTLOWER_H
11
12 #include "llvm/Support/Compiler.h"
13
14 namespace llvm {
15 class MCContext;
16 class MCInst;
17 class MCOperand;
18 class MCSymbol;
19 class MachineInstr;
20 class MachineModuleInfoMachO;
21 class MachineOperand;
22 class Mangler;
23 //class ARMSubtarget;
24
25 /// ARMMCInstLower - This class is used to lower an MachineInstr into an MCInst.
26 class VISIBILITY_HIDDEN ARMMCInstLower {
27 MCContext &Ctx;
28 Mangler *Mang;
29
30 //const ARMSubtarget &getSubtarget() const;
31 public:
32 ARMMCInstLower(MCContext &ctx, Mangler *mang)
33 : Ctx(ctx), Mang(mang) {}
34
35 void Lower(const MachineInstr *MI, MCInst &OutMI) const;
36
37 /*
38 MCSymbol *GetPICBaseSymbol() const;
39
40 MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
41 MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
42 MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const;
43 MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const;
44 MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
45
46 private:
47 MachineModuleInfoMachO &getMachOMMI() const;
48 */
49 };
50
51 }
52
53 #endif