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

Side by Side Diff: src/IceGlobalContext.cpp

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: doesn't matter if eax or not Created 6 years, 6 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
OLDNEW
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===//
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 TypePool<uint64_t, ConstantInteger> Integers; 87 TypePool<uint64_t, ConstantInteger> Integers;
88 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables; 88 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables;
89 }; 89 };
90 90
91 GlobalContext::GlobalContext(llvm::raw_ostream *OsDump, 91 GlobalContext::GlobalContext(llvm::raw_ostream *OsDump,
92 llvm::raw_ostream *OsEmit, VerboseMask Mask, 92 llvm::raw_ostream *OsEmit, VerboseMask Mask,
93 TargetArch Arch, OptLevel Opt, 93 TargetArch Arch, OptLevel Opt,
94 IceString TestPrefix) 94 IceString TestPrefix)
95 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), 95 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask),
96 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), 96 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt),
97 TestPrefix(TestPrefix), HasEmittedFirstMethod(false) {} 97 TestPrefix(TestPrefix), HasEmittedFirstMethod(false) {
98 BuildIntrinsicMap(&IntrinsicInfos);
JF 2014/06/10 03:50:41 Why isn't think just IntrinsicMap's default constr
jvoung (off chromium) 2014/06/16 20:51:58 Done.
99 }
98 100
99 // In this context, name mangling means to rewrite a symbol using a 101 // In this context, name mangling means to rewrite a symbol using a
100 // given prefix. For a C++ symbol, nest the original symbol inside 102 // given prefix. For a C++ symbol, nest the original symbol inside
101 // the "prefix" namespace. For other symbols, just prepend the 103 // the "prefix" namespace. For other symbols, just prepend the
102 // prefix. 104 // prefix.
103 IceString GlobalContext::mangleName(const IceString &Name) const { 105 IceString GlobalContext::mangleName(const IceString &Name) const {
104 // An already-nested name like foo::bar() gets pushed down one 106 // An already-nested name like foo::bar() gets pushed down one
105 // level, making it equivalent to Prefix::foo::bar(). 107 // level, making it equivalent to Prefix::foo::bar().
106 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz 108 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz
107 // A non-nested but mangled name like bar() gets nested, making it 109 // A non-nested but mangled name like bar() gets nested, making it
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return ConstPool->Floats.getConstantPool(); 205 return ConstPool->Floats.getConstantPool();
204 case IceType_f64: 206 case IceType_f64:
205 return ConstPool->Doubles.getConstantPool(); 207 return ConstPool->Doubles.getConstantPool();
206 case IceType_void: 208 case IceType_void:
207 case IceType_NUM: 209 case IceType_NUM:
208 break; 210 break;
209 } 211 }
210 llvm_unreachable("Unknown type"); 212 llvm_unreachable("Unknown type");
211 } 213 }
212 214
215 IntrinsicInfo GlobalContext::getIntrinsicInfo(const IceString &Name) const {
216 IntrinsicMap::const_iterator I = IntrinsicInfos.find(Name);
217 if (I == IntrinsicInfos.end())
218 return UnknownIntrinsicInfo;
219 return I->second;
220 }
221
213 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const { 222 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const {
214 if (Ctx->isVerbose(IceV_Timing)) { 223 if (Ctx->isVerbose(IceV_Timing)) {
215 // Prefixing with '#' allows timing strings to be included 224 // Prefixing with '#' allows timing strings to be included
216 // without error in textual assembly output. 225 // without error in textual assembly output.
217 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n"; 226 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n";
218 } 227 }
219 } 228 }
220 229
221 } // end of namespace Ice 230 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceInst.h » ('j') | src/IceInst.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698