]> git.lizzy.rs Git - rust.git/commitdiff
[RISCV] Enable LLVM backend.
authorDavid Craven <david@craven.ch>
Tue, 24 Jul 2018 10:03:28 +0000 (12:03 +0200)
committerDavid Craven <david@craven.ch>
Wed, 1 Aug 2018 13:32:22 +0000 (15:32 +0200)
config.toml.example
src/librustc_llvm/build.rs
src/librustc_llvm/lib.rs
src/rustllvm/PassWrapper.cpp

index 99073416334f59ef7b02fcae69c7ac276c3084d3..cc40e96b316787ff8741ed23fe7a857f0a8adc3d 100644 (file)
@@ -62,7 +62,7 @@
 # not built by default and the experimental Rust compilation targets that depend
 # on them will not work unless the user opts in to building them. By default the
 # `WebAssembly` target is enabled when compiling LLVM from scratch.
-#experimental-targets = "WebAssembly"
+#experimental-targets = "WebAssembly;RISCV"
 
 # Cap the number of parallel linker invocations when compiling LLVM.
 # This can be useful when building LLVM with debug info, which significantly
index 5910e55def39690c3e6d5b6a19fedd97721d8010..4e24a26983d48754a9a84dd78cb2d1b083f18866 100644 (file)
@@ -100,6 +100,10 @@ fn main() {
         optional_components.push("hexagon");
     }
 
+    if major > 6 {
+        optional_components.push("riscv");
+    }
+
     // FIXME: surely we don't need all these components, right? Stuff like mcjit
     //        or interpreter the compiler itself never uses.
     let required_components = &["ipo",
index 05f6b5b5fbd289fc60c4f7cdf6408f7d7c16c4fa..ffa97bd6fa59d3a385d5738440a54d8527134871 100644 (file)
@@ -90,6 +90,12 @@ fn init() { }
                  LLVMInitializeMSP430Target,
                  LLVMInitializeMSP430TargetMC,
                  LLVMInitializeMSP430AsmPrinter);
+    init_target!(llvm_component = "riscv",
+                 LLVMInitializeRISCVTargetInfo,
+                 LLVMInitializeRISCVTarget,
+                 LLVMInitializeRISCVTargetMC,
+                 LLVMInitializeRISCVAsmPrinter,
+                 LLVMInitializeRISCVAsmParser);
     init_target!(llvm_component = "sparc",
                  LLVMInitializeSparcTargetInfo,
                  LLVMInitializeSparcTarget,
index a13e4ffa8f8295cc50da40d3c3fe3b0735c6128a..7305dc71cbf63fa5bd14fc2b8d6e7edb74e4b832 100644 (file)
@@ -171,6 +171,12 @@ bool LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
 #define SUBTARGET_MSP430
 #endif
 
+#ifdef LLVM_COMPONENT_RISCV
+#define SUBTARGET_RISCV SUBTARGET(RISCV)
+#else
+#define SUBTARGET_RISCV
+#endif
+
 #ifdef LLVM_COMPONENT_SPARC
 #define SUBTARGET_SPARC SUBTARGET(Sparc)
 #else
@@ -192,7 +198,8 @@ bool LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
   SUBTARGET_SYSTEMZ                                                            \
   SUBTARGET_MSP430                                                             \
   SUBTARGET_SPARC                                                              \
-  SUBTARGET_HEXAGON
+  SUBTARGET_HEXAGON                                                            \
+  SUBTARGET_RISCV                                                              \
 
 #define SUBTARGET(x)                                                           \
   namespace llvm {                                                             \