2004-08-01 13:59:33 +08:00
|
|
|
//===- AsmWriterEmitter.h - Generate an assembly writer ---------*- C++ -*-===//
|
2005-04-22 08:00:37 +08:00
|
|
|
//
|
2004-08-01 13:59:33 +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
|
|
|
//
|
2004-08-01 13:59:33 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend is responsible for emitting an assembly printer for the
|
|
|
|
// code generator.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef ASMWRITER_EMITTER_H
|
|
|
|
#define ASMWRITER_EMITTER_H
|
|
|
|
|
|
|
|
#include "TableGenBackend.h"
|
2006-07-19 01:18:03 +08:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
#include <cassert>
|
2004-08-01 13:59:33 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2006-07-19 01:18:03 +08:00
|
|
|
class AsmWriterInst;
|
|
|
|
class CodeGenInstruction;
|
|
|
|
|
2004-08-01 13:59:33 +08:00
|
|
|
class AsmWriterEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2006-07-19 01:18:03 +08:00
|
|
|
std::map<const CodeGenInstruction*, AsmWriterInst*> CGIAWIMap;
|
|
|
|
std::vector<const CodeGenInstruction*> NumberedInstructions;
|
2004-08-01 13:59:33 +08:00
|
|
|
public:
|
|
|
|
AsmWriterEmitter(RecordKeeper &R) : Records(R) {}
|
2005-04-22 08:00:37 +08:00
|
|
|
|
2004-08-01 13:59:33 +08:00
|
|
|
// run - Output the asmwriter, returning true on failure.
|
2009-07-03 08:10:29 +08:00
|
|
|
void run(raw_ostream &o);
|
2006-07-19 01:18:03 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
AsmWriterInst *getAsmWriterInstByID(unsigned ID) const {
|
|
|
|
assert(ID < NumberedInstructions.size());
|
|
|
|
std::map<const CodeGenInstruction*, AsmWriterInst*>::const_iterator I =
|
|
|
|
CGIAWIMap.find(NumberedInstructions[ID]);
|
|
|
|
assert(I != CGIAWIMap.end() && "Didn't find inst!");
|
|
|
|
return I->second;
|
|
|
|
}
|
|
|
|
void FindUniqueOperandCommands(std::vector<std::string> &UOC,
|
2006-07-19 02:28:27 +08:00
|
|
|
std::vector<unsigned> &InstIdxs,
|
|
|
|
std::vector<unsigned> &InstOpsUsed) const;
|
2004-08-01 13:59:33 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|