Chromium Code Reviews| Index: lib/Target/JSBackend/JSBackend.cpp |
| diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp |
| index 5e9134b63163cd9f674136be37580f5717114851..b0c374e101d00ed1aa7eaa4c0b3f7868ac3540c3 100644 |
| --- a/lib/Target/JSBackend/JSBackend.cpp |
| +++ b/lib/Target/JSBackend/JSBackend.cpp |
| @@ -32,11 +32,10 @@ |
| #include "llvm/IR/Module.h" |
| #include "llvm/IR/Operator.h" |
| #include "llvm/Pass.h" |
| -#include "llvm/PassManager.h" |
| +#include "llvm/IR/LegacyPassManager.h" |
| #include "llvm/IR/CallSite.h" |
| #include "llvm/Support/CommandLine.h" |
| #include "llvm/Support/ErrorHandling.h" |
| -#include "llvm/Support/FormattedStream.h" |
| #include "llvm/IR/GetElementPtrTypeIterator.h" |
| #include "llvm/Support/MathExtras.h" |
| #include "llvm/Support/TargetRegistry.h" |
| @@ -129,7 +128,7 @@ namespace { |
| /// JSWriter - This class is the main chunk of code that converts an LLVM |
| /// module to JavaScript. |
| class JSWriter : public ModulePass { |
| - formatted_raw_ostream &Out; |
| + raw_pwrite_stream &Out; |
| const Module *TheModule; |
| unsigned UniqueNum; |
| unsigned NextFunctionIndex; // used with NoAliasingFunctionPointers |
| @@ -155,14 +154,14 @@ namespace { |
| bool UsesSIMD; |
| int InvokeState; // cycles between 0, 1 after preInvoke, 2 after call, 0 again after postInvoke. hackish, no argument there. |
| CodeGenOpt::Level OptLevel; |
| - const DataLayout *DL; |
| + const DataLayout *DL; |
|
jvoung (off chromium)
2015/05/26 20:39:45
Upstream whitespace change, or leave the space alo
Derek Schuff
2015/05/26 22:01:32
Done.
|
| bool StackBumped; |
| #include "CallHandlers.h" |
| public: |
| static char ID; |
| - JSWriter(formatted_raw_ostream &o, CodeGenOpt::Level OptLevel) |
| + JSWriter(raw_pwrite_stream &o, CodeGenOpt::Level OptLevel) |
| : ModulePass(ID), Out(o), UniqueNum(0), NextFunctionIndex(0), CantValidate(""), UsesSIMD(false), InvokeState(0), |
| OptLevel(OptLevel), StackBumped(false) {} |
| @@ -172,7 +171,6 @@ namespace { |
| virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| AU.setPreservesAll(); |
| - AU.addRequired<DataLayoutPass>(); |
| ModulePass::getAnalysisUsage(AU); |
| } |
| @@ -182,7 +180,7 @@ namespace { |
| LLVM_ATTRIBUTE_NORETURN void error(const std::string& msg); |
| - formatted_raw_ostream& nl(formatted_raw_ostream &Out, int delta = 0); |
| + raw_pwrite_stream& nl(raw_pwrite_stream &Out, int delta = 0); |
| private: |
| void printCommaSeparated(const HeapData v); |
| @@ -482,7 +480,7 @@ namespace { |
| }; |
| } // end anonymous namespace. |
| -formatted_raw_ostream &JSWriter::nl(formatted_raw_ostream &Out, int delta) { |
| +raw_pwrite_stream &JSWriter::nl(raw_pwrite_stream &Out, int delta) { |
| Out << '\n'; |
| return Out; |
| } |
| @@ -563,10 +561,10 @@ static inline std::string ensureFloat(const std::string &S, Type *T) { |
| } |
| static void emitDebugInfo(raw_ostream& Code, const Instruction *I) { |
| - if (MDNode *N = I->getMetadata("dbg")) { |
| - DILocation Loc(N); |
| - unsigned Line = Loc.getLineNumber(); |
| - StringRef File = Loc.getFilename(); |
| + auto &Loc = I->getDebugLoc(); |
| + if (Loc) { |
| + unsigned Line = Loc.getLine(); |
| + StringRef File = cast<MDLocation>(Loc.getScope())->getFilename(); |
| Code << " //@line " << utostr(Line) << " \"" << (File.size() > 0 ? File.str() : "?") << "\""; |
| } |
| } |
| @@ -2845,7 +2843,7 @@ void JSWriter::parseConstant(const std::string& name, const Constant* CV, bool c |
| // Deconstruct getelementptrs. |
| int64_t BaseOffset; |
| - V = GetPointerBaseWithConstantOffset(V, BaseOffset, DL); |
| + V = GetPointerBaseWithConstantOffset(V, BaseOffset, *DL); |
| Data += (uint64_t)BaseOffset; |
| Data += getConstAsOffset(V, getGlobalAddress(name)); |
| @@ -2927,7 +2925,7 @@ void JSWriter::printModule(const std::string& fname, |
| bool JSWriter::runOnModule(Module &M) { |
| TheModule = &M; |
| - DL = &getAnalysis<DataLayoutPass>().getDataLayout(); |
| + DL = &M.getDataLayout(); |
| setupCallHandlers(); |
| @@ -2961,7 +2959,7 @@ Pass *createCheckTriplePass() { |
| //===----------------------------------------------------------------------===// |
| bool JSTargetMachine::addPassesToEmitFile(PassManagerBase &PM, |
| - formatted_raw_ostream &o, |
| + raw_pwrite_stream &o, |
| CodeGenFileType FileType, |
| bool DisableVerify, |
| AnalysisID StartAfter, |