[llvm] de5198b - [JITLink][RISCV] Expose relaxation pass publicly

Job Noorman via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 00:44:54 PDT 2023


Author: Job Noorman
Date: 2023-06-26T09:41:20+02:00
New Revision: de5198b00dd7d4df2d30dcae5f9bd4ebc85f5d17

URL: https://github.com/llvm/llvm-project/commit/de5198b00dd7d4df2d30dcae5f9bd4ebc85f5d17
DIFF: https://github.com/llvm/llvm-project/commit/de5198b00dd7d4df2d30dcae5f9bd4ebc85f5d17.diff

LOG: [JITLink][RISCV] Expose relaxation pass publicly

This is useful for contexts where shouldAddDefaultTargetPasses returns
false but that still want to perform relaxation.

Reviewed By: StephenFan

Differential Revision: https://reviews.llvm.org/D153538

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
    llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
index 5a8b186a2c3e6..590ccbf571722 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
@@ -32,6 +32,10 @@ createLinkGraphFromELFObject_riscv(MemoryBufferRef ObjectBuffer);
 void link_ELF_riscv(std::unique_ptr<LinkGraph> G,
                     std::unique_ptr<JITLinkContext> Ctx);
 
+/// Returns a pass that performs linker relaxation. Should be added to
+/// PreFixupPasses.
+LinkGraphPassFunction createRelaxationPass_ELF_riscv();
+
 } // end namespace jitlink
 } // end namespace llvm
 

diff  --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
index 69aa2d2740752..dbc10ac884286 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
@@ -971,5 +971,7 @@ void link_ELF_riscv(std::unique_ptr<LinkGraph> G,
   ELFJITLinker_riscv::link(std::move(Ctx), std::move(G), std::move(Config));
 }
 
+LinkGraphPassFunction createRelaxationPass_ELF_riscv() { return relax; }
+
 } // namespace jitlink
 } // namespace llvm


        


More information about the llvm-commits mailing list