[llvm-commits] [llvm] r77837 - in /llvm/trunk: include/llvm/MC/MCInst.h lib/Target/X86/AsmParser/X86AsmParser.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp utils/TableGen/AsmMatcherEmitter.cpp
Daniel Dunbar
daniel at zuster.org
Sat Aug 1 17:09:22 PDT 2009
Author: ddunbar
Date: Sat Aug 1 19:09:22 2009
New Revision: 77837
URL: http://llvm.org/viewvc/llvm-project?rev=77837&view=rev
Log:
Change MCOperand to use Create style instead of Make style for constructing
operands.
Modified:
llvm/trunk/include/llvm/MC/MCInst.h
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/include/llvm/MC/MCInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=77837&r1=77836&r2=77837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCInst.h (original)
+++ llvm/trunk/include/llvm/MC/MCInst.h Sat Aug 1 19:09:22 2009
@@ -94,22 +94,30 @@
MCValueVal = Val;
}
- void MakeReg(unsigned Reg) {
- Kind = kRegister;
- RegVal = Reg;
- }
- void MakeImm(int64_t Val) {
- Kind = kImmediate;
- ImmVal = Val;
- }
- void MakeMBBLabel(unsigned Fn, unsigned MBB) {
- Kind = kMBBLabel;
- MBBLabel.FunctionNo = Fn;
- MBBLabel.BlockNo = MBB;
- }
- void MakeMCValue(const MCValue &Val) {
- Kind = kMCValue;
- MCValueVal = Val;
+ static MCOperand CreateReg(unsigned Reg) {
+ MCOperand Op;
+ Op.Kind = kRegister;
+ Op.RegVal = Reg;
+ return Op;
+ }
+ static MCOperand CreateImm(int64_t Val) {
+ MCOperand Op;
+ Op.Kind = kImmediate;
+ Op.ImmVal = Val;
+ return Op;
+ }
+ static MCOperand CreateMBBLabel(unsigned Fn, unsigned MBB) {
+ MCOperand Op;
+ Op.Kind = kMBBLabel;
+ Op.MBBLabel.FunctionNo = Fn;
+ Op.MBBLabel.BlockNo = MBB;
+ return Op;
+ }
+ static MCOperand CreateMCValue(const MCValue &Val) {
+ MCOperand Op;
+ Op.Kind = kMCValue;
+ Op.MCValueVal = Val;
+ return Op;
}
};
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=77837&r1=77836&r2=77837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sat Aug 1 19:09:22 2009
@@ -372,7 +372,7 @@
if (Op.Kind != X86Operand::Register)
return true;
- MCOps[0].MakeReg(Op.getReg());
+ MCOps[0] = MCOperand::CreateReg(Op.getReg());
return false;
}
@@ -384,7 +384,7 @@
if (Op.Kind != X86Operand::Immediate)
return true;
- MCOps[0].MakeMCValue(Op.getImm());
+ MCOps[0] = MCOperand::CreateMCValue(Op.getImm());
return false;
}
@@ -396,10 +396,10 @@
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 @@
if (Match_X86_Op_LMEM(Op, MCOps, 4))
return true;
- MCOps[4].MakeReg(Op.getMemSegReg());
+ MCOps[4] = MCOperand::CreateReg(Op.getMemSegReg());
return false;
}
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77837&r1=77836&r2=77837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Sat Aug 1 19:09:22 2009
@@ -725,11 +725,12 @@
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");
}
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=77837&r1=77836&r2=77837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Sat Aug 1 19:09:22 2009
@@ -258,7 +258,7 @@
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";
}
More information about the llvm-commits
mailing list