NOTES.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //===---------------------------------------------------------------------===//
  2. // Random Notes
  3. //===---------------------------------------------------------------------===//
  4. //===---------------------------------------------------------------------===//
  5. To time GCC preprocessing speed without output, use:
  6. "time gcc -MM file"
  7. This is similar to -Eonly.
  8. //===---------------------------------------------------------------------===//
  9. Creating and using a PTH file for performance measurement (use a release build).
  10. $ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
  11. $ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
  12. //===---------------------------------------------------------------------===//
  13. C++ Template Instantiation benchmark:
  14. http://users.rcn.com/abrahams/instantiation_speed/index.html
  15. //===---------------------------------------------------------------------===//
  16. TODO: File Manager Speedup:
  17. We currently do a lot of stat'ing for files that don't exist, particularly
  18. when lots of -I paths exist (e.g. see the <iostream> example, check for
  19. failures in stat in FileManager::getFile). It would be far better to make
  20. the following changes:
  21. 1. FileEntry contains a sys::Path instead of a std::string for Name.
  22. 2. sys::Path contains timestamp and size, lazily computed. Eliminate from
  23. FileEntry.
  24. 3. File UIDs are created on request, not when files are opened.
  25. These changes make it possible to efficiently have FileEntry objects for
  26. files that exist on the file system, but have not been used yet.
  27. Once this is done:
  28. 1. DirectoryEntry gets a boolean value "has read entries". When false, not
  29. all entries in the directory are in the file mgr, when true, they are.
  30. 2. Instead of stat'ing the file in FileManager::getFile, check to see if
  31. the dir has been read. If so, fail immediately, if not, read the dir,
  32. then retry.
  33. 3. Reading the dir uses the getdirentries syscall, creating a FileEntry
  34. for all files found.
  35. //===---------------------------------------------------------------------===//
  36. // Specifying targets: -triple and -arch
  37. //===---------------------------------------------------------------------===//
  38. The clang supports "-triple" and "-arch" options. At most one -triple and one
  39. -arch option may be specified. Both are optional.
  40. The "selection of target" behavior is defined as follows:
  41. (1) If the user does not specify -triple, we default to the host triple.
  42. (2) If the user specifies a -arch, that overrides the arch in the host or
  43. specified triple.
  44. //===---------------------------------------------------------------------===//
  45. verifyInputConstraint and verifyOutputConstraint should not return bool.
  46. Instead we should return something like:
  47. enum VerifyConstraintResult {
  48. Valid,
  49. // Output only
  50. OutputOperandConstraintLacksEqualsCharacter,
  51. MatchingConstraintNotValidInOutputOperand,
  52. // Input only
  53. InputOperandConstraintContainsEqualsCharacter,
  54. MatchingConstraintReferencesInvalidOperandNumber,
  55. // Both
  56. PercentConstraintUsedWithLastOperand
  57. };
  58. //===---------------------------------------------------------------------===//
  59. Blocks should not capture variables that are only used in dead code.
  60. The rule that we came up with is that blocks are required to capture
  61. variables if they're referenced in evaluated code, even if that code
  62. doesn't actually rely on the value of the captured variable.
  63. For example, this requires a capture:
  64. (void) var;
  65. But this does not:
  66. if (false) puts(var);
  67. Summary of <rdar://problem/9851835>: if we implement this, we should
  68. warn about non-POD variables that are referenced but not captured, but
  69. only if the non-reachability is not due to macro or template
  70. metaprogramming.
  71. //===---------------------------------------------------------------------===//
  72. We can still apply a modified version of the constructor/destructor
  73. delegation optimization in cases of virtual inheritance where:
  74. - there is no function-try-block,
  75. - the constructor signature is not variadic, and
  76. - the parameter variables can safely be copied and repassed
  77. to the base constructor because either
  78. - they have not had their addresses taken by the vbase initializers or
  79. - they were passed indirectly.
  80. //===---------------------------------------------------------------------===//