OLD | NEW |
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 incrementSubstitutions(NewName); | 307 incrementSubstitutions(NewName); |
308 return NewName.data(); | 308 return NewName.data(); |
309 } | 309 } |
310 | 310 |
311 // Transform bar ==> Prefixbar | 311 // Transform bar ==> Prefixbar |
312 // ^^^^^^ | 312 // ^^^^^^ |
313 return getTestPrefix() + Name; | 313 return getTestPrefix() + Name; |
314 } | 314 } |
315 | 315 |
316 GlobalContext::~GlobalContext() { | 316 GlobalContext::~GlobalContext() { |
317 llvm::DeleteContainerPointers(GlobalDeclarations); | |
318 llvm::DeleteContainerPointers(AllThreadContexts); | 317 llvm::DeleteContainerPointers(AllThreadContexts); |
319 } | 318 } |
320 | 319 |
321 // TODO(stichnot): Consider adding thread-local caches of constant | 320 // TODO(stichnot): Consider adding thread-local caches of constant |
322 // pool entries to reduce contention. | 321 // pool entries to reduce contention. |
323 | 322 |
324 // All locking is done by the getConstantInt[0-9]+() target function. | 323 // All locking is done by the getConstantInt[0-9]+() target function. |
325 Constant *GlobalContext::getConstantInt(Type Ty, int64_t Value) { | 324 Constant *GlobalContext::getConstantInt(Type Ty, int64_t Value) { |
326 switch (Ty) { | 325 switch (Ty) { |
327 case IceType_i1: | 326 case IceType_i1: |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 BaseOS << "Unsupported constant type: " << Ty; | 440 BaseOS << "Unsupported constant type: " << Ty; |
442 llvm_unreachable(BaseOS.str().c_str()); | 441 llvm_unreachable(BaseOS.str().c_str()); |
443 } break; | 442 } break; |
444 case IceType_void: | 443 case IceType_void: |
445 case IceType_NUM: | 444 case IceType_NUM: |
446 break; | 445 break; |
447 } | 446 } |
448 llvm_unreachable("Unknown type"); | 447 llvm_unreachable("Unknown type"); |
449 } | 448 } |
450 | 449 |
451 // No locking because only the bitcode parser thread calls it. | |
452 // TODO(stichnot,kschimpf): GlobalContext::GlobalDeclarations actually | |
453 // seems to be unused. If so, remove that field and this method. | |
454 FunctionDeclaration * | |
455 GlobalContext::newFunctionDeclaration(const FuncSigType *Signature, | |
456 unsigned CallingConv, unsigned Linkage, | |
457 bool IsProto) { | |
458 FunctionDeclaration *Func = new FunctionDeclaration( | |
459 *Signature, static_cast<llvm::CallingConv::ID>(CallingConv), | |
460 static_cast<llvm::GlobalValue::LinkageTypes>(Linkage), IsProto); | |
461 GlobalDeclarations.push_back(Func); | |
462 return Func; | |
463 } | |
464 | |
465 // No locking because only the bitcode parser thread calls it. | |
466 // TODO(stichnot,kschimpf): GlobalContext::GlobalDeclarations actually | |
467 // seems to be unused. If so, remove that field and this method. | |
468 VariableDeclaration *GlobalContext::newVariableDeclaration() { | |
469 VariableDeclaration *Var = new VariableDeclaration(); | |
470 GlobalDeclarations.push_back(Var); | |
471 return Var; | |
472 } | |
473 | |
474 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { | 450 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { |
475 if (!ALLOW_DUMP) | 451 if (!ALLOW_DUMP) |
476 return 0; | 452 return 0; |
477 auto Timers = getTimers(); | 453 auto Timers = getTimers(); |
478 TimerStackIdT NewID = Timers->size(); | 454 TimerStackIdT NewID = Timers->size(); |
479 Timers->push_back(TimerStack(Name)); | 455 Timers->push_back(TimerStack(Name)); |
480 return NewID; | 456 return NewID; |
481 } | 457 } |
482 | 458 |
483 TimerIdT GlobalContext::getTimerID(TimerStackIdT StackID, | 459 TimerIdT GlobalContext::getTimerID(TimerStackIdT StackID, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 if (ALLOW_DUMP) { | 514 if (ALLOW_DUMP) { |
539 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled; | 515 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled; |
540 if (Active) | 516 if (Active) |
541 Ctx->pushTimer(ID); | 517 Ctx->pushTimer(ID); |
542 } | 518 } |
543 } | 519 } |
544 | 520 |
545 thread_local GlobalContext::ThreadContext *GlobalContext::TLS; | 521 thread_local GlobalContext::ThreadContext *GlobalContext::TLS; |
546 | 522 |
547 } // end of namespace Ice | 523 } // end of namespace Ice |
OLD | NEW |