2003-10-05 21:27:59 +02:00
|
|
|
//===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02: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 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-05 21:27:59 +02: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-18 23:36:47 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2003-11-11 23:41:34 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
class StringInit;
|
|
|
|
class IntInit;
|
|
|
|
class ListInit;
|
2004-10-27 18:14:51 +02:00
|
|
|
struct CodeGenInstruction;
|
2003-10-05 21:27:59 +02:00
|
|
|
|
|
|
|
class InstrInfoEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2005-10-31 18:16:46 +01:00
|
|
|
bool IsItineraries;
|
|
|
|
std::map<std::string, unsigned> ItinClassMap;
|
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
public:
|
2005-10-31 18:16:46 +01:00
|
|
|
InstrInfoEmitter(RecordKeeper &R) : Records(R), IsItineraries(false) {}
|
2005-04-22 02:00:37 +02:00
|
|
|
|
2003-10-05 21:27:59 +02: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-18 23:36:47 +02:00
|
|
|
void printDefList(const std::vector<Record*> &Uses, unsigned Num,
|
2003-10-05 21:27:59 +02:00
|
|
|
std::ostream &OS) const;
|
2004-08-01 07:04:00 +02:00
|
|
|
void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
2005-08-18 23:36:47 +02:00
|
|
|
Record *InstrInfo,
|
2005-10-29 00:59:53 +02:00
|
|
|
std::map<std::vector<Record*>, unsigned> &EL,
|
2005-08-19 20:46:26 +02:00
|
|
|
std::map<std::vector<Record*>, unsigned> &OpInfo,
|
2005-08-18 23:36:47 +02:00
|
|
|
std::ostream &OS);
|
2005-10-31 18:16:46 +01:00
|
|
|
void GatherItinClasses();
|
|
|
|
unsigned ItinClassNumber(std::string ItinName);
|
2003-10-05 21:27:59 +02:00
|
|
|
void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
|
|
|
|
std::ostream &OS);
|
|
|
|
};
|
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
#endif
|