2004-08-01 05:04:00 +00:00
|
|
|
//===- CodeGenInstruction.h - Instruction Class Wrapper ---------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines a wrapper class for the 'Instruction' TableGen class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CODEGEN_INSTRUCTION_H
|
|
|
|
#define CODEGEN_INSTRUCTION_H
|
|
|
|
|
2004-08-01 07:42:39 +00:00
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
2004-08-01 05:04:00 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class Record;
|
|
|
|
|
|
|
|
struct CodeGenInstruction {
|
|
|
|
Record *TheDef; // The actual record defining this instruction.
|
|
|
|
std::string Name; // Contents of the 'Name' field.
|
|
|
|
std::string Namespace; // The namespace the instruction is in.
|
|
|
|
|
|
|
|
/// AsmString - The format string used to emit a .s file for the
|
|
|
|
/// instruction.
|
|
|
|
std::string AsmString;
|
2004-08-01 07:42:39 +00:00
|
|
|
|
2004-08-11 02:22:39 +00:00
|
|
|
/// OperandInfo - The information we keep track of for each operand in the
|
|
|
|
/// operand list for a tablegen instruction.
|
2004-08-01 07:42:39 +00:00
|
|
|
struct OperandInfo {
|
2004-08-11 02:22:39 +00:00
|
|
|
/// Rec - The definition this operand is declared as.
|
2004-08-01 07:42:39 +00:00
|
|
|
Record *Rec;
|
2004-08-11 02:22:39 +00:00
|
|
|
|
|
|
|
/// Ty - The MachineValueType of the operand.
|
|
|
|
///
|
2004-08-01 07:42:39 +00:00
|
|
|
MVT::ValueType Ty;
|
2004-08-11 02:22:39 +00:00
|
|
|
|
|
|
|
/// Name - If this operand was assigned a symbolic name, this is it,
|
|
|
|
/// otherwise, it's empty.
|
2004-08-01 07:42:39 +00:00
|
|
|
std::string Name;
|
2004-08-11 02:22:39 +00:00
|
|
|
|
|
|
|
/// PrinterMethodName - The method used to print operands of this type in
|
|
|
|
/// the asmprinter.
|
|
|
|
std::string PrinterMethodName;
|
|
|
|
|
|
|
|
/// MIOperandNo - Currently (this is meant to be phased out), some logical
|
|
|
|
/// operands correspond to multiple MachineInstr operands. In the X86
|
|
|
|
/// target for example, one address operand is represented as 4
|
|
|
|
/// MachineOperands. Because of this, the operand number in the
|
|
|
|
/// OperandList may not match the MachineInstr operand num. Until it
|
|
|
|
/// does, this contains the MI operand index of this operand.
|
|
|
|
unsigned MIOperandNo;
|
|
|
|
|
|
|
|
OperandInfo(Record *R, MVT::ValueType T, const std::string &N,
|
|
|
|
const std::string &PMN, unsigned MION)
|
|
|
|
: Rec(R), Ty(T), Name(N), PrinterMethodName(PMN), MIOperandNo(MION) {}
|
2004-08-01 07:42:39 +00:00
|
|
|
};
|
2004-08-01 05:04:00 +00:00
|
|
|
|
|
|
|
/// OperandList - The list of declared operands, along with their declared
|
|
|
|
/// type (which is a record).
|
2004-08-01 07:42:39 +00:00
|
|
|
std::vector<OperandInfo> OperandList;
|
2004-08-01 05:04:00 +00:00
|
|
|
|
|
|
|
// Various boolean values we track for the instruction.
|
|
|
|
bool isReturn;
|
|
|
|
bool isBranch;
|
|
|
|
bool isBarrier;
|
|
|
|
bool isCall;
|
2004-09-28 21:01:45 +00:00
|
|
|
bool isLoad;
|
|
|
|
bool isStore;
|
2004-08-01 05:04:00 +00:00
|
|
|
bool isTwoAddress;
|
|
|
|
bool isTerminator;
|
2004-09-28 18:38:01 +00:00
|
|
|
bool hasDelaySlot;
|
2004-08-01 05:04:00 +00:00
|
|
|
|
2004-08-14 22:50:53 +00:00
|
|
|
CodeGenInstruction(Record *R, const std::string &AsmStr);
|
2004-08-01 07:42:39 +00:00
|
|
|
|
|
|
|
/// getOperandNamed - Return the index of the operand with the specified
|
|
|
|
/// non-empty name. If the instruction does not have an operand with the
|
|
|
|
/// specified name, throw an exception.
|
|
|
|
unsigned getOperandNamed(const std::string &Name) const;
|
2004-08-01 05:04:00 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|