summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-04-05 19:54:44 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-04-05 19:54:44 +0000
commitbdc3b4d5230fcaace4101e6f4a664cd01828a46a (patch)
tree87db2f8fcbbaf4f27fa982346f6d73c9a2483fd2 /llvm/lib
parent16be4df94c1569ff3af32a50be935671f3ea962a (diff)
downloadbcm5719-llvm-bdc3b4d5230fcaace4101e6f4a664cd01828a46a.tar.gz
bcm5719-llvm-bdc3b4d5230fcaace4101e6f4a664cd01828a46a.zip
[GlobalISel] Add a class, RegisterBank, to represent register banks.
llvm-svn: 265445
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CMakeLists.txt1
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp39
2 files changed, 40 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
index bb6225f031a..162c8197e95 100644
--- a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
+++ b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
@@ -3,6 +3,7 @@ set(GLOBAL_ISEL_FILES
IRTranslator.cpp
MachineIRBuilder.cpp
RegBankSelect.cpp
+ RegisterBank.cpp
)
# Add GlobalISel files to the dependencies if the user wants to build it.
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
new file mode 100644
index 00000000000..5c86e426e1b
--- /dev/null
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
@@ -0,0 +1,39 @@
+//===- llvm/CodeGen/GlobalISel/RegisterBank.cpp - Register Bank --*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+/// This file implements the RegisterBank class.
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
+
+#include "llvm/Target/TargetRegisterInfo.h"
+
+#define DEBUG_TYPE "registerbank"
+
+using namespace llvm;
+
+void RegisterBank::verify(const TargetRegisterInfo &TRI) const {
+ // Verify that the Size of the register bank is big enough to cover all the
+ // register classes it covers.
+ // Verify that the register bank covers all the sub and super classes of the
+ // classes it covers.
+}
+
+bool RegisterBank::contains(const TargetRegisterClass &RC) const {
+ return ContainedRegClass.test(RC.getID());
+}
+
+bool RegisterBank::operator==(const RegisterBank &OtherRB) const {
+ // There must be only one instance of a given register bank alive
+ // for the whole compilation.
+ // The RegisterBankInfo is supposed to enforce that.
+ assert((OtherRB.getID() != getID() || &OtherRB == this) &&
+ "ID does not uniquely identify a RegisterBank");
+ return &OtherRB == this;
+}
OpenPOWER on IntegriCloud