Gabor Greif
2008-Apr-06 21:06 UTC
[LLVMdev] [HEADS-UP] API changes for <class Use> size reduction.
Hi all, with r49277 I have checked in the API changes for the first wave of modifications related to the size reduction of Use objects. Several creation methods take the place of the previously used "operator new". I have changed the llvm-gcc4.2 and clang projects, but if you have any llvm projects that tracks the SVN trunk of the API you will have to upgrade. in *tcsh* I have used scripts like this to do the transition: setenv CLASS BasicBlock setenv SUBST1 "s/new $CLASS/${CLASS}::Create/g" setenv SUBST2 "s/new llvm::$CLASS/llvm::${CLASS}::Create/g" foreach i (*.cpp) sed -e "$SUBST1" -e "$SUBST2" < $i > 2$i rm $i mv 2$i $i end for visiting all .cpp files in a tree you can use: foreach i (`find . -name "*.cpp"`) ... end The other classes off the top of my head: setenv CLASS Function setenv CLASS SwitchInst setenv CLASS PHINode setenv CLASS BranchInst setenv CLASS CallInst setenv CLASS ReturnInst setenv CLASS InvokeInst setenv CLASS GetElementPtrInst setenv CLASS SelectInst setenv CLASS InsertElementInst There are some false substitutions that arise this way, but it mostly works. Be sure to recompile. Below I give an (marginally tested) monster script that should transform all these classes at once in your whole tree. Be sure to only use it on a tree without modifications! Unfortunately there will be more API changes related to allocation and deallocation of objects, but these will be reviewed upfront on this mailing list, so you will be warned. I will try to make the transition as painless as possible. Cheers, Gabor ------------------------------------------------------------------------ -------------------- foreach CLASS (BasicBlock Function SwitchInst PHINode BranchInst CallInst ReturnInst InvokeInst GetElementPtrInst SelectInst InsertElementInst) setenv SUBST1 "s/new $CLASS/${CLASS}::Create/g" setenv SUBST2 "s/new llvm::$CLASS/llvm::${CLASS}::Create/g" foreach i (`find . -name "*.cpp"`) sed -e "$SUBST1" -e "$SUBST2" < $i > $i.2 rm $i mv $i.2 $i end foreach i (`find . -name "*.h"`) sed -e "$SUBST1" -e "$SUBST2" < $i > $i.2 rm $i mv $i.2 $i end end