diff options
author | Alex Bradbury <asb@lowrisc.org> | 2016-11-01 17:27:54 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2016-11-01 17:27:54 +0000 |
commit | b2e5472d854365ee26a24c7fe3ec6adfc2362ae4 (patch) | |
tree | 020082cb3297d3d7c41bc8b26742821f0cc607c3 /llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp | |
parent | 9677b602880c0202108686e6d2d4f2d1df36608d (diff) | |
download | bcm5719-llvm-b2e5472d854365ee26a24c7fe3ec6adfc2362ae4.tar.gz bcm5719-llvm-b2e5472d854365ee26a24c7fe3ec6adfc2362ae4.zip |
[RISCV] Add stub backend
This contains just enough for lib/Target/RISCV to compile. Notably a basic
RISCVTargetMachine and RISCVTargetInfo. At this point you can attempt llc
-march=riscv32 myinput.ll and will find it fails due to the lack of
MCAsmInfo.
See http://lists.llvm.org/pipermail/llvm-dev/2016-August/103748.html for
further discussion
Differential Revision: https://reviews.llvm.org/D23560
llvm-svn: 285712
Diffstat (limited to 'llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp b/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp new file mode 100644 index 00000000000..3cb657a9978 --- /dev/null +++ b/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp @@ -0,0 +1,35 @@ +//===-- RISCVTargetInfo.cpp - RISCV Target Implementation -----------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/TargetRegistry.h" +using namespace llvm; + +namespace llvm { +Target &getTheRISCV32Target() { + static Target TheRISCV32Target; + return TheRISCV32Target; +} + +Target &getTheRISCV64Target() { + static Target TheRISCV64Target; + return TheRISCV64Target; +} +} + +extern "C" void LLVMInitializeRISCVTargetInfo() { + RegisterTarget<Triple::riscv32> X(getTheRISCV32Target(), "riscv32", + "32-bit RISC-V"); + RegisterTarget<Triple::riscv64> Y(getTheRISCV64Target(), "riscv64", + "64-bit RISC-V"); +} + +// FIXME: Temporary stub - this function must be defined for linking +// to succeed and will be called unconditionally by llc, so must be a no-op. +// Remove once this function is properly implemented. +extern "C" void LLVMInitializeRISCVTargetMC() {} |