blob: 53f35a01863ac70bda0097048162f6d368d269e2 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===---------------------------------------------------------------------===//
2// Random Notes
3//===---------------------------------------------------------------------===//
4
Reid Spencer5f016e22007-07-11 17:01:13 +00005//===---------------------------------------------------------------------===//
Reid Spencer5f016e22007-07-11 17:01:13 +00006
7To time GCC preprocessing speed without output, use:
8 "time gcc -MM file"
9This is similar to -Eonly.
10
Chris Lattnereab819b2009-01-16 19:33:59 +000011//===---------------------------------------------------------------------===//
12
Duncan Sands8f005a62010-07-07 07:49:17 +000013Creating and using a PTH file for performance measurement (use a release build).
Chris Lattnereab819b2009-01-16 19:33:59 +000014
John McCall2ff24892009-09-24 22:03:45 +000015$ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
Daniel Dunbar864db012009-12-12 00:56:47 +000016$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
Reid Spencer5f016e22007-07-11 17:01:13 +000017
18//===---------------------------------------------------------------------===//
19
20 C++ Template Instantiation benchmark:
21 http://users.rcn.com/abrahams/instantiation_speed/index.html
22
23//===---------------------------------------------------------------------===//
24
25TODO: 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 Hines176edba2014-12-01 14:53:08 -080037
Reid Spencer5f016e22007-07-11 17:01:13 +000038 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 Hines176edba2014-12-01 14:53:08 -080041 2. Instead of stat'ing the file in FileManager::getFile, check to see if
Reid Spencer5f016e22007-07-11 17:01:13 +000042 the dir has been read. If so, fail immediately, if not, read the dir,
43 then retry.
Andy Gibbsd77a0512012-10-18 15:24:46 +000044 3. Reading the dir uses the getdirentries syscall, creating a FileEntry
Reid Spencer5f016e22007-07-11 17:01:13 +000045 for all files found.
46
47//===---------------------------------------------------------------------===//
Ted Kremenekf4c45b02007-12-03 22:26:16 +000048// Specifying targets: -triple and -arch
Ken Dycka85ce8a2009-11-13 18:50:18 +000049//===---------------------------------------------------------------------===//
Ted Kremenekf4c45b02007-12-03 22:26:16 +000050
Chris Lattner177b1c72008-03-09 01:36:43 +000051The clang supports "-triple" and "-arch" options. At most one -triple and one
52-arch option may be specified. Both are optional.
Ted Kremenekf4c45b02007-12-03 22:26:16 +000053
54The "selection of target" behavior is defined as follows:
55
Chris Lattner177b1c72008-03-09 01:36:43 +000056(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 Hines176edba2014-12-01 14:53:08 -080058 specified triple.
Anders Carlsson3de54ff2008-03-13 03:45:48 +000059
60//===---------------------------------------------------------------------===//
61
62
Stephen Hines176edba2014-12-01 14:53:08 -080063verifyInputConstraint and verifyOutputConstraint should not return bool.
Anders Carlsson3de54ff2008-03-13 03:45:48 +000064
65Instead we should return something like:
66
67enum VerifyConstraintResult {
68 Valid,
Stephen Hines176edba2014-12-01 14:53:08 -080069
Anders Carlsson3de54ff2008-03-13 03:45:48 +000070 // Output only
71 OutputOperandConstraintLacksEqualsCharacter,
72 MatchingConstraintNotValidInOutputOperand,
73
74 // Input only
75 InputOperandConstraintContainsEqualsCharacter,
76 MatchingConstraintReferencesInvalidOperandNumber,
Stephen Hines176edba2014-12-01 14:53:08 -080077
Anders Carlsson3de54ff2008-03-13 03:45:48 +000078 // Both
79 PercentConstraintUsedWithLastOperand
80};
81
82//===---------------------------------------------------------------------===//
John McCalld46f7632011-07-28 07:41:22 +000083
84Blocks should not capture variables that are only used in dead code.
85
86The rule that we came up with is that blocks are required to capture
87variables if they're referenced in evaluated code, even if that code
88doesn't actually rely on the value of the captured variable.
89
90For example, this requires a capture:
91 (void) var;
92But this does not:
93 if (false) puts(var);
94
95Summary of <rdar://problem/9851835>: if we implement this, we should
96warn about non-POD variables that are referenced but not captured, but
97only if the non-reachability is not due to macro or template
98metaprogramming.
99
100//===---------------------------------------------------------------------===//
John McCall56ea3772012-03-30 04:25:03 +0000101
102We can still apply a modified version of the constructor/destructor
103delegation 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//===---------------------------------------------------------------------===//