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
|
|
|
|
//
|
2007-12-30 04:37:13 +08:00
|
|
|
// This file 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
|
|
|
|
|
2008-01-06 09:12:44 +08:00
|
|
|
#include "CodeGenDAGPatterns.h"
|
2011-10-02 00:41:13 +08:00
|
|
|
#include "llvm/TableGen/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;
|
2006-11-06 03:31:28 +08:00
|
|
|
class CodeGenInstruction;
|
2003-10-06 03:27:59 +08:00
|
|
|
|
|
|
|
class InstrInfoEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2008-04-03 08:02:49 +08:00
|
|
|
CodeGenDAGPatterns CDP;
|
2005-11-01 01:16:46 +08:00
|
|
|
std::map<std::string, unsigned> ItinClassMap;
|
2012-04-12 05:02:30 +08:00
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
public:
|
2008-01-06 09:12:44 +08:00
|
|
|
InstrInfoEmitter(RecordKeeper &R) : Records(R), CDP(R) { }
|
2005-04-22 08:00:37 +08:00
|
|
|
|
2012-04-12 05:09:54 +08:00
|
|
|
// run - Output the instruction set description.
|
2009-07-03 08:10:29 +08:00
|
|
|
void run(raw_ostream &OS);
|
2003-10-06 03:27:59 +08:00
|
|
|
|
|
|
|
private:
|
2011-06-29 04:07:07 +08:00
|
|
|
void emitEnums(raw_ostream &OS);
|
|
|
|
|
2012-04-12 05:02:30 +08:00
|
|
|
typedef std::map<std::vector<std::string>, unsigned> OperandInfoMapTy;
|
2004-08-01 13:04:00 +08:00
|
|
|
void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
2012-04-12 05:02:30 +08:00
|
|
|
Record *InstrInfo,
|
2005-10-29 06:59:53 +08:00
|
|
|
std::map<std::vector<Record*>, unsigned> &EL,
|
2008-01-06 09:20:13 +08:00
|
|
|
const OperandInfoMapTy &OpInfo,
|
2009-07-03 08:10:29 +08:00
|
|
|
raw_ostream &OS);
|
2008-01-06 09:20:13 +08:00
|
|
|
|
2008-01-06 09:21:51 +08:00
|
|
|
// Itinerary information.
|
2005-11-01 01:16:46 +08:00
|
|
|
void GatherItinClasses();
|
2008-01-06 09:12:44 +08:00
|
|
|
unsigned getItinClassNumber(const Record *InstRec);
|
2012-04-12 05:02:30 +08:00
|
|
|
|
2008-01-06 09:21:51 +08:00
|
|
|
// Operand information.
|
2009-07-03 08:10:29 +08:00
|
|
|
void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
|
2008-01-06 09:20:13 +08:00
|
|
|
std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
|
2003-10-06 03:27:59 +08:00
|
|
|
};
|
|
|
|
|
2003-11-12 06:41:34 +08:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
#endif
|