summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
diff options
context:
space:
mode:
authorSameer AbuAsal <sabuasal@codeaurora.org>2018-06-27 20:51:42 +0000
committerSameer AbuAsal <sabuasal@codeaurora.org>2018-06-27 20:51:42 +0000
commit9b65ffb0976c5b9590959a6439d338fc5ec0dceb (patch)
treea81461df9ed2a3cc208291ec5d8da0b06f0ce64f /llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
parent8513cd4c0e577a8b2df17b9d0cda5e0b42273668 (diff)
downloadbcm5719-llvm-9b65ffb0976c5b9590959a6439d338fc5ec0dceb.tar.gz
bcm5719-llvm-9b65ffb0976c5b9590959a6439d338fc5ec0dceb.zip
[RISCV] Add machine function pass to merge base + offset
Summary: In r333455 we added a peephole to fix the corner cases that result from separating base + offset lowering of global address.The peephole didn't handle some of the cases because it only has a basic block view instead of a function level view. This patch replaces that logic with a machine function pass. In addition to handling the original cases it handles uses of the global address across blocks in function and folding an offset from LW\SW instruction. This pass won't run for OptNone compilation, so there will be a negative impact overall vs the old approach at O0. Reviewers: asb, apazos, mgrang Reviewed By: asb Subscribers: MartinMosbeck, brucehoult, the_o, rogfer01, mgorny, rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, llvm-commits, edward-jones Differential Revision: https://reviews.llvm.org/D47857 llvm-svn: 335786
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/RISCV/RISCVTargetMachine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 29f6bead42f..a2ebf5bf3e6 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -78,6 +78,7 @@ public:
void addIRPasses() override;
bool addInstSelector() override;
void addPreEmitPass() override;
+ void addPreRegAlloc() override;
};
}
@@ -97,3 +98,7 @@ bool RISCVPassConfig::addInstSelector() {
}
void RISCVPassConfig::addPreEmitPass() { addPass(&BranchRelaxationPassID); }
+
+void RISCVPassConfig::addPreRegAlloc() {
+ addPass(createRISCVMergeBaseOffsetOptPass());
+}
OpenPOWER on IntegriCloud