blob: b34b7626eb8b713ae17fb6b64d31ce892b25f55a [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 Lorenz33f0aef2015-06-26 16:46:11 +000022class MachineBasicBlock;
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000023class MachineInstr;
24class MachineFunction;
Alex Lorenz5d6108e2015-06-26 22:56:48 +000025struct SlotMapping;
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000026class SMDiagnostic;
27class SourceMgr;
28
Alex Lorenz7a503fa2015-07-07 17:46:43 +000029struct PerFunctionMIParsingState {
30 DenseMap<unsigned, MachineBasicBlock *> MBBSlots;
Alex Lorenz53464512015-07-10 22:51:20 +000031 DenseMap<unsigned, unsigned> VirtualRegisterSlots;
Alex Lorenz7feaf7c2015-07-16 23:37:45 +000032 DenseMap<unsigned, int> FixedStackObjectSlots;
33 DenseMap<unsigned, int> StackObjectSlots;
Alex Lorenz31d70682015-07-15 23:38:35 +000034 DenseMap<unsigned, unsigned> JumpTableSlots;
Alex Lorenz7a503fa2015-07-07 17:46:43 +000035};
36
Alex Lorenz3708a642015-06-30 17:47:50 +000037bool parseMachineInstr(MachineInstr *&MI, SourceMgr &SM, MachineFunction &MF,
Alex Lorenz7a503fa2015-07-07 17:46:43 +000038 StringRef Src, const PerFunctionMIParsingState &PFS,
Alex Lorenz3708a642015-06-30 17:47:50 +000039 const SlotMapping &IRSlots, SMDiagnostic &Error);
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000040
Alex Lorenzf09df002015-06-30 18:16:42 +000041bool parseMBBReference(MachineBasicBlock *&MBB, SourceMgr &SM,
42 MachineFunction &MF, StringRef Src,
Alex Lorenz7a503fa2015-07-07 17:46:43 +000043 const PerFunctionMIParsingState &PFS,
Alex Lorenzf09df002015-06-30 18:16:42 +000044 const SlotMapping &IRSlots, SMDiagnostic &Error);
45
Alex Lorenz9fab3702015-07-14 21:24:41 +000046bool parseNamedRegisterReference(unsigned &Reg, SourceMgr &SM,
47 MachineFunction &MF, StringRef Src,
48 const PerFunctionMIParsingState &PFS,
49 const SlotMapping &IRSlots,
50 SMDiagnostic &Error);
51
Alex Lorenz8e0a1b42015-06-22 17:02:30 +000052} // end namespace llvm
53
54#endif