1*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 2*f4a2713aSLionel Sambuc// Random Notes 3*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel SambucTo time GCC preprocessing speed without output, use: 8*f4a2713aSLionel Sambuc "time gcc -MM file" 9*f4a2713aSLionel SambucThis is similar to -Eonly. 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel SambucCreating and using a PTH file for performance measurement (use a release build). 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc$ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache 16*f4a2713aSLionel Sambuc$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc C++ Template Instantiation benchmark: 21*f4a2713aSLionel Sambuc http://users.rcn.com/abrahams/instantiation_speed/index.html 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel SambucTODO: File Manager Speedup: 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc We currently do a lot of stat'ing for files that don't exist, particularly 28*f4a2713aSLionel Sambuc when lots of -I paths exist (e.g. see the <iostream> example, check for 29*f4a2713aSLionel Sambuc failures in stat in FileManager::getFile). It would be far better to make 30*f4a2713aSLionel Sambuc the following changes: 31*f4a2713aSLionel Sambuc 1. FileEntry contains a sys::Path instead of a std::string for Name. 32*f4a2713aSLionel Sambuc 2. sys::Path contains timestamp and size, lazily computed. Eliminate from 33*f4a2713aSLionel Sambuc FileEntry. 34*f4a2713aSLionel Sambuc 3. File UIDs are created on request, not when files are opened. 35*f4a2713aSLionel Sambuc These changes make it possible to efficiently have FileEntry objects for 36*f4a2713aSLionel Sambuc files that exist on the file system, but have not been used yet. 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc Once this is done: 39*f4a2713aSLionel Sambuc 1. DirectoryEntry gets a boolean value "has read entries". When false, not 40*f4a2713aSLionel Sambuc all entries in the directory are in the file mgr, when true, they are. 41*f4a2713aSLionel Sambuc 2. Instead of stat'ing the file in FileManager::getFile, check to see if 42*f4a2713aSLionel Sambuc the dir has been read. If so, fail immediately, if not, read the dir, 43*f4a2713aSLionel Sambuc then retry. 44*f4a2713aSLionel Sambuc 3. Reading the dir uses the getdirentries syscall, creating a FileEntry 45*f4a2713aSLionel Sambuc for all files found. 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 48*f4a2713aSLionel Sambuc// Specifying targets: -triple and -arch 49*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel SambucThe clang supports "-triple" and "-arch" options. At most one -triple and one 52*f4a2713aSLionel Sambuc-arch option may be specified. Both are optional. 53*f4a2713aSLionel Sambuc 54*f4a2713aSLionel SambucThe "selection of target" behavior is defined as follows: 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc(1) If the user does not specify -triple, we default to the host triple. 57*f4a2713aSLionel Sambuc(2) If the user specifies a -arch, that overrides the arch in the host or 58*f4a2713aSLionel Sambuc specified triple. 59*f4a2713aSLionel Sambuc 60*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel SambucverifyInputConstraint and verifyOutputConstraint should not return bool. 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel SambucInstead we should return something like: 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambucenum VerifyConstraintResult { 68*f4a2713aSLionel Sambuc Valid, 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc // Output only 71*f4a2713aSLionel Sambuc OutputOperandConstraintLacksEqualsCharacter, 72*f4a2713aSLionel Sambuc MatchingConstraintNotValidInOutputOperand, 73*f4a2713aSLionel Sambuc 74*f4a2713aSLionel Sambuc // Input only 75*f4a2713aSLionel Sambuc InputOperandConstraintContainsEqualsCharacter, 76*f4a2713aSLionel Sambuc MatchingConstraintReferencesInvalidOperandNumber, 77*f4a2713aSLionel Sambuc 78*f4a2713aSLionel Sambuc // Both 79*f4a2713aSLionel Sambuc PercentConstraintUsedWithLastOperand 80*f4a2713aSLionel Sambuc}; 81*f4a2713aSLionel Sambuc 82*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 83*f4a2713aSLionel Sambuc 84*f4a2713aSLionel SambucBlocks should not capture variables that are only used in dead code. 85*f4a2713aSLionel Sambuc 86*f4a2713aSLionel SambucThe rule that we came up with is that blocks are required to capture 87*f4a2713aSLionel Sambucvariables if they're referenced in evaluated code, even if that code 88*f4a2713aSLionel Sambucdoesn't actually rely on the value of the captured variable. 89*f4a2713aSLionel Sambuc 90*f4a2713aSLionel SambucFor example, this requires a capture: 91*f4a2713aSLionel Sambuc (void) var; 92*f4a2713aSLionel SambucBut this does not: 93*f4a2713aSLionel Sambuc if (false) puts(var); 94*f4a2713aSLionel Sambuc 95*f4a2713aSLionel SambucSummary of <rdar://problem/9851835>: if we implement this, we should 96*f4a2713aSLionel Sambucwarn about non-POD variables that are referenced but not captured, but 97*f4a2713aSLionel Sambuconly if the non-reachability is not due to macro or template 98*f4a2713aSLionel Sambucmetaprogramming. 99*f4a2713aSLionel Sambuc 100*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 101*f4a2713aSLionel Sambuc 102*f4a2713aSLionel SambucWe can still apply a modified version of the constructor/destructor 103*f4a2713aSLionel Sambucdelegation optimization in cases of virtual inheritance where: 104*f4a2713aSLionel Sambuc - there is no function-try-block, 105*f4a2713aSLionel Sambuc - the constructor signature is not variadic, and 106*f4a2713aSLionel Sambuc - the parameter variables can safely be copied and repassed 107*f4a2713aSLionel Sambuc to the base constructor because either 108*f4a2713aSLionel Sambuc - they have not had their addresses taken by the vbase initializers or 109*f4a2713aSLionel Sambuc - they were passed indirectly. 110*f4a2713aSLionel Sambuc 111*f4a2713aSLionel Sambuc//===---------------------------------------------------------------------===// 112