Use predicate for Value type test
authorChris Lattner <sabre@nondot.org>
Mon, 10 Sep 2001 20:09:50 +0000 (20:09 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 10 Sep 2001 20:09:50 +0000 (20:09 +0000)
Use builtin casts

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

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

index 12475b016d9ebfa6138e6b19f2cc63321d952392..181c1a1d43f33682f57cca2d6a48de46c9f248b3 100644 (file)
@@ -322,14 +322,11 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
       
       // Check latter condition here just to simplify the next IF.
       bool includeAddressOperand =
-       ((operand->getValueType() == Value::BasicBlockVal
-         || operand->getValueType() == Value::MethodVal)
-        && ! instr->isTerminator());
+       ((operand->isBasicBlock() || operand->isMethod())
+        && !instr->isTerminator());
         
-      if (   includeAddressOperand
-         || operand->getValueType() == Value::InstructionVal
-         || operand->getValueType() == Value::ConstantVal
-         || operand->getValueType() == Value::MethodArgumentVal)
+      if (includeAddressOperand || operand->isInstruction() ||
+         operand->isConstant() || operand->isMethodArgument())
        {// This operand is a data value
          
          // An instruction that computes the incoming value is added as a
@@ -345,17 +342,16 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
          // is used directly, i.e., made a child of the instruction node.
          // 
          InstrTreeNode* opTreeNode;
-         if (operand->getValueType() == Value::InstructionVal
-             && operand->use_size() == 1
-             && ((Instruction*)operand)->getParent() == instr->getParent())
+         if (operand->isInstruction() && operand->use_size() == 1 &&
+             ((Instruction*)operand)->getParent() == instr->getParent())
            {
              // Recursively create a treeNode for it.
              opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
            }
-         else if (operand->getValueType() == Value::ConstantVal)
+         else if (ConstPoolVal *CPV = operand->castConstant())
            {
              // Create a leaf node for a constant
-             opTreeNode = new ConstantNode((ConstPoolVal*) operand);
+             opTreeNode = new ConstantNode(CPV);
            }
          else
            {
index 12475b016d9ebfa6138e6b19f2cc63321d952392..181c1a1d43f33682f57cca2d6a48de46c9f248b3 100644 (file)
@@ -322,14 +322,11 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
       
       // Check latter condition here just to simplify the next IF.
       bool includeAddressOperand =
-       ((operand->getValueType() == Value::BasicBlockVal
-         || operand->getValueType() == Value::MethodVal)
-        && ! instr->isTerminator());
+       ((operand->isBasicBlock() || operand->isMethod())
+        && !instr->isTerminator());
         
-      if (   includeAddressOperand
-         || operand->getValueType() == Value::InstructionVal
-         || operand->getValueType() == Value::ConstantVal
-         || operand->getValueType() == Value::MethodArgumentVal)
+      if (includeAddressOperand || operand->isInstruction() ||
+         operand->isConstant() || operand->isMethodArgument())
        {// This operand is a data value
          
          // An instruction that computes the incoming value is added as a
@@ -345,17 +342,16 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
          // is used directly, i.e., made a child of the instruction node.
          // 
          InstrTreeNode* opTreeNode;
-         if (operand->getValueType() == Value::InstructionVal
-             && operand->use_size() == 1
-             && ((Instruction*)operand)->getParent() == instr->getParent())
+         if (operand->isInstruction() && operand->use_size() == 1 &&
+             ((Instruction*)operand)->getParent() == instr->getParent())
            {
              // Recursively create a treeNode for it.
              opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
            }
-         else if (operand->getValueType() == Value::ConstantVal)
+         else if (ConstPoolVal *CPV = operand->castConstant())
            {
              // Create a leaf node for a constant
-             opTreeNode = new ConstantNode((ConstPoolVal*) operand);
+             opTreeNode = new ConstantNode(CPV);
            }
          else
            {