mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
Implement many new type features including upreferences, proper retention
of structure contents, counts of packed and array types, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32847 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -50,7 +50,7 @@ int yyerror(const char *ErrorMsg) ;
|
|||||||
enum Types {
|
enum Types {
|
||||||
BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy,
|
BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy,
|
||||||
FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy,
|
FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy,
|
||||||
OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, NumericTy
|
OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, UpRefTy
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This type is used to keep track of the signedness of values. Instead
|
/// This type is used to keep track of the signedness of values. Instead
|
||||||
@@ -152,7 +152,7 @@ struct TypeInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isUnresolved() const { return oldTy == UnresolvedTy; }
|
bool isUnresolved() const { return oldTy == UnresolvedTy; }
|
||||||
bool isNumeric() const { return oldTy == NumericTy; }
|
bool isUpReference() const { return oldTy == UpRefTy; }
|
||||||
bool isVoid() const { return oldTy == VoidTy; }
|
bool isVoid() const { return oldTy == VoidTy; }
|
||||||
bool isBool() const { return oldTy == BoolTy; }
|
bool isBool() const { return oldTy == BoolTy; }
|
||||||
bool isSigned() const {
|
bool isSigned() const {
|
||||||
@@ -233,6 +233,17 @@ struct TypeInfo {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned getNumStructElements() const {
|
||||||
|
return (elements ? elements->size() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TypeInfo* getElement(unsigned idx) {
|
||||||
|
if (elements)
|
||||||
|
if (idx < elements->size())
|
||||||
|
return (*elements)[idx];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string* newTy;
|
std::string* newTy;
|
||||||
Types oldTy;
|
Types oldTy;
|
||||||
@@ -246,11 +257,11 @@ private:
|
|||||||
struct ConstInfo {
|
struct ConstInfo {
|
||||||
std::string *cnst;
|
std::string *cnst;
|
||||||
TypeInfo *type;
|
TypeInfo *type;
|
||||||
void destroy() { delete cnst; delete type; }
|
void destroy() { delete cnst; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ValueInfo> ValueList;
|
typedef std::vector<ValueInfo> ValueList;
|
||||||
|
|
||||||
inline void ValueInfo::destroy() { delete val; delete type; }
|
inline void ValueInfo::destroy() { delete val; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user