1 //===------------ FixedLenDecoderEmitter.h - Decoder Generator --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // It contains the tablegen backend that emits the decoder functions for
11 // targets with fixed length instruction set.
13 //===----------------------------------------------------------------------===//
15 #ifndef FixedLenDECODEREMITTER_H
16 #define FixedLenDECODEREMITTER_H
18 #include "CodeGenTarget.h"
19 #include "TableGenBackend.h"
21 #include "llvm/Support/DataTypes.h"
30 OperandInfo(unsigned FB, unsigned FL, std::string D)
31 : FieldBase(FB), FieldLength(FL), Decoder(D) { }
34 class FixedLenDecoderEmitter : public TableGenBackend {
36 FixedLenDecoderEmitter(RecordKeeper &R) :
37 Records(R), Target(R),
38 NumberedInstructions(Target.getInstructionsByEnumValue()) {}
40 // run - Output the code emitter
41 void run(raw_ostream &o);
44 RecordKeeper &Records;
46 std::vector<const CodeGenInstruction*> NumberedInstructions;
47 std::vector<unsigned> Opcodes;
48 std::map<unsigned, std::vector<OperandInfo> > Operands;
50 bool populateInstruction(const CodeGenInstruction &CGI, unsigned Opc);
51 void populateInstructions();
54 } // end llvm namespace