blob: 19ab444a3eb116cba16a6b44766f170196a9bbe7 [file] [log] [blame]
Jakub Staszak88ac78c2004-04-06 19:31:31 +00001//===- SimpleInstrSelEmitter.h - Generate a Simple Instruction Selector ----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This tablegen backend is responsible for emitting a simple instruction selector
11//
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef SIMPLE_INSTR_SELECTOR_EMITTER_H
16#define SIMPLE_INSTR_SELECTOR_EMITTER_H
17
18#include "TableGenBackend.h"
19#include "CodeGenWrappers.h"
20#include <vector>
21#include <map>
22#include <cassert>
23
24namespace llvm {
25
26class Init;
27class InstrSelectorEmitter;
28
29
30/// InstrSelectorEmitter - The top-level class which coordinates construction
31/// and emission of the instruction selector.
32///
33class SimpleInstrSelEmitter : public TableGenBackend {
34 RecordKeeper &Records;
35 std::string globalSpacing;
36
37public:
38 SimpleInstrSelEmitter(RecordKeeper &R) : Records(R) {globalSpacing = " ";}
39
40 // run - Output the instruction set description, returning true on failure.
41 void run(std::ostream &OS);
42
43 Record* SimpleInstrSelEmitter::findInstruction(std::ostream &OS, std::string cl, std::vector<std::string>& vi);
44
45 Record* SimpleInstrSelEmitter::findRegister(std::ostream &OS, std::string regname);
46
47 std::string SimpleInstrSelEmitter::formatRegister(std::ostream &OS, std::string regname);
48
49 void SimpleInstrSelEmitter::generateBMIcall(std::ostream &OS, std::string MBB, std::string IP, std::string Opcode, int NumOperands, ListInit &l, ListInit &r);
50
51 void SimpleInstrSelEmitter::InstrSubclasses(std::ostream &OS, std::string prefix, std::string InstrClassName, ListInit* SupportedSubclasses, std::vector<std::string>& vi, unsigned depth);
52
53 std::string spacing();
54 std::string addspacing();
55 std::string remspacing();
56
57};
58
59} // End llvm namespace
60
61#endif