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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « lib/Analysis/NaCl/CMakeLists.txt ('k') | lib/Transforms/NaCl/CMakeLists.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- llvm/Analysis/NaCl/SimplificationAnalyses.cpp ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file houses implementations of the analysis passes used by the PNaCl IR
11 // simplification passes to remove extra passes over modules while progressive
12 // simplifying the IR, allowing them direct access to what each pass needs to
13 // expand.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #include "llvm/Analysis/NaCl/PNaClSimplificationAnalyses.h"
18 #include "llvm/IR/InstIterator.h"
19
20 using namespace llvm;
21
22 AtomicInfo::AtomicInfo(Function &F) {
23 for (Instruction &I : inst_range(F)) {
24 if (AtomicCmpXchgInst *AI = dyn_cast<AtomicCmpXchgInst>(&I)) {
25 CmpXchgs.push_back(AI);
26 } else if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
27 if (!LI->isSimple()) {
28 Loads.push_back(LI);
29 }
30 } else if (StoreInst *SI = dyn_cast<StoreInst>(&I)) {
31 if (!SI->isSimple()) {
32 Stores.push_back(SI);
33 }
34 } else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(&I)) {
35 RMWs.push_back(RMWI);
36 } else if (FenceInst *FI = dyn_cast<FenceInst>(&I)) {
37 Fences.push_back(FI);
38 }
39 }
40 }
41
42 char AtomicAnalysis::PassID;
43
44 INITIALIZE_PASS(AtomicAnalysisWrapperPass, "pnacl-atomic-analysis",
45 "Find atomic instruction to expand", true, true)
46 char AtomicAnalysisWrapperPass::ID = 0;
47
48 bool AtomicAnalysisWrapperPass::runOnFunction(Function &F) {
49 releaseMemory();
50 Info = std::move(AtomicInfo(F));
51 return false;
52 }
53 void AtomicAnalysisWrapperPass::releaseMemory() { Info.releaseMemory(); }
54 void AtomicAnalysisWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
55 AU.setPreservesAll();
56 }
OLDNEW
« 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