summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-20 22:25:16 +0000
committerChris Lattner <sabre@nondot.org>2007-11-20 22:25:16 +0000
commit99ba1f7b8deaf2a296c98600dbf593754cbd43a2 (patch)
treed93a3ae5a1e56e32ef88b41e93e0b9aa2c1172d9 /utils/TableGen/Record.cpp
parent5e41f6569918a6e001cadf8dea96819686cf301c (diff)
downloadllvm-99ba1f7b8deaf2a296c98600dbf593754cbd43a2.tar.gz
llvm-99ba1f7b8deaf2a296c98600dbf593754cbd43a2.tar.bz2
llvm-99ba1f7b8deaf2a296c98600dbf593754cbd43a2.tar.xz
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
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 4cba8891c3..d7eb98a72e 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -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();