Add ARM MC registry routines.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 6 Jul 2011 22:02:34 +0000 (22:02 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 6 Jul 2011 22:02:34 +0000 (22:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134547 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMBaseInfo.h
lib/Target/ARM/CMakeLists.txt
lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp [new file with mode: 0644]
lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h [new file with mode: 0644]
lib/Target/ARM/MCTargetDesc/CMakeLists.txt [new file with mode: 0644]
lib/Target/ARM/MCTargetDesc/Makefile [new file with mode: 0644]
lib/Target/ARM/Makefile

index 4c9ecdfdafe6eb7d526140fd2cac40712cb2245a..458f7dd1f784e4b1129e3cefe41245b60bbe3ed9 100644 (file)
 #ifndef ARMBASEINFO_H
 #define ARMBASEINFO_H
 
+#include "MCTargetDesc/ARMMCTargetDesc.h"
 #include "llvm/Support/ErrorHandling.h"
 
 // Note that the following auto-generated files only defined enum types, and
 // so are safe to include here.
 
-// Defines symbolic names for ARM registers.  This defines a mapping from
-// register name to register number.
-//
-#define GET_REGINFO_ENUM
-#include "ARMGenRegisterInfo.inc"
-
-// Defines symbolic names for the ARM instructions.
-//
-#define GET_INSTRINFO_ENUM
-#include "ARMGenInstrInfo.inc"
-
 namespace llvm {
 
 // Enums corresponding to ARM condition codes
index a261ca09bb2c1890369359ab184e2f064a5b2ba9..e3282bfd0ec373d8ac04f81c2747fc9076eeb019 100644 (file)
@@ -65,3 +65,4 @@ add_subdirectory(TargetInfo)
 add_subdirectory(AsmParser)
 add_subdirectory(Disassembler)
 add_subdirectory(InstPrinter)
+add_subdirectory(MCTargetDesc)
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
new file mode 100644 (file)
index 0000000..198c25d
--- /dev/null
@@ -0,0 +1,74 @@
+//===-- ARMMCTargetDesc.cpp - ARM Target Descriptions -----------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides ARM specific target descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ARMMCTargetDesc.h"
+#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Target/TargetRegistry.h"
+
+#define GET_REGINFO_MC_DESC
+#include "ARMGenRegisterInfo.inc"
+
+#define GET_INSTRINFO_MC_DESC
+#include "ARMGenInstrInfo.inc"
+
+#define GET_SUBTARGETINFO_MC_DESC
+#include "ARMGenSubtargetInfo.inc"
+
+using namespace llvm;
+
+MCInstrInfo *createARMMCInstrInfo() {
+  MCInstrInfo *X = new MCInstrInfo();
+  InitARMMCInstrInfo(X);
+  return X;
+}
+
+MCRegisterInfo *createARMMCRegisterInfo() {
+  MCRegisterInfo *X = new MCRegisterInfo();
+  InitARMMCRegisterInfo(X);
+  return X;
+}
+
+MCSubtargetInfo *createARMMCSubtargetInfo() {
+  MCSubtargetInfo *X = new MCSubtargetInfo();
+  InitARMMCSubtargetInfo(X);
+  return X;
+}
+
+// Force static initialization.
+extern "C" void LLVMInitializeARMMCInstrInfo() {
+  RegisterMCInstrInfo<MCInstrInfo> X(TheARMTarget);
+  RegisterMCInstrInfo<MCInstrInfo> Y(TheThumbTarget);
+
+  TargetRegistry::RegisterMCInstrInfo(TheARMTarget, createARMMCInstrInfo);
+  TargetRegistry::RegisterMCInstrInfo(TheThumbTarget, createARMMCInstrInfo);
+}
+
+extern "C" void LLVMInitializeARMMCRegInfo() {
+  RegisterMCRegInfo<MCRegisterInfo> X(TheARMTarget);
+  RegisterMCRegInfo<MCRegisterInfo> Y(TheThumbTarget);
+
+  TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo);
+  TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo);
+}
+
+extern "C" void LLVMInitializeARMMCSubtargetInfo() {
+  RegisterMCSubtargetInfo<MCSubtargetInfo> X(TheARMTarget);
+  RegisterMCSubtargetInfo<MCSubtargetInfo> Y(TheThumbTarget);
+
+  TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget,
+                                          createARMMCSubtargetInfo);
+  TargetRegistry::RegisterMCSubtargetInfo(TheThumbTarget,
+                                          createARMMCSubtargetInfo);
+}
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h
new file mode 100644 (file)
index 0000000..a486cff
--- /dev/null
@@ -0,0 +1,34 @@
+//===-- ARMMCTargetDesc.h - ARM Target Descriptions -------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides ARM specific target descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ARMMCTARGETDESC_H
+#define ARMMCTARGETDESC_H
+
+namespace llvm {
+class Target;
+
+extern Target TheARMTarget, TheThumbTarget;
+} // End llvm namespace
+
+// Defines symbolic names for ARM registers.  This defines a mapping from
+// register name to register number.
+//
+#define GET_REGINFO_ENUM
+#include "ARMGenRegisterInfo.inc"
+
+// Defines symbolic names for the ARM instructions.
+//
+#define GET_INSTRINFO_ENUM
+#include "ARMGenInstrInfo.inc"
+
+#endif
diff --git a/lib/Target/ARM/MCTargetDesc/CMakeLists.txt b/lib/Target/ARM/MCTargetDesc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9033817
--- /dev/null
@@ -0,0 +1,2 @@
+add_llvm_library(LLVMARMDesc ARMMCTargetDesc.cpp)
+
diff --git a/lib/Target/ARM/MCTargetDesc/Makefile b/lib/Target/ARM/MCTargetDesc/Makefile
new file mode 100644 (file)
index 0000000..448ed9d
--- /dev/null
@@ -0,0 +1,16 @@
+##===- lib/Target/ARM/TargetDesc/Makefile ------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../..
+LIBRARYNAME = LLVMARMDesc
+
+# Hack: we need to include 'main' target directory to grab private headers
+CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
+
+include $(LEVEL)/Makefile.common
index 51a8ac4119f5a13dc716c5152c4b127e3d4e6964..ff83e180923df810966386061cc971b08ec70be2 100644 (file)
@@ -19,6 +19,6 @@ BUILT_SOURCES = ARMGenRegisterInfo.inc ARMGenInstrInfo.inc \
                 ARMGenDecoderTables.inc ARMGenEDInfo.inc \
                 ARMGenFastISel.inc ARMGenMCCodeEmitter.inc
 
-DIRS = InstPrinter AsmParser Disassembler TargetInfo
+DIRS = InstPrinter AsmParser Disassembler TargetInfo MCTargetDesc
 
 include $(LEVEL)/Makefile.common