1 //===- CodeGenInstruction.h - Instruction Class Wrapper ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a wrapper class for the 'Instruction' TableGen class.
12 //===----------------------------------------------------------------------===//
14 #ifndef CODEGEN_INSTRUCTION_H
15 #define CODEGEN_INSTRUCTION_H
17 #include "llvm/CodeGen/ValueTypes.h"
25 struct CodeGenInstruction {
26 Record *TheDef; // The actual record defining this instruction.
27 std::string Name; // Contents of the 'Name' field.
28 std::string Namespace; // The namespace the instruction is in.
30 /// AsmString - The format string used to emit a .s file for the
32 std::string AsmString;
34 /// OperandInfo - For each operand declared in the OperandList of the
35 /// instruction, keep track of its record (which specifies the class of the
36 /// operand), its type, and the name given to the operand, if any.
41 OperandInfo(Record *R, MVT::ValueType T, const std::string &N)
42 : Rec(R), Ty(T), Name(N) {}
45 /// OperandList - The list of declared operands, along with their declared
46 /// type (which is a record).
47 std::vector<OperandInfo> OperandList;
49 // Various boolean values we track for the instruction.
57 CodeGenInstruction(Record *R);
59 /// getOperandNamed - Return the index of the operand with the specified
60 /// non-empty name. If the instruction does not have an operand with the
61 /// specified name, throw an exception.
62 unsigned getOperandNamed(const std::string &Name) const;