diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | 18 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetMachine.cpp | 12 |
2 files changed, 24 insertions, 6 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp index 675b62a974..3a422288d8 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp @@ -50,10 +50,12 @@ class PNaClABIVerifyModule : public ModulePass { ReporterIsOwned(true) { initializePNaClABIVerifyModulePass(*PassRegistry::getPassRegistry()); } - explicit PNaClABIVerifyModule(PNaClABIErrorReporter *Reporter_) : + explicit PNaClABIVerifyModule(PNaClABIErrorReporter *Reporter_, + bool StreamingMode) : ModulePass(ID), Reporter(Reporter_), - ReporterIsOwned(false) { + ReporterIsOwned(false), + StreamingMode(StreamingMode) { initializePNaClABIVerifyModulePass(*PassRegistry::getPassRegistry()); } ~PNaClABIVerifyModule() { @@ -69,6 +71,7 @@ class PNaClABIVerifyModule : public ModulePass { void checkGlobalIsFlattened(const GlobalVariable *GV); PNaClABIErrorReporter *Reporter; bool ReporterIsOwned; + bool StreamingMode; }; static const char *linkageName(GlobalValue::LinkageTypes LT) { @@ -392,7 +395,12 @@ bool PNaClABIVerifyModule::runOnModule(Module &M) { << PNaClABITypeChecker::getTypeName(MI->getFunctionType()) << "\n"; } - if (MI->isDeclaration()) { + // This check is disabled in streaming mode because it would + // reject a function that is defined but not read in yet. + // Unfortunately this means we simply don't check this property + // when translating a pexe in the browser. + // TODO(mseaborn): Enforce this property in the bitcode reader. + if (!StreamingMode && MI->isDeclaration()) { Reporter->addError() << "Function " << MI->getName() << " is declared but not defined (disallowed)\n"; } @@ -451,6 +459,6 @@ INITIALIZE_PASS(PNaClABIVerifyModule, "verify-pnaclabi-module", "Verify module for PNaCl", false, true) ModulePass *llvm::createPNaClABIVerifyModulePass( - PNaClABIErrorReporter *Reporter) { - return new PNaClABIVerifyModule(Reporter); + PNaClABIErrorReporter *Reporter, bool StreamingMode) { + return new PNaClABIVerifyModule(Reporter, StreamingMode); } diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 499f974b96..23a2b3ad99 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -155,8 +155,18 @@ TargetPassConfig *ARMBaseTargetMachine::createPassConfig(PassManagerBase &PM) { } bool ARMPassConfig::addPreISel() { - if (TM->getOptLevel() != CodeGenOpt::None && EnableGlobalMerge) + // @LOCALMOD-START + // We disable the GlobalMerge pass for PNaCl because it causes the + // PNaCl ABI checker to reject the program when the PNaCl translator + // is run in streaming mode. This is because GlobalMerge replaces + // functions' GlobalVariable references with ConstantExprs which the + // ABI verifier rejects. + // TODO(mseaborn): Make the ABI checks coexist with GlobalMerge to + // get back the performance benefits of GlobalMerge. + if (TM->getOptLevel() != CodeGenOpt::None && EnableGlobalMerge && + !getARMSubtarget().isTargetNaCl()) addPass(createGlobalMergePass(TM->getTargetLowering())); + // @LOCALMOD-END return false; } |