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

Side by Side Diff: src/IceGlobalContext.cpp

Issue 678533005: Subzero: Add basic ELFObjectWriter (text section, symtab, strtab, headers) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: cleanup Created 6 years, 1 month 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
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
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 // This file defines aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 public: 106 public:
107 ConstantPool() {} 107 ConstantPool() {}
108 TypePool<float, ConstantFloat, true> Floats; 108 TypePool<float, ConstantFloat, true> Floats;
109 TypePool<double, ConstantDouble, true> Doubles; 109 TypePool<double, ConstantDouble, true> Doubles;
110 TypePool<uint32_t, ConstantInteger32> Integers32; 110 TypePool<uint32_t, ConstantInteger32> Integers32;
111 TypePool<uint64_t, ConstantInteger64> Integers64; 111 TypePool<uint64_t, ConstantInteger64> Integers64;
112 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables; 112 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables;
113 UndefPool Undefs; 113 UndefPool Undefs;
114 }; 114 };
115 115
116 GlobalContext::GlobalContext(llvm::raw_ostream *OsDump, 116 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
117 llvm::raw_ostream *OsEmit, VerboseMask Mask, 117 ELFStreamer *ELFStr, VerboseMask Mask,
118 TargetArch Arch, OptLevel Opt, 118 TargetArch Arch, OptLevel Opt,
119 IceString TestPrefix, const ClFlags &Flags) 119 IceString TestPrefix, const ClFlags &Flags)
120 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), 120 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask),
121 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), 121 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt),
122 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false), 122 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false),
123 RNG("") { 123 RNG(""), ObjectWriter() {
124 // Pre-register built-in stack names. 124 // Pre-register built-in stack names.
125 newTimerStackID("Total across all functions"); 125 newTimerStackID("Total across all functions");
126 newTimerStackID("Per-function summary"); 126 newTimerStackID("Per-function summary");
127 if (ELFStr) {
128 ObjectWriter.reset(new ELFObjectWriter(*this, *ELFStr));
129 }
127 } 130 }
128 131
129 // Scan a string for S[0-9A-Z]*_ patterns and replace them with 132 // Scan a string for S[0-9A-Z]*_ patterns and replace them with
130 // S<num>_ where <num> is the next base-36 value. If a type name 133 // S<num>_ where <num> is the next base-36 value. If a type name
131 // legitimately contains that pattern, then the substitution will be 134 // legitimately contains that pattern, then the substitution will be
132 // made in error and most likely the link will fail. In this case, 135 // made in error and most likely the link will fail. In this case,
133 // the test classes can be rewritten not to use that pattern, which is 136 // the test classes can be rewritten not to use that pattern, which is
134 // much simpler and more reliable than implementing a full demangling 137 // much simpler and more reliable than implementing a full demangling
135 // parser. Another substitution-in-error may occur if a type 138 // parser. Another substitution-in-error may occur if a type
136 // identifier ends with the pattern S[0-9A-Z]*, because an immediately 139 // identifier ends with the pattern S[0-9A-Z]*, because an immediately
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 462 }
460 463
461 TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func) 464 TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func)
462 : ID(ID), Ctx(Func->getContext()), 465 : ID(ID), Ctx(Func->getContext()),
463 Active(Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled) { 466 Active(Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled) {
464 if (Active) 467 if (Active)
465 Ctx->pushTimer(ID); 468 Ctx->pushTimer(ID);
466 } 469 }
467 470
468 } // end of namespace Ice 471 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceMemoryRegion.h » ('j') | src/IceMemoryRegion.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698