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