blob: 92698f6e6d120bd70b94c6314652d1227183d814 [file] [log] [blame]
Alex Lorenz8e0a1b42015-06-22 17:02:30 +00001//===- MIParser.h - Machine Instructions Parser ---------------------------===//
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// This file declares the function that parses the machine instructions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H
15#define LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H
16
Alex Lorenz33f0aef2015-06-26 16:46:11 +000017#include "llvm/ADT/DenseMap.h"
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000018#include "llvm/ADT/StringRef.h"
19
20namespace llvm {
21
Alex Lorenz8a1915b2015-07-27 22:42:41 +000022class BasicBlock;
Alex Lorenz33f0aef2015-06-26 16:46:11 +000023class MachineBasicBlock;
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000024class MachineInstr;
25class MachineFunction;
Alex Lorenz5d6108e2015-06-26 22:56:48 +000026struct SlotMapping;
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000027class SMDiagnostic;
28class SourceMgr;
29
Alex Lorenz7a503fa2015-07-07 17:46:43 +000030struct PerFunctionMIParsingState {
31 DenseMap<unsigned, MachineBasicBlock *> MBBSlots;
Alex Lorenz53464512015-07-10 22:51:20 +000032 DenseMap<unsigned, unsigned> VirtualRegisterSlots;
Alex Lorenz7feaf7c2015-07-16 23:37:45 +000033 DenseMap<unsigned, int> FixedStackObjectSlots;
34 DenseMap<unsigned, int> StackObjectSlots;
Alex Lorenzab980492015-07-20 20:51:18 +000035 DenseMap<unsigned, unsigned> ConstantPoolSlots;
Alex Lorenz31d70682015-07-15 23:38:35 +000036 DenseMap<unsigned, unsigned> JumpTableSlots;
Alex Lorenz7a503fa2015-07-07 17:46:43 +000037};
38
Alex Lorenz3708a642015-06-30 17:47:50 +000039bool parseMachineInstr(MachineInstr *&MI, SourceMgr &SM, MachineFunction &MF,
Alex Lorenz7a503fa2015-07-07 17:46:43 +000040 StringRef Src, const PerFunctionMIParsingState &PFS,
Alex Lorenz3708a642015-06-30 17:47:50 +000041 const SlotMapping &IRSlots, SMDiagnostic &Error);
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000042
Alex Lorenzf09df002015-06-30 18:16:42 +000043bool parseMBBReference(MachineBasicBlock *&MBB, SourceMgr &SM,
44 MachineFunction &MF, StringRef Src,
Alex Lorenz7a503fa2015-07-07 17:46:43 +000045 const PerFunctionMIParsingState &PFS,
Alex Lorenzf09df002015-06-30 18:16:42 +000046 const SlotMapping &IRSlots, SMDiagnostic &Error);
47
Alex Lorenz9fab3702015-07-14 21:24:41 +000048bool parseNamedRegisterReference(unsigned &Reg, SourceMgr &SM,
49 MachineFunction &MF, StringRef Src,
50 const PerFunctionMIParsingState &PFS,
51 const SlotMapping &IRSlots,
52 SMDiagnostic &Error);
53
Alex Lorenz12045a42015-07-27 17:42:45 +000054bool parseVirtualRegisterReference(unsigned &Reg, SourceMgr &SM,
55 MachineFunction &MF, StringRef Src,
56 const PerFunctionMIParsingState &PFS,
57 const SlotMapping &IRSlots,
58 SMDiagnostic &Error);
59
Alex Lorenz8a1915b2015-07-27 22:42:41 +000060bool parseIRBlockReference(const BasicBlock *&BB, SourceMgr &SM,
61 MachineFunction &MF, StringRef Src,
62 const PerFunctionMIParsingState &PFS,
63 const SlotMapping &IRSlots, SMDiagnostic &Error);
64
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000065} // end namespace llvm
66
67#endif