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

Side by Side Diff: lib/Target/ARM/ARMTargetMachine.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
« no previous file with comments | « lib/Target/ARM/ARMSubtarget.cpp ('k') | lib/Target/ARM/ARMTargetObjectFile.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===// 1 //===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // 10 //
11 //===----------------------------------------------------------------------===// 11 //===----------------------------------------------------------------------===//
12 12
13 #include "ARM.h" 13 #include "ARM.h"
14 #include "ARMTargetMachine.h" 14 #include "ARMTargetMachine.h"
15 #include "ARMFrameLowering.h" 15 #include "ARMFrameLowering.h"
16 #include "ARMTargetObjectFile.h" 16 #include "ARMTargetObjectFile.h"
17 #include "llvm/CodeGen/Passes.h" 17 #include "llvm/CodeGen/Passes.h"
18 #include "llvm/IR/Function.h" 18 #include "llvm/IR/Function.h"
19 #include "llvm/MC/MCAsmInfo.h" 19 #include "llvm/MC/MCAsmInfo.h"
20 #include "llvm/PassManager.h" 20 #include "llvm/PassManager.h"
21 #include "llvm/Support/CommandLine.h" 21 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/FormattedStream.h" 22 #include "llvm/Support/FormattedStream.h"
23 #include "llvm/Support/TargetRegistry.h" 23 #include "llvm/Support/TargetRegistry.h"
24 #include "llvm/Target/TargetOptions.h" 24 #include "llvm/Target/TargetOptions.h"
25 // @LOCALMOD-START
26 #include "llvm/Transforms/NaCl.h"
27 // @LOCALMOD-END
25 #include "llvm/Transforms/Scalar.h" 28 #include "llvm/Transforms/Scalar.h"
26 using namespace llvm; 29 using namespace llvm;
27 30
28 static cl::opt<bool> 31 static cl::opt<bool>
29 DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden, 32 DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
30 cl::desc("Inhibit optimization of S->D register accesses on A 15"), 33 cl::desc("Inhibit optimization of S->D register accesses on A 15"),
31 cl::init(false)); 34 cl::init(false));
32 35
33 static cl::opt<bool> 36 static cl::opt<bool>
34 EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden, 37 EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool addPreSched2() override; 204 bool addPreSched2() override;
202 bool addPreEmitPass() override; 205 bool addPreEmitPass() override;
203 }; 206 };
204 } // namespace 207 } // namespace
205 208
206 TargetPassConfig *ARMBaseTargetMachine::createPassConfig(PassManagerBase &PM) { 209 TargetPassConfig *ARMBaseTargetMachine::createPassConfig(PassManagerBase &PM) {
207 return new ARMPassConfig(this, PM); 210 return new ARMPassConfig(this, PM);
208 } 211 }
209 212
210 void ARMPassConfig::addIRPasses() { 213 void ARMPassConfig::addIRPasses() {
214 // @LOCALMOD-START
215 if (getARMSubtarget().isTargetNaCl())
216 addPass(createInsertDivideCheckPass());
217 // @LOCALMOD-END
218
211 if (TM->Options.ThreadModel == ThreadModel::Single) 219 if (TM->Options.ThreadModel == ThreadModel::Single)
212 addPass(createLowerAtomicPass()); 220 addPass(createLowerAtomicPass());
213 else 221 else
214 addPass(createAtomicExpandPass(TM)); 222 addPass(createAtomicExpandPass(TM));
215 223
216 // Cmpxchg instructions are often used with a subsequent comparison to 224 // Cmpxchg instructions are often used with a subsequent comparison to
217 // determine whether it succeeded. We can exploit existing control-flow in 225 // determine whether it succeeded. We can exploit existing control-flow in
218 // ldrex/strex loops to simplify this, but it needs tidying up. 226 // ldrex/strex loops to simplify this, but it needs tidying up.
219 const ARMSubtarget *Subtarget = &getARMSubtarget(); 227 const ARMSubtarget *Subtarget = &getARMSubtarget();
220 if (Subtarget->hasAnyDataBarrier() && !Subtarget->isThumb1Only()) 228 if (Subtarget->hasAnyDataBarrier() && !Subtarget->isThumb1Only())
221 if (TM->getOptLevel() != CodeGenOpt::None && EnableAtomicTidy) 229 if (TM->getOptLevel() != CodeGenOpt::None && EnableAtomicTidy)
222 addPass(createCFGSimplificationPass()); 230 addPass(createCFGSimplificationPass());
223 231
224 TargetPassConfig::addIRPasses(); 232 TargetPassConfig::addIRPasses();
225 } 233 }
226 234
227 bool ARMPassConfig::addPreISel() { 235 bool ARMPassConfig::addPreISel() {
228 if (TM->getOptLevel() != CodeGenOpt::None) 236 // @LOCALMOD-START
237 // We disable the GlobalMerge pass for PNaCl because it causes the
238 // PNaCl ABI checker to reject the program when the PNaCl translator
239 // is run in streaming mode. This is because GlobalMerge replaces
240 // functions' GlobalVariable references with ConstantExprs which the
241 // ABI verifier rejects.
242 // TODO(mseaborn): Make the ABI checks coexist with GlobalMerge to
243 // get back the performance benefits of GlobalMerge.
244 if (!getARMSubtarget().isTargetNaCl() &&
245 TM->getOptLevel() != CodeGenOpt::None)
246 // @LOCALMOD-END
229 addPass(createGlobalMergePass(TM)); 247 addPass(createGlobalMergePass(TM));
230 248
231 return false; 249 return false;
232 } 250 }
233 251
234 bool ARMPassConfig::addInstSelector() { 252 bool ARMPassConfig::addInstSelector() {
235 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel())); 253 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
236 254
237 const ARMSubtarget *Subtarget = &getARMSubtarget(); 255 const ARMSubtarget *Subtarget = &getARMSubtarget();
238 if (Subtarget->isTargetELF() && !Subtarget->isThumb1Only() && 256 if (Subtarget->isTargetELF() && !Subtarget->isThumb1Only() &&
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 bool ARMPassConfig::addPreEmitPass() { 304 bool ARMPassConfig::addPreEmitPass() {
287 if (getARMSubtarget().isThumb2()) { 305 if (getARMSubtarget().isThumb2()) {
288 if (!getARMSubtarget().prefers32BitThumb()) 306 if (!getARMSubtarget().prefers32BitThumb())
289 addPass(createThumb2SizeReductionPass()); 307 addPass(createThumb2SizeReductionPass());
290 308
291 // Constant island pass work on unbundled instructions. 309 // Constant island pass work on unbundled instructions.
292 addPass(&UnpackMachineBundlesID); 310 addPass(&UnpackMachineBundlesID);
293 } 311 }
294 312
295 addPass(createARMOptimizeBarriersPass()); 313 addPass(createARMOptimizeBarriersPass());
296 addPass(createARMConstantIslandPass()); 314
315 // @LOCALMOD-START
316 if (getARMSubtarget().useConstIslands())
317 addPass(createARMConstantIslandPass());
318 // @LOCALMOD-END
319
320 // @LOCALMOD-START
321 // This pass does all the heavy sfi lifting.
322 if (getARMSubtarget().isTargetNaCl()) {
323 addPass(createARMNaClRewritePass());
324 }
325 // @LOCALMOD-END
297 326
298 return true; 327 return true;
299 } 328 }
OLDNEW
« no previous file with comments | « lib/Target/ARM/ARMSubtarget.cpp ('k') | lib/Target/ARM/ARMTargetObjectFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698