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