diff options
author | Alex Bradbury <asb@lowrisc.org> | 2018-06-13 11:58:46 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2018-06-13 11:58:46 +0000 |
commit | dc790dd5d0eda1a22388824bd518045bc57741c1 (patch) | |
tree | 4ebf3a8737d7fc0c8ef162d98c7bbc2d8411a5ba /llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | |
parent | 0f8df3e35ab3c7a763ea93699ad5572363441e6a (diff) | |
download | bcm5719-llvm-dc790dd5d0eda1a22388824bd518045bc57741c1.tar.gz bcm5719-llvm-dc790dd5d0eda1a22388824bd518045bc57741c1.zip |
[RISCV] Codegen support for atomic operations on RV32I
This patch adds lowering for atomic fences and relies on AtomicExpandPass to
lower atomic loads/stores, atomic rmw, and cmpxchg to __atomic_* libcalls.
test/CodeGen/RISCV/atomic-* are modelled on the exhaustive
test/CodeGen/PPC/atomics-regression.ll, and will prove more useful once RV32A
codegen support is introduced.
Fence mappings are taken from table A.6 in the current draft of version 2.3 of
the RISC-V Instruction Set Manual, which incorporates the memory model changes
and definitions contributed by the RISC-V Memory Consistency Model task group.
Differential Revision: https://reviews.llvm.org/D47587
llvm-svn: 334590
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp index d025e82984b..29f6bead42f 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp @@ -75,6 +75,7 @@ public: return getTM<RISCVTargetMachine>(); } + void addIRPasses() override; bool addInstSelector() override; void addPreEmitPass() override; }; @@ -84,6 +85,11 @@ TargetPassConfig *RISCVTargetMachine::createPassConfig(PassManagerBase &PM) { return new RISCVPassConfig(*this, PM); } +void RISCVPassConfig::addIRPasses() { + addPass(createAtomicExpandPass()); + TargetPassConfig::addIRPasses(); +} + bool RISCVPassConfig::addInstSelector() { addPass(createRISCVISelDag(getRISCVTargetMachine())); |