| OLD | NEW |
| 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 |
| 11 // multiple functions. | 11 // multiple functions. |
| 12 // | 12 // |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #include <ctype.h> // isdigit(), isupper() | 15 #include <ctype.h> // isdigit(), isupper() |
| 16 #include <locale> // locale | 16 #include <locale> // locale |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceTypes.h" | 19 #include "IceTypes.h" |
| 20 #include "IceCfg.h" | 20 #include "IceCfg.h" |
| 21 #include "IceClFlags.h" |
| 21 #include "IceGlobalContext.h" | 22 #include "IceGlobalContext.h" |
| 22 #include "IceOperand.h" | 23 #include "IceOperand.h" |
| 23 #include "IceTargetLowering.h" | 24 #include "IceTargetLowering.h" |
| 24 | 25 |
| 25 namespace Ice { | 26 namespace Ice { |
| 26 | 27 |
| 27 // TypePool maps constants of type KeyType (e.g. float) to pointers to | 28 // TypePool maps constants of type KeyType (e.g. float) to pointers to |
| 28 // type ValueType (e.g. ConstantFloat). KeyType values are compared | 29 // type ValueType (e.g. ConstantFloat). KeyType values are compared |
| 29 // using memcmp() because of potential NaN values in KeyType values. | 30 // using memcmp() because of potential NaN values in KeyType values. |
| 30 // KeyTypeHasFP indicates whether KeyType is a floating-point type | 31 // KeyTypeHasFP indicates whether KeyType is a floating-point type |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 TypePool<float, ConstantFloat, true> Floats; | 110 TypePool<float, ConstantFloat, true> Floats; |
| 110 TypePool<double, ConstantDouble, true> Doubles; | 111 TypePool<double, ConstantDouble, true> Doubles; |
| 111 TypePool<uint64_t, ConstantInteger> Integers; | 112 TypePool<uint64_t, ConstantInteger> Integers; |
| 112 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables; | 113 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables; |
| 113 UndefPool Undefs; | 114 UndefPool Undefs; |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 GlobalContext::GlobalContext(llvm::raw_ostream *OsDump, | 117 GlobalContext::GlobalContext(llvm::raw_ostream *OsDump, |
| 117 llvm::raw_ostream *OsEmit, VerboseMask Mask, | 118 llvm::raw_ostream *OsEmit, VerboseMask Mask, |
| 118 TargetArch Arch, OptLevel Opt, | 119 TargetArch Arch, OptLevel Opt, |
| 119 IceString TestPrefix) | 120 IceString TestPrefix, const ClFlags &Flags) |
| 120 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), | 121 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), |
| 121 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), | 122 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), |
| 122 TestPrefix(TestPrefix), HasEmittedFirstMethod(false) {} | 123 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false) {} |
| 123 | 124 |
| 124 // Scan a string for S[0-9A-Z]*_ patterns and replace them with | 125 // Scan a string for S[0-9A-Z]*_ patterns and replace them with |
| 125 // S<num>_ where <num> is the next base-36 value. If a type name | 126 // S<num>_ where <num> is the next base-36 value. If a type name |
| 126 // legitimately contains that pattern, then the substitution will be | 127 // legitimately contains that pattern, then the substitution will be |
| 127 // made in error and most likely the link will fail. In this case, | 128 // made in error and most likely the link will fail. In this case, |
| 128 // the test classes can be rewritten not to use that pattern, which is | 129 // the test classes can be rewritten not to use that pattern, which is |
| 129 // much simpler and more reliable than implementing a full demangling | 130 // much simpler and more reliable than implementing a full demangling |
| 130 // parser. Another substitution-in-error may occur if a type | 131 // parser. Another substitution-in-error may occur if a type |
| 131 // identifier ends with the pattern S[0-9A-Z]*, because an immediately | 132 // identifier ends with the pattern S[0-9A-Z]*, because an immediately |
| 132 // following substitution string like "S1_" or "PS1_" may be combined | 133 // following substitution string like "S1_" or "PS1_" may be combined |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 375 |
| 375 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const { | 376 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const { |
| 376 if (Ctx->isVerbose(IceV_Timing)) { | 377 if (Ctx->isVerbose(IceV_Timing)) { |
| 377 // Prefixing with '#' allows timing strings to be included | 378 // Prefixing with '#' allows timing strings to be included |
| 378 // without error in textual assembly output. | 379 // without error in textual assembly output. |
| 379 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n"; | 380 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n"; |
| 380 } | 381 } |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // end of namespace Ice | 384 } // end of namespace Ice |
| OLD | NEW |