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

Side by Side Diff: lib/Transforms/MinSFI/StripTls.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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
OLDNEW
(Empty)
1 //===- StripTls.cpp - Remove the thread_local attribute from variables ----===//
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 // Runtime support for thread-local storage depends on pthreads which are
11 // currently not supported by MinSFI. This pass removes the thread_local
12 // attribute from all global variables until thread support is in place.
13 //
14 // The pass should be invoked before the pnacl-abi-simplify passes.
15 //
16 //===----------------------------------------------------------------------===//
17
18 #include "llvm/Pass.h"
19 #include "llvm/IR/GlobalVariable.h"
20 #include "llvm/IR/Module.h"
21
22 using namespace llvm;
23
24 namespace {
25 class StripTls : public ModulePass {
26 public:
27 static char ID;
28 StripTls() : ModulePass(ID) {
29 initializeStripTlsPass(*PassRegistry::getPassRegistry());
30 }
31
32 virtual bool runOnModule(Module &M);
33 };
34 } // namespace
35
36 bool StripTls::runOnModule(Module &M) {
37 bool Changed = false;
38 for (Module::global_iterator GV = M.global_begin(), E = M.global_end();
39 GV != E; ++GV) {
40 if (GV->isThreadLocal()) {
41 GV->setThreadLocal(false);
42 Changed = true;
43 }
44 }
45 return Changed;
46 }
47
48 char StripTls::ID = 0;
49 INITIALIZE_PASS(StripTls, "minsfi-strip-tls",
50 "Remove the thread_local attribute from variables",
51 false, false)
OLDNEW
« no previous file with comments | « lib/Transforms/MinSFI/SandboxMemoryAccesses.cpp ('k') | lib/Transforms/MinSFI/SubstituteUndefs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698