Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 1 | //===- 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 Lorenz | 33f0aef | 2015-06-26 16:46:11 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/DenseMap.h" |
Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/StringRef.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
Alex Lorenz | 8a1915b | 2015-07-27 22:42:41 +0000 | [diff] [blame^] | 22 | class BasicBlock; |
Alex Lorenz | 33f0aef | 2015-06-26 16:46:11 +0000 | [diff] [blame] | 23 | class MachineBasicBlock; |
Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 24 | class MachineInstr; |
| 25 | class MachineFunction; |
Alex Lorenz | 5d6108e | 2015-06-26 22:56:48 +0000 | [diff] [blame] | 26 | struct SlotMapping; |
Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 27 | class SMDiagnostic; |
| 28 | class SourceMgr; |
| 29 | |
Alex Lorenz | 7a503fa | 2015-07-07 17:46:43 +0000 | [diff] [blame] | 30 | struct PerFunctionMIParsingState { |
| 31 | DenseMap<unsigned, MachineBasicBlock *> MBBSlots; |
Alex Lorenz | 5346451 | 2015-07-10 22:51:20 +0000 | [diff] [blame] | 32 | DenseMap<unsigned, unsigned> VirtualRegisterSlots; |
Alex Lorenz | 7feaf7c | 2015-07-16 23:37:45 +0000 | [diff] [blame] | 33 | DenseMap<unsigned, int> FixedStackObjectSlots; |
| 34 | DenseMap<unsigned, int> StackObjectSlots; |
Alex Lorenz | ab98049 | 2015-07-20 20:51:18 +0000 | [diff] [blame] | 35 | DenseMap<unsigned, unsigned> ConstantPoolSlots; |
Alex Lorenz | 31d7068 | 2015-07-15 23:38:35 +0000 | [diff] [blame] | 36 | DenseMap<unsigned, unsigned> JumpTableSlots; |
Alex Lorenz | 7a503fa | 2015-07-07 17:46:43 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
Alex Lorenz | 3708a64 | 2015-06-30 17:47:50 +0000 | [diff] [blame] | 39 | bool parseMachineInstr(MachineInstr *&MI, SourceMgr &SM, MachineFunction &MF, |
Alex Lorenz | 7a503fa | 2015-07-07 17:46:43 +0000 | [diff] [blame] | 40 | StringRef Src, const PerFunctionMIParsingState &PFS, |
Alex Lorenz | 3708a64 | 2015-06-30 17:47:50 +0000 | [diff] [blame] | 41 | const SlotMapping &IRSlots, SMDiagnostic &Error); |
Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 42 | |
Alex Lorenz | f09df00 | 2015-06-30 18:16:42 +0000 | [diff] [blame] | 43 | bool parseMBBReference(MachineBasicBlock *&MBB, SourceMgr &SM, |
| 44 | MachineFunction &MF, StringRef Src, |
Alex Lorenz | 7a503fa | 2015-07-07 17:46:43 +0000 | [diff] [blame] | 45 | const PerFunctionMIParsingState &PFS, |
Alex Lorenz | f09df00 | 2015-06-30 18:16:42 +0000 | [diff] [blame] | 46 | const SlotMapping &IRSlots, SMDiagnostic &Error); |
| 47 | |
Alex Lorenz | 9fab370 | 2015-07-14 21:24:41 +0000 | [diff] [blame] | 48 | bool parseNamedRegisterReference(unsigned &Reg, SourceMgr &SM, |
| 49 | MachineFunction &MF, StringRef Src, |
| 50 | const PerFunctionMIParsingState &PFS, |
| 51 | const SlotMapping &IRSlots, |
| 52 | SMDiagnostic &Error); |
| 53 | |
Alex Lorenz | 12045a4 | 2015-07-27 17:42:45 +0000 | [diff] [blame] | 54 | bool parseVirtualRegisterReference(unsigned &Reg, SourceMgr &SM, |
| 55 | MachineFunction &MF, StringRef Src, |
| 56 | const PerFunctionMIParsingState &PFS, |
| 57 | const SlotMapping &IRSlots, |
| 58 | SMDiagnostic &Error); |
| 59 | |
Alex Lorenz | 8a1915b | 2015-07-27 22:42:41 +0000 | [diff] [blame^] | 60 | bool parseIRBlockReference(const BasicBlock *&BB, SourceMgr &SM, |
| 61 | MachineFunction &MF, StringRef Src, |
| 62 | const PerFunctionMIParsingState &PFS, |
| 63 | const SlotMapping &IRSlots, SMDiagnostic &Error); |
| 64 | |
Alex Lorenz | 8e0a1b4 | 2015-06-22 17:02:30 +0000 | [diff] [blame] | 65 | } // end namespace llvm |
| 66 | |
| 67 | #endif |