Introduction to the LLVM Compiler System

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

IntroductiontotheLLVMCompilerSystemChrisLattnerllvm.orgArchitectNovember4,2008ACAT’08-Erice,Sicily•Collectionofindustrialstrengthcompilertechnology■OptimizerandCodeGenerator■llvm-gccandClangFront-ends■MSILand.NETVirtualMachines•Collectionofindustrialstrengthcompilertechnology■OptimizerandCodeGenerator■llvm-gccandClangFront-ends■MSILand.NETVirtualMachines•OpenSourceProjectwithmanycontributors■Industry,ResearchGroups,Individuals://llvm.orgWhyNewCompilers?•ExistingOpenSourceCCompilershaveStagnated!•ExistingOpenSourceCCompilershaveStagnated!•How?■Basedondecadesoldcodegenerationtechnology■Nomoderntechniqueslikecross-fileoptimizationandJITcodegen■Agingcodebases:difficulttolearn,hardtochangesubstantially■Can’tbereusedinotherapplications■Keepgettingslowerwitheveryrelease!!•Asetofproduction-qualityreusablelibraries:■...whichimplementthebestknowntechniquesdrawingfrommodernliterature■...whichfocusoncompiletime■...andperformanceofthegeneratedcode•Ideallysupportmanydifferentlanguagesandapplications!•Primarymission:buildasetofmodularcompilercomponents:■Reducesthetime&costtoconstructaparticularcompiler■Componentsaresharedacrossdifferentcompilers■AllowschoiceoftherightcomponentforthejobCoreOptznxformsX86SupportCodegenTargetPPCDWARFanalysisLTOlinkerLLIOBCIOSystemCBEGCIPOGCCJITclang.........•Primarymission:buildasetofmodularcompilercomponents:■Reducesthetime&costtoconstructaparticularcompiler■Componentsaresharedacrossdifferentcompilers■Allowschoiceoftherightcomponentforthejob•Secondarymission:Buildcompilersoutofthesecomponents■...forexample,atrulygreatCcompiler■...forexample,aruntimespecializationengineCoreOptznxformsX86SupportCodegenTargetPPCDWARFanalysisLTOlinkerLLIOBCIOSystemCBEGCIPOGCCJITclang.........•IntroandMotivation•LLVMasaCandC++Compiler•OtherLLVMCapabilities•GoingForward•C,C++,ObjectiveC,AdaandFortran•StandardGCCcommandlineoptions•SupportsalmostallGCClanguagefeaturesandextensions•Supportsmanytargets,includingX86,X86-64,PowerPC,etc.•ExtremelycompatiblewithGCC4.2•C,C++,ObjectiveC,AdaandFortran•StandardGCCcommandlineoptions•SupportsalmostallGCClanguagefeaturesandextensions•Supportsmanytargets,includingX86,X86-64,PowerPC,etc.•ExtremelycompatiblewithGCC4.2WhatdoesitmeantobebothLLVMandGCC?•ReplaceGCCoptimizerandcodegeneratorwithLLVM■ReusesGCCparserandruntimelibraries.sfileGCC4.2Front-endGCCOptimizerGCCCodeGeneratorGCC4.2CC++...•ReplaceGCCoptimizerandcodegeneratorwithLLVM■ReusesGCCparserandruntimelibrariesLLVMGCC4.2LLVMOptimizerLLVMCodeGeneratorGCC4.2Front-endCC++....sfile.sfileGCC4.2Front-endGCCOptimizerGCCCodeGeneratorGCC4.2CC++...•Safetomixandmatch.ofilesbetweencompilers•SafetocallintolibrariesbuiltwithothercompilersDiskStorageb.cllvm-gcc-O3gcc-O2a.c.ofiles•Safetomixandmatch.ofilesbetweencompilers•SafetocallintolibrariesbuiltwithothercompilersDiskStorageb.cllvm-gcc-O3gcc-O2a.c.ofiles•Safetomixandmatch.ofilesbetweencompilers•SafetocallintolibrariesbuiltwithothercompilersDiskStorageb.cllvm-gcc-O3gcc-O2a.cLinkerexe.ofiles•GeneratedCode■Howfastdoesthecoderun?•GeneratedCode■Howfastdoesthecoderun?•CompileTimes■Howfastcanwegetcodefromthecompiler?•GeneratedCode■Howfastdoesthecoderun?•CompileTimes■Howfastcanwegetcodefromthecompiler?•NewFeatures•GeneratedCode■Howfastdoesthecoderun?•CompileTimes■Howfastcanwegetcodefromthecompiler?•NewFeaturesLinkTimeOptimization•Optimize(e.g.inline,constantfold,etc)acrossfileswith-O4•Optimizeacrosslanguageboundariestoo!DiskStorageb.cllvm-gcc-O4gcc-O3a.cLinker.ofilesexe•Optimize(e.g.inline,constantfold,etc)acrossfileswith-O4•Optimizeacrosslanguageboundariestoo!DiskStorageb.cc.cllvm-gcc-O4llvm-gcc-O4gcc-O3a.cLinker.ofilesexe•Optimize(e.g.inline,constantfold,etc)acrossfileswith-O4•Optimizeacrosslanguageboundariestoo!DiskStorageb.cc.cllvm-gcc-O4llvm-gcc-O4gcc-O3a.cLinker.ofilesexe•Optimize(e.g.inline,constantfold,etc)acrossfileswith-O4•Optimizeacrosslanguageboundariestoo!DiskStorageb.cd.cppllvm-g++-O4c.cllvm-gcc-O4llvm-gcc-O4gcc-O3a.cLinker.ofilesexe://llvm.orgSPECINT2000CompileTime-O0

1 / 55
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功