Unary Not (boolean and bitwise) is no longer a separate LLVM instruction
authorVikram S. Adve <vadve@cs.uiuc.edu>
Thu, 15 Aug 2002 14:19:22 +0000 (14:19 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Thu, 15 Aug 2002 14:19:22 +0000 (14:19 +0000)
but is instead implemented with XOR.  Note that the InstrForest opLabels
for Not and BNot remain the same, i.e., the XOR is recognized and
represented as a (boolean or bitwise) Not when building the instruction
trees.  But these tree nodes are now binary, not unary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3343 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSelection/InstrForest.cpp
lib/Target/SparcV9/InstrSelection/InstrForest.cpp

index d7edf1575b3304047f8e98de06ed62f266ed5a0e..c24c35b640b15fcf3870cce15e84c9bca75e5f0f 100644 (file)
@@ -73,10 +73,15 @@ InstructionNode::InstructionNode(Instruction* I)
     {
       opLabel = opLabel + 100;          // load/getElem with index vector
     }
+  else if (opLabel == Instruction::Xor &&
+           BinaryOperator::isNot(I))
+    {
+      opLabel = (I->getType() == Type::BoolTy)?  NotOp  // boolean Not operator
+                                              : BNotOp; // bitwise Not operator
+    }
   else if (opLabel == Instruction::And ||
            opLabel == Instruction::Or ||
-           opLabel == Instruction::Xor ||
-           opLabel == Instruction::Not)
+           opLabel == Instruction::Xor)
     {
       // Distinguish bitwise operators from logical operators!
       if (I->getType() != Type::BoolTy)
index d7edf1575b3304047f8e98de06ed62f266ed5a0e..c24c35b640b15fcf3870cce15e84c9bca75e5f0f 100644 (file)
@@ -73,10 +73,15 @@ InstructionNode::InstructionNode(Instruction* I)
     {
       opLabel = opLabel + 100;          // load/getElem with index vector
     }
+  else if (opLabel == Instruction::Xor &&
+           BinaryOperator::isNot(I))
+    {
+      opLabel = (I->getType() == Type::BoolTy)?  NotOp  // boolean Not operator
+                                              : BNotOp; // bitwise Not operator
+    }
   else if (opLabel == Instruction::And ||
            opLabel == Instruction::Or ||
-           opLabel == Instruction::Xor ||
-           opLabel == Instruction::Not)
+           opLabel == Instruction::Xor)
     {
       // Distinguish bitwise operators from logical operators!
       if (I->getType() != Type::BoolTy)