mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Use predicate for Value type test
Use builtin casts git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@541 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
919758563d
commit
1a4f8ae3c8
@ -322,14 +322,11 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
|
|||||||
|
|
||||||
// Check latter condition here just to simplify the next IF.
|
// Check latter condition here just to simplify the next IF.
|
||||||
bool includeAddressOperand =
|
bool includeAddressOperand =
|
||||||
((operand->getValueType() == Value::BasicBlockVal
|
((operand->isBasicBlock() || operand->isMethod())
|
||||||
|| operand->getValueType() == Value::MethodVal)
|
&& !instr->isTerminator());
|
||||||
&& ! instr->isTerminator());
|
|
||||||
|
|
||||||
if ( includeAddressOperand
|
if (includeAddressOperand || operand->isInstruction() ||
|
||||||
|| operand->getValueType() == Value::InstructionVal
|
operand->isConstant() || operand->isMethodArgument())
|
||||||
|| operand->getValueType() == Value::ConstantVal
|
|
||||||
|| operand->getValueType() == Value::MethodArgumentVal)
|
|
||||||
{// This operand is a data value
|
{// This operand is a data value
|
||||||
|
|
||||||
// An instruction that computes the incoming value is added as a
|
// 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.
|
// is used directly, i.e., made a child of the instruction node.
|
||||||
//
|
//
|
||||||
InstrTreeNode* opTreeNode;
|
InstrTreeNode* opTreeNode;
|
||||||
if (operand->getValueType() == Value::InstructionVal
|
if (operand->isInstruction() && operand->use_size() == 1 &&
|
||||||
&& operand->use_size() == 1
|
((Instruction*)operand)->getParent() == instr->getParent())
|
||||||
&& ((Instruction*)operand)->getParent() == instr->getParent())
|
|
||||||
{
|
{
|
||||||
// Recursively create a treeNode for it.
|
// Recursively create a treeNode for it.
|
||||||
opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
|
opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
|
||||||
}
|
}
|
||||||
else if (operand->getValueType() == Value::ConstantVal)
|
else if (ConstPoolVal *CPV = operand->castConstant())
|
||||||
{
|
{
|
||||||
// Create a leaf node for a constant
|
// Create a leaf node for a constant
|
||||||
opTreeNode = new ConstantNode((ConstPoolVal*) operand);
|
opTreeNode = new ConstantNode(CPV);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -322,14 +322,11 @@ InstrForest::buildTreeForInstruction(Instruction* instr)
|
|||||||
|
|
||||||
// Check latter condition here just to simplify the next IF.
|
// Check latter condition here just to simplify the next IF.
|
||||||
bool includeAddressOperand =
|
bool includeAddressOperand =
|
||||||
((operand->getValueType() == Value::BasicBlockVal
|
((operand->isBasicBlock() || operand->isMethod())
|
||||||
|| operand->getValueType() == Value::MethodVal)
|
&& !instr->isTerminator());
|
||||||
&& ! instr->isTerminator());
|
|
||||||
|
|
||||||
if ( includeAddressOperand
|
if (includeAddressOperand || operand->isInstruction() ||
|
||||||
|| operand->getValueType() == Value::InstructionVal
|
operand->isConstant() || operand->isMethodArgument())
|
||||||
|| operand->getValueType() == Value::ConstantVal
|
|
||||||
|| operand->getValueType() == Value::MethodArgumentVal)
|
|
||||||
{// This operand is a data value
|
{// This operand is a data value
|
||||||
|
|
||||||
// An instruction that computes the incoming value is added as a
|
// 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.
|
// is used directly, i.e., made a child of the instruction node.
|
||||||
//
|
//
|
||||||
InstrTreeNode* opTreeNode;
|
InstrTreeNode* opTreeNode;
|
||||||
if (operand->getValueType() == Value::InstructionVal
|
if (operand->isInstruction() && operand->use_size() == 1 &&
|
||||||
&& operand->use_size() == 1
|
((Instruction*)operand)->getParent() == instr->getParent())
|
||||||
&& ((Instruction*)operand)->getParent() == instr->getParent())
|
|
||||||
{
|
{
|
||||||
// Recursively create a treeNode for it.
|
// Recursively create a treeNode for it.
|
||||||
opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
|
opTreeNode =this->buildTreeForInstruction((Instruction*)operand);
|
||||||
}
|
}
|
||||||
else if (operand->getValueType() == Value::ConstantVal)
|
else if (ConstPoolVal *CPV = operand->castConstant())
|
||||||
{
|
{
|
||||||
// Create a leaf node for a constant
|
// Create a leaf node for a constant
|
||||||
opTreeNode = new ConstantNode((ConstPoolVal*) operand);
|
opTreeNode = new ConstantNode(CPV);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user