blob: 53f35a01863ac70bda0097048162f6d368d269e2 [file] [log] [blame]
Chris Lattner58360332006-10-14 19:53:48 +00001//===---------------------------------------------------------------------===//
2// Random Notes
3//===---------------------------------------------------------------------===//
4
Chris Lattner58360332006-10-14 19:53:48 +00005//===---------------------------------------------------------------------===//
Chris Lattnerecc6fc52006-07-04 19:29:50 +00006
7To time GCC preprocessing speed without output, use:
Chris Lattnerecbf7b42006-07-05 00:08:00 +00008 "time gcc -MM file"
Chris Lattnerbfe98602006-10-14 17:39:56 +00009This is similar to -Eonly.
10
Chris Lattner972347d2009-01-16 19:33:59 +000011//===---------------------------------------------------------------------===//
12
Duncan Sands86f86f52010-07-07 07:49:17 +000013Creating and using a PTH file for performance measurement (use a release build).
Chris Lattner972347d2009-01-16 19:33:59 +000014
John McCall86a69492009-09-24 22:03:45 +000015$ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
Daniel Dunbar3c6d1b52009-12-12 00:56:47 +000016$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
Chris Lattnerbacf0bf2006-11-08 05:53:27 +000017
18//===---------------------------------------------------------------------===//
19
20 C++ Template Instantiation benchmark:
21 http://users.rcn.com/abrahams/instantiation_speed/index.html
22
Chris Lattnerbfe98602006-10-14 17:39:56 +000023//===---------------------------------------------------------------------===//
Chris Lattnerdb878cd2006-07-10 06:34:50 +000024
Chris Lattnerf78e6032006-11-05 17:54:43 +000025TODO: File Manager Speedup:
Chris Lattnerdb878cd2006-07-10 06:34:50 +000026
Chris Lattnerf78e6032006-11-05 17:54:43 +000027 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.
Pavel Chupin10a84042014-07-13 17:11:45 +000037
Chris Lattnerf78e6032006-11-05 17:54:43 +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.
Pavel Chupin10a84042014-07-13 17:11:45 +000041 2. Instead of stat'ing the file in FileManager::getFile, check to see if
Chris Lattnerf78e6032006-11-05 17:54:43 +000042 the dir has been read. If so, fail immediately, if not, read the dir,
43 then retry.
Andy Gibbs40808192012-10-18 15:24:46 +000044 3. Reading the dir uses the getdirentries syscall, creating a FileEntry
Chris Lattnerf78e6032006-11-05 17:54:43 +000045 for all files found.
46
47//===---------------------------------------------------------------------===//
Ted Kremenek8cdc08e2007-12-03 22:26:16 +000048// Specifying targets: -triple and -arch
Ken Dyck8d6d4b842009-11-13 18:50:18 +000049//===---------------------------------------------------------------------===//
Ted Kremenek8cdc08e2007-12-03 22:26:16 +000050
Chris Lattnere4a6b182008-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 Kremenek8cdc08e2007-12-03 22:26:16 +000053
54The "selection of target" behavior is defined as follows:
55
Chris Lattnere4a6b182008-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
Pavel Chupin10a84042014-07-13 17:11:45 +000058 specified triple.
Anders Carlsson8ec6a6f2008-03-13 03:45:48 +000059
60//===---------------------------------------------------------------------===//
61
62
Pavel Chupin10a84042014-07-13 17:11:45 +000063verifyInputConstraint and verifyOutputConstraint should not return bool.
Anders Carlsson8ec6a6f2008-03-13 03:45:48 +000064
65Instead we should return something like:
66
67enum VerifyConstraintResult {
68 Valid,
Pavel Chupin10a84042014-07-13 17:11:45 +000069
Anders Carlsson8ec6a6f2008-03-13 03:45:48 +000070 // Output only
71 OutputOperandConstraintLacksEqualsCharacter,
72 MatchingConstraintNotValidInOutputOperand,
73
74 // Input only
75 InputOperandConstraintContainsEqualsCharacter,
76 MatchingConstraintReferencesInvalidOperandNumber,
Pavel Chupin10a84042014-07-13 17:11:45 +000077
Anders Carlsson8ec6a6f2008-03-13 03:45:48 +000078 // Both
79 PercentConstraintUsedWithLastOperand
80};
81
82//===---------------------------------------------------------------------===//
John McCallfabe0792011-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 McCall88313032012-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//===---------------------------------------------------------------------===//