blob: 6fc312c0c3b6d6767759b1aeeb887a3afb935d8f [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
Chris Lattnereab819b2009-01-16 19:33:59 +000014//===---------------------------------------------------------------------===//
15
16Creating and using a PTH file for performance measurement (use a release-asserts
17build).
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 Spencer5f016e22007-07-11 17:01:13 +000021
22//===---------------------------------------------------------------------===//
23
24 C++ Template Instantiation benchmark:
25 http://users.rcn.com/abrahams/instantiation_speed/index.html
26
27//===---------------------------------------------------------------------===//
28
29TODO: 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
53TODO: 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//===---------------------------------------------------------------------===//
101
102TODO: New language feature: Configuration queries:
103 - Instead of #ifdef __POWERPC__, use "if (strcmp(`cpu`, __POWERPC__))", or
104 some other, better, syntax.
105 - Use it to increase the number of "architecture-clean" #import'd files,
106 allowing a single index to be used for all fat slices.
107
108//===---------------------------------------------------------------------===//
Ted Kremenekf4c45b02007-12-03 22:26:16 +0000109// Specifying targets: -triple and -arch
110===---------------------------------------------------------------------===//
111
Chris Lattner177b1c72008-03-09 01:36:43 +0000112The clang supports "-triple" and "-arch" options. At most one -triple and one
113-arch option may be specified. Both are optional.
Ted Kremenekf4c45b02007-12-03 22:26:16 +0000114
115The "selection of target" behavior is defined as follows:
116
Chris Lattner177b1c72008-03-09 01:36:43 +0000117(1) If the user does not specify -triple, we default to the host triple.
118(2) If the user specifies a -arch, that overrides the arch in the host or
119 specified triple.
Anders Carlsson3de54ff2008-03-13 03:45:48 +0000120
121//===---------------------------------------------------------------------===//
122
123
124verifyInputConstraint and verifyOutputConstraint should not return bool.
125
126Instead we should return something like:
127
128enum VerifyConstraintResult {
129 Valid,
130
131 // Output only
132 OutputOperandConstraintLacksEqualsCharacter,
133 MatchingConstraintNotValidInOutputOperand,
134
135 // Input only
136 InputOperandConstraintContainsEqualsCharacter,
137 MatchingConstraintReferencesInvalidOperandNumber,
138
139 // Both
140 PercentConstraintUsedWithLastOperand
141};
142
143//===---------------------------------------------------------------------===//