Change MCOperand to use Create style instead of Make style for constructing

operands.

llvm-svn: 77837
This commit is contained in:
Daniel Dunbar 2009-08-02 00:09:22 +00:00
parent 7bb2097143
commit b2aebed2dc
4 changed files with 33 additions and 24 deletions

View File

@ -94,22 +94,30 @@ public:
MCValueVal = Val;
}
void MakeReg(unsigned Reg) {
Kind = kRegister;
RegVal = Reg;
static MCOperand CreateReg(unsigned Reg) {
MCOperand Op;
Op.Kind = kRegister;
Op.RegVal = Reg;
return Op;
}
void MakeImm(int64_t Val) {
Kind = kImmediate;
ImmVal = Val;
static MCOperand CreateImm(int64_t Val) {
MCOperand Op;
Op.Kind = kImmediate;
Op.ImmVal = Val;
return Op;
}
void MakeMBBLabel(unsigned Fn, unsigned MBB) {
Kind = kMBBLabel;
MBBLabel.FunctionNo = Fn;
MBBLabel.BlockNo = MBB;
static MCOperand CreateMBBLabel(unsigned Fn, unsigned MBB) {
MCOperand Op;
Op.Kind = kMBBLabel;
Op.MBBLabel.FunctionNo = Fn;
Op.MBBLabel.BlockNo = MBB;
return Op;
}
void MakeMCValue(const MCValue &Val) {
Kind = kMCValue;
MCValueVal = Val;
static MCOperand CreateMCValue(const MCValue &Val) {
MCOperand Op;
Op.Kind = kMCValue;
Op.MCValueVal = Val;
return Op;
}
};

View File

@ -372,7 +372,7 @@ Match_X86_Op_REG(const X86Operand &Op, MCOperand *MCOps, unsigned NumOps) {
if (Op.Kind != X86Operand::Register)
return true;
MCOps[0].MakeReg(Op.getReg());
MCOps[0] = MCOperand::CreateReg(Op.getReg());
return false;
}
@ -384,7 +384,7 @@ Match_X86_Op_IMM(const X86Operand &Op, MCOperand *MCOps, unsigned NumOps) {
if (Op.Kind != X86Operand::Immediate)
return true;
MCOps[0].MakeMCValue(Op.getImm());
MCOps[0] = MCOperand::CreateMCValue(Op.getImm());
return false;
}
@ -396,10 +396,10 @@ static bool Match_X86_Op_LMEM(const X86Operand &Op,
if (Op.Kind != X86Operand::Memory)
return true;
MCOps[0].MakeReg(Op.getMemBaseReg());
MCOps[1].MakeImm(Op.getMemScale());
MCOps[2].MakeReg(Op.getMemIndexReg());
MCOps[3].MakeMCValue(Op.getMemDisp());
MCOps[0] = MCOperand::CreateReg(Op.getMemBaseReg());
MCOps[1] = MCOperand::CreateImm(Op.getMemScale());
MCOps[2] = MCOperand::CreateReg(Op.getMemIndexReg());
MCOps[3] = MCOperand::CreateMCValue(Op.getMemDisp());
return false;
}
@ -412,7 +412,7 @@ static bool Match_X86_Op_MEM(const X86Operand &Op,
if (Match_X86_Op_LMEM(Op, MCOps, 4))
return true;
MCOps[4].MakeReg(Op.getMemSegReg());
MCOps[4] = MCOperand::CreateReg(Op.getMemSegReg());
return false;
}

View File

@ -725,11 +725,12 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
MCOperand MCOp;
if (MO.isReg()) {
MCOp.MakeReg(MO.getReg());
MCOp = MCOperand::CreateReg(MO.getReg());
} else if (MO.isImm()) {
MCOp.MakeImm(MO.getImm());
MCOp = MCOperand::CreateImm(MO.getImm());
} else if (MO.isMBB()) {
MCOp.MakeMBBLabel(getFunctionNumber(), MO.getMBB()->getNumber());
MCOp = MCOperand::CreateMBBLabel(getFunctionNumber(),
MO.getMBB()->getNumber());
} else {
llvm_unreachable("Unimp");
}

View File

@ -258,7 +258,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
if (!MatchedOperands.count(i)) {
OS << "\n";
OS << " // FIXME: Nothing matched Ops[" << i << "]!\n";
OS << " Ops[" << i << "].MakeReg(0);\n";
OS << " Ops[" << i << "] = MCOperand::CreateReg(0);\n";
OS << "\n";
}