mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Add MCTargetDesc library to Hexagon target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
60d99a5278
commit
d239ff67f2
@ -31,3 +31,5 @@ add_llvm_target(HexagonCodeGen
|
||||
)
|
||||
|
||||
add_subdirectory(TargetInfo)
|
||||
add_subdirectory(MCTargetDesc)
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define TARGET_Hexagon_H
|
||||
|
||||
#include <cassert>
|
||||
#include "MCTargetDesc/HexagonMCTargetDesc.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
|
||||
namespace llvm {
|
||||
@ -37,23 +38,8 @@ namespace llvm {
|
||||
FunctionPass *createHexagonOptimizeSZExtends();
|
||||
FunctionPass *createHexagonFixupHwLoops();
|
||||
|
||||
extern Target TheHexagonTarget;
|
||||
|
||||
} // end namespace llvm;
|
||||
|
||||
// Defines symbolic names for Hexagon instructions and registers.
|
||||
// This defines a mapping from register name to register number.
|
||||
//
|
||||
|
||||
#define GET_REGINFO_ENUM
|
||||
#include "HexagonGenRegisterInfo.inc"
|
||||
|
||||
#define GET_INSTRINFO_ENUM
|
||||
#include "HexagonGenInstrInfo.inc"
|
||||
|
||||
#define GET_SUBTARGETINFO_ENUM
|
||||
#include "HexagonGenSubtargetInfo.inc"
|
||||
|
||||
#define Hexagon_POINTER_SIZE 4
|
||||
|
||||
#define Hexagon_PointerSize (Hexagon_POINTER_SIZE)
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#define GET_INSTRINFO_MC_DESC
|
||||
#define GET_INSTRINFO_CTOR
|
||||
#include "HexagonGenInstrInfo.inc"
|
||||
|
||||
|
@ -319,4 +319,5 @@ unsigned HexagonRegisterInfo::getEHHandlerRegister() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GET_REGINFO_TARGET_DESC
|
||||
#include "HexagonGenRegisterInfo.inc"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
using namespace llvm;
|
||||
|
||||
#define GET_SUBTARGETINFO_MC_DESC
|
||||
#define GET_SUBTARGETINFO_CTOR
|
||||
#define GET_SUBTARGETINFO_TARGET_DESC
|
||||
#include "HexagonGenSubtargetInfo.inc"
|
||||
|
@ -10,7 +10,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "HexagonMCAsmInfo.h"
|
||||
#include "HexagonTargetMachine.h"
|
||||
#include "Hexagon.h"
|
||||
#include "HexagonISelLowering.h"
|
||||
@ -23,12 +22,6 @@
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include <iostream>
|
||||
|
||||
#define GET_REGINFO_MC_DESC
|
||||
#define GET_REGINFO_TARGET_DESC
|
||||
#include "HexagonGenRegisterInfo.inc"
|
||||
|
||||
extern "C" void LLVMInitializeHexagonTargetMC() {}
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static cl::
|
||||
@ -47,9 +40,6 @@ int HexagonTargetMachineModule = 0;
|
||||
extern "C" void LLVMInitializeHexagonTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<HexagonTargetMachine> X(TheHexagonTarget);
|
||||
|
||||
// Register the target asm info.
|
||||
RegisterMCAsmInfo<HexagonMCAsmInfo> A(TheHexagonTarget);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = TargetInfo
|
||||
subdirectories = TargetInfo MCTargetDesc
|
||||
|
||||
[component_0]
|
||||
type = TargetGroup
|
||||
@ -28,5 +28,5 @@ has_asmprinter = 1
|
||||
type = Library
|
||||
name = HexagonCodeGen
|
||||
parent = Hexagon
|
||||
required_libraries = AsmPrinter CodeGen Core HexagonInfo SelectionDAG Support Target MC
|
||||
required_libraries = AsmPrinter CodeGen Core HexagonInfo SelectionDAG Support Target MC HexagonDesc
|
||||
add_to_library_groups = Hexagon
|
||||
|
6
lib/Target/Hexagon/MCTargetDesc/CMakeLists.txt
Normal file
6
lib/Target/Hexagon/MCTargetDesc/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_llvm_library(LLVMHexagonDesc
|
||||
HexagonMCTargetDesc.cpp
|
||||
HexagonMCAsmInfo.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMHexagonDesc HexagonCommonTableGen)
|
94
lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
Normal file
94
lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
//===-- HexagonMCTargetDesc.cpp - Cell Hexagon 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 Cell Hexagon specific target descriptions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "HexagonMCTargetDesc.h"
|
||||
#include "HexagonMCAsmInfo.h"
|
||||
#include "llvm/MC/MachineLocation.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
|
||||
#define GET_INSTRINFO_MC_DESC
|
||||
#include "HexagonGenInstrInfo.inc"
|
||||
|
||||
#define GET_SUBTARGETINFO_MC_DESC
|
||||
#include "HexagonGenSubtargetInfo.inc"
|
||||
|
||||
#define GET_REGINFO_MC_DESC
|
||||
#include "HexagonGenRegisterInfo.inc"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static MCInstrInfo *createHexagonMCInstrInfo() {
|
||||
MCInstrInfo *X = new MCInstrInfo();
|
||||
InitHexagonMCInstrInfo(X);
|
||||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createHexagonMCRegisterInfo(StringRef TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitHexagonMCRegisterInfo(X, Hexagon::R0);
|
||||
return X;
|
||||
}
|
||||
|
||||
static MCSubtargetInfo *createHexagonMCSubtargetInfo(StringRef TT,
|
||||
StringRef CPU,
|
||||
StringRef FS) {
|
||||
MCSubtargetInfo *X = new MCSubtargetInfo();
|
||||
InitHexagonMCSubtargetInfo(X, TT, CPU, FS);
|
||||
return X;
|
||||
}
|
||||
|
||||
static MCAsmInfo *createHexagonMCAsmInfo(const Target &T, StringRef TT) {
|
||||
MCAsmInfo *MAI = new HexagonMCAsmInfo(T, TT);
|
||||
|
||||
// VirtualFP = (R30 + #0).
|
||||
MachineLocation Dst(MachineLocation::VirtualFP);
|
||||
MachineLocation Src(Hexagon::R30, 0);
|
||||
MAI->addInitialFrameState(0, Dst, Src);
|
||||
|
||||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createHexagonMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
// For the time being, use static relocations, since there's really no
|
||||
// support for PIC yet.
|
||||
X->InitMCCodeGenInfo(Reloc::Static, CM, OL);
|
||||
return X;
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeHexagonTargetMC() {
|
||||
// Register the MC asm info.
|
||||
RegisterMCAsmInfoFn X(TheHexagonTarget, createHexagonMCAsmInfo);
|
||||
|
||||
// Register the MC codegen info.
|
||||
TargetRegistry::RegisterMCCodeGenInfo(TheHexagonTarget,
|
||||
createHexagonMCCodeGenInfo);
|
||||
|
||||
// Register the MC instruction info.
|
||||
TargetRegistry::RegisterMCInstrInfo(TheHexagonTarget, createHexagonMCInstrInfo);
|
||||
|
||||
// Register the MC register info.
|
||||
TargetRegistry::RegisterMCRegInfo(TheHexagonTarget,
|
||||
createHexagonMCRegisterInfo);
|
||||
|
||||
// Register the MC subtarget info.
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheHexagonTarget,
|
||||
createHexagonMCSubtargetInfo);
|
||||
}
|
40
lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
Normal file
40
lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
Normal file
@ -0,0 +1,40 @@
|
||||
//===-- SPUMCTargetDesc.h - Hexagon 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 Hexagon specific target descriptions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SPUMCTARGETDESC_H
|
||||
#define SPUMCTARGETDESC_H
|
||||
|
||||
namespace llvm {
|
||||
class MCSubtargetInfo;
|
||||
class Target;
|
||||
class StringRef;
|
||||
|
||||
extern Target TheHexagonTarget;
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
// Define symbolic names for Hexagon registers. This defines a mapping from
|
||||
// register name to register number.
|
||||
//
|
||||
#define GET_REGINFO_ENUM
|
||||
#include "HexagonGenRegisterInfo.inc"
|
||||
|
||||
// Defines symbolic names for the Hexagon instructions.
|
||||
//
|
||||
#define GET_INSTRINFO_ENUM
|
||||
#include "HexagonGenInstrInfo.inc"
|
||||
|
||||
#define GET_SUBTARGETINFO_ENUM
|
||||
#include "HexagonGenSubtargetInfo.inc"
|
||||
|
||||
#endif
|
23
lib/Target/Hexagon/MCTargetDesc/LLVMBuild.txt
Normal file
23
lib/Target/Hexagon/MCTargetDesc/LLVMBuild.txt
Normal file
@ -0,0 +1,23 @@
|
||||
;===- ./lib/Target/CellSPU/MCTargetDesc/LLVMBuild.txt ----------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = HexagonDesc
|
||||
parent = Hexagon
|
||||
required_libraries = HexagonInfo MC
|
||||
add_to_library_groups = Hexagon
|
16
lib/Target/Hexagon/MCTargetDesc/Makefile
Normal file
16
lib/Target/Hexagon/MCTargetDesc/Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
##===- lib/Target/CellSPU/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 = LLVMHexagonDesc
|
||||
|
||||
# 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
|
@ -18,6 +18,6 @@ BUILT_SOURCES = HexagonGenRegisterInfo.inc \
|
||||
HexagonGenCallingConv.inc \
|
||||
HexagonAsmPrinter.cpp
|
||||
|
||||
DIRS = TargetInfo
|
||||
DIRS = TargetInfo MCTargetDesc
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
Loading…
x
Reference in New Issue
Block a user