mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-21 12:38:45 +00:00
Rename the opCode instance variable to Opcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9fc77d1358
commit
2a90ba6017
@ -332,7 +332,7 @@ private:
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class MachineInstr {
|
class MachineInstr {
|
||||||
int opCode; // the opcode
|
int Opcode; // the opcode
|
||||||
std::vector<MachineOperand> operands; // the operands
|
std::vector<MachineOperand> operands; // the operands
|
||||||
unsigned numImplicitRefs; // number of implicit operands
|
unsigned numImplicitRefs; // number of implicit operands
|
||||||
MachineInstr* prev, *next; // links for our intrusive list
|
MachineInstr* prev, *next; // links for our intrusive list
|
||||||
@ -371,7 +371,7 @@ public:
|
|||||||
|
|
||||||
/// Accessors for opcode.
|
/// Accessors for opcode.
|
||||||
///
|
///
|
||||||
const int getOpcode() const { return opCode; }
|
const int getOpcode() const { return Opcode; }
|
||||||
|
|
||||||
/// Access to explicit operands of the instruction.
|
/// Access to explicit operands of the instruction.
|
||||||
///
|
///
|
||||||
@ -591,7 +591,7 @@ public:
|
|||||||
|
|
||||||
/// setOpcode - Replace the opcode of the current instruction with a new one.
|
/// setOpcode - Replace the opcode of the current instruction with a new one.
|
||||||
///
|
///
|
||||||
void setOpcode(unsigned Op) { opCode = Op; }
|
void setOpcode(unsigned Op) { Opcode = Op; }
|
||||||
|
|
||||||
/// RemoveOperand - Erase an operand from an instruction, leaving it with one
|
/// RemoveOperand - Erase an operand from an instruction, leaving it with one
|
||||||
/// fewer operand than it started with.
|
/// fewer operand than it started with.
|
||||||
|
@ -28,11 +28,8 @@ namespace llvm {
|
|||||||
extern const TargetInstrDescriptor *TargetInstrDescriptors;
|
extern const TargetInstrDescriptor *TargetInstrDescriptors;
|
||||||
|
|
||||||
// Constructor for instructions with variable #operands
|
// Constructor for instructions with variable #operands
|
||||||
MachineInstr::MachineInstr(MachineOpCode OpCode, unsigned numOperands)
|
MachineInstr::MachineInstr(MachineOpCode opcode, unsigned numOperands)
|
||||||
: opCode(OpCode),
|
: Opcode(opcode), operands(numOperands, MachineOperand()), numImplicitRefs(0){
|
||||||
operands(numOperands, MachineOperand()),
|
|
||||||
numImplicitRefs(0)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MachineInstr ctor - This constructor only does a _reserve_ of the operands,
|
/// MachineInstr ctor - This constructor only does a _reserve_ of the operands,
|
||||||
@ -40,22 +37,18 @@ MachineInstr::MachineInstr(MachineOpCode OpCode, unsigned numOperands)
|
|||||||
/// add* methods below to fill up the operands, instead of the Set methods.
|
/// add* methods below to fill up the operands, instead of the Set methods.
|
||||||
/// Eventually, the "resizing" ctors will be phased out.
|
/// Eventually, the "resizing" ctors will be phased out.
|
||||||
///
|
///
|
||||||
MachineInstr::MachineInstr(MachineOpCode Opcode, unsigned numOperands,
|
MachineInstr::MachineInstr(MachineOpCode opcode, unsigned numOperands,
|
||||||
bool XX, bool YY)
|
bool XX, bool YY)
|
||||||
: opCode(Opcode),
|
: Opcode(opcode), numImplicitRefs(0) {
|
||||||
numImplicitRefs(0)
|
|
||||||
{
|
|
||||||
operands.reserve(numOperands);
|
operands.reserve(numOperands);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MachineInstr ctor - Work exactly the same as the ctor above, except that the
|
/// MachineInstr ctor - Work exactly the same as the ctor above, except that the
|
||||||
/// MachineInstr is created and added to the end of the specified basic block.
|
/// MachineInstr is created and added to the end of the specified basic block.
|
||||||
///
|
///
|
||||||
MachineInstr::MachineInstr(MachineBasicBlock *MBB, MachineOpCode Opcode,
|
MachineInstr::MachineInstr(MachineBasicBlock *MBB, MachineOpCode opcode,
|
||||||
unsigned numOperands)
|
unsigned numOperands)
|
||||||
: opCode(Opcode),
|
: Opcode(opcode), numImplicitRefs(0) {
|
||||||
numImplicitRefs(0)
|
|
||||||
{
|
|
||||||
assert(MBB && "Cannot use inserting ctor with null basic block!");
|
assert(MBB && "Cannot use inserting ctor with null basic block!");
|
||||||
operands.reserve(numOperands);
|
operands.reserve(numOperands);
|
||||||
MBB->push_back(this); // Add instruction to end of basic block!
|
MBB->push_back(this); // Add instruction to end of basic block!
|
||||||
@ -63,9 +56,8 @@ MachineInstr::MachineInstr(MachineBasicBlock *MBB, MachineOpCode Opcode,
|
|||||||
|
|
||||||
|
|
||||||
// OperandComplete - Return true if it's illegal to add a new operand
|
// OperandComplete - Return true if it's illegal to add a new operand
|
||||||
bool MachineInstr::OperandsComplete() const
|
bool MachineInstr::OperandsComplete() const {
|
||||||
{
|
int NumOperands = TargetInstrDescriptors[Opcode].numOperands;
|
||||||
int NumOperands = TargetInstrDescriptors[opCode].numOperands;
|
|
||||||
if (NumOperands >= 0 && getNumOperands() >= (unsigned)NumOperands)
|
if (NumOperands >= 0 && getNumOperands() >= (unsigned)NumOperands)
|
||||||
return true; // Broken: we have all the operands of this instruction!
|
return true; // Broken: we have all the operands of this instruction!
|
||||||
return false;
|
return false;
|
||||||
@ -77,11 +69,10 @@ bool MachineInstr::OperandsComplete() const
|
|||||||
// This only resets the size of the operand vector and initializes it.
|
// This only resets the size of the operand vector and initializes it.
|
||||||
// The new operands must be set explicitly later.
|
// The new operands must be set explicitly later.
|
||||||
//
|
//
|
||||||
void MachineInstr::replace(MachineOpCode Opcode, unsigned numOperands)
|
void MachineInstr::replace(MachineOpCode opcode, unsigned numOperands) {
|
||||||
{
|
|
||||||
assert(getNumImplicitRefs() == 0 &&
|
assert(getNumImplicitRefs() == 0 &&
|
||||||
"This is probably broken because implicit refs are going to be lost.");
|
"This is probably broken because implicit refs are going to be lost.");
|
||||||
opCode = Opcode;
|
Opcode = opcode;
|
||||||
operands.clear();
|
operands.clear();
|
||||||
operands.resize(numOperands, MachineOperand());
|
operands.resize(numOperands, MachineOperand());
|
||||||
}
|
}
|
||||||
@ -98,10 +89,9 @@ void MachineInstr::SetMachineOperandVal(unsigned i,
|
|||||||
void
|
void
|
||||||
MachineInstr::SetMachineOperandConst(unsigned i,
|
MachineInstr::SetMachineOperandConst(unsigned i,
|
||||||
MachineOperand::MachineOperandType operandType,
|
MachineOperand::MachineOperandType operandType,
|
||||||
int64_t intValue)
|
int64_t intValue) {
|
||||||
{
|
|
||||||
assert(i < getNumOperands()); // must be explicit op
|
assert(i < getNumOperands()); // must be explicit op
|
||||||
assert(TargetInstrDescriptors[opCode].resultPos != (int) i &&
|
assert(TargetInstrDescriptors[Opcode].resultPos != (int) i &&
|
||||||
"immed. constant cannot be defined");
|
"immed. constant cannot be defined");
|
||||||
|
|
||||||
operands[i].opType = operandType;
|
operands[i].opType = operandType;
|
||||||
@ -119,16 +109,12 @@ void MachineInstr::SetMachineOperandReg(unsigned i, int regNum) {
|
|||||||
operands[i].regNum = regNum;
|
operands[i].regNum = regNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void MachineInstr::SetRegForOperand(unsigned i, int regNum) {
|
||||||
MachineInstr::SetRegForOperand(unsigned i, int regNum)
|
|
||||||
{
|
|
||||||
assert(i < getNumOperands()); // must be explicit op
|
assert(i < getNumOperands()); // must be explicit op
|
||||||
operands[i].setRegForValue(regNum);
|
operands[i].setRegForValue(regNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void MachineInstr::SetRegForImplicitRef(unsigned i, int regNum) {
|
||||||
MachineInstr::SetRegForImplicitRef(unsigned i, int regNum)
|
|
||||||
{
|
|
||||||
getImplicitOp(i).setRegForValue(regNum);
|
getImplicitOp(i).setRegForValue(regNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +313,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
|
std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
|
||||||
{
|
{
|
||||||
os << TargetInstrDescriptors[MI.opCode].Name;
|
os << TargetInstrDescriptors[MI.getOpcode()].Name;
|
||||||
|
|
||||||
for (unsigned i=0, N=MI.getNumOperands(); i < N; i++) {
|
for (unsigned i=0, N=MI.getNumOperands(); i < N; i++) {
|
||||||
os << "\t" << MI.getOperand(i);
|
os << "\t" << MI.getOperand(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user