Hi all,
here comes the patch for the first wave of Use class size reduction.
I have split it into 3 files, corresponding to
- header changes
- implementation changes
- applications
This at the moment does not contain the description how the
size of the Use class will be reduced from 16 to 12 bytes,
I am going to send that in a separate patch.
This wave primarily consists of changes that are needed
to allocate objects with a variable number of embedded <Use>s.
Where the number of <Use>s is constant in the lifetime of an object,
I preferred to keep the 'new Instr(...)' syntax. Otherwise I have
introduced static 'Create(...)' methods, which are used instead of the
'new Instr(...)' construct. These replace the constructors and the
constructors become private/protected. The arguments of the 'Create'
methods are identical to the corresponding constructors.
Essentially at the moment all introduced 'operator new's end up calling
'::operator new(size_t)', so there should be no functionality change
at all.
This will change in subsequent waves.
At the moment of writing this my trunk working copy is at r48837,
I have used this command to do the merge:
svn merge http://llvm.org/svn/llvm-project/llvm/branches/ggreif/use-
diet at 48564 http://llvm.org/svn/llvm-project/llvm/branches/ggreif/use-
diet .
This is what it printed on the console:
U include/llvm/BasicBlock.h
U include/llvm/GlobalVariable.h
U include/llvm/Support/LLVMBuilder.h
U include/llvm/Instructions.h
U include/llvm/GlobalAlias.h
U include/llvm/Constants.h
U include/llvm/User.h
U include/llvm/InstrTypes.h
U include/llvm/Function.h
U tools/bugpoint/CrashDebugger.cpp
U tools/bugpoint/Miscompilation.cpp
U lib/Analysis/ScalarEvolutionExpander.cpp
U lib/CodeGen/ShadowStackCollector.cpp
U lib/CodeGen/IntrinsicLowering.cpp
U lib/Linker/LinkModules.cpp
U lib/Target/X86/X86TargetAsmInfo.cpp
U lib/Bitcode/Reader/BitcodeReader.cpp
U lib/ExecutionEngine/JIT/JIT.cpp
U lib/VMCore/Instructions.cpp
U lib/VMCore/Constants.cpp
U lib/VMCore/AutoUpgrade.cpp
U lib/VMCore/Function.cpp
U lib/VMCore/Module.cpp
U lib/VMCore/Core.cpp
U lib/VMCore/BasicBlock.cpp
U lib/AsmParser/llvmAsmParser.y
U lib/AsmParser/llvmAsmParser.cpp.cvs
U lib/AsmParser/llvmAsmParser.h.cvs
U lib/AsmParser/llvmAsmParser.y.cvs
U lib/Transforms/Utils/LowerInvoke.cpp
U lib/Transforms/Utils/LCSSA.cpp
U lib/Transforms/Utils/CodeExtractor.cpp
U lib/Transforms/Utils/CloneModule.cpp
U lib/Transforms/Utils/CloneFunction.cpp
U lib/Transforms/Utils/BreakCriticalEdges.cpp
U lib/Transforms/Utils/LowerSwitch.cpp
U lib/Transforms/Utils/SimplifyCFG.cpp
U lib/Transforms/Utils/BasicBlockUtils.cpp
U lib/Transforms/Utils/LowerAllocations.cpp
U lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
U lib/Transforms/Utils/InlineFunction.cpp
U lib/Transforms/Utils/LoopSimplify.cpp
U lib/Transforms/Utils/PromoteMemoryToRegister.cpp
U lib/Transforms/Utils/Local.cpp
U lib/Transforms/Instrumentation/RSProfiling.cpp
U lib/Transforms/Instrumentation/ProfilingUtils.cpp
U lib/Transforms/Scalar/LoopUnswitch.cpp
U lib/Transforms/Scalar/IndVarSimplify.cpp
U lib/Transforms/Scalar/GVNPRE.cpp
U lib/Transforms/Scalar/InstructionCombining.cpp
U lib/Transforms/Scalar/SimplifyCFG.cpp
U lib/Transforms/Scalar/TailRecursionElimination.cpp
U lib/Transforms/Scalar/LoopIndexSplit.cpp
U lib/Transforms/Scalar/LoopStrengthReduce.cpp
U lib/Transforms/Scalar/GCSE.cpp
U lib/Transforms/Scalar/ScalarReplAggregates.cpp
U lib/Transforms/Scalar/SCCP.cpp
U lib/Transforms/Scalar/LoopRotation.cpp
U lib/Transforms/Scalar/GVN.cpp
U lib/Transforms/Scalar/ADCE.cpp
U lib/Transforms/IPO/IndMemRemoval.cpp
U lib/Transforms/IPO/SimplifyLibCalls.cpp
U lib/Transforms/IPO/PruneEH.cpp
U lib/Transforms/IPO/StructRetPromotion.cpp
U lib/Transforms/IPO/ExtractGV.cpp
U lib/Transforms/IPO/LowerSetJmp.cpp
Skipped missing target: 'lib/Transforms/IPO/ExtractFunction.cpp'
U lib/Transforms/IPO/GlobalOpt.cpp
U lib/Transforms/IPO/DeadArgumentElimination.cpp
U lib/Transforms/IPO/ArgumentPromotion.cpp
U lib/Transforms/IPO/RaiseAllocations.cpp
U examples/BrainF/BrainF.cpp
U examples/BrainF/BrainFDriver.cpp
U examples/ParallelJIT/ParallelJIT.cpp
U examples/HowToUseJIT/HowToUseJIT.cpp
U examples/ModuleMaker/ModuleMaker.cpp
U examples/Fibonacci/fibonacci.cpp
Notes:
- I shall take the *.cvs files out of the patch.
- lib/Transforms/IPO/ExtractFunction.cpp seems to have been deleted
from trunk
- GVN.cpp had a compile error due to changes --> I had to manually
change the file
emacs +1224 lib/Transforms/Scalar/GVN.cpp
emacs +1231 lib/Transforms/Scalar/GVN.cpp
- the patch is pretty dull, mostly mechanical changes
- r48837 + this patch builds and the tests run without errors
- I have omitted Create-ifying llvm-upgrade, as it is not on trunk
any more
- Some statistics:
ggreif$ svn diff include > wave1-include.diff
ggreif$ svn diff lib > wave1-lib.diff
ggreif$ svn diff examples tools > wave1-rest.diff
ggreif$ wc *.diff
798 3883 33028 wave1-include.diff
3894 16494 179719 wave1-lib.diff
441 1769 18291 wave1-rest.diff
5133 22146 231038 total
- I cared about
o Tab-freeness
o correct re-indentation
- I did not (yet) care about the 80-column regime
- the explanation of my wave nomenclature is here:
svn cat http(s)://llvm.org/svn/llvm-project/llvm/branches/ggreif/
README
Cheers,
Gabor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wave1-include.diff
Type: application/octet-stream
Size: 33028 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080326/4170df6b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wave1-lib.diff
Type: application/octet-stream
Size: 179719 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080326/4170df6b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wave1-rest.diff
Type: application/octet-stream
Size: 18291 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080326/4170df6b/attachment-0002.obj>
-------------- next part --------------
On Mar 26, 2008, at 3:16 PM, Gabor Greif wrote:> here comes the patch for the first wave of Use class size reduction. > > I have split it into 3 files, corresponding to > - header changes > - implementation changes > - applicationsnice!> This at the moment does not contain the description how the > size of the Use class will be reduced from 16 to 12 bytes, > I am going to send that in a separate patch.Right, sounds great.> This wave primarily consists of changes that are needed > to allocate objects with a variable number of embedded <Use>s.Ok.> Where the number of <Use>s is constant in the lifetime of an object, > I preferred to keep the 'new Instr(...)' syntax. Otherwise I have > introduced static 'Create(...)' methods, which are used instead of the > 'new Instr(...)' construct.The bad thing about this is that it is inconsistent. I'd prefer to have consistent use of ::Create for all IR classes to make it easier to learn the API. That said, a temporary moment of inconsistency is ok: you could commit this part, then switch the remaining classes over.> These replace the constructors and the > constructors become private/protected. The arguments of the 'Create' > methods are identical to the corresponding constructors. > Essentially at the moment all introduced 'operator new's end up > calling > '::operator new(size_t)', so there should be no functionality change > at all. > This will change in subsequent waves.This basically looks good, some thoughts for the future: 1) Please (eventually) don't make the 'operator new' override be public. I'd actually prefer all memory alloc/dealloc stuff to be done privately to the (vmcore) .cpp files, not exposed through the header. 2) Eventually we'll need to make the dtor private as well. 3) Make sure that make check and some reasonable subset of llvm-test passes with this patch :) Finally, please update llvm-gcc 4.2 as well when you commit this. I'll update clang after you commit. When you commit, please email llvmdev/commits with an email that says "API CHANGE" in the subject line with info on how to upgrade out-of- tree projects (e.g. vmkit). Thanks Gabor! -Chris