mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Add the ability to convert a tblgen type to a string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5e41f65699
commit
99ba1f7b8d
@ -14,6 +14,7 @@
|
||||
#include "Record.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <ios>
|
||||
|
||||
using namespace llvm;
|
||||
@ -46,6 +47,10 @@ Init *BitRecTy::convertValue(TypedInit *VI) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string BitsRecTy::getAsString() const {
|
||||
return "bits<" + utostr(Size) + ">";
|
||||
}
|
||||
|
||||
Init *BitsRecTy::convertValue(UnsetInit *UI) {
|
||||
BitsInit *Ret = new BitsInit(Size);
|
||||
|
||||
@ -146,6 +151,10 @@ Init *StringRecTy::convertValue(TypedInit *TI) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string ListRecTy::getAsString() const {
|
||||
return "list<" + Ty->getAsString() + ">";
|
||||
}
|
||||
|
||||
void ListRecTy::print(std::ostream &OS) const {
|
||||
OS << "list<" << *Ty << ">";
|
||||
}
|
||||
@ -196,6 +205,9 @@ Init *DagRecTy::convertValue(BinOpInit *BO) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string RecordRecTy::getAsString() const {
|
||||
return Rec->getName();
|
||||
}
|
||||
|
||||
void RecordRecTy::print(std::ostream &OS) const {
|
||||
OS << Rec->getName();
|
||||
|
@ -62,6 +62,7 @@ class RecordVal;
|
||||
struct RecTy {
|
||||
virtual ~RecTy() {}
|
||||
|
||||
virtual std::string getAsString() const = 0;
|
||||
virtual void print(std::ostream &OS) const = 0;
|
||||
void dump() const;
|
||||
|
||||
@ -127,6 +128,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
std::string getAsString() const { return "bit"; }
|
||||
void print(std::ostream &OS) const { OS << "bit"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -169,7 +171,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
|
||||
std::string getAsString() const;
|
||||
void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -208,7 +210,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
|
||||
std::string getAsString() const { return "int"; }
|
||||
void print(std::ostream &OS) const { OS << "int"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -245,6 +247,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
std::string getAsString() const { return "string"; }
|
||||
void print(std::ostream &OS) const { OS << "string"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -288,6 +291,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
std::string getAsString() const;
|
||||
void print(std::ostream &OS) const;
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -325,7 +329,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
|
||||
std::string getAsString() const { return "code"; }
|
||||
void print(std::ostream &OS) const { OS << "code"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -360,6 +364,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
std::string getAsString() const { return "dag"; }
|
||||
void print(std::ostream &OS) const { OS << "dag"; }
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
@ -402,6 +407,7 @@ public:
|
||||
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
|
||||
virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
|
||||
|
||||
std::string getAsString() const;
|
||||
void print(std::ostream &OS) const;
|
||||
|
||||
bool typeIsConvertibleTo(const RecTy *RHS) const {
|
||||
|
Loading…
Reference in New Issue
Block a user