mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
* Move BitsInit::resolveReferences up with the rest of BitsInit code
* Initial support for field expressions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4849 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a1651900e1
commit
28520c4b61
@ -206,6 +206,26 @@ bool BitsInit::printAsUnset(std::ostream &OS) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Init *BitsInit::resolveReferences(Record &R) {
|
||||
bool Changed = false;
|
||||
BitsInit *New = new BitsInit(getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
return New;
|
||||
delete New;
|
||||
return this;
|
||||
}
|
||||
|
||||
Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
||||
BitsInit *BI = new BitsInit(Bits.size());
|
||||
|
||||
@ -244,28 +264,14 @@ Init *VarInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
||||
return BI;
|
||||
}
|
||||
|
||||
Init *BitsInit::resolveReferences(Record &R) {
|
||||
bool Changed = false;
|
||||
BitsInit *New = new BitsInit(getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
return New;
|
||||
delete New;
|
||||
return this;
|
||||
RecTy *VarInit::getFieldType(const std::string &FieldName) const {
|
||||
if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(Ty))
|
||||
if (const RecordVal *RV = RTy->getRecord()->getValue(FieldName))
|
||||
return RV->getType();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Init *VarBitInit::resolveReferences(Record &R) {
|
||||
if (R.isTemplateArg(getVariable()->getName()))
|
||||
return this;
|
||||
|
@ -206,6 +206,26 @@ bool BitsInit::printAsUnset(std::ostream &OS) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Init *BitsInit::resolveReferences(Record &R) {
|
||||
bool Changed = false;
|
||||
BitsInit *New = new BitsInit(getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
return New;
|
||||
delete New;
|
||||
return this;
|
||||
}
|
||||
|
||||
Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
||||
BitsInit *BI = new BitsInit(Bits.size());
|
||||
|
||||
@ -244,28 +264,14 @@ Init *VarInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
||||
return BI;
|
||||
}
|
||||
|
||||
Init *BitsInit::resolveReferences(Record &R) {
|
||||
bool Changed = false;
|
||||
BitsInit *New = new BitsInit(getNumBits());
|
||||
|
||||
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
|
||||
Init *B;
|
||||
New->setBit(i, getBit(i));
|
||||
do {
|
||||
B = New->getBit(i);
|
||||
New->setBit(i, B->resolveReferences(R));
|
||||
Changed |= B != New->getBit(i);
|
||||
} while (B != New->getBit(i));
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
return New;
|
||||
delete New;
|
||||
return this;
|
||||
RecTy *VarInit::getFieldType(const std::string &FieldName) const {
|
||||
if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(Ty))
|
||||
if (const RecordVal *RV = RTy->getRecord()->getValue(FieldName))
|
||||
return RV->getType();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Init *VarBitInit::resolveReferences(Record &R) {
|
||||
if (R.isTemplateArg(getVariable()->getName()))
|
||||
return this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user