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 | |
| 16 | Creating and using a PTH file for performance measurement (use a release-asserts |
| 17 | build). |
| 18 | |
| 19 | $ clang -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache |
| 20 | $ clang -token-cache /tmp/tokencache INPUTS/Cocoa_h.m |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 21 | |
| 22 | //===---------------------------------------------------------------------===// |
| 23 | |
| 24 | C++ Template Instantiation benchmark: |
| 25 | http://users.rcn.com/abrahams/instantiation_speed/index.html |
| 26 | |
| 27 | //===---------------------------------------------------------------------===// |
| 28 | |
| 29 | TODO: File Manager Speedup: |
| 30 | |
| 31 | We currently do a lot of stat'ing for files that don't exist, particularly |
| 32 | when lots of -I paths exist (e.g. see the <iostream> example, check for |
| 33 | failures in stat in FileManager::getFile). It would be far better to make |
| 34 | the following changes: |
| 35 | 1. FileEntry contains a sys::Path instead of a std::string for Name. |
| 36 | 2. sys::Path contains timestamp and size, lazily computed. Eliminate from |
| 37 | FileEntry. |
| 38 | 3. File UIDs are created on request, not when files are opened. |
| 39 | These changes make it possible to efficiently have FileEntry objects for |
| 40 | files that exist on the file system, but have not been used yet. |
| 41 | |
| 42 | Once this is done: |
| 43 | 1. DirectoryEntry gets a boolean value "has read entries". When false, not |
| 44 | all entries in the directory are in the file mgr, when true, they are. |
| 45 | 2. Instead of stat'ing the file in FileManager::getFile, check to see if |
| 46 | the dir has been read. If so, fail immediately, if not, read the dir, |
| 47 | then retry. |
| 48 | 3. Reading the dir uses the getdirentries syscall, creating an FileEntry |
| 49 | for all files found. |
| 50 | |
| 51 | //===---------------------------------------------------------------------===// |
| 52 | |
| 53 | TODO: Fast #Import: |
| 54 | |
| 55 | * Get frameworks that don't use #import to do so, e.g. |
| 56 | DirectoryService, AudioToolbox, CoreFoundation, etc. Why not using #import? |
| 57 | Because they work in C mode? C has #import. |
| 58 | * Have the lexer return a token for #import instead of handling it itself. |
| 59 | - Create a new preprocessor object with no external state (no -D/U options |
| 60 | from the command line, etc). Alternatively, keep track of exactly which |
| 61 | external state is used by a #import: declare it somehow. |
| 62 | * When having reading a #import file, keep track of whether we have (and/or |
| 63 | which) seen any "configuration" macros. Various cases: |
| 64 | - Uses of target args (__POWERPC__, __i386): Header has to be parsed |
| 65 | multiple times, per-target. What about #ifndef checks? How do we know? |
| 66 | - "Configuration" preprocessor macros not defined: POWERPC, etc. What about |
| 67 | things like __STDC__ etc? What is and what isn't allowed. |
| 68 | * Special handling for "umbrella" headers, which just contain #import stmts: |
| 69 | - Cocoa.h/AppKit.h - Contain pointers to digests instead of entire digests |
| 70 | themselves? Foundation.h isn't pure umbrella! |
| 71 | * Frameworks digests: |
| 72 | - Can put "digest" of a framework-worth of headers into the framework |
| 73 | itself. To open AppKit, just mmap |
| 74 | /System/Library/Frameworks/AppKit.framework/"digest", which provides a |
| 75 | symbol table in a well defined format. Lazily unstream stuff that is |
| 76 | needed. Contains declarations, macros, and debug information. |
| 77 | - System frameworks ship with digests. How do we handle configuration |
| 78 | information? How do we handle stuff like: |
| 79 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 |
| 80 | which guards a bunch of decls? Should there be a couple of default |
| 81 | configs, then have the UI fall back to building/caching its own? |
| 82 | - GUI automatically builds digests when UI is idle, both of system |
| 83 | frameworks if they aren't not available in the right config, and of app |
| 84 | frameworks. |
| 85 | - GUI builds dependence graph of frameworks/digests based on #imports. If a |
| 86 | digest is out date, dependent digests are automatically invalidated. |
| 87 | |
| 88 | * New constraints on #import for objc-v3: |
| 89 | - #imported file must not define non-inline function bodies. |
| 90 | - Alternatively, they can, and these bodies get compiled/linked *once* |
| 91 | per app into a dylib. What about building user dylibs? |
| 92 | - Restrictions on ObjC grammar: can't #import the body of a for stmt or fn. |
| 93 | - Compiler must detect and reject these cases. |
| 94 | - #defines defined within a #import have two behaviors: |
| 95 | - By default, they escape the header. These macros *cannot* be #undef'd |
| 96 | by other code: this is enforced by the front-end. |
| 97 | - Optionally, user can specify what macros escape (whitelist) or can use |
| 98 | #undef. |
| 99 | |
| 100 | //===---------------------------------------------------------------------===// |
Ted Kremenek | f4c45b0 | 2007-12-03 22:26:16 +0000 | [diff] [blame] | 101 | // Specifying targets: -triple and -arch |
| 102 | ===---------------------------------------------------------------------===// |
| 103 | |
Chris Lattner | 177b1c7 | 2008-03-09 01:36:43 +0000 | [diff] [blame] | 104 | The clang supports "-triple" and "-arch" options. At most one -triple and one |
| 105 | -arch option may be specified. Both are optional. |
Ted Kremenek | f4c45b0 | 2007-12-03 22:26:16 +0000 | [diff] [blame] | 106 | |
| 107 | The "selection of target" behavior is defined as follows: |
| 108 | |
Chris Lattner | 177b1c7 | 2008-03-09 01:36:43 +0000 | [diff] [blame] | 109 | (1) If the user does not specify -triple, we default to the host triple. |
| 110 | (2) If the user specifies a -arch, that overrides the arch in the host or |
| 111 | specified triple. |
Anders Carlsson | 3de54ff | 2008-03-13 03:45:48 +0000 | [diff] [blame] | 112 | |
| 113 | //===---------------------------------------------------------------------===// |
| 114 | |
| 115 | |
| 116 | verifyInputConstraint and verifyOutputConstraint should not return bool. |
| 117 | |
| 118 | Instead we should return something like: |
| 119 | |
| 120 | enum VerifyConstraintResult { |
| 121 | Valid, |
| 122 | |
| 123 | // Output only |
| 124 | OutputOperandConstraintLacksEqualsCharacter, |
| 125 | MatchingConstraintNotValidInOutputOperand, |
| 126 | |
| 127 | // Input only |
| 128 | InputOperandConstraintContainsEqualsCharacter, |
| 129 | MatchingConstraintReferencesInvalidOperandNumber, |
| 130 | |
| 131 | // Both |
| 132 | PercentConstraintUsedWithLastOperand |
| 133 | }; |
| 134 | |
| 135 | //===---------------------------------------------------------------------===// |