Moved getBinaryOperator to the BinaryOperator class and the getUnaryOperator
to the UnaryOperator class (from the Instruction class).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/llvmAsmParser.cpp b/lib/AsmParser/llvmAsmParser.cpp
index e79f1bf..080d4ea 100644
--- a/lib/AsmParser/llvmAsmParser.cpp
+++ b/lib/AsmParser/llvmAsmParser.cpp
@@ -1851,7 +1851,7 @@
case 113:
#line 854 "llvmAsmParser.y"
{
- yyval.InstVal = Instruction::getBinaryOperator(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
+ yyval.InstVal = BinaryOperator::getBinaryOperator(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
if (yyval.InstVal == 0)
ThrowException("binary operator returned null!");
;
@@ -1859,7 +1859,7 @@
case 114:
#line 859 "llvmAsmParser.y"
{
- yyval.InstVal = Instruction::getUnaryOperator(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
+ yyval.InstVal = UnaryOperator::getUnaryOperator(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
if (yyval.InstVal == 0)
ThrowException("unary operator returned null!");
;
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 01709ca..3a4873e 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -852,12 +852,12 @@
ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }
InstVal : BinaryOps Types ValueRef ',' ValueRef {
- $$ = Instruction::getBinaryOperator($1, getVal($2, $3), getVal($2, $5));
+ $$ = BinaryOperator::getBinaryOperator($1, getVal($2, $3), getVal($2, $5));
if ($$ == 0)
ThrowException("binary operator returned null!");
}
| UnaryOps Types ValueRef {
- $$ = Instruction::getUnaryOperator($1, getVal($2, $3));
+ $$ = UnaryOperator::getUnaryOperator($1, getVal($2, $3));
if ($$ == 0)
ThrowException("unary operator returned null!");
}
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp
index 667e144..54ca869 100644
--- a/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/lib/Bytecode/Reader/InstructionReader.cpp
@@ -93,12 +93,13 @@
if (Raw.Opcode >= Instruction::FirstUnaryOp &&
Raw.Opcode < Instruction::NumUnaryOps && Raw.NumOperands == 1) {
- Res = Instruction::getUnaryOperator(Raw.Opcode, getValue(Raw.Ty, Raw.Arg1));
+ Res = UnaryOperator::getUnaryOperator(Raw.Opcode,getValue(Raw.Ty,Raw.Arg1));
return false;
} else if (Raw.Opcode >= Instruction::FirstBinaryOp &&
Raw.Opcode < Instruction::NumBinaryOps && Raw.NumOperands == 2) {
- Res = Instruction::getBinaryOperator(Raw.Opcode, getValue(Raw.Ty, Raw.Arg1),
- getValue(Raw.Ty, Raw.Arg2));
+ Res = BinaryOperator::getBinaryOperator(Raw.Opcode,
+ getValue(Raw.Ty, Raw.Arg1),
+ getValue(Raw.Ty, Raw.Arg2));
return false;
} else if (Raw.Opcode == Instruction::PHINode) {
PHINode *PN = new PHINode(Raw.Ty);
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 4b528f0..6cb62ea 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -30,7 +30,8 @@
if (PP && hasName()) PP->getSymbolTableSure()->insert(this);
}
-Instruction *Instruction::getBinaryOperator(unsigned Op, Value *S1, Value *S2) {
+BinaryOperator *BinaryOperator::getBinaryOperator(unsigned Op,
+ Value *S1, Value *S2) {
switch (Op) {
case Add:
return new AddInst(S1, S2);
@@ -52,7 +53,7 @@
}
-Instruction *Instruction::getUnaryOperator(unsigned Op, Value *Source) {
+UnaryOperator *UnaryOperator::getUnaryOperator(unsigned Op, Value *Source) {
switch (Op) {
default:
cerr << "Don't know how to GetUnaryOperator " << Op << endl;