blob: bf7da347ed2bc16f4723e09b1ee3870ffabd3e64 [file] [log] [blame]
Chris Lattner33ccf7e2003-08-03 17:24:10 +00001//===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
John Criswell01d45822003-10-20 20:20:30 +00002//
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//===----------------------------------------------------------------------===//
Chris Lattner33ccf7e2003-08-03 17:24:10 +00009//
10// This tablegen backend is responsible for emitting a description of the target
11// instruction set for the code generator.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef INSTRINFO_EMITTER_H
16#define INSTRINFO_EMITTER_H
17
Chris Lattnerbc017232003-08-06 04:32:07 +000018#include "TableGenBackend.h"
Brian Gaeked0fde302003-11-11 22:41:34 +000019
20namespace llvm {
21
Chris Lattnera3ae6142003-08-03 21:57:51 +000022class StringInit;
23class IntInit;
Chris Lattnerbc017232003-08-06 04:32:07 +000024class ListInit;
Chris Lattner1fca5ff2004-10-27 16:14:51 +000025struct CodeGenInstruction;
Chris Lattner33ccf7e2003-08-03 17:24:10 +000026
Chris Lattnerbc017232003-08-06 04:32:07 +000027class InstrInfoEmitter : public TableGenBackend {
Chris Lattner33ccf7e2003-08-03 17:24:10 +000028 RecordKeeper &Records;
29public:
30 InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
31
32 // run - Output the instruction set description, returning true on failure.
Chris Lattnera3ae6142003-08-03 21:57:51 +000033 void run(std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000034
35 // runEnums - Print out enum values for all of the instructions.
Chris Lattnera3ae6142003-08-03 21:57:51 +000036 void runEnums(std::ostream &OS);
37private:
Chris Lattnerbc017232003-08-06 04:32:07 +000038 void printDefList(ListInit *LI, const std::string &Name,
39 std::ostream &OS) const;
Chris Lattnerec352402004-08-01 05:04:00 +000040 void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
41 Record *InstrInfo, std::ostream &OS);
Chris Lattnera3ae6142003-08-03 21:57:51 +000042 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
43 std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000044};
45
Brian Gaeked0fde302003-11-11 22:41:34 +000046} // End llvm namespace
47
Chris Lattner33ccf7e2003-08-03 17:24:10 +000048#endif