mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
I confused myself, temporaries will be recorded right along with other inputs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96639 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f0e7c87e56
commit
853b919d93
@ -21,35 +21,15 @@ namespace {
|
|||||||
/// matcher or it can be a temporary value created by the emitter for things
|
/// matcher or it can be a temporary value created by the emitter for things
|
||||||
/// like constants.
|
/// like constants.
|
||||||
class ResultVal {
|
class ResultVal {
|
||||||
unsigned Number : 30;
|
unsigned Number;
|
||||||
enum {
|
|
||||||
Recorded, Temporary
|
|
||||||
} Kind : 2; // True if temporary, false if recorded.
|
|
||||||
public:
|
public:
|
||||||
static ResultVal getRecorded(unsigned N) {
|
static ResultVal get(unsigned N) {
|
||||||
ResultVal R;
|
ResultVal R;
|
||||||
R.Number = N;
|
R.Number = N;
|
||||||
R.Kind = Recorded;
|
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ResultVal getTemp(unsigned N) {
|
unsigned getNumber() const {
|
||||||
ResultVal R;
|
|
||||||
R.Number = N;
|
|
||||||
R.Kind = Temporary;
|
|
||||||
return R;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isTemp() const { return Kind == Temporary; }
|
|
||||||
bool isRecorded() const { return Kind == Recorded; }
|
|
||||||
|
|
||||||
unsigned getTempNo() const {
|
|
||||||
assert(isTemp());
|
|
||||||
return Number;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned getRecordedNo() const {
|
|
||||||
assert(isRecorded());
|
|
||||||
return Number;
|
return Number;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -74,10 +54,6 @@ namespace {
|
|||||||
/// record into.
|
/// record into.
|
||||||
unsigned NextRecordedOperandNo;
|
unsigned NextRecordedOperandNo;
|
||||||
|
|
||||||
/// NextTemporary - As we generate code, this indicates the next temporary
|
|
||||||
/// ID that will be generated.
|
|
||||||
unsigned NextTemporary;
|
|
||||||
|
|
||||||
/// InputChains - This maintains the position in the recorded nodes array of
|
/// InputChains - This maintains the position in the recorded nodes array of
|
||||||
/// all of the recorded input chains.
|
/// all of the recorded input chains.
|
||||||
SmallVector<unsigned, 2> InputChains;
|
SmallVector<unsigned, 2> InputChains;
|
||||||
@ -123,7 +99,7 @@ namespace {
|
|||||||
|
|
||||||
MatcherGen::MatcherGen(const PatternToMatch &pattern,
|
MatcherGen::MatcherGen(const PatternToMatch &pattern,
|
||||||
const CodeGenDAGPatterns &cgp)
|
const CodeGenDAGPatterns &cgp)
|
||||||
: Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0), NextTemporary(0),
|
: Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0),
|
||||||
Matcher(0), CurPredicate(0) {
|
Matcher(0), CurPredicate(0) {
|
||||||
// We need to produce the matcher tree for the patterns source pattern. To do
|
// We need to produce the matcher tree for the patterns source pattern. To do
|
||||||
// this we need to match the structure as well as the types. To do the type
|
// this we need to match the structure as well as the types. To do the type
|
||||||
@ -449,7 +425,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N,
|
|||||||
|
|
||||||
if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
|
if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
|
||||||
AddMatcherNode(new EmitIntegerMatcherNode(II->getValue(),N->getTypeNum(0)));
|
AddMatcherNode(new EmitIntegerMatcherNode(II->getValue(),N->getTypeNum(0)));
|
||||||
ResultOps.push_back(ResultVal::getTemp(NextTemporary++));
|
ResultOps.push_back(ResultVal::get(NextRecordedOperandNo++));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,13 +434,13 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N,
|
|||||||
if (DI->getDef()->isSubClassOf("Register")) {
|
if (DI->getDef()->isSubClassOf("Register")) {
|
||||||
AddMatcherNode(new EmitRegisterMatcherNode(DI->getDef(),
|
AddMatcherNode(new EmitRegisterMatcherNode(DI->getDef(),
|
||||||
N->getTypeNum(0)));
|
N->getTypeNum(0)));
|
||||||
ResultOps.push_back(ResultVal::getTemp(NextTemporary++));
|
ResultOps.push_back(ResultVal::get(NextRecordedOperandNo++));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI->getDef()->getName() == "zero_reg") {
|
if (DI->getDef()->getName() == "zero_reg") {
|
||||||
AddMatcherNode(new EmitRegisterMatcherNode(0, N->getTypeNum(0)));
|
AddMatcherNode(new EmitRegisterMatcherNode(0, N->getTypeNum(0)));
|
||||||
ResultOps.push_back(ResultVal::getTemp(NextTemporary++));
|
ResultOps.push_back(ResultVal::get(NextRecordedOperandNo++));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user