Add ARM MC registry routines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2011-07-06 22:02:34 +00:00
parent ed5e355214
commit 78a9f138ae
7 changed files with 129 additions and 12 deletions

View File

@ -17,22 +17,12 @@
#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

View File

@ -65,3 +65,4 @@ add_subdirectory(TargetInfo)
add_subdirectory(AsmParser)
add_subdirectory(Disassembler)
add_subdirectory(InstPrinter)
add_subdirectory(MCTargetDesc)

View File

@ -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);
}

View File

@ -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

View File

@ -0,0 +1,2 @@
add_llvm_library(LLVMARMDesc ARMMCTargetDesc.cpp)

View File

@ -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

View 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