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