mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Allow passing lists through variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9b929aa749
commit
f1b36f9a71
@ -116,6 +116,14 @@ Init *ListRecTy::convertValue(ListInit *LI) {
|
|||||||
return LI;
|
return LI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Init *ListRecTy::convertValue(TypedInit *TI) {
|
||||||
|
// Ensure that TI is compatible with our class.
|
||||||
|
if (ListRecTy *LRT = dynamic_cast<ListRecTy*>(TI->getType()))
|
||||||
|
if (LRT->getElementClass() == getElementClass())
|
||||||
|
return TI;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void RecordRecTy::print(std::ostream &OS) const {
|
void RecordRecTy::print(std::ostream &OS) const {
|
||||||
OS << Rec->getName();
|
OS << Rec->getName();
|
||||||
}
|
}
|
||||||
@ -127,12 +135,12 @@ Init *RecordRecTy::convertValue(DefInit *DI) {
|
|||||||
return DI;
|
return DI;
|
||||||
}
|
}
|
||||||
|
|
||||||
Init *RecordRecTy::convertValue(TypedInit *VI) {
|
Init *RecordRecTy::convertValue(TypedInit *TI) {
|
||||||
// Ensure that VI is compatible with Rec.
|
// Ensure that TI is compatible with Rec.
|
||||||
if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(VI->getType()))
|
if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(TI->getType()))
|
||||||
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
|
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
|
||||||
RRT->getRecord() == getRecord())
|
RRT->getRecord() == getRecord())
|
||||||
return VI;
|
return TI;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ struct IntRecTy : public RecTy {
|
|||||||
struct StringRecTy : public RecTy {
|
struct StringRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(StringInit *SI) { return (Init*)SI; }
|
Init *convertValue(StringInit *SI) { return (Init*)SI; }
|
||||||
Init *convertValue(TypedInit *VI);
|
Init *convertValue(TypedInit *TI);
|
||||||
void print(std::ostream &OS) const { OS << "string"; }
|
void print(std::ostream &OS) const { OS << "string"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,8 +119,14 @@ class ListRecTy : public RecTy {
|
|||||||
Record *Class;
|
Record *Class;
|
||||||
public:
|
public:
|
||||||
ListRecTy(Record *C) : Class(C) {}
|
ListRecTy(Record *C) : Class(C) {}
|
||||||
|
|
||||||
|
/// getElementClass - Return the class that the list contains.
|
||||||
|
///
|
||||||
|
Record *getElementClass() const { return Class; }
|
||||||
|
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(ListInit *LI);
|
Init *convertValue(ListInit *LI);
|
||||||
|
Init *convertValue(TypedInit *TI);
|
||||||
|
|
||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
@ -116,6 +116,14 @@ Init *ListRecTy::convertValue(ListInit *LI) {
|
|||||||
return LI;
|
return LI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Init *ListRecTy::convertValue(TypedInit *TI) {
|
||||||
|
// Ensure that TI is compatible with our class.
|
||||||
|
if (ListRecTy *LRT = dynamic_cast<ListRecTy*>(TI->getType()))
|
||||||
|
if (LRT->getElementClass() == getElementClass())
|
||||||
|
return TI;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void RecordRecTy::print(std::ostream &OS) const {
|
void RecordRecTy::print(std::ostream &OS) const {
|
||||||
OS << Rec->getName();
|
OS << Rec->getName();
|
||||||
}
|
}
|
||||||
@ -127,12 +135,12 @@ Init *RecordRecTy::convertValue(DefInit *DI) {
|
|||||||
return DI;
|
return DI;
|
||||||
}
|
}
|
||||||
|
|
||||||
Init *RecordRecTy::convertValue(TypedInit *VI) {
|
Init *RecordRecTy::convertValue(TypedInit *TI) {
|
||||||
// Ensure that VI is compatible with Rec.
|
// Ensure that TI is compatible with Rec.
|
||||||
if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(VI->getType()))
|
if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(TI->getType()))
|
||||||
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
|
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
|
||||||
RRT->getRecord() == getRecord())
|
RRT->getRecord() == getRecord())
|
||||||
return VI;
|
return TI;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ struct IntRecTy : public RecTy {
|
|||||||
struct StringRecTy : public RecTy {
|
struct StringRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(StringInit *SI) { return (Init*)SI; }
|
Init *convertValue(StringInit *SI) { return (Init*)SI; }
|
||||||
Init *convertValue(TypedInit *VI);
|
Init *convertValue(TypedInit *TI);
|
||||||
void print(std::ostream &OS) const { OS << "string"; }
|
void print(std::ostream &OS) const { OS << "string"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,8 +119,14 @@ class ListRecTy : public RecTy {
|
|||||||
Record *Class;
|
Record *Class;
|
||||||
public:
|
public:
|
||||||
ListRecTy(Record *C) : Class(C) {}
|
ListRecTy(Record *C) : Class(C) {}
|
||||||
|
|
||||||
|
/// getElementClass - Return the class that the list contains.
|
||||||
|
///
|
||||||
|
Record *getElementClass() const { return Class; }
|
||||||
|
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(ListInit *LI);
|
Init *convertValue(ListInit *LI);
|
||||||
|
Init *convertValue(TypedInit *TI);
|
||||||
|
|
||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user