mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-19 03:29:22 +00:00
implement a fixme: only select values once, even if used multiple times.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23454 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ff0c1ef9eb
commit
6bc7e513d5
@ -1074,23 +1074,26 @@ void DAGISelEmitter::EmitMatchForPattern(TreePatternNode *N,
|
|||||||
<< ".Val)) goto P" << PatternNo << "Fail;\n";
|
<< ".Val)) goto P" << PatternNo << "Fail;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// CodeGenPatternResult - Emit the action for a pattern. Now that it has
|
||||||
|
/// matched, we actually have to build a DAG!
|
||||||
unsigned DAGISelEmitter::
|
unsigned DAGISelEmitter::
|
||||||
CodeGenPatternResult(TreePatternNode *N, unsigned &Ctr,
|
CodeGenPatternResult(TreePatternNode *N, unsigned &Ctr,
|
||||||
std::map<std::string,std::string> &VariableMap,
|
std::map<std::string,std::string> &VariableMap,
|
||||||
std::ostream &OS){
|
std::ostream &OS) {
|
||||||
// This is something selected from the pattern we matched.
|
// This is something selected from the pattern we matched.
|
||||||
if (!N->getName().empty()) {
|
if (!N->getName().empty()) {
|
||||||
const std::string &Val = VariableMap[N->getName()];
|
std::string &Val = VariableMap[N->getName()];
|
||||||
assert(!Val.empty() &&
|
assert(!Val.empty() &&
|
||||||
"Variable referenced but not defined and not caught earlier!");
|
"Variable referenced but not defined and not caught earlier!");
|
||||||
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.
|
||||||
// FIXME: DO THIS.
|
return atoi(Val.c_str()+3);
|
||||||
} else {
|
} else {
|
||||||
unsigned ResNo = Ctr++;
|
unsigned ResNo = Ctr++;
|
||||||
OS << " SDOperand Tmp" << ResNo << " = Select(" << Val << ");\n";
|
OS << " SDOperand Tmp" << ResNo << " = Select(" << Val << ");\n";
|
||||||
// FIXME: Add Tmp<ResNo> to VariableMap.
|
// Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
|
||||||
|
// value if used multiple times by this pattern result.
|
||||||
|
Val = "Tmp"+utostr(ResNo);
|
||||||
return ResNo;
|
return ResNo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user