mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Select Constant nodes to TargetConstant nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23488 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
32643d8e05
commit
f6f9416363
@ -1088,15 +1088,29 @@ CodeGenPatternResult(TreePatternNode *N, unsigned &Ctr,
|
|||||||
if (Val[0] == 'T' && Val[1] == 'm' && Val[2] == 'p') {
|
if (Val[0] == 'T' && Val[1] == 'm' && Val[2] == 'p') {
|
||||||
// Already selected this operand, just return the tmpval.
|
// Already selected this operand, just return the tmpval.
|
||||||
return atoi(Val.c_str()+3);
|
return atoi(Val.c_str()+3);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
unsigned ResNo = Ctr++;
|
unsigned ResNo = Ctr++;
|
||||||
|
if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
|
||||||
|
switch (N->getType()) {
|
||||||
|
default: assert(0 && "Unknown type for constant node!");
|
||||||
|
case MVT::i1: OS << " bool Tmp"; break;
|
||||||
|
case MVT::i8: OS << " unsigned char Tmp"; break;
|
||||||
|
case MVT::i16: OS << " unsigned short Tmp"; break;
|
||||||
|
case MVT::i32: OS << " unsigned Tmp"; break;
|
||||||
|
case MVT::i64: OS << " uint64_t Tmp"; break;
|
||||||
|
}
|
||||||
|
OS << ResNo << "C = cast<ConstantSDNode>(" << Val << ")->getValue();\n";
|
||||||
|
OS << " SDOperand Tmp" << ResNo << " = CurDAG->getTargetConstant(Tmp"
|
||||||
|
<< ResNo << "C, MVT::" << getEnumName(N->getType()) << ");\n";
|
||||||
|
} else {
|
||||||
OS << " SDOperand Tmp" << ResNo << " = Select(" << Val << ");\n";
|
OS << " SDOperand Tmp" << ResNo << " = Select(" << Val << ");\n";
|
||||||
|
}
|
||||||
// Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
|
// Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
|
||||||
// value if used multiple times by this pattern result.
|
// value if used multiple times by this pattern result.
|
||||||
Val = "Tmp"+utostr(ResNo);
|
Val = "Tmp"+utostr(ResNo);
|
||||||
return ResNo;
|
return ResNo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (N->isLeaf()) {
|
if (N->isLeaf()) {
|
||||||
N->dump();
|
N->dump();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user