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

operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-02 00:09:22 +00:00
parent 7b1dcdfce1
commit cdcb388a58
4 changed files with 33 additions and 24 deletions

View File

@ -94,22 +94,30 @@ public:
MCValueVal = Val; MCValueVal = Val;
} }
void MakeReg(unsigned Reg) { static MCOperand CreateReg(unsigned Reg) {
Kind = kRegister; MCOperand Op;
RegVal = Reg; Op.Kind = kRegister;
Op.RegVal = Reg;
return Op;
} }
void MakeImm(int64_t Val) { static MCOperand CreateImm(int64_t Val) {
Kind = kImmediate; MCOperand Op;
ImmVal = Val; Op.Kind = kImmediate;
Op.ImmVal = Val;
return Op;
} }
void MakeMBBLabel(unsigned Fn, unsigned MBB) { static MCOperand CreateMBBLabel(unsigned Fn, unsigned MBB) {
Kind = kMBBLabel; MCOperand Op;
MBBLabel.FunctionNo = Fn; Op.Kind = kMBBLabel;
MBBLabel.BlockNo = MBB; Op.MBBLabel.FunctionNo = Fn;
Op.MBBLabel.BlockNo = MBB;
return Op;
} }
void MakeMCValue(const MCValue &Val) { static MCOperand CreateMCValue(const MCValue &Val) {
Kind = kMCValue; MCOperand Op;
MCValueVal = Val; 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) if (Op.Kind != X86Operand::Register)
return true; return true;
MCOps[0].MakeReg(Op.getReg()); MCOps[0] = MCOperand::CreateReg(Op.getReg());
return false; return false;
} }
@ -384,7 +384,7 @@ Match_X86_Op_IMM(const X86Operand &Op, MCOperand *MCOps, unsigned NumOps) {
if (Op.Kind != X86Operand::Immediate) if (Op.Kind != X86Operand::Immediate)
return true; return true;
MCOps[0].MakeMCValue(Op.getImm()); MCOps[0] = MCOperand::CreateMCValue(Op.getImm());
return false; return false;
} }
@ -396,10 +396,10 @@ static bool Match_X86_Op_LMEM(const X86Operand &Op,
if (Op.Kind != X86Operand::Memory) if (Op.Kind != X86Operand::Memory)
return true; return true;
MCOps[0].MakeReg(Op.getMemBaseReg()); MCOps[0] = MCOperand::CreateReg(Op.getMemBaseReg());
MCOps[1].MakeImm(Op.getMemScale()); MCOps[1] = MCOperand::CreateImm(Op.getMemScale());
MCOps[2].MakeReg(Op.getMemIndexReg()); MCOps[2] = MCOperand::CreateReg(Op.getMemIndexReg());
MCOps[3].MakeMCValue(Op.getMemDisp()); MCOps[3] = MCOperand::CreateMCValue(Op.getMemDisp());
return false; return false;
} }
@ -412,7 +412,7 @@ static bool Match_X86_Op_MEM(const X86Operand &Op,
if (Match_X86_Op_LMEM(Op, MCOps, 4)) if (Match_X86_Op_LMEM(Op, MCOps, 4))
return true; return true;
MCOps[4].MakeReg(Op.getMemSegReg()); MCOps[4] = MCOperand::CreateReg(Op.getMemSegReg());
return false; return false;
} }

View File

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

View File

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