资源描述:
《GCC Internals and Porting》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、GCCInternalsandPortingHelloGccWorkshopOctober24,2009MingjieXingjoefoxreal@gmail.comOutline➢GettingStarted➢Overview➢Compilation,SourceTree,InternalFramework➢FrontEnd➢LanguageHooks,CParser,Tree&GENERIC➢MiddleEnd➢GIMPLE,CallGraph,Passes➢BackEnd&Port➢RTL,MD,TargetMacrosHelloGccWorkshop2009GCCI
2、nternalsandPorting-2GettingStartedhttp://gcc.gnu.org/wiki/GettingStarted➢Tutorials,HOWTOs➢GCCInternalsPodcast-Englishlistening:)➢GCCInternalsTutorial-Verydetailed!➢WorkshoponGCCInternals-Spimport➢InternalDocumentation➢GCCInternals➢DealingWiththeSourceCode➢Debugging,Testing,Writingpass/fron
3、t-end/back-end➢StructureofGCC➢Frontend,Tree/RTLOptimizers,PassesHelloGccWorkshop2009GCCInternalsandPorting-3Overview➢Compilation➢SourceTree➢InternalFrameworkHelloGccWorkshop2009GCCInternalsandPorting-4Compilation➢gccdriverhello.c➢Processspecstrings:gcc.c➢$gcc-dumpspecscc1➢cc1➢Entrypoint:to
4、plev_main,toplev.cgccas➢Sametocc1plus,jc1,f771,etc.collect2➢collect2➢Reallinker:lda.out➢Handleinitializationfunctions:main→__main→constructors$gcc-vhello.cHelloGccWorkshop2009GCCInternalsandPorting-5SourceTreeboehm-gcadaalpha*.mdconfigconfigarc*.hcontribcparm*.cfixincludesdocmips*.optgccfo
5、rtran...t-*➢librariesgcc-4.4.0INSTALLgincludex-*➢front-endslibgccjava...➢middle-endobjc➢back-endlibada➢portslibgfortranobjcplibjavapo...testsuiteHelloGccWorkshop2009GCCInternalsandPorting-6*.c/*.h...GCCGrowthFromDiegoNovillo'sSlidesHelloGccWorkshop2009GCCInternalsandPorting-7InternalFramew
6、orkFromDiegoNovillo'sSlidesHelloGccWorkshop2009GCCInternalsandPorting-8FrontEnd➢LanguageHooks➢CParser➢Tree&GENERICHelloGccWorkshop2009GCCInternalsandPorting-9LanguageHooks➢Definethestructure➢Definespecificfunctionsstructlang_hooks{bool...c_objc_common_init(void)}/*langhooks.h*/{...➢Defined
7、efaultfunctions}/*c-opts.c*/bool/*alsoinc-common.c,c-decl.c*/hook_bool_void_false(void){➢Declarethevariable&Initializereturnfalse;}/*langhooks.c*/#include"c-objc-common.h"➢Definethedefaultinitializer#undefLANG_HOOKS_NAME#defineLANG_HOOKS_NAME"GNUunknown"#defin