summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-03 19:34:31 +0000
committerChris Lattner <sabre@nondot.org>2004-10-03 19:34:31 +0000
commit91c538f2a1557efe4a0ea57111123b034fedb527 (patch)
treea137c10716488d0d10c3405f0d58fc5df7a63f5e /llvm/utils/TableGen/CodeGenTarget.cpp
parent42c43b2cb3407ab3383429ffa5712c486450ac48 (diff)
downloadbcm5719-llvm-91c538f2a1557efe4a0ea57111123b034fedb527.tar.gz
bcm5719-llvm-91c538f2a1557efe4a0ea57111123b034fedb527.zip
Add initial support for variants. This just parses the new format, no
functionality is added llvm-svn: 16636
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index f7225f081d0..4c882ad5557 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -16,8 +16,14 @@
#include "CodeGenTarget.h"
#include "Record.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CommandLine.h"
using namespace llvm;
+static cl::opt<unsigned>
+AsmWriterNum("asmwriternum", cl::init(0),
+ cl::desc("Make -gen-asm-writer emit assembly writer #N"));
+
/// getValueType - Return the MCV::ValueType that the specified TableGen record
/// corresponds to.
MVT::ValueType llvm::getValueType(Record *Rec) {
@@ -100,7 +106,12 @@ Record *CodeGenTarget::getInstructionSet() const {
/// getAsmWriter - Return the AssemblyWriter definition for this target.
///
Record *CodeGenTarget::getAsmWriter() const {
- return TargetRec->getValueAsDef("AssemblyWriter");
+ ListInit *LI = TargetRec->getValueAsListInit("AssemblyWriters");
+ if (AsmWriterNum >= LI->getSize())
+ throw "Target does not have an AsmWriter #" + utostr(AsmWriterNum) + "!";
+ DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(AsmWriterNum));
+ if (!DI) throw std::string("AssemblyWriter list should be a list of defs!");
+ return DI->getDef();
}
void CodeGenTarget::ReadRegisters() const {
OpenPOWER on IntegriCloud