2003-08-03 17:24:10 +00:00
|
|
|
//===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 20:20:30 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:37:13 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 20:20:30 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-08-03 17:24:10 +00: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
|
|
|
|
|
2003-08-06 04:32:07 +00:00
|
|
|
#include "TableGenBackend.h"
|
2008-01-06 01:12:44 +00:00
|
|
|
#include "CodeGenDAGPatterns.h"
|
2005-08-18 21:36:47 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2003-11-11 22:41:34 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2003-08-03 21:57:51 +00:00
|
|
|
class StringInit;
|
|
|
|
class IntInit;
|
2003-08-06 04:32:07 +00:00
|
|
|
class ListInit;
|
2006-11-05 19:31:28 +00:00
|
|
|
class CodeGenInstruction;
|
2003-08-03 17:24:10 +00:00
|
|
|
|
2003-08-06 04:32:07 +00:00
|
|
|
class InstrInfoEmitter : public TableGenBackend {
|
2003-08-03 17:24:10 +00:00
|
|
|
RecordKeeper &Records;
|
2008-04-03 00:02:49 +00:00
|
|
|
CodeGenDAGPatterns CDP;
|
2005-10-31 17:16:46 +00:00
|
|
|
std::map<std::string, unsigned> ItinClassMap;
|
|
|
|
|
2003-08-03 17:24:10 +00:00
|
|
|
public:
|
2008-01-06 01:12:44 +00:00
|
|
|
InstrInfoEmitter(RecordKeeper &R) : Records(R), CDP(R) { }
|
2005-04-22 00:00:37 +00:00
|
|
|
|
2003-08-03 17:24:10 +00:00
|
|
|
// run - Output the instruction set description, returning true on failure.
|
2009-07-03 00:10:29 +00:00
|
|
|
void run(raw_ostream &OS);
|
2003-08-03 17:24:10 +00:00
|
|
|
|
2003-08-03 21:57:51 +00:00
|
|
|
private:
|
2008-01-06 01:20:13 +00:00
|
|
|
typedef std::map<std::vector<std::string>, unsigned> OperandInfoMapTy;
|
|
|
|
|
2004-08-01 05:04:00 +00:00
|
|
|
void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
2005-08-18 21:36:47 +00:00
|
|
|
Record *InstrInfo,
|
2005-10-28 22:59:53 +00:00
|
|
|
std::map<std::vector<Record*>, unsigned> &EL,
|
2008-10-17 21:00:09 +00:00
|
|
|
std::map<Record*, unsigned> &BM,
|
2008-01-06 01:20:13 +00:00
|
|
|
const OperandInfoMapTy &OpInfo,
|
2009-07-03 00:10:29 +00:00
|
|
|
raw_ostream &OS);
|
2008-01-06 01:20:13 +00:00
|
|
|
|
2008-01-06 01:21:51 +00:00
|
|
|
// Itinerary information.
|
2005-10-31 17:16:46 +00:00
|
|
|
void GatherItinClasses();
|
2008-01-06 01:12:44 +00:00
|
|
|
unsigned getItinClassNumber(const Record *InstRec);
|
2008-01-06 01:20:13 +00:00
|
|
|
|
2008-01-06 01:21:51 +00:00
|
|
|
// Operand information.
|
2009-07-03 00:10:29 +00:00
|
|
|
void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
|
2008-01-06 01:20:13 +00:00
|
|
|
std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
|
2008-10-17 21:00:09 +00:00
|
|
|
|
|
|
|
void DetectRegisterClassBarriers(std::vector<Record*> &Defs,
|
|
|
|
const std::vector<CodeGenRegisterClass> &RCs,
|
|
|
|
std::vector<Record*> &Barriers);
|
2003-08-03 17:24:10 +00:00
|
|
|
};
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2003-08-03 17:24:10 +00:00
|
|
|
#endif
|