mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-16 00:33:10 +00:00
Add comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
737ae6ea61
commit
07278e48dc
@ -48,6 +48,9 @@ inline std::ostream &operator<<(std::ostream &OS, const RecTy &Ty) {
|
|||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// BitRecTy - 'bit' - Represent a single bit
|
||||||
|
///
|
||||||
struct BitRecTy : public RecTy {
|
struct BitRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(BitInit *BI) { return (Init*)BI; }
|
Init *convertValue(BitInit *BI) { return (Init*)BI; }
|
||||||
@ -58,6 +61,9 @@ struct BitRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "bit"; }
|
void print(std::ostream &OS) const { OS << "bit"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// BitsRecTy - 'bits<n>' - Represent a fixed number of bits
|
||||||
|
///
|
||||||
class BitsRecTy : public RecTy {
|
class BitsRecTy : public RecTy {
|
||||||
unsigned Size;
|
unsigned Size;
|
||||||
public:
|
public:
|
||||||
@ -74,6 +80,9 @@ public:
|
|||||||
void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
|
void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// IntRecTy - 'int' - Represent an integer value of no particular size
|
||||||
|
///
|
||||||
struct IntRecTy : public RecTy {
|
struct IntRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(IntInit *II) { return (Init*)II; }
|
Init *convertValue(IntInit *II) { return (Init*)II; }
|
||||||
@ -83,6 +92,8 @@ struct IntRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "int"; }
|
void print(std::ostream &OS) const { OS << "int"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// StringRecTy - 'string' - Represent an string value
|
||||||
|
///
|
||||||
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; }
|
||||||
@ -90,6 +101,9 @@ struct StringRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "string"; }
|
void print(std::ostream &OS) const { OS << "string"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// ListRecTy - 'list<class>' - Represent a list defs, all of which must be
|
||||||
|
/// derived from the specified class.
|
||||||
|
///
|
||||||
class ListRecTy : public RecTy {
|
class ListRecTy : public RecTy {
|
||||||
Record *Class;
|
Record *Class;
|
||||||
public:
|
public:
|
||||||
@ -100,6 +114,9 @@ public:
|
|||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
|
||||||
|
/// (R32 X = EAX).
|
||||||
|
///
|
||||||
class RecordRecTy : public RecTy {
|
class RecordRecTy : public RecTy {
|
||||||
Record *Rec;
|
Record *Rec;
|
||||||
public:
|
public:
|
||||||
@ -111,6 +128,8 @@ public:
|
|||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Initializer Classes
|
// Initializer Classes
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -134,6 +153,9 @@ inline std::ostream &operator<<(std::ostream &OS, const Init &I) {
|
|||||||
I.print(OS); return OS;
|
I.print(OS); return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// UnsetInit - ? - Represents an uninitialized value
|
||||||
|
///
|
||||||
struct UnsetInit : public Init {
|
struct UnsetInit : public Init {
|
||||||
virtual Init *convertInitializerTo(RecTy *Ty) {
|
virtual Init *convertInitializerTo(RecTy *Ty) {
|
||||||
return Ty->convertValue(this);
|
return Ty->convertValue(this);
|
||||||
@ -143,6 +165,9 @@ struct UnsetInit : public Init {
|
|||||||
virtual void print(std::ostream &OS) const { OS << "?"; }
|
virtual void print(std::ostream &OS) const { OS << "?"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// BitInit - true/false - Represent a concrete initializer for a bit.
|
||||||
|
///
|
||||||
class BitInit : public Init {
|
class BitInit : public Init {
|
||||||
bool Value;
|
bool Value;
|
||||||
public:
|
public:
|
||||||
@ -158,6 +183,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
|
virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value.
|
||||||
|
/// It contains a vector of bits, whose size is determined by the type.
|
||||||
|
///
|
||||||
class BitsInit : public Init {
|
class BitsInit : public Init {
|
||||||
std::vector<Init*> Bits;
|
std::vector<Init*> Bits;
|
||||||
public:
|
public:
|
||||||
@ -195,6 +223,9 @@ public:
|
|||||||
bool printAsUnset(std::ostream &OS) const;
|
bool printAsUnset(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// IntInit - 7 - Represent an initalization by a literal integer value.
|
||||||
|
///
|
||||||
class IntInit : public Init {
|
class IntInit : public Init {
|
||||||
int Value;
|
int Value;
|
||||||
public:
|
public:
|
||||||
@ -211,6 +242,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << Value; }
|
virtual void print(std::ostream &OS) const { OS << Value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// StringInit - "foo" - Represent an initialization by a string value.
|
||||||
|
///
|
||||||
class StringInit : public Init {
|
class StringInit : public Init {
|
||||||
std::string Value;
|
std::string Value;
|
||||||
public:
|
public:
|
||||||
@ -224,6 +258,8 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
|
virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// ListInit - [AL, AH, CL] - Represent a list of defs
|
||||||
|
///
|
||||||
class ListInit : public Init {
|
class ListInit : public Init {
|
||||||
std::vector<Record*> Records;
|
std::vector<Record*> Records;
|
||||||
public:
|
public:
|
||||||
@ -245,6 +281,8 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// VarInit - 'Opcode' - Represent a reference to an entire variable object.
|
||||||
|
///
|
||||||
class VarInit : public Init {
|
class VarInit : public Init {
|
||||||
std::string VarName;
|
std::string VarName;
|
||||||
RecTy *Ty;
|
RecTy *Ty;
|
||||||
@ -264,6 +302,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << VarName; }
|
virtual void print(std::ostream &OS) const { OS << VarName; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// VarBitInit - Opcode{0} - Represent access to one bit of a variable
|
||||||
|
///
|
||||||
class VarBitInit : public Init {
|
class VarBitInit : public Init {
|
||||||
VarInit *VI;
|
VarInit *VI;
|
||||||
unsigned Bit;
|
unsigned Bit;
|
||||||
@ -284,6 +325,9 @@ public:
|
|||||||
virtual Init *resolveReferences(Record &R);
|
virtual Init *resolveReferences(Record &R);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// DefInit - AL - Represent a reference to a 'def' in the description
|
||||||
|
///
|
||||||
class DefInit : public Init {
|
class DefInit : public Init {
|
||||||
Record *Def;
|
Record *Def;
|
||||||
public:
|
public:
|
||||||
|
@ -48,6 +48,9 @@ inline std::ostream &operator<<(std::ostream &OS, const RecTy &Ty) {
|
|||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// BitRecTy - 'bit' - Represent a single bit
|
||||||
|
///
|
||||||
struct BitRecTy : public RecTy {
|
struct BitRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(BitInit *BI) { return (Init*)BI; }
|
Init *convertValue(BitInit *BI) { return (Init*)BI; }
|
||||||
@ -58,6 +61,9 @@ struct BitRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "bit"; }
|
void print(std::ostream &OS) const { OS << "bit"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// BitsRecTy - 'bits<n>' - Represent a fixed number of bits
|
||||||
|
///
|
||||||
class BitsRecTy : public RecTy {
|
class BitsRecTy : public RecTy {
|
||||||
unsigned Size;
|
unsigned Size;
|
||||||
public:
|
public:
|
||||||
@ -74,6 +80,9 @@ public:
|
|||||||
void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
|
void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// IntRecTy - 'int' - Represent an integer value of no particular size
|
||||||
|
///
|
||||||
struct IntRecTy : public RecTy {
|
struct IntRecTy : public RecTy {
|
||||||
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
|
||||||
Init *convertValue(IntInit *II) { return (Init*)II; }
|
Init *convertValue(IntInit *II) { return (Init*)II; }
|
||||||
@ -83,6 +92,8 @@ struct IntRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "int"; }
|
void print(std::ostream &OS) const { OS << "int"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// StringRecTy - 'string' - Represent an string value
|
||||||
|
///
|
||||||
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; }
|
||||||
@ -90,6 +101,9 @@ struct StringRecTy : public RecTy {
|
|||||||
void print(std::ostream &OS) const { OS << "string"; }
|
void print(std::ostream &OS) const { OS << "string"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// ListRecTy - 'list<class>' - Represent a list defs, all of which must be
|
||||||
|
/// derived from the specified class.
|
||||||
|
///
|
||||||
class ListRecTy : public RecTy {
|
class ListRecTy : public RecTy {
|
||||||
Record *Class;
|
Record *Class;
|
||||||
public:
|
public:
|
||||||
@ -100,6 +114,9 @@ public:
|
|||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
|
||||||
|
/// (R32 X = EAX).
|
||||||
|
///
|
||||||
class RecordRecTy : public RecTy {
|
class RecordRecTy : public RecTy {
|
||||||
Record *Rec;
|
Record *Rec;
|
||||||
public:
|
public:
|
||||||
@ -111,6 +128,8 @@ public:
|
|||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Initializer Classes
|
// Initializer Classes
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -134,6 +153,9 @@ inline std::ostream &operator<<(std::ostream &OS, const Init &I) {
|
|||||||
I.print(OS); return OS;
|
I.print(OS); return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// UnsetInit - ? - Represents an uninitialized value
|
||||||
|
///
|
||||||
struct UnsetInit : public Init {
|
struct UnsetInit : public Init {
|
||||||
virtual Init *convertInitializerTo(RecTy *Ty) {
|
virtual Init *convertInitializerTo(RecTy *Ty) {
|
||||||
return Ty->convertValue(this);
|
return Ty->convertValue(this);
|
||||||
@ -143,6 +165,9 @@ struct UnsetInit : public Init {
|
|||||||
virtual void print(std::ostream &OS) const { OS << "?"; }
|
virtual void print(std::ostream &OS) const { OS << "?"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// BitInit - true/false - Represent a concrete initializer for a bit.
|
||||||
|
///
|
||||||
class BitInit : public Init {
|
class BitInit : public Init {
|
||||||
bool Value;
|
bool Value;
|
||||||
public:
|
public:
|
||||||
@ -158,6 +183,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
|
virtual void print(std::ostream &OS) const { OS << (Value ? "1" : "0"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value.
|
||||||
|
/// It contains a vector of bits, whose size is determined by the type.
|
||||||
|
///
|
||||||
class BitsInit : public Init {
|
class BitsInit : public Init {
|
||||||
std::vector<Init*> Bits;
|
std::vector<Init*> Bits;
|
||||||
public:
|
public:
|
||||||
@ -195,6 +223,9 @@ public:
|
|||||||
bool printAsUnset(std::ostream &OS) const;
|
bool printAsUnset(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// IntInit - 7 - Represent an initalization by a literal integer value.
|
||||||
|
///
|
||||||
class IntInit : public Init {
|
class IntInit : public Init {
|
||||||
int Value;
|
int Value;
|
||||||
public:
|
public:
|
||||||
@ -211,6 +242,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << Value; }
|
virtual void print(std::ostream &OS) const { OS << Value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// StringInit - "foo" - Represent an initialization by a string value.
|
||||||
|
///
|
||||||
class StringInit : public Init {
|
class StringInit : public Init {
|
||||||
std::string Value;
|
std::string Value;
|
||||||
public:
|
public:
|
||||||
@ -224,6 +258,8 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
|
virtual void print(std::ostream &OS) const { OS << "\"" << Value << "\""; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// ListInit - [AL, AH, CL] - Represent a list of defs
|
||||||
|
///
|
||||||
class ListInit : public Init {
|
class ListInit : public Init {
|
||||||
std::vector<Record*> Records;
|
std::vector<Record*> Records;
|
||||||
public:
|
public:
|
||||||
@ -245,6 +281,8 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(std::ostream &OS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// VarInit - 'Opcode' - Represent a reference to an entire variable object.
|
||||||
|
///
|
||||||
class VarInit : public Init {
|
class VarInit : public Init {
|
||||||
std::string VarName;
|
std::string VarName;
|
||||||
RecTy *Ty;
|
RecTy *Ty;
|
||||||
@ -264,6 +302,9 @@ public:
|
|||||||
virtual void print(std::ostream &OS) const { OS << VarName; }
|
virtual void print(std::ostream &OS) const { OS << VarName; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// VarBitInit - Opcode{0} - Represent access to one bit of a variable
|
||||||
|
///
|
||||||
class VarBitInit : public Init {
|
class VarBitInit : public Init {
|
||||||
VarInit *VI;
|
VarInit *VI;
|
||||||
unsigned Bit;
|
unsigned Bit;
|
||||||
@ -284,6 +325,9 @@ public:
|
|||||||
virtual Init *resolveReferences(Record &R);
|
virtual Init *resolveReferences(Record &R);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// DefInit - AL - Represent a reference to a 'def' in the description
|
||||||
|
///
|
||||||
class DefInit : public Init {
|
class DefInit : public Init {
|
||||||
Record *Def;
|
Record *Def;
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user