summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-01 04:04:35 +0000
committerChris Lattner <sabre@nondot.org>2004-08-01 04:04:35 +0000
commit803a5f6ecb1823280f80e3c4459aa58627d0484c (patch)
tree54bc6bcb65b69b76177ac145967ba91bbbbf8381
parent2082ebe8b3a5db302748828ab4f79a36d239c1d9 (diff)
downloadllvm-803a5f6ecb1823280f80e3c4459aa58627d0484c.tar.gz
llvm-803a5f6ecb1823280f80e3c4459aa58627d0484c.tar.bz2
llvm-803a5f6ecb1823280f80e3c4459aa58627d0484c.tar.xz
Rename CodeGenWrappers.(cpp|h) -> CodeGenTarget.(cpp|h)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15382 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/CodeGenTarget.cpp6
-rw-r--r--utils/TableGen/CodeGenTarget.h14
-rw-r--r--utils/TableGen/CodeGenWrappers.cpp99
-rw-r--r--utils/TableGen/CodeGenWrappers.h68
-rw-r--r--utils/TableGen/InstrInfoEmitter.cpp2
-rw-r--r--utils/TableGen/InstrSelectorEmitter.cpp1
-rw-r--r--utils/TableGen/InstrSelectorEmitter.h2
-rw-r--r--utils/TableGen/RegisterInfoEmitter.cpp2
8 files changed, 13 insertions, 181 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index fe4ad2634d..eef94db0b9 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -1,4 +1,4 @@
-//===- CodeGenWrappers.cpp - Code Generation Class Wrappers -----*- C++ -*-===//
+//===- CodeGenTarget.cpp - CodeGen Target Class Wrapper ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,14 @@
//
//===----------------------------------------------------------------------===//
//
-// These classes wrap target description classes used by the various code
+// This class wrap target description classes used by the various code
// generation TableGen backends. This makes it easier to access the data and
// provides a single place that needs to check it for validity. All of these
// classes throw exceptions on error conditions.
//
//===----------------------------------------------------------------------===//
-#include "CodeGenWrappers.h"
+#include "CodeGenTarget.h"
#include "Record.h"
using namespace llvm;
diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h
index 948360e2b1..aad277c516 100644
--- a/utils/TableGen/CodeGenTarget.h
+++ b/utils/TableGen/CodeGenTarget.h
@@ -1,4 +1,4 @@
-//===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===//
+//===- CodeGenTarget.h - Target Class Wrapper -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,15 +7,15 @@
//
//===----------------------------------------------------------------------===//
//
-// These classes wrap target description classes used by the various code
-// generation TableGen backends. This makes it easier to access the data and
-// provides a single place that needs to check it for validity. All of these
-// classes throw exceptions on error conditions.
+// This file defines wrappers for the Target class and related global
+// functionality. This makes it easier to access the data and provides a single
+// place that needs to check it for validity. All of these classes throw
+// exceptions on error conditions.
//
//===----------------------------------------------------------------------===//
-#ifndef CODEGENWRAPPERS_H
-#define CODEGENWRAPPERS_H
+#ifndef CODEGEN_TARGET_H
+#define CODEGEN_TARGET_H
#include "llvm/CodeGen/ValueTypes.h"
#include <iosfwd>
diff --git a/utils/TableGen/CodeGenWrappers.cpp b/utils/TableGen/CodeGenWrappers.cpp
deleted file mode 100644
index fe4ad2634d..0000000000
--- a/utils/TableGen/CodeGenWrappers.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-//===- CodeGenWrappers.cpp - Code Generation Class Wrappers -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These classes wrap target description classes used by the various code
-// generation TableGen backends. This makes it easier to access the data and
-// provides a single place that needs to check it for validity. All of these
-// classes throw exceptions on error conditions.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CodeGenWrappers.h"
-#include "Record.h"
-using namespace llvm;
-
-/// getValueType - Return the MCV::ValueType that the specified TableGen record
-/// corresponds to.
-MVT::ValueType llvm::getValueType(Record *Rec) {
- return (MVT::ValueType)Rec->getValueAsInt("Value");
-}
-
-std::string llvm::getName(MVT::ValueType T) {
- switch (T) {
- case MVT::Other: return "UNKNOWN";
- case MVT::i1: return "i1";
- case MVT::i8: return "i8";
- case MVT::i16: return "i16";
- case MVT::i32: return "i32";
- case MVT::i64: return "i64";
- case MVT::i128: return "i128";
- case MVT::f32: return "f32";
- case MVT::f64: return "f64";
- case MVT::f80: return "f80";
- case MVT::f128: return "f128";
- case MVT::isVoid:return "void";
- default: assert(0 && "ILLEGAL VALUE TYPE!"); return "";
- }
-}
-
-std::string llvm::getEnumName(MVT::ValueType T) {
- switch (T) {
- case MVT::Other: return "Other";
- case MVT::i1: return "i1";
- case MVT::i8: return "i8";
- case MVT::i16: return "i16";
- case MVT::i32: return "i32";
- case MVT::i64: return "i64";
- case MVT::i128: return "i128";
- case MVT::f32: return "f32";
- case MVT::f64: return "f64";
- case MVT::f80: return "f80";
- case MVT::f128: return "f128";
- case MVT::isVoid:return "isVoid";
- default: assert(0 && "ILLEGAL VALUE TYPE!"); return "";
- }
-}
-
-
-std::ostream &llvm::operator<<(std::ostream &OS, MVT::ValueType T) {
- return OS << getName(T);
-}
-
-
-/// getTarget - Return the current instance of the Target class.
-///
-CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) {
- std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target");
- if (Targets.size() == 0)
- throw std::string("ERROR: No 'Target' subclasses defined!");
- if (Targets.size() != 1)
- throw std::string("ERROR: Multiple subclasses of Target defined!");
- TargetRec = Targets[0];
-
- // Read in all of the CalleeSavedRegisters...
- ListInit *LI = TargetRec->getValueAsListInit("CalleeSavedRegisters");
- for (unsigned i = 0, e = LI->getSize(); i != e; ++i)
- if (DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i)))
- CalleeSavedRegisters.push_back(DI->getDef());
- else
- throw "Target: " + TargetRec->getName() +
- " expected register definition in CalleeSavedRegisters list!";
-
- PointerType = getValueType(TargetRec->getValueAsDef("PointerType"));
-}
-
-
-const std::string &CodeGenTarget::getName() const {
- return TargetRec->getName();
-}
-
-Record *CodeGenTarget::getInstructionSet() const {
- return TargetRec->getValueAsDef("InstructionSet");
-}
-
diff --git a/utils/TableGen/CodeGenWrappers.h b/utils/TableGen/CodeGenWrappers.h
deleted file mode 100644
index 948360e2b1..0000000000
--- a/utils/TableGen/CodeGenWrappers.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These classes wrap target description classes used by the various code
-// generation TableGen backends. This makes it easier to access the data and
-// provides a single place that needs to check it for validity. All of these
-// classes throw exceptions on error conditions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CODEGENWRAPPERS_H
-#define CODEGENWRAPPERS_H
-
-#include "llvm/CodeGen/ValueTypes.h"
-#include <iosfwd>
-#include <string>
-#include <vector>
-
-namespace llvm {
-
-class Record;
-class RecordKeeper;
-
-/// getValueType - Return the MVT::ValueType that the specified TableGen record
-/// corresponds to.
-MVT::ValueType getValueType(Record *Rec);
-
-std::ostream &operator<<(std::ostream &OS, MVT::ValueType T);
-std::string getName(MVT::ValueType T);
-std::string getEnumName(MVT::ValueType T);
-
-
-/// CodeGenTarget - This class corresponds to the Target class in the .td files.
-///
-class CodeGenTarget {
- Record *TargetRec;
- std::vector<Record*> CalleeSavedRegisters;
- MVT::ValueType PointerType;
-
-public:
- CodeGenTarget();
-
- Record *getTargetRecord() const { return TargetRec; }
- const std::string &getName() const;
-
- const std::vector<Record*> &getCalleeSavedRegisters() const {
- return CalleeSavedRegisters;
- }
-
- MVT::ValueType getPointerType() const { return PointerType; }
-
- // getInstructionSet - Return the InstructionSet object...
- Record *getInstructionSet() const;
-
- // getInstructionSet - Return the CodeGenInstructionSet object for this
- // target, lazily reading it from the record keeper as needed.
- // CodeGenInstructionSet *getInstructionSet -
-};
-
-} // End llvm namespace
-
-#endif
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp
index d2a3537099..a1c1984f3d 100644
--- a/utils/TableGen/InstrInfoEmitter.cpp
+++ b/utils/TableGen/InstrInfoEmitter.cpp
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "InstrInfoEmitter.h"
-#include "CodeGenWrappers.h"
+#include "CodeGenTarget.h"
#include "Record.h"
using namespace llvm;
diff --git a/utils/TableGen/InstrSelectorEmitter.cpp b/utils/TableGen/InstrSelectorEmitter.cpp
index d6f9c0a4de..5fb83c8755 100644
--- a/utils/TableGen/InstrSelectorEmitter.cpp
+++ b/utils/TableGen/InstrSelectorEmitter.cpp
@@ -13,7 +13,6 @@
//===----------------------------------------------------------------------===//
#include "InstrSelectorEmitter.h"
-#include "CodeGenWrappers.h"
#include "Record.h"
#include "Support/Debug.h"
#include "Support/StringExtras.h"
diff --git a/utils/TableGen/InstrSelectorEmitter.h b/utils/TableGen/InstrSelectorEmitter.h
index a0fbbcf408..156e7222b7 100644
--- a/utils/TableGen/InstrSelectorEmitter.h
+++ b/utils/TableGen/InstrSelectorEmitter.h
@@ -16,7 +16,7 @@
#define INSTRSELECTOR_EMITTER_H
#include "TableGenBackend.h"
-#include "CodeGenWrappers.h"
+#include "CodeGenTarget.h"
#include <vector>
#include <map>
#include <cassert>
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp
index 8fd0e16553..6dd2d7779f 100644
--- a/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/utils/TableGen/RegisterInfoEmitter.cpp
@@ -14,7 +14,7 @@
//===----------------------------------------------------------------------===//
#include "RegisterInfoEmitter.h"
-#include "CodeGenWrappers.h"
+#include "CodeGenTarget.h"
#include "Record.h"
#include "Support/StringExtras.h"
#include <set>