2003-10-06 03:27:59 +08:00
|
|
|
//===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
|
2005-04-22 08:00:37 +08:00
|
|
|
//
|
2003-10-21 04:20:30 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-22 08:00:37 +08:00
|
|
|
//
|
2003-10-21 04:20:30 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-06 03:27:59 +08:00
|
|
|
//
|
|
|
|
// This tablegen backend is responsible for emitting a description of the target
|
|
|
|
// instruction set for the code generator.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef INSTRINFO_EMITTER_H
|
|
|
|
#define INSTRINFO_EMITTER_H
|
|
|
|
|
|
|
|
#include "TableGenBackend.h"
|
2005-08-19 05:36:47 +08:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2003-11-12 06:41:34 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
class StringInit;
|
|
|
|
class IntInit;
|
|
|
|
class ListInit;
|
2004-10-28 00:14:51 +08:00
|
|
|
struct CodeGenInstruction;
|
2003-10-06 03:27:59 +08:00
|
|
|
|
|
|
|
class InstrInfoEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
|
|
|
public:
|
|
|
|
InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
|
2005-04-22 08:00:37 +08:00
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
// run - Output the instruction set description, returning true on failure.
|
|
|
|
void run(std::ostream &OS);
|
|
|
|
|
|
|
|
// runEnums - Print out enum values for all of the instructions.
|
|
|
|
void runEnums(std::ostream &OS);
|
|
|
|
private:
|
2005-08-19 05:36:47 +08:00
|
|
|
void printDefList(const std::vector<Record*> &Uses, unsigned Num,
|
2003-10-06 03:27:59 +08:00
|
|
|
std::ostream &OS) const;
|
2004-08-01 13:04:00 +08:00
|
|
|
void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
2005-08-19 05:36:47 +08:00
|
|
|
Record *InstrInfo,
|
|
|
|
std::map<ListInit*, unsigned> &ListNumbers,
|
2005-08-20 02:46:26 +08:00
|
|
|
std::map<std::vector<Record*>, unsigned> &OpInfo,
|
2005-08-19 05:36:47 +08:00
|
|
|
std::ostream &OS);
|
2003-10-06 03:27:59 +08:00
|
|
|
void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
|
|
|
|
std::ostream &OS);
|
|
|
|
};
|
|
|
|
|
2003-11-12 06:41:34 +08:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
#endif
|