summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h52
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CMakeLists.txt1
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp28
3 files changed, 81 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
new file mode 100644
index 00000000000..8eaf2fa7384
--- /dev/null
+++ b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
@@ -0,0 +1,52 @@
+//==-- llvm/CodeGen/GlobalISel/RegisterBankInfo.h ----------------*- 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 declares the API for the register bank info.
+/// This API is responsible for handling the register banks.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_GLOBALISEL_REGBANKINFO_H
+#define LLVM_CODEGEN_GLOBALISEL_REGBANKINFO_H
+
+#include <memory>
+
+namespace llvm {
+class RegisterBank;
+class TargetRegisterInfo;
+
+/// Holds all the information related to register banks.
+class RegisterBankInfo {
+protected:
+ std::unique_ptr<RegisterBank[]> RegBanks;
+ unsigned NbOfRegBanks;
+
+ RegisterBankInfo(unsigned NbOfRegBanks);
+
+ virtual ~RegisterBankInfo();
+
+public:
+ /// Get the register bank identified by \p ID.
+ const RegisterBank &getRegBank(unsigned ID) const {
+ assert(ID < NbOfRegBanks && "Accessing an unknown register bank");
+ return RegBanks[ID];
+ }
+
+ /// Get the cost of a copy from \p B to \p A, or put differently,
+ /// get the cost of A = COPY B.
+ virtual unsigned copyCost(const RegisterBank &A,
+ const RegisterBank &B) const {
+ return 0;
+ }
+
+ void verify(const TargetRegisterInfo &TRI) const;
+};
+} // End namespace llvm.
+
+#endif
diff --git a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
index 162c8197e95..e3e81ae5c4b 100644
--- a/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
+++ b/llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
@@ -4,6 +4,7 @@ set(GLOBAL_ISEL_FILES
MachineIRBuilder.cpp
RegBankSelect.cpp
RegisterBank.cpp
+ RegisterBankInfo.cpp
)
# Add GlobalISel files to the dependencies if the user wants to build it.
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
new file mode 100644
index 00000000000..1d98c993c81
--- /dev/null
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
@@ -0,0 +1,28 @@
+//===- llvm/CodeGen/GlobalISel/RegisterBankInfo.cpp --------------*- 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 RegisterBankInfo class.
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
+#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
+#include "llvm/Target/TargetRegisterInfo.h"
+
+#define DEBUG_TYPE "registerbankinfo"
+
+using namespace llvm;
+
+RegisterBankInfo::RegisterBankInfo(unsigned NbOfRegBanks)
+ : NbOfRegBanks(NbOfRegBanks) {
+ RegBanks.reset(new RegisterBank[NbOfRegBanks]);
+}
+
+RegisterBankInfo::~RegisterBankInfo() {}
+
+void RegisterBankInfo::verify(const TargetRegisterInfo &TRI) const {}
OpenPOWER on IntegriCloud