Chromium Code Reviews| Index: src/IceGlobalContext.cpp |
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp |
| index af3e6c7065e657aa98a4c989f89d64c5a120bc28..83d5c7a9b3e096ba780446936c043a2b2370d69d 100644 |
| --- a/src/IceGlobalContext.cpp |
| +++ b/src/IceGlobalContext.cpp |
| @@ -18,6 +18,7 @@ |
| #include "IceCfg.h" |
| #include "IceCfgNode.h" |
| #include "IceClFlags.h" |
| +#include "IceClFlagsExtra.h" |
| #include "IceDefs.h" |
| #include "IceELFObjectWriter.h" |
| #include "IceGlobalInits.h" |
| @@ -250,9 +251,9 @@ void GlobalContext::CodeStats::dump(const IceString &Name, GlobalContext *Ctx) { |
| } |
| GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, |
| - ELFStreamer *ELFStr, const ClFlags &Flags) |
| + ELFStreamer *ELFStr) |
| : ConstPool(new ConstantPool()), ErrorStatus(), StrDump(OsDump), |
| - StrEmit(OsEmit), StrError(OsError), Flags(Flags), ObjectWriter(), |
| + StrEmit(OsEmit), StrError(OsError), ObjectWriter(), |
| OptQ(/*Sequential=*/Flags.isSequential(), |
| /*MaxSize=*/Flags.getNumTranslationThreads()), |
| // EmitQ is allowed unlimited size. |
| @@ -293,15 +294,13 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, |
| // ProfileBlockInfoVarDecl is initialized here because it takes this as a |
| // parameter -- we want to |
| // ensure that at least this' member variables are initialized. |
| - ProfileBlockInfoVarDecl = VariableDeclaration::create(this); |
| + ProfileBlockInfoVarDecl = VariableDeclaration::createExternal(this); |
| ProfileBlockInfoVarDecl->setAlignment(typeWidthInBytes(IceType_i64)); |
| ProfileBlockInfoVarDecl->setIsConstant(true); |
| // Note: if you change this symbol, make sure to update |
| // runtime/szrt_profiler.c as well. |
| ProfileBlockInfoVarDecl->setName("__Sz_block_profile_info"); |
| - ProfileBlockInfoVarDecl->setSuppressMangling(); |
| - ProfileBlockInfoVarDecl->setLinkage(llvm::GlobalValue::ExternalLinkage); |
| TargetLowering::staticInit(this); |
| } |
| @@ -418,7 +417,7 @@ void GlobalContext::lowerGlobals(const IceString &SectionSuffix) { |
| OstreamLocker L(this); |
| Ostream &Stream = getStrDump(); |
| for (const Ice::VariableDeclaration *Global : Globals) { |
| - Global->dump(this, Stream); |
| + Global->dump(Stream); |
| } |
| } |
| if (Flags.getDisableTranslation()) |
| @@ -545,15 +544,15 @@ void GlobalContext::emitItems() { |
| std::unique_ptr<Assembler> Asm = Item->getAsm(); |
| Asm->alignFunction(); |
| - IceString MangledName = mangleName(Asm->getFunctionName()); |
| + const IceString &Name = Asm->getFunctionName(); |
| switch (getFlags().getOutFileType()) { |
| case FT_Elf: |
| - getObjectWriter()->writeFunctionCode(MangledName, Asm->getInternal(), |
| + getObjectWriter()->writeFunctionCode(Name, Asm->getInternal(), |
| Asm.get()); |
| break; |
| case FT_Iasm: { |
| OstreamLocker L(this); |
| - Cfg::emitTextHeader(MangledName, this, Asm.get()); |
| + Cfg::emitTextHeader(Name, this, Asm.get()); |
| Asm->emitIASBytes(this); |
| } break; |
| case FT_Asm: |
| @@ -597,7 +596,7 @@ void GlobalContext::emitItems() { |
| // identifier ends with the pattern S[0-9A-Z]*, because an immediately |
| // following substitution string like "S1_" or "PS1_" may be combined |
| // with the previous type. |
| -void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const { |
| +void GlobalContext::incrementSubstitutions(ManglerVector &OldName) { |
| const std::locale CLocale("C"); |
| // Provide extra space in case the length of <num> increases. |
| ManglerVector NewName(OldName.size() * 2); |
| @@ -677,7 +676,7 @@ void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const { |
| // In this context, name mangling means to rewrite a symbol using a given |
| // prefix. For a C++ symbol, nest the original symbol inside the "prefix" |
| // namespace. For other symbols, just prepend the prefix. |
| -IceString GlobalContext::mangleName(const IceString &Name) const { |
| +IceString GlobalContext::mangleName(const IceString &Name) { |
| // An already-nested name like foo::bar() gets pushed down one level, making |
| // it equivalent to Prefix::foo::bar(). |
| // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz |
| @@ -812,25 +811,21 @@ Constant *GlobalContext::getConstantDouble(double ConstantDouble) { |
| Constant *GlobalContext::getConstantSym(const RelocOffsetT Offset, |
| const RelocOffsetArray &OffsetExpr, |
| const IceString &Name, |
| - const IceString &EmitString, |
| - bool SuppressMangling) { |
| + const IceString &EmitString) { |
| return getConstPool()->Relocatables.getOrAdd( |
| - this, |
| - RelocatableTuple(Offset, OffsetExpr, Name, EmitString, SuppressMangling)); |
| + this, RelocatableTuple(Offset, OffsetExpr, Name, EmitString)); |
| } |
| Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, |
| - const IceString &Name, |
| - bool SuppressMangling) { |
| + const IceString &Name) { |
| constexpr char EmptyEmitString[] = ""; |
| - return getConstantSym(Offset, {}, Name, EmptyEmitString, SuppressMangling); |
| + return getConstantSym(Offset, {}, Name, EmptyEmitString); |
| } |
| Constant *GlobalContext::getConstantExternSym(const IceString &Name) { |
| constexpr RelocOffsetT Offset = 0; |
| - constexpr bool SuppressMangling = true; |
| return getConstPool()->ExternRelocatables.getOrAdd( |
| - this, RelocatableTuple(Offset, {}, Name, SuppressMangling)); |
| + this, RelocatableTuple(Offset, {}, Name)); |
| } |
| Constant *GlobalContext::getConstantUndef(Type Ty) { |
| @@ -937,7 +932,7 @@ JumpTableDataList GlobalContext::getJumpTables() { |
| } |
| JumpTableData & |
| -GlobalContext::addJumpTable(IceString FuncName, SizeT Id, |
| +GlobalContext::addJumpTable(const IceString &FuncName, SizeT Id, |
| const JumpTableData::TargetList &TargetList) { |
| auto JumpTableList = getJumpTableList(); |
| JumpTableList->emplace_back(FuncName, Id, TargetList); |
| @@ -1030,6 +1025,9 @@ void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { |
| Timers->at(StackID).dump(getStrDump(), DumpCumulative); |
| } |
| +ClFlags GlobalContext::Flags; |
| +ClFlagsExtra GlobalContext::ExtraFlags; |
|
John
2016/03/06 22:39:38
Do these have constructors?
Jim Stichnoth
2016/03/07 00:03:10
Yes - and they get run as static initializers. I
|
| + |
| void TimerMarker::push() { |
| switch (StackID) { |
| case GlobalContext::TSK_Default: |