• pecommon6.dll > The Phoenix Compiler and Tools Framework
  • The Phoenix Compiler and Tools Framework

    免费下载 下载该文档 文档格式:PPT   更新时间:2014-08-20   下载次数:0   点击次数:1
    The Phoenix Compiler and Tools Framework Andy AyersMicrosoft PhoenixAndyA@microsoft.com What is Phoenix? Phoenix is a codename for Microsoft's next-generation, state of the art infrastructure for program analysis and transformation Why Phoenix? VS Phoenix Goals An industry leading compilation and tools framework An infrastructure that is robustretargetableextensibleconfigurablescalable A rich ecosystem foracademic research and industrial users Overview PhoenixInfrastructure .Net CodeGen Runtime JITsPre-JITOO and .Net optimizations Native CodeGen Advanced C++/OO OptimizationsFP optimizationsOpenMP Retargetable "Machine Models"~3 months: -Od~3 months: -O2 Chip Vendor CDK ~6 month portsSample port + docs Academic RDK Managed API'sIP as DLLsDocs MSR & Partner Tools Built on Phoenix API'sBoth HL and LL API'sManaged API'sProgram AnalysisProgram Rewrite MSR Adv Lang Language ResearchDirect xfer to PhoenixResearch Insulated from code generation AST Tools Static Analysis ToolsNext Gen Front-EndsR/W Global Program Views Delphi Cobol HL Opts LL Opts Code Gen HL Opts LL Opts LL Opts HL Opts NativeImage C# Phoenix CoreAST IR Syms Types CFG SSA Xlator Formatter Browser Phx APIs Profiler Obfuscator Visualizer SecurityChecker Refactor Lint VB C++ IL assembly C++ PreFast Profile Eiffel C++ Phx AST Lex/Yacc Tiger Code Gen Compilers Tools Phoenix Architecture Core set of extensible classes to representIR, Symbols, Types, Graphs, Trees, RegionsLayered set of analysis and transformations componentsData Flow Analysis, Loops, Aliasing, Dead Code, Redundant Code, InliningCommon input/output library for binary formatsPE, LIB, OBJ, CIL, MSIL, PDB Driver (CL) Demo 1: Code Generation Microsoft C++ compilerInput: program textOutput: COFF object file C++Source Frontend(C1) Backend(C2) ObjFile We'll demo a Phoenix-based c2 IR States Phases transform IR, either within a state or from one state to another.For instance, Lower transforms MIR into LIR. Abstract Concrete Lowering Raising AST HIR MIR LIR EIR View inside Phoenix-Based C2 AST HIR MIR LIR EIR CIL ReaderType Checker MIR LowerSSA ConstSSA DestCanonAddr Modes LowerReg AllocEH LowerStack AllocFrame GenSwitch LowerBlock LayoutFlow Opts EncodeLister C2 C1 CIL SOURCE OBJECT Extending Phoenix All Phoenix clients can host plug-insPlug-ins canAdd new componentsExtend existing componentsReconfigure clientsExtensibility relies onReflectionEvents & Delegates Example: Uninitialized Local Detection Would like to warn the user that 'x' is not initialized before useTo do this we need to perform a dataflow analysis within the compilerWe'll add a phase to C2 to do this, via a plug-in int foo(){int x;return x;} Detecting an Uninitialized Use For each local variable vExamine all paths from the entry of the method to each use of vIf on every path v is not initialized before the use:v must be used before it is definedIf there is some path where v is not initialized before the use:v may be used before it is defined Build control flow graph, solve data flow problemUnknown is the "state of v" at start of each block:Transfer function relatesoutput of block to input:Meet combines outputs frompredecessor blocks Classic Solution start v = = v start v = =v Undefined Defined Mixed If block contains v= Else output = input must may Code sketch using dataflow bool changed = true;while (changed){ for each (Phx::Graphs::BasicBlock block in func)STATE ^ inState = inStates[block]; bool firstPred = true; for each(Phx::Graphs::BasicBlock predBlock in block->Predecessors)STATE ^ predState = outStates[predBlock]inState = meet(inState, predState)inStates[id] = inState; STATE ^ newOutState = gcnew STATE(inState); for each(Phx::IR::Instr ^ instr in block->Instrs)for each (Phx::IR::Opnd ^ opnd in instr->DstOpnds)Phx::Syms::LocalVarSym ^ localSym = opnd->Sym->AsLocalVarSym;newOutState[localSym] = dst(newOutState[localSym]STATE ^ outState = outStates[id]; bool blockChanged = ! equals(newOutState, outState); if (blockChanged)changed = true;outStates[id] = newOutState; Update input state Compute output state Check for convergence Demo: Unintialized Local Plug-In UninitializedLocal.cpp C++/CLI UninitialzedLocal.dll Test.cpp C1 Test.obj Phx-C2 To Run: cl -d2plugin: UninitializedLocal.dll -c Test.cpp Demo 3: Phoenix PE Explorer Phoenix can also read and write PE files directlyImplement your own compiler or linkerCreate post link tools for analysis, instrumentation or optimizationPhx-Explorer is only ~800 LOC client code on top of Phoenix core library Demo 4: Binary Rewriting mtrace injects tracing code into managed applications Phoenix IR vs MSIL Phoenix IR makes everything explicit:OperandsControl flowException handlingSide effectsMemory modelBetter format for analysis and transformationIdentical model for .Net and native codeMany analyses don't need to make a distinction Current Status RDKs released every 6 mos (May 06) with regular updates.Phoenix is now building Vista~15 universities engaged via academic programCode quality, code size, features, compile times not yet on par with the retail product (but closing ground fast). Recap Phoenix is a powerful and flexible framework for compilers & toolsC2 backend PE file read/write JIT & PreJIT (not shown)Universal plugins on a common IRYou can use the same components we use in your own work.Download available nowPrerequisite: VS2005 (VC++ Express will work, mostly)Evaluation license prohibits redist or commercial use More Info http://research.microsoft.com/phoenix Summary Phoenix is Microsoft's next-generation tools and code generation frameworkIt's written entirely in C++/CLIIt's available for you to experiment with now… Questions? http://research.microsoft.com/phoenixandya@microsoft.com
  • 下载地址 (推荐使用迅雷下载地址,速度快,支持断点续传)
  • 免费下载 PPT格式下载
  • 您可能感兴趣的
  • x3daudio16dll  xercesc26dll  x3daudio16dll下载  vba6dll  aclstl6dll  计算机丢失aclst6dll  winobj6dll  libstdc6dll  ac1st6dll  pecms6dll