ebook img

Compiler Optimizations for a Time-constrained Environment PDF

93 Pages·2008·0.54 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Compiler Optimizations for a Time-constrained Environment

Compiler Optimizations for a Time-constrained Environment Owen C. Anderson Prof. Susan Fox, First reader Prof. Libby Shoop, Second reader Prof. Andrew Beveridge, Third reader April,2008 DepartmentofMathematicsandComputerScience Copyright c 2008OwenC.Anderson. ! TheauthorgrantsMacalesterCollegethenonexclusiverighttomakethisworkavailablefornoncommer- cial,educationalpurposes,providedthatthiscopyrightstatementappearsonthereproducedmaterialsand notice is given that the copying is by permission of the author. To disseminate otherwise or to republish requireswrittenpermissionfromtheauthor. Abstract Overthelastseveraldecades,twoimportantshiftshavetakenplaceinthecomputingworld: first, thespeedofprocessorshasvastlyoutstrippedthespeedofmemory,makingmemoryaccessesby farthemostexpensiveoperationsthatatypicalsymbolicprogramperforms. Second,dynamically compiledlanguagessuchasJavaandC#havebecomepopular,placingnewpressuresoncompiler writerstocreateeffectivesystemsforrun-timecodegeneration. Thispaperaddressestheneedcreatedbythelaggingspeedsofmemoryaccessesinthecontext of dynamically compiled systems. In such systems memory access optimization is important for resultant program performance, but the compilation time required by most traditional memory access optimizations is prohibitively high for use in such contexts. In this paper, we present a newanalysis,memorydependenceanalysis,whichamortizesthecostofperformingmemoryaccess analysistoalevelthatisacceptablefordynamiccompilation. Inaddition,wepresenttwomemory access optimizations based on this new analysis, and present empirical evidence that using this approachresultsinsignificantlyimprovedcompilationtimeswithoutsignificantlossinresultant codequality. Contents Abstract iii Contents v ListofFigures vii ListofTables ix Acknowledgments xi 1 Introduction 1 1.1 ModernStaticOptimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 EvolutionofJust-in-TimeCompilation . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 PreviousWork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Implementation: LLVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 AliasAnalysis 7 2.1 ClassicalAliasAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 BasicAliasAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3 MemoryDependenceAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 DeadStoreElimination 13 3.1 ClassicalDeadStoreElimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2 FastDeadStoreElimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4 RedundantLoadElimination 19 4.1 GlobalCommonSubexpressionElimination. . . . . . . . . . . . . . . . . . . . . . . . 19 4.2 GlobalValueNumbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 vi Contents 5 Conclusions 25 5.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.2 FutureWork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Bibliography 29 CodeListing 31 List of Figures 1.1 Anexamplecontrol-flowgraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 AsimpleexampleinCandLLVMIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 Anexampleofmemorydependenceanalysis . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 Adiagramaticexampleoftheinternalsofmemorydependenceanalysis . . . . . . . 10 3.1 Anexamplewherethefirststoreispotentiallynecessary . . . . . . . . . . . . . . . . 13 3.2 Anexampleinwhichthefirststoreisdead . . . . . . . . . . . . . . . . . . . . . . . . 14 4.1 Anexamplewheretheloadisnotredundant . . . . . . . . . . . . . . . . . . . . . . . 20 4.2 Anexamplewheretheloadisredundant . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.3 Theresultofeliminatingaredundantload . . . . . . . . . . . . . . . . . . . . . . . . 21 5.1 Totaltimetoexecutetheoptimizationsinsecondsofthefourlargesttestcasesfrom SPEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.2 NormalizedexecutiontimeofthefourlargesttestcasesfromSPEC . . . . . . . . . . 26 List of Tables 2.1 ThenumberofaliasqueriesevaluatedontheSPECbenchmarks . . . . . . . . . . . . 11 3.1 ThenumberofstoresremovedontheSPECbenchmarks . . . . . . . . . . . . . . . . 16 4.1 ThenumberofloadsremovedontheSPECbenchmarks . . . . . . . . . . . . . . . . 23

Description:
He would also like to thank the entire LLVM community for their . of Java as a teaching and research platform, and the realization that its initial .. by most of the same issues that afflict dead store elimination, in that, in the face.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.