Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1445)

Unified Diff: lib/Analysis/NaCl/PNaClSimplificationAnalyses.cpp

Issue 927493002: PNaCl: Impl the other atomicrmw operations: nand, max, min, umax, and umin. Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Analysis/NaCl/CMakeLists.txt ('k') | lib/Transforms/NaCl/CMakeLists.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Analysis/NaCl/PNaClSimplificationAnalyses.cpp
diff --git a/lib/Analysis/NaCl/PNaClSimplificationAnalyses.cpp b/lib/Analysis/NaCl/PNaClSimplificationAnalyses.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e7f9fda2c1ece6a9d567669a28f4ac21fda85e9
--- /dev/null
+++ b/lib/Analysis/NaCl/PNaClSimplificationAnalyses.cpp
@@ -0,0 +1,56 @@
+//===- llvm/Analysis/NaCl/SimplificationAnalyses.cpp ------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file houses implementations of the analysis passes used by the PNaCl IR
+// simplification passes to remove extra passes over modules while progressive
+// simplifying the IR, allowing them direct access to what each pass needs to
+// expand.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Analysis/NaCl/PNaClSimplificationAnalyses.h"
+#include "llvm/IR/InstIterator.h"
+
+using namespace llvm;
+
+AtomicInfo::AtomicInfo(Function &F) {
+ for (Instruction &I : inst_range(F)) {
+ if (AtomicCmpXchgInst *AI = dyn_cast<AtomicCmpXchgInst>(&I)) {
+ CmpXchgs.push_back(AI);
+ } else if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
+ if (!LI->isSimple()) {
+ Loads.push_back(LI);
+ }
+ } else if (StoreInst *SI = dyn_cast<StoreInst>(&I)) {
+ if (!SI->isSimple()) {
+ Stores.push_back(SI);
+ }
+ } else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(&I)) {
+ RMWs.push_back(RMWI);
+ } else if (FenceInst *FI = dyn_cast<FenceInst>(&I)) {
+ Fences.push_back(FI);
+ }
+ }
+}
+
+char AtomicAnalysis::PassID;
+
+INITIALIZE_PASS(AtomicAnalysisWrapperPass, "pnacl-atomic-analysis",
+ "Find atomic instruction to expand", true, true)
+char AtomicAnalysisWrapperPass::ID = 0;
+
+bool AtomicAnalysisWrapperPass::runOnFunction(Function &F) {
+ releaseMemory();
+ Info = std::move(AtomicInfo(F));
+ return false;
+}
+void AtomicAnalysisWrapperPass::releaseMemory() { Info.releaseMemory(); }
+void AtomicAnalysisWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+}
« no previous file with comments | « lib/Analysis/NaCl/CMakeLists.txt ('k') | lib/Transforms/NaCl/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698