mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-23 20:22:09 +00:00
Move M_* flags down in the file. Move SchedClass up in the
TargetInstrDescriptor class and shrink to 16-bits, saving a word in TargetInstrDescriptor. Add some comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45686 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
775060d007
commit
4764189298
@ -33,10 +33,56 @@ class SelectionDAG;
|
||||
template<class T> class SmallVectorImpl;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// struct TargetInstrDescriptor:
|
||||
// Predefined information about each machine instruction.
|
||||
// Designed to initialized statically.
|
||||
//
|
||||
// Machine Operand Flags and Description
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace TOI {
|
||||
// Operand constraints: only "tied_to" for now.
|
||||
enum OperandConstraint {
|
||||
TIED_TO = 0 // Must be allocated the same register as.
|
||||
};
|
||||
|
||||
/// OperandFlags - These are flags set on operands, but should be considered
|
||||
/// private, all access should go through the TargetOperandInfo accessors.
|
||||
/// See the accessors for a description of what these are.
|
||||
enum OperandFlags {
|
||||
LookupPtrRegClass = 1 << 0,
|
||||
Predicate = 1 << 1,
|
||||
OptionalDef = 1 << 2
|
||||
};
|
||||
}
|
||||
|
||||
/// TargetOperandInfo - This holds information about one operand of a machine
|
||||
/// instruction, indicating the register class for register operands, etc.
|
||||
///
|
||||
class TargetOperandInfo {
|
||||
public:
|
||||
/// RegClass - This specifies the register class enumeration of the operand
|
||||
/// if the operand is a register. If not, this contains 0.
|
||||
unsigned short RegClass;
|
||||
unsigned short Flags;
|
||||
/// Lower 16 bits are used to specify which constraints are set. The higher 16
|
||||
/// bits are used to specify the value of constraints (4 bits each).
|
||||
unsigned int Constraints;
|
||||
/// Currently no other information.
|
||||
|
||||
/// isLookupPtrRegClass - Set if this operand is a pointer value and it
|
||||
/// requires a callback to look up its register class.
|
||||
bool isLookupPtrRegClass() const { return Flags & TOI::LookupPtrRegClass; }
|
||||
|
||||
/// isPredicate - Set if this is one of the operands that made up of
|
||||
/// the predicate operand that controls an M_PREDICATED instruction.
|
||||
bool isPredicate() const { return Flags & TOI::Predicate; }
|
||||
|
||||
/// isOptionalDef - Set if this operand is a optional def.
|
||||
///
|
||||
bool isOptionalDef() const { return Flags & TOI::OptionalDef; }
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Machine Instruction Flags and Description
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
const unsigned M_BRANCH_FLAG = 1 << 0;
|
||||
const unsigned M_CALL_FLAG = 1 << 1;
|
||||
@ -118,61 +164,14 @@ const unsigned M_NEVER_HAS_SIDE_EFFECTS = 1 << 18;
|
||||
const unsigned M_MAY_HAVE_SIDE_EFFECTS = 1 << 19;
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Machine operand flags
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace TOI {
|
||||
// Operand constraints: only "tied_to" for now.
|
||||
enum OperandConstraint {
|
||||
TIED_TO = 0 // Must be allocated the same register as.
|
||||
};
|
||||
|
||||
/// OperandFlags - These are flags set on operands, but should be considered
|
||||
/// private, all access should go through the TargetOperandInfo accessors.
|
||||
/// See the accessors for a description of what these are.
|
||||
enum OperandFlags {
|
||||
LookupPtrRegClass = 1 << 0,
|
||||
Predicate = 1 << 1,
|
||||
OptionalDef = 1 << 2
|
||||
};
|
||||
}
|
||||
|
||||
/// TargetOperandInfo - This holds information about one operand of a machine
|
||||
/// instruction, indicating the register class for register operands, etc.
|
||||
///
|
||||
class TargetOperandInfo {
|
||||
public:
|
||||
/// RegClass - This specifies the register class enumeration of the operand
|
||||
/// if the operand is a register. If not, this contains 0.
|
||||
unsigned short RegClass;
|
||||
unsigned short Flags;
|
||||
/// Lower 16 bits are used to specify which constraints are set. The higher 16
|
||||
/// bits are used to specify the value of constraints (4 bits each).
|
||||
unsigned int Constraints;
|
||||
/// Currently no other information.
|
||||
|
||||
/// isLookupPtrRegClass - Set if this operand is a pointer value and it
|
||||
/// requires a callback to look up its register class.
|
||||
bool isLookupPtrRegClass() const { return Flags & TOI::LookupPtrRegClass; }
|
||||
|
||||
/// isPredicate - Set if this is one of the operands that made up of
|
||||
/// the predicate operand that controls an M_PREDICATED instruction.
|
||||
bool isPredicate() const { return Flags & TOI::Predicate; }
|
||||
|
||||
/// isOptionalDef - Set if this operand is a optional def.
|
||||
///
|
||||
bool isOptionalDef() const { return Flags & TOI::OptionalDef; }
|
||||
};
|
||||
|
||||
|
||||
class TargetInstrDescriptor {
|
||||
public:
|
||||
unsigned short Opcode; // The opcode.
|
||||
unsigned short NumOperands; // Num of args (may be more if variable_ops).
|
||||
unsigned short Opcode; // The opcode number.
|
||||
unsigned short NumOperands; // Num of args (may be more if variable_ops)
|
||||
unsigned short NumDefs; // Num of args that are definitions.
|
||||
const char * Name; // Assembly language mnemonic for the opcode.
|
||||
unsigned SchedClass; // enum identifying instr sched class
|
||||
unsigned short SchedClass; // enum identifying instr sched class
|
||||
const char * Name; // Name of the instruction record in td file.
|
||||
unsigned Flags; // flags identifying machine instr class
|
||||
unsigned TSFlags; // Target Specific Flag values
|
||||
const unsigned *ImplicitUses; // Registers implicitly read by this instr
|
||||
@ -197,6 +196,8 @@ public:
|
||||
/// dest operand. Returns -1 if there isn't one.
|
||||
int findTiedToSrcOperand(unsigned OpNum) const;
|
||||
|
||||
/// getName - Return the name of the record in the .td file for this
|
||||
/// instruction, for example "ADD8ri".
|
||||
const char *getName() const {
|
||||
return Name;
|
||||
}
|
||||
|
@ -298,8 +298,8 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
||||
|
||||
OS << " { ";
|
||||
OS << Num << ",\t" << MinOperands << ",\t"
|
||||
<< Inst.NumDefs << ",\t\"" << Inst.TheDef->getName();
|
||||
OS << "\",\t" << getItinClassNumber(Inst.TheDef) << ", 0";
|
||||
<< Inst.NumDefs << ",\t" << getItinClassNumber(Inst.TheDef)
|
||||
<< ",\t\"" << Inst.TheDef->getName() << "\", 0";
|
||||
|
||||
// Emit all of the target indepedent flags...
|
||||
if (Inst.isReturn) OS << "|M_RET_FLAG";
|
||||
|
Loading…
x
Reference in New Issue
Block a user